public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
* Patch to enable omapfb scaling
@ 2008-10-31 10:44 Tuomas Kulve
  2008-11-03 15:03 ` Tuomas Kulve
  0 siblings, 1 reply; 3+ messages in thread
From: Tuomas Kulve @ 2008-10-31 10:44 UTC (permalink / raw)
  To: linux-omap


[-- Attachment #1.1: Type: text/plain, Size: 411 bytes --]


Hi

The attached patch enables omapfb scaling. Tested on omap3 based
beagleboard with 2.6.27-omap1 kernel from linux-omap kernel tree.

The "if" is a leftover from this commit in linux-omap tree:
4139f42ea612e0ff53a4df41428040f777d0422c


Thanks,
-- 
Tuomas Kulve, Movial Creative Technologies Inc.
Porkkalankatu 13J, FI-00180 Helsinki
Fax +358 9 8567 6401, Tel +358 9 8567 6400
www.movial.com

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-Removed-old-contradictory-leftover-if-that-prevent.patch --]
[-- Type: text/x-patch; name*0="0001-Removed-old-contradictory-leftover-if-that-prevent.patch", Size: 812 bytes --]

From 886ddb31a1192fc324f1bc092766c918c5fd22fb Mon Sep 17 00:00:00 2001
From: Tuomas Kulve <tuomas.kulve@movial.com>
Date: Wed, 29 Oct 2008 10:54:06 +0200
Subject: [PATCH] Removed old contradictory leftover 'if' that prevents video scaling.

---
 drivers/video/omap/dispc.c |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/drivers/video/omap/dispc.c b/drivers/video/omap/dispc.c
index 1e6e035..68bc887 100644
--- a/drivers/video/omap/dispc.c
+++ b/drivers/video/omap/dispc.c
@@ -583,9 +583,6 @@ static int omap_dispc_set_scale(int plane,
 	if ((unsigned)plane > OMAPFB_PLANE_NUM)
 		return -ENODEV;
 
-	if (out_width != orig_width || out_height != orig_height)
-		return -EINVAL;
-
 	enable_lcd_clocks(1);
 	if (orig_width < out_width) {
 		/*
-- 
1.5.6.5




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

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

* Re: Patch to enable omapfb scaling
  2008-10-31 10:44 Patch to enable omapfb scaling Tuomas Kulve
@ 2008-11-03 15:03 ` Tuomas Kulve
  2008-11-26 17:29   ` Tony Lindgren
  0 siblings, 1 reply; 3+ messages in thread
From: Tuomas Kulve @ 2008-11-03 15:03 UTC (permalink / raw)
  To: linux-omap


[-- Attachment #1.1: Type: text/plain, Size: 609 bytes --]

Tuomas Kulve wrote:
> Hi
> 
> The attached patch enables omapfb scaling. Tested on omap3 based
> beagleboard with 2.6.27-omap1 kernel from linux-omap kernel tree.

The 0002 patch implements downscaling in omapfb. It seems to work on
ES3.0 beagleboard and ES2.1 EVM but not on my rev B5 beagleboard.

The patch still needs cleanup but it should work with e.g. X.Org's XV
extension:

http://gitweb.pingu.fi/?p=xf86-video-omapfb.git;a=summary


-- 
Tuomas Kulve, Movial Creative Technologies Inc.
Porkkalankatu 13J, FI-00180 Helsinki
Fax +358 9 8567 6401, Tel +358 9 8567 6400
www.movial.com

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0002-Implemented-video-downsampling-in-omapfb.patch --]
[-- Type: text/x-patch; name="0002-Implemented-video-downsampling-in-omapfb.patch", Size: 2881 bytes --]

From 069ce763b1a7e936b7b2bdc288d94dd98e477d7e Mon Sep 17 00:00:00 2001
From: Tuomas Kulve <tuomas.kulve@movial.com>
Date: Mon, 3 Nov 2008 11:22:56 +0200
Subject: [PATCH] Implemented video downsampling in omapfb.

---
 drivers/video/omap/dispc.c |   58 ++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 53 insertions(+), 5 deletions(-)

diff --git a/drivers/video/omap/dispc.c b/drivers/video/omap/dispc.c
index 68bc887..83f37bf 100644
--- a/drivers/video/omap/dispc.c
+++ b/drivers/video/omap/dispc.c
@@ -545,6 +545,17 @@ static void write_firhv_reg(int plane, int reg, u32 value)
 	dispc_write_reg(base + reg * 8,	value);
 }
 
+static void write_firv_reg(int plane, int reg, u32 value)
+{
+	u32 base;
+
+	if (plane == 1)
+		base = 0x1E0;
+	else
+		base = 0x1E0 + 0x20;
+	dispc_write_reg(base + reg * 4,	value);
+}
+
 static void set_upsampling_coef_table(int plane)
 {
 	const u32 coef[][2] = {
@@ -565,6 +576,27 @@ static void set_upsampling_coef_table(int plane)
 	}
 }
 
+static void set_downsampling_coef_table(int plane)
+{
+	const u32 coef[][3] = {
+		{ 0x24382400, 0x24382400, 0x00000000 },
+		{ 0x28371FFE, 0x28391F04, 0x000004FE },
+		{ 0x2C361BFB, 0x2D381B08, 0x000008FB },
+		{ 0x303516F9, 0x3237170C, 0x00000CF9 },
+		{ 0x11343311, 0x123737F7, 0x0000F711 },
+		{ 0x1635300C, 0x173732F9, 0x0000F90C },
+		{ 0x1B362C08, 0x1B382DFB, 0x0000FB08 },
+		{ 0x1F372804, 0x1F3928FE, 0x0000FE04 },
+	};
+	int i;
+
+	for (i = 0; i < 8; i++) {
+		write_firh_reg(plane, i, coef[i][0]);
+		write_firhv_reg(plane, i, coef[i][1]);
+		write_firv_reg(plane, i, coef[i][2]);
+	}
+}
+
 static int omap_dispc_set_scale(int plane,
 				int orig_width, int orig_height,
 				int out_width, int out_height)
@@ -592,16 +624,32 @@ static int omap_dispc_set_scale(int plane,
 		if (orig_height > out_height ||
 		    orig_width * 8 < out_width ||
 		    orig_height * 8 < out_height) {
+			dev_dbg(dispc.fbdev->dev,
+				"Max upsampling is 8x, "
+				"tried: %dx%d -> %dx%d\n",
+				orig_width, orig_height,
+				out_width, out_height);
 			enable_lcd_clocks(0);
 			return -EINVAL;
 		}
 		set_upsampling_coef_table(plane);
 	} else if (orig_width > out_width) {
-		/* Downsampling not yet supported
-		*/
-
-		enable_lcd_clocks(0);
-		return -EINVAL;
+		/*
+		 * Downsampling.
+		 * Currently you can only scale both dimensions in one way.
+		 */
+		if (orig_height < out_height ||
+		    orig_width > out_width * 4 ||
+		    orig_height > out_height * 4) {
+			dev_dbg(dispc.fbdev->dev,
+				"Max downsampling is 4x, "
+				"tried: %dx%d -> %dx%d\n",
+				orig_width, orig_height,
+				out_width, out_height);
+			enable_lcd_clocks(0);
+			return -EINVAL;
+		}
+		set_downsampling_coef_table(plane);
 	}
 	if (!orig_width || orig_width == out_width)
 		fir_hinc = 0;
-- 
1.5.6.5


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.3: 0003-Calculate-fir_-inc-using-resolution-minus-one-in-oma.patch --]
[-- Type: text/x-patch; name*0="0003-Calculate-fir_-inc-using-resolution-minus-one-in-oma.patch", Size: 1030 bytes --]

From fd41a240a99de4c1408097bb39fa89cec4b7868d Mon Sep 17 00:00:00 2001
From: Tuomas Kulve <tuomas.kulve@movial.com>
Date: Fri, 31 Oct 2008 20:05:26 +0200
Subject: [PATCH] Calculate fir_*inc using resolution minus one in omapfb scaling.

---
 drivers/video/omap/dispc.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/video/omap/dispc.c b/drivers/video/omap/dispc.c
index 83f37bf..7ac4a86 100644
--- a/drivers/video/omap/dispc.c
+++ b/drivers/video/omap/dispc.c
@@ -654,11 +654,11 @@ static int omap_dispc_set_scale(int plane,
 	if (!orig_width || orig_width == out_width)
 		fir_hinc = 0;
 	else
-		fir_hinc = 1024 * orig_width / out_width;
+		fir_hinc = 1024 * (orig_width - 1) / (out_width - 1);
 	if (!orig_height || orig_height == out_height)
 		fir_vinc = 0;
 	else
-		fir_vinc = 1024 * orig_height / out_height;
+		fir_vinc = 1024 * (orig_height - 1) / (out_height - 1);
 	dispc.fir_hinc[plane] = fir_hinc;
 	dispc.fir_vinc[plane] = fir_vinc;
 
-- 
1.5.6.5


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

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

* Re: Patch to enable omapfb scaling
  2008-11-03 15:03 ` Tuomas Kulve
