Commit de152b62 authored by Rodrigo Vivi's avatar Rodrigo Vivi Committed by Daniel Vetter

drm/i915: Add origin to frontbuffer tracking flush

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: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
Reviewed-by: default avatarPaulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent 83b8a982
...@@ -375,7 +375,7 @@ i915_gem_phys_pwrite(struct drm_i915_gem_object *obj, ...@@ -375,7 +375,7 @@ i915_gem_phys_pwrite(struct drm_i915_gem_object *obj,
i915_gem_chipset_flush(dev); i915_gem_chipset_flush(dev);
out: out:
intel_fb_obj_flush(obj, false); intel_fb_obj_flush(obj, false, ORIGIN_CPU);
return ret; return ret;
} }
...@@ -839,7 +839,7 @@ i915_gem_gtt_pwrite_fast(struct drm_device *dev, ...@@ -839,7 +839,7 @@ i915_gem_gtt_pwrite_fast(struct drm_device *dev,
} }
out_flush: out_flush:
intel_fb_obj_flush(obj, false); intel_fb_obj_flush(obj, false, ORIGIN_GTT);
out_unpin: out_unpin:
i915_gem_object_ggtt_unpin(obj); i915_gem_object_ggtt_unpin(obj);
out: out:
...@@ -1032,7 +1032,7 @@ i915_gem_shmem_pwrite(struct drm_device *dev, ...@@ -1032,7 +1032,7 @@ i915_gem_shmem_pwrite(struct drm_device *dev,
if (needs_clflush_after) if (needs_clflush_after)
i915_gem_chipset_flush(dev); i915_gem_chipset_flush(dev);
intel_fb_obj_flush(obj, false); intel_fb_obj_flush(obj, false, ORIGIN_CPU);
return ret; return ret;
} }
...@@ -2375,7 +2375,7 @@ i915_gem_object_retire__write(struct drm_i915_gem_object *obj) ...@@ -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))); RQ_BUG_ON(!(obj->active & intel_ring_flag(obj->last_write_req->ring)));
i915_gem_request_assign(&obj->last_write_req, NULL); 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 static void
...@@ -3905,7 +3905,7 @@ i915_gem_object_flush_gtt_write_domain(struct drm_i915_gem_object *obj) ...@@ -3905,7 +3905,7 @@ i915_gem_object_flush_gtt_write_domain(struct drm_i915_gem_object *obj)
old_write_domain = obj->base.write_domain; old_write_domain = obj->base.write_domain;
obj->base.write_domain = 0; 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, trace_i915_gem_object_change_domain(obj,
obj->base.read_domains, obj->base.read_domains,
...@@ -3927,7 +3927,7 @@ i915_gem_object_flush_cpu_write_domain(struct drm_i915_gem_object *obj) ...@@ -3927,7 +3927,7 @@ i915_gem_object_flush_cpu_write_domain(struct drm_i915_gem_object *obj)
old_write_domain = obj->base.write_domain; old_write_domain = obj->base.write_domain;
obj->base.write_domain = 0; 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, trace_i915_gem_object_change_domain(obj,
obj->base.read_domains, obj->base.read_domains,
......
...@@ -978,16 +978,16 @@ void intel_frontbuffer_flip_prepare(struct drm_device *dev, ...@@ -978,16 +978,16 @@ void intel_frontbuffer_flip_prepare(struct drm_device *dev,
void intel_frontbuffer_flip_complete(struct drm_device *dev, void intel_frontbuffer_flip_complete(struct drm_device *dev,
unsigned frontbuffer_bits); unsigned frontbuffer_bits);
void intel_frontbuffer_flush(struct drm_device *dev, 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, void intel_frontbuffer_flip(struct drm_device *dev,
unsigned frontbuffer_bits); unsigned frontbuffer_bits);
unsigned int intel_fb_align_height(struct drm_device *dev, unsigned int intel_fb_align_height(struct drm_device *dev,
unsigned int height, unsigned int height,
uint32_t pixel_format, uint32_t pixel_format,
uint64_t fb_format_modifier); 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, u32 intel_fb_stride_alignment(struct drm_device *dev, uint64_t fb_modifier,
uint32_t pixel_format); uint32_t pixel_format);
......
...@@ -105,6 +105,7 @@ void intel_fb_obj_invalidate(struct drm_i915_gem_object *obj, ...@@ -105,6 +105,7 @@ void intel_fb_obj_invalidate(struct drm_i915_gem_object *obj,
* intel_frontbuffer_flush - flush frontbuffer * intel_frontbuffer_flush - flush frontbuffer
* @dev: DRM device * @dev: DRM device
* @frontbuffer_bits: frontbuffer plane tracking bits * @frontbuffer_bits: frontbuffer plane tracking bits
* @origin: which operation caused the flush
* *
* This function gets called every time rendering on the given planes has * This function gets called every time rendering on the given planes has
* completed and frontbuffer caching can be started again. Flushes will get * 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, ...@@ -113,7 +114,8 @@ void intel_fb_obj_invalidate(struct drm_i915_gem_object *obj,
* Can be called without any locks held. * Can be called without any locks held.
*/ */
void intel_frontbuffer_flush(struct drm_device *dev, 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); struct drm_i915_private *dev_priv = to_i915(dev);
...@@ -140,7 +142,7 @@ void intel_frontbuffer_flush(struct drm_device *dev, ...@@ -140,7 +142,7 @@ void intel_frontbuffer_flush(struct drm_device *dev,
* then any delayed flushes will be unblocked. * then any delayed flushes will be unblocked.
*/ */
void intel_fb_obj_flush(struct drm_i915_gem_object *obj, 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_device *dev = obj->base.dev;
struct drm_i915_private *dev_priv = to_i915(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, ...@@ -162,7 +164,7 @@ void intel_fb_obj_flush(struct drm_i915_gem_object *obj,
mutex_unlock(&dev_priv->fb_tracking.lock); 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, ...@@ -212,7 +214,7 @@ void intel_frontbuffer_flip_complete(struct drm_device *dev,
dev_priv->fb_tracking.flip_bits &= ~frontbuffer_bits; dev_priv->fb_tracking.flip_bits &= ~frontbuffer_bits;
mutex_unlock(&dev_priv->fb_tracking.lock); 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, ...@@ -237,5 +239,5 @@ void intel_frontbuffer_flip(struct drm_device *dev,
dev_priv->fb_tracking.busy_bits &= ~frontbuffer_bits; dev_priv->fb_tracking.busy_bits &= ~frontbuffer_bits;
mutex_unlock(&dev_priv->fb_tracking.lock); mutex_unlock(&dev_priv->fb_tracking.lock);
intel_frontbuffer_flush(dev, frontbuffer_bits); intel_frontbuffer_flush(dev, frontbuffer_bits, ORIGIN_FLIP);
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment