Prior to commit b0aa06e9a7fd ("drm/fb-helper: Support deferred setup"), if no output is connected at framebuffer setup time, we get a default 1024x768 mode that is going to be used when we first connect a monitor. After the commit, on first connection after deferred setup, we probe the monitor and get the preferred resolution, but no mode get set because the drm_fb_helper_hotplug_event() function returns early when the setup has been deferred. That is different from what happens on a second re-connect of the monitor, when the native mode get set.
Create a more consistent behaviour by checking in the drm_fb_helper_hotplug_event() function if the deferred setup is still active. If not, that means we now have a valid framebuffer that can be used for setting the correct mode.
Fixes: b0aa06e9a7fd ("drm/fb-helper: Support deferred setup") Signed-off-by: Liviu Dudau Liviu.Dudau@arm.com Cc: Daniel Vetter daniel.vetter@ffwll.ch --- drivers/gpu/drm/drm_fb_helper.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c index d833eb2320d1..bb7b44d284ec 100644 --- a/drivers/gpu/drm/drm_fb_helper.c +++ b/drivers/gpu/drm/drm_fb_helper.c @@ -2444,6 +2444,7 @@ static int __drm_fb_helper_initial_config(struct drm_fb_helper *fb_helper, if (ret == -EAGAIN) { fb_helper->preferred_bpp = bpp_sel; fb_helper->deferred_setup = true; + ret = 0; } mutex_unlock(&fb_helper->lock);
@@ -2565,7 +2566,13 @@ int drm_fb_helper_hotplug_event(struct drm_fb_helper *fb_helper) if (fb_helper->deferred_setup) { err = __drm_fb_helper_initial_config(fb_helper, fb_helper->preferred_bpp); - return err; + /* + * __drm_fb_helper_initial_config can change deferred_setup, + * if 'false' that means we can go ahead with the rest of + * the setup as normal + */ + if (fb_helper->deferred_setup) + return err; }
if (!fb_helper->fb || !drm_fb_helper_is_bound(fb_helper)) {