nouveau: fix channel closing

Restore code lost in libdrm_nouveau rewrite.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
main
Marcin Slusarz 2012-05-01 23:24:45 +02:00 committed by Ben Skeggs
parent 754655c795
commit 5288729823
1 changed files with 12 additions and 5 deletions

View File

@ -278,16 +278,23 @@ nouveau_object_new(struct nouveau_object *parent, uint64_t handle,
void void
nouveau_object_del(struct nouveau_object **pobj) nouveau_object_del(struct nouveau_object **pobj)
{ {
struct drm_nouveau_gpuobj_free req;
struct nouveau_object *obj = *pobj; struct nouveau_object *obj = *pobj;
struct nouveau_device *dev; struct nouveau_device *dev;
if (obj) { if (obj) {
dev = nouveau_object_find(obj, NOUVEAU_DEVICE_CLASS); dev = nouveau_object_find(obj, NOUVEAU_DEVICE_CLASS);
if (obj->oclass == NOUVEAU_FIFO_CHANNEL_CLASS) {
struct drm_nouveau_channel_free req;
req.channel = obj->handle;
drmCommandWrite(dev->fd, DRM_NOUVEAU_CHANNEL_FREE,
&req, sizeof(req));
} else {
struct drm_nouveau_gpuobj_free req;
req.channel = obj->parent->handle; req.channel = obj->parent->handle;
req.handle = obj->handle; req.handle = obj->handle;
drmCommandWrite(dev->fd, DRM_NOUVEAU_GPUOBJ_FREE, drmCommandWrite(dev->fd, DRM_NOUVEAU_GPUOBJ_FREE,
&req, sizeof(req)); &req, sizeof(req));
} }
}
free(obj); free(obj);
*pobj = NULL; *pobj = NULL;
} }