From: Daniel Vetter <daniel@ffwll.ch>
To: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 04/35] drm/i915: get rid of primary_enabled and use atomic state
Date: Thu, 7 May 2015 09:43:08 +0200 [thread overview]
Message-ID: <20150507074308.GV30184@phenom.ffwll.local> (raw)
In-Reply-To: <1429625604-22252-5-git-send-email-ander.conselvan.de.oliveira@intel.com>
On Tue, Apr 21, 2015 at 05:12:53PM +0300, Ander Conselvan de Oliveira wrote:
> From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Generally a bit too terse commmit message. E.g. here a short summary of
our irc discussion about why it should be ok to remove this feature is
definitely needed. I added that.
But I prefer more verbose commit messages in general.
-Daniel
>
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Reviewed-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
> ---
> drivers/gpu/drm/i915/intel_display.c | 50 ++++++++++++++++++++----------------
> drivers/gpu/drm/i915/intel_drv.h | 1 -
> drivers/gpu/drm/i915/intel_fbc.c | 2 +-
> 3 files changed, 29 insertions(+), 24 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index acf3494..40e3c62 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -2236,11 +2236,7 @@ static void intel_enable_primary_hw_plane(struct drm_plane *plane,
>
> /* If the pipe isn't enabled, we can't pump pixels and may hang */
> assert_pipe_enabled(dev_priv, intel_crtc->pipe);
> -
> - if (intel_crtc->primary_enabled)
> - return;
> -
> - intel_crtc->primary_enabled = true;
> + to_intel_plane_state(plane->state)->visible = true;
>
> dev_priv->display.update_primary_plane(crtc, plane->fb,
> crtc->x, crtc->y);
> @@ -2661,6 +2657,8 @@ static void i9xx_update_primary_plane(struct drm_crtc *crtc,
> struct drm_device *dev = crtc->dev;
> struct drm_i915_private *dev_priv = dev->dev_private;
> struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
> + struct drm_plane *primary = crtc->primary;
> + bool visible = to_intel_plane_state(primary->state)->visible;
> struct drm_i915_gem_object *obj;
> int plane = intel_crtc->plane;
> unsigned long linear_offset;
> @@ -2668,7 +2666,7 @@ static void i9xx_update_primary_plane(struct drm_crtc *crtc,
> u32 reg = DSPCNTR(plane);
> int pixel_size;
>
> - if (!intel_crtc->primary_enabled || !fb) {
> + if (!visible || !fb) {
> I915_WRITE(reg, 0);
> if (INTEL_INFO(dev)->gen >= 4)
> I915_WRITE(DSPSURF(plane), 0);
> @@ -2790,6 +2788,8 @@ static void ironlake_update_primary_plane(struct drm_crtc *crtc,
> struct drm_device *dev = crtc->dev;
> struct drm_i915_private *dev_priv = dev->dev_private;
> struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
> + struct drm_plane *primary = crtc->primary;
> + bool visible = to_intel_plane_state(primary->state)->visible;
> struct drm_i915_gem_object *obj;
> int plane = intel_crtc->plane;
> unsigned long linear_offset;
> @@ -2797,7 +2797,7 @@ static void ironlake_update_primary_plane(struct drm_crtc *crtc,
> u32 reg = DSPCNTR(plane);
> int pixel_size;
>
> - if (!intel_crtc->primary_enabled || !fb) {
> + if (!visible || !fb) {
> I915_WRITE(reg, 0);
> I915_WRITE(DSPSURF(plane), 0);
> POSTING_READ(reg);
> @@ -2966,6 +2966,8 @@ static void skylake_update_primary_plane(struct drm_crtc *crtc,
> struct drm_device *dev = crtc->dev;
> struct drm_i915_private *dev_priv = dev->dev_private;
> struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
> + struct drm_plane *plane = crtc->primary;
> + bool visible = to_intel_plane_state(plane->state)->visible;
> struct drm_i915_gem_object *obj;
> int pipe = intel_crtc->pipe;
> u32 plane_ctl, stride_div, stride;
> @@ -2973,9 +2975,8 @@ static void skylake_update_primary_plane(struct drm_crtc *crtc,
> unsigned int rotation;
> int x_offset, y_offset;
> unsigned long surf_addr;
> - struct drm_plane *plane;
>
> - if (!intel_crtc->primary_enabled || !fb) {
> + if (!visible || !fb) {
> I915_WRITE(PLANE_CTL(pipe, 0), 0);
> I915_WRITE(PLANE_SURF(pipe, 0), 0);
> POSTING_READ(PLANE_CTL(pipe, 0));
> @@ -3035,7 +3036,6 @@ static void skylake_update_primary_plane(struct drm_crtc *crtc,
>
> plane_ctl |= PLANE_CTL_PLANE_GAMMA_DISABLE;
>
> - plane = crtc->primary;
> rotation = plane->state->rotation;
> switch (rotation) {
> case BIT(DRM_ROTATE_90):
> @@ -4699,7 +4699,6 @@ static void intel_crtc_disable_planes(struct drm_crtc *crtc)
> hsw_disable_ips(intel_crtc);
>
> intel_crtc_dpms_overlay(intel_crtc, false);
> - intel_crtc->primary_enabled = false;
> for_each_intel_plane(dev, intel_plane) {
> if (intel_plane->pipe == pipe) {
> struct drm_crtc *from = intel_plane->base.crtc;
> @@ -12803,6 +12802,9 @@ static int intel_crtc_set_config(struct drm_mode_set *set)
> } else if (config->fb_changed) {
> struct intel_crtc *intel_crtc = to_intel_crtc(set->crtc);
> struct drm_plane *primary = set->crtc->primary;
> + struct intel_plane_state *plane_state =
> + to_intel_plane_state(primary->state);
> + bool was_visible = plane_state->visible;
> int vdisplay, hdisplay;
>
> drm_crtc_get_hv_timing(set->mode, &hdisplay, &vdisplay);
> @@ -12815,7 +12817,8 @@ static int intel_crtc_set_config(struct drm_mode_set *set)
> * We need to make sure the primary plane is re-enabled if it
> * has previously been turned off.
> */
> - if (!intel_crtc->primary_enabled && ret == 0) {
> + plane_state = to_intel_plane_state(primary->state);
> + if (ret == 0 && !was_visible && plane_state->visible) {
> WARN_ON(!intel_crtc->active);
> intel_enable_primary_hw_plane(set->crtc->primary, set->crtc);
> }
> @@ -13113,6 +13116,9 @@ intel_check_primary_plane(struct drm_plane *plane,
> return ret;
>
> if (intel_crtc->active) {
> + struct intel_plane_state *old_state =
> + to_intel_plane_state(plane->state);
> +
> intel_crtc->atomic.wait_for_flips = true;
>
> /*
> @@ -13125,20 +13131,20 @@ intel_check_primary_plane(struct drm_plane *plane,
> * one is done too late. We eventually need to unify
> * this.
> */
> - if (intel_crtc->primary_enabled &&
> + if (state->visible &&
> INTEL_INFO(dev)->gen <= 4 && !IS_G4X(dev) &&
> dev_priv->fbc.crtc == intel_crtc &&
> state->base.rotation != BIT(DRM_ROTATE_0)) {
> intel_crtc->atomic.disable_fbc = true;
> }
>
> - if (state->visible) {
> + if (state->visible && !old_state->visible) {
> /*
> * BDW signals flip done immediately if the plane
> * is disabled, even if the plane enable is already
> * armed to occur at the next vblank :(
> */
> - if (IS_BROADWELL(dev) && !intel_crtc->primary_enabled)
> + if (IS_BROADWELL(dev))
> intel_crtc->atomic.wait_vblank = true;
> }
>
> @@ -13173,8 +13179,6 @@ intel_commit_primary_plane(struct drm_plane *plane,
> crtc->y = src->y1 >> 16;
>
> if (intel_crtc->active) {
> - intel_crtc->primary_enabled = state->visible;
> -
> if (state->visible)
> /* FIXME: kill this fastboot hack */
> intel_update_pipe_size(intel_crtc);
> @@ -13192,9 +13196,6 @@ intel_disable_primary_plane(struct drm_plane *plane,
> struct drm_device *dev = plane->dev;
> struct drm_i915_private *dev_priv = dev->dev_private;
>
> - if (!force)
> - to_intel_crtc(crtc)->primary_enabled = false;
> -
> dev_priv->display.update_primary_plane(crtc, NULL, 0, 0);
> }
>
> @@ -14655,8 +14656,8 @@ static void intel_sanitize_crtc(struct intel_crtc *crtc)
> * Temporarily change the plane mapping and disable everything
> * ... */
> plane = crtc->plane;
> + to_intel_plane_state(crtc->base.primary->state)->visible = true;
> crtc->plane = !plane;
> - crtc->primary_enabled = true;
> dev_priv->display.crtc_disable(&crtc->base);
> crtc->plane = plane;
>
> @@ -14833,6 +14834,9 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev)
> int i;
>
> for_each_intel_crtc(dev, crtc) {
> + struct drm_plane *primary = crtc->base.primary;
> + struct intel_plane_state *plane_state;
> +
> memset(crtc->config, 0, sizeof(*crtc->config));
>
> crtc->config->quirks |= PIPE_CONFIG_QUIRK_INHERITED_MODE;
> @@ -14842,7 +14846,9 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev)
>
> crtc->base.state->enable = crtc->active;
> crtc->base.enabled = crtc->active;
> - crtc->primary_enabled = primary_get_hw_state(crtc);
> +
> + plane_state = to_intel_plane_state(primary->state);
> + plane_state->visible = primary_get_hw_state(crtc);
>
> DRM_DEBUG_KMS("[CRTC:%d] hw state readout: %s\n",
> crtc->base.base.id,
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index 42548bc..cb0f29e 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -510,7 +510,6 @@ struct intel_crtc {
> */
> bool active;
> unsigned long enabled_power_domains;
> - bool primary_enabled; /* is the primary plane (partially) visible? */
> bool lowfreq_avail;
> struct intel_overlay *overlay;
> struct intel_unpin_work *unpin_work;
> diff --git a/drivers/gpu/drm/i915/intel_fbc.c b/drivers/gpu/drm/i915/intel_fbc.c
> index 4165ce0..6abb834 100644
> --- a/drivers/gpu/drm/i915/intel_fbc.c
> +++ b/drivers/gpu/drm/i915/intel_fbc.c
> @@ -457,7 +457,7 @@ static struct drm_crtc *intel_fbc_find_crtc(struct drm_i915_private *dev_priv)
> tmp_crtc = dev_priv->pipe_to_crtc_mapping[pipe];
>
> if (intel_crtc_active(tmp_crtc) &&
> - to_intel_crtc(tmp_crtc)->primary_enabled) {
> + to_intel_plane_state(tmp_crtc->primary->state)->visible) {
> if (one_pipe_only && crtc) {
> if (set_no_fbc_reason(dev_priv, FBC_MULTIPLE_PIPES))
> DRM_DEBUG_KMS("more than one pipe active, disabling compression\n");
> --
> 2.1.0
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2015-05-07 7:40 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-21 14:12 [PATCH 00/35] Make legacy modeset a lot more atomic-like Ander Conselvan de Oliveira
2015-04-21 14:12 ` [PATCH 01/35] drm/i915: Remove implicitly disabling primary plane for now Ander Conselvan de Oliveira
2015-04-21 14:12 ` [PATCH 02/35] drm/i915: Add a way to disable planes without updating state Ander Conselvan de Oliveira
2015-04-21 14:12 ` [PATCH 03/35] drm/i915: Use the disable callback for disabling planes Ander Conselvan de Oliveira
2015-04-21 14:12 ` [PATCH 04/35] drm/i915: get rid of primary_enabled and use atomic state Ander Conselvan de Oliveira
2015-05-07 7:43 ` Daniel Vetter [this message]
2015-04-21 14:12 ` [PATCH 05/35] drm/i915: Move intel_(pre_disable/post_enable)_primary to intel_display.c, and use it there Ander Conselvan de Oliveira
2015-04-21 14:12 ` [PATCH 06/35] drm/i915: Rename intel_crtc_dpms_overlay Ander Conselvan de Oliveira
2015-04-21 14:12 ` [PATCH 07/35] drm/i915: Move toggling planes out of crtc enable/disable Ander Conselvan de Oliveira
2015-04-21 14:12 ` [PATCH 08/35] drm/i915: Don't check for NULL before freeing state Ander Conselvan de Oliveira
2015-04-21 14:12 ` [PATCH 09/35] drm/i915: Call drm helpers when duplicating crtc and plane states Ander Conselvan de Oliveira
2015-04-21 14:12 ` [PATCH 10/35] drm/i915: Use for_each_connector_in_state helper macro Ander Conselvan de Oliveira
2015-04-21 14:13 ` [PATCH 11/35] drm/i915: Extract mode_changed computation out of stage_output_config() Ander Conselvan de Oliveira
2015-04-21 14:13 ` [PATCH 12/35] drm/i915: Add crtc states before calling compute_config() Ander Conselvan de Oliveira
2015-04-21 14:13 ` [PATCH 13/35] drm/i915: Don't pretend we can calculate multiple pipe_configs Ander Conselvan de Oliveira
2015-04-21 14:13 ` [PATCH 14/35] drm/i915: Calculate a new pipe_config based on new enabled state Ander Conselvan de Oliveira
2015-04-21 14:13 ` [PATCH 15/35] drm/i915: Remove all *_pipes flags from modeset Ander Conselvan de Oliveira
2015-05-28 16:35 ` Chris Wilson
2015-05-29 11:28 ` [PATCH] drm/i915: Silence compiler warning Ander Conselvan de Oliveira
2015-05-29 17:06 ` Daniel Vetter
2015-04-21 14:13 ` [PATCH 16/35] drm/i915: Remove saved_mode from __intel_set_mode() Ander Conselvan de Oliveira
2015-04-21 14:13 ` [PATCH 17/35] drm/i915: Move compute part of __intel_set_mode() to separate function Ander Conselvan de Oliveira
2015-04-21 14:13 ` [PATCH 18/35] drm/i915: Simplify error handling in __intel_set_mode() Ander Conselvan de Oliveira
2015-04-21 14:13 ` [PATCH 19/35] drm/i915: Don't modeset with old mode when set_crtc fails Ander Conselvan de Oliveira
2015-04-21 14:13 ` [PATCH 20/35] drm/i915: Add primary plane to atomic state in legacy modeset Ander Conselvan de Oliveira
2015-04-21 14:13 ` [PATCH 21/35] drm/i915: Delete fb, x and y parameters from mode set functions Ander Conselvan de Oliveira
2015-04-21 14:13 ` [PATCH 22/35] drm/i915: Don't use struct intel_set_config *_changed flags Ander Conselvan de Oliveira
2015-04-21 14:13 ` [PATCH 23/35] drm/i915: Don't use staged config to calculate mode_changed flags Ander Conselvan de Oliveira
2015-04-21 14:13 ` [PATCH 24/35] drm/i915: Unify modeset and flip paths of intel_crtc_set_config() Ander Conselvan de Oliveira
2015-04-21 14:13 ` [PATCH 25/35] drm/i915: Simplify intel_set_config_compute_mode_changes() a bit Ander Conselvan de Oliveira
2015-04-21 14:13 ` [PATCH 26/35] drm/i915: Stage new modeset state straight into atomic state Ander Conselvan de Oliveira
2015-04-21 14:13 ` [PATCH 27/35] drm/i915: Remove save/restore logic from intel_crtc_set_config() Ander Conselvan de Oliveira
2015-04-21 14:13 ` [PATCH 28/35] drm/i915: Update crtc state active flag based on DPMS Ander Conselvan de Oliveira
2015-04-21 14:13 ` [PATCH 29/35] drm/atomic: Make mode_fixup() optional for check_modeset() Ander Conselvan de Oliveira
2015-04-21 14:13 ` [PATCH 30/35] drm/i915: Use atomic helpers for computing changed flags Ander Conselvan de Oliveira
2015-04-21 14:13 ` [PATCH 31/35] drm/i915: Take ownership of atomic state on success in intel_set_mode() Ander Conselvan de Oliveira
2015-04-21 14:13 ` [PATCH 32/35] drm/i915: Preserve shared DPLL information in new pipe_config Ander Conselvan de Oliveira
2015-04-21 14:13 ` [PATCH 33/35] drm/i915: Don't use plane update helper in legacy mode set Ander Conselvan de Oliveira
2015-04-21 14:13 ` [PATCH 34/35] drm/i915: Swap atomic state in legacy modeset Ander Conselvan de Oliveira
2015-04-21 14:13 ` [PATCH 35/35] drm/i915: Get rid of intel_crtc_set_state() Ander Conselvan de Oliveira
2015-04-21 15:21 ` [PATCH 00/35] Make legacy modeset a lot more atomic-like Maarten Lankhorst
2015-05-07 8:16 ` Daniel Vetter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150507074308.GV30184@phenom.ffwll.local \
--to=daniel@ffwll.ch \
--cc=ander.conselvan.de.oliveira@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox