Skip to contentSkip to conversation

fbmem: really support wildcard video=options for all fbdev drivers

PATCH In review Olaf Hering 3 participants 3 messages Dec 15, 2013 – Jan 8, 2014 Framebuffer layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fbmem: really support wildcard video=options for all fbdev drivers

Documentation/fb/modedb.txt states that video=option should be considered a global option. But video_setup and fb_get_options are not coded that way. Instead its required to boot with video=driver:option to set a given option in drvier. This is cumbersome because it requires to know in advance which driver will be active for a given board/kernel.

The following patch implements the documented catchall for the fbdev drivers. It is now possible to boot with video=XxY without the need to know the active driver in advance. The specific case it tries to fix is syslinux in the SUSE installer which offers a menu to set a display resolution. Right now this just appends the vga= option the kernel. But in addition to vga= it should be possible to pass a generic video=XxY for all framebuffer/drm drivers. With this change forcing a certain window size of VM displays is now much easier.

Today the video= option is stored in a global fb_mode_option. But unfortunately only drm uses it.

Note: this change introduces a small memleak if video=option is actually used because fb_mode_option is const. Most drivers use strsep to get to individual options. This could be fixed in a followup patch which always releases the option string in every caller of fb_get_options.

---
 drivers/video/fbmem.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/video/fbmem.c +3 -0
index 010d191..cde4619 100644
@@ -1930,6 +1930,9 @@ int fb_get_options(const char *name, char **option)
 				options = opt + name_len + 1;
 		}
 	}
+	/* No match, pass global option */
+	if (!options && option && fb_mode_option)
+		options = kstrdup(fb_mode_option, GFP_KERNEL);
 	if (options && !strncmp(options, "off", 3))
 		retval = 1;
 
#1 lore raw
Quoted 5 lines · Olaf Hering

Documentation/fb/modedb.txt states that video=option should be considered a global option. But video_setup and fb_get_options are not coded that way. Instead its required to boot with video=driver:option to set a given option in drvier. This is cumbersome because it requires to know in advance which driver will be active for a given board/kernel.

That's an interesting finding: this definitely was working fine a few years ago. Unfortunately I have no idea when I used it recently. I'm 100% sure I used it with ps3fb ca. 5 years ago.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#2 lore raw
In reply to Olaf Hering
Quoted 34 lines · Olaf Hering

Documentation/fb/modedb.txt states that video=option should be considered a global option. But video_setup and fb_get_options are not coded that way. Instead its required to boot with video=driver:option to set a given option in drvier. This is cumbersome because it requires to know in advance which driver will be active for a given board/kernel.

The following patch implements the documented catchall for the fbdev drivers. It is now possible to boot with video=XxY without the need to know the active driver in advance. The specific case it tries to fix is syslinux in the SUSE installer which offers a menu to set a display resolution. Right now this just appends the vga= option the kernel. But in addition to vga= it should be possible to pass a generic video=XxY for all framebuffer/drm drivers. With this change forcing a certain window size of VM displays is now much easier.

Today the video= option is stored in a global fb_mode_option. But unfortunately only drm uses it.

Note: this change introduces a small memleak if video=option is actually used because fb_mode_option is const. Most drivers use strsep to get to individual options. This could be fixed in a followup patch which always releases the option string in every caller of fb_get_options.

---
 drivers/video/fbmem.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/video/fbmem.c +0 -0
index 010d191..cde4619 100644

drivers/video/fbmem.c int fb_get_options(const char *name, char **option) · line 1938

Quoted 9 lines
drivers/video/fbmem.c +3 -0
@@ -1930,6 +1930,9 @@ int fb_get_options(const char *name, char **option)
 				options = opt + name_len + 1;
 		}
 	}
+	/* No match, pass global option */
+	if (!options && option && fb_mode_option)
+		options = kstrdup(fb_mode_option, GFP_KERNEL);
 	if (options && !strncmp(options, "off", 3))
 		retval = 1;
 

Queued for 3.14.

Tomi