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 adcaae0bab..2cb1ce8263 100644 --- a/src/egl/drivers/dri2/egl_dri2.c +++ b/src/egl/drivers/dri2/egl_dri2.c @@ -737,6 +737,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; + } } } @@ -1856,6 +1860,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) { @@ -1868,10 +1873,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); } @@ -1930,6 +1941,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 @@ -2063,6 +2077,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; } @@ -2126,6 +2144,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); } @@ -2468,6 +2489,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; @@ -2541,6 +2565,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 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev