From: Louis Chauvet <louis.chauvet@bootlin.com>
To: "Rodrigo Siqueira" <rodrigosiqueiramelo@gmail.com>,
"Melissa Wen" <melissa.srw@gmail.com>,
"Maíra Canal" <mairacanal@riseup.net>,
"Haneen Mohammed" <hamohammed.sa@gmail.com>,
"Daniel Vetter" <daniel@ffwll.ch>,
"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
"Maxime Ripard" <mripard@kernel.org>,
"Thomas Zimmermann" <tzimmermann@suse.de>,
"David Airlie" <airlied@gmail.com>
Cc: dri-devel@lists.freedesktop.org, arthurgrillo@riseup.net,
linux-kernel@vger.kernel.org, jeremie.dautheribes@bootlin.com,
miquel.raynal@bootlin.com, thomas.petazzoni@bootlin.com,
seanpaul@google.com, nicolejadeyee@google.com,
Louis Chauvet <louis.chauvet@bootlin.com>
Subject: [PATCH v2 3/3] drm/vkms: Add support for XRGB2101010
Date: Wed, 14 Aug 2024 10:42:18 +0200 [thread overview]
Message-ID: <20240814-writeback_line_by_line-v2-3-36541c717569@bootlin.com> (raw)
In-Reply-To: <20240814-writeback_line_by_line-v2-0-36541c717569@bootlin.com>
Thanks to the WRITE_LINE macro, adding the format XRGB210101010 is trivial.
Signed-off-by: Louis Chauvet <louis.chauvet@bootlin.com>
---
drivers/gpu/drm/vkms/vkms_formats.c | 12 ++++++++++++
drivers/gpu/drm/vkms/vkms_writeback.c | 3 ++-
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/vkms/vkms_formats.c b/drivers/gpu/drm/vkms/vkms_formats.c
index a25cdf656d8a..65fdd3999441 100644
--- a/drivers/gpu/drm/vkms/vkms_formats.c
+++ b/drivers/gpu/drm/vkms/vkms_formats.c
@@ -654,6 +654,14 @@ static void argb_u16_to_RGB565(u8 *out_pixel, const struct pixel_argb_u16 *in_pi
*pixel = cpu_to_le16(r << 11 | g << 5 | b);
}
+static void argb_u16_to_XRGB2101010(u8 *out_pixel, const struct pixel_argb_u16 *in_pixel)
+{
+ out_pixel[0] = (u8)(in_pixel->b & 0xFF);
+ out_pixel[1] = (u8)((in_pixel->b >> 8) & 0x03) | (u8)((in_pixel->g << 2) & 0xFC);
+ out_pixel[2] = (u8)((in_pixel->g >> 6) & 0x0F) | (u8)((in_pixel->r << 4) & 0xF0);
+ out_pixel[3] = (u8)((in_pixel->r >> 4) & 0x3F);
+}
+
/**
* WRITE_LINE() - Generic generator for write_line functions
*
@@ -700,6 +708,8 @@ WRITE_LINE(XRGB16161616_write_line, argb_u16_to_XRGB16161616)
WRITE_LINE(RGB565_write_line, argb_u16_to_RGB565)
+WRITE_LINE(XRGB2101010_write_line, argb_u16_to_XRGB2101010)
+
/**
* get_pixel_read_function() - Retrieve the correct read_line function for a specific
* format. The returned pointer is NULL for unsupported pixel formats. The caller must ensure that
@@ -977,6 +987,8 @@ pixel_write_line_t get_pixel_write_line_function(u32 format)
return &XRGB16161616_write_line;
case DRM_FORMAT_RGB565:
return &RGB565_write_line;
+ case DRM_FORMAT_XRGB2101010:
+ return &XRGB2101010_write_line;
default:
/*
* This is a bug in vkms_writeback_atomic_check. All the supported
diff --git a/drivers/gpu/drm/vkms/vkms_writeback.c b/drivers/gpu/drm/vkms/vkms_writeback.c
index f6ed3aa69af8..7e0302c0830c 100644
--- a/drivers/gpu/drm/vkms/vkms_writeback.c
+++ b/drivers/gpu/drm/vkms/vkms_writeback.c
@@ -19,7 +19,8 @@ static const u32 vkms_wb_formats[] = {
DRM_FORMAT_XRGB8888,
DRM_FORMAT_XRGB16161616,
DRM_FORMAT_ARGB16161616,
- DRM_FORMAT_RGB565
+ DRM_FORMAT_RGB565,
+ DRM_FORMAT_XRGB2101010,
};
static const struct drm_connector_funcs vkms_wb_connector_funcs = {
--
2.44.2
prev parent reply other threads:[~2024-08-14 8:42 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-14 8:42 [PATCH v2 0/3] drm/vkms: Reimplement line-per-line pixel conversion for writeback Louis Chauvet
2024-08-14 8:42 ` [PATCH v2 1/3] drm/vkms: Re-introduce line-by-line algorithm " Louis Chauvet
2024-10-26 15:05 ` Maíra Canal
2024-10-28 9:50 ` Louis Chauvet
2024-08-14 8:42 ` [PATCH v2 2/3] drm/vkms: Add a macro for write_line functions Louis Chauvet
2024-10-26 15:08 ` Maíra Canal
2024-10-28 9:50 ` Louis Chauvet
2024-08-14 8:42 ` Louis Chauvet [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240814-writeback_line_by_line-v2-3-36541c717569@bootlin.com \
--to=louis.chauvet@bootlin.com \
--cc=airlied@gmail.com \
--cc=arthurgrillo@riseup.net \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=hamohammed.sa@gmail.com \
--cc=jeremie.dautheribes@bootlin.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mairacanal@riseup.net \
--cc=melissa.srw@gmail.com \
--cc=miquel.raynal@bootlin.com \
--cc=mripard@kernel.org \
--cc=nicolejadeyee@google.com \
--cc=rodrigosiqueiramelo@gmail.com \
--cc=seanpaul@google.com \
--cc=thomas.petazzoni@bootlin.com \
--cc=tzimmermann@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®