intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
To: dri-devel@lists.freedesktop.org
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 5/5] drm/atomic: Add encoder_mask to crtc_state, v2.
Date: Thu, 28 Jan 2016 14:57:45 +0100	[thread overview]
Message-ID: <56AA1E59.3070807@linux.intel.com> (raw)
In-Reply-To: <1452160762-30487-6-git-send-email-maarten.lankhorst@linux.intel.com>

A diff to make this v3. Found when running this through IGT bat.

- Keeping an encoder but moving it to a different crtc resulted, in encoder_mask not being updated.
- Add some paranoia when best_encoder was already updated to a different encoder in steal_encoder.
    This could happen in theory.
- Relax the WARN_ON(!crtc) when resuming after resume and add an explanation what the WARN_ON is for.
---
diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
index 1ac35072e14f..e5534dc9c4b4 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -137,7 +137,13 @@ set_best_encoder(struct drm_atomic_state *state,
 		/* Unset the encoder_mask in the old crtc state. */
 		crtc = conn_state->connector->state->crtc;
 
-		WARN_ON(!crtc);
+		/* A NULL crtc is an error here because we should have
+		 *  duplicated a NULL best_encoder when crtc was NULL.
+		 * As an exception restoring duplicated atomic state
+		 * during resume is allowed, so don't warn when
+		 * best_encoder is equal to encoder we intend to set.
+		 */
+		WARN_ON(!crtc && encoder != conn_state->best_encoder);
 		if (crtc) {
 			crtc_state = drm_atomic_get_existing_crtc_state(state, crtc);
 
@@ -199,6 +205,9 @@ steal_encoder(struct drm_atomic_state *state,
 		if (IS_ERR(connector_state))
 			return PTR_ERR(connector_state);
 
+		if (connector_state->best_encoder != encoder)
+			continue;
+
 		set_best_encoder(state, connector_state, NULL);
 	}
 
@@ -276,6 +285,8 @@ update_connector_routing(struct drm_atomic_state *state, int conn_idx)
 	}
 
 	if (new_encoder == connector_state->best_encoder) {
+		set_best_encoder(state, connector_state, new_encoder);
+
 		DRM_DEBUG_ATOMIC("[CONNECTOR:%d:%s] keeps [ENCODER:%d:%s], now on [CRTC:%d:%s]\n",
 				 connector->base.id,
 				 connector->name,

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2016-01-28 13:57 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-07  9:59 [PATCH 0/5] Add encoder_mask to crtc_state, v2 Maarten Lankhorst
2016-01-07  9:59 ` [PATCH 1/5] drm/core: Add drm_encoder_index Maarten Lankhorst
2016-02-03 12:43   ` [Intel-gfx] " Gustavo Padovan
2016-01-07  9:59 ` [PATCH 2/5] drm/core: Add drm_for_each_encoder_mask, v2 Maarten Lankhorst
2016-02-03 12:43   ` Gustavo Padovan
2016-01-07  9:59 ` [PATCH 3/5] drm/i915: Do not touch best_encoder for load detect Maarten Lankhorst
2016-02-03 12:44   ` Gustavo Padovan
2016-01-07  9:59 ` [PATCH 4/5] drm/atomic: Do not unset crtc when an encoder is stolen Maarten Lankhorst
2016-02-03 12:44   ` Gustavo Padovan
2016-01-07  9:59 ` [PATCH 5/5] drm/atomic: Add encoder_mask to crtc_state, v2 Maarten Lankhorst
2016-01-28 13:57   ` Maarten Lankhorst [this message]
2016-01-28 14:04   ` [PATCH v3 5/5] drm/atomic: Add encoder_mask to crtc_state, v3 Maarten Lankhorst
2016-02-03 12:45     ` Gustavo Padovan
2016-02-09  8:52       ` Daniel Vetter
2016-01-11  8:52 ` ✗ warning: Fi.CI.BAT Patchwork

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=56AA1E59.3070807@linux.intel.com \
    --to=maarten.lankhorst@linux.intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --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;
as well as URLs for NNTP newsgroup(s).