From de76ffce5f5873e05e2243c3af64f1fcb098a3a1 Mon Sep 17 00:00:00 2001 From: Jonas 'Sortie' Termansen Date: Sun, 21 Aug 2016 15:49:17 +0200 Subject: [PATCH] Only set resolution in init(8) if not already done. --- init/init.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/init/init.c b/init/init.c index 2f28bd1c..2e8de56e 100644 --- a/init/init.c +++ b/init/init.c @@ -430,6 +430,21 @@ static void set_videomode(void) return; } free(videomode); + struct dispmsg_get_crtc_mode get_mode; + memset(&get_mode, 0, sizeof(get_mode)); + get_mode.msgid = DISPMSG_GET_CRTC_MODE; + get_mode.device = 0; + get_mode.connector = 0; + // Don't set the resolution if it's already correct. + if ( dispmsg_issue(&get_mode, sizeof(get_mode)) == 0 ) + { + if ( get_mode.mode.control & DISPMSG_CONTROL_VALID && + !(get_mode.mode.control & DISPMSG_CONTROL_FALLBACK) && + get_mode.mode.fb_format == bpp && + get_mode.mode.view_xres == xres && + get_mode.mode.view_yres == yres ) + return; + } struct dispmsg_set_crtc_mode set_mode; memset(&set_mode, 0, sizeof(set_mode)); set_mode.msgid = DISPMSG_SET_CRTC_MODE;