summaryrefslogtreecommitdiff
path: root/sys/dev/pci
diff options
context:
space:
mode:
authorJonathan Gray <jsg@jsg.id.au>2013-03-06 23:30:48 +1100
committerJonathan Gray <jsg@jsg.id.au>2013-03-06 23:30:48 +1100
commit0bbe03f6ba2ba3b929c9a3316b1555982f220b54 (patch)
treea022e067fbe065feb3794ad4cb3c509b971706d4 /sys/dev/pci
parent88d7b9fdfb3e21b47536684660d022981d98464e (diff)
directly call the dispatch execbuffer callback
Diffstat (limited to 'sys/dev/pci')
-rw-r--r--sys/dev/pci/drm/i915_drm.h14
-rw-r--r--sys/dev/pci/drm/i915_gem_execbuffer.c21
2 files changed, 33 insertions, 2 deletions
diff --git a/sys/dev/pci/drm/i915_drm.h b/sys/dev/pci/drm/i915_drm.h
index 2bf113f256b..8512c6c8bd1 100644
--- a/sys/dev/pci/drm/i915_drm.h
+++ b/sys/dev/pci/drm/i915_drm.h
@@ -598,6 +598,20 @@ struct drm_i915_gem_execbuffer2 {
/** Resets the SO write offset registers for transform feedback on gen7. */
#define I915_EXEC_GEN7_SOL_RESET (1<<8)
+/** Request a privileged ("secure") batch buffer. Note only available for
+ * DRM_ROOT_ONLY | DRM_MASTER processes.
+ */
+#define I915_EXEC_SECURE (1<<9)
+
+/** Inform the kernel that the batch is and will always be pinned. This
+ * negates the requirement for a workaround to be performed to avoid
+ * an incoherent CS (such as can be found on 830/845). If this flag is
+ * not passed, the kernel will endeavour to make sure the batch is
+ * coherent with the CS before execution. If this flag is passed,
+ * userspace assumes the responsibility for ensuring the same.
+ */
+#define I915_EXEC_IS_PINNED (1<<10)
+
struct drm_i915_gem_pin {
/** Handle of the buffer to be pinned. */
uint32_t handle;
diff --git a/sys/dev/pci/drm/i915_gem_execbuffer.c b/sys/dev/pci/drm/i915_gem_execbuffer.c
index 553cee1799c..7b11b86817c 100644
--- a/sys/dev/pci/drm/i915_gem_execbuffer.c
+++ b/sys/dev/pci/drm/i915_gem_execbuffer.c
@@ -519,7 +519,8 @@ i915_gem_execbuffer2(struct drm_device *dev, void *data,
int ret, ret2, i;
int pinned = 0, pin_tries;
uint32_t reloc_index;
- uint32_t seqno;
+ uint32_t seqno, flags;
+ uint32_t exec_start, exec_len;
/*
* Check for valid execbuffer offset. We can do this early because
@@ -537,6 +538,16 @@ i915_gem_execbuffer2(struct drm_device *dev, void *data,
return (EINVAL);
}
+ flags = 0;
+ if (args->flags & I915_EXEC_SECURE) {
+ if (!DRM_SUSER(curproc))
+ return (EPERM);
+
+ flags |= I915_DISPATCH_SECURE;
+ }
+ if (args->flags & I915_EXEC_IS_PINNED)
+ flags |= I915_DISPATCH_PINNED;
+
switch (args->flags & I915_EXEC_RING_MASK) {
case I915_EXEC_DEFAULT:
case I915_EXEC_RENDER:
@@ -704,7 +715,13 @@ i915_gem_execbuffer2(struct drm_device *dev, void *data,
/*
* XXX make sure that this may never fail by preallocating the request.
*/
- i915_dispatch_gem_execbuffer(ring, args, batch_obj_priv->gtt_offset);
+
+ exec_start = batch_obj_priv->gtt_offset + args->batch_start_offset;
+ exec_len = args->batch_len;
+
+ ret = ring->dispatch_execbuffer(ring, exec_start, exec_len, flags);
+ if (ret)
+ goto err;
i915_gem_execbuffer_move_to_active(object_list, args->buffer_count, ring);
i915_gem_execbuffer_retire_commands(dev, file_priv, ring);