diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2012-10-08 12:58:23 +1000 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2012-11-29 09:56:38 +1000 |
commit | 6c1689a08cf54e58c19eb565528a293f36f731be (patch) | |
tree | 53ecbfa8324e13c7a7af4373d2914cf5c90c9d15 /drivers/gpu/drm/nouveau/core/engine/dmaobj | |
parent | f86770aaaa9a4d9cc68c8a9adc351ab7f47e6345 (diff) | |
download | op-kernel-dev-6c1689a08cf54e58c19eb565528a293f36f731be.zip op-kernel-dev-6c1689a08cf54e58c19eb565528a293f36f731be.tar.gz |
drm/nouveau/dmaobj: move parent class check to bind() method
Otherwise when nvc0- gains a bind() method (disp needs it), the fifo
engine will attempt to create a dma object for the push buffer, which
is unnecessary on fermi.
The only sane place to put these checks is in the bind method itself,
and have it unconditionally called from wherever it might be needed.
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/core/engine/dmaobj')
-rw-r--r-- | drivers/gpu/drm/nouveau/core/engine/dmaobj/base.c | 18 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/core/engine/dmaobj/nv04.c | 12 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/core/engine/dmaobj/nv50.c | 12 |
3 files changed, 30 insertions, 12 deletions
diff --git a/drivers/gpu/drm/nouveau/core/engine/dmaobj/base.c b/drivers/gpu/drm/nouveau/core/engine/dmaobj/base.c index 9ca9061..325b79d 100644 --- a/drivers/gpu/drm/nouveau/core/engine/dmaobj/base.c +++ b/drivers/gpu/drm/nouveau/core/engine/dmaobj/base.c @@ -88,21 +88,15 @@ nouveau_dmaobj_ctor(struct nouveau_object *parent, switch (nv_mclass(parent)) { case NV_DEVICE_CLASS: + /* delayed, or no, binding */ break; - case NV03_CHANNEL_DMA_CLASS: - case NV10_CHANNEL_DMA_CLASS: - case NV17_CHANNEL_DMA_CLASS: - case NV40_CHANNEL_DMA_CLASS: - case NV50_CHANNEL_DMA_CLASS: - case NV84_CHANNEL_DMA_CLASS: - case NV50_CHANNEL_IND_CLASS: - case NV84_CHANNEL_IND_CLASS: + default: ret = dmaeng->bind(dmaeng, *pobject, dmaobj, &gpuobj); - nouveau_object_ref(NULL, pobject); - *pobject = nv_object(gpuobj); + if (ret == 0) { + nouveau_object_ref(NULL, pobject); + *pobject = nv_object(gpuobj); + } break; - default: - return -EINVAL; } return ret; diff --git a/drivers/gpu/drm/nouveau/core/engine/dmaobj/nv04.c b/drivers/gpu/drm/nouveau/core/engine/dmaobj/nv04.c index 8923873..027d821 100644 --- a/drivers/gpu/drm/nouveau/core/engine/dmaobj/nv04.c +++ b/drivers/gpu/drm/nouveau/core/engine/dmaobj/nv04.c @@ -49,6 +49,18 @@ nv04_dmaobj_bind(struct nouveau_dmaeng *dmaeng, u32 length = dmaobj->limit - dmaobj->start; int ret; + if (!nv_iclass(parent, NV_ENGCTX_CLASS)) { + switch (nv_mclass(parent->parent)) { + case NV03_CHANNEL_DMA_CLASS: + case NV10_CHANNEL_DMA_CLASS: + case NV17_CHANNEL_DMA_CLASS: + case NV40_CHANNEL_DMA_CLASS: + break; + default: + return -EINVAL; + } + } + if (dmaobj->target == NV_MEM_TARGET_VM) { if (nv_object(vmm)->oclass == &nv04_vmmgr_oclass) { struct nouveau_gpuobj *pgt = vmm->vm->pgt[0].obj[0]; diff --git a/drivers/gpu/drm/nouveau/core/engine/dmaobj/nv50.c b/drivers/gpu/drm/nouveau/core/engine/dmaobj/nv50.c index 58876f5..3dab016 100644 --- a/drivers/gpu/drm/nouveau/core/engine/dmaobj/nv50.c +++ b/drivers/gpu/drm/nouveau/core/engine/dmaobj/nv50.c @@ -41,6 +41,18 @@ nv50_dmaobj_bind(struct nouveau_dmaeng *dmaeng, u32 flags = nv_mclass(dmaobj); int ret; + if (!nv_iclass(parent, NV_ENGCTX_CLASS)) { + switch (nv_mclass(parent->parent)) { + case NV50_CHANNEL_DMA_CLASS: + case NV84_CHANNEL_DMA_CLASS: + case NV50_CHANNEL_IND_CLASS: + case NV84_CHANNEL_IND_CLASS: + break; + default: + return -EINVAL; + } + } + switch (dmaobj->target) { case NV_MEM_TARGET_VM: flags |= 0x00000000; |