egl/dri2: Implement the new flush 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 14:09:39 -07:00 committed by Marge Bot
parent 8d55fb54b1
commit 89cd55e11d
5 changed files with 43 additions and 0 deletions

View file

@ -3824,6 +3824,20 @@ dri2_interop_export_object(_EGLDisplay *disp, _EGLContext *ctx,
return dri2_dpy->interop->export_object(dri2_ctx->dri_context, in, out);
}
static int
dri2_interop_flush_objects(_EGLDisplay *disp, _EGLContext *ctx,
unsigned count, struct mesa_glinterop_export_in *objects,
GLsync *sync)
{
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
struct dri2_egl_context *dri2_ctx = dri2_egl_context(ctx);
if (!dri2_dpy->interop || dri2_dpy->interop->base.version < 2)
return MESA_GLINTEROP_UNSUPPORTED;
return dri2_dpy->interop->flush_objects(dri2_ctx->dri_context, count, objects, sync);
}
const _EGLDriver _eglDriver = {
.Initialize = dri2_initialize,
.Terminate = dri2_terminate,
@ -3875,6 +3889,7 @@ const _EGLDriver _eglDriver = {
.DestroySyncKHR = dri2_destroy_sync,
.GLInteropQueryDeviceInfo = dri2_interop_query_device_info,
.GLInteropExportObject = dri2_interop_export_object,
.GLInteropFlushObjects = dri2_interop_flush_objects,
.DupNativeFenceFDANDROID = dri2_dup_native_fence_fd,
.SetBlobCacheFuncsANDROID = dri2_set_blob_cache_funcs,
};

View file

@ -44,3 +44,4 @@ eglWaitNative
eglWaitSync
MesaGLInteropEGLQueryDeviceInfo
MesaGLInteropEGLExportObject
MesaGLInteropEGLFlushObjects

View file

@ -47,3 +47,4 @@ eglWaitSync@12
; __cdecl calling convention have no @number suffix
MesaGLInteropEGLQueryDeviceInfo
MesaGLInteropEGLExportObject
MesaGLInteropEGLFlushObjects

View file

@ -2968,3 +2968,25 @@ MesaGLInteropEGLExportObject(EGLDisplay dpy, EGLContext context,
_eglUnlockDisplay(disp);
return ret;
}
PUBLIC int
MesaGLInteropEGLFlushObjects(EGLDisplay dpy, EGLContext context,
unsigned count, struct mesa_glinterop_export_in *objects,
GLsync *sync)
{
_EGLDisplay *disp;
_EGLContext *ctx;
int ret;
ret = _eglLockDisplayInterop(dpy, context, &disp, &ctx);
if (ret != MESA_GLINTEROP_SUCCESS)
return ret;
if (disp->Driver->GLInteropFlushObjects)
ret = disp->Driver->GLInteropFlushObjects(disp, ctx, count, objects, sync);
else
ret = MESA_GLINTEROP_UNSUPPORTED;
_eglUnlockDisplay(disp);
return ret;
}

View file

@ -75,6 +75,7 @@ struct wl_display;
struct mesa_glinterop_device_info;
struct mesa_glinterop_export_in;
struct mesa_glinterop_export_out;
typedef struct __GLsync *GLsync;
/**
* The API dispatcher jumps through these functions
@ -202,6 +203,9 @@ struct _egl_driver
int (*GLInteropExportObject)(_EGLDisplay *disp, _EGLContext *ctx,
struct mesa_glinterop_export_in *in,
struct mesa_glinterop_export_out *out);
int (*GLInteropFlushObjects)(_EGLDisplay *disp, _EGLContext *ctx,
unsigned count, struct mesa_glinterop_export_in *in,
GLsync *sync);
/* for EGL_EXT_image_dma_buf_import_modifiers */
EGLBoolean (*QueryDmaBufFormatsEXT)(_EGLDisplay *disp,