From ace2eda073f838e1327abd7ffb8e5111e52f4b86 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Fri, 23 Jul 2021 17:22:04 +0200 Subject: [PATCH] render/egl: set EGL_IMAGE_PRESERVED_KHR Without setting this the EGL implementation is allowed to perform destructive actions on the buffer when imported: its contents become undefined. This is mostly a pedantic change, because Mesa processes the attrib and does absolutely nothing with it. --- render/egl.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/render/egl.c b/render/egl.c index 9a3ce29c..9fa2add5 100644 --- a/render/egl.c +++ b/render/egl.c @@ -525,6 +525,11 @@ EGLImageKHR wlr_egl_create_image_from_dmabuf(struct wlr_egl *egl, attribs[atti++] = attributes->modifier >> 32; } } + + // Our clients don't expect our usage to trash the buffer contents + attribs[atti++] = EGL_IMAGE_PRESERVED_KHR; + attribs[atti++] = EGL_TRUE; + attribs[atti++] = EGL_NONE; assert(atti < sizeof(attribs)/sizeof(attribs[0]));