summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Worth <cworth@cworth.org>2009-05-06 09:37:34 -0700
committerCarl Worth <cworth@cworth.org>2009-05-06 09:37:34 -0700
commitefda7c776b95f8634cd6a2fed88d526de80176bc (patch)
tree9d5fe2be702998885f6da1a6f3ef653b88929728
parenta066cfb0be6e6b20a27eb4ba17f503f13e65e082 (diff)
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@keithp.com> (cherry picked from commit 8255cca2c9092f7ecb798944aa8f03fa3efcfa6c) Conflicts: src/i915_video.c
-rw-r--r--src/i915_video.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/i915_video.c b/src/i915_video.c
index 93e0c86a..afa10551 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);
}