Fix late monitor hotplug event.

If system starts without attached monitor, DRM create framebuffer
for VT console. Later, when monitor is attached, the hotplug event must
issue full modeset procedure to setup CRTC.
In original code, this was done in drm_fb_helper_set_par(), but we don't
have this function implemented yet. Use unrolled version of
drm_fb_helper_set_par() to ensure same functionality.

MFC after: 1 month
This commit is contained in:
mmel 2016-12-26 11:20:40 +00:00
parent f9b6f82f5b
commit 5bced16c26

View File

@ -339,6 +339,7 @@ bool drm_fb_helper_restore_fbdev_mode(struct drm_fb_helper *fb_helper)
{ {
bool error = false; bool error = false;
int i, ret; int i, ret;
for (i = 0; i < fb_helper->crtc_count; i++) { for (i = 0; i < fb_helper->crtc_count; i++) {
struct drm_mode_set *mode_set = &fb_helper->crtc_info[i].mode_set; struct drm_mode_set *mode_set = &fb_helper->crtc_info[i].mode_set;
ret = mode_set->crtc->funcs->set_config(mode_set); ret = mode_set->crtc->funcs->set_config(mode_set);
@ -841,6 +842,9 @@ int drm_fb_helper_single_fb_probe(struct drm_fb_helper *fb_helper,
struct drm_fb_helper_surface_size sizes; struct drm_fb_helper_surface_size sizes;
int gamma_size = 0; int gamma_size = 0;
#if defined(__FreeBSD__) #if defined(__FreeBSD__)
struct drm_crtc *crtc;
struct drm_device *dev;
int ret;
device_t kdev; device_t kdev;
#endif #endif
@ -942,6 +946,24 @@ int drm_fb_helper_single_fb_probe(struct drm_fb_helper *fb_helper,
if (ret != 0) if (ret != 0)
DRM_ERROR("Failed to attach fbd device: %d\n", ret); DRM_ERROR("Failed to attach fbd device: %d\n", ret);
#endif #endif
} else {
/* Modified version of drm_fb_helper_set_par() */
dev = fb_helper->dev;
sx_xlock(&dev->mode_config.mutex);
for (i = 0; i < fb_helper->crtc_count; i++) {
crtc = fb_helper->crtc_info[i].mode_set.crtc;
ret = crtc->funcs->set_config(&fb_helper->crtc_info[i].mode_set);
if (ret) {
sx_xunlock(&dev->mode_config.mutex);
return ret;
}
}
sx_xunlock(&dev->mode_config.mutex);
if (fb_helper->delayed_hotplug) {
fb_helper->delayed_hotplug = false;
drm_fb_helper_hotplug_event(fb_helper);
}
} }
#else #else
if (new_fb) { if (new_fb) {