video: tegra: fix three overlay window blending
authorAri Hirvonen <ahirvonen@nvidia.com>
Thu, 30 Dec 2010 13:27:28 +0000 (15:27 +0200)
committerErik Gilling <konkers@android.com>
Wed, 5 Jan 2011 01:50:07 +0000 (17:50 -0800)
Change-Id: I36e2540b5b98817b87efbe4ca2b1f4d4f19ceba4
Signed-off-by: Michael I. Gold <gold@nvidia.com>
drivers/video/tegra/dc/dc.c

index 3c3a4754b7dc0d869d0e08c083cda6cfd1dcafbb..946d3da7dc2c54601f019af6dfc6118f09a55809 100644 (file)
@@ -369,7 +369,7 @@ static int get_topmost_window(u32 *depths, unsigned long *wins)
 {
        int idx, best = -1;
 
-       for_each_set_bit(idx, wins, sizeof(*wins)) {
+       for_each_set_bit(idx, wins, DC_N_WINDOWS) {
                if (best == -1 || depths[idx] < depths[best])
                        best = idx;
        }
@@ -406,13 +406,15 @@ static u32 blend_2win(int idx, unsigned long behind_mask, u32* flags, int xy)
 static u32 blend_3win(int idx, unsigned long behind_mask, u32* flags)
 {
        unsigned long infront_mask;
+       int first;
 
        infront_mask = ~(behind_mask | BIT(idx));
        infront_mask &= (BIT(DC_N_WINDOWS) - 1);
+       first = ffs(infront_mask) - 1;
 
        if (!infront_mask)
                return blend_topwin(flags[idx]);
-       else if (behind_mask && flags[ffs(infront_mask)])
+       else if (behind_mask && first != -1 && flags[first])
                return BLEND(NOKEY, DEPENDANT, 0x00, 0x00);
        else
                return BLEND(NOKEY, FIX, 0x0, 0x0);