aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_fb_helper.c
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2012-06-15 05:01:22 -0400
committerDave Airlie <airlied@redhat.com>2012-07-19 21:23:09 -0400
commit343065a605646b4c1fee8b1ca07b715283813b11 (patch)
tree99cf63f590355eaafbe6c8e8e99e6b436be3de36 /drivers/gpu/drm/drm_fb_helper.c
parentb68bdc1bbab743e2911b40c27b91a0a8e641cfb7 (diff)
drm/fb-helper: delay hotplug handling when partially bound
Ok, this requires quite a dance to actually hit: 1) We plug in a 2nd screen, enable it in both X and (by vt-switching) in the fbcon. 2) We disable that screen again in with xrandr. 3) We vt-switch again, so that fbcon displays on the 2nd screen, but X on the first screen. This obviously needs a driver that doesn't switch off unused functions when regaining the VT. 3) When X controls the vt, we unplug that screen. Now drm_fb_helper_hotplug_event we noticed that that some crtcs are bound, but because we still have the fbcon on the 2nd screeen we also have bound set. Which means the fbcon wrongly assumes it's in control of everything an happily disables the output on the 2nd screen, but enables its fb on the first screen. Work around this issue by counting how many crtcs are bound and how many are bound to fbcon and assuming that when fbcon isn't bound to all of them, it better not touch the output configuration. Conceptually this is the same as only restoring the fbcon output configuration on the driver's ->lastclose, when we're sure that no one else is using kms. So this should be consistent with existing kms drivers. Chris has created a separate patch for the intel ddx, but I think we should fix this issue here regardless - the fbcon messing with the output config while it's not fully in control simply isn't a too polite behaviour. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=50772 Tested-by: Maxim A. Nikulin <M.A.Nikulin@gmail.com> Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/drm_fb_helper.c')
-rw-r--r--drivers/gpu/drm/drm_fb_helper.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 5683b7fdd746..d3f15b9d1d82 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -1353,7 +1353,7 @@ int drm_fb_helper_hotplug_event(struct drm_fb_helper *fb_helper)
1353 struct drm_device *dev = fb_helper->dev; 1353 struct drm_device *dev = fb_helper->dev;
1354 int count = 0; 1354 int count = 0;
1355 u32 max_width, max_height, bpp_sel; 1355 u32 max_width, max_height, bpp_sel;
1356 bool bound = false, crtcs_bound = false; 1356 int bound = 0, crtcs_bound = 0;
1357 struct drm_crtc *crtc; 1357 struct drm_crtc *crtc;
1358 1358
1359 if (!fb_helper->fb) 1359 if (!fb_helper->fb)
@@ -1362,12 +1362,12 @@ int drm_fb_helper_hotplug_event(struct drm_fb_helper *fb_helper)
1362 mutex_lock(&dev->mode_config.mutex); 1362 mutex_lock(&dev->mode_config.mutex);
1363 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { 1363 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
1364 if (crtc->fb) 1364 if (crtc->fb)
1365 crtcs_bound = true; 1365 crtcs_bound++;
1366 if (crtc->fb == fb_helper->fb) 1366 if (crtc->fb == fb_helper->fb)
1367 bound = true; 1367 bound++;
1368 } 1368 }
1369 1369
1370 if (!bound && crtcs_bound) { 1370 if (bound < crtcs_bound) {
1371 fb_helper->delayed_hotplug = true; 1371 fb_helper->delayed_hotplug = true;
1372 mutex_unlock(&dev->mode_config.mutex); 1372 mutex_unlock(&dev->mode_config.mutex);
1373 return 0; 1373 return 0;