aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
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 edeb76ee648c..2a7c13d55aca 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)
132 iowrite32_native(data, chan->user + addr); 132 iowrite32_native(data, chan->user + addr);
133} 133}
134 134
135int
136nouveau_fifo_chid(struct nouveau_fifo *priv, struct nouveau_object *object)
137{
138 int engidx = nv_hclass(priv) & 0xff;
139
140 while (object && object->parent) {
141 if ( nv_iclass(object->parent, NV_ENGCTX_CLASS) &&
142 (nv_hclass(object->parent) & 0xff) == engidx)
143 return nouveau_fifo_chan(object)->chid;
144 object = object->parent;
145 }
146
147 return -1;
148}
149
135void 150void
136nouveau_fifo_destroy(struct nouveau_fifo *priv) 151nouveau_fifo_destroy(struct nouveau_fifo *priv)
137{ 152{
@@ -160,6 +175,7 @@ nouveau_fifo_create_(struct nouveau_object *parent,
160 if (!priv->channel) 175 if (!priv->channel)
161 return -ENOMEM; 176 return -ENOMEM;
162 177
178 priv->chid = nouveau_fifo_chid;
163 spin_lock_init(&priv->lock); 179 spin_lock_init(&priv->lock);
164 return 0; 180 return 0;
165} 181}
diff --git a/drivers/gpu/drm/nouveau/core/include/engine/fifo.h b/drivers/gpu/drm/nouveau/core/include/engine/fifo.h
index 65ee929a75f0..f2133872bd7c 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 {
70 u16 min; 70 u16 min;
71 u16 max; 71 u16 max;
72 72
73 int (*chid)(struct nouveau_fifo *, struct nouveau_object *);
73 void (*pause)(struct nouveau_fifo *, unsigned long *); 74 void (*pause)(struct nouveau_fifo *, unsigned long *);
74 void (*start)(struct nouveau_fifo *, unsigned long *); 75 void (*start)(struct nouveau_fifo *, unsigned long *);
75}; 76};