All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: Jyri Sarha <jsarha@ti.com>, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 3/7] drm/omap: fix missing scaler pixel fmt limitations
Date: Tue, 3 Sep 2019 18:12:45 +0300	[thread overview]
Message-ID: <20190903151245.GA8247@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20190902125359.18001-4-tomi.valkeinen@ti.com>

Hi Tomi,

Thank you for the patch.

On Mon, Sep 02, 2019 at 03:53:55PM +0300, Tomi Valkeinen wrote:
> OMAP2 and OMAP3/AM4 have limitations with the scaler:
> - OMAP2 can only scale XRGB8888
> - OMAP3/AM4 can only scale XRGB8888, RGB565, YUYV and UYVY
> 
> The driver doesn't check these limitations, which leads to sync-lost
> floods.
> 
> This patch adds a check for the pixel formats when scaling.
> 
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> ---
>  drivers/gpu/drm/omapdrm/dss/dispc.c | 25 +++++++++++++++++++++++++
>  1 file changed, 25 insertions(+)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/dispc.c b/drivers/gpu/drm/omapdrm/dss/dispc.c
> index c6da33e7014f..7d87d60edb80 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dispc.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dispc.c
> @@ -114,6 +114,7 @@ struct dispc_features {
>  	const unsigned int num_reg_fields;
>  	const enum omap_overlay_caps *overlay_caps;
>  	const u32 **supported_color_modes;
> +	const u32 *supported_scaler_color_modes;
>  	unsigned int num_mgrs;
>  	unsigned int num_ovls;
>  	unsigned int buffer_size_unit;
> @@ -2498,6 +2499,19 @@ static int dispc_ovl_calc_scaling(struct dispc_device *dispc,
>  	if (width == out_width && height == out_height)
>  		return 0;
>  
> +	if (dispc->feat->supported_scaler_color_modes) {
> +		const u32 *modes = dispc->feat->supported_scaler_color_modes;
> +		int i;

i is never negative and can thus be an unsigned int. Apart from that,

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> +
> +		for (i = 0; modes[i]; ++i) {
> +			if (modes[i] == fourcc)
> +				break;
> +		}
> +
> +		if (modes[i] == 0)
> +			return -EINVAL;
> +	}
> +
>  	if (plane == OMAP_DSS_WB) {
>  		switch (fourcc) {
>  		case DRM_FORMAT_NV12:
> @@ -4213,6 +4227,12 @@ static const u32 *omap4_dispc_supported_color_modes[] = {
>  	DRM_FORMAT_RGBX8888),
>  };
>  
> +static const u32 omap3_dispc_supported_scaler_color_modes[] = {
> +	DRM_FORMAT_XRGB8888, DRM_FORMAT_RGB565, DRM_FORMAT_YUYV,
> +	DRM_FORMAT_UYVY,
> +	0,
> +};
> +
>  static const struct dispc_features omap24xx_dispc_feats = {
>  	.sw_start		=	5,
>  	.fp_start		=	15,
> @@ -4241,6 +4261,7 @@ static const struct dispc_features omap24xx_dispc_feats = {
>  	.num_reg_fields		=	ARRAY_SIZE(omap2_dispc_reg_fields),
>  	.overlay_caps		=	omap2_dispc_overlay_caps,
>  	.supported_color_modes	=	omap2_dispc_supported_color_modes,
> +	.supported_scaler_color_modes = COLOR_ARRAY(DRM_FORMAT_XRGB8888),
>  	.num_mgrs		=	2,
>  	.num_ovls		=	3,
>  	.buffer_size_unit	=	1,
> @@ -4275,6 +4296,7 @@ static const struct dispc_features omap34xx_rev1_0_dispc_feats = {
>  	.num_reg_fields		=	ARRAY_SIZE(omap3_dispc_reg_fields),
>  	.overlay_caps		=	omap3430_dispc_overlay_caps,
>  	.supported_color_modes	=	omap3_dispc_supported_color_modes,
> +	.supported_scaler_color_modes = omap3_dispc_supported_scaler_color_modes,
>  	.num_mgrs		=	2,
>  	.num_ovls		=	3,
>  	.buffer_size_unit	=	1,
> @@ -4309,6 +4331,7 @@ static const struct dispc_features omap34xx_rev3_0_dispc_feats = {
>  	.num_reg_fields		=	ARRAY_SIZE(omap3_dispc_reg_fields),
>  	.overlay_caps		=	omap3430_dispc_overlay_caps,
>  	.supported_color_modes	=	omap3_dispc_supported_color_modes,
> +	.supported_scaler_color_modes = omap3_dispc_supported_scaler_color_modes,
>  	.num_mgrs		=	2,
>  	.num_ovls		=	3,
>  	.buffer_size_unit	=	1,
> @@ -4343,6 +4366,7 @@ static const struct dispc_features omap36xx_dispc_feats = {
>  	.num_reg_fields		=	ARRAY_SIZE(omap3_dispc_reg_fields),
>  	.overlay_caps		=	omap3630_dispc_overlay_caps,
>  	.supported_color_modes	=	omap3_dispc_supported_color_modes,
> +	.supported_scaler_color_modes = omap3_dispc_supported_scaler_color_modes,
>  	.num_mgrs		=	2,
>  	.num_ovls		=	3,
>  	.buffer_size_unit	=	1,
> @@ -4377,6 +4401,7 @@ static const struct dispc_features am43xx_dispc_feats = {
>  	.num_reg_fields		=	ARRAY_SIZE(omap3_dispc_reg_fields),
>  	.overlay_caps		=	omap3430_dispc_overlay_caps,
>  	.supported_color_modes	=	omap3_dispc_supported_color_modes,
> +	.supported_scaler_color_modes = omap3_dispc_supported_scaler_color_modes,
>  	.num_mgrs		=	1,
>  	.num_ovls		=	3,
>  	.buffer_size_unit	=	1,

-- 
Regards,

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

  reply	other threads:[~2019-09-03 15:12 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-02 12:53 [PATCH 0/7] drm/omap: misc improvements Tomi Valkeinen
2019-09-02 12:53 ` [PATCH 1/7] drm/omap: drop unneeded locking from mgr_fld_write() Tomi Valkeinen
2019-09-03 14:14   ` Laurent Pinchart
2019-09-02 12:53 ` [PATCH 2/7] drm/omap: tweak HDMI DDC timings Tomi Valkeinen
2019-09-03 14:23   ` Laurent Pinchart
2019-09-26 12:54     ` Tomi Valkeinen
2019-09-26 14:40       ` Alejandro Hernandez
2019-09-02 12:53 ` [PATCH 3/7] drm/omap: fix missing scaler pixel fmt limitations Tomi Valkeinen
2019-09-03 15:12   ` Laurent Pinchart [this message]
2019-09-26 12:55     ` Tomi Valkeinen
2019-09-02 12:53 ` [PATCH 4/7] drm/omap: Implement CTM property for CRTC using OVL managers CPR matrix Tomi Valkeinen
2019-09-03 15:24   ` Laurent Pinchart
     [not found]     ` <b44372e2-1bb7-ddb8-d121-ae096b38d918@ti.com>
2019-09-04 11:11       ` Laurent Pinchart
2019-09-04 20:08         ` Jyri Sarha
2019-09-04 20:20           ` Ilia Mirkin
2020-09-21 11:08             ` Tomi Valkeinen
2020-09-21 11:49               ` Pekka Paalanen
2020-09-22  7:44                 ` Tomi Valkeinen
2020-09-22  9:48                   ` Pekka Paalanen
2020-09-22 10:02                   ` Daniel Stone
2019-09-04 21:52           ` Laurent Pinchart
2019-09-05 10:00             ` Jyri Sarha
2019-09-05 10:05               ` Laurent Pinchart
2019-09-05 13:48                 ` Jyri Sarha
2019-09-02 12:53 ` [PATCH 5/7] drm/omap: Enable COLOR_ENCODING and COLOR_RANGE properties for planes Tomi Valkeinen
2019-09-03 15:32   ` Laurent Pinchart
2019-09-05  9:24     ` Jyri Sarha
2019-09-05  9:43       ` Laurent Pinchart
2019-09-02 12:53 ` [PATCH 6/7] drm/omap: dss: platform_register_drivers() to dss.c and remove core.c Tomi Valkeinen
2019-09-03 15:34   ` Laurent Pinchart
2019-09-04  6:47     ` Jyri Sarha
2019-09-02 12:53 ` [PATCH 7/7] drm/omap: hdmi5: automatically choose limited/full range output Tomi Valkeinen
2019-09-03 15:38   ` Laurent Pinchart

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=20190903151245.GA8247@pendragon.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jsarha@ti.com \
    --cc=tomi.valkeinen@ti.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.