diff options
-rw-r--r-- | drivers/gpu/drm/i915/i915_drv.h | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem.c | 51 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_display.c | 2 |
3 files changed, 53 insertions, 1 deletions
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 29dd67626967..445c49c6c397 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h | |||
@@ -864,6 +864,7 @@ int i915_do_wait_request(struct drm_device *dev, uint32_t seqno, int interruptib | |||
864 | int i915_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf); | 864 | int i915_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf); |
865 | int i915_gem_object_set_to_gtt_domain(struct drm_gem_object *obj, | 865 | int i915_gem_object_set_to_gtt_domain(struct drm_gem_object *obj, |
866 | int write); | 866 | int write); |
867 | int i915_gem_object_set_to_display_plane(struct drm_gem_object *obj); | ||
867 | int i915_gem_attach_phys_object(struct drm_device *dev, | 868 | int i915_gem_attach_phys_object(struct drm_device *dev, |
868 | struct drm_gem_object *obj, int id); | 869 | struct drm_gem_object *obj, int id); |
869 | void i915_gem_detach_phys_object(struct drm_device *dev, | 870 | void i915_gem_detach_phys_object(struct drm_device *dev, |
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 2748609f05b3..0f4afa3b03f2 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
@@ -2837,6 +2837,57 @@ i915_gem_object_set_to_gtt_domain(struct drm_gem_object *obj, int write) | |||
2837 | return 0; | 2837 | return 0; |
2838 | } | 2838 | } |
2839 | 2839 | ||
2840 | /* | ||
2841 | * Prepare buffer for display plane. Use uninterruptible for possible flush | ||
2842 | * wait, as in modesetting process we're not supposed to be interrupted. | ||
2843 | */ | ||
2844 | int | ||
2845 | i915_gem_object_set_to_display_plane(struct drm_gem_object *obj) | ||
2846 | { | ||
2847 | struct drm_device *dev = obj->dev; | ||
2848 | struct drm_i915_gem_object *obj_priv = obj->driver_private; | ||
2849 | uint32_t old_write_domain, old_read_domains; | ||
2850 | int ret; | ||
2851 | |||
2852 | /* Not valid to be called on unbound objects. */ | ||
2853 | if (obj_priv->gtt_space == NULL) | ||
2854 | return -EINVAL; | ||
2855 | |||
2856 | i915_gem_object_flush_gpu_write_domain(obj); | ||
2857 | |||
2858 | /* Wait on any GPU rendering and flushing to occur. */ | ||
2859 | if (obj_priv->active) { | ||
2860 | #if WATCH_BUF | ||
2861 | DRM_INFO("%s: object %p wait for seqno %08x\n", | ||
2862 | __func__, obj, obj_priv->last_rendering_seqno); | ||
2863 | #endif | ||
2864 | ret = i915_do_wait_request(dev, obj_priv->last_rendering_seqno, 0); | ||
2865 | if (ret != 0) | ||
2866 | return ret; | ||
2867 | } | ||
2868 | |||
2869 | old_write_domain = obj->write_domain; | ||
2870 | old_read_domains = obj->read_domains; | ||
2871 | |||
2872 | obj->read_domains &= I915_GEM_DOMAIN_GTT; | ||
2873 | |||
2874 | i915_gem_object_flush_cpu_write_domain(obj); | ||
2875 | |||
2876 | /* It should now be out of any other write domains, and we can update | ||
2877 | * the domain values for our changes. | ||
2878 | */ | ||
2879 | BUG_ON((obj->write_domain & ~I915_GEM_DOMAIN_GTT) != 0); | ||
2880 | obj->read_domains |= I915_GEM_DOMAIN_GTT; | ||
2881 | obj->write_domain = I915_GEM_DOMAIN_GTT; | ||
2882 | obj_priv->dirty = 1; | ||
2883 | |||
2884 | trace_i915_gem_object_change_domain(obj, | ||
2885 | old_read_domains, | ||
2886 | old_write_domain); | ||
2887 | |||
2888 | return 0; | ||
2889 | } | ||
2890 | |||
2840 | /** | 2891 | /** |
2841 | * Moves a single object to the CPU read, and possibly write domain. | 2892 | * Moves a single object to the CPU read, and possibly write domain. |
2842 | * | 2893 | * |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 42e8c031c2ca..4b96a54b8e48 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -1207,7 +1207,7 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y, | |||
1207 | return ret; | 1207 | return ret; |
1208 | } | 1208 | } |
1209 | 1209 | ||
1210 | ret = i915_gem_object_set_to_gtt_domain(obj, 1); | 1210 | ret = i915_gem_object_set_to_display_plane(obj); |
1211 | if (ret != 0) { | 1211 | if (ret != 0) { |
1212 | i915_gem_object_unpin(obj); | 1212 | i915_gem_object_unpin(obj); |
1213 | mutex_unlock(&dev->struct_mutex); | 1213 | mutex_unlock(&dev->struct_mutex); |