Skip to contentSkip to conversation

ui: add XBGR8888 and ABGR8888 in drm_format_pixman_map

PATCH In review Ken Xue 3 participants 3 messages Sep 14, 2023 – Sep 15, 2023

lore
Share & tools
lore

Ken Xue

author
#0 lore raw

PATCH 1/1 ui: add XBGR8888 and ABGR8888 in drm_format_pixman_map

Android uses XBGR8888 and ABGR8888 as default scanout buffer, But qemu does not support them for qemu_pixman_to_drm_format conversion within virtio_gpu_create_dmabuf for virtio gpu.

so, add those 2 formats into drm_format_pixman_map.

---
 include/ui/qemu-pixman.h | 4 ++++
 ui/qemu-pixman.c         | 4 +++-
 2 files changed, 7 insertions(+), 1 deletion(-)
include/ui/qemu-pixman.h +4 -0
index 51f870932791..e587c48b1fde 100644
@@ -32,6 +32,8 @@
 # define PIXMAN_LE_r8g8b8     PIXMAN_b8g8r8
 # define PIXMAN_LE_a8r8g8b8   PIXMAN_b8g8r8a8
 # define PIXMAN_LE_x8r8g8b8   PIXMAN_b8g8r8x8
+# define PIXMAN_LE_a8b8g8r8   PIXMAN_r8g8b8a8
+# define PIXMAN_LE_x8b8g8r8   PIXMAN_r8g8b8x8
 #else
 # define PIXMAN_BE_r8g8b8     PIXMAN_b8g8r8
 # define PIXMAN_BE_x8r8g8b8   PIXMAN_b8g8r8x8
@@ -45,6 +47,8 @@
 # define PIXMAN_LE_r8g8b8     PIXMAN_r8g8b8
 # define PIXMAN_LE_a8r8g8b8   PIXMAN_a8r8g8b8
 # define PIXMAN_LE_x8r8g8b8   PIXMAN_x8r8g8b8
+# define PIXMAN_LE_a8b8g8r8   PIXMAN_a8b8g8r8
+# define PIXMAN_LE_x8b8g8r8   PIXMAN_x8b8g8r8
 #endif
 
 #define QEMU_PIXMAN_COLOR(r, g, b)                                               \
ui/qemu-pixman.c +3 -1
index be00a96340d3..b43ec38bf0e9 100644
@@ -96,7 +96,9 @@ static const struct {
 } drm_format_pixman_map[] = {
     { DRM_FORMAT_RGB888,   PIXMAN_LE_r8g8b8   },
     { DRM_FORMAT_ARGB8888, PIXMAN_LE_a8r8g8b8 },
-    { DRM_FORMAT_XRGB8888, PIXMAN_LE_x8r8g8b8 }
+    { DRM_FORMAT_XRGB8888, PIXMAN_LE_x8r8g8b8 },
+    { DRM_FORMAT_XBGR8888, PIXMAN_LE_x8b8g8r8 },
+    { DRM_FORMAT_ABGR8888, PIXMAN_LE_a8b8g8r8 },
 };
 
 pixman_format_code_t qemu_drm_format_to_pixman(uint32_t drm_format)

base-commit: 9a8af699677cdf58e92ff43f38ea74bbe9d37ab0

Signature · 1 line
2.35.1
#1 lore raw

Cc'ing maintainers:

$ ./scripts/get_maintainer.pl -f ui/qemu-pixman.c
Gerd Hoffmann <[email protected]> (odd fixer:Graphics)
"Marc-André Lureau" <[email protected]> (odd fixer:Graphics)
Quoted 51 lines · Ken Xue

Android uses XBGR8888 and ABGR8888 as default scanout buffer, But qemu does not support them for qemu_pixman_to_drm_format conversion within virtio_gpu_create_dmabuf for virtio gpu.

so, add those 2 formats into drm_format_pixman_map.

---
  include/ui/qemu-pixman.h | 4 ++++
  ui/qemu-pixman.c         | 4 +++-
  2 files changed, 7 insertions(+), 1 deletion(-)
include/ui/qemu-pixman.h +4 -0
index 51f870932791..e587c48b1fde 100644
@@ -32,6 +32,8 @@
  # define PIXMAN_LE_r8g8b8     PIXMAN_b8g8r8
  # define PIXMAN_LE_a8r8g8b8   PIXMAN_b8g8r8a8
  # define PIXMAN_LE_x8r8g8b8   PIXMAN_b8g8r8x8
+# define PIXMAN_LE_a8b8g8r8   PIXMAN_r8g8b8a8
+# define PIXMAN_LE_x8b8g8r8   PIXMAN_r8g8b8x8
  #else
  # define PIXMAN_BE_r8g8b8     PIXMAN_b8g8r8
  # define PIXMAN_BE_x8r8g8b8   PIXMAN_b8g8r8x8
