Top Description Inners Fields Constructors Methods
jogamp.nativewindow.x11

public Class X11Util

extends Object
implements ToolkitProperties
Class Inheritance
All Implemented Interfaces
jogamp.nativewindow.ToolkitProperties
Imports
java.util.ArrayList, .HashMap, .List, com.jogamp.nativewindow.AbstractGraphicsDevice, .NativeWindowException, .NativeWindowFactory, jogamp.nativewindow.Debug, .NWJNILibLoader, .ToolkitProperties, com.jogamp.common.ExceptionUtils, com.jogamp.common.util.LongObjectHashMap, .PropertyAccess, com.jogamp.nativewindow.x11.X11GraphicsDevice

Contains a thread safe X11 utility to retrieve display connections.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class

Field Summary

Modifier and TypeField and Description
public static final boolean
ATI_HAS_MULTITHREADING_BUG

See Bug 623 - https://jogamp.org/bugzilla/show_bug.cgi?id=623

public static final boolean
ATI_HAS_XCLOSEDISPLAY_BUG

See Bug 515 - https://jogamp.org/bugzilla/show_bug.cgi?id=515

It is observed that ATI X11 drivers, eg.

public static final boolean
private static final HashMap<String, Boolean>
private static Object
public static final boolean
private static boolean
private static volatile boolean
private static boolean
private static String
private static List<X11Util.NamedDisplay>
private static LongObjectHashMap
private static List<X11Util.NamedDisplay>
private static List<X11Util.NamedDisplay>
private static final Object
private static final boolean
private static final String
private static final String
public static final boolean
pack-priv static volatile boolean
pack-priv static long
pack-priv static long
public static final boolean

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static void
closeDisplay(final long handle)

private static int

Returns:

number of closed Display connections
closePendingDisplayConnections
()

Closing pending Display connections in original creation order, if getMarkAllDisplaysUnclosable() is true.

public static void
public static void
private static final void
private static final String
public static boolean
public static X11Util.NamedDisplay
getNamedDisplay(final long handle)

public static String
public static int
public static int
public static int
public static final boolean
private static native boolean
initialize0(boolean debug)

public static void
public static void
public static boolean
markDisplayUncloseable(final long handle)

public static long
openDisplay(String name)

Returns a created or reused named display.

public static final boolean
public static void
setX11ErrorHandler(final boolean onoff, final boolean quiet)

private static native void
setX11ErrorHandler0(boolean onoff, boolean quiet)

public static void
shutdown()

Cleanup resources.

private static native void
public static String

Returns:

If name is null, it returns the previous queried NULL display name, otherwise the name.
validateDisplayName
(final String name)

public static String
validateDisplayName(String name, final long handle)

public static int
XCloseDisplay(final long display)

public static boolean
public static boolean
XineramaIsEnabled(final long displayHandle)

public static long
XOpenDisplay(final String arg0)

Locked X11Lib wrapped functions

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

ATI_HAS_MULTITHREADING_BUGback to summary
public static final boolean ATI_HAS_MULTITHREADING_BUG

See Bug 623 - https://jogamp.org/bugzilla/show_bug.cgi?id=623

ATI_HAS_XCLOSEDISPLAY_BUGback to summary
public static final boolean ATI_HAS_XCLOSEDISPLAY_BUG

See Bug 515 - https://jogamp.org/bugzilla/show_bug.cgi?id=515

It is observed that ATI X11 drivers, eg.

  • fglrx 8.78.6,
  • fglrx 11.08/8.881 and
  • fglrx 11.11/8.911
are quite sensitive to multiple Display connections.

With the above drivers closing displays shall happen in the same order as they were opened, or shall not be closed at all! If closed, some driver related bug appears and brings down the JVM.

You may test this, ie just reverse the destroy order below. See also native test: jogl/test-native/displayMultiple02.c

Workaround is to not close them at all if driver vendor is ATI during operation.

With ATI X11 drivers all connections must be closed at JVM shutdown, otherwise a SIGSEGV (after JVM safepoint) will be caused.

DEBUGback to summary
public static final boolean DEBUG
displayXineramaEnabledMapback to summary
private static final HashMap<String, Boolean> displayXineramaEnabledMap
globalLockback to summary
private static Object globalLock
HAS_XCLOSEDISPLAY_BUGback to summary
public static final boolean HAS_XCLOSEDISPLAY_BUG

See ATI_HAS_XCLOSEDISPLAY_BUG.

hasThreadingIssuesback to summary
private static boolean hasThreadingIssues
isInitback to summary
private static volatile boolean isInit
markAllDisplaysUnclosableback to summary
private static boolean markAllDisplaysUnclosable
nullDisplayNameback to summary
private static String nullDisplayName
openDisplayListback to summary
private static List<X11Util.NamedDisplay> openDisplayList
openDisplayMapback to summary
private static LongObjectHashMap openDisplayMap
pendingDisplayListback to summary
private static List<X11Util.NamedDisplay> pendingDisplayList
reusableDisplayListback to summary
private static List<X11Util.NamedDisplay> reusableDisplayList
setX11ErrorHandlerLockback to summary
private static final Object setX11ErrorHandlerLock
TRACE_DISPLAY_LIFECYCLEback to summary
private static final boolean TRACE_DISPLAY_LIFECYCLE
X11_EXTENSION_ATIFGLEXTENSIONback to summary
private static final String X11_EXTENSION_ATIFGLEXTENSION
X11_EXTENSION_ATIFGLRXDRIback to summary
private static final String X11_EXTENSION_ATIFGLRXDRI
XERROR_STACKDUMPback to summary
public static final boolean XERROR_STACKDUMP
XineramaFetchedback to summary
pack-priv static volatile boolean XineramaFetched
XineramaLibHandleback to summary
pack-priv static long XineramaLibHandle
XineramaQueryFuncback to summary
pack-priv static long XineramaQueryFunc
XSYNC_ENABLEDback to summary
public static final boolean XSYNC_ENABLED

