<div dir="ltr"><div><div><div>Hi Marek,<br><br></div>This patch ended up breaking make check for me (src/egl/egl-symbols-check).<br><br></div>Also, while bisecting, it occurred to me that you pushed v2 of the series, while you had previously sent a v3 to the mesa-dev list. Was pushing v2 intentional?<br><br></div>--Aaron<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 8, 2016 at 4:52 PM, Marek Olšák <span dir="ltr"><<a href="mailto:maraeo@gmail.com" target="_blank">maraeo@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">From: Marek Olšák <<a href="mailto:marek.olsak@amd.com">marek.olsak@amd.com</a>><br>
<br>
v2: - use const<br>
---<br>
src/egl/drivers/dri2/egl_dri2.c | 32 ++++++++++++++++++<br>
src/egl/drivers/dri2/egl_dri2.h | 1 +<br>
src/egl/main/eglapi.c | 72 +++++++++++++++++++++++++++++++++++++++++<br>
src/egl/main/eglapi.h | 9 ++++++<br>
4 files changed, 114 insertions(+)<br>
<br>
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c<br>
index 8f50f0c..6e23b71 100644<br>
--- a/src/egl/drivers/dri2/egl_dri2.c<br>
+++ b/src/egl/drivers/dri2/egl_dri2.c<br>
@@ -44,6 +44,7 @@<br>
#endif<br>
#include <GL/gl.h><br>
#include <GL/internal/dri_interface.h><br>
+#include "GL/mesa_glinterop.h"<br>
#include <sys/types.h><br>
#include <sys/stat.h><br>
<br>
@@ -736,6 +737,8 @@ dri2_create_screen(_EGLDisplay *disp)<br>
if (strcmp(extensions[i]->name, __DRI2_RENDERER_QUERY) == 0) {<br>
dri2_dpy->rendererQuery = (__DRI2rendererQueryExtension *) extensions[i];<br>
}<br>
+ if (strcmp(extensions[i]->name, __DRI2_INTEROP) == 0)<br>
+ dri2_dpy->interop = (__DRI2interopExtension *) extensions[i];<br>
}<br>
<br>
dri2_setup_screen(disp);<br>
@@ -2512,6 +2515,33 @@ dri2_server_wait_sync(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSync *sync)<br>
return EGL_TRUE;<br>
}<br>
<br>
+static int<br>
+dri2_interop_query_device_info(_EGLDisplay *dpy, _EGLContext *ctx,<br>
+ mesa_glinterop_device_info *out)<br>
+{<br>
+ struct dri2_egl_display *dri2_dpy = dri2_egl_display(dpy);<br>
+ struct dri2_egl_context *dri2_ctx = dri2_egl_context(ctx);<br>
+<br>
+ if (!dri2_dpy->interop)<br>
+ return MESA_GLINTEROP_UNSUPPORTED;<br>
+<br>
+ return dri2_dpy->interop->query_device_info(dri2_ctx->dri_context, out);<br>
+}<br>
+<br>
+static int<br>
+dri2_interop_export_object(_EGLDisplay *dpy, _EGLContext *ctx,<br>
+ const mesa_glinterop_export_in *in,<br>
+ mesa_glinterop_export_out *out)<br>
+{<br>
+ struct dri2_egl_display *dri2_dpy = dri2_egl_display(dpy);<br>
+ struct dri2_egl_context *dri2_ctx = dri2_egl_context(ctx);<br>
+<br>
+ if (!dri2_dpy->interop)<br>
+ return MESA_GLINTEROP_UNSUPPORTED;<br>
+<br>
+ return dri2_dpy->interop->export_object(dri2_ctx->dri_context, in, out);<br>
+}<br>
+<br>
static void<br>
dri2_unload(_EGLDriver *drv)<br>
{<br>
@@ -2622,6 +2652,8 @@ _eglBuiltInDriverDRI2(const char *args)<br>
dri2_drv->base.API.ClientWaitSyncKHR = dri2_client_wait_sync;<br>
dri2_drv->base.API.WaitSyncKHR = dri2_server_wait_sync;<br>
dri2_drv->base.API.DestroySyncKHR = dri2_destroy_sync;<br>
+ dri2_drv->base.API.GLInteropQueryDeviceInfo = dri2_interop_query_device_info;<br>
+ dri2_drv->base.API.GLInteropExportObject = dri2_interop_export_object;<br>
<br>
dri2_drv->base.Name = "DRI2";<br>
dri2_drv->base.Unload = dri2_unload;<br>
diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h<br>
index 52ad92b..d83bc1e 100644<br>
--- a/src/egl/drivers/dri2/egl_dri2.h<br>
+++ b/src/egl/drivers/dri2/egl_dri2.h<br>
@@ -174,6 +174,7 @@ struct dri2_egl_display<br>
const __DRI2configQueryExtension *config;<br>
const __DRI2fenceExtension *fence;<br>
const __DRI2rendererQueryExtension *rendererQuery;<br>
+ const __DRI2interopExtension *interop;<br>
int fd;<br>
<br>
int own_device;<br>
diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c<br>
index 32f6823..e229334 100644<br>
--- a/src/egl/main/eglapi.c<br>
+++ b/src/egl/main/eglapi.c<br>
@@ -88,6 +88,7 @@<br>
#include <string.h><br>
#include "c99_compat.h"<br>
#include "c11/threads.h"<br>
+#include "GL/mesa_glinterop.h"<br>
#include "eglcompiler.h"<br>
<br>
#include "eglglobals.h"<br>
@@ -1905,3 +1906,74 @@ eglGetProcAddress(const char *procname)<br>
<br>
RETURN_EGL_SUCCESS(NULL, ret);<br>
}<br>
+<br>
+static int<br>
+_eglLockDisplayInterop(EGLDisplay dpy, EGLContext context,<br>
+ _EGLDisplay **disp, _EGLDriver **drv,<br>
+ _EGLContext **ctx)<br>
+{<br>
+<br>
+ *disp = _eglLockDisplay(dpy);<br>
+ if (!*disp || !(*disp)->Initialized || !(*disp)->Driver) {<br>
+ if (*disp)<br>
+ _eglUnlockDisplay(*disp);<br>
+ return MESA_GLINTEROP_INVALID_DISPLAY;<br>
+ }<br>
+<br>
+ *drv = (*disp)->Driver;<br>
+<br>
+ *ctx = _eglLookupContext(context, *disp);<br>
+ if (!*ctx ||<br>
+ ((*ctx)->ClientAPI != EGL_OPENGL_API &&<br>
+ (*ctx)->ClientAPI != EGL_OPENGL_ES_API)) {<br>
+ _eglUnlockDisplay(*disp);<br>
+ return MESA_GLINTEROP_INVALID_CONTEXT;<br>
+ }<br>
+<br>
+ return MESA_GLINTEROP_SUCCESS;<br>
+}<br>
+<br>
+GLAPI int GLAPIENTRY<br>
+MesaGLInteropEGLQueryDeviceInfo(EGLDisplay dpy, EGLContext context,<br>
+ mesa_glinterop_device_info *out)<br>
+{<br>
+ _EGLDisplay *disp;<br>
+ _EGLDriver *drv;<br>
+ _EGLContext *ctx;<br>
+ int ret;<br>
+<br>
+ ret = _eglLockDisplayInterop(dpy, context, &disp, &drv, &ctx);<br>
+ if (ret != MESA_GLINTEROP_SUCCESS)<br>
+ return ret;<br>
+<br>
+ if (drv->API.GLInteropQueryDeviceInfo)<br>
+ ret = drv->API.GLInteropQueryDeviceInfo(disp, ctx, out);<br>
+ else<br>
+ ret = MESA_GLINTEROP_UNSUPPORTED;<br>
+<br>
+ _eglUnlockDisplay(disp);<br>
+ return ret;<br>
+}<br>
+<br>
+GLAPI int GLAPIENTRY<br>
+MesaGLInteropEGLExportObject(EGLDisplay dpy, EGLContext context,<br>
+ const mesa_glinterop_export_in *in,<br>
+ mesa_glinterop_export_out *out)<br>
+{<br>
+ _EGLDisplay *disp;<br>
+ _EGLDriver *drv;<br>
+ _EGLContext *ctx;<br>
+ int ret;<br>
+<br>
+ ret = _eglLockDisplayInterop(dpy, context, &disp, &drv, &ctx);<br>
+ if (ret != MESA_GLINTEROP_SUCCESS)<br>
+ return ret;<br>
+<br>
+ if (drv->API.GLInteropExportObject)<br>
+ ret = drv->API.GLInteropExportObject(disp, ctx, in, out);<br>
+ else<br>
+ ret = MESA_GLINTEROP_UNSUPPORTED;<br>
+<br>
+ _eglUnlockDisplay(disp);<br>
+ return ret;<br>
+}<br>
diff --git a/src/egl/main/eglapi.h b/src/egl/main/eglapi.h<br>
index 3f6d3c2..58327fd 100644<br>
--- a/src/egl/main/eglapi.h<br>
+++ b/src/egl/main/eglapi.h<br>
@@ -42,6 +42,9 @@ extern "C" {<br>
typedef void (*_EGLProc)(void);<br>
<br>
struct wl_display;<br>
+typedef struct _mesa_glinterop_device_info mesa_glinterop_device_info;<br>
+typedef struct _mesa_glinterop_export_in mesa_glinterop_export_in;<br>
+typedef struct _mesa_glinterop_export_out mesa_glinterop_export_out;<br>
<br>
/**<br>
* The API dispatcher jumps through these functions<br>
@@ -188,6 +191,12 @@ struct _egl_api<br>
EGLBoolean (*ExportDMABUFImageMESA)(_EGLDriver *drv, _EGLDisplay *disp,<br>
_EGLImage *img, EGLint *fds,<br>
EGLint *strides, EGLint *offsets);<br>
+<br>
+ int (*GLInteropQueryDeviceInfo)(_EGLDisplay *dpy, _EGLContext *ctx,<br>
+ mesa_glinterop_device_info *out);<br>
+ int (*GLInteropExportObject)(_EGLDisplay *dpy, _EGLContext *ctx,<br>
+ const mesa_glinterop_export_in *in,<br>
+ mesa_glinterop_export_out *out);<br>
};<br>
<span class="HOEnZb"><font color="#888888"><br>
<br>
--<br>
2.5.0<br>
<br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div>