[Mesa-dev] [RFC v5 04/19] dri: Add suppressImplicitSync to DRIimageExtension
Louis-Francis Ratté-Boulianne
lfrb at collabora.com
Mon Nov 6 22:02:34 UTC 2017
From: Daniel Stone <daniels at 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 98402eae05..952f557f54 100644
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
@@ -1186,7 +1186,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_*
@@ -1648,6 +1648,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 503450542e..8a9749d207 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -765,6 +765,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;
+ }
}
}
@@ -1922,6 +1926,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) {
@@ -1934,6 +1939,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;
@@ -1956,6 +1964,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);
}
@@ -2014,6 +2025,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
@@ -2122,6 +2136,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;
}
@@ -2185,6 +2203,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);
}
@@ -2527,6 +2548,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;
@@ -2600,6 +2624,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
More information about the mesa-dev
mailing list