diff options
author | Marek Olšák <[email protected]> | 2016-03-03 15:59:48 +0100 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2016-04-20 12:18:47 +0200 |
commit | b6eda708431b91a3b568da0efac845c08cb36796 (patch) | |
tree | 4d80c1559be8195b4f2cbd5b0b3cf1bc7414fc29 /src/egl/drivers | |
parent | 5e9ed261ed8ec211ba9bf5aa58d50078304583ff (diff) |
egl: implement EGL part of interop interface (v2)
v2: - use const
Diffstat (limited to 'src/egl/drivers')
-rw-r--r-- | src/egl/drivers/dri2/egl_dri2.c | 32 | ||||
-rw-r--r-- | src/egl/drivers/dri2/egl_dri2.h | 1 |
2 files changed, 33 insertions, 0 deletions
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c index 490b0409c98..d8448f4fc0f 100644 --- a/src/egl/drivers/dri2/egl_dri2.c +++ b/src/egl/drivers/dri2/egl_dri2.c @@ -46,6 +46,7 @@ #endif #include <GL/gl.h> #include <GL/internal/dri_interface.h> +#include "GL/mesa_glinterop.h" #include <sys/types.h> #include <sys/stat.h> @@ -740,6 +741,8 @@ dri2_create_screen(_EGLDisplay *disp) if (strcmp(extensions[i]->name, __DRI2_RENDERER_QUERY) == 0) { dri2_dpy->rendererQuery = (__DRI2rendererQueryExtension *) extensions[i]; } + if (strcmp(extensions[i]->name, __DRI2_INTEROP) == 0) + dri2_dpy->interop = (__DRI2interopExtension *) extensions[i]; } dri2_setup_screen(disp); @@ -2691,6 +2694,33 @@ dri2_server_wait_sync(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSync *sync) return EGL_TRUE; } +static int +dri2_interop_query_device_info(_EGLDisplay *dpy, _EGLContext *ctx, + mesa_glinterop_device_info *out) +{ + struct dri2_egl_display *dri2_dpy = dri2_egl_display(dpy); + struct dri2_egl_context *dri2_ctx = dri2_egl_context(ctx); + + if (!dri2_dpy->interop) + return MESA_GLINTEROP_UNSUPPORTED; + + return dri2_dpy->interop->query_device_info(dri2_ctx->dri_context, out); +} + +static int +dri2_interop_export_object(_EGLDisplay *dpy, _EGLContext *ctx, + const mesa_glinterop_export_in *in, + mesa_glinterop_export_out *out) +{ + struct dri2_egl_display *dri2_dpy = dri2_egl_display(dpy); + struct dri2_egl_context *dri2_ctx = dri2_egl_context(ctx); + + if (!dri2_dpy->interop) + return MESA_GLINTEROP_UNSUPPORTED; + + return dri2_dpy->interop->export_object(dri2_ctx->dri_context, in, out); +} + static void dri2_unload(_EGLDriver *drv) { @@ -2802,6 +2832,8 @@ _eglBuiltInDriverDRI2(const char *args) dri2_drv->base.API.SignalSyncKHR = dri2_signal_sync; dri2_drv->base.API.WaitSyncKHR = dri2_server_wait_sync; dri2_drv->base.API.DestroySyncKHR = dri2_destroy_sync; + dri2_drv->base.API.GLInteropQueryDeviceInfo = dri2_interop_query_device_info; + dri2_drv->base.API.GLInteropExportObject = dri2_interop_export_object; dri2_drv->base.Name = "DRI2"; dri2_drv->base.Unload = dri2_unload; diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h index ef799398474..3e9f9911d24 100644 --- a/src/egl/drivers/dri2/egl_dri2.h +++ b/src/egl/drivers/dri2/egl_dri2.h @@ -174,6 +174,7 @@ struct dri2_egl_display const __DRI2configQueryExtension *config; const __DRI2fenceExtension *fence; const __DRI2rendererQueryExtension *rendererQuery; + const __DRI2interopExtension *interop; int fd; int own_device; |