From e384d75b120ce60954c545e8c6edbe98fd01bea7 Mon Sep 17 00:00:00 2001 From: Emil Velikov Date: Thu, 21 Apr 2016 17:29:16 +0100 Subject: mesa_glinterop: make GL interop version field bidirectional MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This allows clear and easy communication between the two. Caller: Requesting information (struct vN) Callee: I know how to deal with older version (vN-1) only. Here is your data and the version I support. Caller: Older version ? Sure I'll cap all access to the fields provided by the older version (vN-1) Signed-off-by: Emil Velikov Reviewed-by: Marek Olšák Tested-by: Tom Stellard --- include/GL/internal/dri_interface.h | 2 +- include/GL/mesa_glinterop.h | 23 +++++++++++++++++++---- 2 files changed, 20 insertions(+), 5 deletions(-) (limited to 'include') diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h index 4008658dce..f80233b82b 100644 --- a/include/GL/internal/dri_interface.h +++ b/include/GL/internal/dri_interface.h @@ -414,7 +414,7 @@ struct __DRI2interopExtensionRec { /** Same as MesaGLInterop*ExportObject. */ int (*export_object)(__DRIcontext *ctx, - const mesa_glinterop_export_in *in, + mesa_glinterop_export_in *in, mesa_glinterop_export_out *out); }; diff --git a/include/GL/mesa_glinterop.h b/include/GL/mesa_glinterop.h index 0a22b9be32..b805d63d3e 100644 --- a/include/GL/mesa_glinterop.h +++ b/include/GL/mesa_glinterop.h @@ -94,6 +94,11 @@ enum { */ typedef struct _mesa_glinterop_device_info { /* The caller should set this to the version of the struct they support */ + /* The callee will overwrite it if it supports a lower version. + * + * The caller should check the value and access up-to the version supported + * by the the callee. + */ /* NOTE: Do not use the MESA_GLINTEROP_DEVICE_INFO_VERSION macro */ uint32_t version; @@ -117,6 +122,11 @@ typedef struct _mesa_glinterop_device_info { */ typedef struct _mesa_glinterop_export_in { /* The caller should set this to the version of the struct they support */ + /* The callee will overwrite it if it supports a lower version. + * + * The caller should check the value and access up-to the version supported + * by the the callee. + */ /* NOTE: Do not use the MESA_GLINTEROP_EXPORT_IN_VERSION macro */ uint32_t version; @@ -177,6 +187,11 @@ typedef struct _mesa_glinterop_export_in { */ typedef struct _mesa_glinterop_export_out { /* The caller should set this to the version of the struct they support */ + /* The callee will overwrite it if it supports a lower version. + * + * The caller should check the value and access up-to the version supported + * by the the callee. + */ /* NOTE: Do not use the MESA_GLINTEROP_EXPORT_OUT_VERSION macro */ uint32_t version; @@ -257,7 +272,7 @@ MesaGLInteropEGLQueryDeviceInfo(EGLDisplay dpy, EGLContext context, */ int MesaGLInteropGLXExportObject(Display *dpy, GLXContext context, - const mesa_glinterop_export_in *in, + mesa_glinterop_export_in *in, mesa_glinterop_export_out *out); @@ -267,7 +282,7 @@ MesaGLInteropGLXExportObject(Display *dpy, GLXContext context, */ int MesaGLInteropEGLExportObject(EGLDisplay dpy, EGLContext context, - const mesa_glinterop_export_in *in, + mesa_glinterop_export_in *in, mesa_glinterop_export_out *out); @@ -276,10 +291,10 @@ typedef int (PFNMESAGLINTEROPGLXQUERYDEVICEINFOPROC)(Display *dpy, GLXContext co typedef int (PFNMESAGLINTEROPEGLQUERYDEVICEINFOPROC)(EGLDisplay dpy, EGLContext context, mesa_glinterop_device_info *out); typedef int (PFNMESAGLINTEROPGLXEXPORTOBJECTPROC)(Display *dpy, GLXContext context, - const mesa_glinterop_export_in *in, + mesa_glinterop_export_in *in, mesa_glinterop_export_out *out); typedef int (PFNMESAGLINTEROPEGLEXPORTOBJECTPROC)(EGLDisplay dpy, EGLContext context, - const mesa_glinterop_export_in *in, + mesa_glinterop_export_in *in, mesa_glinterop_export_out *out); #ifdef __cplusplus -- cgit v1.2.3