# This .cfg file is used to generate the interface to the GLX routines
# used internally by the X11GLContext implementation.
Package jogamp.nativewindow.drm
JavaClass DRMLib
Style AllStatic

HierarchicalNativeOutput false

JavaOutputDir gensrc/classes
NativeOutputDir gensrc/native/drm

# Imports needed by all glue code
Import java.nio.*
Import java.util.*

# XID needs to be treated as a long for 32/64 bit compatibility
Opaque boolean Bool
Opaque long void *
Opaque long gbm_device*;
Opaque long gbm_bo*;
Opaque long gbm_surface*;
Opaque long union gbm_bo_handle;

# IncludeAs CustomJavaCode X11Lib x11-CustomJavaCode.java

ArgumentIsString drmOpen 0 1
ArgumentIsString drmCheckModesettingSupported 0
# ReturnsString XDisplayString
# ReturnValueCapacity XRenderFindVisualFormat sizeof(XRenderPictFormat)

ImmutableAccess drmModeConnector
ReturnedArrayLength drmModeConnector.modes getCount_modes()
ReturnedArrayLength drmModeConnector.props getCount_props()
ReturnedArrayLength drmModeConnector.prop_values getCount_props()
ReturnedArrayLength drmModeConnector.encoders getCount_encoders()

ImmutableAccess drmModeCrtc

ImmutableAccess drmModeEncoder

ImmutableAccess drmModeFB

ImmutableAccess drmModeModeInfo
ReturnsString drmModeModeInfo.name

ImmutableAccess drmModeRes
ReturnedArrayLength drmModeRes.connectors getCount_connectors()
ReturnedArrayLength drmModeRes.crtcs getCount_crtcs()
ReturnedArrayLength drmModeRes.encoders getCount_encoders()


IgnoreNot ^(drm|DRM_|gbm_|GBM_).+

Ignore drmHandleEvent

Ignore drmModeAtomicReq
Ignore drmModeAtomicAlloc
Ignore drmModeAtomicDuplicate
Ignore drmModeAtomicMerge
Ignore drmModeAtomicFree
Ignore drmModeAtomicGetCursor
Ignore drmModeAtomicSetCursor
Ignore drmModeAtomicAddProperty
Ignore drmModeAtomicCommit

Ignore drmModeClip
Ignore drmModeDirtyFB

Ignore drmModeLesseeListRes
Ignore drmModeListLessees
Ignore drmModeGetLease
Ignore drmModeObjectListRes

Ignore drmModeObjectProperties
Ignore drmModeObjectGetProperties
Ignore drmModeFreeObjectProperties

Ignore drmModePropertyBlobRes
Ignore drmModeGetPropertyBlob
Ignore drmModeFreePropertyBlob

Ignore drmModePropertyRes
Ignore drmModeGetProperty
Ignore drmModeFreeProperty

Ignore drmModePlane
Ignore drmModeGetPlane
Ignore drmModeFreePlane
Ignore drmModePlaneRes
Ignore drmModeGetPlaneResources
Ignore drmModeFreePlaneResources

Ignore GBM_BO_FORMAT.+
Ignore gbm_bo_handle
Ignore gbm_bo_get_handle
Ignore gbm_bo_get_handle_for_plane
Ignore gbm_bo_set_user_data

ManuallyImplement drmOpenFile

# CustomJavaCode DRMLib public static final int DRM_MODE_TYPE_BUILTIN = (1<<0);
# CustomJavaCode DRMLib public static final int DRM_MODE_TYPE_CLOCK_C = ((1<<1) | DRM_MODE_TYPE_BUILTIN);
# CustomJavaCode DRMLib public static final int DRM_MODE_TYPE_CRTC_C = ((1<<2) | DRM_MODE_TYPE_BUILTIN);
# CustomJavaCode DRMLib public static final int DRM_MODE_TYPE_PREFERRED = (1<<3);
# CustomJavaCode DRMLib public static final int DRM_MODE_TYPE_DEFAULT = (1<<4);
# CustomJavaCode DRMLib public static final int DRM_MODE_TYPE_USERDEF = (1<<5);
# CustomJavaCode DRMLib public static final int DRM_MODE_TYPE_DRIVER = (1<<6);
CustomJavaCode DRMLib public static native int drmOpenFile(String filename);

CustomCCode #include <stdlib.h>
CustomCCode #include <errno.h>
CustomCCode #include <string.h>
CustomCCode #include <fcntl.h>
CustomCCode #include <inttypes.h>
CustomCCode #include <xf86drm.h>
CustomCCode #include <xf86drmMode.h>
CustomCCode #include <gbm.h>

