summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Morell <rmorell@nvidia.com>2011-03-21 14:42:51 -0700
committerVarun Colbert <vcolbert@nvidia.com>2011-08-11 11:54:15 -0700
commitff8196ae3958f2be1a15e2572bb5f8c6bb37d28a (patch)
tree3ab3fe06fd3a064c7a702653904ff9e4704849da
parent2cd1c94506b47ee57bc0ee261ebe624b35c6b51a (diff)
video: tegra: Expose vblank syncpoint
This change adds support for userspace to query the syncpoint that display autoincrements every vblank. This can be useful for applications to time buffer submissions to throttle rendering and prevent excessive host stalls. bug 818525 Change-Id: I050e4dcd08609da802f10eeec5b70da181b21717 Signed-off-by: Robert Morell <rmorell@nvidia.com> Reviewed-on: http://git-master/r/40529 Reviewed-by: Varun Colbert <vcolbert@nvidia.com> Tested-by: Varun Colbert <vcolbert@nvidia.com>
-rw-r--r--drivers/video/tegra/dc/dc.c11
-rw-r--r--drivers/video/tegra/dc/dc_priv.h1
-rw-r--r--drivers/video/tegra/dc/ext/dev.c17
-rw-r--r--include/video/tegra_dc_ext.h7
4 files changed, 30 insertions, 6 deletions
diff --git a/drivers/video/tegra/dc/dc.c b/drivers/video/tegra/dc/dc.c
index 1914f8731df8..8319a0d8e5f1 100644
--- a/drivers/video/tegra/dc/dc.c
+++ b/drivers/video/tegra/dc/dc.c
@@ -2061,13 +2061,10 @@ static u32 get_syncpt(struct tegra_dc *dc, int idx)
static void tegra_dc_init(struct tegra_dc *dc)
{
- u32 vblank_syncpt = 0;
int i;
tegra_dc_writel(dc, 0x00000100, DC_CMD_GENERAL_INCR_SYNCPT_CNTRL);
if (dc->ndev->id == 0) {
- vblank_syncpt = NVSYNCPT_VBLANK0;
-
tegra_mc_set_priority(TEGRA_MC_CLIENT_DISPLAY0A,
TEGRA_MC_PRIO_MED);
tegra_mc_set_priority(TEGRA_MC_CLIENT_DISPLAY0B,
@@ -2079,8 +2076,6 @@ static void tegra_dc_init(struct tegra_dc *dc)
tegra_mc_set_priority(TEGRA_MC_CLIENT_DISPLAYHC,
TEGRA_MC_PRIO_HIGH);
} else if (dc->ndev->id == 1) {
- vblank_syncpt = NVSYNCPT_VBLANK1;
-
tegra_mc_set_priority(TEGRA_MC_CLIENT_DISPLAY0AB,
TEGRA_MC_PRIO_MED);
tegra_mc_set_priority(TEGRA_MC_CLIENT_DISPLAY0BB,
@@ -2092,7 +2087,8 @@ static void tegra_dc_init(struct tegra_dc *dc)
tegra_mc_set_priority(TEGRA_MC_CLIENT_DISPLAYHCB,
TEGRA_MC_PRIO_HIGH);
}
- tegra_dc_writel(dc, 0x00000100 | vblank_syncpt, DC_CMD_CONT_SYNCPT_VSYNC);
+ tegra_dc_writel(dc, 0x00000100 | dc->vblank_syncpt,
+ DC_CMD_CONT_SYNCPT_VSYNC);
tegra_dc_writel(dc, 0x00004700, DC_CMD_INT_TYPE);
tegra_dc_writel(dc, 0x0001c700, DC_CMD_INT_POLARITY);
tegra_dc_writel(dc, 0x00202020, DC_DISP_MEM_HIGH_PRIORITY);
@@ -2520,6 +2516,9 @@ static int tegra_dc_probe(struct nvhost_device *ndev)
else
dev_err(&ndev->dev, "No default output specified. Leaving output disabled.\n");
+ dc->vblank_syncpt = (dc->ndev->id == 0) ?
+ NVSYNCPT_VBLANK0 : NVSYNCPT_VBLANK1;
+
dc->ext = tegra_dc_ext_register(ndev, dc);
if (IS_ERR_OR_NULL(dc->ext)) {
dev_warn(&ndev->dev, "Failed to enable Tegra DC extensions.\n");
diff --git a/drivers/video/tegra/dc/dc_priv.h b/drivers/video/tegra/dc/dc_priv.h
index 26b246cbe85f..027fd8490f20 100644
--- a/drivers/video/tegra/dc/dc_priv.h
+++ b/drivers/video/tegra/dc/dc_priv.h
@@ -112,6 +112,7 @@ struct tegra_dc {
u32 min;
u32 max;
} syncpt[DC_N_WINDOWS];
+ u32 vblank_syncpt;
unsigned long underflow_mask;
struct work_struct reset_work;
diff --git a/drivers/video/tegra/dc/ext/dev.c b/drivers/video/tegra/dc/ext/dev.c
index b0e8c38626a6..eba706342f43 100644
--- a/drivers/video/tegra/dc/ext/dev.c
+++ b/drivers/video/tegra/dc/ext/dev.c
@@ -476,6 +476,13 @@ static int tegra_dc_ext_set_csc(struct tegra_dc_ext_user *user,
return 0;
}
+static u32 tegra_dc_ext_get_vblank_syncpt(struct tegra_dc_ext_user *user)
+{
+ struct tegra_dc *dc = user->ext->dc;
+
+ return dc->vblank_syncpt;
+}
+
static long tegra_dc_ioctl(struct file *filp, unsigned int cmd,
unsigned long arg)
{
@@ -540,6 +547,16 @@ static long tegra_dc_ioctl(struct file *filp, unsigned int cmd,
return tegra_dc_ext_set_csc(user, &args);
}
+ case TEGRA_DC_EXT_GET_VBLANK_SYNCPT:
+ {
+ u32 syncpt = tegra_dc_ext_get_vblank_syncpt(user);
+
+ if (copy_to_user(user_arg, &syncpt, sizeof(syncpt)))
+ return -EFAULT;
+
+ return 0;
+ }
+
default:
return -EINVAL;
}
diff --git a/include/video/tegra_dc_ext.h b/include/video/tegra_dc_ext.h
index 971beccb57fc..5ac7899bc6dd 100644
--- a/include/video/tegra_dc_ext.h
+++ b/include/video/tegra_dc_ext.h
@@ -184,6 +184,13 @@ struct tegra_dc_ext_csc {
#define TEGRA_DC_EXT_SET_CSC \
_IOW('D', 0x08, struct tegra_dc_ext_csc)
+/*
+ * Returns the auto-incrementing vblank syncpoint for the head associated with
+ * this device node
+ */
+#define TEGRA_DC_EXT_GET_VBLANK_SYNCPT \
+ _IOR('D', 0x09, __u32)
+
enum tegra_dc_ext_control_output_type {
TEGRA_DC_EXT_DSI,