summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/i915/intel_ioctl.c
diff options
context:
space:
mode:
authorJouk <joukj@tarantella.nano.tudelft.nl>2007-10-31 08:18:58 +0100
committerJouk <joukj@tarantella.nano.tudelft.nl>2007-10-31 08:18:58 +0100
commitd1414da8f9dbf3c27cf05509be51e8c70ed1185d (patch)
treeb6b3fdccea77d6173c1a829e0d2710d5b973dd5a /src/mesa/drivers/dri/i915/intel_ioctl.c
parentb263435a98173645fa3f4a5dce4566e53470f38f (diff)
parentd2f19a554a9089fddb5e978e3a732bbf71d77f93 (diff)
Merge branch 'master' of git+ssh://joukj@git.freedesktop.org/git/mesa/mesa
Diffstat (limited to 'src/mesa/drivers/dri/i915/intel_ioctl.c')
-rw-r--r--src/mesa/drivers/dri/i915/intel_ioctl.c58
1 files changed, 55 insertions, 3 deletions
diff --git a/src/mesa/drivers/dri/i915/intel_ioctl.c b/src/mesa/drivers/dri/i915/intel_ioctl.c
index 6e76737c78..94f7e73ecf 100644
--- a/src/mesa/drivers/dri/i915/intel_ioctl.c
+++ b/src/mesa/drivers/dri/i915/intel_ioctl.c
@@ -42,6 +42,8 @@
#include "intel_regions.h"
#include "drm.h"
+#include "intel_bufmgr_ttm.h"
+
#define FILE_DEBUG_FLAG DEBUG_IOCTL
int
@@ -105,9 +107,6 @@ intel_batch_ioctl(struct intel_context *intel,
* hardware contexts which would preserve statechanges beyond a
* single buffer.
*/
-
-
-
batch.start = start_offset;
batch.used = used;
batch.cliprects = intel->pClipRects;
@@ -133,3 +132,56 @@ intel_batch_ioctl(struct intel_context *intel,
*/
intel->vtbl.lost_hardware(intel);
}
+
+void
+intel_exec_ioctl(struct intel_context *intel,
+ GLuint used,
+ GLboolean ignore_cliprects, GLboolean allow_unlock,
+ void *start, GLuint count, dri_fence **fence)
+{
+ struct drm_i915_execbuffer execbuf;
+ dri_fence *fo;
+
+ assert(intel->locked);
+ assert(used);
+
+ if (*fence) {
+ dri_fence_unreference(*fence);
+ }
+
+ memset(&execbuf, 0, sizeof(execbuf));
+
+ execbuf.num_buffers = count;
+ execbuf.batch.used = used;
+ execbuf.batch.cliprects = intel->pClipRects;
+ execbuf.batch.num_cliprects = ignore_cliprects ? 0 : intel->numClipRects;
+ execbuf.batch.DR1 = 0;
+ execbuf.batch.DR4 = ((((GLuint) intel->drawX) & 0xffff) |
+ (((GLuint) intel->drawY) << 16));
+
+ execbuf.ops_list = (unsigned)start; // TODO
+ execbuf.fence_arg.flags = DRM_FENCE_FLAG_SHAREABLE | DRM_I915_FENCE_FLAG_FLUSHED;
+
+ if (drmCommandWriteRead(intel->driFd, DRM_I915_EXECBUFFER, &execbuf,
+ sizeof(execbuf))) {
+ fprintf(stderr, "DRM_I830_EXECBUFFER: %d\n", -errno);
+ UNLOCK_HARDWARE(intel);
+ exit(1);
+ }
+
+
+ fo = intel_ttm_fence_create_from_arg(intel->intelScreen->bufmgr, "fence buffers",
+ &execbuf.fence_arg);
+ if (!fo) {
+ fprintf(stderr, "failed to fence handle: %08x\n", execbuf.fence_arg.handle);
+ UNLOCK_HARDWARE(intel);
+ exit(1);
+ }
+ *fence = fo;
+
+ /* FIXME: use hardware contexts to avoid 'losing' hardware after
+ * each buffer flush.
+ */
+ intel->vtbl.lost_hardware(intel);
+
+}