diff --git a/src/nouveau/winsys/nouveau_context.c b/src/nouveau/winsys/nouveau_context.c index 0ea4582bec0..3a4a817d86d 100644 --- a/src/nouveau/winsys/nouveau_context.c +++ b/src/nouveau/winsys/nouveau_context.c @@ -133,27 +133,21 @@ nouveau_ws_context_create(struct nouveau_ws_device *dev, struct nouveau_ws_conte int ret = drmCommandWriteRead(dev->fd, DRM_NOUVEAU_CHANNEL_ALLOC, &req, sizeof(req)); if (ret) - goto fail_chan; + goto fail_alloc; ret = nouveau_ws_context_query_classes(dev->fd, req.channel, classes); if (ret) - goto fail_chan; + goto fail_subchan; base = (0xbeef + req.channel) << 16; - uint32_t obj_class = nouveau_ws_context_find_class(classes, 0x2d); - ret = nouveau_ws_subchan_alloc(dev->fd, req.channel, base | 0x902d, obj_class, &(*out)->eng2d); - if (ret) - goto fail_2d; - obj_class = nouveau_ws_context_find_class(classes, 0x40); - if (!obj_class) - obj_class = nouveau_ws_context_find_class(classes, 0x39); - ret = nouveau_ws_subchan_alloc(dev->fd, req.channel, base | 0x323f, obj_class, &(*out)->m2mf); + uint32_t obj_class = nouveau_ws_context_find_class(classes, 0xb5); + ret = nouveau_ws_subchan_alloc(dev->fd, req.channel, 0, obj_class, &(*out)->copy); if (ret) goto fail_subchan; - obj_class = nouveau_ws_context_find_class(classes, 0xb5); - ret = nouveau_ws_subchan_alloc(dev->fd, req.channel, 0, obj_class, &(*out)->copy); + obj_class = nouveau_ws_context_find_class(classes, 0x2d); + ret = nouveau_ws_subchan_alloc(dev->fd, req.channel, base | 0x902d, obj_class, &(*out)->eng2d); if (ret) goto fail_subchan; @@ -162,6 +156,13 @@ nouveau_ws_context_create(struct nouveau_ws_device *dev, struct nouveau_ws_conte if (ret) goto fail_subchan; + obj_class = nouveau_ws_context_find_class(classes, 0x40); + if (!obj_class) + obj_class = nouveau_ws_context_find_class(classes, 0x39); + ret = nouveau_ws_subchan_alloc(dev->fd, req.channel, base | 0x323f, obj_class, &(*out)->m2mf); + if (ret) + goto fail_subchan; + obj_class = nouveau_ws_context_find_class(classes, 0xc0); ret = nouveau_ws_subchan_alloc(dev->fd, req.channel, base | 0x00c0, obj_class, &(*out)->compute); if (ret) @@ -177,9 +178,8 @@ fail_subchan: nouveau_ws_subchan_dealloc(dev->fd, &(*out)->copy); nouveau_ws_subchan_dealloc(dev->fd, &(*out)->m2mf); nouveau_ws_subchan_dealloc(dev->fd, &(*out)->eng2d); -fail_2d: nouveau_ws_channel_dealloc(dev->fd, req.channel); -fail_chan: +fail_alloc: FREE(*out); return ret; }