summaryrefslogtreecommitdiff
path: root/drivers/gpu
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2012-08-10 14:02:44 +1000
committerBen Skeggs <bskeggs@redhat.com>2012-10-03 13:13:03 +1000
commit0c5b8cecf34d6b25e577475cc5e8c7169d63ba92 (patch)
tree0b4e36434b2259da9fc42874578ace75e31cc4df /drivers/gpu
parent3acec63aee5d082f86218973912e682e84ec2a05 (diff)
downloadlinux-3.10-0c5b8cecf34d6b25e577475cc5e8c7169d63ba92.tar.gz
linux-3.10-0c5b8cecf34d6b25e577475cc5e8c7169d63ba92.tar.bz2
linux-3.10-0c5b8cecf34d6b25e577475cc5e8c7169d63ba92.zip
drm/nouveau/fifo: add method to lookup fifo chid related to a given object
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/fifo/base.c16
-rw-r--r--drivers/gpu/drm/nouveau/core/include/engine/fifo.h1
2 files changed, 17 insertions, 0 deletions
diff --git a/drivers/gpu/drm/nouveau/core/engine/fifo/base.c b/drivers/gpu/drm/nouveau/core/engine/fifo/base.c
index edeb76ee648..2a7c13d55ac 100644
--- a/drivers/gpu/drm/nouveau/core/engine/fifo/base.c
+++ b/drivers/gpu/drm/nouveau/core/engine/fifo/base.c
@@ -132,6 +132,21 @@ _nouveau_fifo_channel_wr32(struct nouveau_object *object, u32 addr, u32 data)
iowrite32_native(data, chan->user + addr);
}
+int
+nouveau_fifo_chid(struct nouveau_fifo *priv, struct nouveau_object *object)
+{
+ int engidx = nv_hclass(priv) & 0xff;
+
+ while (object && object->parent) {
+ if ( nv_iclass(object->parent, NV_ENGCTX_CLASS) &&
+ (nv_hclass(object->parent) & 0xff) == engidx)
+ return nouveau_fifo_chan(object)->chid;
+ object = object->parent;
+ }
+
+ return -1;
+}
+
void
nouveau_fifo_destroy(struct nouveau_fifo *priv)
{
@@ -160,6 +175,7 @@ nouveau_fifo_create_(struct nouveau_object *parent,
if (!priv->channel)
return -ENOMEM;
+ priv->chid = nouveau_fifo_chid;
spin_lock_init(&priv->lock);
return 0;
}
diff --git a/drivers/gpu/drm/nouveau/core/include/engine/fifo.h b/drivers/gpu/drm/nouveau/core/include/engine/fifo.h
index 65ee929a75f..f2133872bd7 100644
--- a/drivers/gpu/drm/nouveau/core/include/engine/fifo.h
+++ b/drivers/gpu/drm/nouveau/core/include/engine/fifo.h
@@ -70,6 +70,7 @@ struct nouveau_fifo {
u16 min;
u16 max;
+ int (*chid)(struct nouveau_fifo *, struct nouveau_object *);
void (*pause)(struct nouveau_fifo *, unsigned long *);
void (*start)(struct nouveau_fifo *, unsigned long *);
};