Hi Kieran,

Thanks for the patch.

> -----Original Message-----
> From: Kieran Bingham <kieran.bing...@ideasonboard.com>
> Sent: 21 March 2025 19:06
> Subject: RE: [PATCH] drm: renesas: Extend RZ/G2L supported KMS formats
> 
> Hi Biju,
> 
> Quoting Biju Das (2025-03-21 18:40:50)
> > Hi Kieran,
> >
> > Thanks for the patch.
> >
> > > -----Original Message-----
> > > From: Kieran Bingham <kieran.bing...@ideasonboard.com>
> > > Sent: 21 March 2025 17:22
> > > Subject: [PATCH] drm: renesas: Extend RZ/G2L supported KMS formats
> > >
> > > From: Kieran Bingham <kieran.bingham+rene...@ideasonboard.com>
> > >
> > > The RZ/G2L driver utilises the VSPD to read data from input sources.
> > >
> > > The rzg2l_du_kms component lists a restricted subset of the
> > > capabilities of the VSPd which prevents
> >
> > VSPD
> >
> > > additional formats from being used for display planes.
> > >
> > > The supported display plane formats are mapped in rzg2l_du_vsp_formats[].
> > >
> > > Extend the rzg2l_du_format_infos[] table with the corresponding
> > > mappings between the supported DRM formats and the formats exposed
> > > by the VSP in rzg2l_du_vsp_formats, maintaining the same ordering in both 
> > > tables.
> > >
> > > Signed-off-by: Kieran Bingham
> > > <kieran.bingham+rene...@ideasonboard.com>
> > > ---
> > >  drivers/gpu/drm/renesas/rz-du/rzg2l_du_kms.c | 141
> > > ++++++++++++++++++-
> > >  1 file changed, 136 insertions(+), 5 deletions(-)
> > >
> > > Prior to this patch, kmstest reports all of these formats as
> > > supported by the Planes, but using them fails during rzg2l_du_fb_create() 
> > > as the corresponding
> format isn't found in rzg2l_du_format_info.
> > >
> > > This patch now lets me capture and render pixelformats from the
> > > Mali-C55 direct to an attached DSI panel on the Kakip board.
> >
> > Previously I got a comment to remove all the formats from this table as DSI 
> > supports only 3 formats.
> 
> Indeed, I can see that the DSI only supports the three RGB variant formats, 
> but the RPF of the VPSD is
> very capable and does the pixel format conversion for us here as I understand 
> it!

Cool, I haven't tested pixel format conversion previously.

