diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2015-08-20 14:54:18 +1000 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2015-08-28 12:40:38 +1000 |
commit | 344c2d429dd86b1b0113177e18f15adb74e9d936 (patch) | |
tree | 5f38cd2830f72b2088d71ce4cea6eadd65321d7b /drivers/gpu/drm/nouveau/nvkm/engine/fifo/base.c | |
parent | 898a2b32138da26ed8f7abc0cc8232741ca03de7 (diff) | |
download | talos-obmc-linux-344c2d429dd86b1b0113177e18f15adb74e9d936.tar.gz talos-obmc-linux-344c2d429dd86b1b0113177e18f15adb74e9d936.zip |
drm/nouveau/fb: remove dependence on namedb/engctx lookup
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/nvkm/engine/fifo/base.c')
-rw-r--r-- | drivers/gpu/drm/nouveau/nvkm/engine/fifo/base.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/base.c b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/base.c index 1934dfb5a434..60e5fab4c80a 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/base.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/base.c @@ -32,6 +32,47 @@ #include <nvif/event.h> #include <nvif/unpack.h> +void +nvkm_fifo_chan_put(struct nvkm_fifo *fifo, unsigned long flags, + struct nvkm_fifo_chan **pchan) +{ + struct nvkm_fifo_chan *chan = *pchan; + if (likely(chan)) { + *pchan = NULL; + spin_unlock_irqrestore(&fifo->lock, flags); + } +} + +struct nvkm_fifo_chan * +nvkm_fifo_chan_inst(struct nvkm_fifo *fifo, u64 inst, unsigned long *rflags) +{ + unsigned long flags; + int i; + spin_lock_irqsave(&fifo->lock, flags); + for (i = fifo->min; i < fifo->max; i++) { + struct nvkm_fifo_chan *chan = (void *)fifo->channel[i]; + if (chan && chan->inst == inst) { + *rflags = flags; + return chan; + } + } + spin_unlock_irqrestore(&fifo->lock, flags); + return NULL; +} + +struct nvkm_fifo_chan * +nvkm_fifo_chan_chid(struct nvkm_fifo *fifo, int chid, unsigned long *rflags) +{ + unsigned long flags; + spin_lock_irqsave(&fifo->lock, flags); + if (fifo->channel[chid]) { + *rflags = flags; + return (void *)fifo->channel[chid]; + } + spin_unlock_irqrestore(&fifo->lock, flags); + return NULL; +} + static int nvkm_fifo_event_ctor(struct nvkm_object *object, void *data, u32 size, struct nvkm_notify *notify) |