@@ -45,6 +47,8 @@
  # define PIXMAN_LE_r8g8b8     PIXMAN_r8g8b8
  # define PIXMAN_LE_a8r8g8b8   PIXMAN_a8r8g8b8
  # define PIXMAN_LE_x8r8g8b8   PIXMAN_x8r8g8b8
+# define PIXMAN_LE_a8b8g8r8   PIXMAN_a8b8g8r8
+# define PIXMAN_LE_x8b8g8r8   PIXMAN_x8b8g8r8
  #endif
 
  #define QEMU_PIXMAN_COLOR(r, g, b)                                               \
ui/qemu-pixman.c +3 -1
index be00a96340d3..b43ec38bf0e9 100644
@@ -96,7 +96,9 @@ static const struct {
  } drm_format_pixman_map[] = {
      { DRM_FORMAT_RGB888,   PIXMAN_LE_r8g8b8   },
      { DRM_FORMAT_ARGB8888, PIXMAN_LE_a8r8g8b8 },
-    { DRM_FORMAT_XRGB8888, PIXMAN_LE_x8r8g8b8 }
+    { DRM_FORMAT_XRGB8888, PIXMAN_LE_x8r8g8b8 },
+    { DRM_FORMAT_XBGR8888, PIXMAN_LE_x8b8g8r8 },
+    { DRM_FORMAT_ABGR8888, PIXMAN_LE_a8b8g8r8 },
  };
 
  pixman_format_code_t qemu_drm_format_to_pixman(uint32_t drm_format)

base-commit: 9a8af699677cdf58e92ff43f38ea74bbe9d37ab0

Reviewed-by on v1 1/1
#2 lore raw
In reply to Ken Xue
Quoted 8 lines · Ken Xue

Android uses XBGR8888 and ABGR8888 as default scanout buffer, But qemu does not support them for qemu_pixman_to_drm_format conversion within virtio_gpu_create_dmabuf for virtio gpu.

so, add those 2 formats into drm_format_pixman_map.

Quoted 48 lines
---
 include/ui/qemu-pixman.h | 4 ++++
 ui/qemu-pixman.c         | 4 +++-
 2 files changed, 7 insertions(+), 1 deletion(-)
include/ui/qemu-pixman.h +4 -0
index 51f870932791..e587c48b1fde 100644
@@ -32,6 +32,8 @@
 # define PIXMAN_LE_r8g8b8     PIXMAN_b8g8r8
 # define PIXMAN_LE_a8r8g8b8   PIXMAN_b8g8r8a8
 # define PIXMAN_LE_x8r8g8b8   PIXMAN_b8g8r8x8
+# define PIXMAN_LE_a8b8g8r8   PIXMAN_r8g8b8a8
+# define PIXMAN_LE_x8b8g8r8   PIXMAN_r8g8b8x8
 #else
 # define PIXMAN_BE_r8g8b8     PIXMAN_b8g8r8
 # define PIXMAN_BE_x8r8g8b8   PIXMAN_b8g8r8x8
@@ -45,6 +47,8 @@
 # define PIXMAN_LE_r8g8b8     PIXMAN_r8g8b8
 # define PIXMAN_LE_a8r8g8b8   PIXMAN_a8r8g8b8
 # define PIXMAN_LE_x8r8g8b8   PIXMAN_x8r8g8b8
+# define PIXMAN_LE_a8b8g8r8   PIXMAN_a8b8g8r8
+# define PIXMAN_LE_x8b8g8r8   PIXMAN_x8b8g8r8
 #endif
 
 #define QEMU_PIXMAN_COLOR(r, g, b)                                               \
ui/qemu-pixman.c +3 -1
index be00a96340d3..b43ec38bf0e9 100644
@@ -96,7 +96,9 @@ static const struct {
 } drm_format_pixman_map[] = {
     { DRM_FORMAT_RGB888,   PIXMAN_LE_r8g8b8   },
     { DRM_FORMAT_ARGB8888, PIXMAN_LE_a8r8g8b8 },
-    { DRM_FORMAT_XRGB8888, PIXMAN_LE_x8r8g8b8 }
+    { DRM_FORMAT_XRGB8888, PIXMAN_LE_x8r8g8b8 },
+    { DRM_FORMAT_XBGR8888, PIXMAN_LE_x8b8g8r8 },
+    { DRM_FORMAT_ABGR8888, PIXMAN_LE_a8b8g8r8 },
 };
 
 pixman_format_code_t qemu_drm_format_to_pixman(uint32_t drm_format)

base-commit: 9a8af699677cdf58e92ff43f38ea74bbe9d37ab0 --
2.35.1

Signature · 1 line
Marc-André Lureau