> 
> 
> > I agree VSPD has two planes(2 rpf-instances) which supports all these 
> > formats.
> >
> > Mali-C55(n formats)-->LCDC(VSPD n formats)->DSI(3 formats)-->Panel
> >
> > Am I missing anything w.r.to the comment that I received previously.
> > Otherwise patch LGTM.
> >
> 
> I haven't looked completely, but as long as the VSPD is only configured to 
> /output/ the RGB formats to
> the DSI then I think this is fine,
> 
> >
> > >
> > > Patch tested with kms-tests:
> > >
> > >
> > >
> > > diff --git a/drivers/gpu/drm/renesas/rz-du/rzg2l_du_kms.c
> > > b/drivers/gpu/drm/renesas/rz- du/rzg2l_du_kms.c index
> > > b1266fbd9598..a5e96f863172 100644
> > > --- a/drivers/gpu/drm/renesas/rz-du/rzg2l_du_kms.c
> > > +++ b/drivers/gpu/drm/renesas/rz-du/rzg2l_du_kms.c
> > > @@ -36,8 +36,61 @@
> > >
> > >  static const struct rzg2l_du_format_info rzg2l_du_format_infos[] = {
> > >       {
> > > -             .fourcc = DRM_FORMAT_XRGB8888,
> > > -             .v4l2 = V4L2_PIX_FMT_XBGR32,
> > > +             .fourcc = DRM_FORMAT_RGB332,
> > > +             .v4l2 = V4L2_PIX_FMT_RGB332,
> > > +             .bpp = 8,


Please drop bpp as it is unused like R-Car Gen3.

> > > +             .planes = 1,
> > > +             .hsub = 1,
> > > +     }, {
> > > +             .fourcc = DRM_FORMAT_ARGB4444,
> > > +             .v4l2 = V4L2_PIX_FMT_ARGB444,
> > > +             .bpp = 16,
> > > +             .planes = 1,
> > > +             .hsub = 1,
> > > +     }, {
> > > +             .fourcc = DRM_FORMAT_XRGB4444,
> > > +             .v4l2 = V4L2_PIX_FMT_XRGB444,
> > > +             .bpp = 16,
> > > +             .planes = 1,
> > > +             .hsub = 1,
> > > +     }, {
> > > +             .fourcc = DRM_FORMAT_ARGB1555,
> > > +             .v4l2 = V4L2_PIX_FMT_ARGB555,
> > > +             .bpp = 16,
> > > +             .planes = 1,
> > > +             .hsub = 1,
> > > +     }, {
> > > +             .fourcc = DRM_FORMAT_XRGB1555,
> > > +             .v4l2 = V4L2_PIX_FMT_XRGB555,
> > > +             .bpp = 16,
> > > +             .planes = 1,
> > > +     }, {
> > > +             .fourcc = DRM_FORMAT_RGB565,
> > > +             .v4l2 = V4L2_PIX_FMT_RGB565,
> > > +             .bpp = 16,
> > > +             .planes = 1,
> > > +             .hsub = 1,
> > > +     }, {
> > > +             .fourcc = DRM_FORMAT_BGR888,
> > > +             .v4l2 = V4L2_PIX_FMT_RGB24,
> > > +             .bpp = 24,
> > > +             .planes = 1,
> > > +             .hsub = 1,
> > > +     }, {
> > > +             .fourcc = DRM_FORMAT_RGB888,
> > > +             .v4l2 = V4L2_PIX_FMT_BGR24,
> > > +             .bpp = 24,
> > > +             .planes = 1,
> > > +             .hsub = 1,
> > > +     }, {
> > > +             .fourcc = DRM_FORMAT_BGRA8888,
> > > +             .v4l2 = V4L2_PIX_FMT_ARGB32,
> > > +             .bpp = 32,
> > > +             .planes = 1,
> > > +             .hsub = 1,
> > > +     }, {
> > > +             .fourcc = DRM_FORMAT_BGRX8888,
> > > +             .v4l2 = V4L2_PIX_FMT_XRGB32,
> > >               .bpp = 32,
> > >               .planes = 1,
> > >               .hsub = 1,
> > > @@ -48,11 +101,89 @@ static const struct rzg2l_du_format_info 
> > > rzg2l_du_format_infos[] = {
> > >               .planes = 1,
> > >               .hsub = 1,
> > >       }, {
> > > -             .fourcc = DRM_FORMAT_RGB888,
> > > -             .v4l2 = V4L2_PIX_FMT_BGR24,
> > > -             .bpp = 24,
> > > +             .fourcc = DRM_FORMAT_XRGB8888,
> > > +             .v4l2 = V4L2_PIX_FMT_XBGR32,
> > > +             .bpp = 32,
> > >               .planes = 1,
> > >               .hsub = 1,
> > > +     }, {
> > > +             .fourcc = DRM_FORMAT_UYVY,
> > > +             .v4l2 = V4L2_PIX_FMT_UYVY,
> > > +             .bpp = 16,
> > > +             .planes = 1,
> > > +             .hsub = 2,
> > > +     }, {
> > > +             .fourcc = DRM_FORMAT_YUYV,
> > > +             .v4l2 = V4L2_PIX_FMT_YUYV,
> > > +             .bpp = 16,
> > > +             .planes = 1,
> > > +             .hsub = 2,
> > > +     }, {
> > > +             .fourcc = DRM_FORMAT_YVYU,
> > > +             .v4l2 = V4L2_PIX_FMT_YVYU,
> > > +             .bpp = 16,
> > > +             .planes = 1,
> > > +             .hsub = 2,
> > > +     }, {
> > > +             .fourcc = DRM_FORMAT_NV12,
> > > +             .v4l2 = V4L2_PIX_FMT_NV12M,
> > > +             .bpp = 12,
> > > +             .planes = 2,
> > > +             .hsub = 2,
> > > +     }, {
> > > +             .fourcc = DRM_FORMAT_NV21,
> > > +             .v4l2 = V4L2_PIX_FMT_NV21M,
> > > +             .bpp = 12,
> > > +             .planes = 2,
> > > +             .hsub = 2,

As this patch is extending to support YUV formats, 
Now hsub can be used in rzg2l_du_fb_create() like R-Car Gen3.

         /*                                                                     
  
          * Calculate the chroma plane(s) pitch using the horizontal 
subsampling  
          * factor. For semi-planar formats, the U and V planes are combined, 
the 
          * pitch must thus be doubled.                                         
  
          */                                                                    
  
         chroma_pitch = mode_cmd->pitches[0] / format->hsub;                    
  
         if (format->planes == 2)                                               
  
               chroma_pitch *= 2;                                               
                                                                                
  
          for (i = 1; i < format->planes; ++i) {                                
   
                  if (mode_cmd->pitches[i] != chroma_pitch) {                   
   
                          dev_dbg(dev->dev,                                     
   
                                  "luma and chroma pitches are not 
compatible\n"); 
                          return ERR_PTR(-EINVAL);                              
   
                  }                                                             
   
          }

Cheers,
Biju

Reply via email to