All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/vkms: Add DRM_FORMAT_XBGR8888 support to writeback
@ 2026-11-24  5:49 Karthik Sarvan
  2026-11-24 11:14 ` Oarora Etimis
  0 siblings, 1 reply; 2+ messages in thread
From: Karthik Sarvan @ 2026-11-24  5:49 UTC (permalink / raw)
  To: dri-devel
  Cc: louis.chauvet, oaroraetimis, tzimmermann, melissa.srw, simona,
	Karthik Sarvan

VKMS planes already support reading DRM_FORMAT_XBGR8888, but writeback
cannot write it yet. In the 8888 format family, writeback only supports
ARGB8888, XRGB8888, and ABGR8888.

Add a pixel write function for XBGR8888 and include it in the supported
writeback formats list so compositors and tests can capture frames in
this format.

Signed-off-by: Karthik Sarvan <karthiks1mail@gmail.com>
---
 drivers/gpu/drm/vkms/vkms_formats.c   | 10 ++++++++++
 drivers/gpu/drm/vkms/vkms_writeback.c |  1 +
 2 files changed, 11 insertions(+)

diff --git a/drivers/gpu/drm/vkms/vkms_formats.c b/drivers/gpu/drm/vkms/vkms_formats.c
index 7f1f29b589e8..a89aef97cede 100644
--- a/drivers/gpu/drm/vkms/vkms_formats.c
+++ b/drivers/gpu/drm/vkms/vkms_formats.c
@@ -611,6 +611,14 @@ static void argb_u16_to_XRGB8888(u8 *out_pixel, const struct pixel_argb_u16 *in_
 	out_pixel[0] = DIV_ROUND_CLOSEST(in_pixel->b, 257);
 }
 
+static void argb_u16_to_XBGR8888(u8 *out_pixel, const struct pixel_argb_u16 *in_pixel)
+{
+	out_pixel[3] = 0xff;
+	out_pixel[2] = DIV_ROUND_CLOSEST(in_pixel->b, 257);
+	out_pixel[1] = DIV_ROUND_CLOSEST(in_pixel->g, 257);
+	out_pixel[0] = DIV_ROUND_CLOSEST(in_pixel->r, 257);
+}
+
 static void argb_u16_to_ABGR8888(u8 *out_pixel, const struct pixel_argb_u16 *in_pixel)
 {
 	out_pixel[3] = DIV_ROUND_CLOSEST(in_pixel->a, 257);
@@ -977,6 +985,8 @@ pixel_write_t get_pixel_write_function(u32 format)
 		return &argb_u16_to_ARGB8888;
 	case DRM_FORMAT_XRGB8888:
 		return &argb_u16_to_XRGB8888;
+	case DRM_FORMAT_XBGR8888:
+		return &argb_u16_to_XBGR8888;
 	case DRM_FORMAT_ABGR8888:
 		return &argb_u16_to_ABGR8888;
 	case DRM_FORMAT_ARGB16161616:
diff --git a/drivers/gpu/drm/vkms/vkms_writeback.c b/drivers/gpu/drm/vkms/vkms_writeback.c
index 858df1f89f66..3407b5914694 100644
--- a/drivers/gpu/drm/vkms/vkms_writeback.c
+++ b/drivers/gpu/drm/vkms/vkms_writeback.c
@@ -18,6 +18,7 @@
 static const u32 vkms_wb_formats[] = {
 	DRM_FORMAT_ARGB8888,
 	DRM_FORMAT_XRGB8888,
+	DRM_FORMAT_XBGR8888,
 	DRM_FORMAT_ABGR8888,
 	DRM_FORMAT_XRGB16161616,
 	DRM_FORMAT_ARGB16161616,
-- 
2.56.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-24 11:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-24  5:49 [PATCH] drm/vkms: Add DRM_FORMAT_XBGR8888 support to writeback Karthik Sarvan
2026-11-24 11:14 ` Oarora Etimis

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.