提交 1c9b6b13 编写于 作者: C Chris Wilson

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: NVille Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180220134208.24988-4-chris@chris-wilson.co.uk
上级 e3c017f1
...@@ -667,6 +667,7 @@ struct intel_fbc { ...@@ -667,6 +667,7 @@ struct intel_fbc {
*/ */
struct intel_fbc_state_cache { struct intel_fbc_state_cache {
struct i915_vma *vma; struct i915_vma *vma;
unsigned long flags;
struct { struct {
unsigned int mode_flags; unsigned int mode_flags;
...@@ -705,6 +706,7 @@ struct intel_fbc { ...@@ -705,6 +706,7 @@ struct intel_fbc {
*/ */
struct intel_fbc_reg_params { struct intel_fbc_reg_params {
struct i915_vma *vma; struct i915_vma *vma;
unsigned long flags;
struct { struct {
enum pipe pipe; enum pipe pipe;
......
...@@ -183,7 +183,7 @@ static void g4x_fbc_activate(struct drm_i915_private *dev_priv) ...@@ -183,7 +183,7 @@ static void g4x_fbc_activate(struct drm_i915_private *dev_priv)
else else
dpfc_ctl |= DPFC_CTL_LIMIT_1X; dpfc_ctl |= DPFC_CTL_LIMIT_1X;
if (params->vma->fence) { if (params->flags & PLANE_HAS_FENCE) {
dpfc_ctl |= DPFC_CTL_FENCE_EN | params->vma->fence->id; dpfc_ctl |= DPFC_CTL_FENCE_EN | params->vma->fence->id;
I915_WRITE(DPFC_FENCE_YOFF, params->crtc.fence_y_offset); I915_WRITE(DPFC_FENCE_YOFF, params->crtc.fence_y_offset);
} else { } else {
...@@ -241,7 +241,7 @@ static void ilk_fbc_activate(struct drm_i915_private *dev_priv) ...@@ -241,7 +241,7 @@ static void ilk_fbc_activate(struct drm_i915_private *dev_priv)
break; break;
} }
if (params->vma->fence) { if (params->flags & PLANE_HAS_FENCE) {
dpfc_ctl |= DPFC_CTL_FENCE_EN; dpfc_ctl |= DPFC_CTL_FENCE_EN;
if (IS_GEN5(dev_priv)) if (IS_GEN5(dev_priv))
dpfc_ctl |= params->vma->fence->id; dpfc_ctl |= params->vma->fence->id;
...@@ -324,7 +324,7 @@ static void gen7_fbc_activate(struct drm_i915_private *dev_priv) ...@@ -324,7 +324,7 @@ static void gen7_fbc_activate(struct drm_i915_private *dev_priv)
break; break;
} }
if (params->vma->fence) { if (params->flags & PLANE_HAS_FENCE) {
dpfc_ctl |= IVB_DPFC_CTL_FENCE_EN; dpfc_ctl |= IVB_DPFC_CTL_FENCE_EN;
I915_WRITE(SNB_DPFC_CTL_SA, I915_WRITE(SNB_DPFC_CTL_SA,
SNB_CPU_FENCE_ENABLE | SNB_CPU_FENCE_ENABLE |
...@@ -753,6 +753,7 @@ static void intel_fbc_update_state_cache(struct intel_crtc *crtc, ...@@ -753,6 +753,7 @@ static void intel_fbc_update_state_cache(struct intel_crtc *crtc,
struct drm_framebuffer *fb = plane_state->base.fb; struct drm_framebuffer *fb = plane_state->base.fb;
cache->vma = NULL; cache->vma = NULL;
cache->flags = 0;
cache->crtc.mode_flags = crtc_state->base.adjusted_mode.flags; cache->crtc.mode_flags = crtc_state->base.adjusted_mode.flags;
if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv)) 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,6 +779,9 @@ static void intel_fbc_update_state_cache(struct intel_crtc *crtc,
cache->fb.stride = fb->pitches[0]; cache->fb.stride = fb->pitches[0];
cache->vma = plane_state->vma; cache->vma = plane_state->vma;
cache->flags = plane_state->flags;
if (WARN_ON(cache->flags & PLANE_HAS_FENCE && !cache->vma->fence))
cache->flags &= ~PLANE_HAS_FENCE;
} }
static bool intel_fbc_can_activate(struct intel_crtc *crtc) 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,7 +821,7 @@ static bool intel_fbc_can_activate(struct intel_crtc *crtc)
* so have no fence associated with it) due to aperture constaints * so have no fence associated with it) due to aperture constaints
* at the time of pinning. * at the time of pinning.
*/ */
if (!cache->vma->fence) { if (!(cache->flags & PLANE_HAS_FENCE)) {
fbc->no_fbc_reason = "framebuffer not tiled or fenced"; fbc->no_fbc_reason = "framebuffer not tiled or fenced";
return false; return false;
} }
...@@ -898,6 +902,7 @@ static void intel_fbc_get_reg_params(struct intel_crtc *crtc, ...@@ -898,6 +902,7 @@ static void intel_fbc_get_reg_params(struct intel_crtc *crtc,
memset(params, 0, sizeof(*params)); memset(params, 0, sizeof(*params));
params->vma = cache->vma; params->vma = cache->vma;
params->flags = cache->flags;
params->crtc.pipe = crtc->pipe; params->crtc.pipe = crtc->pipe;
params->crtc.i9xx_plane = to_intel_plane(crtc->base.primary)->i9xx_plane; params->crtc.i9xx_plane = to_intel_plane(crtc->base.primary)->i9xx_plane;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册