From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
To: dri-devel@lists.freedesktop.org
Cc: intel-gfx@lists.freedesktop.org
Subject: [PATCH 2/3] drm/atomic: Refuse to steal encoders with index < conn_idx.
Date: Thu, 18 Feb 2016 09:54:42 +0100 [thread overview]
Message-ID: <1455785683-5477-3-git-send-email-maarten.lankhorst@linux.intel.com> (raw)
In-Reply-To: <1455785683-5477-1-git-send-email-maarten.lankhorst@linux.intel.com>
There was a potential to crash in the following case:
[ 49.985270] [drm:update_connector_routing] Updating routing for [CONNECTOR:48:DP-3]
[ 49.985273] [drm:update_connector_routing] [CONNECTOR:48:DP-3] keeps [ENCODER:33:DP MST-33], now on [CRTC:21:crtc-0]
[ 49.985275] [drm:update_connector_routing] Updating routing for [CONNECTOR:51:DP-4]
[ 49.985278] [drm:steal_encoder] [ENCODER:33:DP MST-33] in use on [CRTC:21:crtc-0], stealing it
[ 49.985281] [drm:update_connector_routing] [CONNECTOR:51:DP-4] using [ENCODER:33:DP MST-33] on [CRTC:21:crtc-0]
This case is not allowed, similar to the previous case of 2 connectors newly assigned to the same encoder.
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
drivers/gpu/drm/drm_atomic_helper.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
index fc1c06b1d8bb..fa708559542c 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -88,18 +88,18 @@ drm_atomic_helper_plane_changed(struct drm_atomic_state *state,
static bool
check_pending_encoder_assignment(struct drm_atomic_state *state,
- struct drm_encoder *new_encoder)
+ struct drm_encoder *new_encoder,
+ int conn_idx)
{
struct drm_connector *connector;
struct drm_connector_state *conn_state;
int i;
for_each_connector_in_state(state, connector, conn_state, i) {
- if (conn_state->best_encoder != new_encoder)
- continue;
+ if (i >= conn_idx)
+ break;
- /* encoder already assigned and we're trying to re-steal it! */
- if (connector->state->best_encoder != conn_state->best_encoder)
+ if (conn_state->best_encoder == new_encoder)
return false;
}
@@ -272,7 +272,7 @@ update_connector_routing(struct drm_atomic_state *state,
return 0;
}
- if (!check_pending_encoder_assignment(state, new_encoder)) {
+ if (!check_pending_encoder_assignment(state, new_encoder, conn_idx)) {
DRM_DEBUG_ATOMIC("Encoder for [CONNECTOR:%d:%s] already assigned\n",
connector->base.id,
connector->name);
--
2.1.0
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2016-02-18 8:54 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-18 8:54 [PATCH 0/3] drm/atomic: Fix encoder stealing Maarten Lankhorst
2016-02-18 8:54 ` [PATCH 1/3] drm/atomic: Always call steal_encoder Maarten Lankhorst
2016-02-18 8:54 ` Maarten Lankhorst [this message]
2016-02-18 11:09 ` [PATCH 2/3] drm/atomic: Refuse to steal encoders with index < conn_idx Daniel Vetter
2016-02-18 11:22 ` Maarten Lankhorst
2016-02-18 8:54 ` [PATCH 3/3] drm/atomic: Refuse to steal encoders from connectors not part of the state Maarten Lankhorst
2016-02-18 11:07 ` Daniel Vetter
2016-02-18 11:18 ` Maarten Lankhorst
2016-02-18 12:43 ` Daniel Vetter
2016-02-18 12:59 ` Ville Syrjälä
2016-02-24 8:51 ` Maarten Lankhorst
2016-02-18 11:35 ` Maarten Lankhorst
2016-02-18 11:11 ` [Intel-gfx] [PATCH 0/3] drm/atomic: Fix encoder stealing 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=1455785683-5477-3-git-send-email-maarten.lankhorst@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).