[Intel-gfx] [PATCH 4/7] Xv: move users of x1, x2, y1, y2 to PutImage

Daniel Vetter daniel.vetter at ffwll.ch
Tue Dec 1 14:32:31 CET 2009


After this there are no other external users of these strange variables,
so we can nicely hide them somewhere in the next changeset.

Signed-off-by: Daniel Vetter <daniel.vetter at ffwll.ch>
---
 src/i830_video.c |   36 ++++++++++++++++++++++++------------
 1 files changed, 24 insertions(+), 12 deletions(-)

diff --git a/src/i830_video.c b/src/i830_video.c
index bab8687..1f47ccf 100644
--- a/src/i830_video.c
+++ b/src/i830_video.c
@@ -1439,12 +1439,11 @@ i830_dst_pitch_and_size(ScrnInfoPtr scrn, intel_adaptor_private *adaptor_priv, s
 static Bool
 i830_copy_video_data(ScrnInfoPtr scrn, intel_adaptor_private *adaptor_priv,
 		     short width, short height, int *dstPitch, int *dstPitch2,
-		     INT32 x1, INT32 y1, INT32 x2, INT32 y2,
+		     int top, int left, int npixels, int nlines,
 		     int id, unsigned char *buf)
 {
-	intel_screen_private *intel = intel_get_screen_private(scrn);
 	int srcPitch = 0, srcPitch2 = 0;
-	int top, left, npixels, nlines, size;
+	int size;
 
 	if (is_planar_fourcc(id)) {
 		srcPitch = (width + 0x3) & ~0x3;
@@ -1486,20 +1485,13 @@ i830_copy_video_data(ScrnInfoPtr scrn, intel_adaptor_private *adaptor_priv,
 #endif
 
 	/* copy data */
-	top = y1 >> 16;
-	left = (x1 >> 16) & ~1;
-	npixels = ((((x2 + 0xffff) >> 16) + 1) & ~1) - left;
-
 	if (is_planar_fourcc(id)) {
 		if (!xvmc_passthrough(id)) {
-			top &= ~1;
-			nlines = ((((y2 + 0xffff) >> 16) + 1) & ~1) - top;
 			I830CopyPlanarData(adaptor_priv, buf, srcPitch, srcPitch2,
 					   *dstPitch, height, top, left, nlines,
 					   npixels, id);
 		}
 	} else {
-		nlines = ((y2 + 0xffff) >> 16) - top;
 		I830CopyPackedData(adaptor_priv, buf, srcPitch, *dstPitch, top, left,
 				   nlines, npixels);
 	}
@@ -1539,6 +1531,7 @@ I830PutImageTextured(ScrnInfoPtr scrn,
 	int dstPitch2 = 0;
 	BoxRec dstBox;
 	xf86CrtcPtr crtc;
+	int top, left, npixels, nlines;
 
 #if 0
 	ErrorF("I830PutImage: src: (%d,%d)(%d,%d), dst: (%d,%d)(%d,%d)\n"
@@ -1564,9 +1557,18 @@ I830PutImageTextured(ScrnInfoPtr scrn,
 				    width, height))
 		return Success;
 
+	top = y1 >> 16;
+	left = (x1 >> 16) & ~1;
+	npixels = ((((x2 + 0xffff) >> 16) + 1) & ~1) - left;
+	if (is_planar_fourcc(id)) {
+		top &= ~1;
+		nlines = ((((y2 + 0xffff) >> 16) + 1) & ~1) - top;
+	} else
+		nlines = ((y2 + 0xffff) >> 16) - top;
+
 	if (!i830_copy_video_data(scrn, adaptor_priv, width, height,
 				  &dstPitch, &dstPitch2,
-				  x1, y1, x2, y2, id, buf))
+				  top, left, npixels, nlines, id, buf))
 		return BadAlloc;
 
 	if (crtc && adaptor_priv->SyncToVblank != 0) {
@@ -1609,6 +1611,7 @@ I830PutImageOverlay(ScrnInfoPtr scrn,
 	int dstPitch2 = 0;
 	BoxRec dstBox;
 	xf86CrtcPtr crtc;
+	int top, left, npixels, nlines;
 
 #if 0
 	ErrorF("I830PutImage: src: (%d,%d)(%d,%d), dst: (%d,%d)(%d,%d)\n"
@@ -1652,9 +1655,18 @@ I830PutImageOverlay(ScrnInfoPtr scrn,
 		return Success;
 	}
 
+	top = y1 >> 16;
+	left = (x1 >> 16) & ~1;
+	npixels = ((((x2 + 0xffff) >> 16) + 1) & ~1) - left;
+	if (is_planar_fourcc(id)) {
+		top &= ~1;
+		nlines = ((((y2 + 0xffff) >> 16) + 1) & ~1) - top;
+	} else
+		nlines = ((y2 + 0xffff) >> 16) - top;
+
 	if (!i830_copy_video_data(scrn, adaptor_priv, width, height,
 				  &dstPitch, &dstPitch2,
-				  x1, y1, x2, y2, id, buf))
+				  top, left, npixels, nlines, id, buf))
 		return BadAlloc;
 
 	if (!i830_display_overlay
-- 
1.6.5.3




More information about the Intel-gfx mailing list