diff options
-rw-r--r-- | drivers/video/tegra/fb.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/video/tegra/fb.c b/drivers/video/tegra/fb.c index 007d713ab948..a9964946f2cc 100644 --- a/drivers/video/tegra/fb.c +++ b/drivers/video/tegra/fb.c @@ -122,10 +122,13 @@ static int tegra_fb_set_par(struct fb_info *info) default: return -EINVAL; } - info->fix.line_length = var->xres * var->bits_per_pixel / 8; - /* Pad the stride to 16-byte boundary. */ - info->fix.line_length = round_up(info->fix.line_length, + /* if line_length unset, then pad the stride */ + if (!info->fix.line_length) { + info->fix.line_length = var->xres * var->bits_per_pixel + / 8; + info->fix.line_length = round_up(info->fix.line_length, TEGRA_LINEAR_PITCH_ALIGNMENT); + } tegra_fb->win->stride = info->fix.line_length; tegra_fb->win->stride_uv = 0; tegra_fb->win->phys_addr_u = 0; @@ -516,8 +519,10 @@ struct tegra_fb_info *tegra_fb_register(struct nvhost_device *ndev, tegra_fb->valid = true; } + info->fix.line_length = fb_data->xres * fb_data->bits_per_pixel / 8; + stride = tegra_dc_get_stride(dc, 0); - if (!stride) /* default to pad the stride to 16-byte boundary. */ + if (!stride) /* default to pad the stride */ stride = round_up(info->fix.line_length, TEGRA_LINEAR_PITCH_ALIGNMENT); @@ -534,7 +539,6 @@ struct tegra_fb_info *tegra_fb_register(struct nvhost_device *ndev, info->fix.accel = FB_ACCEL_NONE; info->fix.smem_start = fb_phys; info->fix.smem_len = fb_size; - info->fix.line_length = fb_data->xres * fb_data->bits_per_pixel / 8; info->fix.line_length = stride; info->var.xres = fb_data->xres; |