From: Dave Airlie <airlied@gmail.com>
To: dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org
Subject: [PATCH 4/6] drm/crtc: take references to connectors used in a modeset. (v2)
Date: Tue, 3 May 2016 14:28:24 +1000 [thread overview]
Message-ID: <1462249706-4759-4-git-send-email-airlied@gmail.com> (raw)
In-Reply-To: <1462249706-4759-1-git-send-email-airlied@gmail.com>
From: Dave Airlie <airlied@redhat.com>
This just takes a reference on the connector when we set a mode
in the non-atomic paths.
v2: Follow Daniel Stone's suggestions on when to take/drop
references.
Signed-off-by: Dave Airlie <airlied@redhat.com>
---
drivers/gpu/drm/drm_crtc_helper.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c
index 66ca313..f47a252 100644
--- a/drivers/gpu/drm/drm_crtc_helper.c
+++ b/drivers/gpu/drm/drm_crtc_helper.c
@@ -456,6 +456,9 @@ drm_crtc_helper_disable(struct drm_crtc *crtc)
* between them is henceforth no longer available.
*/
connector->dpms = DRM_MODE_DPMS_OFF;
+
+ /* we keep a reference while the encoder is bound */
+ drm_connector_unreference(connector);
}
}
@@ -606,6 +609,11 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
mode_changed = true;
}
+ /* take a reference on all connectors in set */
+ for (ro = 0; ro < set->num_connectors; ro++) {
+ drm_connector_reference(set->connectors[ro]);
+ }
+
/* a) traverse passed in connector list and get encoders for them */
count = 0;
drm_for_each_connector(connector, dev) {
@@ -724,6 +732,12 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
}
}
+ /* after fail drop reference on all connectors in save set */
+ count = 0;
+ drm_for_each_connector(connector, dev) {
+ drm_connector_unreference(&save_connectors[count++]);
+ }
+
kfree(save_connectors);
kfree(save_encoders);
return 0;
@@ -740,6 +754,11 @@ fail:
*connector = save_connectors[count++];
}
+ /* after fail drop reference on all connectors in set */
+ for (ro = 0; ro < set->num_connectors; ro++) {
+ drm_connector_unreference(set->connectors[ro]);
+ }
+
/* Try to restore the config */
if (mode_changed &&
!drm_crtc_helper_set_mode(save_set.crtc, save_set.mode, save_set.x,
--
2.5.5
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2016-05-03 4:28 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-03 4:28 [PATCH 1/6] drm/fb: fix missing /** in kerneldoc comment Dave Airlie
2016-05-03 4:28 ` [PATCH 2/6] drm/modes: add connector reference counting. (v2) Dave Airlie
2016-05-03 4:28 ` [PATCH 3/6] drm/fb_helper: " Dave Airlie
2016-05-03 7:56 ` [Intel-gfx] " Daniel Vetter
2016-05-03 4:28 ` Dave Airlie [this message]
2016-05-03 8:00 ` [PATCH 4/6] drm/crtc: take references to connectors used in a modeset. (v2) Daniel Vetter
2016-05-03 4:28 ` [PATCH 5/6] drm/atomic: use connector references (v2) Dave Airlie
2016-05-03 8:03 ` Daniel Vetter
2016-05-03 10:09 ` Dave Airlie
2016-05-03 12:26 ` Daniel Vetter
2016-05-03 14:02 ` Daniel Stone
2016-05-03 4:28 ` [PATCH 6/6] drm/i915/mst: use reference counted connectors. (v3) Dave Airlie
2016-05-03 7:55 ` [PATCH 1/6] drm/fb: fix missing /** in kerneldoc comment 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=1462249706-4759-4-git-send-email-airlied@gmail.com \
--to=airlied@gmail.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