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>
This commit is contained in:
Jesse Natalie
2022-10-21 15:14:30 -07:00
committed by Marge Bot
parent aaf35cb442
commit 04d45eab34
2 changed files with 57 additions and 1 deletions

View File

@@ -416,11 +416,12 @@ struct __DRI2fenceExtensionRec {
*/ */
#define __DRI2_INTEROP "DRI2_Interop" #define __DRI2_INTEROP "DRI2_Interop"
#define __DRI2_INTEROP_VERSION 1 #define __DRI2_INTEROP_VERSION 2
struct mesa_glinterop_device_info; struct mesa_glinterop_device_info;
struct mesa_glinterop_export_in; struct mesa_glinterop_export_in;
struct mesa_glinterop_export_out; struct mesa_glinterop_export_out;
typedef struct __GLsync *GLsync;
struct __DRI2interopExtensionRec { struct __DRI2interopExtensionRec {
__DRIextension base; __DRIextension base;
@@ -433,6 +434,15 @@ struct __DRI2interopExtensionRec {
int (*export_object)(__DRIcontext *ctx, int (*export_object)(__DRIcontext *ctx,
struct mesa_glinterop_export_in *in, struct mesa_glinterop_export_in *in,
struct mesa_glinterop_export_out *out); 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);
}; };

View File

@@ -77,6 +77,8 @@ typedef struct HGLRC__ *HGLRC;
typedef void *HANDLE; typedef void *HANDLE;
#endif #endif
typedef struct __GLsync *GLsync;
/** Returned error codes. */ /** Returned error codes. */
enum { enum {
MESA_GLINTEROP_SUCCESS = 0, MESA_GLINTEROP_SUCCESS = 0,
@@ -323,6 +325,41 @@ wglMesaGLInteropExportObject(HDC dpy, HGLRC context,
struct mesa_glinterop_export_out *out); 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, typedef int (PFNMESAGLINTEROPGLXQUERYDEVICEINFOPROC)(struct _XDisplay *dpy, struct __GLXcontextRec *context,
struct mesa_glinterop_device_info *out); struct mesa_glinterop_device_info *out);
typedef int (PFNMESAGLINTEROPEGLQUERYDEVICEINFOPROC)(EGLDisplay dpy, EGLContext context, 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, typedef int (PFNWGLMESAGLINTEROPEXPORTOBJECTPROC)(HDC dpy, HGLRC context,
struct mesa_glinterop_export_in *in, struct mesa_glinterop_export_in *in,
struct mesa_glinterop_export_out *out); 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 #ifdef __cplusplus
} }