video: tegra: host: Serialize 2D jobs
Terje Bergstrom [Wed, 27 Jun 2012 06:37:05 +0000 (09:37 +0300)]
Force serialization of 2D jobs by inserting a host wait for previous
maximum at the beginning of the job.

Bug 1002293

Change-Id: I667ad4565cc32186ea7ccf16845c68d1b1bbdf78
Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-on: http://git-master/r/111475
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Donghan Ryu <dryu@nvidia.com>
Reviewed-by: Arto Merilainen <amerilainen@nvidia.com>
Reviewed-by: Daniel Parker <dparker@nvidia.com>
Reviewed-by: Mayuresh Kulkarni <mkulkarni@nvidia.com>
Reviewed-by: Juha Tukkinen <jtukkinen@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Francis Hart <fhart@nvidia.com>

drivers/video/tegra/host/host1x/host1x_channel.c
drivers/video/tegra/host/t20/t20.c
drivers/video/tegra/host/t30/t30.c
include/linux/nvhost.h

index 98af575..9e9fc25 100644 (file)
@@ -251,6 +251,18 @@ static int host1x_channel_submit(struct nvhost_job *job)
                goto error;
        }
 
+       if (ch->dev->serialize) {
+               /* Force serialization by inserting a host wait for the
+                * previous job to finish before this one can commence. */
+               nvhost_cdma_push(&ch->cdma,
+                               nvhost_opcode_setclass(NV_HOST1X_CLASS_ID,
+                                       host1x_uclass_wait_syncpt_r(),
+                                       1),
+                               nvhost_class_host_wait_syncpt(job->syncpt_id,
+                                       nvhost_syncpt_read_max(sp,
+                                               job->syncpt_id)));
+       }
+
        submit_ctxsave(job, ctxsave_waiter, ch->cur_ctx);
        submit_ctxrestore(job);
        ch->cur_ctx = job->hwctx;
index 00c1e28..71ed733 100644 (file)
@@ -140,6 +140,7 @@ static struct nvhost_device tegra_gr2d01_device = {
        NVHOST_MODULE_NO_POWERGATE_IDS,
        .clockgate_delay = 0,
        .moduleid       = NVHOST_MODULE_NONE,
+       .serialize      = true,
 };
 
 static struct resource isp_resources_t20[] = {
index 88a4892..4d042a9 100644 (file)
@@ -148,6 +148,7 @@ static struct nvhost_device tegra_gr2d02_device = {
        NVHOST_MODULE_NO_POWERGATE_IDS,
        .clockgate_delay = 0,
        .moduleid       = NVHOST_MODULE_NONE,
+       .serialize      = true,
 };
 
 static struct resource isp_resources_t20[] = {
index f84749a..cde63fa 100644 (file)
@@ -100,6 +100,7 @@ struct nvhost_device {
        bool            keepalive;      /* Do not power gate when opened */
        bool            waitbasesync;   /* Force sync of wait bases */
        bool            powerup_reset;  /* Do a reset after power un-gating */
+       bool            serialize;      /* Serialize submits in the channel */
 
        int             powergate_ids[NVHOST_MODULE_MAX_POWERGATE_IDS];
        bool            can_powergate;  /* True if module can be power gated */