xf86-video-intel: Branch '2.7' - 3 commits - src/i830_batchbuffer.h src/i915_video.c src/i965_video.c

Carl Worth cworth at kemper.freedesktop.org
Wed May 6 10:03:26 PDT 2009


 src/i830_batchbuffer.h |    2 +-
 src/i915_video.c       |   18 +++++++++++++++---
 src/i965_video.c       |    5 ++++-
 3 files changed, 20 insertions(+), 5 deletions(-)

New commits:
commit efda7c776b95f8634cd6a2fed88d526de80176bc
Author: Carl Worth <cworth at cworth.org>
Date:   Wed May 6 09:37:34 2009 -0700

    Split i915 textured video commands to fit into batch buffers.
    
    i915 textured video commands are quite long, but must be contained in the
    same batch buffer as the 3D setup commands. When the number of clip rects
    for the video becomes too large for the associated commands to fit in the
    same batch buffer, this change breaks the sequence into pieces, ensuring
    that each batch contains the necessary setup sequence.
    
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 8255cca2c9092f7ecb798944aa8f03fa3efcfa6c)
    
    Conflicts:
    
    	src/i915_video.c

diff --git a/src/i915_video.c b/src/i915_video.c
index 93e0c86..afa1055 100644
--- a/src/i915_video.c
+++ b/src/i915_video.c
@@ -50,7 +50,8 @@ I915DisplayVideoTextured(ScrnInfoPtr pScrn, I830PortPrivPtr pPriv, int id,
    I830Ptr pI830 = I830PTR(pScrn);
    uint32_t format, ms3, s5;
    BoxPtr pbox = REGION_RECTS(dstRegion);
-   int nbox = REGION_NUM_RECTS(dstRegion);
+   int nbox_total = REGION_NUM_RECTS(dstRegion);
+   int nbox_this_time;
    int dxo, dyo, pix_xoff, pix_yoff;
    Bool planar;
 
@@ -73,7 +74,17 @@ I915DisplayVideoTextured(ScrnInfoPtr pScrn, I830PortPrivPtr pPriv, int id,
       return;
    }
 
-   intel_batch_start_atomic(pScrn, 200 + 20 * nbox);
+#define BYTES_FOR_BOXES(n)	((200 + (n) * 20) * 4)
+#define BOXES_IN_BYTES(s)	((((s)/4) - 200) / 20)
+#define BATCH_BYTES(p)		((p)->batch_bo->size - 16)
+
+   while (nbox_total) {
+	nbox_this_time = nbox_total;
+	if (BYTES_FOR_BOXES(nbox_this_time) > BATCH_BYTES(pI830))
+		nbox_this_time = BOXES_IN_BYTES(BATCH_BYTES(pI830));
+	nbox_total -= nbox_this_time;
+
+   intel_batch_start_atomic(pScrn, 200 + 20 * nbox_this_time);
 
    IntelEmitInvarientState(pScrn);
    pI830->last_3d = LAST_3D_VIDEO;
@@ -366,7 +377,7 @@ I915DisplayVideoTextured(ScrnInfoPtr pScrn, I830PortPrivPtr pPriv, int id,
    dxo = dstRegion->extents.x1;
    dyo = dstRegion->extents.y1;
 
-   while (nbox--)
+   while (nbox_this_time--)
    {
       int box_x1 = pbox->x1;
       int box_y1 = pbox->y1;
@@ -415,6 +426,7 @@ I915DisplayVideoTextured(ScrnInfoPtr pScrn, I830PortPrivPtr pPriv, int id,
    }
 
    intel_batch_end_atomic(pScrn);
+   }
 
    i830MarkSync(pScrn);
 }
commit a066cfb0be6e6b20a27eb4ba17f503f13e65e082
Author: Carl Worth <cworth at cworth.org>
Date:   Wed May 6 09:17:46 2009 -0700

    Hold reference to video binding table until all rects are painted.
    
    The optimization of unreferencing the binding table when the relocation is
    posted causes the object to be dereferenced for each box in the clip list,
    causing general chaos in the buffer manager. It's easier to just hold a
    reference to the object until all of the boxes are painted and then drop it.
    
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 11a853bd8e5d907fe7f5bd907453bcdac9032861)
    
    Conflicts:
    
    	src/i965_video.c

diff --git a/src/i965_video.c b/src/i965_video.c
index f6020d4..c0a69fd 100644
--- a/src/i965_video.c
+++ b/src/i965_video.c
@@ -795,7 +795,6 @@ i965_emit_video_setup(ScrnInfoPtr pScrn, drm_intel_bo *bind_bo, int n_src_surf)
     OUT_BATCH(0); /* sf */
     /* Only the PS uses the binding table */
     OUT_RELOC(bind_bo, I915_GEM_DOMAIN_INSTRUCTION, 0, 0);
-    drm_intel_bo_unreference(bind_bo);
 
     /* Blend constant color (magenta is fun) */
     OUT_BATCH(BRW_3DSTATE_CONSTANT_COLOR | 3);
@@ -1161,6 +1160,10 @@ I965DisplayVideoTextured(ScrnInfoPtr pScrn, I830PortPrivPtr pPriv, int id,
     }
 
     i830MarkSync(pScrn);
+
+    /* release reference once we're finished */
+    drm_intel_bo_unreference(bind_bo);
+
 #if WATCH_STATS
     i830_dump_error_state(pScrn);
 #endif
commit 115fc9a7d79da07301b96d9fc5c513d33734d273
Author: Keith Packard <keithp at keithp.com>
Date:   Fri May 1 11:44:13 2009 -0700

    intel_batch_start_atomic: fix size passed to intel_batch_require_space (*4)
    
    intel_batch_start_atomic takes an argument in 32-bit units, and so it must
    multiply that by 4 before passing it to intel_batch_require_space, which
    takes an argument in bytes.
    
    We should figure out what units we want to use and use the same everywhere...
    
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 1142353b487c155a31011923fbd08ec67e60f505)

diff --git a/src/i830_batchbuffer.h b/src/i830_batchbuffer.h
index a72786e..ec87084 100644
--- a/src/i830_batchbuffer.h
+++ b/src/i830_batchbuffer.h
@@ -56,7 +56,7 @@ intel_batch_start_atomic(ScrnInfoPtr pScrn, unsigned int sz)
     I830Ptr pI830 = I830PTR(pScrn);
 
     assert(!pI830->in_batch_atomic);
-    intel_batch_require_space(pScrn, pI830, sz);
+    intel_batch_require_space(pScrn, pI830, sz * 4);
 
     pI830->in_batch_atomic = TRUE;
     pI830->batch_atomic_limit = pI830->batch_used + sz * 4;


More information about the xorg-commit mailing list