* [PATCH] video: ramfb: support multiple resolutions via mode_name parameter
@ 2026-05-01 8:51 Ahmad Fatoum
2026-05-07 10:38 ` Sascha Hauer
0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2026-05-01 8:51 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
Replace the single hardcoded 640x480 mode with a static mode list
covering common resolutions (640x480, 800x600, 1280x720, 1920x1080).
The default remains 640x480 (index 0).
Users can now switch to e.g. 1080p before enabling the framebuffer:
fb0.mode_name=1920x1080
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
drivers/video/ramfb.c | 34 ++++++++++++++++------------------
1 file changed, 16 insertions(+), 18 deletions(-)
diff --git a/drivers/video/ramfb.c b/drivers/video/ramfb.c
index cc490496175b..7d0413afb5e2 100644
--- a/drivers/video/ramfb.c
+++ b/drivers/video/ramfb.c
@@ -18,7 +18,6 @@ struct ramfb {
int fd;
struct fb_info info;
dma_addr_t screen_dma;
- struct fb_videomode mode;
};
struct fw_cfg_etc_ramfb {
@@ -30,22 +29,6 @@ struct fw_cfg_etc_ramfb {
u32 stride;
} __packed;
-static void ramfb_populate_modes(struct ramfb *ramfb)
-{
- struct fb_info *info = &ramfb->info;
-
- ramfb->mode.name = "x8r8g8b8";
- info->xres = ramfb->mode.xres = 640;
- info->yres = ramfb->mode.yres = 480;
-
- info->mode = &ramfb->mode;
- info->bits_per_pixel = 32;
- info->red = (struct fb_bitfield) {16, 8};
- info->green = (struct fb_bitfield) {8, 8};
- info->blue = (struct fb_bitfield) {0, 8};
- info->transp = (struct fb_bitfield) {0, 0};
-}
-
static int ramfb_activate_var(struct fb_info *fbi)
{
struct ramfb *ramfb = fbi->priv;
@@ -81,6 +64,13 @@ static void ramfb_enable(struct fb_info *fbi)
dma_free(etc_ramfb);
}
+static struct fb_videomode ramfb_modes[] = {
+ { .name = "640x480", .xres = 640, .yres = 480 },
+ { .name = "800x600", .xres = 800, .yres = 600 },
+ { .name = "1280x720", .xres = 1280, .yres = 720 },
+ { .name = "1920x1080", .xres = 1920, .yres = 1080 },
+};
+
static struct fb_ops ramfb_ops = {
.fb_activate_var = ramfb_activate_var,
.fb_enable = ramfb_enable,
@@ -101,7 +91,15 @@ static int ramfb_probe(struct device *dev)
fbi->fbops = &ramfb_ops;
fbi->dev.parent = dev;
- ramfb_populate_modes(ramfb);
+ fbi->modes.modes = ramfb_modes;
+ fbi->modes.num_modes = ARRAY_SIZE(ramfb_modes);
+ /* current_mode = 0 (640x480) from xzalloc */
+
+ fbi->bits_per_pixel = 32;
+ fbi->red = (struct fb_bitfield) {16, 8};
+ fbi->green = (struct fb_bitfield) {8, 8};
+ fbi->blue = (struct fb_bitfield) {0, 8};
+ fbi->transp = (struct fb_bitfield) {0, 0};
ret = register_framebuffer(fbi);
if (ret < 0) {
--
2.47.3
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] video: ramfb: support multiple resolutions via mode_name parameter
2026-05-01 8:51 [PATCH] video: ramfb: support multiple resolutions via mode_name parameter Ahmad Fatoum
@ 2026-05-07 10:38 ` Sascha Hauer
0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2026-05-07 10:38 UTC (permalink / raw)
To: barebox, Ahmad Fatoum
On Fri, 01 May 2026 10:51:01 +0200, Ahmad Fatoum wrote:
> Replace the single hardcoded 640x480 mode with a static mode list
> covering common resolutions (640x480, 800x600, 1280x720, 1920x1080).
> The default remains 640x480 (index 0).
>
> Users can now switch to e.g. 1080p before enabling the framebuffer:
>
> fb0.mode_name=1920x1080
>
> [...]
Applied, thanks!
[1/1] video: ramfb: support multiple resolutions via mode_name parameter
https://git.pengutronix.de/cgit/barebox/commit/?id=7fb4694d6174 (link may not be stable)
Best regards,
--
Sascha Hauer <s.hauer@pengutronix.de>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-05-07 10:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-05-01 8:51 [PATCH] video: ramfb: support multiple resolutions via mode_name parameter Ahmad Fatoum
2026-05-07 10:38 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox