All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Kieran Bingham <kieran.bingham@ideasonboard.com>
Cc: "Ville Syrjälä" <ville.syrjala@linux.intel.com>,
	linux-renesas-soc@vger.kernel.org,
	"Laurent Pinchart" <laurent.pinchart+renesas@ideasonboard.com>,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm: rcar-du: Fix pitch handling for fully planar YUV formats
Date: Wed, 9 Sep 2020 19:17:30 +0300	[thread overview]
Message-ID: <20200909161730.GC3931@pendragon.ideasonboard.com> (raw)
In-Reply-To: <490b02de-8b4f-057e-a0c6-07f73f6ce052@ideasonboard.com>

Hi Kieran,

On Wed, Sep 09, 2020 at 05:06:01PM +0100, Kieran Bingham wrote:
> On 09/09/2020 13:08, Ville Syrjälä wrote:
> > On Tue, Sep 08, 2020 at 05:05:48PM +0100, Kieran Bingham wrote:
> >> On 08/09/2020 16:52, Laurent Pinchart wrote:
> >>> On Tue, Sep 08, 2020 at 04:42:58PM +0100, Kieran Bingham wrote:
> >>>> On 06/08/2020 03:26, Laurent Pinchart wrote:
> >>>>> When creating a frame buffer, the driver verifies that the pitches for
> >>>>> the chroma planes match the luma plane. This is done incorrectly for
> >>>>> fully planar YUV formats, without taking horizontal subsampling into
> >>>>> account. Fix it.
> >>>>>
> >>>>> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
> >>>>> ---
> > <snip>
> >>>>>  	}, {
> >>>>>  		.fourcc = DRM_FORMAT_YVU444,
> >>>>>  		.v4l2 = V4L2_PIX_FMT_YVU444M,
> >>>>>  		.bpp = 24,
> >>>>>  		.planes = 3,
> >>>>> +		.hsub = 1,
> >>>>>  	},
> >>>>>  };
> >>>>>  
> >>>>
> >>>> I wonder when we can have a global/generic set of format tables so that
> >>>> all of this isn't duplicated on a per-driver basis.
> >>>
> >>> Note that this table also contains register values, so at least that
> >>> part will need to be kept. For the rest, do you mean a 4CC library that
> >>
> >> Yes, the driver specific mappings of course need to be driver specific.
> >>
> >>> would be shared between DRM/KMS and V4L2 ? That's a great idea. Too bad
> >>> it has been shot down when patches were submitted :-S
> >>
> >>  /o\ ... It just seems like so much data replication that must be used
> >> by many drivers.
> >>
> >> Even without mapping the DRM/V4L2 fourccs - even a common table in each
> >> subsystem would be beneficial wouldn't it?
> >>
> >> I mean - RCar-DU isn't the only device that needs to know how many
> >> planes DRM_FORMAT_YUV422 has, or what horizontal subsampling it uses?
> >>
> >> Anyway, that's not an issue with this patch, it just seems glaring to me
> >> that these entries are common across all hardware that use them ...
> >>
> >> (the bpp/planes/subsampling of course, not the hardware specific registers).
> > 
> > See drm_format_info() & co.
> 
> Aha perfect, That's what I was looking for.
> I'm glad to see that's common (at least for the DRM parts).
> 
> The question is - why aren't we using it in RCar-DU.
> 
> Laurent, would you see any issue in obtaining the struct drm_format_info
> rather than re-encoding all the data in these tables?
> 
> And if not - would you prefer to convert on top of this patch, or
> preceding this patch?
> 
> Or simply prefer to keep the existing tables ?
> 
> Given that this fixes a bug - I'd say getting this patch in now is
> probably best.

I'd apply refactoring on top, if desired. You would have to keep the
existing table for the mapping to V4L2 (although this could be moved to
drm_format_info if desired), as well as for the register value. And that
would then lead to a double lookup operation. That's the part that
bothers me the most.

-- 
Regards,

Laurent Pinchart

WARNING: multiple messages have this Message-ID (diff)
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Kieran Bingham <kieran.bingham@ideasonboard.com>
Cc: linux-renesas-soc@vger.kernel.org,
	Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm: rcar-du: Fix pitch handling for fully planar YUV formats
Date: Wed, 9 Sep 2020 19:17:30 +0300	[thread overview]
Message-ID: <20200909161730.GC3931@pendragon.ideasonboard.com> (raw)
In-Reply-To: <490b02de-8b4f-057e-a0c6-07f73f6ce052@ideasonboard.com>

