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 aefba92c02..915c1b45d3 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 17 +#define __DRI_IMAGE_VERSION 18 /** * These formats correspond to the similarly named MESA_FORMAT_* @@ -1642,6 +1642,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 77f09271f0..e450769e7a 100644 --- a/src/egl/drivers/dri2/egl_dri2.c +++ b/src/egl/drivers/dri2/egl_dri2.c @@ -738,6 +738,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; + } } } @@ -1878,6 +1882,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) { @@ -1890,6 +1895,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; @@ -1912,6 +1920,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); } @@ -1970,6 +1981,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 @@ -2078,6 +2092,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; } @@ -2141,6 +2159,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); } @@ -2483,6 +2504,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; @@ -2556,6 +2580,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