@ 2008-11-26 17:29   ` Tony Lindgren
  0 siblings, 0 replies; 3+ messages in thread
From: Tony Lindgren @ 2008-11-26 17:29 UTC (permalink / raw)
  To: Tuomas Kulve; +Cc: linux-omap

* Tuomas Kulve <tuomas.kulve@movial.fi> [081103 07:04]:
> Tuomas Kulve wrote:
> > Hi
> > 
> > The attached patch enables omapfb scaling. Tested on omap3 based
> > beagleboard with 2.6.27-omap1 kernel from linux-omap kernel tree.
> 
> The 0002 patch implements downscaling in omapfb. It seems to work on
> ES3.0 beagleboard and ES2.1 EVM but not on my rev B5 beagleboard.
> 
> The patch still needs cleanup but it should work with e.g. X.Org's XV
> extension:
> 
> http://gitweb.pingu.fi/?p=xf86-video-omapfb.git;a=summary

All, I'm not going to push any more omap video patches, those need to
be discussed on fbdev mailing list. So please send the patches against
the mainline kernel there and cc linux-omap mailing list.

Regards,

Tony


> 
> 
> -- 
> Tuomas Kulve, Movial Creative Technologies Inc.
> Porkkalankatu 13J, FI-00180 Helsinki
> Fax +358 9 8567 6401, Tel +358 9 8567 6400
> www.movial.com

> From 069ce763b1a7e936b7b2bdc288d94dd98e477d7e Mon Sep 17 00:00:00 2001
> From: Tuomas Kulve <tuomas.kulve@movial.com>
> Date: Mon, 3 Nov 2008 11:22:56 +0200
> Subject: [PATCH] Implemented video downsampling in omapfb.
> 
> ---
>  drivers/video/omap/dispc.c |   58 ++++++++++++++++++++++++++++++++++++++++----
>  1 files changed, 53 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/video/omap/dispc.c b/drivers/video/omap/dispc.c
> index 68bc887..83f37bf 100644
> --- a/drivers/video/omap/dispc.c
> +++ b/drivers/video/omap/dispc.c
> @@ -545,6 +545,17 @@ static void write_firhv_reg(int plane, int reg, u32 value)
>  	dispc_write_reg(base + reg * 8,	value);
>  }
>  
> +static void write_firv_reg(int plane, int reg, u32 value)
> +{
> +	u32 base;
> +
> +	if (plane == 1)
> +		base = 0x1E0;
> +	else
> +		base = 0x1E0 + 0x20;
> +	dispc_write_reg(base + reg * 4,	value);
> +}
> +
>  static void set_upsampling_coef_table(int plane)
>  {
>  	const u32 coef[][2] = {
> @@ -565,6 +576,27 @@ static void set_upsampling_coef_table(int plane)
>  	}
>  }
>  
> +static void set_downsampling_coef_table(int plane)
> +{
> +	const u32 coef[][3] = {
> +		{ 0x24382400, 0x24382400, 0x00000000 },
> +		{ 0x28371FFE, 0x28391F04, 0x000004FE },
> +		{ 0x2C361BFB, 0x2D381B08, 0x000008FB },
> +		{ 0x303516F9, 0x3237170C, 0x00000CF9 },
> +		{ 0x11343311, 0x123737F7, 0x0000F711 },
> +		{ 0x1635300C, 0x173732F9, 0x0000F90C },
> +		{ 0x1B362C08, 0x1B382DFB, 0x0000FB08 },
> +		{ 0x1F372804, 0x1F3928FE, 0x0000FE04 },
> +	};
> +	int i;
> +
> +	for (i = 0; i < 8; i++) {
> +		write_firh_reg(plane, i, coef[i][0]);
> +		write_firhv_reg(plane, i, coef[i][1]);
> +		write_firv_reg(plane, i, coef[i][2]);
> +	}
> +}
> +
>  static int omap_dispc_set_scale(int plane,
>  				int orig_width, int orig_height,
>  				int out_width, int out_height)
> @@ -592,16 +624,32 @@ static int omap_dispc_set_scale(int plane,
>  		if (orig_height > out_height ||
>  		    orig_width * 8 < out_width ||
>  		    orig_height * 8 < out_height) {
> +			dev_dbg(dispc.fbdev->dev,
> +				"Max upsampling is 8x, "
> +				"tried: %dx%d -> %dx%d\n",
> +				orig_width, orig_height,
> +				out_width, out_height);
>  			enable_lcd_clocks(0);
>  			return -EINVAL;
>  		}
>  		set_upsampling_coef_table(plane);
>  	} else if (orig_width > out_width) {
> -		/* Downsampling not yet supported
> -		*/
> -
> -		enable_lcd_clocks(0);
> -		return -EINVAL;
> +		/*
> +		 * Downsampling.
> +		 * Currently you can only scale both dimensions in one way.
> +		 */
> +		if (orig_height < out_height ||
> +		    orig_width > out_width * 4 ||
> +		    orig_height > out_height * 4) {
> +			dev_dbg(dispc.fbdev->dev,
> +				"Max downsampling is 4x, "
> +				"tried: %dx%d -> %dx%d\n",
> +				orig_width, orig_height,
> +				out_width, out_height);
> +			enable_lcd_clocks(0);
> +			return -EINVAL;
> +		}
> +		set_downsampling_coef_table(plane);
>  	}
>  	if (!orig_width || orig_width == out_width)
>  		fir_hinc = 0;
> -- 
> 1.5.6.5
> 

> From fd41a240a99de4c1408097bb39fa89cec4b7868d Mon Sep 17 00:00:00 2001
> From: Tuomas Kulve <tuomas.kulve@movial.com>
> Date: Fri, 31 Oct 2008 20:05:26 +0200
> Subject: [PATCH] Calculate fir_*inc using resolution minus one in omapfb scaling.
> 
> ---
>  drivers/video/omap/dispc.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/video/omap/dispc.c b/drivers/video/omap/dispc.c
> index 83f37bf..7ac4a86 100644
> --- a/drivers/video/omap/dispc.c
> +++ b/drivers/video/omap/dispc.c
> @@ -654,11 +654,11 @@ static int omap_dispc_set_scale(int plane,
>  	if (!orig_width || orig_width == out_width)
>  		fir_hinc = 0;
>  	else
> -		fir_hinc = 1024 * orig_width / out_width;
> +		fir_hinc = 1024 * (orig_width - 1) / (out_width - 1);
>  	if (!orig_height || orig_height == out_height)
>  		fir_vinc = 0;
>  	else
> -		fir_vinc = 1024 * orig_height / out_height;
> +		fir_vinc = 1024 * (orig_height - 1) / (out_height - 1);
>  	dispc.fir_hinc[plane] = fir_hinc;
>  	dispc.fir_vinc[plane] = fir_vinc;
>  
> -- 
> 1.5.6.5
> 




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

end of thread, other threads:[~2008-11-26 17:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-31 10:44 Patch to enable omapfb scaling Tuomas Kulve
2008-11-03 15:03 ` Tuomas Kulve
2008-11-26 17:29   ` Tony Lindgren

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox