From: Tomi Valkeinen <tomi.valkeinen@ti.com> To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>, linux-omap@vger.kernel.org, linux-fbdev@vger.kernel.org Cc: Tomi Valkeinen <tomi.valkeinen@ti.com> Subject: [PATCH 07/11] OMAPDSS: DISPC: check if scaling setup failed Date: Wed, 17 Jun 2015 12:54:31 +0000 [thread overview] Message-ID: <1434545675-477-8-git-send-email-tomi.valkeinen@ti.com> (raw) In-Reply-To: <1434545675-477-1-git-send-email-tomi.valkeinen@ti.com> The DISPC's scaling code seems to presume that decimation always succeeds, and so we always do find a suitable downscaling setup. However, this is not the case, and the algorithm can fail. When that happens, the code just proceeds with wrong results, causing issues later. Add the necessary checks to bail out if the scaling algorithm failed. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com> --- drivers/video/fbdev/omap2/dss/dispc.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/video/fbdev/omap2/dss/dispc.c b/drivers/video/fbdev/omap2/dss/dispc.c index 2db1c986e989..0bdb587cb48c 100644 --- a/drivers/video/fbdev/omap2/dss/dispc.c +++ b/drivers/video/fbdev/omap2/dss/dispc.c @@ -2279,6 +2279,11 @@ static int dispc_ovl_calc_scaling_24xx(unsigned long pclk, unsigned long lclk, } } while (*decim_x <= *x_predecim && *decim_y <= *y_predecim && error); + if (error) { + DSSERR("failed to find scaling settings\n"); + return -EINVAL; + } + if (in_width > maxsinglelinewidth) { DSSERR("Cannot scale max input width exceeded"); return -EINVAL; @@ -2356,6 +2361,11 @@ again: } } while (*decim_x <= *x_predecim && *decim_y <= *y_predecim && error); + if (error) { + DSSERR("failed to find scaling settings\n"); + return -EINVAL; + } + if (check_horiz_timing_omap3(pclk, lclk, mgr_timings, pos_x, in_width, in_height, out_width, out_height, *five_taps)) { DSSERR("horizontal timing too tight\n"); -- 2.1.4
WARNING: multiple messages have this Message-ID (diff)
From: Tomi Valkeinen <tomi.valkeinen@ti.com> To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>, linux-omap@vger.kernel.org, linux-fbdev@vger.kernel.org Cc: Tomi Valkeinen <tomi.valkeinen@ti.com> Subject: [PATCH 07/11] OMAPDSS: DISPC: check if scaling setup failed Date: Wed, 17 Jun 2015 15:54:31 +0300 [thread overview] Message-ID: <1434545675-477-8-git-send-email-tomi.valkeinen@ti.com> (raw) In-Reply-To: <1434545675-477-1-git-send-email-tomi.valkeinen@ti.com> The DISPC's scaling code seems to presume that decimation always succeeds, and so we always do find a suitable downscaling setup. However, this is not the case, and the algorithm can fail. When that happens, the code just proceeds with wrong results, causing issues later. Add the necessary checks to bail out if the scaling algorithm failed. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com> --- drivers/video/fbdev/omap2/dss/dispc.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/video/fbdev/omap2/dss/dispc.c b/drivers/video/fbdev/omap2/dss/dispc.c index 2db1c986e989..0bdb587cb48c 100644 --- a/drivers/video/fbdev/omap2/dss/dispc.c +++ b/drivers/video/fbdev/omap2/dss/dispc.c @@ -2279,6 +2279,11 @@ static int dispc_ovl_calc_scaling_24xx(unsigned long pclk, unsigned long lclk, } } while (*decim_x <= *x_predecim && *decim_y <= *y_predecim && error); + if (error) { + DSSERR("failed to find scaling settings\n"); + return -EINVAL; + } + if (in_width > maxsinglelinewidth) { DSSERR("Cannot scale max input width exceeded"); return -EINVAL; @@ -2356,6 +2361,11 @@ again: } } while (*decim_x <= *x_predecim && *decim_y <= *y_predecim && error); + if (error) { + DSSERR("failed to find scaling settings\n"); + return -EINVAL; + } + if (check_horiz_timing_omap3(pclk, lclk, mgr_timings, pos_x, in_width, in_height, out_width, out_height, *five_taps)) { DSSERR("horizontal timing too tight\n"); -- 2.1.4
next prev parent reply other threads:[~2015-06-17 12:54 UTC|newest] Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top 2015-06-17 12:54 [PATCH 00/11] OMAPDSS: scaling & misc fixes Tomi Valkeinen 2015-06-17 12:54 ` Tomi Valkeinen 2015-06-17 12:54 ` [PATCH 01/11] OMAPDSS: DISPC: work-around for errata i631 Tomi Valkeinen 2015-06-17 12:54 ` Tomi Valkeinen 2015-06-17 12:54 ` [PATCH 02/11] OMAPDSS: DISPC: fix predecimation for YUV modes Tomi Valkeinen 2015-06-17 12:54 ` Tomi Valkeinen 2015-06-17 12:54 ` [PATCH 03/11] OMAPDSS: DISPC: fix check_horiz_timing_omap3 args Tomi Valkeinen 2015-06-17 12:54 ` Tomi Valkeinen 2015-06-17 12:54 ` [PATCH 04/11] OMAPDSS: DISPC: add check for scaling limits Tomi Valkeinen 2015-06-17 12:54 ` Tomi Valkeinen 2015-06-17 12:54 ` [PATCH 05/11] OMAPDSS: DISPC: fix row_inc for OMAP3 Tomi Valkeinen 2015-06-17 12:54 ` Tomi Valkeinen 2015-06-17 12:54 ` [PATCH 06/11] OMAPDSS: DISPC: fix 64 bit issue in 5-tap Tomi Valkeinen 2015-06-17 12:54 ` Tomi Valkeinen 2015-06-17 12:54 ` Tomi Valkeinen [this message] 2015-06-17 12:54 ` [PATCH 07/11] OMAPDSS: DISPC: check if scaling setup failed Tomi Valkeinen 2015-06-17 12:54 ` [PATCH 08/11] OMAPDSS: DISPC: do only y decimation on OMAP3 Tomi Valkeinen 2015-06-17 12:54 ` Tomi Valkeinen 2015-06-17 12:54 ` [PATCH 09/11] OMAPDSS: DISPC: scaler debug print Tomi Valkeinen 2015-06-17 12:54 ` Tomi Valkeinen 2015-06-17 12:54 ` [PATCH 10/11] OMAPDSS: HDMI4: fix error handling Tomi Valkeinen 2015-06-17 12:54 ` Tomi Valkeinen 2015-06-17 12:54 ` [PATCH 11/11] OMAPDSS: HDMI: wait for framedone when stopping video Tomi Valkeinen 2015-06-17 12:54 ` Tomi Valkeinen
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=1434545675-477-8-git-send-email-tomi.valkeinen@ti.com \ --to=tomi.valkeinen@ti.com \ --cc=laurent.pinchart@ideasonboard.com \ --cc=linux-fbdev@vger.kernel.org \ --cc=linux-omap@vger.kernel.org \ /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: linkBe 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.