From: Daniel Stone <dani...@collabora.com> Provide a hook to inform the driver that implicit synchronization should be suppressed.
Reviewed-by: Jason Ekstrand <ja...@jlekstrand.net> --- include/GL/internal/dri_interface.h | 10 +++++++++- src/egl/drivers/dri2/egl_dri2.c | 27 +++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h index a0c11f1..be12918 100644 --- a/include/GL/internal/dri_interface.h +++ b/include/GL/internal/dri_interface.h @@ -1220,7 +1220,7 @@ struct __DRIdri2ExtensionRec { * extensions. */ #define __DRI_IMAGE "DRI_IMAGE" -#define __DRI_IMAGE_VERSION 17 +#define __DRI_IMAGE_VERSION 18 /** * These formats correspond to the similarly named MESA_FORMAT_* @@ -1691,6 +1691,14 @@ struct __DRIimageExtensionRec { int renderbuffer, void *loaderPrivate, unsigned *error); + + /* + * Suppress implicit synchronization for the image. Not mandatory but + * cannot fail if provided. + * + * \since 18 + */ + void (*suppressImplicitSync)(__DRIimage *image); }; diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c index 17b646e..34cdb9f 100644 --- a/src/egl/drivers/dri2/egl_dri2.c +++ b/src/egl/drivers/dri2/egl_dri2.c @@ -772,6 +772,10 @@ dri2_setup_screen(_EGLDisplay *disp) disp->Extensions.EXT_image_dma_buf_import_modifiers = EGL_TRUE; } #endif + if (dri2_dpy->image->base.version >= 18 && + dri2_dpy->image->suppressImplicitSync) { + disp->Extensions.EXT_image_implicit_sync_control = EGL_TRUE; + } } if (dri2_dpy->flush_control) @@ -1880,6 +1884,7 @@ dri2_create_image_khr_renderbuffer(_EGLDisplay *disp, _EGLContext *ctx, struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); struct dri2_egl_context *dri2_ctx = dri2_egl_context(ctx); GLuint renderbuffer = (GLuint) (uintptr_t) buffer; + _EGLImageAttribs attrs; __DRIimage *dri_image; if (renderbuffer == 0) { @@ -1892,6 +1897,9 @@ dri2_create_image_khr_renderbuffer(_EGLDisplay *disp, _EGLContext *ctx, return EGL_NO_IMAGE_KHR; } + if (!_eglParseImageAttribList(&attrs, disp, attr_list)) + return NULL; + if (dri2_dpy->image->base.version >= 17 && dri2_dpy->image->createImageFromRenderbuffer2) { unsigned error = ~0; @@ -1914,6 +1922,9 @@ dri2_create_image_khr_renderbuffer(_EGLDisplay *disp, _EGLContext *ctx, } } + if (dri_image && attrs.ExplicitSync) + dri2_dpy->image->suppressImplicitSync(dri_image); + return dri2_create_image_from_dri(disp, dri_image); } @@ -1973,6 +1984,9 @@ dri2_create_image_wayland_wl_buffer(_EGLDisplay *disp, _EGLContext *ctx, return NULL; } + if (attrs.ExplicitSync) + dri2_dpy->image->suppressImplicitSync(dri_image); + return dri2_create_image_from_dri(disp, dri_image); } #endif @@ -2081,6 +2095,10 @@ dri2_create_image_khr_texture(_EGLDisplay *disp, _EGLContext *ctx, free(dri2_img); return EGL_NO_IMAGE_KHR; } + + if (attrs.ExplicitSync) + dri2_dpy->image->suppressImplicitSync(dri2_img->dri_image); + return &dri2_img->base; } @@ -2144,6 +2162,9 @@ dri2_create_image_mesa_drm_buffer(_EGLDisplay *disp, _EGLContext *ctx, pitch, NULL); + if (dri_image && attrs.ExplicitSync) + dri2_dpy->image->suppressImplicitSync(dri_image); + return dri2_create_image_from_dri(disp, dri_image); } @@ -2486,6 +2507,9 @@ dri2_create_image_dma_buf(_EGLDisplay *disp, _EGLContext *ctx, if (!dri_image) return EGL_NO_IMAGE_KHR; + if (attrs.ExplicitSync) + dri2_dpy->image->suppressImplicitSync(dri_image); + res = dri2_create_image_from_dri(disp, dri_image); return res; @@ -2559,6 +2583,9 @@ dri2_create_drm_image_mesa(_EGLDriver *drv, _EGLDisplay *disp, return EGL_NO_IMAGE_KHR; } + if (attrs.ExplicitSync) + dri2_dpy->image->suppressImplicitSync(dri2_img->dri_image); + return &dri2_img->base; } -- 2.5.0.400.gff86faf _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev