summaryrefslogtreecommitdiff
path: root/drivers/video/tegra/host/nvhost_channel.c
diff options
context:
space:
mode:
authorTerje Bergstrom <tbergstrom@nvidia.com>2012-05-28 11:56:54 +0300
committerRohan Somvanshi <rsomvanshi@nvidia.com>2012-05-29 22:39:53 -0700
commitbc056c017381a85acf2d41a1e537f45e04ea297a (patch)
treee5db40625c4413c1747744ea62886f2bda414aa2 /drivers/video/tegra/host/nvhost_channel.c
parentb6f12a3449234f9960998954382e1a9afea7764d (diff)
video: tegra: host: Throttle lower priority jobs
Implement per channel counter for jobs in each priority level. If there are jobs active with higher priority than the one being submitted, throttle. Bug 926690 Change-Id: I5fed341e3f248325873b31d1c53bf57bf0a78074 Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-on: http://git-master/r/104939 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Juha Tukkinen <jtukkinen@nvidia.com> Reviewed-by: Mayuresh Kulkarni <mkulkarni@nvidia.com>
Diffstat (limited to 'drivers/video/tegra/host/nvhost_channel.c')
-rw-r--r--drivers/video/tegra/host/nvhost_channel.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/drivers/video/tegra/host/nvhost_channel.c b/drivers/video/tegra/host/nvhost_channel.c
index ef8886fe4652..ad303cf0a22d 100644
--- a/drivers/video/tegra/host/nvhost_channel.c
+++ b/drivers/video/tegra/host/nvhost_channel.c
@@ -51,10 +51,26 @@ int nvhost_channel_init(struct nvhost_channel *ch,
int nvhost_channel_submit(struct nvhost_job *job)
{
- /* Low priority submits wait until sync queue is empty. Ignores result
- * from nvhost_cdma_flush, as we submit either when push buffer is
- * empty or when we reach the timeout. */
- if (job->priority < NVHOST_PRIORITY_MEDIUM)
+ /*
+ * Check if queue has higher priority jobs running. If so, wait until
+ * queue is empty. Ignores result from nvhost_cdma_flush, as we submit
+ * either when push buffer is empty or when we reach the timeout.
+ */
+ int higher_count = 0;
+
+ switch (job->priority) {
+ case NVHOST_PRIORITY_HIGH:
+ higher_count = 0;
+ break;
+ case NVHOST_PRIORITY_MEDIUM:
+ higher_count = job->ch->cdma.high_prio_count;
+ break;
+ case NVHOST_PRIORITY_LOW:
+ higher_count = job->ch->cdma.high_prio_count
+ + job->ch->cdma.med_prio_count;
+ break;
+ }
+ if (higher_count > 0)
(void)nvhost_cdma_flush(&job->ch->cdma,
NVHOST_CHANNEL_LOW_PRIO_MAX_WAIT);