Re: [PATCH RESEND v2 2/8] drm/vkms: Add support for ARGB8888 formats

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 28/10/24 - 07:20, Maíra Canal wrote:
> Hi Louis,
> 
> On 28/10/24 06:50, Louis Chauvet wrote:
> > On 26/10/24 - 11:11, Maíra Canal wrote:
> > > Hi Louis,
> > > 
> > > On 07/10/24 13:46, Louis Chauvet wrote:
> > > > The formats XRGB8888 and ARGB8888 were already supported.
> > > > Add the support for:
> > > > - XBGR8888
> > > > - RGBX8888
> > > > - BGRX8888
> > > > - ABGR8888
> > > > - RGBA8888
> > > > - BGRA8888
> > > > 
> > > > Signed-off-by: Louis Chauvet <louis.chauvet@xxxxxxxxxxx>
> > > > ---
> > > >    drivers/gpu/drm/vkms/vkms_formats.c | 18 ++++++++++++++++++
> > > >    drivers/gpu/drm/vkms/vkms_plane.c   |  6 ++++++
> > > >    2 files changed, 24 insertions(+)
> > > > 
> > > > diff --git a/drivers/gpu/drm/vkms/vkms_formats.c b/drivers/gpu/drm/vkms/vkms_formats.c
> > > > index 8f1bcca38148..b5a38f70c62b 100644
> > > > --- a/drivers/gpu/drm/vkms/vkms_formats.c
> > > > +++ b/drivers/gpu/drm/vkms/vkms_formats.c
> > > > @@ -432,8 +432,14 @@ static void R4_read_line(const struct vkms_plane_state *plane, int x_start,
> > > >    READ_LINE_ARGB8888(XRGB8888_read_line, px, 255, px[2], px[1], px[0])
> > > > +READ_LINE_ARGB8888(XBGR8888_read_line, px, 255, px[0], px[1], px[2]) > +READ_LINE_ARGB8888(RGBX8888_read_line, px, 255, px[3], px[2], px[1])
> > > 
> > > I'm not expert in colors, but is this correct? From what I understand,
> > > it should be:
> > 
> > Yes, this is correct, READ_LINE_ARGB8888 take the parameters as A, R, G,
> > B, so here 0xFF, px[2], px[1], px[0]
> 
> Now I wonder if
> 
> READ_LINE_ARGB8888(XRGB8888_read_line, px, 255, px[2], px[1], px[0])
> 
> is correct.

Why? 

It creates the function `XRGB8888_read_line`, that reads the pixel line, 4 
bytes by 4 bytes, ignore the alpha value, uses px[2] as R, px[1] 
as G, px[0] as B.

I just tested with kms_plane (igt version 1.27.1-NO-GIT, fedora), and he 
seems happy on all the supported formats, including XRGB8888 (XR24):

Testing format XR24(0x34325258) / modifier linear(0x0) on A.0
Testing format AR24(0x34325241) / modifier linear(0x0) on A.0
Testing format AB24(0x34324241) / modifier linear(0x0) on A.0
Testing format XB24(0x34324258) / modifier linear(0x0) on A.0
Testing format RG24(0x34324752) / modifier linear(0x0) on A.0
Testing format BG24(0x34324742) / modifier linear(0x0) on A.0
Testing format XR48(0x38345258) / modifier linear(0x0) on A.0
Testing format XB48(0x38344258) / modifier linear(0x0) on A.0
Testing format AR48(0x38345241) / modifier linear(0x0) on A.0
Testing format AB48(0x38344241) / modifier linear(0x0) on A.0
Testing format RG16(0x36314752) / modifier linear(0x0) on A.0
Testing format BG16(0x36314742) / modifier linear(0x0) on A.0
Testing format NV12(0x3231564e) / modifier linear(0x0) (ITU-R BT.601 YCbCr, YCbCr limited range) on A.0
Testing format NV12(0x3231564e) / modifier linear(0x0) (ITU-R BT.601 YCbCr, YCbCr full range) on A.0
Testing format NV12(0x3231564e) / modifier linear(0x0) (ITU-R BT.709 YCbCr, YCbCr limited range) on A.0
Testing format NV12(0x3231564e) / modifier linear(0x0) (ITU-R BT.709 YCbCr, YCbCr full range) on A.0
Testing format NV12(0x3231564e) / modifier linear(0x0) (ITU-R BT.2020 YCbCr, YCbCr limited range) on A.0
Testing format NV12(0x3231564e) / modifier linear(0x0) (ITU-R BT.2020 YCbCr, YCbCr full range) on A.0
Testing format NV16(0x3631564e) / modifier linear(0x0) (ITU-R BT.601 YCbCr, YCbCr limited range) on A.0
Testing format NV16(0x3631564e) / modifier linear(0x0) (ITU-R BT.601 YCbCr, YCbCr full range) on A.0
Testing format NV16(0x3631564e) / modifier linear(0x0) (ITU-R BT.709 YCbCr, YCbCr limited range) on A.0
Testing format NV16(0x3631564e) / modifier linear(0x0) (ITU-R BT.709 YCbCr, YCbCr full range) on A.0
Testing format NV16(0x3631564e) / modifier linear(0x0) (ITU-R BT.2020 YCbCr, YCbCr limited range) on A.0
Testing format NV16(0x3631564e) / modifier linear(0x0) (ITU-R BT.2020 YCbCr, YCbCr full range) on A.0
Testing format NV21(0x3132564e) / modifier linear(0x0) (ITU-R BT.601 YCbCr, YCbCr limited range) on A.0
Testing format NV21(0x3132564e) / modifier linear(0x0) (ITU-R BT.601 YCbCr, YCbCr full range) on A.0
Testing format NV21(0x3132564e) / modifier linear(0x0) (ITU-R BT.709 YCbCr, YCbCr limited range) on A.0
Testing format NV21(0x3132564e) / modifier linear(0x0) (ITU-R BT.709 YCbCr, YCbCr full range) on A.0
Testing format NV21(0x3132564e) / modifier linear(0x0) (ITU-R BT.2020 YCbCr, YCbCr limited range) on A.0
Testing format NV21(0x3132564e) / modifier linear(0x0) (ITU-R BT.2020 YCbCr, YCbCr full range) on A.0
Testing format NV61(0x3136564e) / modifier linear(0x0) (ITU-R BT.601 YCbCr, YCbCr limited range) on A.0
Testing format NV61(0x3136564e) / modifier linear(0x0) (ITU-R BT.601 YCbCr, YCbCr full range) on A.0
Testing format NV61(0x3136564e) / modifier linear(0x0) (ITU-R BT.709 YCbCr, YCbCr limited range) on A.0
Testing format NV61(0x3136564e) / modifier linear(0x0) (ITU-R BT.709 YCbCr, YCbCr full range) on A.0
Testing format NV61(0x3136564e) / modifier linear(0x0) (ITU-R BT.2020 YCbCr, YCbCr limited range) on A.0
Testing format NV61(0x3136564e) / modifier linear(0x0) (ITU-R BT.2020 YCbCr, YCbCr full range) on A.0
Testing format YU12(0x32315559) / modifier linear(0x0) (ITU-R BT.601 YCbCr, YCbCr limited range) on A.0
Testing format YU12(0x32315559) / modifier linear(0x0) (ITU-R BT.601 YCbCr, YCbCr full range) on A.0
Testing format YU12(0x32315559) / modifier linear(0x0) (ITU-R BT.709 YCbCr, YCbCr limited range) on A.0
Testing format YU12(0x32315559) / modifier linear(0x0) (ITU-R BT.709 YCbCr, YCbCr full range) on A.0
Testing format YU12(0x32315559) / modifier linear(0x0) (ITU-R BT.2020 YCbCr, YCbCr limited range) on A.0
Testing format YU12(0x32315559) / modifier linear(0x0) (ITU-R BT.2020 YCbCr, YCbCr full range) on A.0
Testing format YU16(0x36315559) / modifier linear(0x0) (ITU-R BT.601 YCbCr, YCbCr limited range) on A.0
Testing format YU16(0x36315559) / modifier linear(0x0) (ITU-R BT.601 YCbCr, YCbCr full range) on A.0
Testing format YU16(0x36315559) / modifier linear(0x0) (ITU-R BT.709 YCbCr, YCbCr limited range) on A.0
Testing format YU16(0x36315559) / modifier linear(0x0) (ITU-R BT.709 YCbCr, YCbCr full range) on A.0
Testing format YU16(0x36315559) / modifier linear(0x0) (ITU-R BT.2020 YCbCr, YCbCr limited range) on A.0
Testing format YU16(0x36315559) / modifier linear(0x0) (ITU-R BT.2020 YCbCr, YCbCr full range) on A.0
Testing format YV12(0x32315659) / modifier linear(0x0) (ITU-R BT.601 YCbCr, YCbCr limited range) on A.0
Testing format YV12(0x32315659) / modifier linear(0x0) (ITU-R BT.601 YCbCr, YCbCr full range) on A.0
Testing format YV12(0x32315659) / modifier linear(0x0) (ITU-R BT.709 YCbCr, YCbCr limited range) on A.0
Testing format YV12(0x32315659) / modifier linear(0x0) (ITU-R BT.709 YCbCr, YCbCr full range) on A.0
Testing format YV12(0x32315659) / modifier linear(0x0) (ITU-R BT.2020 YCbCr, YCbCr limited range) on A.0
Testing format YV12(0x32315659) / modifier linear(0x0) (ITU-R BT.2020 YCbCr, YCbCr full range) on A.0
Testing format YV16(0x36315659) / modifier linear(0x0) (ITU-R BT.601 YCbCr, YCbCr limited range) on A.0
Testing format YV16(0x36315659) / modifier linear(0x0) (ITU-R BT.601 YCbCr, YCbCr full range) on A.0
Testing format YV16(0x36315659) / modifier linear(0x0) (ITU-R BT.709 YCbCr, YCbCr limited range) on A.0
Testing format YV16(0x36315659) / modifier linear(0x0) (ITU-R BT.709 YCbCr, YCbCr full range) on A.0
Testing format YV16(0x36315659) / modifier linear(0x0) (ITU-R BT.2020 YCbCr, YCbCr limited range) on A.0
Testing format YV16(0x36315659) / modifier linear(0x0) (ITU-R BT.2020 YCbCr, YCbCr full range) on A.0
Testing format P010(0x30313050) / modifier linear(0x0) (ITU-R BT.601 YCbCr, YCbCr limited range) on A.0
Testing format P010(0x30313050) / modifier linear(0x0) (ITU-R BT.601 YCbCr, YCbCr full range) on A.0
Testing format P010(0x30313050) / modifier linear(0x0) (ITU-R BT.709 YCbCr, YCbCr limited range) on A.0
Testing format P010(0x30313050) / modifier linear(0x0) (ITU-R BT.709 YCbCr, YCbCr full range) on A.0
Testing format P010(0x30313050) / modifier linear(0x0) (ITU-R BT.2020 YCbCr, YCbCr limited range) on A.0
Testing format P010(0x30313050) / modifier linear(0x0) (ITU-R BT.2020 YCbCr, YCbCr full range) on A.0
Testing format P012(0x32313050) / modifier linear(0x0) (ITU-R BT.601 YCbCr, YCbCr limited range) on A.0
Testing format P012(0x32313050) / modifier linear(0x0) (ITU-R BT.601 YCbCr, YCbCr full range) on A.0
Testing format P012(0x32313050) / modifier linear(0x0) (ITU-R BT.709 YCbCr, YCbCr limited range) on A.0
Testing format P012(0x32313050) / modifier linear(0x0) (ITU-R BT.709 YCbCr, YCbCr full range) on A.0
Testing format P012(0x32313050) / modifier linear(0x0) (ITU-R BT.2020 YCbCr, YCbCr limited range) on A.0
Testing format P012(0x32313050) / modifier linear(0x0) (ITU-R BT.2020 YCbCr, YCbCr full range) on A.0
Testing format P016(0x36313050) / modifier linear(0x0) (ITU-R BT.601 YCbCr, YCbCr limited range) on A.0
Testing format P016(0x36313050) / modifier linear(0x0) (ITU-R BT.601 YCbCr, YCbCr full range) on A.0
Testing format P016(0x36313050) / modifier linear(0x0) (ITU-R BT.709 YCbCr, YCbCr limited range) on A.0
Testing format P016(0x36313050) / modifier linear(0x0) (ITU-R BT.709 YCbCr, YCbCr full range) on A.0
Testing format P016(0x36313050) / modifier linear(0x0) (ITU-R BT.2020 YCbCr, YCbCr limited range) on A.0
Testing format P016(0x36313050) / modifier linear(0x0) (ITU-R BT.2020 YCbCr, YCbCr full range) on A.0


> Best Regards,
> - Maíra
> 
> > > READ_LINE_ARGB8888(RGBX8888_read_line, px, px[2], px[1], px[0], 255)
> > >                                             ^R     ^G     ^B     ^X
> > > 
> > > > +READ_LINE_ARGB8888(BGRX8888_read_line, px, 255, px[1], px[2], px[3])
> > > 
> > > Again, is this correct?
> > > 
> > > Best Regards,
> > > - Maíra
> > > 
> > > >    READ_LINE_ARGB8888(ARGB8888_read_line, px, px[3], px[2], px[1], px[0])
> > > > +READ_LINE_ARGB8888(ABGR8888_read_line, px, px[3], px[0], px[1], px[2])
> > > > +READ_LINE_ARGB8888(RGBA8888_read_line, px, px[0], px[3], px[2], px[1])
> > > > +READ_LINE_ARGB8888(BGRA8888_read_line, px, px[0], px[1], px[2], px[3])
> > > >    READ_LINE_16161616(ARGB16161616_read_line, px, px[3], px[2], px[1], px[0]);
> > > > @@ -637,8 +643,20 @@ pixel_read_line_t get_pixel_read_line_function(u32 format)
> > > >    	switch (format) {
> > > >    	case DRM_FORMAT_ARGB8888:
> > > >    		return &ARGB8888_read_line;
> > > > +	case DRM_FORMAT_ABGR8888:
> > > > +		return &ABGR8888_read_line;
> > > > +	case DRM_FORMAT_BGRA8888:
> > > > +		return &BGRA8888_read_line;
> > > > +	case DRM_FORMAT_RGBA8888:
> > > > +		return &RGBA8888_read_line;
> > > >    	case DRM_FORMAT_XRGB8888:
> > > >    		return &XRGB8888_read_line;
> > > > +	case DRM_FORMAT_XBGR8888:
> > > > +		return &XBGR8888_read_line;
> > > > +	case DRM_FORMAT_RGBX8888:
> > > > +		return &RGBX8888_read_line;
> > > > +	case DRM_FORMAT_BGRX8888:
> > > > +		return &BGRX8888_read_line;
> > > >    	case DRM_FORMAT_ARGB16161616:
> > > >    		return &ARGB16161616_read_line;
> > > >    	case DRM_FORMAT_XRGB16161616:
> > > > diff --git a/drivers/gpu/drm/vkms/vkms_plane.c b/drivers/gpu/drm/vkms/vkms_plane.c
> > > > index 67f891e7ac58..941a6e92a040 100644
> > > > --- a/drivers/gpu/drm/vkms/vkms_plane.c
> > > > +++ b/drivers/gpu/drm/vkms/vkms_plane.c
> > > > @@ -14,7 +14,13 @@
> > > >    static const u32 vkms_formats[] = {
> > > >    	DRM_FORMAT_ARGB8888,
> > > > +	DRM_FORMAT_ABGR8888,
> > > > +	DRM_FORMAT_BGRA8888,
> > > > +	DRM_FORMAT_RGBA8888,
> > > >    	DRM_FORMAT_XRGB8888,
> > > > +	DRM_FORMAT_XBGR8888,
> > > > +	DRM_FORMAT_RGBX8888,
> > > > +	DRM_FORMAT_BGRX8888,
> > > >    	DRM_FORMAT_XRGB16161616,
> > > >    	DRM_FORMAT_ARGB16161616,
> > > >    	DRM_FORMAT_RGB565,
> > > > 
> 



[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux