aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpu/drm/i915/i915_gem.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 174c0c3ba0b0..3fde82be014f 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -435,6 +435,13 @@ i915_gem_set_domain_ioctl(struct drm_device *dev, void *data,
435#endif 435#endif
436 if (read_domains & I915_GEM_DOMAIN_GTT) { 436 if (read_domains & I915_GEM_DOMAIN_GTT) {
437 ret = i915_gem_object_set_to_gtt_domain(obj, write_domain != 0); 437 ret = i915_gem_object_set_to_gtt_domain(obj, write_domain != 0);
438
439 /* Silently promote "you're not bound, there was nothing to do"
440 * to success, since the client was just asking us to
441 * make sure everything was done.
442 */
443 if (ret == -EINVAL)
444 ret = 0;
438 } else { 445 } else {
439 ret = i915_gem_object_set_to_cpu_domain(obj, write_domain != 0); 446 ret = i915_gem_object_set_to_cpu_domain(obj, write_domain != 0);
440 } 447 }
@@ -1304,6 +1311,10 @@ i915_gem_object_set_to_gtt_domain(struct drm_gem_object *obj, int write)
1304 struct drm_i915_gem_object *obj_priv = obj->driver_private; 1311 struct drm_i915_gem_object *obj_priv = obj->driver_private;
1305 int ret; 1312 int ret;
1306 1313
1314 /* Not valid to be called on unbound objects. */
1315 if (obj_priv->gtt_space == NULL)
1316 return -EINVAL;
1317
1307 i915_gem_object_flush_gpu_write_domain(obj); 1318 i915_gem_object_flush_gpu_write_domain(obj);
1308 /* Wait on any GPU rendering and flushing to occur. */ 1319 /* Wait on any GPU rendering and flushing to occur. */
1309 ret = i915_gem_object_wait_rendering(obj); 1320 ret = i915_gem_object_wait_rendering(obj);