mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* fix framebuffer memory base address
@ 2011-01-14 19:48 Sascha Hauer
  2011-01-14 19:48 ` [PATCH] fb: update cdev map_base Sascha Hauer
  2011-01-15 16:54 ` fix framebuffer memory base address Gregory CLEMENT
  0 siblings, 2 replies; 5+ messages in thread
From: Sascha Hauer @ 2011-01-14 19:48 UTC (permalink / raw)
  To: barebox

The following should fix the framebuffer base address when multiple
video modes are enabled.
Gregory, can you please check if this obsoletes patch 1/4 you sent?

Sascha


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] fb: update cdev map_base
  2011-01-14 19:48 fix framebuffer memory base address Sascha Hauer
@ 2011-01-14 19:48 ` Sascha Hauer
  2011-01-17  9:38   ` Gregory CLEMENT
  2011-01-17 17:58   ` Sascha Hauer
  2011-01-15 16:54 ` fix framebuffer memory base address Gregory CLEMENT
  1 sibling, 2 replies; 5+ messages in thread
From: Sascha Hauer @ 2011-01-14 19:48 UTC (permalink / raw)
  To: barebox

Calling fb_activate_var potentially changes the framebuffer address,
so we have to update the fb0 cdev afterwards.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/video/fb.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/video/fb.c b/drivers/video/fb.c
index aad0e1f..ba34b9c 100644
--- a/drivers/video/fb.c
+++ b/drivers/video/fb.c
@@ -79,6 +79,8 @@ static int fb_setup_mode(struct device_d *dev, struct param_d *param,
 
 	ret = info->fbops->fb_activate_var(info);
 
+	dev->map_base = (unsigned long)info->screen_base;
+
 	if (ret == 0)
 		dev_param_set_generic(dev, param, val);
 
-- 
1.7.2.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: fix framebuffer memory base address
  2011-01-14 19:48 fix framebuffer memory base address Sascha Hauer
  2011-01-14 19:48 ` [PATCH] fb: update cdev map_base Sascha Hauer
@ 2011-01-15 16:54 ` Gregory CLEMENT
  1 sibling, 0 replies; 5+ messages in thread
From: Gregory CLEMENT @ 2011-01-15 16:54 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

On 01/14/2011 08:48 PM, Sascha Hauer wrote:
> The following should fix the framebuffer base address when multiple
> video modes are enabled.
> Gregory, can you please check if this obsoletes patch 1/4 you sent?
> 

I integrated your patch in my git tree replacing my patch 1/4. I built
barebox, and I will test it on Monday on my board.

I didn't dare modify this file and I just touched the file related to my
platform. But clearly your patch seems better than my solution.

> Sascha
> 


-- 
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] fb: update cdev map_base
  2011-01-14 19:48 ` [PATCH] fb: update cdev map_base Sascha Hauer
@ 2011-01-17  9:38   ` Gregory CLEMENT
  2011-01-17 17:58   ` Sascha Hauer
  1 sibling, 0 replies; 5+ messages in thread
From: Gregory CLEMENT @ 2011-01-17  9:38 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

Hi Sascha,

You can revert the patch 1/4 I sent and add my Tested-by on this one.

On 01/14/2011 08:48 PM, Sascha Hauer wrote:
> Calling fb_activate_var potentially changes the framebuffer address,
> so we have to update the fb0 cdev afterwards.
> 
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---
>  drivers/video/fb.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/video/fb.c b/drivers/video/fb.c
> index aad0e1f..ba34b9c 100644
> --- a/drivers/video/fb.c
> +++ b/drivers/video/fb.c
> @@ -79,6 +79,8 @@ static int fb_setup_mode(struct device_d *dev, struct param_d *param,
>  
>  	ret = info->fbops->fb_activate_var(info);
>  
> +	dev->map_base = (unsigned long)info->screen_base;
> +
>  	if (ret == 0)
>  		dev_param_set_generic(dev, param, val);
>  


-- 
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] fb: update cdev map_base
  2011-01-14 19:48 ` [PATCH] fb: update cdev map_base Sascha Hauer
  2011-01-17  9:38   ` Gregory CLEMENT
@ 2011-01-17 17:58   ` Sascha Hauer
  1 sibling, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2011-01-17 17:58 UTC (permalink / raw)
  To: barebox

On Fri, Jan 14, 2011 at 08:48:44PM +0100, Sascha Hauer wrote:
> Calling fb_activate_var potentially changes the framebuffer address,
> so we have to update the fb0 cdev afterwards.
> 
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---
>  drivers/video/fb.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/video/fb.c b/drivers/video/fb.c
> index aad0e1f..ba34b9c 100644
> --- a/drivers/video/fb.c
> +++ b/drivers/video/fb.c
> @@ -79,6 +79,8 @@ static int fb_setup_mode(struct device_d *dev, struct param_d *param,
>  
>  	ret = info->fbops->fb_activate_var(info);
>  
> +	dev->map_base = (unsigned long)info->screen_base;
> +
>  	if (ret == 0)
>  		dev_param_set_generic(dev, param, val);
>  


Unfortunately this is not enough. We also have to update xres, yres and
size, like in the following patch:

8<------------------------------------------------

[PATCH 5/5] fb: When setting a mode, also update xres, yres and fb size

Also, set size to 0 when setting up the framebuffer failed so that
the user cannot write to uninitialized framebuffer memory.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/video/fb.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/video/fb.c b/drivers/video/fb.c
index ba34b9c..cf21c4b 100644
--- a/drivers/video/fb.c
+++ b/drivers/video/fb.c
@@ -77,12 +77,18 @@ static int fb_setup_mode(struct device_d *dev, struct param_d *param,
 
 	info->mode = &info->mode_list[mode];
 
-	ret = info->fbops->fb_activate_var(info);
+	info->xres = info->mode->xres;
+	info->yres = info->mode->yres;
 
-	dev->map_base = (unsigned long)info->screen_base;
+	ret = info->fbops->fb_activate_var(info);
 
-	if (ret == 0)
+	if (!ret) {
+		dev->map_base = (unsigned long)info->screen_base;
+		info->cdev.size = info->xres * info->yres * (info->bits_per_pixel >> 3);
+		dev->size = info->cdev.size;
 		dev_param_set_generic(dev, param, val);
+	} else
+		info->cdev.size = 0;
 
 	return ret;
 }
-- 
1.7.2.3

-- 
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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-01-17 17:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-14 19:48 fix framebuffer memory base address Sascha Hauer
2011-01-14 19:48 ` [PATCH] fb: update cdev map_base Sascha Hauer
2011-01-17  9:38   ` Gregory CLEMENT
2011-01-17 17:58   ` Sascha Hauer
2011-01-15 16:54 ` fix framebuffer memory base address Gregory CLEMENT

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox