video: tegra: dc: use height for rotated bw calc
Jon Mayo [Tue, 5 Mar 2013 22:37:57 +0000 (14:37 -0800)]
Swap input width and height when calculating window bandwidth for rotated
windows.

Bug 1243957

Change-Id: I9f972e3dd7bcd8ca74596595a2066cb9d56de3b7
Signed-off-by: Jon Mayo <jmayo@nvidia.com>
Reviewed-on: http://git-master/r/206438
(cherry picked from commit cf9b403efbb2c5f0ae825eb17b767571dadf2e80)
Reviewed-on: http://git-master/r/221318
GVS: Gerrit_Virtual_Submit

drivers/video/tegra/dc/bandwidth.c

index d51c30c..d7882d8 100644 (file)
@@ -149,6 +149,7 @@ static unsigned long tegra_dc_calc_win_bandwidth(struct tegra_dc *dc,
        unsigned long ret;
        int tiled_windows_bw_multiplier;
        unsigned long bpp;
+       unsigned in_w;
 
        if (!WIN_IS_ENABLED(w))
                return 0;
@@ -156,6 +157,11 @@ static unsigned long tegra_dc_calc_win_bandwidth(struct tegra_dc *dc,
        if (dfixed_trunc(w->w) == 0 || dfixed_trunc(w->h) == 0 ||
            w->out_w == 0 || w->out_h == 0)
                return 0;
+       if (w->flags & TEGRA_WIN_FLAG_SCAN_COLUMN)
+               /* rotated: PRESCALE_SIZE swapped, but WIN_SIZE is unchanged */
+               in_w = dfixed_trunc(w->h);
+       else
+               in_w = dfixed_trunc(w->w); /* normal output, not rotated */
 
        tiled_windows_bw_multiplier =
                tegra_mc_get_tiled_memory_bandwidth_multiplier();
@@ -169,7 +175,7 @@ static unsigned long tegra_dc_calc_win_bandwidth(struct tegra_dc *dc,
 #if defined(CONFIG_ARCH_TEGRA_2x_SOC) || defined(CONFIG_ARCH_TEGRA_3x_SOC)
                (win_use_v_filter(dc, w) ? 2 : 1) *
 #endif
-               dfixed_trunc(w->w) / w->out_w * (WIN_IS_TILED(w) ?
+               in_w / w->out_w * (WIN_IS_TILED(w) ?
                tiled_windows_bw_multiplier : 1);
 
 #ifdef CONFIG_ARCH_TEGRA_2x_SOC