From: Louis Chauvet <louis.chauvet@bootlin.com>
To: Matheus Alves de Almeida <matheus.aalmeida@inf.ufrgs.br>,
Haneen Mohammed <hamohammed.sa@gmail.com>,
Simona Vetter <simona@ffwll.ch>,
Melissa Wen <melissa.srw@gmail.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@gmail.com>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 4/5] drm/vkms: add support for RGB332
Date: Tue, 17 Nov 2026 17:11:30 +0100 [thread overview]
Message-ID: <9a6373c3-f8df-4464-8ff7-75dd594a7e80@bootlin.com> (raw)
In-Reply-To: <20260928005301.367977-5-matheus.aalmeida@inf.ufrgs.br>
On 9/28/26 02:53, Matheus Alves de Almeida wrote:
> Add support for reading and writing the RGB332 pixel format.
>
> Signed-off-by: Matheus Alves de Almeida <matheus.aalmeida@inf.ufrgs.br>
Reviewed-by: Louis Chauvet <louis.chauvet@bootlin.com>
> ---
> drivers/gpu/drm/vkms/vkms_formats.c | 21 +++++++++++++++++++++
> drivers/gpu/drm/vkms/vkms_plane.c | 1 +
> drivers/gpu/drm/vkms/vkms_writeback.c | 3 ++-
> 3 files changed, 24 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/vkms/vkms_formats.c b/drivers/gpu/drm/vkms/vkms_formats.c
> index 6e4f58207..0c3bb0618 100644
> --- a/drivers/gpu/drm/vkms/vkms_formats.c
> +++ b/drivers/gpu/drm/vkms/vkms_formats.c
> @@ -267,6 +267,12 @@ static struct pixel_argb_u16 argb_u16_from_BGR565(const __le16 *pixel)
> (bgr_565 >> 11) & 0x1f, 0xffff, 5, 6, 5, 0);
> }
>
> +static struct pixel_argb_u16 argb_u16_from_RGB332(u8 pixel)
> +{
> + return channels_to_argb_u16((pixel >> 5) & 0x7, (pixel >> 2) & 0x7,
> + pixel & 0x3, 0xffff, 3, 3, 2, 0);
> +}
> +
> static struct pixel_argb_u16 argb_u16_from_gray8(u8 gray)
> {
> return argb_u16_from_u8888(255, gray, gray, gray);
> @@ -475,6 +481,8 @@ READ_LINE_le16161616(XBGR16161616_read_line, px, cpu_to_le16(0xFFFF), px[0], px[
> READ_LINE(RGB565_read_line, px, __le16, argb_u16_from_RGB565, px)
> READ_LINE(BGR565_read_line, px, __le16, argb_u16_from_BGR565, px)
>
> +READ_LINE(RGB332_read_line, px, u8, argb_u16_from_RGB332, *px)
> +
> READ_LINE(R8_read_line, px, u8, argb_u16_from_gray8, *px)
>
> /*
> @@ -690,6 +698,15 @@ static void argb_u16_to_BGR565(u8 *out_pixel, const struct pixel_argb_u16 *in_pi
> *pixel = cpu_to_le16(b << 11 | g << 5 | r);
> }
>
> +static void argb_u16_to_RGB332(u8 *out_pixel, const struct pixel_argb_u16 *in_pixel)
> +{
> + u16 r, g, b;
> +
> + argb_u16_to_channels(&r, &g, &b, NULL, 3, 3, 2, 0, in_pixel);
> +
> + *out_pixel = r << 5 | g << 2 | b;
> +}
> +
> /**
> * vkms_writeback_row() - Generic loop for all supported writeback format. It is executed just
> * after the blending to write a line in the writeback buffer.
> @@ -752,6 +769,8 @@ pixel_read_line_t get_pixel_read_line_function(u32 format)
> return &RGB565_read_line;
> case DRM_FORMAT_BGR565:
> return &BGR565_read_line;
> + case DRM_FORMAT_RGB332:
> + return &RGB332_read_line;
> case DRM_FORMAT_NV12:
> case DRM_FORMAT_NV16:
> case DRM_FORMAT_NV24:
> @@ -992,6 +1011,8 @@ pixel_write_t get_pixel_write_function(u32 format)
> return &argb_u16_to_RGB565;
> case DRM_FORMAT_BGR565:
> return &argb_u16_to_BGR565;
> + case DRM_FORMAT_RGB332:
> + return &argb_u16_to_RGB332;
> default:
> /*
> * This is a bug in vkms_writeback_atomic_check. All the supported
> diff --git a/drivers/gpu/drm/vkms/vkms_plane.c b/drivers/gpu/drm/vkms/vkms_plane.c
> index 68cb2a333..fff2d4eb5 100644
> --- a/drivers/gpu/drm/vkms/vkms_plane.c
> +++ b/drivers/gpu/drm/vkms/vkms_plane.c
> @@ -29,6 +29,7 @@ static const u32 vkms_formats[] = {
> DRM_FORMAT_ABGR16161616,
> DRM_FORMAT_RGB565,
> DRM_FORMAT_BGR565,
> + DRM_FORMAT_RGB332,
> DRM_FORMAT_NV12,
> DRM_FORMAT_NV16,
> DRM_FORMAT_NV24,
> diff --git a/drivers/gpu/drm/vkms/vkms_writeback.c b/drivers/gpu/drm/vkms/vkms_writeback.c
> index f64b90908..54330803e 100644
> --- a/drivers/gpu/drm/vkms/vkms_writeback.c
> +++ b/drivers/gpu/drm/vkms/vkms_writeback.c
> @@ -22,7 +22,8 @@ static const u32 vkms_wb_formats[] = {
> DRM_FORMAT_XRGB16161616,
> DRM_FORMAT_ARGB16161616,
> DRM_FORMAT_RGB565,
> - DRM_FORMAT_BGR565
> + DRM_FORMAT_BGR565,
> + DRM_FORMAT_RGB332
> };
>
> static const struct drm_connector_funcs vkms_wb_connector_funcs = {
next prev parent reply other threads:[~2026-11-17 16:11 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-28 0:52 [PATCH 0/5] drm/vkms: support more formats and fix RGB565 regression Matheus Alves de Almeida
2026-09-28 0:52 ` [PATCH 1/5] drm/vkms: make argb_u16_to_RGB565 round resulting values Matheus Alves de Almeida
2026-11-08 3:12 ` Sidharth Saha
2026-09-28 0:52 ` [PATCH 2/5] drm/vkms: support BGR565 writeback Matheus Alves de Almeida
2026-09-28 0:52 ` [PATCH 3/5] drm/vkms: add a helper for channel to argb_u16 conversion Matheus Alves de Almeida
2026-09-28 0:53 ` [PATCH 4/5] drm/vkms: add support for RGB332 Matheus Alves de Almeida
2026-11-17 16:11 ` Louis Chauvet [this message]
2026-09-28 0:53 ` [PATCH 5/5] drm/vkms: add support for BGR233 Matheus Alves de Almeida
2026-10-12 19:18 ` [PATCH 0/5] drm/vkms: support more formats and fix RGB565 regression Matheus Alves de Almeida
2026-11-08 3:08 ` Sidharth Saha
2026-11-13 0:18 ` Sidharth Saha
2026-11-13 1:51 ` Matheus Alves de Almeida
2026-11-14 18:51 ` Sidharth Saha
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=9a6373c3-f8df-4464-8ff7-75dd594a7e80@bootlin.com \
--to=louis.chauvet@bootlin.com \
--cc=airlied@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=hamohammed.sa@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=matheus.aalmeida@inf.ufrgs.br \
--cc=melissa.srw@gmail.com \
--cc=mripard@kernel.org \
--cc=simona@ffwll.ch \
--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®