video: tegra: nvhost: add submit timeout support
authorChris Johnson <cwj@nvidia.com>
Fri, 12 Aug 2011 06:04:09 +0000 (09:04 +0300)
committerDan Willemsen <dwillemsen@nvidia.com>
Thu, 1 Dec 2011 05:48:21 +0000 (21:48 -0800)
commitb33dead2cc3e262000ba1915b19c27b6b0b87f41
tree587b2f7261c8f1401e1aaa737d3f901eb8d3b49b
parent14dcbce77792e27a94adb242650c50809435af30
video: tegra: nvhost: add submit timeout support

In this change, nvhost_cdma starts a timer (if a timeout is specified
in the userctx), for the buffer at the head of the sync_queue that has
not reached its syncpt threshold.

If the timeout fires, nvhost_cdma initiates a channel / module reset.
It then detects up to where in the sync_queue it stopped execution
(based on the current HW syncpt value).

For any remaining uncompleted buffers in the context, nvhost_cdma NOPs
the entry and CPU incrs the syncpt to where it should be had it completed.
If one of the sync_queue entries belongs to another context, it still
does the syncpt incrs for this context, but via the PB as a GATHER opcode,

At the end, CDMA is restarted, so buffers are refetched (either with
NOP slots, or GATHERs to incr syncpts). This appears as though the
buffer has completed (and the associated resources released).

For testing, debugfs entries have been added under /d/tegra_nvhost

force_timeout_val - set the timeout value, in ms
force_timeout_channel - channel ID, were timeouts checks occur
force_timeout_pid - process ID to set the userctx

The idea is to set the timeout_val, then the timeout_channel (e.g. for
3D, the channel ID is 1) and then the process ID, gotten from running
adb shell ps.

Bug 625545

Original-Change-Id: I659e9255f1105f3439ce23e9169a19739b83ea52
Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-on: http://git-master/r/42655
Reviewed-by: Scott Williams <scwilliams@nvidia.com>
Reviewed-by: Varun Colbert <vcolbert@nvidia.com>
Tested-by: Varun Colbert <vcolbert@nvidia.com>

Rebase-Id: R89759c129e2db8f7dbf83a6066fc29947f95cc27
19 files changed:
drivers/video/tegra/host/chip_support.h
drivers/video/tegra/host/debug.c
drivers/video/tegra/host/debug.h
drivers/video/tegra/host/dev.c
drivers/video/tegra/host/dev.h
drivers/video/tegra/host/nvhost_acm.c
drivers/video/tegra/host/nvhost_acm.h
drivers/video/tegra/host/nvhost_cdma.c
drivers/video/tegra/host/nvhost_cdma.h
drivers/video/tegra/host/nvhost_channel.c
drivers/video/tegra/host/nvhost_channel.h
drivers/video/tegra/host/nvhost_hwctx.h
drivers/video/tegra/host/nvhost_intr.c
drivers/video/tegra/host/nvhost_syncpt.c
drivers/video/tegra/host/t20/3dctx_t20.c
drivers/video/tegra/host/t20/cdma_t20.c
drivers/video/tegra/host/t20/channel_t20.c
drivers/video/tegra/host/t20/hardware_t20.h
include/linux/nvhost_ioctl.h