gpu: host1x: Add 'flags' field to syncpt request
authorArto Merilainen <amerilainen@nvidia.com>
Mon, 14 Oct 2013 12:21:52 +0000 (15:21 +0300)
committerThierry Reding <treding@nvidia.com>
Thu, 31 Oct 2013 08:55:47 +0000 (09:55 +0100)
Functions host1x_syncpt_request() and _host1x_syncpt_alloc() have
been taking a separate boolean flag ('client_managed') for indicating
if the syncpoint value should be tracked by the host1x driver.

This patch converts the field into generic 'flags' field so that
we can easily add more information while requesting a syncpoint.
Clients are adapted to use the new interface accordingly.

Signed-off-by: Arto Merilainen <amerilainen@nvidia.com>
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
drivers/gpu/drm/tegra/gr2d.c
drivers/gpu/host1x/syncpt.c
include/linux/host1x.h

index 7f4eb11..3a04b97 100644 (file)
@@ -43,7 +43,7 @@ static int gr2d_init(struct host1x_client *client)
        if (!gr2d->channel)
                return -ENOMEM;
 
-       client->syncpts[0] = host1x_syncpt_request(client->dev, false);
+       client->syncpts[0] = host1x_syncpt_request(client->dev, 0);
        if (!client->syncpts[0]) {
                host1x_channel_free(gr2d->channel);
                return -ENOMEM;
index 03cf292..5b88ba4 100644 (file)
@@ -30,9 +30,9 @@
 #define SYNCPT_CHECK_PERIOD (2 * HZ)
 #define MAX_STUCK_CHECK_COUNT 15
 
-static struct host1x_syncpt *_host1x_syncpt_alloc(struct host1x *host,
-                                                 struct device *dev,
-                                                 bool client_managed)
+static struct host1x_syncpt *host1x_syncpt_alloc(struct host1x *host,
+                                                struct device *dev,
+                                                unsigned long flags)
 {
        int i;
        struct host1x_syncpt *sp = host->syncpt;
@@ -51,7 +51,11 @@ static struct host1x_syncpt *_host1x_syncpt_alloc(struct host1x *host,
 
        sp->dev = dev;
        sp->name = name;
-       sp->client_managed = client_managed;
+
+       if (flags & HOST1X_SYNCPT_CLIENT_MANAGED)
+               sp->client_managed = true;
+       else
+               sp->client_managed = false;
 
        return sp;
 }
@@ -321,7 +325,7 @@ int host1x_syncpt_init(struct host1x *host)
        host1x_syncpt_restore(host);
 
        /* Allocate sync point to use for clearing waits for expired fences */
-       host->nop_sp = _host1x_syncpt_alloc(host, NULL, false);
+       host->nop_sp = host1x_syncpt_alloc(host, NULL, 0);
        if (!host->nop_sp)
                return -ENOMEM;
 
@@ -329,10 +333,10 @@ int host1x_syncpt_init(struct host1x *host)
 }
 
 struct host1x_syncpt *host1x_syncpt_request(struct device *dev,
-                                           bool client_managed)
+                                           unsigned long flags)
 {
        struct host1x *host = dev_get_drvdata(dev->parent);
-       return _host1x_syncpt_alloc(host, dev, client_managed);
+       return host1x_syncpt_alloc(host, dev, flags);
 }
 
 void host1x_syncpt_free(struct host1x_syncpt *sp)
index f5dd56f..eb713db 100644 (file)
@@ -124,6 +124,8 @@ static inline void host1x_bo_kunmap(struct host1x_bo *bo,
  * host1x syncpoints
  */
 
+#define HOST1X_SYNCPT_CLIENT_MANAGED   (1 << 0)
+
 struct host1x_syncpt;
 struct host1x;
 
@@ -135,7 +137,7 @@ int host1x_syncpt_incr(struct host1x_syncpt *sp);
 int host1x_syncpt_wait(struct host1x_syncpt *sp, u32 thresh, long timeout,
                       u32 *value);
 struct host1x_syncpt *host1x_syncpt_request(struct device *dev,
-                                           bool client_managed);
+                                           unsigned long flags);
 void host1x_syncpt_free(struct host1x_syncpt *sp);
 
 /*