summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2009-01-19 14:43:20 -0800
committerEric Anholt <eric@anholt.net>2009-01-20 10:50:19 -0800
commit946c7ef8170e74ac178c83b1465242d57fa86f2e (patch)
treeaf6f7fcacd9ffc1b6c9c5f19317be1cf3d9206d7
parent7be668179a12918918cad863f6936ced4ab78dbf (diff)
Do check_aperture_space and batch_start_atomic for i965 video.
This increases the overhead for video in the presence of cliprects, but we were already doing nasty things in that case and don't seem to care. This could fix potential bad rendering or hangs with video, particularly with DRI2.
-rw-r--r--src/i965_video.c29
1 files changed, 27 insertions, 2 deletions
diff --git a/src/i965_video.c b/src/i965_video.c
index 3c626ca4..cd726a28 100644
--- a/src/i965_video.c
+++ b/src/i965_video.c
@@ -1057,8 +1057,6 @@ I965DisplayVideoTextured(ScrnInfoPtr pScrn, I830PortPrivPtr pPriv, int id,
}
}
- i965_emit_video_setup(pScrn, bind_bo, n_src_surf);
-
/* Set up the offset for translating from the given region (in screen
* coordinates) to the backing pixmap.
*/
@@ -1087,12 +1085,25 @@ I965DisplayVideoTextured(ScrnInfoPtr pScrn, I830PortPrivPtr pPriv, int id,
int i;
drm_intel_bo *vb_bo;
float *vb;
+ drm_intel_bo *bo_table[] = {
+ NULL, /* vb_bo */
+ pI830->batch_bo,
+ bind_bo,
+ pI830->video.gen4_sampler_bo,
+ pI830->video.gen4_sip_kernel_bo,
+ pI830->video.gen4_vs_bo,
+ pI830->video.gen4_sf_bo,
+ pI830->video.gen4_wm_packed_bo,
+ pI830->video.gen4_wm_planar_bo,
+ pI830->video.gen4_cc_bo,
+ };
pbox++;
if (intel_alloc_and_map(pI830, "textured video vb", 4096,
&vb_bo, &vb) != 0)
break;
+ bo_table[0] = vb_bo;
i = 0;
vb[i++] = (box_x2 - dxo) * src_scale_x;
@@ -1114,6 +1125,18 @@ I965DisplayVideoTextured(ScrnInfoPtr pScrn, I830PortPrivPtr pPriv, int id,
i965_pre_draw_debug(pScrn);
+ /* If this command won't fit in the current batch, flush.
+ * Assume that it does after being flushed.
+ */
+ if (drm_intel_bufmgr_check_aperture_space(bo_table,
+ ARRAY_SIZE(bo_table)) < 0) {
+ intel_batch_flush(pScrn, FALSE);
+ }
+
+ intel_batch_start_atomic(pScrn, 100);
+
+ i965_emit_video_setup(pScrn, bind_bo, n_src_surf);
+
BEGIN_BATCH(10);
/* Set up the pointer to our vertex buffer */
OUT_BATCH(BRW_3DSTATE_VERTEX_BUFFERS | 2);
@@ -1136,6 +1159,8 @@ I965DisplayVideoTextured(ScrnInfoPtr pScrn, I830PortPrivPtr pPriv, int id,
OUT_BATCH(0); /* index buffer offset, ignored */
ADVANCE_BATCH();
+ intel_batch_end_atomic(pScrn);
+
drm_intel_bo_unreference(vb_bo);
i965_post_draw_debug(pScrn);