drivers/gpu/drm/vkms/vkms_formats.c | 32 +++++++++++++++++++++++++++ drivers/gpu/drm/vkms/vkms_plane.c | 1 + drivers/gpu/drm/vkms/vkms_writeback.c | 1 + 3 files changed, 34 insertions(+)
Add support for pixel format ABGR8888, which is the default format
on Android devices. This will allow us to use VKMS as the default
display driver in Android Emulator (Cuttlefish) and increase VKMS
adoption.
Changes in v2:
- Rebased on top of tip of tree because it has been 3 months.
- No functional changes.
Signed-off-by: Paz Zcharya <pazz@google.com>
---
drivers/gpu/drm/vkms/vkms_formats.c | 32 +++++++++++++++++++++++++++
drivers/gpu/drm/vkms/vkms_plane.c | 1 +
drivers/gpu/drm/vkms/vkms_writeback.c | 1 +
3 files changed, 34 insertions(+)
diff --git a/drivers/gpu/drm/vkms/vkms_formats.c b/drivers/gpu/drm/vkms/vkms_formats.c
index 39b1d7c97d45..30a64ecca87c 100644
--- a/drivers/gpu/drm/vkms/vkms_formats.c
+++ b/drivers/gpu/drm/vkms/vkms_formats.c
@@ -253,6 +253,26 @@ static void XRGB8888_read_line(const struct vkms_plane_state *plane, int x_start
}
}
+static void ABGR8888_read_line(const struct vkms_plane_state *plane, int x_start, int y_start,
+ enum pixel_read_direction direction, int count,
+ struct pixel_argb_u16 out_pixel[])
+{
+ struct pixel_argb_u16 *end = out_pixel + count;
+ u8 *src_pixels;
+
+ packed_pixels_addr_1x1(plane->frame_info, x_start, y_start, 0, &src_pixels);
+
+ int step = get_block_step_bytes(plane->frame_info->fb, direction, 0);
+
+ while (out_pixel < end) {
+ u8 *px = (u8 *)src_pixels;
+ /* Switch blue and red pixels. */
+ *out_pixel = argb_u16_from_u8888(px[3], px[0], px[1], px[2]);
+ out_pixel += 1;
+ src_pixels += step;
+ }
+}
+
static void ARGB16161616_read_line(const struct vkms_plane_state *plane, int x_start,
int y_start, enum pixel_read_direction direction, int count,
struct pixel_argb_u16 out_pixel[])
@@ -344,6 +364,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_ABGR8888(u8 *out_pixel, const struct pixel_argb_u16 *in_pixel)
+{
+ out_pixel[3] = DIV_ROUND_CLOSEST(in_pixel->a, 257);
+ 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_ARGB16161616(u8 *out_pixel, const struct pixel_argb_u16 *in_pixel)
{
__le16 *pixel = (__le16 *)out_pixel;
@@ -420,6 +448,8 @@ pixel_read_line_t get_pixel_read_line_function(u32 format)
return &ARGB8888_read_line;
case DRM_FORMAT_XRGB8888:
return &XRGB8888_read_line;
+ case DRM_FORMAT_ABGR8888:
+ return &ABGR8888_read_line;
case DRM_FORMAT_ARGB16161616:
return &ARGB16161616_read_line;
case DRM_FORMAT_XRGB16161616:
@@ -453,6 +483,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_ABGR8888:
+ return &argb_u16_to_ABGR8888;
case DRM_FORMAT_ARGB16161616:
return &argb_u16_to_ARGB16161616;
case DRM_FORMAT_XRGB16161616:
diff --git a/drivers/gpu/drm/vkms/vkms_plane.c b/drivers/gpu/drm/vkms/vkms_plane.c
index e2fce471870f..e34f8c7f83c3 100644
--- a/drivers/gpu/drm/vkms/vkms_plane.c
+++ b/drivers/gpu/drm/vkms/vkms_plane.c
@@ -15,6 +15,7 @@
static const u32 vkms_formats[] = {
DRM_FORMAT_ARGB8888,
DRM_FORMAT_XRGB8888,
+ DRM_FORMAT_ABGR8888,
DRM_FORMAT_XRGB16161616,
DRM_FORMAT_ARGB16161616,
DRM_FORMAT_RGB565
diff --git a/drivers/gpu/drm/vkms/vkms_writeback.c b/drivers/gpu/drm/vkms/vkms_writeback.c
index e9b5c74d7c58..fe163271d5b5 100644
--- a/drivers/gpu/drm/vkms/vkms_writeback.c
+++ b/drivers/gpu/drm/vkms/vkms_writeback.c
@@ -17,6 +17,7 @@
static const u32 vkms_wb_formats[] = {
DRM_FORMAT_ARGB8888,
DRM_FORMAT_XRGB8888,
+ DRM_FORMAT_ABGR8888,
DRM_FORMAT_XRGB16161616,
DRM_FORMAT_ARGB16161616,
DRM_FORMAT_RGB565
--
2.48.1.262.g85cc9f2d1e-goog
On 27/01/25 - 23:59, Paz Zcharya wrote: > Add support for pixel format ABGR8888, which is the default format > on Android devices. This will allow us to use VKMS as the default > display driver in Android Emulator (Cuttlefish) and increase VKMS > adoption. > > Changes in v2: > - Rebased on top of tip of tree because it has been 3 months. > - No functional changes. > > Signed-off-by: Paz Zcharya <pazz@google.com> Hi Paz, Reviewed-by: Louis Chauvet <louis.chauvet@bootlin.com> When applying a patch I got a small warning about a missmatch between your author email and the Signed-off-by: -:106: WARNING:FROM_SIGN_OFF_MISMATCH: From:/Signed-off-by: email address mismatch: 'From: Paz Zcharya <pazz@chromium.org>' != 'Signed-off-by: Paz Zcharya <pazz@google.com>' I can fix it for you by adding a Author: / changing the Sign-of-by before applying on drm-misc-next. What mail do you want to use? pazz@google.com or pazz@chromium.org? Thanks! Louis Chauvet
On Tue, Jan 28, 2025 at 11:04:33AM +0100, Louis Chauvet wrote: > On 27/01/25 - 23:59, Paz Zcharya wrote: > > Add support for pixel format ABGR8888, which is the default format > > on Android devices. This will allow us to use VKMS as the default > > display driver in Android Emulator (Cuttlefish) and increase VKMS > > adoption. > > > > Changes in v2: > > - Rebased on top of tip of tree because it has been 3 months. > > - No functional changes. > > > > Signed-off-by: Paz Zcharya <pazz@google.com> > > Hi Paz, > > Reviewed-by: Louis Chauvet <louis.chauvet@bootlin.com> > > When applying a patch I got a small warning about a missmatch between your > author email and the Signed-off-by: > > -:106: WARNING:FROM_SIGN_OFF_MISMATCH: From:/Signed-off-by: email address mismatch: 'From: Paz Zcharya <pazz@chromium.org>' != 'Signed-off-by: Paz Zcharya <pazz@google.com>' > > I can fix it for you by adding a Author: / changing the Sign-of-by before > applying on drm-misc-next. > > What mail do you want to use? pazz@google.com or pazz@chromium.org? > > Thanks! > Louis Chauvet Thank you for the quick review, Louis! Let's use pazz@google.com. I apologize about the mistake -- I'll make sure to fix that in the future. Greatly appericiate your help! Thanks a lot, Paz
On 28/01/25 - 15:08, Paz Zcharya wrote: > On Tue, Jan 28, 2025 at 11:04:33AM +0100, Louis Chauvet wrote: > > On 27/01/25 - 23:59, Paz Zcharya wrote: > > > Add support for pixel format ABGR8888, which is the default format > > > on Android devices. This will allow us to use VKMS as the default > > > display driver in Android Emulator (Cuttlefish) and increase VKMS > > > adoption. > > > > > > Changes in v2: > > > - Rebased on top of tip of tree because it has been 3 months. > > > - No functional changes. > > > > > > Signed-off-by: Paz Zcharya <pazz@google.com> > > > > Hi Paz, > > > > Reviewed-by: Louis Chauvet <louis.chauvet@bootlin.com> > > > > When applying a patch I got a small warning about a missmatch between your > > author email and the Signed-off-by: > > > > -:106: WARNING:FROM_SIGN_OFF_MISMATCH: From:/Signed-off-by: email address mismatch: 'From: Paz Zcharya <pazz@chromium.org>' != 'Signed-off-by: Paz Zcharya <pazz@google.com>' > > > > I can fix it for you by adding a Author: / changing the Sign-of-by before > > applying on drm-misc-next. > > > > What mail do you want to use? pazz@google.com or pazz@chromium.org? > > > > Thanks! > > Louis Chauvet > > Thank you for the quick review, Louis! > > Let's use pazz@google.com. > I apologize about the mistake -- I'll make sure to fix that in the > future. And I just noticed that "changes in v2" is in the commit log. It should not be there. To add a changelog, you must put it after ---, so in your case your commit should be something like: drm/vkms: Add support for ABGR8888 pixel format Add support for [...] adoption. Signed-off-by: Paz Zcharya <pazz@google.com> --- Changes in v2: [...] Can you send a "real" v2 with the correct commit message and the correct author? If you don't know it, you can use b4[1] to help you manage your series and iterations. [1]:https://b4.docs.kernel.org/en/latest/ > Greatly appericiate your help! > > Thanks a lot, > Paz >
On Wed, Jan 29, 2025 at 11:18:26AM +0100, Louis Chauvet wrote: > And I just noticed that "changes in v2" is in the commit log. It should > not be there. > > To add a changelog, you must put it after ---, so in your case your commit > should be something like: > > drm/vkms: Add support for ABGR8888 pixel format > > Add support for [...] adoption. > > Signed-off-by: Paz Zcharya <pazz@google.com> > > --- > > Changes in v2: > [...] > > Can you send a "real" v2 with the correct commit message and the correct > author? > > If you don't know it, you can use b4[1] to help you manage your series and > iterations. > > [1]:https://b4.docs.kernel.org/en/latest/ > > Just resent it. My email server is using pazz@chromium.org, so I went with that. I really hope I got it done right this time. I apologize for any additional work or inconvenience I may have caused. I greatly appreciate your help, Paz Zcharya
© 2016 - 2026 Red Hat, Inc.