diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2018-02-20 08:42:08 -0500 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2018-02-20 14:03:59 -0500 |
commit | 1c9b6b133e658f9efde8706124f185fde3f273bb (patch) | |
tree | 1b7bb0031e1a2f044ed430bf4d11c1e42543adfc | |
parent | e3c017f15f7ee4c088697d41ee4260986c42a885 (diff) |
drm/i915/fbc: Use PLANE_HAS_FENCE to determine if the plane is fenced
Rather than trusting the cached value of plane_state->vma->fence to
imply whether the plane_state itself holds a reference on the
framebuffer's fence, use the information provided in the
plane_state->flags (PLANE_HAS_FENCE). Note that we still assume that FBC
is entirely bounded by the plane_state active life span; it's not clear
if that is a safe assumption.
Suggested-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180220134208.24988-4-chris@chris-wilson.co.uk
-rw-r--r-- | drivers/gpu/drm/i915/i915_drv.h | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_fbc.c | 13 |
2 files changed, 11 insertions, 4 deletions
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 3e1ad3f8e55d..1cdb543d4fce 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h | |||
@@ -667,6 +667,7 @@ struct intel_fbc { | |||
667 | */ | 667 | */ |
668 | struct intel_fbc_state_cache { | 668 | struct intel_fbc_state_cache { |
669 | struct i915_vma *vma; | 669 | struct i915_vma *vma; |
670 | unsigned long flags; | ||
670 | 671 | ||
671 | struct { | 672 | struct { |
672 | unsigned int mode_flags; | 673 | unsigned int mode_flags; |
@@ -705,6 +706,7 @@ struct intel_fbc { | |||
705 | */ | 706 | */ |
706 | struct intel_fbc_reg_params { | 707 | struct intel_fbc_reg_params { |
707 | struct i915_vma *vma; | 708 | struct i915_vma *vma; |
709 | unsigned long flags; | ||
708 | 710 | ||
709 | struct { | 711 | struct { |
710 | enum pipe pipe; | 712 | enum pipe pipe; |
diff --git a/drivers/gpu/drm/i915/intel_fbc.c b/drivers/gpu/drm/i915/intel_fbc.c index 80682a418a70..2cc2eada5576 100644 --- a/drivers/gpu/drm/i915/intel_fbc.c +++ b/drivers/gpu/drm/i915/intel_fbc.c | |||
@@ -183,7 +183,7 @@ static void g4x_fbc_activate(struct drm_i915_private *dev_priv) | |||
183 | else | 183 | else |
184 | dpfc_ctl |= DPFC_CTL_LIMIT_1X; | 184 | dpfc_ctl |= DPFC_CTL_LIMIT_1X; |
185 | 185 | ||
186 | if (params->vma->fence) { | 186 | if (params->flags & PLANE_HAS_FENCE) { |
187 | dpfc_ctl |= DPFC_CTL_FENCE_EN | params->vma->fence->id; | 187 | dpfc_ctl |= DPFC_CTL_FENCE_EN | params->vma->fence->id; |
188 | I915_WRITE(DPFC_FENCE_YOFF, params->crtc.fence_y_offset); | 188 | I915_WRITE(DPFC_FENCE_YOFF, params->crtc.fence_y_offset); |
189 | } else { | 189 | } else { |
@@ -241,7 +241,7 @@ static void ilk_fbc_activate(struct drm_i915_private *dev_priv) | |||
241 | break; | 241 | break; |
242 | } | 242 | } |
243 | 243 | ||
244 | if (params->vma->fence) { | 244 | if (params->flags & PLANE_HAS_FENCE) { |
245 | dpfc_ctl |= DPFC_CTL_FENCE_EN; | 245 | dpfc_ctl |= DPFC_CTL_FENCE_EN; |
246 | if (IS_GEN5(dev_priv)) | 246 | if (IS_GEN5(dev_priv)) |
247 | dpfc_ctl |= params->vma->fence->id; | 247 | dpfc_ctl |= params->vma->fence->id; |
@@ -324,7 +324,7 @@ static void gen7_fbc_activate(struct drm_i915_private *dev_priv) | |||
324 | break; | 324 | break; |
325 | } | 325 | } |
326 | 326 | ||
327 | if (params->vma->fence) { | 327 | if (params->flags & PLANE_HAS_FENCE) { |
328 | dpfc_ctl |= IVB_DPFC_CTL_FENCE_EN; | 328 | dpfc_ctl |= IVB_DPFC_CTL_FENCE_EN; |
329 | I915_WRITE(SNB_DPFC_CTL_SA, | 329 | I915_WRITE(SNB_DPFC_CTL_SA, |
330 | SNB_CPU_FENCE_ENABLE | | 330 | SNB_CPU_FENCE_ENABLE | |
@@ -753,6 +753,7 @@ static void intel_fbc_update_state_cache(struct intel_crtc *crtc, | |||
753 | struct drm_framebuffer *fb = plane_state->base.fb; | 753 | struct drm_framebuffer *fb = plane_state->base.fb; |
754 | 754 | ||
755 | cache->vma = NULL; | 755 | cache->vma = NULL; |
756 | cache->flags = 0; | ||
756 | 757 | ||
757 | cache->crtc.mode_flags = crtc_state->base.adjusted_mode.flags; | 758 | cache->crtc.mode_flags = crtc_state->base.adjusted_mode.flags; |
758 | if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv)) | 759 | if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv)) |
@@ -778,6 +779,9 @@ static void intel_fbc_update_state_cache(struct intel_crtc *crtc, | |||
778 | cache->fb.stride = fb->pitches[0]; | 779 | cache->fb.stride = fb->pitches[0]; |
779 | 780 | ||
780 | cache->vma = plane_state->vma; | 781 | cache->vma = plane_state->vma; |
782 | cache->flags = plane_state->flags; | ||
783 | if (WARN_ON(cache->flags & PLANE_HAS_FENCE && !cache->vma->fence)) | ||
784 | cache->flags &= ~PLANE_HAS_FENCE; | ||
781 | } | 785 | } |
782 | 786 | ||
783 | static bool intel_fbc_can_activate(struct intel_crtc *crtc) | 787 | static bool intel_fbc_can_activate(struct intel_crtc *crtc) |
@@ -817,7 +821,7 @@ static bool intel_fbc_can_activate(struct intel_crtc *crtc) | |||
817 | * so have no fence associated with it) due to aperture constaints | 821 | * so have no fence associated with it) due to aperture constaints |
818 | * at the time of pinning. | 822 | * at the time of pinning. |
819 | */ | 823 | */ |
820 | if (!cache->vma->fence) { | 824 | if (!(cache->flags & PLANE_HAS_FENCE)) { |
821 | fbc->no_fbc_reason = "framebuffer not tiled or fenced"; | 825 | fbc->no_fbc_reason = "framebuffer not tiled or fenced"; |
822 | return false; | 826 | return false; |
823 | } | 827 | } |
@@ -898,6 +902,7 @@ static void intel_fbc_get_reg_params(struct intel_crtc *crtc, | |||
898 | memset(params, 0, sizeof(*params)); | 902 | memset(params, 0, sizeof(*params)); |
899 | 903 | ||
900 | params->vma = cache->vma; | 904 | params->vma = cache->vma; |
905 | params->flags = cache->flags; | ||
901 | 906 | ||
902 | params->crtc.pipe = crtc->pipe; | 907 | params->crtc.pipe = crtc->pipe; |
903 | params->crtc.i9xx_plane = to_intel_plane(crtc->base.primary)->i9xx_plane; | 908 | params->crtc.i9xx_plane = to_intel_plane(crtc->base.primary)->i9xx_plane; |