[Intel-gfx] [PATCH 16/24] drm/i915: atomic plane updates in a nutshell
Maarten Lankhorst
maarten.lankhorst at linux.intel.com
Mon Jun 1 06:27:19 PDT 2015
Now that all planes are added during a modeset we can use the
calculated changes before disabling a plane, and then either commit
or force disable a plane before disabling the crtc.
The code is shared with atomic_begin/flush, except watermark updating
and vblank evasion are not used.
Signed-off-by: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
---
drivers/gpu/drm/i915/intel_display.c | 124 ++++++++---------------------------
drivers/gpu/drm/i915/intel_sprite.c | 3 -
2 files changed, 29 insertions(+), 98 deletions(-)
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 12da97d9f386..e2a1c4c01032 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -109,8 +109,6 @@ static void skl_init_scalers(struct drm_device *dev, struct intel_crtc *intel_cr
struct intel_crtc_state *crtc_state);
static int i9xx_get_refclk(const struct intel_crtc_state *crtc_state,
int num_connectors);
-static void intel_crtc_enable_planes(struct drm_crtc *crtc);
-static void intel_crtc_disable_planes(struct drm_crtc *crtc);
static struct intel_encoder *intel_find_encoder(struct intel_connector *connector, int pipe)
{
@@ -2215,28 +2213,6 @@ static void intel_disable_pipe(struct intel_crtc *crtc)
intel_wait_for_pipe_off(crtc);
}
-/**
- * intel_enable_primary_hw_plane - enable the primary plane on a given pipe
- * @plane: plane to be enabled
- * @crtc: crtc for the plane
- *
- * Enable @plane on @crtc, making sure that the pipe is running first.
- */
-static void intel_enable_primary_hw_plane(struct drm_plane *plane,
- struct drm_crtc *crtc)
-{
- struct drm_device *dev = plane->dev;
- struct drm_i915_private *dev_priv = dev->dev_private;
- struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
-
- /* If the pipe isn't enabled, we can't pump pixels and may hang */
- assert_pipe_enabled(dev_priv, intel_crtc->pipe);
- to_intel_plane_state(plane->state)->visible = true;
-
- dev_priv->display.update_primary_plane(crtc, plane->fb,
- crtc->x, crtc->y);
-}
-
static bool need_vtd_wa(struct drm_device *dev)
{
#ifdef CONFIG_INTEL_IOMMU
@@ -4501,20 +4477,6 @@ static void ironlake_pfit_enable(struct intel_crtc *crtc)
}
}
-static void intel_enable_sprite_planes(struct drm_crtc *crtc)
-{
- struct drm_device *dev = crtc->dev;
- enum pipe pipe = to_intel_crtc(crtc)->pipe;
- struct drm_plane *plane;
- struct intel_plane *intel_plane;
-
- drm_for_each_legacy_plane(plane, &dev->mode_config.plane_list) {
- intel_plane = to_intel_plane(plane);
- if (intel_plane->pipe == pipe)
- intel_plane_restore(&intel_plane->base);
- }
-}
-
void hsw_enable_ips(struct intel_crtc *crtc)
{
struct drm_device *dev = crtc->base.dev;
@@ -4815,51 +4777,31 @@ static void intel_pre_plane_update(struct intel_crtc *crtc)
static void intel_crtc_enable_planes(struct drm_crtc *crtc)
{
- struct drm_device *dev = crtc->dev;
- struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
- int pipe = intel_crtc->pipe;
-
- intel_enable_primary_hw_plane(crtc->primary, crtc);
- intel_enable_sprite_planes(crtc);
- intel_crtc_update_cursor(crtc, true);
+ struct drm_plane *p;
- intel_post_enable_primary(crtc);
+ drm_for_each_plane_mask(p, crtc->dev, crtc->state->plane_mask) {
+ struct intel_plane *plane = to_intel_plane(p);
- /*
- * FIXME: Once we grow proper nuclear flip support out of this we need
- * to compute the mask of flip planes precisely. For the time being
- * consider this a flip to a NULL plane.
- */
- intel_frontbuffer_flip(dev, INTEL_FRONTBUFFER_ALL_MASK(pipe));
+ plane->commit_plane(p, to_intel_plane_state(p->state));
+ }
}
-static void intel_crtc_disable_planes(struct drm_crtc *crtc)
+static void intel_crtc_disable_planes(struct drm_crtc *crtc,
+ struct drm_crtc_state *old_crtc_state)
{
- struct drm_device *dev = crtc->dev;
struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
- struct intel_plane *intel_plane;
- int pipe = intel_crtc->pipe;
-
- intel_crtc_wait_for_pending_flips(crtc);
-
- intel_pre_disable_primary(crtc);
+ struct drm_plane *p;
intel_crtc_dpms_overlay_disable(intel_crtc);
- for_each_intel_plane(dev, intel_plane) {
- if (intel_plane->pipe == pipe) {
- struct drm_crtc *from = intel_plane->base.crtc;
- intel_plane->disable_plane(&intel_plane->base,
- from ?: crtc, true);
- }
- }
+ drm_for_each_plane_mask(p, crtc->dev, old_crtc_state->plane_mask) {
+ struct intel_plane *plane = to_intel_plane(p);
- /*
- * FIXME: Once we grow proper nuclear flip support out of this we need
- * to compute the mask of flip planes precisely. For the time being
- * consider this a flip to a NULL plane.
- */
- intel_frontbuffer_flip(dev, INTEL_FRONTBUFFER_ALL_MASK(pipe));
+ if (crtc->state->active)
+ plane->disable_plane(p, crtc, true);
+ else
+ plane->commit_plane(p, to_intel_plane_state(p->state));
+ }
}
static void ironlake_crtc_enable(struct drm_crtc *crtc)
@@ -11505,10 +11447,6 @@ int intel_plane_atomic_calc_changes(struct drm_crtc_state *crtc_state,
if (old_plane_state->base.fb && !fb)
intel_crtc->atomic.disabled_planes |= 1 << i;
- /* don't run rest during modeset yet */
- if (!intel_crtc->active || mode_changed)
- return 0;
-
DRM_DEBUG_ATOMIC("[CRTC:%i] was enabled %i now enabled: %i\n",
idx, was_crtc_enabled, is_crtc_enabled);
@@ -12895,11 +12833,11 @@ static int __intel_set_mode(struct drm_atomic_state *state)
continue;
any_ms = true;
- if (!crtc_state->active)
- continue;
-
- intel_crtc_disable_planes(crtc);
- dev_priv->display.crtc_disable(crtc);
+ intel_pre_plane_update(to_intel_crtc(crtc));
+ if (crtc_state->active) {
+ intel_crtc_disable_planes(crtc, crtc_state);
+ dev_priv->display.crtc_disable(crtc);
+ }
}
/* Only after disabling all output pipelines that will be changed can we
@@ -12913,15 +12851,17 @@ static int __intel_set_mode(struct drm_atomic_state *state)
/* Now enable the clocks, plane, pipe, and connectors that we set up. */
for_each_crtc_in_state(state, crtc, crtc_state, i) {
- drm_atomic_helper_commit_planes_on_crtc(crtc_state);
-
- if (!needs_modeset(crtc->state) || !crtc->state->active)
+ if (!needs_modeset(crtc->state)) {
+ drm_atomic_helper_commit_planes_on_crtc(crtc_state);
continue;
+ }
- update_scanline_offset(to_intel_crtc(crtc));
-
- dev_priv->display.crtc_enable(crtc);
- intel_crtc_enable_planes(crtc);
+ if (crtc->state->active) {
+ update_scanline_offset(to_intel_crtc(crtc));
+ dev_priv->display.crtc_enable(crtc);
+ intel_crtc_enable_planes(crtc);
+ }
+ intel_post_plane_update(to_intel_crtc(crtc));
}
/* FIXME: add subpixel order */
@@ -13498,9 +13438,6 @@ intel_commit_primary_plane(struct drm_plane *plane,
crtc->x = src->x1 >> 16;
crtc->y = src->y1 >> 16;
- if (!intel_crtc->active)
- return;
-
if (state->visible)
/* FIXME: kill this fastboot hack */
intel_update_pipe_size(intel_crtc);
@@ -13758,9 +13695,6 @@ intel_commit_cursor_plane(struct drm_plane *plane,
crtc->cursor_x = state->base.crtc_x;
crtc->cursor_y = state->base.crtc_y;
- if (!intel_crtc->active)
- return;
-
if (intel_crtc->cursor_bo == obj)
goto update;
diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
index 6b5d25f2a90b..5443e16f307e 100644
--- a/drivers/gpu/drm/i915/intel_sprite.c
+++ b/drivers/gpu/drm/i915/intel_sprite.c
@@ -936,9 +936,6 @@ intel_commit_sprite_plane(struct drm_plane *plane,
plane->fb = fb;
- if (!intel_crtc->active)
- return;
-
if (state->visible) {
intel_plane->update_plane(plane, crtc, fb,
state->dst.x1, state->dst.y1,
--
2.1.0
More information about the Intel-gfx
mailing list