BCM2835 / simple framebuffer support
Subsystems (5)
v2 cover BCM2835 / simple framebuffer support
This is v2 of my patch set posted on 10/24.
It adds framebuffer support for the RPi and provides an additional config knob to set up the kernel's simplefb driver. The active barebox framebuffer is basis for that feature, so that other platforms can make use of it.
This simplefb option depends on the bcm2835 fb driver since drivers need to be aware of simplefb: framebuffers need to stay configured and cannot be teared down.
The RPi case is rather simple in this regard. The allocated framebuffer lies within the memory range of the VideoCore of the ARM/VC memory split. Hence, there is no memory range that needs to be reserved as far as the ARM side of things is concerned.
This likely needs to be added once other fb driver want to use simplefb.
Changes since v1:
* renamed "pitch" to "line_length" to match the kernel
* the bcm2835 framebuffer driver is now standalone
* configuring simplefb for the kernel is based on the active barebox framebuffer
Andre Heider (6):
fb: add a line_length value to struct fb_info
gui: convert graphic utils to respect line_length
gui: convert the bmp renderer to respect line_length
ARM: bcm2835: add missing mbox overscan response field
video: add a BCM2835 framebuffer driver
video: set up the kernel's simple framebuffer driver
arch/arm/boards/raspberry-pi/rpi.c | 1 + arch/arm/mach-bcm2835/include/mach/core.h | 5 + arch/arm/mach-bcm2835/include/mach/mbox.h | 1 + drivers/video/Kconfig | 14 +++ drivers/video/Makefile | 2 + drivers/video/bcm2835.c | 136 ++++++++++++++++++++++++ drivers/video/fb.c | 11 +- drivers/video/simplefb.c | 171 ++++++++++++++++++++++++++++++ include/fb.h | 1 + lib/gui/bmp.c | 8 +- lib/gui/graphic_utils.c | 10 +- 11 files changed, 349 insertions(+), 11 deletions(-) create mode 100644 drivers/video/bcm2835.c create mode 100644 drivers/video/simplefb.c
Signature · 7 lines
1.8.3.2 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH v2 1/6 fb: add a line_length value to struct fb_info
Add support for framebuffers with noncontiguous horizontal lines.
Video drivers can set this value if the hardware requires it. In case a driver does not set it, the current value of xres * (bpp / 8) is used instead.
--- drivers/video/fb.c | 11 +++++++++-- include/fb.h | 1 + 2 files changed, 10 insertions(+), 2 deletions(-)
drivers/video/fb.c +9 -2
@@ -72,12 +72,16 @@ static int fb_setup_mode(struct device_d *dev, struct param_d *param, info->xres = info->mode->xres; info->yres = info->mode->yres; + info->line_length =0 ; ret = info->fbops->fb_activate_var (info); +if (!info->line_length) + info->line_length = info->xres * (info->bits_per_pixel >>3 ); +if (!ret) { dev->resource[0 ].start = (resource_size_t )info->screen_base; - info->cdev.size = info->xres * info->yres * (info->bits_per_pixel >>3 ); + info->cdev.size = info->line_length * info->yres; dev->resource[0 ].end = dev->resource[0 ].start + info->cdev.size -1 ;dev_param_set_generic (dev, param, val); }else
@@ -122,9 +126,12 @@ int register_framebuffer(struct fb_info *info) dev = &info->dev; +if (!info->line_length) + info->line_length = info->xres * (info->bits_per_pixel >>3 ); + info->cdev.ops = &fb_ops; info->cdev.name =asprintf ("fb%d" , id); - info->cdev.size = info->xres * info->yres * (info->bits_per_pixel >>3 ); + info->cdev.size = info->line_length * info->yres; info->cdev.dev = dev; info->cdev.priv = info; dev->resource =xzalloc (sizeof (struct resource ));
include/fb.h +1 -0
@@ -94,6 +94,7 @@ struct fb_info {u32 xres;/* visible resolution */ u32 yres;u32 bits_per_pixel;/* guess what */ +u32 line_length;/* length of a line in bytes */ u32 grayscale;/* != 0 Graylevels instead of colors */
Signature · 7 lines
1.8.3.2 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH v2 1/6] fb: add a line_length value to struct fb_info
Quoted 17 lines · Andre Heider
Add support for framebuffers with noncontiguous horizontal lines.
Video drivers can set this value if the hardware requires it. In case a driver does not set it, the current value of xres * (bpp / 8) is used instead.
Signed-off-by Andre Heider <[email protected]>--- drivers/video/fb.c | 11 +++++++++-- include/fb.h | 1 + 2 files changed, 10 insertions(+), 2 deletions(-)drivers/video/fb.c +0
-0
drivers/video/fb.c static int fb_setup_mode(struct device_d *dev, struct param_d *param, · line 81
Quoted 10 lines
drivers/video/fb.c +4
-0@@ -72,12 +72,16 @@ static int fb_setup_mode(struct device_d *dev, struct param_d *param, info->xres = info->mode->xres; info->yres = info->mode->yres; + info->line_length =0 ; ret = info->fbops->fb_activate_var (info); +if (!info->line_length) + info->line_length = info->xres * (info->bits_per_pixel >>3 ); +
Isn't this already set from the register_framebuffer function?
You wanna see that somebody changed this value in info->fbops->fb_activate_var(info)?
Then I would do nothing here.
- Alex
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH v2 1/6] fb: add a line_length value to struct fb_info
Quoted 25 lines · Alexander Aring
Quoted 24 lines · Andre Heider
Add support for framebuffers with noncontiguous horizontal lines.
Video drivers can set this value if the hardware requires it. In case a driver does not set it, the current value of xres * (bpp / 8) is used instead.
Signed-off-by Andre Heider <[email protected]>--- drivers/video/fb.c | 11 +++++++++-- include/fb.h | 1 + 2 files changed, 10 insertions(+), 2 deletions(-)drivers/video/fb.c +1
-0@@ -72,12 +72,16 @@ static int fb_setup_mode(struct device_d *dev, struct param_d *param, info->xres = info->mode->xres; info->yres = info->mode->yres; + info->line_length =0 ; ret = info->fbops->fb_activate_var (info);
Quoted 7 lines
drivers/video/fb.c static int fb_setup_mode(struct device_d *dev, struct param_d *param, · line 81
Quoted 3 lines
drivers/video/fb.c +3
-0+if (!info->line_length) + info->line_length = info->xres * (info->bits_per_pixel >>3 ); +Isn't this already set from the
register_framebufferfunction?
You wanna see that somebody changed this value ininfo->fbops->fb_activate_var(info)?Then I would do nothing here.
It is set from register_framebuffer, but the mode setup invalidates it, So Andre sets it to 0 first and updates it after calling into the driver if necessary. The code looks correct. Maybe I misunderstand you?
Sascha
Signature · 9 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH v2 1/6] fb: add a line_length value to struct fb_info
Hi Sascha,
Quoted 32 lines · Sascha Hauer
Quoted 31 lines · Alexander Aring
Quoted 17 lines · Andre Heider
Add support for framebuffers with noncontiguous horizontal lines.
Video drivers can set this value if the hardware requires it. In case a driver does not set it, the current value of xres * (bpp / 8) is used instead.
Signed-off-by Andre Heider <[email protected]>--- drivers/video/fb.c | 11 +++++++++-- include/fb.h | 1 + 2 files changed, 10 insertions(+), 2 deletions(-)drivers/video/fb.c +0
-0drivers/video/fb.c static int fb_setup_mode(struct device_d *dev, struct param_d *param, · line 81
Quoted 10 lines
drivers/video/fb.c +4
-0@@ -72,12 +72,16 @@ static int fb_setup_mode(struct device_d *dev, struct param_d *param, info->xres = info->mode->xres; info->yres = info->mode->yres; + info->line_length =0 ; ret = info->fbops->fb_activate_var (info); +if (!info->line_length) + info->line_length = info->xres * (info->bits_per_pixel >>3 ); +Isn't this already set from the
register_framebufferfunction?
You wanna see that somebody changed this value ininfo->fbops->fb_activate_var(info)?
Quoted 6 lines
Quoted 1 line
Then I would do nothing here.
It is set from
register_framebuffer, but the mode setup invalidates it, So Andre sets it to 0 first and updates it after calling into the driver if necessary. The code looks correct. Maybe I misunderstand you?
ok. Was a hard day and night for me ;-)
Maybe I was too tired and look all day into another code and other things ;-).
I think I need a coffee or beer now.
I mean we have the same code in register_framebuffer:
if (!info->line_length)
info->line_length = info->xres * (info->bits_per_pixel >> 3);
I don't know the exactly context to call fb_setup_mode but then we set it twice and we don't need to check if the value has changed from fb_activate_var function.
It's only a nitpick, but this code is correct. Of course.
- Alex
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH v2 1/6] fb: add a line_length value to struct fb_info
Hi Alexander,
Quoted 48 lines · Alexander Aring
Hi Sascha,
Quoted 32 lines · Sascha Hauer
Quoted 31 lines · Alexander Aring
Quoted 17 lines · Andre Heider
Add support for framebuffers with noncontiguous horizontal lines.
Video drivers can set this value if the hardware requires it. In case a driver does not set it, the current value of xres * (bpp / 8) is used instead.
Signed-off-by Andre Heider <[email protected]>--- drivers/video/fb.c | 11 +++++++++-- include/fb.h | 1 + 2 files changed, 10 insertions(+), 2 deletions(-)drivers/video/fb.c +0
-0drivers/video/fb.c static int fb_setup_mode(struct device_d *dev, struct param_d *param, · line 81
Quoted 10 lines
drivers/video/fb.c +4
-0@@ -72,12 +72,16 @@ static int fb_setup_mode(struct device_d *dev, struct param_d *param, info->xres = info->mode->xres; info->yres = info->mode->yres; + info->line_length =0 ; ret = info->fbops->fb_activate_var (info); +if (!info->line_length) + info->line_length = info->xres * (info->bits_per_pixel >>3 ); +Isn't this already set from the
register_framebufferfunction?
You wanna see that somebody changed this value ininfo->fbops->fb_activate_var(info)?Quoted 6 lines
Quoted 1 line
Then I would do nothing here.
It is set from
register_framebuffer, but the mode setup invalidates it, So Andre sets it to 0 first and updates it after calling into the driver if necessary. The code looks correct. Maybe I misunderstand you?ok. Was a hard day and night for me ;-)
Maybe I was too tired and look all day into another code and other things ;-).I think I need a coffee or beer now.
Quoted 8 lines
I mean we have the same code in
register_framebuffer:if (!info->line_length)
info->line_length = info->xres * (info->bits_per_pixel >> 3);I don't know the exactly context to call
fb_setup_modebut then we set it twice and we don't need to check if the value has changed fromfb_activate_varfunction.
With this patch we have a new line_length value, but fb drivers don't have to set it, its optional. What you see in register_framebuffer() is a default value for the initial mode. The framework sets it in case the driver doesn't.
But we can also change modes, so if a fb driver doesn't update line_length in the fb_activate_var callback, we have a stale line_length value from the old mode.
So I set it to zero before the callback and check afterwards if the driver set it. Without that there would be no way to distinguish if the value is valid for the new mode or a stale one from the prior mode.
Thanks,
Andre
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH v2 1/6] fb: add a line_length value to struct fb_info
Quoted 65 lines · Andre Heider
Hi Alexander,
Quoted 48 lines · Alexander Aring
Hi Sascha,
Quoted 32 lines · Sascha Hauer
Quoted 31 lines · Alexander Aring
Quoted 17 lines · Andre Heider
Add support for framebuffers with noncontiguous horizontal lines.
Video drivers can set this value if the hardware requires it. In case a driver does not set it, the current value of xres * (bpp / 8) is used instead.
Signed-off-by Andre Heider <[email protected]>--- drivers/video/fb.c | 11 +++++++++-- include/fb.h | 1 + 2 files changed, 10 insertions(+), 2 deletions(-)drivers/video/fb.c +0
-0drivers/video/fb.c static int fb_setup_mode(struct device_d *dev, struct param_d *param, · line 81
Quoted 10 lines
drivers/video/fb.c +4
-0@@ -72,12 +72,16 @@ static int fb_setup_mode(struct device_d *dev, struct param_d *param, info->xres = info->mode->xres; info->yres = info->mode->yres; + info->line_length =0 ; ret = info->fbops->fb_activate_var (info); +if (!info->line_length) + info->line_length = info->xres * (info->bits_per_pixel >>3 ); +Isn't this already set from the
register_framebufferfunction?
You wanna see that somebody changed this value ininfo->fbops->fb_activate_var(info)?Quoted 6 lines
Quoted 1 line
Then I would do nothing here.
It is set from
register_framebuffer, but the mode setup invalidates it, So Andre sets it to 0 first and updates it after calling into the driver if necessary. The code looks correct. Maybe I misunderstand you?ok. Was a hard day and night for me ;-)
Maybe I was too tired and look all day into another code and other things ;-).I think I need a coffee or beer now.
Quoted 8 lines
I mean we have the same code in
register_framebuffer:if (!info->line_length)
info->line_length = info->xres * (info->bits_per_pixel >> 3);I don't know the exactly context to call
fb_setup_modebut then we set it twice and we don't need to check if the value has changed fromfb_activate_varfunction.With this patch we have a new
line_lengthvalue, but fb drivers don't have to set it, its optional. What you see inregister_framebuffer()is a default value for the initial mode. The framework sets it in case the driver doesn't.
Quoted 7 lines
But we can also change modes, so if a fb driver doesn't update
line_lengthin thefb_activate_varcallback, we have a staleline_lengthvalue from the old mode.
So I set it to zero before the callback and check afterwards if the driver set it. Without that there would be no way to distinguish if the value is valid for the new mode or a stale one from the prior mode.
ok, thanks for the little explaination.
- Alex
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
PATCH v2 2/6 gui: convert graphic utils to respect line_length
In reply to Andre Heider--- lib/gui/graphic_utils.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
lib/gui/graphic_utils.c +5 -5
@@ -167,18 +167,18 @@ void rgba_blend(struct fb_info *info, struct image *img, void* buf, int height, {unsigned char *adr;int x, y; -int xres; +int line_length;int img_byte_per_pixel =3 ;void *image;if (is_rgba) img_byte_per_pixel++; - xres = info->xres; + line_length = info->line_length;for (y =0 ; y < height; y++) { - adr = buf + ((y + starty) * xres + startx) * - (info->bits_per_pixel >>3 ); + adr = buf + (y + starty) * line_length + + startx * (info->bits_per_pixel >>3 ); image = img->data + (y * img->width *img_byte_per_pixel);for (x =0 ; x < width; x++) {
@@ -219,7 +219,7 @@ int fb_open(const char * fbdev, struct screen *sc, bool offscreen) sc->s.y =0 ; sc->s.width = sc->info.xres; sc->s.height = sc->info.yres; - sc->fbsize = sc->s.width * sc->s.height * (sc->info.bits_per_pixel >>3 ); + sc->fbsize = sc->info.line_length * sc->s.height;if (offscreen) {/* Don't fail if malloc fails, just continue rendering directly
Signature · 7 lines
1.8.3.2 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH v2 3/6 gui: convert the bmp renderer to respect line_length
In reply to Andre Heider--- lib/gui/bmp.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
lib/gui/bmp.c +4 -4
@@ -78,8 +78,8 @@ static int bmp_renderer(struct screen *sc, struct surface *s, struct image *img) image = (char *)bmp +le32_to_cpu (bmp->header.data_offset); image += (img->height - y -1 ) * img->width * (bits_per_pixel >>3 ); - adr = buf + ((y + starty) * sc->s.width + startx) * - (sc->info.bits_per_pixel >>3 ); + adr = buf + (y + starty) * sc->info.line_length + + startx * (sc->info.bits_per_pixel >>3 );for (x =0 ; x < width; x++) {int pixel;
@@ -100,8 +100,8 @@ static int bmp_renderer(struct screen *sc, struct surface *s, struct image *img) image = (char *)bmp +le32_to_cpu (bmp->header.data_offset); image += (img->height - y -1 ) * img->width * (bits_per_pixel >>3 ); - adr = buf + ((y + starty) * sc->s.width + startx) * - (sc->info.bits_per_pixel >>3 ); + adr = buf + (y + starty) * sc->info.line_length + + startx * (sc->info.bits_per_pixel >>3 );for (x =0 ; x < width; x++) {char *pixel;
Signature · 7 lines
1.8.3.2 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH v2 4/6 ARM: bcm2835: add missing mbox overscan response field
In reply to Andre HeiderAdd the missing "right" field to struct bcm2835_mbox_tag_overscan.
--- arch/arm/mach-bcm2835/include/mach/mbox.h | 1 + 1 file changed, 1 insertion(+)
arch/arm/mach-bcm2835/include/mach/mbox.h +1 -0
@@ -355,6 +355,7 @@ struct bcm2835_mbox_tag_overscan {u32 top;u32 bottom;u32 left; +u32 right; } resp; } body; };
Signature · 7 lines
1.8.3.2 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH v2 5/6 video: add a BCM2835 framebuffer driver
In reply to Andre HeiderUse the mailbox driver to set up a framebuffer based on the firmware configuration.
--- arch/arm/boards/raspberry-pi/rpi.c | 1 + arch/arm/mach-bcm2835/include/mach/core.h | 5 ++ drivers/video/Kconfig | 6 ++ drivers/video/Makefile | 1 + drivers/video/bcm2835.c | 136 ++++++++++++++++++++++++++++++ 5 files changed, 149 insertions(+) create mode 100644 drivers/video/bcm2835.c
arch/arm/boards/raspberry-pi/rpi.c +1 -0
@@ -140,6 +140,7 @@ static int rpi_env_init(void)static int rpi_devices_init (void ) {bcm2835_register_mci (); +bcm2835_register_fb ();armlinux_set_architecture (MACH_TYPE_BCM2708 );armlinux_set_bootparams ((void *)(0x00000100 ));rpi_env_init ();
arch/arm/mach-bcm2835/include/mach/core.h +5 -0
@@ -27,4 +27,9 @@ static void inline bcm2835_register_mci(void) IORESOURCE_MEM, NULL); } +static void inline bcm2835_register_fb (void ) +{ +add_generic_device ("bcm2835_fb" ,0 ,NULL ,0 ,0 ,0 ,NULL ); +} +#endif
drivers/video/Kconfig +6 -0
@@ -71,4 +71,10 @@ config DRIVER_VIDEO_PXA Add support for the frame buffer device found on the PXA270 CPU. +config DRIVER_VIDEO_BCM2835 + bool "BCM2835 framebuffer driver" + depends on ARCH_BCM2835 + help + Add support for the BCM2835/VideoCore frame buffer device. + endif
drivers/video/Makefile +1 -0
@@ -9,3 +9,4 @@ obj-$(CONFIG_DRIVER_VIDEO_S3C24XX) += s3c24xx.o obj-$(CONFIG_DRIVER_VIDEO_PXA) += pxa.o obj-$(CONFIG_DRIVER_VIDEO_SDL) += sdl.o obj-$(CONFIG_DRIVER_VIDEO_OMAP) += omap.o +obj-$(CONFIG_DRIVER_VIDEO_BCM2835) += bcm2835.o
drivers/video/bcm2835.c new file +136 -0
136 lines not on this page · raw message
Signature · 7 lines
1.8.3.2 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH v2 6/6 video: set up the kernel's simple framebuffer driver
In reply to Andre HeiderAdd support to configure the active framebuffer for the kernel through device tree.
--- drivers/video/Kconfig | 8 +++ drivers/video/Makefile | 1 + drivers/video/simplefb.c | 171 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 180 insertions(+) create mode 100644 drivers/video/simplefb.c
drivers/video/Kconfig +8 -0
@@ -77,4 +77,12 @@ config DRIVER_VIDEO_BCM2835 help Add support for the BCM2835/VideoCore frame buffer device. +config DRIVER_VIDEO_SIMPLEFB + bool "Simple framebuffer support" + depends on OFTREE + depends on DRIVER_VIDEO_BCM2835 + help + Add support for setting up the kernel's simple framebuffer driver + based on the active barebox framebuffer. + endif
drivers/video/Makefile +1 -0
@@ -10,3 +10,4 @@ obj-$(CONFIG_DRIVER_VIDEO_PXA) += pxa.o obj-$(CONFIG_DRIVER_VIDEO_SDL) += sdl.o obj-$(CONFIG_DRIVER_VIDEO_OMAP) += omap.o obj-$(CONFIG_DRIVER_VIDEO_BCM2835) += bcm2835.o +obj-$(CONFIG_DRIVER_VIDEO_SIMPLEFB) += simplefb.o
drivers/video/simplefb.c new file +171 -0
171 lines not on this page · raw message
Signature · 7 lines
1.8.3.2 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Hi Andre,
Quoted 15 lines · Andre Heider
This is v2 of my patch set posted on 10/24.
It adds framebuffer support for the RPi and provides an additional config knob to set up the kernel's simplefb driver. The active barebox framebuffer is basis for that feature, so that other platforms can make use of it.This simplefb option depends on the bcm2835 fb driver since drivers need to be aware of simplefb: framebuffers need to stay configured and cannot be teared down.
The RPi case is rather simple in this regard. The allocated framebuffer lies within the memory range of the VideoCore of the ARM/VC memory split. Hence, there is no memory range that needs to be reserved as far as the ARM side of things is concerned.
This likely needs to be added once other fb driver want to use simplefb.
Quoted 5 lines
Changes since v1:
* renamed "pitch" to "line_length" to match the kernel
* the bcm2835 framebuffer driver is now standalone
* configuring simplefb for the kernel is based on the active barebox framebuffer
I applied this series without the simplefb patch.
For the simplefb I'd like to use the following patch instead. It's your patch with some adjustments:
- add a register_simplefb device parameter to make it configurable whether a simplefb node should be created or not.
- register the OF fixup in register_framebuffer(). This way we always have a simplefb node once a framebuffer is registered without getting spurious warnings when there is no framebuffer present.
- check if the framebuffer is actually enabled. If it's not, we shouldn't register a simplefb node.
Are you fine with this and if yes, could you give the patch a test? It depends on the add-context-pointer-to-of_register_fixup patch I just posted. Just try the current -next branch, it should contain all you need for testing.
One oddity I just realized is that my patch will try and create a /framebuffer node multiple times if multiple framebuffers exist. I would have to fix this.
Sascha
8<----------------------------------------------------------
From 97607e85cdc44824e9617c74325bc9bc6405c383 Mon Sep 17 00:00:00 2001
From: Andre Heider <[email protected]>
Date: Tue, 5 Nov 2013 00:01:04 +0100
Subject: [PATCH] video: set up the kernel's simple framebuffer driver
Add support to configure the active framebuffer for the kernel through device tree.
--- drivers/video/Kconfig | 7 ++ drivers/video/Makefile | 1 + drivers/video/fb.c | 7 ++ drivers/video/simplefb.c | 167 +++++++++++++++++++++++++++++++++++++++++++++++ include/fb.h | 7 ++ 5 files changed, 189 insertions(+) create mode 100644 drivers/video/simplefb.c
drivers/video/Kconfig +7 -0
@@ -77,4 +77,11 @@ config DRIVER_VIDEO_BCM2835 help Add support for the BCM2835/VideoCore frame buffer device. +config DRIVER_VIDEO_SIMPLEFB + bool "Simple framebuffer support" + depends on OFTREE + help + Add support for setting up the kernel's simple framebuffer driver + based on the active barebox framebuffer. + endif
drivers/video/Makefile +1 -0
@@ -10,3 +10,4 @@ obj-$(CONFIG_DRIVER_VIDEO_PXA) += pxa.o obj-$(CONFIG_DRIVER_VIDEO_SDL) += sdl.o obj-$(CONFIG_DRIVER_VIDEO_OMAP) += omap.o obj-$(CONFIG_DRIVER_VIDEO_BCM2835) += bcm2835.o +obj-$(CONFIG_DRIVER_VIDEO_SIMPLEFB) += simplefb.o
drivers/video/fb.c +7 -0
@@ -163,6 +163,13 @@ int register_framebuffer(struct fb_info *info)if (ret) goto err_unregister; +if (IS_ENABLED (CONFIG_DRIVER_VIDEO_SIMPLEFB )) { + ret =fb_register_simplefb (info); +if (ret) +dev_err (&info->dev,"failed to register simplefb: %s\n" , +strerror (-ret)); + } +return 0 ; err_unregister:
drivers/video/simplefb.c new file +167 -0
167 lines not on this page · raw message
include/fb.h +7 -0
@@ -105,6 +105,9 @@ struct fb_info {int enabled;int p_enable; +int register_simplefb;/* If true a simplefb device node will +* be created. +*/ };int register_framebuffer (struct fb_info *info);
@@ -115,5 +118,9 @@ int register_framebuffer(struct fb_info *info);extern struct bus_type fb_bus; +/* fb internal functions */ + +int fb_register_simplefb (struct fb_info *info); +#endif /* __FB_H */
Signature · 13 lines
1.8.4.rc3 -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Hi Sascha,
drivers/video/fb.c int register_framebuffer(struct fb_info *info) · line 170
Quoted 10 lines · Sascha Hauer
Hi Andre,
drivers/video/fb.c +5
-0@@ -163,6 +163,13 @@ int register_framebuffer(struct fb_info *info)if (ret) goto err_unregister; +if (IS_ENABLED (CONFIG_DRIVER_VIDEO_SIMPLEFB )) { + ret =fb_register_simplefb (info); +if (ret) +dev_err (&info->dev,"failed to register simplefb: %s\n" , +strerror (-ret));
maybe we should return ret here?
drivers/video/simplefb.c
Quoted 6 lines
drivers/video/fb.c +2
-0+ } +return 0 ; err_unregister:drivers/video/simplefb.c +0
-0
- Alex
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Quoted 8 lines · Alexander Aring
Hi Sascha,
Quoted 5 lines · Sascha Hauer
Hi Andre,
drivers/video/fb.c +0
-0@@ -163,6 +163,13 @@ int register_framebuffer(struct fb_info *info)if (ret) goto err_unregister;
Quoted 6 lines
drivers/video/fb.c int register_framebuffer(struct fb_info *info) · line 170
Quoted 5 lines
drivers/video/fb.c +5
-0+if (IS_ENABLED (CONFIG_DRIVER_VIDEO_SIMPLEFB )) { + ret =fb_register_simplefb (info); +if (ret) +dev_err (&info->dev,"failed to register simplefb: %s\n" , +strerror (-ret));maybe we should return ret here?
I think it's fine to continue without simplefb here. In the end the framebuffer works, just without simplefb.
Sascha
Signature · 9 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Quoted 16 lines · Sascha Hauer
Quoted 8 lines · Alexander Aring
Hi Sascha,
Quoted 5 lines · Sascha Hauer
Hi Andre,
drivers/video/fb.c +0
-0@@ -163,6 +163,13 @@ int register_framebuffer(struct fb_info *info)if (ret) goto err_unregister;Quoted 6 lines
drivers/video/fb.c int register_framebuffer(struct fb_info *info) · line 170
Quoted 5 lines
drivers/video/fb.c +5
-0+if (IS_ENABLED (CONFIG_DRIVER_VIDEO_SIMPLEFB )) { + ret =fb_register_simplefb (info); +if (ret) +dev_err (&info->dev,"failed to register simplefb: %s\n" , +strerror (-ret));maybe we should return ret here?
Quoted 3 lines
I think it's fine to continue without simplefb here. In the end the framebuffer works, just without simplefb.
ok, thanks.
- Alex
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Hi Sascha,
Quoted 18 lines · Sascha Hauer
Hi Andre,
Quoted 15 lines · Andre Heider
This is v2 of my patch set posted on 10/24.
It adds framebuffer support for the RPi and provides an additional config knob to set up the kernel's simplefb driver. The active barebox framebuffer is basis for that feature, so that other platforms can make use of it.This simplefb option depends on the bcm2835 fb driver since drivers need to be aware of simplefb: framebuffers need to stay configured and cannot be teared down.
The RPi case is rather simple in this regard. The allocated framebuffer lies within the memory range of the VideoCore of the ARM/VC memory split. Hence, there is no memory range that needs to be reserved as far as the ARM side of things is concerned.
This likely needs to be added once other fb driver want to use simplefb.
Quoted 7 lines
Quoted 5 lines
Changes since v1:
* renamed "pitch" to "line_length" to match the kernel
* the bcm2835 framebuffer driver is now standalone
* configuring simplefb for the kernel is based on the active barebox framebufferI applied this series without the simplefb patch.
thanks!
Quoted 12 lines
For the simplefb I'd like to use the following patch instead. It's your patch with some adjustments:
- add a
register_simplefbdevice parameter to make it configurable whether a simplefb node should be created or not.
- register the OF fixup inregister_framebuffer(). This way we always have a simplefb node once a framebuffer is registered without getting spurious warnings when there is no framebuffer present.
- check if the framebuffer is actually enabled. If it's not, we shouldn't register a simplefb node.
Quoted 4 lines
Are you fine with this and if yes, could you give the patch a test? It depends on the add-context-pointer-to-of_register_fixup patch I just posted. Just try the current -next branch, it should contain all you need for testing.
Neat, that looks nicer, so no objection here ;)
And yes, it works if I set fb0.enable=1 and fb0.register_simplefb=1, both are 0 per default.
Now I wonder who/where those are supposed to get set? Is that a job for the runtime environment?
I didn't really care about the enabled parameter until now, there isn't anything to do in the fb_enable callback for this fb driver and splash doesn't seem to care either.
Regards,
Andre
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Hi Sascha,
Quoted 5 lines · Andre Heider
And yes, it works if I set fb0.enable=1 and fb0.register_simplefb=1, both are 0 per default.
Now I wonder who/where those are supposed to get set? Is that a job for the runtime environment?
if possible I'd like to make the fb work out of the box. Setting these two parameters to default to "1" feels wrong (and I didn't find other drivers to do so). Any suggestions?
Thanks,
Andre
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Quoted 6 lines · Andre Heider
Hi Sascha,
Quoted 3 lines · Andre Heider
And yes, it works if I set fb0.enable=1 and fb0.register_simplefb=1, both are 0 per default.
Quoted 6 lines
Quoted 2 lines
Now I wonder who/where those are supposed to get set? Is that a job for the runtime environment?
if possible I'd like to make the fb work out of the box. Setting these two parameters to default to "1" feels wrong (and I didn't find other drivers to do so). Any suggestions?
Normally the policy is that a framebuffer is not enabled during registration. This makes sense because normally the framebuffer doesn't contain a useful picture, so users should set a picture and enable the framebuffer afterwards to avoid flickering.
In your case the situation is different though. The display hardware is already enabled when you enter barebox, right? In this case I suggest that you set info->p_enable to true before calling register_framebuffer from the bcm2835 driver. This should be the right thing to do since it only reflects the hardware status.
Also I think you can set info->register_simplefb to true aswell in the bcm2835 driver since on that platform this is probably a sane default.
Sascha
Signature · 9 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Quoted 14 lines · Sascha Hauer
Quoted 6 lines · Andre Heider
Hi Sascha,
Quoted 3 lines · Andre Heider
And yes, it works if I set fb0.enable=1 and fb0.register_simplefb=1, both are 0 per default.
Quoted 6 lines
Quoted 2 lines
Now I wonder who/where those are supposed to get set? Is that a job for the runtime environment?
if possible I'd like to make the fb work out of the box. Setting these two parameters to default to "1" feels wrong (and I didn't find other drivers to do so). Any suggestions?
Quoted 7 lines
Normally the policy is that a framebuffer is not enabled during registration. This makes sense because normally the framebuffer doesn't contain a useful picture, so users should set a picture and enable the framebuffer afterwards to avoid flickering.
In your case the situation is different though. The display hardware is already enabled when you enter barebox, right?
Right.
Quoted 7 lines
In this case I suggest
that you setinfo->p_enableto true before callingregister_framebufferfrom the bcm2835 driver. This should be the right thing to do since it only reflects the hardware status.Also I think you can set
info->register_simplefbto true aswell in the bcm2835 driver since on that platform this is probably a sane default.
Ok, easy enough ;)
Thanks,
Andre
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox