[Intel-gfx] [PATCH] Do check_aperture_space and batch_start_atomic for i965 video.
Eric Anholt
eric at anholt.net
Tue Jan 20 06:12:09 CET 2009
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.
---
src/i965_video.c | 29 +++++++++++++++++++++++++++--
1 files changed, 27 insertions(+), 2 deletions(-)
diff --git a/src/i965_video.c b/src/i965_video.c
index 3c626ca..cd726a2 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);
--
1.5.6.5
More information about the Intel-gfx
mailing list