video: tegra: fb: Default stride from HW
Christopher Freeman [Tue, 28 Aug 2012 00:36:15 +0000 (17:36 -0700)]
This patch adds:

1.  line_stride value is honored in fb_set_par routine
2.  Hardware value for line_stride is used in fb_register

Bug 1025739

Change-Id: Ic37c4c90911c2c70e74b8d5609f3b32b521772ff
Signed-off-by: Christopher Freeman <cfreeman@nvidia.com>
Reviewed-on: http://git-master/r/127690
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Kevin Huang (Eng-SW) <kevinh@nvidia.com>
Reviewed-by: Jon Mayo <jmayo@nvidia.com>

drivers/video/tegra/fb.c

index 007d713..a996494 100644 (file)
@@ -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;