JOGL v2.6.0-rc-20250712
JOGL, High-Performance Graphics Binding for Java™ (public API).
com.jogamp.nativewindow.DefaultGraphicsDevice Class Reference
Inheritance diagram for com.jogamp.nativewindow.DefaultGraphicsDevice:
Collaboration diagram for com.jogamp.nativewindow.DefaultGraphicsDevice:

Public Member Functions

 DefaultGraphicsDevice (final String type, final String connection, final int unitID)
 Create an instance with the system default ToolkitLock, gathered via NativeWindowFactory#getDefaultToolkitLock(String). More...
 
 DefaultGraphicsDevice (final String type, final String connection, final int unitID, final long handle)
 Create an instance with the system default ToolkitLock. More...
 
 DefaultGraphicsDevice (final String type, final String connection, final int unitID, final long handle, final ToolkitLock locker)
 Create an instance with the given ToolkitLock instance, or null ToolkitLock if null. More...
 
Object clone ()
 
final String getType ()
 Returns the type of the underlying subsystem, ie NativeWindowFactory.TYPE_KD, NativeWindowFactory.TYPE_X11, . More...
 
final String getConnection ()
 Returns the semantic GraphicsDevice connection. More...
 
final int getUnitID ()
 Returns the graphics device unit ID. More...
 
final String getUniqueID ()
 Returns a unique ID object of this device using type, connection and unitID as it's key components. More...
 
final long getHandle ()
 Returns the native handle of the underlying native device, if such thing exist. More...
 
final void lock ()
 Optionally locking the device, utilizing eg com.jogamp.nativewindow.ToolkitLock#lock().The lock implementation must be recursive. More...
 
final void validateLocked () throws RuntimeException
 
final void unlock ()
 Optionally unlocking the device, utilizing eg com.jogamp.nativewindow.ToolkitLock#unlock().The lock implementation must be recursive.
Exceptions
RuntimeExceptionin case the lock is not acquired by this thread.
More...
 
boolean open ()
 Optionally [re]opening the device if handle is null. More...
 
boolean close ()
 Optionally closing the device if handle is not null. More...
 
final boolean isHandleOwner ()
 
final void clearHandleOwner ()
 
String toString ()
 
final ToolkitLock getToolkitLock ()
 
Object clone ()
 
String getType ()
 Returns the type of the underlying subsystem, ie NativeWindowFactory.TYPE_KD, NativeWindowFactory.TYPE_X11, . More...
 
String getConnection ()
 Returns the semantic GraphicsDevice connection. More...
 
int getUnitID ()
 Returns the graphics device unit ID. More...
 
String getUniqueID ()
 Returns a unique ID object of this device using type, connection and unitID as it's key components. More...
 
long getHandle ()
 Returns the native handle of the underlying native device, if such thing exist. More...
 
void lock ()
 Optionally locking the device, utilizing eg com.jogamp.nativewindow.ToolkitLock#lock(). More...
 
void unlock ()
 Optionally unlocking the device, utilizing eg com.jogamp.nativewindow.ToolkitLock#unlock(). More...
 
void validateLocked () throws RuntimeException
 
boolean open ()
 Optionally [re]opening the device if handle is null. More...
 
boolean close ()
 Optionally closing the device if handle is not null. More...
 
boolean isHandleOwner ()
 
void clearHandleOwner ()
 

Static Public Member Functions

static String getDefaultDisplayConnection ()
 Return the default display connection for the given windowing toolkit type gathered via NativeWindowFactory#getDefaultDisplayConnection(). More...
 
static String getDefaultDisplayConnection (final String type)
 Return the default display connection for the given windowing toolkit type gathered via NativeWindowFactory#getDefaultDisplayConnection(String). More...
 
static final void swapHandleAndOwnership (final DefaultGraphicsDevice a, final DefaultGraphicsDevice b)
 

Protected Member Functions

final long setHandle (final long newHandle)
 Set the native handle of the underlying native device and return the previous one. More...
 
final Object getHandleOwnership ()
 
final Object setHandleOwnership (final Object newOwnership)
 
ToolkitLock setToolkitLock (final ToolkitLock locker)
 Set the internal ToolkitLock, which is used within the lock() and unlock() implementation. More...
 

