mesa/st, dri2, wgl, glx: Restore flush_objects interop backward compat
In commit1396dc1c
a new output field was added as a parameter, but this is a problem since the signature of the function are not versionned. The flush function didn't have a versionned output struct. So what I'm proposing here is that if the version of the input argument is new enough (bumped to 2 here), then we re-use the existing argument, which until now was directly a pointer to GLsync, and instead use it as a pointer to a versioned struct. We're just changing one pointer type to another, so in C, this should be fine AFAIK. Fixes:1396dc1c
Signed-off-by: Sylvain Munaut <tnt@246tNt.com> Reviewed-by: Jesse Natalie <jenatali@microsoft.com> Reviewed-by: Karol Herbst <kherbst@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26315>
This commit is contained in:

committed by
Marge Bot

parent
76b751c3b1
commit
0fa85b983f
@@ -441,6 +441,7 @@ struct __DRI2fenceExtensionRec {
|
||||
struct mesa_glinterop_device_info;
|
||||
struct mesa_glinterop_export_in;
|
||||
struct mesa_glinterop_export_out;
|
||||
struct mesa_glinterop_flush_out;
|
||||
typedef struct __GLsync *GLsync;
|
||||
|
||||
struct __DRI2interopExtensionRec {
|
||||
@@ -462,7 +463,7 @@ struct __DRI2interopExtensionRec {
|
||||
*/
|
||||
int (*flush_objects)(__DRIcontext *ctx,
|
||||
unsigned count, struct mesa_glinterop_export_in *objects,
|
||||
GLsync *sync, int *fence_fd);
|
||||
struct mesa_glinterop_flush_out *out);
|
||||
};
|
||||
|
||||
|
||||
|
@@ -147,7 +147,7 @@ struct mesa_glinterop_device_info {
|
||||
/* Structure version 3 ends here. */
|
||||
};
|
||||
|
||||
#define MESA_GLINTEROP_EXPORT_IN_VERSION 1
|
||||
#define MESA_GLINTEROP_EXPORT_IN_VERSION 2
|
||||
|
||||
/**
|
||||
* Input parameters to Mesa interop export functions.
|
||||
@@ -210,6 +210,12 @@ struct mesa_glinterop_export_in {
|
||||
*/
|
||||
void *out_driver_data;
|
||||
/* Structure version 1 ends here. */
|
||||
|
||||
/* Structure version 2 starts here. */
|
||||
/* NOTE: Version 2 doesn't add any fields to input but redefines the
|
||||
* argument to flush call to `struct mesa_glinterop_flush_out *`
|
||||
* instead of `GLsync *` */
|
||||
/* Structure version 2 ends here. */
|
||||
};
|
||||
|
||||
#define MESA_GLINTEROP_EXPORT_OUT_VERSION 2
|
||||
@@ -286,6 +292,28 @@ struct mesa_glinterop_export_out {
|
||||
/* Structure version 2 ends here. */
|
||||
};
|
||||
|
||||
#define MESA_GLINTEROP_FLUSH_OUT_VERSION 1
|
||||
|
||||
/**
|
||||
* Outputs of Mesa interop flush functions.
|
||||
*/
|
||||
struct mesa_glinterop_flush_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 callee.
|
||||
*/
|
||||
/* NOTE: Do not use the MESA_GLINTEROP_EXPORT_OUT_VERSION macro */
|
||||
uint32_t version;
|
||||
|
||||
/* GLsync to map to CL event, caller set it non-NULL to be filled */
|
||||
GLsync *sync;
|
||||
|
||||
/* fence_fd to use in CL, caller set it to non-NULL to be filled */
|
||||
int *fence_fd;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Query device information.
|
||||
@@ -362,15 +390,14 @@ wglMesaGLInteropExportObject(HDC dpy, HGLRC context,
|
||||
* \param context GLX context
|
||||
* \param count number of resources
|
||||
* \param resources resources to flush
|
||||
* \param sync optional GLsync to map to CL event
|
||||
* \param fence_fd optional fence_fd to use in CL
|
||||
* \param out return values
|
||||
*
|
||||
* \return MESA_GLINTEROP_SUCCESS or MESA_GLINTEROP_* != 0 on error
|
||||
*/
|
||||
int
|
||||
MesaGLInteropGLXFlushObjects(struct _XDisplay *dpy, struct __GLXcontextRec *context,
|
||||
unsigned count, struct mesa_glinterop_export_in *resources,
|
||||
GLsync *sync, int *fence_fd);
|
||||
struct mesa_glinterop_flush_out *out);
|
||||
|
||||
/**
|
||||
* Same as MesaGLInteropGLXFlushObjects except that it accepts
|
||||
@@ -379,16 +406,16 @@ MesaGLInteropGLXFlushObjects(struct _XDisplay *dpy, struct __GLXcontextRec *cont
|
||||
int
|
||||
MesaGLInteropEGLFlushObjects(EGLDisplay dpy, EGLContext context,
|
||||
unsigned count, struct mesa_glinterop_export_in *resources,
|
||||
GLsync *sync, int *fence_fd);
|
||||
struct mesa_glinterop_flush_out *out);
|
||||
|
||||
/**
|
||||
* Same as MesaGLInteropGLXFlushObjects except that it accepts
|
||||
* HDC and HGLRC, and not a fence_fd.
|
||||
* HDC and HGLRC.
|
||||
*/
|
||||
int
|
||||
wglMesaGLInteropFlushObjects(HDC dpy, HGLRC context,
|
||||
unsigned count, struct mesa_glinterop_export_in *resources,
|
||||
GLsync *sync);
|
||||
struct mesa_glinterop_flush_out *out);
|
||||
|
||||
|
||||
typedef int (*PFNMESAGLINTEROPGLXQUERYDEVICEINFOPROC)(struct _XDisplay *dpy, struct __GLXcontextRec *context,
|
||||
@@ -408,13 +435,13 @@ typedef int (*PFNWGLMESAGLINTEROPEXPORTOBJECTPROC)(HDC dpy, HGLRC context,
|
||||
struct mesa_glinterop_export_out *out);
|
||||
typedef int (*PFNMESAGLINTEROPGLXFLUSHOBJECTSPROC)(struct _XDisplay *dpy, struct __GLXcontextRec *context,
|
||||
unsigned count, struct mesa_glinterop_export_in *resources,
|
||||
GLsync *sync, int *fence_fd);
|
||||
struct mesa_glinterop_flush_out *out);
|
||||
typedef int (*PFNMESAGLINTEROPEGLFLUSHOBJECTSPROC)(EGLDisplay dpy, EGLContext context,
|
||||
unsigned count, struct mesa_glinterop_export_in *resources,
|
||||
GLsync *sync, int *fence_fd);
|
||||
struct mesa_glinterop_flush_out *out);
|
||||
typedef int (*PFNWGLMESAGLINTEROPFLUSHOBJECTSPROC)(HDC dpy, HGLRC context,
|
||||
unsigned count, struct mesa_glinterop_export_in *resources,
|
||||
GLsync *sync);
|
||||
struct mesa_glinterop_flush_out *out);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
Reference in New Issue
Block a user