summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Michael <cmichael@igalia.com>2024-02-15 08:49:06 -0500
committerChristopher Michael <cmichael@igalia.com>2024-02-26 07:06:28 -0500
commit6ab022fdfcfedd28f4b5dbd8d3299414a367746f (patch)
treeed2ad5fd39aae111018a98e0aa1e9e1c6a926eac
parent96d63eb59e34c647cda1cbb489265f8c536ae055 (diff)
kmscube: Fix incorrect modifier check in create_framebuffer functionHEADmaster
When importing an egl image from a linux dma buf fd, we need to pass the proper image attributes to eglCreateImageKHR. The modifier check here should not ignore DRM_FORMAT_MOD_LINEAR when setting EGL_DMA_BUF_PLANE0_MODIFIER_LO/HI_EXT else the ordering of samples within a plane will be incorrect, resulting in incorrect/garbled pixels being presented. v2: Update code changes to set EGL_DMA_BUF_PLANE0_MODIFIER_LO/HI whenever an extension exposes modifiers so that INVALID modifiers are accepted (Daniel Stone)
-rw-r--r--common.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/common.c b/common.c
index e75ed04..e52d480 100644
--- a/common.c
+++ b/common.c
@@ -253,15 +253,13 @@ create_framebuffer(const struct egl *egl, struct gbm_bo *bo,
if (egl->modifiers_supported) {
const uint64_t modifier = gbm_bo_get_modifier(bo);
- if (modifier != DRM_FORMAT_MOD_LINEAR) {
- size_t attrs_index = 12;
- khr_image_attrs[attrs_index++] =
- EGL_DMA_BUF_PLANE0_MODIFIER_LO_EXT;
- khr_image_attrs[attrs_index++] = modifier & 0xfffffffful;
- khr_image_attrs[attrs_index++] =
- EGL_DMA_BUF_PLANE0_MODIFIER_HI_EXT;
- khr_image_attrs[attrs_index++] = modifier >> 32;
- }
+ size_t attrs_index = 12;
+ khr_image_attrs[attrs_index++] =
+ EGL_DMA_BUF_PLANE0_MODIFIER_LO_EXT;
+ khr_image_attrs[attrs_index++] = modifier & 0xfffffffful;
+ khr_image_attrs[attrs_index++] =
+ EGL_DMA_BUF_PLANE0_MODIFIER_HI_EXT;
+ khr_image_attrs[attrs_index++] = modifier >> 32;
}
fb->image = egl->eglCreateImageKHR(egl->display, EGL_NO_CONTEXT,