From: Daniel Stone <dani...@collabora.com> Provide a hook to inform the driver that implicit synchronization should be suppressed. --- 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 783ff1c70d..f673d50cdf 100644 --- a/include/GL/internal/dri_interface.h +++ b/include/GL/internal/dri_interface.h @@ -1180,7 +1180,7 @@ struct __DRIdri2ExtensionRec { * extensions. */ #define __DRI_IMAGE "DRI_IMAGE" -#define __DRI_IMAGE_VERSION 16 +#define __DRI_IMAGE_VERSION 17 /** * These formats correspond to the similarly named MESA_FORMAT_* @@ -1625,6 +1625,14 @@ struct __DRIimageExtensionRec { GLboolean (*queryDmaBufFormatModifierAttribs)(__DRIscreen *screen, uint32_t fourcc, uint64_t modifier, int attrib, uint64_t *value); + + /* + * Suppress implicit synchronization for the image. Not mandatory but + * cannot fail if provided. + * + * \since 17 + */ + void (*suppressImplicitSync)(__DRIimage *image); }; diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c index 0dce2246c1..b17675e1ba 100644 --- a/src/egl/drivers/dri2/egl_dri2.c +++ b/src/egl/drivers/dri2/egl_dri2.c @@ -725,6 +725,10 @@ dri2_setup_screen(_EGLDisplay *disp) disp->Extensions.EXT_image_dma_buf_import_modifiers = EGL_TRUE; } #endif + if (dri2_dpy->image->base.version >= 17 && + dri2_dpy->image->suppressImplicitSync) { + disp->Extensions.EXT_image_implicit_sync_control = EGL_TRUE; + } } } @@ -1844,6 +1848,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) { @@ -1856,10 +1861,16 @@ dri2_create_image_khr_renderbuffer(_EGLDisplay *disp, _EGLContext *ctx, return EGL_NO_IMAGE_KHR; } + if (!_eglParseImageAttribList(&attrs, disp, attr_list)) + return NULL; + dri_image = dri2_dpy->image->createImageFromRenderbuffer(dri2_ctx->dri_context, renderbuffer, NULL); + if (dri_image && attrs.ExplicitSync) + dri2_dpy->image->suppressImplicitSync(dri_image); + return dri2_create_image_from_dri(disp, dri_image); } @@ -1918,6 +1929,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 @@ -2051,6 +2065,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; } @@ -2114,6 +2132,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); } @@ -2456,6 +2477,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; @@ -2529,6 +2553,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.13.0 _______________________________________________ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: https://lists.x.org/mailman/listinfo/xorg-devel