drm/i915: Add origin to frontbuffer tracking flush
authorRodrigo Vivi <rodrigo.vivi@intel.com>
Tue, 7 Jul 2015 23:28:51 +0000 (16:28 -0700)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Wed, 8 Jul 2015 15:29:08 +0000 (17:29 +0200)
This will be useful to PSR and FBC once we start making
dirty fb calls to also flush frontbuffer.

Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/i915_gem.c
drivers/gpu/drm/i915/intel_drv.h
drivers/gpu/drm/i915/intel_frontbuffer.c

index 82c05b80b7ef096ed3ebab692c51cf1920e9e49e..aaabf3c259d50e1c665b79eaed4b34f85e419a6b 100644 (file)
@@ -375,7 +375,7 @@ i915_gem_phys_pwrite(struct drm_i915_gem_object *obj,
        i915_gem_chipset_flush(dev);
 
 out:
-       intel_fb_obj_flush(obj, false);
+       intel_fb_obj_flush(obj, false, ORIGIN_CPU);
        return ret;
 }
 
@@ -839,7 +839,7 @@ i915_gem_gtt_pwrite_fast(struct drm_device *dev,
        }
 
 out_flush:
-       intel_fb_obj_flush(obj, false);
+       intel_fb_obj_flush(obj, false, ORIGIN_GTT);
 out_unpin:
        i915_gem_object_ggtt_unpin(obj);
 out:
@@ -1032,7 +1032,7 @@ out:
        if (needs_clflush_after)
                i915_gem_chipset_flush(dev);
 
-       intel_fb_obj_flush(obj, false);
+       intel_fb_obj_flush(obj, false, ORIGIN_CPU);
        return ret;
 }
 
@@ -2375,7 +2375,7 @@ i915_gem_object_retire__write(struct drm_i915_gem_object *obj)
        RQ_BUG_ON(!(obj->active & intel_ring_flag(obj->last_write_req->ring)));
 
        i915_gem_request_assign(&obj->last_write_req, NULL);
-       intel_fb_obj_flush(obj, true);
+       intel_fb_obj_flush(obj, true, ORIGIN_CS);
 }
 
 static void
@@ -3905,7 +3905,7 @@ i915_gem_object_flush_gtt_write_domain(struct drm_i915_gem_object *obj)
        old_write_domain = obj->base.write_domain;
        obj->base.write_domain = 0;
 
-       intel_fb_obj_flush(obj, false);
+       intel_fb_obj_flush(obj, false, ORIGIN_GTT);
 
        trace_i915_gem_object_change_domain(obj,
                                            obj->base.read_domains,
@@ -3927,7 +3927,7 @@ i915_gem_object_flush_cpu_write_domain(struct drm_i915_gem_object *obj)
        old_write_domain = obj->base.write_domain;
        obj->base.write_domain = 0;
 
-       intel_fb_obj_flush(obj, false);
+       intel_fb_obj_flush(obj, false, ORIGIN_CPU);
 
        trace_i915_gem_object_change_domain(obj,
                                            obj->base.read_domains,
index 082d0e7dfb14be75fde69f789d0f2faf5cc26f2e..beeb4d326cbea4de1a77a94b96f04d1a3511b6aa 100644 (file)
@@ -978,16 +978,16 @@ void intel_frontbuffer_flip_prepare(struct drm_device *dev,
 void intel_frontbuffer_flip_complete(struct drm_device *dev,
                                     unsigned frontbuffer_bits);
 void intel_frontbuffer_flush(struct drm_device *dev,
-                            unsigned frontbuffer_bits);
+                            unsigned frontbuffer_bits,
+                            enum fb_op_origin origin);
 void intel_frontbuffer_flip(struct drm_device *dev,
                            unsigned frontbuffer_bits);
-
 unsigned int intel_fb_align_height(struct drm_device *dev,
                                   unsigned int height,
                                   uint32_t pixel_format,
                                   uint64_t fb_format_modifier);
-void intel_fb_obj_flush(struct drm_i915_gem_object *obj, bool retire);
-
+void intel_fb_obj_flush(struct drm_i915_gem_object *obj, bool retire,
+                       enum fb_op_origin origin);
 u32 intel_fb_stride_alignment(struct drm_device *dev, uint64_t fb_modifier,
                              uint32_t pixel_format);
 
index 6e90e2b0293d5572f403893de56d750da5a4ab25..cb5a6f0447e7ccdf8b9d171091549401427f7d2a 100644 (file)
@@ -105,6 +105,7 @@ void intel_fb_obj_invalidate(struct drm_i915_gem_object *obj,
  * intel_frontbuffer_flush - flush frontbuffer
  * @dev: DRM device
  * @frontbuffer_bits: frontbuffer plane tracking bits
+ * @origin: which operation caused the flush
  *
  * This function gets called every time rendering on the given planes has
  * completed and frontbuffer caching can be started again. Flushes will get
@@ -113,7 +114,8 @@ void intel_fb_obj_invalidate(struct drm_i915_gem_object *obj,
  * Can be called without any locks held.
  */
 void intel_frontbuffer_flush(struct drm_device *dev,
-                            unsigned frontbuffer_bits)
+                            unsigned frontbuffer_bits,
+                            enum fb_op_origin origin)
 {
        struct drm_i915_private *dev_priv = to_i915(dev);
 
@@ -140,7 +142,7 @@ void intel_frontbuffer_flush(struct drm_device *dev,
  * then any delayed flushes will be unblocked.
  */
 void intel_fb_obj_flush(struct drm_i915_gem_object *obj,
-                       bool retire)
+                       bool retire, enum fb_op_origin origin)
 {
        struct drm_device *dev = obj->base.dev;
        struct drm_i915_private *dev_priv = to_i915(dev);
@@ -162,7 +164,7 @@ void intel_fb_obj_flush(struct drm_i915_gem_object *obj,
                mutex_unlock(&dev_priv->fb_tracking.lock);
        }
 
-       intel_frontbuffer_flush(dev, frontbuffer_bits);
+       intel_frontbuffer_flush(dev, frontbuffer_bits, origin);
 }
 
 /**
@@ -212,7 +214,7 @@ void intel_frontbuffer_flip_complete(struct drm_device *dev,
        dev_priv->fb_tracking.flip_bits &= ~frontbuffer_bits;
        mutex_unlock(&dev_priv->fb_tracking.lock);
 
-       intel_frontbuffer_flush(dev, frontbuffer_bits);
+       intel_frontbuffer_flush(dev, frontbuffer_bits, ORIGIN_FLIP);
 }
 
 /**
@@ -237,5 +239,5 @@ void intel_frontbuffer_flip(struct drm_device *dev,
        dev_priv->fb_tracking.busy_bits &= ~frontbuffer_bits;
        mutex_unlock(&dev_priv->fb_tracking.lock);
 
-       intel_frontbuffer_flush(dev, frontbuffer_bits);
+       intel_frontbuffer_flush(dev, frontbuffer_bits, ORIGIN_FLIP);
 }