RE: DSS2 Video Overlay Scaling Patch

Fischer Steven-P27614
2009-07-07T13:08:58Z

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

Ugh, messed up morning, forgot the patch as well :(

-----Original Message-----
From: linux-omap-owner@vger.kernel.org
[mailto:linux-omap-owner@vger.kernel.org] On Behalf Of Fischer
Steven-P27614
Sent: Tuesday, July 07, 2009 8:05 AM
To: linux-omap@vger.kernel.org
Subject: RE: DSS2 Video Overlay Scaling Patch

Sorry, missed the subject line.

-----Original Message-----
From: linux-omap-owner@vger.kernel.org
[mailto:linux-omap-owner@vger.kernel.org] On Behalf Of Fischer
Steven-P27614
Sent: Tuesday, July 07, 2009 7:54 AM
To: linux-omap@vger.kernel.org
Subject:

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.
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org More majordomo info
at http://vger.kernel.org/majordomo-info.html

[-- 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