Protected Attributes

final String connection
 
final int unitID
 
final String uniqueID
 
long handle
 
ToolkitLock toolkitLock
 

Additional Inherited Members

- Static Public Attributes inherited from com.jogamp.nativewindow.AbstractGraphicsDevice
static final boolean DEBUG = Debug.debug("GraphicsDevice")
 
static String DEFAULT_CONNECTION = "decon"
 Dummy connection value for a default connection where no native support for multiple devices is available. More...
 
static String EXTERNAL_CONNECTION = "excon"
 Dummy connection value for an external connection where no native support for multiple devices is available. More...
 
static int DEFAULT_UNIT = 0
 Default unit id for the 1st device: 0. More...
 

Detailed Description

Definition at line 38 of file DefaultGraphicsDevice.java.

Constructor & Destructor Documentation

◆ DefaultGraphicsDevice() [1/3]

com.jogamp.nativewindow.DefaultGraphicsDevice.DefaultGraphicsDevice ( final String  type,
final String  connection,
final int  unitID 
)

Create an instance with the system default ToolkitLock, gathered via NativeWindowFactory#getDefaultToolkitLock(String).

Parameters
type

Definition at line 70 of file DefaultGraphicsDevice.java.

Here is the call graph for this function:

◆ DefaultGraphicsDevice() [2/3]

com.jogamp.nativewindow.DefaultGraphicsDevice.DefaultGraphicsDevice ( final String  type,
final String  connection,
final int  unitID,
final long  handle 
)

Create an instance with the system default ToolkitLock.

gathered via NativeWindowFactory#getDefaultToolkitLock(String).

Parameters
type
handle

Definition at line 80 of file DefaultGraphicsDevice.java.

Here is the call graph for this function:

◆ DefaultGraphicsDevice() [3/3]

com.jogamp.nativewindow.DefaultGraphicsDevice.DefaultGraphicsDevice ( final String  type,
final String  connection,
final int  unitID,
final long  handle,
final ToolkitLock  locker 
)

Create an instance with the given ToolkitLock instance, or null ToolkitLock if null.

Parameters
type
handle
lockerif null, a non blocking null lock is used.

Definition at line 90 of file DefaultGraphicsDevice.java.

Here is the call graph for this function:

Member Function Documentation

◆ clearHandleOwner()

final void com.jogamp.nativewindow.DefaultGraphicsDevice.clearHandleOwner ( )

◆ clone()

◆ close()

boolean com.jogamp.nativewindow.DefaultGraphicsDevice.close ( )

Optionally closing the device if handle is not null.

The default implementation dispose it's ToolkitLock and sets the handle to null.

Example implementations like com.jogamp.nativewindow.x11.X11GraphicsDevice or com.jogamp.nativewindow.egl.EGLGraphicsDevice issue the native close operation or skip it depending on the handles's ownership.

Returns
true if the handle was not null and closing was successful, otherwise false.

Implements com.jogamp.nativewindow.AbstractGraphicsDevice.

Reimplemented in com.jogamp.nativewindow.egl.EGLGraphicsDevice, and com.jogamp.nativewindow.x11.X11GraphicsDevice.

Definition at line 173 of file DefaultGraphicsDevice.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getConnection()

final String com.jogamp.nativewindow.DefaultGraphicsDevice.getConnection ( )

Returns the semantic GraphicsDevice connection.


On platforms supporting remote devices, eg via tcp/ip network, the implementation shall return a unique name for each remote address.

For X11GraphicsDevice, the connection string should be as the follows

  • :0.0 for a local connection
  • remote.host.net:0.0 for a remote connection

To support multiple local device, see getUnitID().

Implements com.jogamp.nativewindow.AbstractGraphicsDevice.

Definition at line 115 of file DefaultGraphicsDevice.java.

Here is the caller graph for this function:

◆ getDefaultDisplayConnection() [1/2]

static String com.jogamp.nativewindow.DefaultGraphicsDevice.getDefaultDisplayConnection ( )
static

Return the default display connection for the given windowing toolkit type gathered via NativeWindowFactory#getDefaultDisplayConnection().

Parameters
type

