]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
video: tegra: host: use dynamic syncpt for hwctx
authorDeepak Nibade <dnibade@nvidia.com>
Tue, 4 Feb 2014 11:16:31 +0000 (16:46 +0530)
committerTerje Bergstrom <tbergstrom@nvidia.com>
Fri, 14 Feb 2014 06:13:25 +0000 (22:13 -0800)
- do not request syncpts in hwctx handler init which is common path
  for all clients
- this results in unnecessary booking of syncpts at init time and for
  all clients

- request the syncpt from *_alloc_hwctx() call which is specific
  to each client
- this way we can request syncpt for client who really needs it for its
  hwctx

Bug 1305024

Change-Id: Ib5276da0d9d013487149262223bf5f9cf4e79bbf
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: http://git-master/r/363888
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Shridhar Rasal <srasal@nvidia.com>
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
drivers/video/tegra/host/gr3d/gr3d.c
drivers/video/tegra/host/gr3d/gr3d_t114.c
drivers/video/tegra/host/host1x/host1x_channel.c
drivers/video/tegra/host/vic03/vic03.c

index 56b26098a6f5333de288b9f1d4daed4fab78af72..97063961880ffa01e89458e37d84a0e68365e426 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Tegra Graphics Host 3D
  *
- * Copyright (c) 2012-2013 NVIDIA Corporation.  All rights reserved.
+ * Copyright (c) 2012-2014 NVIDIA Corporation.  All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms and conditions of the GNU General Public License,
@@ -87,11 +87,20 @@ struct host1x_hwctx *nvhost_3dctx_alloc_common(struct host1x_hwctx_handler *p,
                struct nvhost_channel *ch, bool mem_flag)
 {
        struct host1x_hwctx *ctx;
+       struct nvhost_device_data *pdata = nvhost_get_devdata(ch->dev);
+       u32 syncpt;
 
        ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
        if (!ctx)
                return NULL;
 
+       syncpt = pdata->syncpts[0];
+       if (!syncpt) {
+               syncpt = nvhost_get_syncpt_host_managed(ch->dev, 0);
+               pdata->syncpts[0] = syncpt;
+       }
+       p->h.syncpt = syncpt;
+
        if (mem_flag)
                ctx->cpuva = dma_alloc_writecombine(&ch->dev->dev,
                                                p->restore_size * 4,
index 3314d621dff8b91e735bb84d92a117cfe0aacefc..be974c287f8fabeba3b7a7af1818df1472338cc4 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Tegra Graphics Host 3d hardware context
  *
- * Copyright (c) 2011-2013 NVIDIA Corporation. All rights reserved.
+ * Copyright (c) 2011-2014 NVIDIA Corporation. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms and conditions of the GNU General Public License,
@@ -421,7 +421,6 @@ struct nvhost_hwctx_handler *nvhost_gr3d_t114_ctxhandler_init(
        if (!p)
                return NULL;
 
-       p->h.syncpt = syncpt;
        p->h.waitbase = waitbase;
 
        setup_save(p, NULL);
index ebcacbd843f4865962e219b3287c6ede8d455f3d..59d798ba946d98f1a86e617ad2e247dd8b783d76 100644 (file)
@@ -482,7 +482,7 @@ static inline int hwctx_handler_init(struct nvhost_channel *ch)
        int err = 0;
 
        struct nvhost_device_data *pdata = platform_get_drvdata(ch->dev);
-       u32 syncpt = pdata->syncpts[0];
+       u32 syncpt = NVSYNCPT_INVALID;
        u32 waitbase = pdata->waitbases[0];
 
        if (pdata->alloc_hwctx_handler) {
index 3eb81382746e33d1d8e67523dc5e38f157cb22f8..a728923a1276e2c58eb1a3365119d9abd7a508d8 100644 (file)
@@ -426,11 +426,12 @@ static struct nvhost_hwctx *vic03_alloc_hwctx(struct nvhost_hwctx_handler *h,
                struct nvhost_channel *ch)
 {
        struct host1x_hwctx_handler *p = to_host1x_hwctx_handler(h);
+       struct nvhost_device_data *pdata = nvhost_get_devdata(ch->dev);
 
        struct vic03 *v = get_vic03(ch->dev);
        struct host1x_hwctx *ctx;
        u32 *ptr;
-       u32 syncpt = nvhost_get_devdata(ch->dev)->syncpts[0];
+       u32 syncpt;
        u32 nvhost_vic03_restore_size = 10; /* number of words written below */
 
        nvhost_dbg_fn("");
@@ -439,6 +440,13 @@ static struct nvhost_hwctx *vic03_alloc_hwctx(struct nvhost_hwctx_handler *h,
        if (!ctx)
                return NULL;
 
+       syncpt = pdata->syncpts[0];
+       if (!syncpt) {
+               syncpt = nvhost_get_syncpt_host_managed(ch->dev, 0);
+               pdata->syncpts[0] = syncpt;
+       }
+       h->syncpt = syncpt;
+
        ctx->restore_size = nvhost_vic03_restore_size;
 
        ctx->cpuva = dma_alloc_writecombine(&ch->dev->dev,
@@ -541,7 +549,6 @@ struct nvhost_hwctx_handler *nvhost_vic03_alloc_hwctx_handler(u32 syncpt,
        if (!p)
                return NULL;
 
-       p->h.syncpt = syncpt;
        p->h.waitbase = waitbase;
 
        p->h.alloc = vic03_alloc_hwctx;