vulkan: Update Vulkan XML and headers to 1.2.149
[mesa.git] / include / GL / mesa_glinterop.h
index 7e57dda2d5a289387a445587be818ab6eb15df37..45fda93ca2495608a8d0340643755604f1042bc1 100644 (file)
 #define MESA_GLINTEROP_H
 
 #include <stddef.h>
-#include <GL/glx.h>
-#include <EGL/egl.h>
+#include <stdint.h>
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
+/* Forward declarations to avoid inclusion of GL/glx.h */
+#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 {
    MESA_GLINTEROP_SUCCESS = 0,
    MESA_GLINTEROP_OUT_OF_RESOURCES,
    MESA_GLINTEROP_OUT_OF_HOST_MEMORY,
    MESA_GLINTEROP_INVALID_OPERATION,
-   MESA_GLINTEROP_INVALID_VALUE,
+   MESA_GLINTEROP_INVALID_VERSION,
    MESA_GLINTEROP_INVALID_DISPLAY,
    MESA_GLINTEROP_INVALID_CONTEXT,
    MESA_GLINTEROP_INVALID_TARGET,
@@ -85,9 +96,15 @@ enum {
 /**
  * Device information returned by Mesa.
  */
-typedef struct _mesa_glinterop_device_info {
-   /* The caller should set this to: MESA_GLINTEROP_DEVICE_INFO_VERSION */
-   uint32_t struct_version;
+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;
 
    /* PCI location */
    uint32_t pci_segment_group;
@@ -99,26 +116,23 @@ 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 {
-   /* The caller should set this to: MESA_GLINTEROP_EXPORT_IN_VERSION */
-   uint32_t struct_version;
+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;
 
    /* One of the following:
     * - GL_TEXTURE_BUFFER
@@ -168,16 +182,22 @@ 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 {
-   /* The caller should set this to: MESA_GLINTEROP_EXPORT_OUT_VERSION */
-   uint32_t struct_version;
+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;
 
    /* The DMABUF handle. It must be closed by the caller using the POSIX
     * close() function when it's not needed anymore. Mesa is not responsible
@@ -217,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;
+};
 
 
 /**
@@ -229,18 +249,18 @@ typedef struct _mesa_glinterop_export_out {
  *
  * \return MESA_GLINTEROP_SUCCESS or MESA_GLINTEROP_* != 0 on error
  */
-GLAPI int GLAPIENTRY
-MesaGLInteropGLXQueryDeviceInfo(Display *dpy, GLXContext context,
-                                mesa_glinterop_device_info *out);
+int
+MesaGLInteropGLXQueryDeviceInfo(struct _XDisplay *dpy, struct __GLXcontextRec *context,
+                                struct mesa_glinterop_device_info *out);
 
 
 /**
  * Same as MesaGLInteropGLXQueryDeviceInfo except that it accepts EGLDisplay
  * and EGLContext.
  */
-GLAPI int GLAPIENTRY
+int
 MesaGLInteropEGLQueryDeviceInfo(EGLDisplay dpy, EGLContext context,
-                                mesa_glinterop_device_info *out);
+                                struct mesa_glinterop_device_info *out);
 
 
 /**
@@ -254,32 +274,32 @@ MesaGLInteropEGLQueryDeviceInfo(EGLDisplay dpy, EGLContext context,
  *
  * \return MESA_GLINTEROP_SUCCESS or MESA_GLINTEROP_* != 0 on error
  */
-GLAPI int GLAPIENTRY
-MesaGLInteropGLXExportObject(Display *dpy, GLXContext context,
-                             const mesa_glinterop_export_in *in,
-                             mesa_glinterop_export_out *out);
+int
+MesaGLInteropGLXExportObject(struct _XDisplay *dpy, struct __GLXcontextRec *context,
+                             struct mesa_glinterop_export_in *in,
+                             struct mesa_glinterop_export_out *out);
 
 
 /**
  * Same as MesaGLInteropGLXExportObject except that it accepts
  * EGLDisplay and EGLContext.
  */
-GLAPI int GLAPIENTRY
+int
 MesaGLInteropEGLExportObject(EGLDisplay dpy, EGLContext context,
-                             const mesa_glinterop_export_in *in,
-                             mesa_glinterop_export_out *out);
-
-
-typedef int (APIENTRYP PFNMESAGLINTEROPGLXQUERYDEVICEINFOPROC)(Display *dpy, GLXContext context,
-                                                               mesa_glinterop_device_info *out);
-typedef int (APIENTRYP PFNMESAGLINTEROPEGLQUERYDEVICEINFOPROC)(EGLDisplay dpy, EGLContext context,
-                                                               mesa_glinterop_device_info *out);
-typedef int (APIENTRYP PFNMESAGLINTEROPGLXEXPORTOBJECTPROC)(Display *dpy, GLXContext context,
-                                                            const mesa_glinterop_export_in *in,
-                                                            mesa_glinterop_export_out *out);
-typedef int (APIENTRYP 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);
+
+
+typedef int (PFNMESAGLINTEROPGLXQUERYDEVICEINFOPROC)(struct _XDisplay *dpy, struct __GLXcontextRec *context,
+                                                     struct mesa_glinterop_device_info *out);
+typedef int (PFNMESAGLINTEROPEGLQUERYDEVICEINFOPROC)(EGLDisplay dpy, EGLContext context,
+                                                     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,
+                                                  struct mesa_glinterop_export_in *in,
+                                                  struct mesa_glinterop_export_out *out);
 
 #ifdef __cplusplus
 }