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: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2990>
This commit is contained in:
Robert Mader 2023-05-07 21:59:48 +02:00
parent 29ec2d2e20
commit 2dd5196267

View File

@ -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)
{