From 2dd519626793c2b308d46914425cf56cf8bcaa2d Mon Sep 17 00:00:00 2001 From: Robert Mader Date: Sun, 7 May 2023 21:59:48 +0200 Subject: [PATCH] egl: Set EGL_IMAGE_PRESERVED_KHR on DMABUF import Otherwise drivers would be free to alter the buffer content. While no driver is known to do so, it's probably good to make things explicit. See also `import_simple_dmabuf()` in Weston. Part-of: --- src/backends/meta-egl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/backends/meta-egl.c b/src/backends/meta-egl.c index 07e46812d..06a1661f2 100644 --- a/src/backends/meta-egl.c +++ b/src/backends/meta-egl.c @@ -609,7 +609,7 @@ meta_egl_create_dmabuf_image (MetaEgl *egl, const uint64_t *modifiers, GError **error) { - EGLint attribs[37]; + EGLint attribs[39]; int atti = 0; /* This requires the Mesa commit in @@ -626,6 +626,8 @@ meta_egl_create_dmabuf_image (MetaEgl *egl, attribs[atti++] = height; attribs[atti++] = EGL_LINUX_DRM_FOURCC_EXT; attribs[atti++] = drm_format; + attribs[atti++] = EGL_IMAGE_PRESERVED_KHR; + attribs[atti++] = EGL_TRUE; if (n_planes > 0) {