public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915: Broaden application of set-domain(GTT)
@ 2014-10-13 13:20 Chris Wilson
  2014-10-14 12:47 ` Chris Wilson
  0 siblings, 1 reply; 45+ messages in thread
From: Chris Wilson @ 2014-10-13 13:20 UTC (permalink / raw)
  To: intel-gfx; +Cc: Akash Goel

Previously, this was restricted to only operate on bound objects - to
make pointer access through the GTT to the object coherent with writes
to and from the GPU. A second usecase is drm_intel_bo_wait_rendering()
which at present does not function unless the object also happens to
be bound into the GGTT (on current systems that is becoming increasingly
rare, especially for the typical requests from mesa). A third usecase is
a future patch wishing to extend the coverage of the GTT domain to
include objects not bound into the GGTT but still in its coherent cache
domain. For the latter pair of requests, we need to operate on the
object regardless of its bind state.

Cc: Akash Goel <akash.goel@intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_gem.c | 23 +++++++----------------
 1 file changed, 7 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index a2251d9dc134..cee6fdfe8e05 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1506,18 +1506,10 @@ i915_gem_set_domain_ioctl(struct drm_device *dev, void *data,
 	if (ret)
 		goto unref;
 
-	if (read_domains & I915_GEM_DOMAIN_GTT) {
+	if (read_domains & I915_GEM_DOMAIN_GTT)
 		ret = i915_gem_object_set_to_gtt_domain(obj, write_domain != 0);
-
-		/* Silently promote "you're not bound, there was nothing to do"
-		 * to success, since the client was just asking us to
-		 * make sure everything was done.
-		 */
-		if (ret == -EINVAL)
-			ret = 0;
-	} else {
+	else
 		ret = i915_gem_object_set_to_cpu_domain(obj, write_domain != 0);
-	}
 
 unref:
 	drm_gem_object_unreference(&obj->base);
@@ -3474,14 +3466,10 @@ i915_gem_object_flush_cpu_write_domain(struct drm_i915_gem_object *obj,
 int
 i915_gem_object_set_to_gtt_domain(struct drm_i915_gem_object *obj, bool write)
 {
-	struct i915_vma *vma = i915_gem_obj_to_ggtt(obj);
 	uint32_t old_write_domain, old_read_domains;
+	struct i915_vma *vma;
 	int ret;
 
-	/* Not valid to be called on unbound objects. */
-	if (vma == NULL)
-		return -EINVAL;
-
 	if (obj->base.write_domain == I915_GEM_DOMAIN_GTT)
 		return 0;
 
@@ -3518,7 +3506,10 @@ i915_gem_object_set_to_gtt_domain(struct drm_i915_gem_object *obj, bool write)
 					    old_write_domain);
 
 	/* And bump the LRU for this access */
-	if (i915_gem_object_is_inactive(obj))
+	vma = i915_gem_obj_to_ggtt(obj);
+	if (vma &&
+	    drm_mm_node_allocated(&vma->node) &&
+	    i915_gem_object_is_inactive(obj))
 		list_move_tail(&vma->mm_list,
 			       &to_i915(obj->base.dev)->gtt.base.inactive_list);
 
-- 
2.1.1

^ permalink raw reply related	[flat|nested] 45+ messages in thread

end of thread, other threads:[~2016-03-15  8:40 UTC | newest]

Thread overview: 45+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-13 13:20 [PATCH] drm/i915: Broaden application of set-domain(GTT) Chris Wilson
2014-10-14 12:47 ` Chris Wilson
2014-10-23 10:33   ` [PATCH] drm/i915: Support to create uncached user mapping for a Gem object akash.goel
2014-10-23 10:37     ` [PATCH] intel: New libdrm interface to create uncached CPU mapping akash.goel
2014-10-23 10:54     ` [PATCH] drm/i915: Support to create uncached user mapping for a Gem object Chris Wilson
2014-10-23 11:03     ` Chris Wilson
2014-10-23 11:56     ` Chris Wilson
2014-10-23 13:23       ` Chris Wilson
2014-12-10  4:48         ` Chad Versace
2014-12-10  8:02           ` Chris Wilson
2014-10-23 16:55     ` [PATCH] drm/i915: Support creation of unbound wc user mappings for objects Chris Wilson
2014-10-23 19:05       ` [PATCH 1/3] igt/gem_evict_(alignment|everything): contend with GPU hangs Chris Wilson
2014-10-23 19:05         ` [PATCH 2/3] lib/core: Check for kernel error messages and WARN if any are found Chris Wilson
2014-10-23 19:05         ` [PATCH 3/3] reg-read-8 Chris Wilson
2014-10-23 19:12         ` [PATCH 1/3] igt/gem_evict_(alignment|everything): contend with GPU hangs Chris Wilson
2014-10-23 19:11       ` [PATCH 1/3] igt/gem_mmap_wc: Exercise mmap(wc) interface Chris Wilson
2014-10-23 19:11         ` [PATCH 2/3] igt/gem_gtt_speed: compare against WC mmaps Chris Wilson
2014-10-23 19:11         ` [PATCH 3/3] igt/gem_concurrent_blit: Exercise wc mappings Chris Wilson
2014-10-25 11:51       ` [PATCH] intel: New libdrm interface to create unbound wc user mappings for objects akash.goel
2014-10-25 12:45         ` Damien Lespiau
2014-10-26  8:36           ` Akash Goel
2014-10-26  8:41             ` Chris Wilson
2014-10-28 13:09         ` [PATCH v3] " akash.goel
2014-10-28 16:11           ` Damien Lespiau
2014-12-03 14:13           ` Damien Lespiau
2014-12-03 18:18             ` Chris Wilson
2014-12-09 10:54             ` Chris Wilson
2014-12-09 16:53               ` Damien Lespiau
2014-12-14  8:41                 ` [PATCH v4] " akash.goel
2016-03-09  9:09                   ` [PATCH v5] " akash.goel
2016-03-10  8:39                     ` Martin Peres
2016-03-14 16:51                       ` Martin Peres
2016-03-15  8:41                         ` Daniel Vetter
2015-03-03 14:20                 ` [PATCH v3] " Damien Lespiau
2015-03-03 17:05                   ` Chris Wilson
2015-03-03 17:11                     ` Damien Lespiau
2015-03-03 17:13                       ` Chris Wilson
2015-03-03 17:16                         ` Damien Lespiau
2014-11-05 12:48       ` [PATCH] drm/i915: Support creation of " Chris Wilson
2014-11-06 14:50         ` Daniel Vetter
2014-12-17 12:46       ` Tvrtko Ursulin
2014-12-17 12:52         ` Chris Wilson
2014-10-24  8:40     ` [PATCH] drm/i915: Support to create uncached user mapping for a Gem object Daniel Vetter
2014-10-24  9:23       ` Chris Wilson
2014-11-05 12:49   ` [PATCH] drm/i915: Broaden application of set-domain(GTT) Chris Wilson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox