summaryrefslogtreecommitdiff
path: root/drivers/video/tegra/host/nvhost_cdma.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/video/tegra/host/nvhost_cdma.c')
-rw-r--r--drivers/video/tegra/host/nvhost_cdma.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/video/tegra/host/nvhost_cdma.c b/drivers/video/tegra/host/nvhost_cdma.c
index 4b90456696ad..f27656bac07b 100644
--- a/drivers/video/tegra/host/nvhost_cdma.c
+++ b/drivers/video/tegra/host/nvhost_cdma.c
@@ -627,3 +627,24 @@ void nvhost_cdma_flush(struct nvhost_cdma *cdma)
}
mutex_unlock(&cdma->lock);
}
+
+/**
+ * Find the currently executing gather in the push buffer and return
+ * its physical address and size.
+ */
+void nvhost_cdma_find_gather(struct nvhost_cdma *cdma, u32 dmaget, u32 *addr, u32 *size)
+{
+ u32 offset = dmaget - cdma->push_buffer.phys;
+
+ *addr = *size = 0;
+
+ if (offset >= 8 && offset < cdma->push_buffer.cur) {
+ u32 *p = cdma->push_buffer.mapped + (offset - 8) / 4;
+
+ /* Make sure we have a gather */
+ if ((p[0] >> 28) == 6) {
+ *addr = p[1];
+ *size = p[0] & 0x3fff;
+ }
+ }
+}