Hi Kieran,

On Wed, Sep 09, 2020 at 05:06:01PM +0100, Kieran Bingham wrote:
> On 09/09/2020 13:08, Ville Syrjälä wrote:
> > On Tue, Sep 08, 2020 at 05:05:48PM +0100, Kieran Bingham wrote:
> >> On 08/09/2020 16:52, Laurent Pinchart wrote:
> >>> On Tue, Sep 08, 2020 at 04:42:58PM +0100, Kieran Bingham wrote:
> >>>> On 06/08/2020 03:26, Laurent Pinchart wrote:
> >>>>> When creating a frame buffer, the driver verifies that the pitches for
> >>>>> the chroma planes match the luma plane. This is done incorrectly for
> >>>>> fully planar YUV formats, without taking horizontal subsampling into
> >>>>> account. Fix it.
> >>>>>
> >>>>> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
> >>>>> ---
> > <snip>
> >>>>>  	}, {
> >>>>>  		.fourcc = DRM_FORMAT_YVU444,
> >>>>>  		.v4l2 = V4L2_PIX_FMT_YVU444M,
> >>>>>  		.bpp = 24,
> >>>>>  		.planes = 3,
> >>>>> +		.hsub = 1,
> >>>>>  	},
> >>>>>  };
> >>>>>  
> >>>>
> >>>> I wonder when we can have a global/generic set of format tables so that
> >>>> all of this isn't duplicated on a per-driver basis.
> >>>
> >>> Note that this table also contains register values, so at least that
> >>> part will need to be kept. For the rest, do you mean a 4CC library that
> >>
> >> Yes, the driver specific mappings of course need to be driver specific.
> >>
> >>> would be shared between DRM/KMS and V4L2 ? That's a great idea. Too bad
> >>> it has been shot down when patches were submitted :-S
> >>
> >>  /o\ ... It just seems like so much data replication that must be used
> >> by many drivers.
> >>
> >> Even without mapping the DRM/V4L2 fourccs - even a common table in each
> >> subsystem would be beneficial wouldn't it?
> >>
> >> I mean - RCar-DU isn't the only device that needs to know how many
> >> planes DRM_FORMAT_YUV422 has, or what horizontal subsampling it uses?
> >>
> >> Anyway, that's not an issue with this patch, it just seems glaring to me
> >> that these entries are common across all hardware that use them ...
> >>
> >> (the bpp/planes/subsampling of course, not the hardware specific registers).
> > 
> > See drm_format_info() & co.
> 
> Aha perfect, That's what I was looking for.
> I'm glad to see that's common (at least for the DRM parts).
> 
> The question is - why aren't we using it in RCar-DU.
> 
> Laurent, would you see any issue in obtaining the struct drm_format_info
> rather than re-encoding all the data in these tables?
> 
> And if not - would you prefer to convert on top of this patch, or
> preceding this patch?
> 
> Or simply prefer to keep the existing tables ?
> 
> Given that this fixes a bug - I'd say getting this patch in now is
> probably best.

I'd apply refactoring on top, if desired. You would have to keep the
existing table for the mapping to V4L2 (although this could be moved to
drm_format_info if desired), as well as for the register value. And that
would then lead to a double lookup operation. That's the part that
bothers me the most.

-- 
Regards,

Laurent Pinchart
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2020-09-09 16:18 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-06  2:26 [PATCH] drm: rcar-du: Fix pitch handling for fully planar YUV formats Laurent Pinchart
2020-08-06  2:26 ` Laurent Pinchart
2020-09-08 15:42 ` Kieran Bingham
2020-09-08 15:42   ` Kieran Bingham
2020-09-08 15:52   ` Laurent Pinchart
2020-09-08 15:52     ` Laurent Pinchart
2020-09-08 16:05     ` Kieran Bingham
2020-09-08 16:05       ` Kieran Bingham
2020-09-09 12:08       ` Ville Syrjälä
2020-09-09 12:08         ` Ville Syrjälä
2020-09-09 16:06         ` Kieran Bingham
2020-09-09 16:06           ` Kieran Bingham
2020-09-09 16:17           ` Laurent Pinchart [this message]
2020-09-09 16:17             ` Laurent Pinchart
2020-09-09 12:17       ` Daniel Vetter
2020-09-09 12:17         ` Daniel Vetter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200909161730.GC3931@pendragon.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=kieran.bingham@ideasonboard.com \
    --cc=laurent.pinchart+renesas@ideasonboard.com \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=ville.syrjala@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.