summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2008-06-06 14:03:25 -0700
committerEric Anholt <eric@anholt.net>2008-06-10 11:37:03 -0700
commitbade7d7d2505a10a8a7d24b084aff9742e2d6d64 (patch)
treefe9bc74dda9320aa400fa5e4bbbc8a9cf8429075 /src
parent6e94affcc2240e668bcf1aa41f3c8b19929d144b (diff)
Use the DRM for submitting batchbuffers when available.
There are some concerns with this, as the DRM will be setting the nonsecure flag on the batchbuffer, and the server may be submitting some secure-only commands. It appears to work on the 915GM test system currently.
Diffstat (limited to 'src')
-rw-r--r--src/i830_batchbuffer.c39
1 files changed, 28 insertions, 11 deletions
diff --git a/src/i830_batchbuffer.c b/src/i830_batchbuffer.c
index 82758a2d..976a405c 100644
--- a/src/i830_batchbuffer.c
+++ b/src/i830_batchbuffer.c
@@ -100,18 +100,35 @@ intel_batch_flush(ScrnInfoPtr pScrn)
dri_process_relocs(pI830->batch_bo);
- if (!IS_I830(pI830) && !IS_845G(pI830)) {
- BEGIN_LP_RING(2);
- OUT_RING(MI_BATCH_BUFFER_START | (2 << 6));
- OUT_RING(pI830->batch_bo->offset);
- ADVANCE_LP_RING();
+ if (pI830->directRenderingEnabled) {
+ struct drm_i915_batchbuffer batch;
+ int ret;
+
+ batch.start = pI830->batch_bo->offset;
+ batch.used = pI830->batch_used;
+ batch.cliprects = NULL;
+ batch.num_cliprects = 0;
+ batch.DR1 = 0;
+ batch.DR4 = 0xffffffff;
+
+ ret = drmCommandWrite(pI830->drmSubFD, DRM_I915_BATCHBUFFER,
+ &batch, sizeof(batch));
+ if (ret != 0)
+ FatalError("Failed to submit batchbuffer: %s\n", strerror(errno));
} else {
- BEGIN_LP_RING(4);
- OUT_RING(MI_BATCH_BUFFER);
- OUT_RING(pI830->batch_bo->offset);
- OUT_RING(pI830->batch_bo->offset + pI830->batch_used - 4);
- OUT_RING(MI_NOOP);
- ADVANCE_LP_RING();
+ if (!IS_I830(pI830) && !IS_845G(pI830)) {
+ BEGIN_LP_RING(2);
+ OUT_RING(MI_BATCH_BUFFER_START | (2 << 6));
+ OUT_RING(pI830->batch_bo->offset);
+ ADVANCE_LP_RING();
+ } else {
+ BEGIN_LP_RING(4);
+ OUT_RING(MI_BATCH_BUFFER);
+ OUT_RING(pI830->batch_bo->offset);
+ OUT_RING(pI830->batch_bo->offset + pI830->batch_used - 4);
+ OUT_RING(MI_NOOP);
+ ADVANCE_LP_RING();
+ }
}
dri_post_submit(pI830->batch_bo);