Commit 8693ee2e authored by Ville Syrjälä's avatar Ville Syrjälä

drm/i915: Add plane vfuncs to enable/disable flip_done interrupt

Prepare for more platforms with async flip support by turning
the flip_done interrupt enable/disable into plane vfuncs.

Cc: Karthik B S <karthik.b.s@intel.com>
Cc: Vandita Kulkarni <vandita.kulkarni@intel.com>
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210111163711.12913-6-ville.syrjala@linux.intel.comReviewed-by: default avatarKarthik B S <karthik.b.s@intel.com>
parent 30b61720
...@@ -4786,6 +4786,42 @@ static void intel_post_plane_update(struct intel_atomic_state *state, ...@@ -4786,6 +4786,42 @@ static void intel_post_plane_update(struct intel_atomic_state *state,
icl_wa_scalerclkgating(dev_priv, pipe, false); icl_wa_scalerclkgating(dev_priv, pipe, false);
} }
static void intel_crtc_enable_flip_done(struct intel_atomic_state *state,
struct intel_crtc *crtc)
{
const struct intel_crtc_state *crtc_state =
intel_atomic_get_new_crtc_state(state, crtc);
u8 update_planes = crtc_state->update_planes;
const struct intel_plane_state *plane_state;
struct intel_plane *plane;
int i;
for_each_new_intel_plane_in_state(state, plane, plane_state, i) {
if (plane->enable_flip_done &&
plane->pipe == crtc->pipe &&
update_planes & BIT(plane->id))
plane->enable_flip_done(plane);
}
}
static void intel_crtc_disable_flip_done(struct intel_atomic_state *state,
struct intel_crtc *crtc)
{
const struct intel_crtc_state *crtc_state =
intel_atomic_get_new_crtc_state(state, crtc);
u8 update_planes = crtc_state->update_planes;
const struct intel_plane_state *plane_state;
struct intel_plane *plane;
int i;
for_each_new_intel_plane_in_state(state, plane, plane_state, i) {
if (plane->disable_flip_done &&
plane->pipe == crtc->pipe &&
update_planes & BIT(plane->id))
plane->disable_flip_done(plane);
}
}
static void skl_disable_async_flip_wa(struct intel_atomic_state *state, static void skl_disable_async_flip_wa(struct intel_atomic_state *state,
struct intel_crtc *crtc, struct intel_crtc *crtc,
const struct intel_crtc_state *new_crtc_state) const struct intel_crtc_state *new_crtc_state)
...@@ -12210,7 +12246,7 @@ static void kill_bigjoiner_slave(struct intel_atomic_state *state, ...@@ -12210,7 +12246,7 @@ static void kill_bigjoiner_slave(struct intel_atomic_state *state,
* Async flip can only change the plane surface address, so anything else * Async flip can only change the plane surface address, so anything else
* changing is rejected from the intel_atomic_check_async() function. * changing is rejected from the intel_atomic_check_async() function.
* Once this check is cleared, flip done interrupt is enabled using * Once this check is cleared, flip done interrupt is enabled using
* the skl_enable_flip_done() function. * the intel_crtc_enable_flip_done() function.
* *
* As soon as the surface address register is written, flip done interrupt is * As soon as the surface address register is written, flip done interrupt is
* generated and the requested events are sent to the usersapce in the interrupt * generated and the requested events are sent to the usersapce in the interrupt
...@@ -13155,7 +13191,7 @@ static void intel_atomic_commit_tail(struct intel_atomic_state *state) ...@@ -13155,7 +13191,7 @@ static void intel_atomic_commit_tail(struct intel_atomic_state *state)
for_each_new_intel_crtc_in_state(state, crtc, new_crtc_state, i) { for_each_new_intel_crtc_in_state(state, crtc, new_crtc_state, i) {
if (new_crtc_state->uapi.async_flip) if (new_crtc_state->uapi.async_flip)
skl_enable_flip_done(crtc); intel_crtc_enable_flip_done(state, crtc);
} }
/* Now enable the clocks, plane, pipe, and connectors that we set up. */ /* Now enable the clocks, plane, pipe, and connectors that we set up. */
...@@ -13180,7 +13216,7 @@ static void intel_atomic_commit_tail(struct intel_atomic_state *state) ...@@ -13180,7 +13216,7 @@ static void intel_atomic_commit_tail(struct intel_atomic_state *state)
for_each_new_intel_crtc_in_state(state, crtc, new_crtc_state, i) { for_each_new_intel_crtc_in_state(state, crtc, new_crtc_state, i) {
if (new_crtc_state->uapi.async_flip) if (new_crtc_state->uapi.async_flip)
skl_disable_flip_done(crtc); intel_crtc_disable_flip_done(state, crtc);
if (new_crtc_state->hw.active && if (new_crtc_state->hw.active &&
!intel_crtc_needs_modeset(new_crtc_state) && !intel_crtc_needs_modeset(new_crtc_state) &&
......
...@@ -1268,6 +1268,8 @@ struct intel_plane { ...@@ -1268,6 +1268,8 @@ struct intel_plane {
void (*async_flip)(struct intel_plane *plane, void (*async_flip)(struct intel_plane *plane,
const struct intel_crtc_state *crtc_state, const struct intel_crtc_state *crtc_state,
const struct intel_plane_state *plane_state); const struct intel_plane_state *plane_state);
void (*enable_flip_done)(struct intel_plane *plane);
void (*disable_flip_done)(struct intel_plane *plane);
}; };
struct intel_watermark_params { struct intel_watermark_params {
......
...@@ -958,6 +958,28 @@ skl_plane_get_hw_state(struct intel_plane *plane, ...@@ -958,6 +958,28 @@ skl_plane_get_hw_state(struct intel_plane *plane,
return ret; return ret;
} }
static void
skl_plane_enable_flip_done(struct intel_plane *plane)
{
struct drm_i915_private *i915 = to_i915(plane->base.dev);
enum pipe pipe = plane->pipe;
spin_lock_irq(&i915->irq_lock);
bdw_enable_pipe_irq(i915, pipe, GEN9_PIPE_PLANE_FLIP_DONE(plane->id));
spin_unlock_irq(&i915->irq_lock);
}
static void
skl_plane_disable_flip_done(struct intel_plane *plane)
{
struct drm_i915_private *i915 = to_i915(plane->base.dev);
enum pipe pipe = plane->pipe;
spin_lock_irq(&i915->irq_lock);
bdw_disable_pipe_irq(i915, pipe, GEN9_PIPE_PLANE_FLIP_DONE(plane->id));
spin_unlock_irq(&i915->irq_lock);
}
static void i9xx_plane_linear_gamma(u16 gamma[8]) static void i9xx_plane_linear_gamma(u16 gamma[8])
{ {
/* The points are not evenly spaced. */ /* The points are not evenly spaced. */
...@@ -3291,8 +3313,11 @@ skl_universal_plane_create(struct drm_i915_private *dev_priv, ...@@ -3291,8 +3313,11 @@ skl_universal_plane_create(struct drm_i915_private *dev_priv,
plane->check_plane = skl_plane_check; plane->check_plane = skl_plane_check;
plane->min_cdclk = skl_plane_min_cdclk; plane->min_cdclk = skl_plane_min_cdclk;
if (plane_id == PLANE_PRIMARY) if (plane_id == PLANE_PRIMARY) {
plane->async_flip = skl_plane_async_flip; plane->async_flip = skl_plane_async_flip;
plane->enable_flip_done = skl_plane_enable_flip_done;
plane->disable_flip_done = skl_plane_disable_flip_done;
}
if (INTEL_GEN(dev_priv) >= 11) if (INTEL_GEN(dev_priv) >= 11)
formats = icl_get_plane_formats(dev_priv, pipe, formats = icl_get_plane_formats(dev_priv, pipe,
......
...@@ -2822,19 +2822,6 @@ int bdw_enable_vblank(struct drm_crtc *crtc) ...@@ -2822,19 +2822,6 @@ int bdw_enable_vblank(struct drm_crtc *crtc)
return 0; return 0;
} }
void skl_enable_flip_done(struct intel_crtc *crtc)
{
struct drm_i915_private *i915 = to_i915(crtc->base.dev);
enum pipe pipe = crtc->pipe;
unsigned long irqflags;
spin_lock_irqsave(&i915->irq_lock, irqflags);
bdw_enable_pipe_irq(i915, pipe, GEN9_PIPE_PLANE1_FLIP_DONE);
spin_unlock_irqrestore(&i915->irq_lock, irqflags);
}
/* Called from drm generic code, passed 'crtc' which /* Called from drm generic code, passed 'crtc' which
* we use as a pipe index * we use as a pipe index
*/ */
...@@ -2899,19 +2886,6 @@ void bdw_disable_vblank(struct drm_crtc *crtc) ...@@ -2899,19 +2886,6 @@ void bdw_disable_vblank(struct drm_crtc *crtc)
spin_unlock_irqrestore(&dev_priv->irq_lock, irqflags); spin_unlock_irqrestore(&dev_priv->irq_lock, irqflags);
} }
void skl_disable_flip_done(struct intel_crtc *crtc)
{
struct drm_i915_private *i915 = to_i915(crtc->base.dev);
enum pipe pipe = crtc->pipe;
unsigned long irqflags;
spin_lock_irqsave(&i915->irq_lock, irqflags);
bdw_disable_pipe_irq(i915, pipe, GEN9_PIPE_PLANE1_FLIP_DONE);
spin_unlock_irqrestore(&i915->irq_lock, irqflags);
}
static void ibx_irq_reset(struct drm_i915_private *dev_priv) static void ibx_irq_reset(struct drm_i915_private *dev_priv)
{ {
struct intel_uncore *uncore = &dev_priv->uncore; struct intel_uncore *uncore = &dev_priv->uncore;
......
...@@ -118,9 +118,6 @@ void i965_disable_vblank(struct drm_crtc *crtc); ...@@ -118,9 +118,6 @@ void i965_disable_vblank(struct drm_crtc *crtc);
void ilk_disable_vblank(struct drm_crtc *crtc); void ilk_disable_vblank(struct drm_crtc *crtc);
void bdw_disable_vblank(struct drm_crtc *crtc); void bdw_disable_vblank(struct drm_crtc *crtc);
void skl_enable_flip_done(struct intel_crtc *crtc);
void skl_disable_flip_done(struct intel_crtc *crtc);
void gen2_irq_reset(struct intel_uncore *uncore); void gen2_irq_reset(struct intel_uncore *uncore);
void gen3_irq_reset(struct intel_uncore *uncore, i915_reg_t imr, void gen3_irq_reset(struct intel_uncore *uncore, i915_reg_t imr,
i915_reg_t iir, i915_reg_t ier); i915_reg_t iir, i915_reg_t ier);
......
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