summaryrefslogtreecommitdiff
path: root/drivers/video/tegra/fb.c
diff options
context:
space:
mode:
authorKevin Huang <kevinh@nvidia.com>2011-06-06 14:16:54 -0700
committerDan Willemsen <dwillemsen@nvidia.com>2011-11-30 21:47:23 -0800
commit7952212afd1566cdfebc02f55cfc3b5013ff6f0e (patch)
treea696708af6df82e5bacc6a233171eb510471ce31 /drivers/video/tegra/fb.c
parentd44e2fd485cb3b95845f45385b80ab9cd1b01ba7 (diff)
video: tegra: Aligned the stride of fb to 16-byte boundary.
Aligned memory can improve the performance memory access. Also, since the bootloader fb is aligned, kernel needs to do it to avoid skew. Original-Change-Id: Ia5a122539856da9e9c73580929b8ea9c73e86c9d Reviewed-on: http://git-master/r/35276 Reviewed-by: Varun Colbert <vcolbert@nvidia.com> Tested-by: Varun Colbert <vcolbert@nvidia.com> Rebase-Id: Rdc32cc0c095903cb731b47e96b5723b13066b63b
Diffstat (limited to 'drivers/video/tegra/fb.c')
-rw-r--r--drivers/video/tegra/fb.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/video/tegra/fb.c b/drivers/video/tegra/fb.c
index 2954661a4064..2d40e22a697e 100644
--- a/drivers/video/tegra/fb.c
+++ b/drivers/video/tegra/fb.c
@@ -43,6 +43,9 @@
#include "nvmap/nvmap.h"
#include "dc/dc_priv.h"
+/* Pad pitch to 16-byte boundary. */
+#define TEGRA_LINEAR_PITCH_ALIGNMENT 16
+
struct tegra_fb_info {
struct tegra_dc_win *win;
struct nvhost_device *ndev;
@@ -169,7 +172,9 @@ static int tegra_fb_set_par(struct fb_info *info)
return -EINVAL;
}
info->fix.line_length = var->xres * var->bits_per_pixel / 8;
- tegra_fb->win->stride = info->fix.line_length;
+ /* Pad the stride to 16-byte boundary. */
+ tegra_fb->win->stride = round_up(info->fix.line_length,
+ TEGRA_LINEAR_PITCH_ALIGNMENT);
tegra_fb->win->stride_uv = 0;
tegra_fb->win->offset_u = 0;
tegra_fb->win->offset_v = 0;
@@ -832,6 +837,8 @@ struct tegra_fb_info *tegra_fb_register(struct nvhost_device *ndev,
win->offset_u = 0;
win->offset_v = 0;
win->stride = fb_data->xres * fb_data->bits_per_pixel / 8;
+ /* Pad the stride to 16-byte boundary. */
+ win->stride = round_up(win->stride, TEGRA_LINEAR_PITCH_ALIGNMENT);
win->stride_uv = 0;
win->flags = TEGRA_WIN_FLAG_ENABLED;