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. Signed-off-by: Andre Heider <a.heider@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
7a305b2d8a
commit
485544f0fb
|
@ -72,12 +72,16 @@ static int fb_setup_mode(struct device_d *dev, struct param_d *param,
|
||||||
|
|
||||||
info->xres = info->mode->xres;
|
info->xres = info->mode->xres;
|
||||||
info->yres = info->mode->yres;
|
info->yres = info->mode->yres;
|
||||||
|
info->line_length = 0;
|
||||||
|
|
||||||
ret = info->fbops->fb_activate_var(info);
|
ret = info->fbops->fb_activate_var(info);
|
||||||
|
|
||||||
|
if (!info->line_length)
|
||||||
|
info->line_length = info->xres * (info->bits_per_pixel >> 3);
|
||||||
|
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
dev->resource[0].start = (resource_size_t)info->screen_base;
|
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->resource[0].end = dev->resource[0].start + info->cdev.size - 1;
|
||||||
dev_param_set_generic(dev, param, val);
|
dev_param_set_generic(dev, param, val);
|
||||||
} else
|
} else
|
||||||
|
@ -122,9 +126,12 @@ int register_framebuffer(struct fb_info *info)
|
||||||
|
|
||||||
dev = &info->dev;
|
dev = &info->dev;
|
||||||
|
|
||||||
|
if (!info->line_length)
|
||||||
|
info->line_length = info->xres * (info->bits_per_pixel >> 3);
|
||||||
|
|
||||||
info->cdev.ops = &fb_ops;
|
info->cdev.ops = &fb_ops;
|
||||||
info->cdev.name = asprintf("fb%d", id);
|
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.dev = dev;
|
||||||
info->cdev.priv = info;
|
info->cdev.priv = info;
|
||||||
dev->resource = xzalloc(sizeof(struct resource));
|
dev->resource = xzalloc(sizeof(struct resource));
|
||||||
|
|
|
@ -94,6 +94,7 @@ struct fb_info {
|
||||||
u32 xres; /* visible resolution */
|
u32 xres; /* visible resolution */
|
||||||
u32 yres;
|
u32 yres;
|
||||||
u32 bits_per_pixel; /* guess what */
|
u32 bits_per_pixel; /* guess what */
|
||||||
|
u32 line_length; /* length of a line in bytes */
|
||||||
|
|
||||||
u32 grayscale; /* != 0 Graylevels instead of colors */
|
u32 grayscale; /* != 0 Graylevels instead of colors */
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue