mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Andre Heider <a.heider@gmail.com>
To: barebox@lists.infradead.org
Subject: [PATCH 1/6] fb: add a stride value to struct fb_info
Date: Thu, 24 Oct 2013 22:23:41 +0200	[thread overview]
Message-ID: <1382646226-24871-2-git-send-email-a.heider@gmail.com> (raw)
In-Reply-To: <1382646226-24871-1-git-send-email-a.heider@gmail.com>

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 <a.heider@gmail.com>
---
 drivers/video/fb.c | 11 +++++++++--
 include/fb.h       |  1 +
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/video/fb.c b/drivers/video/fb.c
index 420e4e3..e80fab9 100644
--- a/drivers/video/fb.c
+++ b/drivers/video/fb.c
@@ -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->stride = 0;
 
 	ret = info->fbops->fb_activate_var(info);
 
+	if (!info->stride)
+		info->stride = 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->stride * 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->stride)
+		info->stride = 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->stride * info->yres;
 	info->cdev.dev = dev;
 	info->cdev.priv = info;
 	dev->resource = xzalloc(sizeof(struct resource));
diff --git a/include/fb.h b/include/fb.h
index df4ba8e..ba46954 100644
--- a/include/fb.h
+++ b/include/fb.h
@@ -94,6 +94,7 @@ struct fb_info {
 	u32 xres;			/* visible resolution		*/
 	u32 yres;
 	u32 bits_per_pixel;		/* guess what			*/
+	u32 stride;			/* number of bytes in each line	*/
 
 	u32 grayscale;			/* != 0 Graylevels instead of colors */
 
-- 
1.8.3.2


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

  reply	other threads:[~2013-10-24 20:24 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-24 20:23 [PATCH 0/6] simple framebuffer driver with RPi support Andre Heider
2013-10-24 20:23 ` Andre Heider [this message]
2013-10-25 10:58   ` [PATCH 1/6] fb: add a stride value to struct fb_info Jean-Christophe PLAGNIOL-VILLARD
2013-10-25 11:51     ` Andre Heider
2013-10-25 23:04     ` Sascha Hauer
2013-10-24 20:23 ` [PATCH 2/6] gui: convert graphic utils to respect the stride value Andre Heider
2013-10-24 20:23 ` [PATCH 3/6] gui: convert the bmp renderer " Andre Heider
2013-10-24 20:23 ` [PATCH 4/6] video: add a simple framebuffer driver Andre Heider
2013-10-24 20:23 ` [PATCH 5/6] ARM: bcm2835: add missing mbox overscan response field Andre Heider
2013-10-24 20:23 ` [PATCH 6/6] ARM: rpi: add support for simplefb Andre Heider
2013-10-25  7:56 ` [PATCH 0/6] simple framebuffer driver with RPi support Andre Heider
2013-10-25 23:51   ` Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1382646226-24871-2-git-send-email-a.heider@gmail.com \
    --to=a.heider@gmail.com \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox