drm/vkms: Add DRM_FORMAT_XBGR8888 support to writeback
PATCH 1/1 drm/vkms: Add DRM_FORMAT_XBGR8888 support to writeback
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(+)
drivers/gpu/drm/vkms/vkms_formats.c +10 -0
@@ -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 :
drivers/gpu/drm/vkms/vkms_writeback.c +1 -0
@@ -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 ,
Signature · 1 line
2.56.0
Quoted 57 lines · 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 <[email protected]>--- drivers/gpu/drm/vkms/vkms_formats.c | 10 ++++++++++ drivers/gpu/drm/vkms/vkms_writeback.c | 1 + 2 files changed, 11 insertions(+)drivers/gpu/drm/vkms/vkms_formats.c +10
-0@@ -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 :drivers/gpu/drm/vkms/vkms_writeback.c +1
-0@@ -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 ,Signature · 1 line
2.56.0
Reviewed-by Oarora Etimis <[email protected]>