egl: Fixes transparency with EGL and X11.
[mesa.git] / include / GL / mesa_glinterop.h
index ff3235e958afa0a7440de53b39d8b96337a47c2e..45fda93ca2495608a8d0340643755604f1042bc1 100644 (file)
@@ -58,12 +58,16 @@ extern "C" {
 #endif
 
 /* Forward declarations to avoid inclusion of GL/glx.h */
-typedef struct _XDisplay Display;
-typedef struct __GLXcontextRec *GLXContext;
+#ifndef GLX_H
+struct _XDisplay;
+struct __GLXcontextRec;
+#endif
 
 /* Forward declarations to avoid inclusion of EGL/egl.h */
+#ifndef __egl_h_
 typedef void *EGLDisplay;
 typedef void *EGLContext;
+#endif
 
 /** Returned error codes. */
 enum {
@@ -92,8 +96,13 @@ enum {
 /**
  * Device information returned by Mesa.
  */
-typedef struct _mesa_glinterop_device_info {
+struct mesa_glinterop_device_info {
    /* The caller should set this to the version of the struct they support */
+   /* The callee will overwrite it if it supports a lower version.
+    *
+    * The caller should check the value and access up-to the version supported
+    * by the callee.
+    */
    /* NOTE: Do not use the MESA_GLINTEROP_DEVICE_INFO_VERSION macro */
    uint32_t version;
 
@@ -107,25 +116,21 @@ typedef struct _mesa_glinterop_device_info {
    uint32_t vendor_id;
    uint32_t device_id;
 
-   /* The interop version determines what behavior the caller should expect
-    * out of all functions.
-    *
-    * Interop version 1:
-    * - mesa_glinterop_export_in is not read beyond "out_driver_data"
-    * - mesa_glinterop_export_out is not written beyond "out_driver_data_written"
-    * - mesa_glinterop_device_info is not written beyond "interop_version"
-    */
-   uint32_t interop_version;
    /* Structure version 1 ends here. */
-} mesa_glinterop_device_info;
+};
 
 #define MESA_GLINTEROP_EXPORT_IN_VERSION 1
 
 /**
  * Input parameters to Mesa interop export functions.
  */
-typedef struct _mesa_glinterop_export_in {
+struct mesa_glinterop_export_in {
    /* The caller should set this to the version of the struct they support */
+   /* The callee will overwrite it if it supports a lower version.
+    *
+    * The caller should check the value and access up-to the version supported
+    * by the callee.
+    */
    /* NOTE: Do not use the MESA_GLINTEROP_EXPORT_IN_VERSION macro */
    uint32_t version;
 
@@ -177,15 +182,20 @@ typedef struct _mesa_glinterop_export_in {
     */
    void *out_driver_data;
    /* Structure version 1 ends here. */
-} mesa_glinterop_export_in;
+};
 
 #define MESA_GLINTEROP_EXPORT_OUT_VERSION 1
 
 /**
  * Outputs of Mesa interop export functions.
  */
-typedef struct _mesa_glinterop_export_out {
+struct mesa_glinterop_export_out {
    /* The caller should set this to the version of the struct they support */
+   /* The callee will overwrite it if it supports a lower version.
+    *
+    * The caller should check the value and access up-to the version supported
+    * by the callee.
+    */
    /* NOTE: Do not use the MESA_GLINTEROP_EXPORT_OUT_VERSION macro */
    uint32_t version;
 
@@ -227,7 +237,7 @@ typedef struct _mesa_glinterop_export_out {
    /* The number of bytes written to out_driver_data. */
    uint32_t out_driver_data_written;
    /* Structure version 1 ends here. */
-} mesa_glinterop_export_out;
+};
 
 
 /**
@@ -240,8 +250,8 @@ typedef struct _mesa_glinterop_export_out {
  * \return MESA_GLINTEROP_SUCCESS or MESA_GLINTEROP_* != 0 on error
  */
 int
-MesaGLInteropGLXQueryDeviceInfo(Display *dpy, GLXContext context,
-                                mesa_glinterop_device_info *out);
+MesaGLInteropGLXQueryDeviceInfo(struct _XDisplay *dpy, struct __GLXcontextRec *context,
+                                struct mesa_glinterop_device_info *out);
 
 
 /**
@@ -250,7 +260,7 @@ MesaGLInteropGLXQueryDeviceInfo(Display *dpy, GLXContext context,
  */
 int
 MesaGLInteropEGLQueryDeviceInfo(EGLDisplay dpy, EGLContext context,
-                                mesa_glinterop_device_info *out);
+                                struct mesa_glinterop_device_info *out);
 
 
 /**
@@ -265,9 +275,9 @@ MesaGLInteropEGLQueryDeviceInfo(EGLDisplay dpy, EGLContext context,
  * \return MESA_GLINTEROP_SUCCESS or MESA_GLINTEROP_* != 0 on error
  */
 int
-MesaGLInteropGLXExportObject(Display *dpy, GLXContext context,
-                             const mesa_glinterop_export_in *in,
-                             mesa_glinterop_export_out *out);
+MesaGLInteropGLXExportObject(struct _XDisplay *dpy, struct __GLXcontextRec *context,
+                             struct mesa_glinterop_export_in *in,
+                             struct mesa_glinterop_export_out *out);
 
 
 /**
@@ -276,20 +286,20 @@ MesaGLInteropGLXExportObject(Display *dpy, GLXContext context,
  */
 int
 MesaGLInteropEGLExportObject(EGLDisplay dpy, EGLContext context,
-                             const mesa_glinterop_export_in *in,
-                             mesa_glinterop_export_out *out);
+                             struct mesa_glinterop_export_in *in,
+                             struct mesa_glinterop_export_out *out);
 
 
-typedef int (PFNMESAGLINTEROPGLXQUERYDEVICEINFOPROC)(Display *dpy, GLXContext context,
-                                                     mesa_glinterop_device_info *out);
+typedef int (PFNMESAGLINTEROPGLXQUERYDEVICEINFOPROC)(struct _XDisplay *dpy, struct __GLXcontextRec *context,
+                                                     struct mesa_glinterop_device_info *out);
 typedef int (PFNMESAGLINTEROPEGLQUERYDEVICEINFOPROC)(EGLDisplay dpy, EGLContext context,
-                                                     mesa_glinterop_device_info *out);
-typedef int (PFNMESAGLINTEROPGLXEXPORTOBJECTPROC)(Display *dpy, GLXContext context,
-                                                  const mesa_glinterop_export_in *in,
-                                                  mesa_glinterop_export_out *out);
+                                                     struct mesa_glinterop_device_info *out);
+typedef int (PFNMESAGLINTEROPGLXEXPORTOBJECTPROC)(struct _XDisplay *dpy, struct __GLXcontextRec *context,
+                                                  struct mesa_glinterop_export_in *in,
+                                                  struct mesa_glinterop_export_out *out);
 typedef int (PFNMESAGLINTEROPEGLEXPORTOBJECTPROC)(EGLDisplay dpy, EGLContext context,
-                                                  const mesa_glinterop_export_in *in,
-                                                  mesa_glinterop_export_out *out);
+                                                  struct mesa_glinterop_export_in *in,
+                                                  struct mesa_glinterop_export_out *out);
 
 #ifdef __cplusplus
 }