[Fix] (SharedImage): allocate and import ARGB8888/XRGB8888 images so KWin's offscreen Quick views get buffers

This commit is contained in:
2026-10-02 09:37:17 -04:00
parent 0e314f645e
commit 672261764e
11 changed files with 55 additions and 20 deletions
+5 -4
View File
@@ -1578,9 +1578,9 @@ namespace MobileGL {
}
Bool EGLContext::IsDmaBufFourccSupported(Uint32 fourcc) {
// Only the GL RGBA8 byte order: an ARGB/XRGB-ordered import would need the
// backend to swizzle the image it binds, which nothing records yet.
return fourcc == kDrmFourccAbgr8888 || fourcc == kDrmFourccXbgr8888;
// The four orders a shared image can be allocated under (SharedImageApi.h).
return fourcc == kDrmFourccAbgr8888 || fourcc == kDrmFourccXbgr8888 || fourcc == kDrmFourccArgb8888 ||
fourcc == kDrmFourccXrgb8888;
}
Bool EGLContext::PrepareDmaBufImport(EGLDisplayHandle display, EGLContextHandle context,
@@ -1753,7 +1753,8 @@ namespace MobileGL {
SetError(EGL_BAD_PARAMETER);
return false;
}
static constexpr Uint32 kFormats[] = {kDrmFourccAbgr8888, kDrmFourccXbgr8888};
static constexpr Uint32 kFormats[] = {kDrmFourccAbgr8888, kDrmFourccXbgr8888, kDrmFourccArgb8888,
kDrmFourccXrgb8888};
const EGLint total = available ? static_cast<EGLint>(std::size(kFormats)) : 0;
if (maxFormats == 0) {
*numFormats = total;
+4 -1
View File
@@ -149,7 +149,8 @@ namespace MobileGL {
// DMA-BUF IMPORT (EGL_EXT_image_dma_buf_import[_modifiers]). A dma-buf this library
// can name is one of the backend's shared images (MG_Backend::SharedImageExport):
// single plane, DRM ABGR8888 or XBGR8888 - the GL RGBA8 byte order. The state
// single plane, DRM ABGR8888 / XBGR8888 / ARGB8888 / XRGB8888 (all stored RGBA8 by the
// server, whose layout no client can observe). The state
// validates and records; the backend identifies the descriptor in between.
struct DmaBufImportAttribs {
EGLint Width = 0;
@@ -169,6 +170,8 @@ namespace MobileGL {
};
static constexpr Uint32 kDrmFourccAbgr8888 = 0x34324241u; // 'AB24'
static constexpr Uint32 kDrmFourccXbgr8888 = 0x34324258u; // 'XB24'
static constexpr Uint32 kDrmFourccArgb8888 = 0x34325241u; // 'AR24'
static constexpr Uint32 kDrmFourccXrgb8888 = 0x34325258u; // 'XR24'
static Bool IsDmaBufFourccSupported(Uint32 fourcc);
// The checks eglCreateImage owes an EGL_LINUX_DMA_BUF_EXT target before anything