summaryrefslogtreecommitdiff
path: root/linux-core/nv50_fbcon.c
diff options
context:
space:
mode:
Diffstat (limited to 'linux-core/nv50_fbcon.c')
-rw-r--r--linux-core/nv50_fbcon.c46
1 files changed, 37 insertions, 9 deletions
diff --git a/linux-core/nv50_fbcon.c b/linux-core/nv50_fbcon.c
index c428ff94..8969860b 100644
--- a/linux-core/nv50_fbcon.c
+++ b/linux-core/nv50_fbcon.c
@@ -284,16 +284,21 @@ static int nv50_fbcon_set_par(struct fb_info *info)
}
mode_set.mode = drm_mode;
- list_for_each_entry(drm_crtc, &dev->mode_config.crtc_list, head) {
- if (crtc_used[crtc_count]) {
- crtc_count++;
- continue;
+ /* choose crtc it already has, if possible */
+ if (drm_connector->encoder) {
+ struct drm_encoder *drm_encoder = drm_connector->encoder;
+
+ if (drm_encoder->crtc) {
+ list_for_each_entry(drm_crtc, &dev->mode_config.crtc_list, head) {
+ crtc_count++;
+
+ if (drm_crtc == drm_encoder->crtc) {
+ if (!crtc_used[crtc_count]) /* still available? */
+ mode_set.crtc = drm_crtc;
+ break;
+ }
+ }
}
-
- /* found a crtc */
- mode_set.crtc = drm_crtc;
-
- break;
}
/* proceed as planned */
@@ -302,6 +307,29 @@ static int nv50_fbcon_set_par(struct fb_info *info)
crtc_used[crtc_count] = true;
}
+ if (!mode_set.crtc) {
+ crtc_count = 0; /* reset */
+
+ /* choose a "random" crtc */
+ list_for_each_entry(drm_crtc, &dev->mode_config.crtc_list, head) {
+ if (crtc_used[crtc_count]) {
+ crtc_count++;
+ continue;
+ }
+
+ /* found a crtc */
+ mode_set.crtc = drm_crtc;
+
+ break;
+ }
+
+ /* proceed as planned */
+ if (mode_set.crtc) {
+ mode_set.crtc->funcs->set_config(&mode_set);
+ crtc_used[crtc_count] = true;
+ }
+ }
+
kfree(mode_set.connectors);
}