diff options
author | Marek Olšák <[email protected]> | 2016-03-03 18:43:53 +0100 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2016-04-20 12:18:47 +0200 |
commit | 37d3a26bd620703f63673101f4093d13fb97ddef (patch) | |
tree | 6f7dd03d13b7c6153a963abd47640e9b41aa3de7 /src/glx/glxcmds.c | |
parent | b6eda708431b91a3b568da0efac845c08cb36796 (diff) |
glx: implement GLX part of interop interface (v2)
v2: - use const
Diffstat (limited to 'src/glx/glxcmds.c')
-rw-r--r-- | src/glx/glxcmds.c | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/src/glx/glxcmds.c b/src/glx/glxcmds.c index 93e8db5a367..63f492128bc 100644 --- a/src/glx/glxcmds.c +++ b/src/glx/glxcmds.c @@ -54,6 +54,7 @@ #include <X11/Xlib-xcb.h> #include <xcb/xcb.h> #include <xcb/glx.h> +#include "GL/mesa_glinterop.h" static const char __glXGLXClientVendorName[] = "Mesa Project and SGI"; static const char __glXGLXClientVersion[] = "1.4"; @@ -2691,3 +2692,56 @@ __glXGetUST(int64_t * ust) } } #endif /* GLX_DIRECT_RENDERING */ + +#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) + +GLAPI int GLAPIENTRY +MesaGLInteropGLXQueryDeviceInfo(Display *dpy, GLXContext context, + mesa_glinterop_device_info *out) +{ + struct glx_context *gc = (struct glx_context*)context; + int ret; + + __glXLock(); + + if (!gc || gc->xid == None || !gc->isDirect) { + __glXUnlock(); + return MESA_GLINTEROP_INVALID_CONTEXT; + } + + if (!gc->vtable->interop_query_device_info) { + __glXUnlock(); + return MESA_GLINTEROP_UNSUPPORTED; + } + + ret = gc->vtable->interop_query_device_info(gc, out); + __glXUnlock(); + return ret; +} + +GLAPI int GLAPIENTRY +MesaGLInteropGLXExportObject(Display *dpy, GLXContext context, + const mesa_glinterop_export_in *in, + mesa_glinterop_export_out *out) +{ + struct glx_context *gc = (struct glx_context*)context; + int ret; + + __glXLock(); + + if (!gc || gc->xid == None || !gc->isDirect) { + __glXUnlock(); + return MESA_GLINTEROP_INVALID_CONTEXT; + } + + if (!gc->vtable->interop_export_object) { + __glXUnlock(); + return MESA_GLINTEROP_UNSUPPORTED; + } + + ret = gc->vtable->interop_export_object(gc, in, out); + __glXUnlock(); + return ret; +} + +#endif /* defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) */ |