summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse Natalie <jenatali@microsoft.com>2022-10-21 15:14:30 -0700
committerMarge Bot <emma+marge@anholt.net>2022-11-02 18:11:41 +0000
commit04d45eab34fef96f7ea43176f100e2d33c8b547d (patch)
tree4ad0dedb070102d6e686d8e17853e81cf1b42801
parentaaf35cb442bf24589a5d30e279b5a5c9c746ac93 (diff)
downloadmesa-04d45eab34fef96f7ea43176f100e2d33c8b547d.tar.gz
mesa-04d45eab34fef96f7ea43176f100e2d33c8b547d.tar.bz2
mesa-04d45eab34fef96f7ea43176f100e2d33c8b547d.zip
include: Add a flush interop method
Reviewed-by: Adam Jackson <ajax@redhat.com> Acked-by: Karol Herbst <kherbst@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19242>
-rw-r--r--include/GL/internal/dri_interface.h12
-rw-r--r--include/GL/mesa_glinterop.h46
2 files changed, 57 insertions, 1 deletions
diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h
index d680abda671..7f1f48243e1 100644
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
@@ -416,11 +416,12 @@ struct __DRI2fenceExtensionRec {
*/
#define __DRI2_INTEROP "DRI2_Interop"
-#define __DRI2_INTEROP_VERSION 1
+#define __DRI2_INTEROP_VERSION 2
struct mesa_glinterop_device_info;
struct mesa_glinterop_export_in;
struct mesa_glinterop_export_out;
+typedef struct __GLsync *GLsync;
struct __DRI2interopExtensionRec {
__DRIextension base;
@@ -433,6 +434,15 @@ struct __DRI2interopExtensionRec {
int (*export_object)(__DRIcontext *ctx,
struct mesa_glinterop_export_in *in,
struct mesa_glinterop_export_out *out);
+
+ /**
+ * Same as MesaGLInterop*FlushObjects.
+ *
+ * \since 2
+ */
+ int (*flush_objects)(__DRIcontext *ctx,
+ unsigned count, struct mesa_glinterop_export_in *objects,
+ GLsync *sync);
};
diff --git a/include/GL/mesa_glinterop.h b/include/GL/mesa_glinterop.h
index e0826b8f7ee..4a7da7479a0 100644
--- a/include/GL/mesa_glinterop.h
+++ b/include/GL/mesa_glinterop.h
@@ -77,6 +77,8 @@ typedef struct HGLRC__ *HGLRC;
typedef void *HANDLE;
#endif
+typedef struct __GLsync *GLsync;
+
/** Returned error codes. */
enum {
MESA_GLINTEROP_SUCCESS = 0,
@@ -323,6 +325,41 @@ wglMesaGLInteropExportObject(HDC dpy, HGLRC context,
struct mesa_glinterop_export_out *out);
+/**
+ * Prepare OpenGL resources for being accessed by OpenCL.
+ *
+ * \param dpy GLX display
+ * \param context GLX context
+ * \param count number of resources
+ * \param resources resources to flush
+ * \param sync optional GLsync to map to CL event
+ *
+ * \return MESA_GLINTEROP_SUCCESS or MESA_GLINTEROP_* != 0 on error
+ */
+int
+MesaGLInteropGLXFlushObjects(struct _XDisplay *dpy, struct __GLXcontextRec *context,
+ unsigned count, struct mesa_glinterop_export_in *resources,
+ GLsync *sync);
+
+/**
+* Same as MesaGLInteropGLXFlushObjects except that it accepts
+* EGLDisplay and EGLContext.
+*/
+int
+MesaGLInteropEGLFlushObjects(EGLDisplay dpy, EGLContext context,
+ unsigned count, struct mesa_glinterop_export_in *resources,
+ GLsync *sync);
+
+/**
+* Same as MesaGLInteropGLXFlushObjects except that it accepts
+* HDC and HGLRC.
+*/
+int
+wglMesaGLInteropFlushObjects(HDC dpy, HGLRC context,
+ unsigned count, struct mesa_glinterop_export_in *resources,
+ GLsync *sync);
+
+
typedef int (PFNMESAGLINTEROPGLXQUERYDEVICEINFOPROC)(struct _XDisplay *dpy, struct __GLXcontextRec *context,
struct mesa_glinterop_device_info *out);
typedef int (PFNMESAGLINTEROPEGLQUERYDEVICEINFOPROC)(EGLDisplay dpy, EGLContext context,
@@ -338,6 +375,15 @@ typedef int (PFNMESAGLINTEROPEGLEXPORTOBJECTPROC)(EGLDisplay dpy, EGLContext con
typedef int (PFNWGLMESAGLINTEROPEXPORTOBJECTPROC)(HDC dpy, HGLRC context,
struct mesa_glinterop_export_in *in,
struct mesa_glinterop_export_out *out);
+typedef int (PFNMESAGLINTEROPGLXFLUSHOBJECTSPROC)(struct _XDisplay *dpy, struct __GLXcontextRec *context,
+ unsigned count, struct mesa_glinterop_export_in *resources,
+ GLsync *sync);
+typedef int (PFNMESAGLINTEROPEGLFLUSHOBJECTSPROC)(EGLDisplay dpy, EGLContext context,
+ unsigned count, struct mesa_glinterop_export_in *resources,
+ GLsync *sync);
+typedef int (PFNWGLMESAGLINTEROPFLUSHOBJECTSPROC)(HDC dpy, HGLRC context,
+ unsigned count, struct mesa_glinterop_export_in *resources,
+ GLsync *sync);
#ifdef __cplusplus
}