summaryrefslogtreecommitdiff
path: root/sys/dev/pci/drm
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2013-12-07 10:46:27 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2013-12-07 10:46:27 +0000
commitf4272e614f461da014565ab49d408327cf2d3a23 (patch)
tree7e28e1ac0b09ca7a352562399271331385821ed7 /sys/dev/pci/drm
parent87af1e2d75ca1adbcf7f69bc41a1cfbcbaec91a2 (diff)
Enable fast path for relocations.
ok jsg@
Diffstat (limited to 'sys/dev/pci/drm')
-rw-r--r--sys/dev/pci/drm/i915/i915_gem_execbuffer.c33
1 files changed, 23 insertions, 10 deletions
diff --git a/sys/dev/pci/drm/i915/i915_gem_execbuffer.c b/sys/dev/pci/drm/i915/i915_gem_execbuffer.c
index bd7cea2c6c2..4e33cb132ce 100644
--- a/sys/dev/pci/drm/i915/i915_gem_execbuffer.c
+++ b/sys/dev/pci/drm/i915/i915_gem_execbuffer.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: i915_gem_execbuffer.c,v 1.22 2013/12/05 13:29:56 kettenis Exp $ */
+/* $OpenBSD: i915_gem_execbuffer.c,v 1.23 2013/12/07 10:46:26 kettenis Exp $ */
/*
* Copyright (c) 2008-2009 Owain G. Ainsworth <oga@openbsd.org>
*
@@ -54,6 +54,28 @@
#include <sys/queue.h>
#include <sys/task.h>
+int pagefault_disabled;
+
+static inline void
+pagefault_disable(void)
+{
+ KASSERT(pagefault_disabled == 0);
+ pagefault_disabled = 1;
+}
+
+static inline void
+pagefault_enable(void)
+{
+ KASSERT(pagefault_disabled == 1);
+ pagefault_disabled = 0;
+}
+
+static inline int
+in_atomic(void)
+{
+ return pagefault_disabled;
+}
+
static void *kmap_atomic(struct vm_page *);
static void kunmap_atomic(void *);
static inline struct vm_page *i915_gem_object_get_page(struct drm_i915_gem_object *, int);
@@ -209,10 +231,8 @@ i915_gem_execbuffer_relocate_entry(struct drm_i915_gem_object *obj,
}
/* We can't wait for rendering with pagefaults disabled */
-#ifdef notyet
if (obj->active && in_atomic())
return -EFAULT;
-#endif
reloc->delta += target_offset;
if (use_cpu_reloc(obj)) {
@@ -330,9 +350,6 @@ i915_gem_execbuffer_relocate(struct drm_device *dev,
struct drm_i915_gem_object *obj;
int ret = 0;
- /* XXX fastpath not currently used on OpenBSD */
- return -EFAULT;
-
/* This is the fast path and we cannot handle a pagefault whilst
* holding the struct mutex lest the user pass in the relocations
* contained within a mmaped bo. For in such a case we, the page
@@ -340,17 +357,13 @@ i915_gem_execbuffer_relocate(struct drm_device *dev,
* acquire the struct mutex again. Obviously this is bad and so
* lockdep complains vehemently.
*/
-#ifdef notyet
pagefault_disable();
-#endif
list_for_each_entry(obj, objects, exec_list) {
ret = i915_gem_execbuffer_relocate_object(obj, eb);
if (ret)
break;
}
-#ifdef notyet
pagefault_enable();
-#endif
return ret;
}