Definition at line 53 of file DefaultGraphicsDevice.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getDefaultDisplayConnection() [2/2]

static String com.jogamp.nativewindow.DefaultGraphicsDevice.getDefaultDisplayConnection ( final String  type)
static

Return the default display connection for the given windowing toolkit type gathered via NativeWindowFactory#getDefaultDisplayConnection(String).

Parameters
type

Definition at line 61 of file DefaultGraphicsDevice.java.

Here is the call graph for this function:

◆ getHandle()

final long com.jogamp.nativewindow.DefaultGraphicsDevice.getHandle ( )

Returns the native handle of the underlying native device, if such thing exist.

Implements com.jogamp.nativewindow.AbstractGraphicsDevice.

Definition at line 130 of file DefaultGraphicsDevice.java.

Here is the caller graph for this function:

◆ getHandleOwnership()

final Object com.jogamp.nativewindow.DefaultGraphicsDevice.getHandleOwnership ( )
protected

Definition at line 208 of file DefaultGraphicsDevice.java.

Here is the caller graph for this function:

◆ getToolkitLock()

final ToolkitLock com.jogamp.nativewindow.DefaultGraphicsDevice.getToolkitLock ( )

◆ getType()

final String com.jogamp.nativewindow.DefaultGraphicsDevice.getType ( )

Returns the type of the underlying subsystem, ie NativeWindowFactory.TYPE_KD, NativeWindowFactory.TYPE_X11, .

Implements com.jogamp.nativewindow.AbstractGraphicsDevice.

Definition at line 110 of file DefaultGraphicsDevice.java.

Here is the caller graph for this function:

◆ getUniqueID()

final String com.jogamp.nativewindow.DefaultGraphicsDevice.getUniqueID ( )

Returns a unique ID object of this device using type, connection and unitID as it's key components.

The unique ID does not reflect the instance of the device, hence the handle is not included. The unique ID may be used as a key for semantic device mapping.

The returned string object reference is unique using String#intern() and hence can be used as a key itself.

Implements com.jogamp.nativewindow.AbstractGraphicsDevice.

Definition at line 125 of file DefaultGraphicsDevice.java.

Here is the caller graph for this function:

◆ getUnitID()

final int com.jogamp.nativewindow.DefaultGraphicsDevice.getUnitID ( )

Returns the graphics device unit ID.


The unit ID support multiple graphics device configurations on a local machine.
To support remote device, see getConnection().

Returns

Implements com.jogamp.nativewindow.AbstractGraphicsDevice.

Definition at line 120 of file DefaultGraphicsDevice.java.

Here is the caller graph for this function:

◆ isHandleOwner()

final boolean com.jogamp.nativewindow.DefaultGraphicsDevice.isHandleOwner ( )
Returns
true if instance owns the handle to issue close(), otherwise false.

Implements com.jogamp.nativewindow.AbstractGraphicsDevice.

Definition at line 183 of file DefaultGraphicsDevice.java.

Here is the caller graph for this function:

◆ lock()

final void com.jogamp.nativewindow.DefaultGraphicsDevice.lock ( )

Optionally locking the device, utilizing eg com.jogamp.nativewindow.ToolkitLock#lock().The lock implementation must be recursive.

Locking is perfomed via delegation to ToolkitLock#lock(), ToolkitLock#unlock().

See also
DefaultGraphicsDevice::DefaultGraphicsDevice(java.lang.String, long)
DefaultGraphicsDevice::DefaultGraphicsDevice(java.lang.String, long, com.jogamp.nativewindow.ToolkitLock)

Implements com.jogamp.nativewindow.AbstractGraphicsDevice.

Definition at line 144 of file DefaultGraphicsDevice.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ open()

boolean com.jogamp.nativewindow.DefaultGraphicsDevice.open ( )

Optionally [re]opening the device if handle is null.

The default implementation is a NOP.

Example implementations like com.jogamp.nativewindow.x11.X11GraphicsDevice or com.jogamp.nativewindow.egl.EGLGraphicsDevice issue the native open operation in case handle is null.

Returns
true if the handle was null and opening was successful, otherwise false.

Implements com.jogamp.nativewindow.AbstractGraphicsDevice.

