[Intel-gfx] [PATCH 17/22] Xv: create xvmc_passthrough helper

Daniel Vetter daniel.vetter at ffwll.ch
Thu Jul 2 14:15:50 CEST 2009


This way all thes strange special cases make much more sense.

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

diff --git a/src/i830_video.c b/src/i830_video.c
index ac5c0ca..6675387 100644
--- a/src/i830_video.c
+++ b/src/i830_video.c
@@ -1963,6 +1963,16 @@ is_planar_fourcc(int id)
     }
 }
 
+static int
+xvmc_passthrough(int id, Rotation rotation)
+{
+#ifdef INTEL_XVMC
+    return id == FOURCC_XVMC && rotation == RR_Rotate_0;
+#else
+    return 0;
+#endif
+}
+
 static void
 i830_display_overlay(ScrnInfoPtr pScrn, xf86CrtcPtr crtc,
 		   int id, short width, short height,
@@ -2205,16 +2215,13 @@ i830_setup_video_buffer(ScrnInfoPtr pScrn, I830PortPrivPtr pPriv,
 	pPriv->buf = NULL;
     }
 
-#ifdef INTEL_XVMC
-    if (id == FOURCC_XVMC && 
-        pPriv->rotation == RR_Rotate_0) {
+    if (xvmc_passthrough(id, pPriv->rotation)) {
         if (pPriv->buf) {
             assert(pPriv->textured);
             drm_intel_bo_unreference(pPriv->buf);
             pPriv->buf = NULL;
         }
     } else {
-#endif
         if (pPriv->buf == NULL) {
             pPriv->buf = drm_intel_bo_alloc(pI830->bufmgr,
                                          "xv buffer", alloc_size, 4096);
@@ -2228,9 +2235,8 @@ i830_setup_video_buffer(ScrnInfoPtr pScrn, I830PortPrivPtr pPriv,
                 return FALSE;
             }
         }
-#ifdef INTEL_XVMC
     }
-#endif
+
     return TRUE;
 }
 
@@ -2368,8 +2374,7 @@ i830_copy_video_data(ScrnInfoPtr pScrn, I830PortPrivPtr pPriv,
     npixels = ((((x2 + 0xffff) >> 16) + 1) & ~1) - left;
 
     if (is_planar_fourcc(id)) {
-	if (id != FOURCC_XVMC
-		|| pPriv->rotation != RR_Rotate_0) {
+	if (!xvmc_passthrough(id, pPriv->rotation)) {
 	    top &= ~1;
 	    nlines = ((((y2 + 0xffff) >> 16) + 1) & ~1) - top;
 	    I830CopyPlanarData(pScrn, pPriv, buf, srcPitch, srcPitch2, *dstPitch,
@@ -2485,13 +2490,11 @@ I830PutImage(ScrnInfoPtr pScrn,
         }
 
         if (IS_I965G(pI830)) {
-#ifdef INTEL_XVMC
-            if (id == FOURCC_XVMC && pPriv->rotation == RR_Rotate_0) {
+            if (xvmc_passthrough(id, pPriv->rotation)) {
                 pPriv->YBufOffset = buf -  pI830->FbBase;
                 pPriv->UBufOffset = pPriv->YBufOffset + height*width; 
                 pPriv->VBufOffset = pPriv->UBufOffset + height*width/4; 
             }
-#endif
             I965DisplayVideoTextured(pScrn, pPriv, id, clipBoxes, width, height,
                                      dstPitch, x1, y1, x2, y2,
                                      src_w, src_h, drw_w, drw_h, pPixmap);
-- 
1.6.3.3




More information about the Intel-gfx mailing list