Constructor Detail

X11Utilback to summary
private X11Util()

Method Detail

closeDisplayback to summary
public static void closeDisplay(final long handle)
closePendingDisplayConnectionsback to summary
private static int closePendingDisplayConnections()

Closing pending Display connections in original creation order, if getMarkAllDisplaysUnclosable() is true.

Returns:int

number of closed Display connections

dumpOpenDisplayConnectionsback to summary
public static void dumpOpenDisplayConnections()
dumpPendingDisplayConnectionsback to summary
public static void dumpPendingDisplayConnections()
dumpStackback to summary
private static final void dumpStack()
getCurrentThreadNameback to summary
private static final String getCurrentThreadName()
getMarkAllDisplaysUnclosableback to summary
public static boolean getMarkAllDisplaysUnclosable()
getNamedDisplayback to summary
public static X11Util.NamedDisplay getNamedDisplay(final long handle)
getNullDisplayNameback to summary
public static String getNullDisplayName()
getOpenDisplayConnectionNumberback to summary
public static int getOpenDisplayConnectionNumber()
getPendingDisplayConnectionNumberback to summary
public static int getPendingDisplayConnectionNumber()
getReusableDisplayConnectionNumberback to summary
public static int getReusableDisplayConnectionNumber()
hasThreadingIssuesback to summary
public static final boolean hasThreadingIssues()

Called by NativeWindowFactory#initSingleton()

See Also
ToolkitProperties
initialize0back to summary
private static native boolean initialize0(boolean debug)
initSingletonback to summary
public static void initSingleton()

Called by NativeWindowFactory#initSingleton()

See Also
ToolkitProperties
markAllDisplaysUnclosableback to summary
public static void markAllDisplaysUnclosable()
markDisplayUncloseableback to summary
public static boolean markDisplayUncloseable(final long handle)
openDisplayback to summary
public static long openDisplay(String name)

Returns a created or reused named display.

requiresToolkitLockback to summary
public static final boolean requiresToolkitLock()

Called by NativeWindowFactory#initSingleton()

See Also
ToolkitProperties
setX11ErrorHandlerback to summary
public static void setX11ErrorHandler(final boolean onoff, final boolean quiet)
setX11ErrorHandler0back to summary
private static native void setX11ErrorHandler0(boolean onoff, boolean quiet)
shutdownback to summary
public static void shutdown()

Cleanup resources.

Called by NativeWindowFactory#shutdown()

See Also
ToolkitProperties
shutdown0back to summary
private static native void shutdown0()
validateDisplayNameback to summary
public static String validateDisplayName(final String name)
Returns:String

If name is null, it returns the previous queried NULL display name, otherwise the name.

validateDisplayNameback to summary
public static String validateDisplayName(String name, final long handle)
XCloseDisplayback to summary
public static int XCloseDisplay(final long display)
XineramaIsEnabledback to summary
public static boolean XineramaIsEnabled(final X11GraphicsDevice device)
XineramaIsEnabledback to summary
public static boolean XineramaIsEnabled(final long displayHandle)
XOpenDisplayback to summary
public static long XOpenDisplay(final String arg0)

Locked X11Lib wrapped functions

jogamp.nativewindow.x11 back to summary

public Class X11Util.NamedDisplay

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv Throwable
pack-priv final long
pack-priv final int
pack-priv final String
pack-priv int
pack-priv boolean

Constructor Summary

AccessConstructor and Description
protected
NamedDisplay(final String name, final long handle)

Method Summary

Modifier and TypeMethod and Description
public final void
public final boolean
equals(final Object
the reference object with which to compare.
obj
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.
public final Throwable
public final long
public final String
public final int
public final int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.
public final boolean
public final void
public final void
setUncloseable(final boolean v)

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

creationStackback to summary
pack-priv Throwable creationStack
handleback to summary
pack-priv final long handle
hash32back to summary
pack-priv final int hash32
nameback to summary
pack-priv final String name
refCountback to summary
pack-priv int refCount
unCloseableback to summary
pack-priv boolean unCloseable

Constructor Detail

NamedDisplayback to summary
protected NamedDisplay(final String name, final long handle)

Method Detail

addRefback to summary
public final void addRef()
equalsback to summary
public final boolean equals(final Object obj)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
obj:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
getCreationStackback to summary
public final Throwable getCreationStack()
getHandleback to summary
public final long getHandle()
getNameback to summary
public final String getName()
getRefCountback to summary
public final int getRefCount()
hashCodeback to summary
public final int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object

Annotations
@Override
isUncloseableback to summary
public final boolean isUncloseable()
removeRefback to summary
public final void removeRef()
setUncloseableback to summary
public final void setUncloseable(final boolean v)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object

Annotations
@Override