public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
* (unknown), 
@ 2009-07-07 12:53 Fischer Steven-P27614
  2009-07-07 13:04 ` DSS2 Video Overlay Scaling Patch Fischer Steven-P27614
  0 siblings, 1 reply; 8+ messages in thread
From: Fischer Steven-P27614 @ 2009-07-07 12:53 UTC (permalink / raw)
  To: linux-omap

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

All,
 
The DSS2 code base seems to inadvertently prevent downscaling of video
overlay frames.  Attached is my attempt at a patch to resolve this
issue.
 
As I gather from the code, there is an attempt to limit the overlay
output frame size (x, y, outw, outh) to the managers updated window
(mc->x, mc->y, mc->w, mc->h).  The problem is that the input frame size
(w & h) is being used to instead of the output frame size (outw, outh).
Due to this, when the input frame size is large than the output frame
size, the input frame is being cropped, thus no downscaling occurs.  My
patch corrects this issue and also attempts to properly scale the input
frame size if indeed the output frame is cropped.
 
In my particular case, the output frame size is never cropped, so I have
not explicitly tested these equations, but I believe they are
mathematically correct.
 
With this patch overlay downscaling is functional.
 
Steve.

[-- Attachment #2: 0001-Proper-Scaling-Fix.patch --]
[-- Type: application/octet-stream, Size: 1321 bytes --]

From 4319270881e8e9a0915aec140c1d8b5f6c27c876 Mon Sep 17 00:00:00 2001
From: Steve Fischer <steven.fischer@motorola.com>
Date: Thu, 2 Jul 2009 09:29:12 -0500
Subject: [PATCH] Proper Scaling Fix

---
 drivers/video/omap2/dss/manager.c |   24 ++++++++++++++++++------
 1 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/drivers/video/omap2/dss/manager.c b/drivers/video/omap2/dss/manager.c
index 0be370e..3ed9f3f 100644
--- a/drivers/video/omap2/dss/manager.c
+++ b/drivers/video/omap2/dss/manager.c
@@ -701,6 +701,8 @@ static int configure_overlay(enum omap_plane plane)
 	struct manager_cache_data *mc;
 	u16 outw, outh;
 	u16 x, y, w, h;
+	u32 dw = 0;
+	u32 dh = 0;
 	u32 paddr;
 	int r;
 
@@ -772,15 +774,25 @@ static int configure_overlay(enum omap_plane plane)
 			y = c->pos_y - mc->y;
 		}
 
-		if (mc->w < (x+w))
-			w = (x+w) - (mc->w);
+		if (mc->w < (x+outw)) {
+			dw = (x+outw) - (mc->w);
+			outw -= dw;
+		}
 
-		if (mc->h < (y+h))
-			h = (y+h) - (mc->h);
+		if (mc->h < (y+outh)) {
+			dh = (y+outh) - (mc->h);
+			outh -= dh;
+		}
 
 		if (!dispc_is_overlay_scaled(c)) {
-			outw = w;
-			outh = h;
+			w = outw;
+			h = outh;
+		} else {
+			if (dw)
+				w -= (u16) ((((dw << 16) / w) * outw) >> 16);
+
+			if (dh)
+				h -= (u16) ((((dh << 16) / h) * outh) >> 16);
 		}
 	}
 
-- 
1.5.4.3


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

end of thread, other threads:[~2009-08-06 14:24 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-07 12:53 (unknown), Fischer Steven-P27614
2009-07-07 13:04 ` DSS2 Video Overlay Scaling Patch Fischer Steven-P27614
2009-07-07 13:08   ` Fischer Steven-P27614
2009-08-04 11:06     ` Tomi Valkeinen
2009-08-04 22:22       ` Fischer Steven-P27614
2009-08-05 19:09       ` Fischer Steven-P27614
2009-08-06 13:38         ` Tomi Valkeinen
2009-08-06 14:23           ` Fischer Steven-P27614

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