On Tue, Nov 24, 2026 at 11:19:53AM +0530, Karthik Sarvan wrote: > 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 <[email protected]> > --- > 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 >
Reviewed-by: Oarora Etimis <[email protected]>
