linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] OMAPDSS: DISPC: Fix 34xx overlay scaling calculation
@ 2014-01-11 12:42 Ivaylo Dimitrov
  2014-01-13  9:43 ` Tomi Valkeinen
  2014-01-13 10:58 ` Archit Taneja
  0 siblings, 2 replies; 5+ messages in thread
From: Ivaylo Dimitrov @ 2014-01-11 12:42 UTC (permalink / raw)
  To: tomi.valkeinen
  Cc: plagnioj, pali.rohar, pavel, linux-omap, linux-fbdev,
	linux-kernel, Ivaylo Dimitrov, Ivaylo Dimitrov

From: Ivaylo Dimitrov <freemangordon@abv.bg>

commit 7faa92339bbb1e6b9a80983b206642517327eb75 OMAPDSS: DISPC: Handle
synclost errors in OMAP3 introduces limits check to prevent SYNCLOST errors
on OMAP3. However, it misses the logic found in Nokia kernels that is
needed to correctly calculate whether 3 tap or 5 tap rescaler to be used as
well as the logic to fallback to 3 taps if 5 taps clock results in too
tight horizontal timings. Without that patch "horizontal timing too tight"
errors are seen when a video with resolution above 640x350 is tried to be
played. The patch is a forward-ported logic found in Nokia N900 and N9/50
kernels.

Signed-off-by: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>
---
 drivers/video/omap2/dss/dispc.c |   36 +++++++++++++++++++++++++-----------
 1 files changed, 25 insertions(+), 11 deletions(-)

diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
index 67e413e..9d1aa25 100644
--- a/drivers/video/omap2/dss/dispc.c
+++ b/drivers/video/omap2/dss/dispc.c
@@ -1999,7 +1999,8 @@ static void calc_tiler_rotation_offset(u16 screen_width, u16 width,
  */
 static int check_horiz_timing_omap3(unsigned long pclk, unsigned long lclk,
 		const struct omap_video_timings *t, u16 pos_x,
-		u16 width, u16 height, u16 out_width, u16 out_height)
+		u16 width, u16 height, u16 out_width, u16 out_height,
+		bool five_taps)
 {
 	const int ds = DIV_ROUND_UP(height, out_height);
 	unsigned long nonactive;
@@ -2019,6 +2020,10 @@ static int check_horiz_timing_omap3(unsigned long pclk, unsigned long lclk,
 	if (blank <= limits[i])
 		return -EINVAL;
 
+	/* FIXME add checks for 3-tap filter once the limitations are known */
+	if (!five_taps)
+		return 0;
+
 	/*
 	 * Pixel data should be prepared before visible display point starts.
 	 * So, atleast DS-2 lines must have already been fetched by DISPC
@@ -2191,24 +2196,33 @@ static int dispc_ovl_calc_scaling_34xx(unsigned long pclk, unsigned long lclk,
 	const int maxsinglelinewidth  			dss_feat_get_param_max(FEAT_PARAM_LINEWIDTH);
 
+	*five_taps = height > out_height;
+
 	do {
 		in_height = DIV_ROUND_UP(height, *decim_y);
 		in_width = DIV_ROUND_UP(width, *decim_x);
-		*core_clk = calc_core_clk_five_taps(pclk, mgr_timings,
-			in_width, in_height, out_width, out_height, color_mode);
-
-		error = check_horiz_timing_omap3(pclk, lclk, mgr_timings,
-				pos_x, in_width, in_height, out_width,
-				out_height);
 
 		if (in_width > maxsinglelinewidth)
 			if (in_height > out_height &&
 						in_height < out_height * 2)
 				*five_taps = false;
-		if (!*five_taps)
+again:
+		if (*five_taps)
+			*core_clk = calc_core_clk_five_taps(pclk, mgr_timings,
+						in_width, in_height, out_width,
+						out_height, color_mode);
+		else
 			*core_clk = dispc.feat->calc_core_clk(pclk, in_width,
-					in_height, out_width, out_height,
-					mem_to_mem);
+				in_height, out_width, out_height,
+				mem_to_mem);
+
+		error = check_horiz_timing_omap3(pclk, lclk, mgr_timings,
+				pos_x, in_width, in_height, out_width,
+				out_height, *five_taps);
+		if (error && *five_taps) {
+			*five_taps = false;
+			goto again;
+		}
 
 		error = (error || in_width > maxsinglelinewidth * 2 ||
 			(in_width > maxsinglelinewidth && *five_taps) ||
@@ -2226,7 +2240,7 @@ static int dispc_ovl_calc_scaling_34xx(unsigned long pclk, unsigned long lclk,
 	} while (*decim_x <= *x_predecim && *decim_y <= *y_predecim && error);
 
 	if (check_horiz_timing_omap3(pclk, lclk, mgr_timings, pos_x, width,
-				height, out_width, out_height)){
+				height, out_width, out_height, *five_taps)) {
 			DSSERR("horizontal timing too tight\n");
 			return -EINVAL;
 	}
-- 
1.5.6.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] OMAPDSS: DISPC: Fix 34xx overlay scaling calculation
  2014-01-11 12:42 [PATCH] OMAPDSS: DISPC: Fix 34xx overlay scaling calculation Ivaylo Dimitrov
@ 2014-01-13  9:43 ` Tomi Valkeinen
  2014-01-13 10:58 ` Archit Taneja
  1 sibling, 0 replies; 5+ messages in thread
From: Tomi Valkeinen @ 2014-01-13  9:43 UTC (permalink / raw)
  To: Ivaylo Dimitrov
  Cc: plagnioj, pali.rohar, pavel, linux-omap, linux-fbdev,
	linux-kernel, Ivaylo Dimitrov, Archit Taneja

[-- Attachment #1: Type: text/plain, Size: 1083 bytes --]

Hi,

On 2014-01-11 14:42, Ivaylo Dimitrov wrote:
> From: Ivaylo Dimitrov <freemangordon@abv.bg>
> 
> commit 7faa92339bbb1e6b9a80983b206642517327eb75 OMAPDSS: DISPC: Handle
> synclost errors in OMAP3 introduces limits check to prevent SYNCLOST errors
> on OMAP3. However, it misses the logic found in Nokia kernels that is
> needed to correctly calculate whether 3 tap or 5 tap rescaler to be used as
> well as the logic to fallback to 3 taps if 5 taps clock results in too
> tight horizontal timings. Without that patch "horizontal timing too tight"
> errors are seen when a video with resolution above 640x350 is tried to be
> played. The patch is a forward-ported logic found in Nokia N900 and N9/50
> kernels.
> 
> Signed-off-by: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>

I had a quick test with this. Without the patch, on beagle-xm, my scaler
test immediately gives "horizontal timing too tight". With the patch, no
errors and the scaling seems to work. So looks good. I'll look at the
patch a bit more, but I think this is 3.14 material.

 Tomi



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 901 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] OMAPDSS: DISPC: Fix 34xx overlay scaling calculation
  2014-01-11 12:42 [PATCH] OMAPDSS: DISPC: Fix 34xx overlay scaling calculation Ivaylo Dimitrov
  2014-01-13  9:43 ` Tomi Valkeinen
@ 2014-01-13 10:58 ` Archit Taneja
  2014-01-13 16:33   ` [PATCH v2] " Ivaylo Dimitrov
  1 sibling, 1 reply; 5+ messages in thread
From: Archit Taneja @ 2014-01-13 10:58 UTC (permalink / raw)
  To: Ivaylo Dimitrov, tomi.valkeinen
  Cc: plagnioj, pali.rohar, pavel, linux-omap, linux-fbdev,
	linux-kernel, Ivaylo Dimitrov

Hi,

On Saturday 11 January 2014 06:12 PM, Ivaylo Dimitrov wrote:
> From: Ivaylo Dimitrov <freemangordon@abv.bg>
>
> commit 7faa92339bbb1e6b9a80983b206642517327eb75 OMAPDSS: DISPC: Handle
> synclost errors in OMAP3 introduces limits check to prevent SYNCLOST errors
> on OMAP3. However, it misses the logic found in Nokia kernels that is
> needed to correctly calculate whether 3 tap or 5 tap rescaler to be used as
> well as the logic to fallback to 3 taps if 5 taps clock results in too
> tight horizontal timings. Without that patch "horizontal timing too tight"
> errors are seen when a video with resolution above 640x350 is tried to be
> played. The patch is a forward-ported logic found in Nokia N900 and N9/50
> kernels.
>
> Signed-off-by: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>
> ---
>   drivers/video/omap2/dss/dispc.c |   36 +++++++++++++++++++++++++-----------
>   1 files changed, 25 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
> index 67e413e..9d1aa25 100644
> --- a/drivers/video/omap2/dss/dispc.c
> +++ b/drivers/video/omap2/dss/dispc.c
> @@ -1999,7 +1999,8 @@ static void calc_tiler_rotation_offset(u16 screen_width, u16 width,
>    */
>   static int check_horiz_timing_omap3(unsigned long pclk, unsigned long lclk,
>   		const struct omap_video_timings *t, u16 pos_x,
> -		u16 width, u16 height, u16 out_width, u16 out_height)
> +		u16 width, u16 height, u16 out_width, u16 out_height,
> +		bool five_taps)
>   {
>   	const int ds = DIV_ROUND_UP(height, out_height);
>   	unsigned long nonactive;
> @@ -2019,6 +2020,10 @@ static int check_horiz_timing_omap3(unsigned long pclk, unsigned long lclk,
>   	if (blank <= limits[i])
>   		return -EINVAL;
>
> +	/* FIXME add checks for 3-tap filter once the limitations are known */
> +	if (!five_taps)
> +		return 0;
> +
>   	/*
>   	 * Pixel data should be prepared before visible display point starts.
>   	 * So, atleast DS-2 lines must have already been fetched by DISPC
> @@ -2191,24 +2196,33 @@ static int dispc_ovl_calc_scaling_34xx(unsigned long pclk, unsigned long lclk,
>   	const int maxsinglelinewidth >   			dss_feat_get_param_max(FEAT_PARAM_LINEWIDTH);
>
> +	*five_taps = height > out_height;
> +

We should consider the decimated height when calculating the five taps. 
I suggest the change below:

>   	do {
>   		in_height = DIV_ROUND_UP(height, *decim_y);
>   		in_width = DIV_ROUND_UP(width, *decim_x);
> -		*core_clk = calc_core_clk_five_taps(pclk, mgr_timings,
> -			in_width, in_height, out_width, out_height, color_mode);
> -
> -		error = check_horiz_timing_omap3(pclk, lclk, mgr_timings,
> -				pos_x, in_width, in_height, out_width,
> -				out_height);
>

set "*five_taps = in_height > out_height;" here. The rest of the code 
remains the same.

>   		if (in_width > maxsinglelinewidth)
>   			if (in_height > out_height &&
>   						in_height < out_height * 2)
>   				*five_taps = false;
> -		if (!*five_taps)
> +again:
> +		if (*five_taps)
> +			*core_clk = calc_core_clk_five_taps(pclk, mgr_timings,
> +						in_width, in_height, out_width,
> +						out_height, color_mode);
> +		else
>   			*core_clk = dispc.feat->calc_core_clk(pclk, in_width,
> -					in_height, out_width, out_height,
> -					mem_to_mem);
> +				in_height, out_width, out_height,
> +				mem_to_mem);
> +
> +		error = check_horiz_timing_omap3(pclk, lclk, mgr_timings,
> +				pos_x, in_width, in_height, out_width,
> +				out_height, *five_taps);
> +		if (error && *five_taps) {
> +			*five_taps = false;
> +			goto again;
> +		}
>
>   		error = (error || in_width > maxsinglelinewidth * 2 ||
>   			(in_width > maxsinglelinewidth && *five_taps) ||
> @@ -2226,7 +2240,7 @@ static int dispc_ovl_calc_scaling_34xx(unsigned long pclk, unsigned long lclk,
>   	} while (*decim_x <= *x_predecim && *decim_y <= *y_predecim && error);
>
>   	if (check_horiz_timing_omap3(pclk, lclk, mgr_timings, pos_x, width,
> -				height, out_width, out_height)){
> +				height, out_width, out_height, *five_taps)) {
>   			DSSERR("horizontal timing too tight\n");
>   			return -EINVAL;
>   	}
>

Thanks,
Archit


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2] OMAPDSS: DISPC: Fix 34xx overlay scaling calculation
  2014-01-13 10:58 ` Archit Taneja
@ 2014-01-13 16:33   ` Ivaylo Dimitrov
  2014-01-14  8:11     ` Tomi Valkeinen
  0 siblings, 1 reply; 5+ messages in thread
From: Ivaylo Dimitrov @ 2014-01-13 16:33 UTC (permalink / raw)
  To: tomi.valkeinen
  Cc: archit, plagnioj, pali.rohar, pavel, linux-omap, linux-fbdev,
	linux-kernel, Ivaylo Dimitrov, Ivaylo Dimitrov

From: Ivaylo Dimitrov <freemangordon@abv.bg>

commit 7faa92339bbb1e6b9a80983b206642517327eb75 OMAPDSS: DISPC: Handle
synclost errors in OMAP3 introduces limits check to prevent SYNCLOST errors
on OMAP3. However, it misses the logic found in Nokia kernels that is
needed to correctly calculate whether 3 tap or 5 tap rescaler to be used as
well as the logic to fallback to 3 taps if 5 taps clock results in too
tight horizontal timings. Without that patch "horizontal timing too tight"
errors are seen when a video with resolution above 640x350 is tried to be
played. The patch is a forward-ported logic found in Nokia N900 and N9/50
kernels.

Signed-off-by: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>
---
 drivers/video/omap2/dss/dispc.c |   31 ++++++++++++++++++++++---------
 1 files changed, 22 insertions(+), 9 deletions(-)

diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
index 67e413e..66e0849 100644
--- a/drivers/video/omap2/dss/dispc.c
+++ b/drivers/video/omap2/dss/dispc.c
@@ -1999,7 +1999,8 @@ static void calc_tiler_rotation_offset(u16 screen_width, u16 width,
  */
 static int check_horiz_timing_omap3(unsigned long pclk, unsigned long lclk,
 		const struct omap_video_timings *t, u16 pos_x,
-		u16 width, u16 height, u16 out_width, u16 out_height)
+		u16 width, u16 height, u16 out_width, u16 out_height,
+		bool five_taps)
 {
 	const int ds = DIV_ROUND_UP(height, out_height);
 	unsigned long nonactive;
@@ -2019,6 +2020,10 @@ static int check_horiz_timing_omap3(unsigned long pclk, unsigned long lclk,
 	if (blank <= limits[i])
 		return -EINVAL;
 
+	/* FIXME add checks for 3-tap filter once the limitations are known */
+	if (!five_taps)
+		return 0;
+
 	/*
 	 * Pixel data should be prepared before visible display point starts.
 	 * So, atleast DS-2 lines must have already been fetched by DISPC
@@ -2194,22 +2199,30 @@ static int dispc_ovl_calc_scaling_34xx(unsigned long pclk, unsigned long lclk,
 	do {
 		in_height = DIV_ROUND_UP(height, *decim_y);
 		in_width = DIV_ROUND_UP(width, *decim_x);
-		*core_clk = calc_core_clk_five_taps(pclk, mgr_timings,
-			in_width, in_height, out_width, out_height, color_mode);
-
-		error = check_horiz_timing_omap3(pclk, lclk, mgr_timings,
-				pos_x, in_width, in_height, out_width,
-				out_height);
+		*five_taps = in_height > out_height;
 
 		if (in_width > maxsinglelinewidth)
 			if (in_height > out_height &&
 						in_height < out_height * 2)
 				*five_taps = false;
-		if (!*five_taps)
+again:
+		if (*five_taps)
+			*core_clk = calc_core_clk_five_taps(pclk, mgr_timings,
+						in_width, in_height, out_width,
+						out_height, color_mode);
+		else
 			*core_clk = dispc.feat->calc_core_clk(pclk, in_width,
 					in_height, out_width, out_height,
 					mem_to_mem);
 
+		error = check_horiz_timing_omap3(pclk, lclk, mgr_timings,
+				pos_x, in_width, in_height, out_width,
+				out_height, *five_taps);
+		if (error && *five_taps) {
+			*five_taps = false;
+			goto again;
+		}
+
 		error = (error || in_width > maxsinglelinewidth * 2 ||
 			(in_width > maxsinglelinewidth && *five_taps) ||
 			!*core_clk || *core_clk > dispc_core_clk_rate());
@@ -2226,7 +2239,7 @@ static int dispc_ovl_calc_scaling_34xx(unsigned long pclk, unsigned long lclk,
 	} while (*decim_x <= *x_predecim && *decim_y <= *y_predecim && error);
 
 	if (check_horiz_timing_omap3(pclk, lclk, mgr_timings, pos_x, width,
-				height, out_width, out_height)){
+				height, out_width, out_height, *five_taps)) {
 			DSSERR("horizontal timing too tight\n");
 			return -EINVAL;
 	}
-- 
1.5.6.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] OMAPDSS: DISPC: Fix 34xx overlay scaling calculation
  2014-01-13 16:33   ` [PATCH v2] " Ivaylo Dimitrov
@ 2014-01-14  8:11     ` Tomi Valkeinen
  0 siblings, 0 replies; 5+ messages in thread
From: Tomi Valkeinen @ 2014-01-14  8:11 UTC (permalink / raw)
  To: Ivaylo Dimitrov
  Cc: archit, plagnioj, pali.rohar, pavel, linux-omap, linux-fbdev,
	linux-kernel, Ivaylo Dimitrov

[-- Attachment #1: Type: text/plain, Size: 821 bytes --]

On 2014-01-13 18:33, Ivaylo Dimitrov wrote:
> From: Ivaylo Dimitrov <freemangordon@abv.bg>
> 
> commit 7faa92339bbb1e6b9a80983b206642517327eb75 OMAPDSS: DISPC: Handle
> synclost errors in OMAP3 introduces limits check to prevent SYNCLOST errors
> on OMAP3. However, it misses the logic found in Nokia kernels that is
> needed to correctly calculate whether 3 tap or 5 tap rescaler to be used as
> well as the logic to fallback to 3 taps if 5 taps clock results in too
> tight horizontal timings. Without that patch "horizontal timing too tight"
> errors are seen when a video with resolution above 640x350 is tried to be
> played. The patch is a forward-ported logic found in Nokia N900 and N9/50
> kernels.
> 
> Signed-off-by: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>

Queued for 3.14.

 Tomi



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 901 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-01-14  8:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-11 12:42 [PATCH] OMAPDSS: DISPC: Fix 34xx overlay scaling calculation Ivaylo Dimitrov
2014-01-13  9:43 ` Tomi Valkeinen
2014-01-13 10:58 ` Archit Taneja
2014-01-13 16:33   ` [PATCH v2] " Ivaylo Dimitrov
2014-01-14  8:11     ` Tomi Valkeinen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).