video: tegra: dc: fix MC_DECERR display0_win errors on shutdown
Adam Cheney [Sat, 16 Jun 2012 02:22:35 +0000 (19:22 -0700)]
When a DC window is being released, a NULL flip is used to indicate
that the window should be disabled.  To disable a window, 0 is
written to WIN_OPTIONS.

The MC_DECERR on window shutdown is a symptom of forgetting step 2)
below when disabling windows, leaving no indication that there is
anything to wait for.  This causes DC to erroneously unpin the
scanout buffer while the buffer is still actively being used.

Summary of flip (window update) synchronization in DC:
1) program some window registers
2) set win->dirty=1
3) schedule the activation of the registers
4) request VBLANK or HBLANK interrupts
5) wait for win->dirty==0

In the trigger_windows ISR (every VBLANK or HBLANK):
1) if there is no window update pending in HW, clear dirty flag to
   indicate that ACTIVE registers are up-to-date.

bug 991572
bug 995614
bug 989119
bug 983251
bug 960424
bug 866711

Change-Id: I8b710aac874b202838c3989608b7e0bd15425382
Signed-off-by: Adam Cheney <acheney@nvidia.com>
Reviewed-on: http://git-master/r/109370
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Robert Morell <rmorell@nvidia.com>
Reviewed-by: Nirav Patel <nipatel@nvidia.com>
Reviewed-by: Jon Mayo <jmayo@nvidia.com>

drivers/video/tegra/dc/dc.c

index db4efc9..0b92369 100644 (file)
@@ -931,6 +931,7 @@ int tegra_dc_update_windows(struct tegra_dc_win *windows[], int n)
                        update_mask |= WIN_A_ACT_REQ << win->idx;
 
                if (!WIN_IS_ENABLED(win)) {
+                       dc->windows[i].dirty = 1;
                        tegra_dc_writel(dc, 0, DC_WIN_WIN_OPTIONS);
                        continue;
                }