Commit 5baf63cc authored by Rodrigo Vivi's avatar Rodrigo Vivi

drm/i915/psr: Use more PSR HW tracking.

So far we are using frontbuffer tracking for everything
and ignoring that PSR has a HW capable HW tracking for many
modern usages of GPU on Core platforms and newer Atom ones.

One reason for that is that we were trying to keep same
infrastructure in place for VLV/CHV than the rest of platforms.
But also because when this infrastructure was created
the front-buffer-tracking origin wasn't that good and stable
how it is today after Paulo reworked it to attend FBC cases.

However this PSR implementation without HW tracking died
on gen8LP. And newer platforms are starting to demand more HW
tracking specially with PSR2 cases in mind.

By disabling and re-enabling PSR totally every time we believe
someone is going to change the front buffer content we don't
allow PSR HW tracking to do this job and specially compromising
the whole idea of PSR2 case where the HW tracking detect only
the damaged area and do a partial screen update.

So, from now on, on the platforms that has hw_tracking let's
rely more on HW tracking.

This also is the case in used by other drivers and more validated
by SV teams. So I hope that this will lead us to less misterious
bugs.

v2: Only do this for platform that actually has hw tracking.

v3 from DK
Do this only for flips, small gradual changes are better.

Cc: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
Cc: Jim Bride <jim.bride@linux.intel.com>
Cc: Vathsala Nagaraju <vathsala.nagaraju@intel.com>
Signed-off-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: default avatarDhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
Reviewed-by: default avatarJose Roberto de Souza <jose.souza@intel.com>
Signed-off-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180307033420.3086-3-dhinakaran.pandiyan@intel.com
parent a694e226
...@@ -606,6 +606,7 @@ struct i915_psr { ...@@ -606,6 +606,7 @@ struct i915_psr {
bool y_cord_support; bool y_cord_support;
bool colorimetry_support; bool colorimetry_support;
bool alpm; bool alpm;
bool has_hw_tracking;
void (*enable_source)(struct intel_dp *, void (*enable_source)(struct intel_dp *,
const struct intel_crtc_state *); const struct intel_crtc_state *);
......
...@@ -1876,7 +1876,8 @@ void intel_psr_enable(struct intel_dp *intel_dp, ...@@ -1876,7 +1876,8 @@ void intel_psr_enable(struct intel_dp *intel_dp,
void intel_psr_disable(struct intel_dp *intel_dp, void intel_psr_disable(struct intel_dp *intel_dp,
const struct intel_crtc_state *old_crtc_state); const struct intel_crtc_state *old_crtc_state);
void intel_psr_invalidate(struct drm_i915_private *dev_priv, void intel_psr_invalidate(struct drm_i915_private *dev_priv,
unsigned frontbuffer_bits); unsigned frontbuffer_bits,
enum fb_op_origin origin);
void intel_psr_flush(struct drm_i915_private *dev_priv, void intel_psr_flush(struct drm_i915_private *dev_priv,
unsigned frontbuffer_bits, unsigned frontbuffer_bits,
enum fb_op_origin origin); enum fb_op_origin origin);
......
...@@ -80,7 +80,7 @@ void __intel_fb_obj_invalidate(struct drm_i915_gem_object *obj, ...@@ -80,7 +80,7 @@ void __intel_fb_obj_invalidate(struct drm_i915_gem_object *obj,
} }
might_sleep(); might_sleep();
intel_psr_invalidate(dev_priv, frontbuffer_bits); intel_psr_invalidate(dev_priv, frontbuffer_bits, origin);
intel_edp_drrs_invalidate(dev_priv, frontbuffer_bits); intel_edp_drrs_invalidate(dev_priv, frontbuffer_bits);
intel_fbc_invalidate(dev_priv, frontbuffer_bits, origin); intel_fbc_invalidate(dev_priv, frontbuffer_bits, origin);
} }
......
...@@ -957,6 +957,7 @@ void intel_psr_single_frame_update(struct drm_i915_private *dev_priv, ...@@ -957,6 +957,7 @@ void intel_psr_single_frame_update(struct drm_i915_private *dev_priv,
* intel_psr_invalidate - Invalidade PSR * intel_psr_invalidate - Invalidade PSR
* @dev_priv: i915 device * @dev_priv: i915 device
* @frontbuffer_bits: frontbuffer plane tracking bits * @frontbuffer_bits: frontbuffer plane tracking bits
* @origin: which operation caused the invalidate
* *
* Since the hardware frontbuffer tracking has gaps we need to integrate * Since the hardware frontbuffer tracking has gaps we need to integrate
* with the software frontbuffer tracking. This function gets called every * with the software frontbuffer tracking. This function gets called every
...@@ -966,7 +967,7 @@ void intel_psr_single_frame_update(struct drm_i915_private *dev_priv, ...@@ -966,7 +967,7 @@ void intel_psr_single_frame_update(struct drm_i915_private *dev_priv,
* Dirty frontbuffers relevant to PSR are tracked in busy_frontbuffer_bits." * Dirty frontbuffers relevant to PSR are tracked in busy_frontbuffer_bits."
*/ */
void intel_psr_invalidate(struct drm_i915_private *dev_priv, void intel_psr_invalidate(struct drm_i915_private *dev_priv,
unsigned frontbuffer_bits) unsigned frontbuffer_bits, enum fb_op_origin origin)
{ {
struct drm_crtc *crtc; struct drm_crtc *crtc;
enum pipe pipe; enum pipe pipe;
...@@ -974,6 +975,9 @@ void intel_psr_invalidate(struct drm_i915_private *dev_priv, ...@@ -974,6 +975,9 @@ void intel_psr_invalidate(struct drm_i915_private *dev_priv,
if (!CAN_PSR(dev_priv)) if (!CAN_PSR(dev_priv))
return; return;
if (dev_priv->psr.has_hw_tracking && origin == ORIGIN_FLIP)
return;
mutex_lock(&dev_priv->psr.lock); mutex_lock(&dev_priv->psr.lock);
if (!dev_priv->psr.enabled) { if (!dev_priv->psr.enabled) {
mutex_unlock(&dev_priv->psr.lock); mutex_unlock(&dev_priv->psr.lock);
...@@ -1014,6 +1018,9 @@ void intel_psr_flush(struct drm_i915_private *dev_priv, ...@@ -1014,6 +1018,9 @@ void intel_psr_flush(struct drm_i915_private *dev_priv,
if (!CAN_PSR(dev_priv)) if (!CAN_PSR(dev_priv))
return; return;
if (dev_priv->psr.has_hw_tracking && origin == ORIGIN_FLIP)
return;
mutex_lock(&dev_priv->psr.lock); mutex_lock(&dev_priv->psr.lock);
if (!dev_priv->psr.enabled) { if (!dev_priv->psr.enabled) {
mutex_unlock(&dev_priv->psr.lock); mutex_unlock(&dev_priv->psr.lock);
...@@ -1105,6 +1112,7 @@ void intel_psr_init(struct drm_i915_private *dev_priv) ...@@ -1105,6 +1112,7 @@ void intel_psr_init(struct drm_i915_private *dev_priv)
dev_priv->psr.activate = vlv_psr_activate; dev_priv->psr.activate = vlv_psr_activate;
dev_priv->psr.setup_vsc = vlv_psr_setup_vsc; dev_priv->psr.setup_vsc = vlv_psr_setup_vsc;
} else { } else {
dev_priv->psr.has_hw_tracking = true;
dev_priv->psr.enable_source = hsw_psr_enable_source; dev_priv->psr.enable_source = hsw_psr_enable_source;
dev_priv->psr.disable_source = hsw_psr_disable; dev_priv->psr.disable_source = hsw_psr_disable;
dev_priv->psr.enable_sink = hsw_psr_enable_sink; dev_priv->psr.enable_sink = hsw_psr_enable_sink;
......
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