Commit 97a978e2 authored by Ville Syrjälä's avatar Ville Syrjälä

drm/i915/fbc: Store fence_id directly in fbc cache/params

Rather than playing around with vma+flags let's just grab
the fence id from within and stash that directly in the fbc
cache/params.
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20191127201222.16669-8-ville.syrjala@linux.intel.comReviewed-by: default avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
parent 8bdbe1be
...@@ -151,7 +151,7 @@ static void i8xx_fbc_activate(struct drm_i915_private *dev_priv) ...@@ -151,7 +151,7 @@ static void i8xx_fbc_activate(struct drm_i915_private *dev_priv)
if (IS_I945GM(dev_priv)) if (IS_I945GM(dev_priv))
fbc_ctl |= FBC_CTL_C3_IDLE; /* 945 needs special SR handling */ fbc_ctl |= FBC_CTL_C3_IDLE; /* 945 needs special SR handling */
fbc_ctl |= (cfb_pitch & 0xff) << FBC_CTL_STRIDE_SHIFT; fbc_ctl |= (cfb_pitch & 0xff) << FBC_CTL_STRIDE_SHIFT;
fbc_ctl |= params->vma->fence->id; fbc_ctl |= params->fence_id;
I915_WRITE(FBC_CONTROL, fbc_ctl); I915_WRITE(FBC_CONTROL, fbc_ctl);
} }
...@@ -171,8 +171,8 @@ static void g4x_fbc_activate(struct drm_i915_private *dev_priv) ...@@ -171,8 +171,8 @@ 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->flags & PLANE_HAS_FENCE) { if (params->fence_id >= 0) {
dpfc_ctl |= DPFC_CTL_FENCE_EN | params->vma->fence->id; dpfc_ctl |= DPFC_CTL_FENCE_EN | params->fence_id;
I915_WRITE(DPFC_FENCE_YOFF, params->crtc.fence_y_offset); I915_WRITE(DPFC_FENCE_YOFF, params->crtc.fence_y_offset);
} else { } else {
I915_WRITE(DPFC_FENCE_YOFF, 0); I915_WRITE(DPFC_FENCE_YOFF, 0);
...@@ -229,14 +229,14 @@ static void ilk_fbc_activate(struct drm_i915_private *dev_priv) ...@@ -229,14 +229,14 @@ static void ilk_fbc_activate(struct drm_i915_private *dev_priv)
break; break;
} }
if (params->flags & PLANE_HAS_FENCE) { if (params->fence_id >= 0) {
dpfc_ctl |= DPFC_CTL_FENCE_EN; dpfc_ctl |= DPFC_CTL_FENCE_EN;
if (IS_GEN(dev_priv, 5)) if (IS_GEN(dev_priv, 5))
dpfc_ctl |= params->vma->fence->id; dpfc_ctl |= params->fence_id;
if (IS_GEN(dev_priv, 6)) { if (IS_GEN(dev_priv, 6)) {
I915_WRITE(SNB_DPFC_CTL_SA, I915_WRITE(SNB_DPFC_CTL_SA,
SNB_CPU_FENCE_ENABLE | SNB_CPU_FENCE_ENABLE |
params->vma->fence->id); params->fence_id);
I915_WRITE(DPFC_CPU_FENCE_OFFSET, I915_WRITE(DPFC_CPU_FENCE_OFFSET,
params->crtc.fence_y_offset); params->crtc.fence_y_offset);
} }
...@@ -309,11 +309,11 @@ static void gen7_fbc_activate(struct drm_i915_private *dev_priv) ...@@ -309,11 +309,11 @@ static void gen7_fbc_activate(struct drm_i915_private *dev_priv)
break; break;
} }
if (params->flags & PLANE_HAS_FENCE) { if (params->fence_id >= 0) {
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 |
params->vma->fence->id); params->fence_id);
I915_WRITE(DPFC_CPU_FENCE_OFFSET, params->crtc.fence_y_offset); I915_WRITE(DPFC_CPU_FENCE_OFFSET, params->crtc.fence_y_offset);
} else { } else {
I915_WRITE(SNB_DPFC_CTL_SA,0); I915_WRITE(SNB_DPFC_CTL_SA,0);
...@@ -659,10 +659,14 @@ static void intel_fbc_update_state_cache(struct intel_crtc *crtc, ...@@ -659,10 +659,14 @@ static void intel_fbc_update_state_cache(struct intel_crtc *crtc,
cache->fb.format = fb->format; cache->fb.format = fb->format;
cache->fb.stride = fb->pitches[0]; cache->fb.stride = fb->pitches[0];
cache->vma = plane_state->vma; WARN_ON(plane_state->flags & PLANE_HAS_FENCE &&
cache->flags = plane_state->flags; !plane_state->vma->fence);
if (WARN_ON(cache->flags & PLANE_HAS_FENCE && !cache->vma->fence))
cache->flags &= ~PLANE_HAS_FENCE; if (plane_state->flags & PLANE_HAS_FENCE &&
plane_state->vma->fence)
cache->fence_id = plane_state->vma->fence->id;
else
cache->fence_id = -1;
} }
static bool intel_fbc_can_activate(struct intel_crtc *crtc) static bool intel_fbc_can_activate(struct intel_crtc *crtc)
...@@ -707,7 +711,7 @@ static bool intel_fbc_can_activate(struct intel_crtc *crtc) ...@@ -707,7 +711,7 @@ static bool intel_fbc_can_activate(struct intel_crtc *crtc)
* For now this will effecively disable FBC with 90/270 degree * For now this will effecively disable FBC with 90/270 degree
* rotation. * rotation.
*/ */
if (!(cache->flags & PLANE_HAS_FENCE)) { if (cache->fence_id < 0) {
fbc->no_fbc_reason = "framebuffer not tiled or fenced"; fbc->no_fbc_reason = "framebuffer not tiled or fenced";
return false; return false;
} }
...@@ -804,8 +808,7 @@ static void intel_fbc_get_reg_params(struct intel_crtc *crtc, ...@@ -804,8 +808,7 @@ static void intel_fbc_get_reg_params(struct intel_crtc *crtc,
* zero. */ * zero. */
memset(params, 0, sizeof(*params)); memset(params, 0, sizeof(*params));
params->vma = cache->vma; params->fence_id = cache->fence_id;
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;
......
...@@ -386,9 +386,6 @@ struct intel_fbc { ...@@ -386,9 +386,6 @@ struct intel_fbc {
* these problems. * these problems.
*/ */
struct intel_fbc_state_cache { struct intel_fbc_state_cache {
struct i915_vma *vma;
unsigned long flags;
struct { struct {
unsigned int mode_flags; unsigned int mode_flags;
u32 hsw_bdw_pixel_rate; u32 hsw_bdw_pixel_rate;
...@@ -418,6 +415,7 @@ struct intel_fbc { ...@@ -418,6 +415,7 @@ struct intel_fbc {
unsigned int stride; unsigned int stride;
} fb; } fb;
u16 gen9_wa_cfb_stride; u16 gen9_wa_cfb_stride;
s8 fence_id;
} state_cache; } state_cache;
/* /*
...@@ -428,9 +426,6 @@ struct intel_fbc { ...@@ -428,9 +426,6 @@ struct intel_fbc {
* are supposed to read from it in order to program the registers. * are supposed to read from it in order to program the registers.
*/ */
struct intel_fbc_reg_params { struct intel_fbc_reg_params {
struct i915_vma *vma;
unsigned long flags;
struct { struct {
enum pipe pipe; enum pipe pipe;
enum i9xx_plane_id i9xx_plane; enum i9xx_plane_id i9xx_plane;
...@@ -444,6 +439,7 @@ struct intel_fbc { ...@@ -444,6 +439,7 @@ struct intel_fbc {
int cfb_size; int cfb_size;
u16 gen9_wa_cfb_stride; u16 gen9_wa_cfb_stride;
s8 fence_id;
bool plane_visible; bool plane_visible;
} params; } params;
......
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