Reimplemented in com.jogamp.nativewindow.egl.EGLGraphicsDevice, and com.jogamp.nativewindow.x11.X11GraphicsDevice.

Definition at line 168 of file DefaultGraphicsDevice.java.

◆ setHandle()

final long com.jogamp.nativewindow.DefaultGraphicsDevice.setHandle ( final long  newHandle)
protected

Set the native handle of the underlying native device and return the previous one.

Definition at line 202 of file DefaultGraphicsDevice.java.

Here is the caller graph for this function:

◆ setHandleOwnership()

final Object com.jogamp.nativewindow.DefaultGraphicsDevice.setHandleOwnership ( final Object  newOwnership)
protected

Definition at line 211 of file DefaultGraphicsDevice.java.

Here is the caller graph for this function:

◆ setToolkitLock()

ToolkitLock com.jogamp.nativewindow.DefaultGraphicsDevice.setToolkitLock ( final ToolkitLock  locker)
protected

Set the internal ToolkitLock, which is used within the lock() and unlock() implementation.

The current ToolkitLock is being locked/unlocked while swapping the reference, ensuring no concurrent access can occur during the swap.

Parameters
lockerthe ToolkitLock, if null, jogamp.nativewindow.NullToolkitLock is being used
Returns
the previous ToolkitLock instance

Definition at line 248 of file DefaultGraphicsDevice.java.

Here is the call graph for this function:

◆ swapHandleAndOwnership()

static final void com.jogamp.nativewindow.DefaultGraphicsDevice.swapHandleAndOwnership ( final DefaultGraphicsDevice  a,
final DefaultGraphicsDevice  b 
)
static

Definition at line 217 of file DefaultGraphicsDevice.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ toString()

String com.jogamp.nativewindow.DefaultGraphicsDevice.toString ( )

Reimplemented in com.jogamp.nativewindow.awt.AWTGraphicsDevice, and com.jogamp.nativewindow.egl.EGLGraphicsDevice.

Definition at line 193 of file DefaultGraphicsDevice.java.

Here is the call graph for this function:

◆ unlock()

final void com.jogamp.nativewindow.DefaultGraphicsDevice.unlock ( )

Optionally unlocking the device, utilizing eg com.jogamp.nativewindow.ToolkitLock#unlock().The lock implementation must be recursive.

Exceptions
RuntimeExceptionin case the lock is not acquired by this thread.

Locking is perfomed via delegation to ToolkitLock#lock(), ToolkitLock#unlock().

See also
DefaultGraphicsDevice::DefaultGraphicsDevice(java.lang.String, long)
DefaultGraphicsDevice::DefaultGraphicsDevice(java.lang.String, long, com.jogamp.nativewindow.ToolkitLock)

Implements com.jogamp.nativewindow.AbstractGraphicsDevice.

Definition at line 163 of file DefaultGraphicsDevice.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ validateLocked()

final void com.jogamp.nativewindow.DefaultGraphicsDevice.validateLocked ( ) throws RuntimeException
Exceptions
RuntimeExceptionif current thread does not hold the lock

Implements com.jogamp.nativewindow.AbstractGraphicsDevice.

Definition at line 149 of file DefaultGraphicsDevice.java.

Here is the call graph for this function:

Member Data Documentation

◆ connection

final String com.jogamp.nativewindow.DefaultGraphicsDevice.connection
protected

Definition at line 41 of file DefaultGraphicsDevice.java.

◆ handle

long com.jogamp.nativewindow.DefaultGraphicsDevice.handle
protected

Definition at line 44 of file DefaultGraphicsDevice.java.

◆ toolkitLock

ToolkitLock com.jogamp.nativewindow.DefaultGraphicsDevice.toolkitLock
protected

Definition at line 46 of file DefaultGraphicsDevice.java.

◆ uniqueID

final String com.jogamp.nativewindow.DefaultGraphicsDevice.uniqueID
protected

Definition at line 43 of file DefaultGraphicsDevice.java.

◆ unitID

final int com.jogamp.nativewindow.DefaultGraphicsDevice.unitID
protected

Definition at line 42 of file DefaultGraphicsDevice.java.


The documentation for this class was generated from the following file: