Commit 9ac596a4 authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau/nvif: give every object a human-readable identifier

Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
Reviewed-by: default avatarLyude Paul <lyude@redhat.com>
parent 6db25fb1
...@@ -92,8 +92,8 @@ int corec37d_caps_init(struct nouveau_drm *drm, struct nv50_disp *disp) ...@@ -92,8 +92,8 @@ int corec37d_caps_init(struct nouveau_drm *drm, struct nv50_disp *disp)
{ {
int ret; int ret;
ret = nvif_object_init(&disp->disp->object, 0, GV100_DISP_CAPS, ret = nvif_object_ctor(&disp->disp->object, "dispCaps", 0,
NULL, 0, &disp->caps); GV100_DISP_CAPS, NULL, 0, &disp->caps);
if (ret) { if (ret) {
NV_ERROR(drm, NV_ERROR(drm,
"Failed to init notifier caps region: %d\n", "Failed to init notifier caps region: %d\n",
......
...@@ -514,7 +514,7 @@ nv50_crc_ctx_init(struct nv50_head *head, struct nvif_mmu *mmu, ...@@ -514,7 +514,7 @@ nv50_crc_ctx_init(struct nv50_head *head, struct nvif_mmu *mmu,
if (ret) if (ret)
return ret; return ret;
ret = nvif_object_init(&core->chan.base.user, ret = nvif_object_ctor(&core->chan.base.user, "kmsCrcNtfyCtxDma",
NV50_DISP_HANDLE_CRC_CTX(head, idx), NV50_DISP_HANDLE_CRC_CTX(head, idx),
NV_DMA_IN_MEMORY, NV_DMA_IN_MEMORY,
&(struct nv_dma_v0) { &(struct nv_dma_v0) {
...@@ -538,7 +538,7 @@ nv50_crc_ctx_init(struct nv50_head *head, struct nvif_mmu *mmu, ...@@ -538,7 +538,7 @@ nv50_crc_ctx_init(struct nv50_head *head, struct nvif_mmu *mmu,
static inline void static inline void
nv50_crc_ctx_fini(struct nv50_crc_notifier_ctx *ctx) nv50_crc_ctx_fini(struct nv50_crc_notifier_ctx *ctx)
{ {
nvif_object_fini(&ctx->ntfy); nvif_object_dtor(&ctx->ntfy);
nvif_mem_fini(&ctx->mem); nvif_mem_fini(&ctx->mem);
} }
......
...@@ -138,8 +138,8 @@ curs507a_new_(const struct nv50_wimm_func *func, struct nouveau_drm *drm, ...@@ -138,8 +138,8 @@ curs507a_new_(const struct nv50_wimm_func *func, struct nouveau_drm *drm,
if (*pwndw = wndw, ret) if (*pwndw = wndw, ret)
return ret; return ret;
ret = nvif_object_init(&disp->disp->object, 0, oclass, &args, ret = nvif_object_ctor(&disp->disp->object, "kmsCurs", 0, oclass,
sizeof(args), &wndw->wimm.base.user); &args, sizeof(args), &wndw->wimm.base.user);
if (ret) { if (ret) {
NV_ERROR(drm, "curs%04x allocation failed: %d\n", oclass, ret); NV_ERROR(drm, "curs%04x allocation failed: %d\n", oclass, ret);
return ret; return ret;
......
...@@ -79,8 +79,9 @@ nv50_chan_create(struct nvif_device *device, struct nvif_object *disp, ...@@ -79,8 +79,9 @@ nv50_chan_create(struct nvif_device *device, struct nvif_object *disp,
while (oclass[0]) { while (oclass[0]) {
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
if (sclass[i].oclass == oclass[0]) { if (sclass[i].oclass == oclass[0]) {
ret = nvif_object_init(disp, 0, oclass[0], ret = nvif_object_ctor(disp, "kmsChan", 0,
data, size, &chan->user); oclass[0], data, size,
&chan->user);
if (ret == 0) if (ret == 0)
nvif_object_map(&chan->user, NULL, 0); nvif_object_map(&chan->user, NULL, 0);
nvif_object_sclass_put(&sclass); nvif_object_sclass_put(&sclass);
...@@ -97,7 +98,7 @@ nv50_chan_create(struct nvif_device *device, struct nvif_object *disp, ...@@ -97,7 +98,7 @@ nv50_chan_create(struct nvif_device *device, struct nvif_object *disp,
static void static void
nv50_chan_destroy(struct nv50_chan *chan) nv50_chan_destroy(struct nv50_chan *chan)
{ {
nvif_object_fini(&chan->user); nvif_object_dtor(&chan->user);
} }
/****************************************************************************** /******************************************************************************
...@@ -107,8 +108,8 @@ nv50_chan_destroy(struct nv50_chan *chan) ...@@ -107,8 +108,8 @@ nv50_chan_destroy(struct nv50_chan *chan)
void void
nv50_dmac_destroy(struct nv50_dmac *dmac) nv50_dmac_destroy(struct nv50_dmac *dmac)
{ {
nvif_object_fini(&dmac->vram); nvif_object_dtor(&dmac->vram);
nvif_object_fini(&dmac->sync); nvif_object_dtor(&dmac->sync);
nv50_chan_destroy(&dmac->base); nv50_chan_destroy(&dmac->base);
...@@ -155,7 +156,7 @@ nv50_dmac_create(struct nvif_device *device, struct nvif_object *disp, ...@@ -155,7 +156,7 @@ nv50_dmac_create(struct nvif_device *device, struct nvif_object *disp,
if (!syncbuf) if (!syncbuf)
return 0; return 0;
ret = nvif_object_init(&dmac->base.user, NV50_DISP_HANDLE_SYNCBUF, ret = nvif_object_ctor(&dmac->base.user, "kmsSyncCtxDma", NV50_DISP_HANDLE_SYNCBUF,
NV_DMA_IN_MEMORY, NV_DMA_IN_MEMORY,
&(struct nv_dma_v0) { &(struct nv_dma_v0) {
.target = NV_DMA_V0_TARGET_VRAM, .target = NV_DMA_V0_TARGET_VRAM,
...@@ -167,7 +168,7 @@ nv50_dmac_create(struct nvif_device *device, struct nvif_object *disp, ...@@ -167,7 +168,7 @@ nv50_dmac_create(struct nvif_device *device, struct nvif_object *disp,
if (ret) if (ret)
return ret; return ret;
ret = nvif_object_init(&dmac->base.user, NV50_DISP_HANDLE_VRAM, ret = nvif_object_ctor(&dmac->base.user, "kmsVramCtxDma", NV50_DISP_HANDLE_VRAM,
NV_DMA_IN_MEMORY, NV_DMA_IN_MEMORY,
&(struct nv_dma_v0) { &(struct nv_dma_v0) {
.target = NV_DMA_V0_TARGET_VRAM, .target = NV_DMA_V0_TARGET_VRAM,
...@@ -2465,7 +2466,7 @@ nv50_display_destroy(struct drm_device *dev) ...@@ -2465,7 +2466,7 @@ nv50_display_destroy(struct drm_device *dev)
nv50_audio_component_fini(nouveau_drm(dev)); nv50_audio_component_fini(nouveau_drm(dev));
nvif_object_unmap(&disp->caps); nvif_object_unmap(&disp->caps);
nvif_object_fini(&disp->caps); nvif_object_dtor(&disp->caps);
nv50_core_del(&disp->core); nv50_core_del(&disp->core);
nouveau_bo_unmap(disp->sync); nouveau_bo_unmap(disp->sync);
......
...@@ -33,8 +33,8 @@ oimm507b_init_(const struct nv50_wimm_func *func, struct nouveau_drm *drm, ...@@ -33,8 +33,8 @@ oimm507b_init_(const struct nv50_wimm_func *func, struct nouveau_drm *drm,
struct nv50_disp *disp = nv50_disp(drm->dev); struct nv50_disp *disp = nv50_disp(drm->dev);
int ret; int ret;
ret = nvif_object_init(&disp->disp->object, 0, oclass, &args, ret = nvif_object_ctor(&disp->disp->object, "kmsOvim", 0, oclass,
sizeof(args), &wndw->wimm.base.user); &args, sizeof(args), &wndw->wimm.base.user);
if (ret) { if (ret) {
NV_ERROR(drm, "oimm%04x allocation failed: %d\n", oclass, ret); NV_ERROR(drm, "oimm%04x allocation failed: %d\n", oclass, ret);
return ret; return ret;
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
static void static void
nv50_wndw_ctxdma_del(struct nv50_wndw_ctxdma *ctxdma) nv50_wndw_ctxdma_del(struct nv50_wndw_ctxdma *ctxdma)
{ {
nvif_object_fini(&ctxdma->object); nvif_object_dtor(&ctxdma->object);
list_del(&ctxdma->head); list_del(&ctxdma->head);
kfree(ctxdma); kfree(ctxdma);
} }
...@@ -94,8 +94,8 @@ nv50_wndw_ctxdma_new(struct nv50_wndw *wndw, struct drm_framebuffer *fb) ...@@ -94,8 +94,8 @@ nv50_wndw_ctxdma_new(struct nv50_wndw *wndw, struct drm_framebuffer *fb)
argc += sizeof(args.gf119); argc += sizeof(args.gf119);
} }
ret = nvif_object_init(wndw->ctxdma.parent, handle, NV_DMA_IN_MEMORY, ret = nvif_object_ctor(wndw->ctxdma.parent, "kmsFbCtxDma", handle,
&args, argc, &ctxdma->object); NV_DMA_IN_MEMORY, &args, argc, &ctxdma->object);
if (ret) { if (ret) {
nv50_wndw_ctxdma_del(ctxdma); nv50_wndw_ctxdma_del(ctxdma);
return ERR_PTR(ret); return ERR_PTR(ret);
......
/* SPDX-License-Identifier: MIT */ /* SPDX-License-Identifier: MIT */
#ifndef __NVIF_OBJECT_H__ #ifndef __NVIF_OBJECT_H__
#define __NVIF_OBJECT_H__ #define __NVIF_OBJECT_H__
#include <nvif/os.h> #include <nvif/os.h>
struct nvif_sclass { struct nvif_sclass {
...@@ -12,6 +11,7 @@ struct nvif_sclass { ...@@ -12,6 +11,7 @@ struct nvif_sclass {
struct nvif_object { struct nvif_object {
struct nvif_client *client; struct nvif_client *client;
const char *name;
u32 handle; u32 handle;
s32 oclass; s32 oclass;
void *priv; /*XXX: hack */ void *priv; /*XXX: hack */
...@@ -21,9 +21,9 @@ struct nvif_object { ...@@ -21,9 +21,9 @@ struct nvif_object {
} map; } map;
}; };
int nvif_object_init(struct nvif_object *, u32 handle, s32 oclass, void *, u32, int nvif_object_ctor(struct nvif_object *, const char *name, u32 handle,
struct nvif_object *); s32 oclass, void *, u32, struct nvif_object *);
void nvif_object_fini(struct nvif_object *); void nvif_object_dtor(struct nvif_object *);
int nvif_object_ioctl(struct nvif_object *, void *, u32, void **); int nvif_object_ioctl(struct nvif_object *, void *, u32, void **);
int nvif_object_sclass_get(struct nvif_object *, struct nvif_sclass **); int nvif_object_sclass_get(struct nvif_object *, struct nvif_sclass **);
void nvif_object_sclass_put(struct nvif_sclass **); void nvif_object_sclass_put(struct nvif_sclass **);
......
...@@ -114,7 +114,7 @@ static void ...@@ -114,7 +114,7 @@ static void
nouveau_abi16_ntfy_fini(struct nouveau_abi16_chan *chan, nouveau_abi16_ntfy_fini(struct nouveau_abi16_chan *chan,
struct nouveau_abi16_ntfy *ntfy) struct nouveau_abi16_ntfy *ntfy)
{ {
nvif_object_fini(&ntfy->object); nvif_object_dtor(&ntfy->object);
nvkm_mm_free(&chan->heap, &ntfy->node); nvkm_mm_free(&chan->heap, &ntfy->node);
list_del(&ntfy->head); list_del(&ntfy->head);
kfree(ntfy); kfree(ntfy);
...@@ -502,8 +502,8 @@ nouveau_abi16_ioctl_grobj_alloc(ABI16_IOCTL_ARGS) ...@@ -502,8 +502,8 @@ nouveau_abi16_ioctl_grobj_alloc(ABI16_IOCTL_ARGS)
list_add(&ntfy->head, &chan->notifiers); list_add(&ntfy->head, &chan->notifiers);
client->route = NVDRM_OBJECT_ABI16; client->route = NVDRM_OBJECT_ABI16;
ret = nvif_object_init(&chan->chan->user, init->handle, oclass, ret = nvif_object_ctor(&chan->chan->user, "abi16EngObj", init->handle,
NULL, 0, &ntfy->object); oclass, NULL, 0, &ntfy->object);
client->route = NVDRM_OBJECT_NVIF; client->route = NVDRM_OBJECT_NVIF;
if (ret) if (ret)
...@@ -569,7 +569,7 @@ nouveau_abi16_ioctl_notifierobj_alloc(ABI16_IOCTL_ARGS) ...@@ -569,7 +569,7 @@ nouveau_abi16_ioctl_notifierobj_alloc(ABI16_IOCTL_ARGS)
client->route = NVDRM_OBJECT_ABI16; client->route = NVDRM_OBJECT_ABI16;
client->super = true; client->super = true;
ret = nvif_object_init(&chan->chan->user, info->handle, ret = nvif_object_ctor(&chan->chan->user, "abi16Ntfy", info->handle,
NV_DMA_IN_MEMORY, &args, sizeof(args), NV_DMA_IN_MEMORY, &args, sizeof(args),
&ntfy->object); &ntfy->object);
client->super = false; client->super = false;
......
...@@ -1197,14 +1197,14 @@ nouveau_bo_move_init(struct nouveau_drm *drm) ...@@ -1197,14 +1197,14 @@ nouveau_bo_move_init(struct nouveau_drm *drm)
if (chan == NULL) if (chan == NULL)
continue; continue;
ret = nvif_object_init(&chan->user, ret = nvif_object_ctor(&chan->user, "ttmBoMove",
mthd->oclass | (mthd->engine << 16), mthd->oclass | (mthd->engine << 16),
mthd->oclass, NULL, 0, mthd->oclass, NULL, 0,
&drm->ttm.copy); &drm->ttm.copy);
if (ret == 0) { if (ret == 0) {
ret = mthd->init(chan, drm->ttm.copy.handle); ret = mthd->init(chan, drm->ttm.copy.handle);
if (ret) { if (ret) {
nvif_object_fini(&drm->ttm.copy); nvif_object_dtor(&drm->ttm.copy);
continue; continue;
} }
......
...@@ -102,12 +102,12 @@ nouveau_channel_del(struct nouveau_channel **pchan) ...@@ -102,12 +102,12 @@ nouveau_channel_del(struct nouveau_channel **pchan)
if (cli) if (cli)
nouveau_svmm_part(chan->vmm->svmm, chan->inst); nouveau_svmm_part(chan->vmm->svmm, chan->inst);
nvif_object_fini(&chan->nvsw); nvif_object_dtor(&chan->nvsw);
nvif_object_fini(&chan->gart); nvif_object_dtor(&chan->gart);
nvif_object_fini(&chan->vram); nvif_object_dtor(&chan->vram);
nvif_notify_fini(&chan->kill); nvif_notify_fini(&chan->kill);
nvif_object_fini(&chan->user); nvif_object_dtor(&chan->user);
nvif_object_fini(&chan->push.ctxdma); nvif_object_dtor(&chan->push.ctxdma);
nouveau_vma_del(&chan->push.vma); nouveau_vma_del(&chan->push.vma);
nouveau_bo_unmap(chan->push.buffer); nouveau_bo_unmap(chan->push.buffer);
if (chan->push.buffer && chan->push.buffer->pin_refcnt) if (chan->push.buffer && chan->push.buffer->pin_refcnt)
...@@ -214,8 +214,9 @@ nouveau_channel_prep(struct nouveau_drm *drm, struct nvif_device *device, ...@@ -214,8 +214,9 @@ nouveau_channel_prep(struct nouveau_drm *drm, struct nvif_device *device,
} }
} }
ret = nvif_object_init(&device->object, 0, NV_DMA_FROM_MEMORY, ret = nvif_object_ctor(&device->object, "abi16PushCtxDma", 0,
&args, sizeof(args), &chan->push.ctxdma); NV_DMA_FROM_MEMORY, &args, sizeof(args),
&chan->push.ctxdma);
if (ret) { if (ret) {
nouveau_channel_del(pchan); nouveau_channel_del(pchan);
return ret; return ret;
...@@ -290,8 +291,8 @@ nouveau_channel_ind(struct nouveau_drm *drm, struct nvif_device *device, ...@@ -290,8 +291,8 @@ nouveau_channel_ind(struct nouveau_drm *drm, struct nvif_device *device,
size = sizeof(args.nv50); size = sizeof(args.nv50);
} }
ret = nvif_object_init(&device->object, 0, *oclass++, ret = nvif_object_ctor(&device->object, "abi16ChanUser", 0,
&args, size, &chan->user); *oclass++, &args, size, &chan->user);
if (ret == 0) { if (ret == 0) {
if (chan->user.oclass >= VOLTA_CHANNEL_GPFIFO_A) { if (chan->user.oclass >= VOLTA_CHANNEL_GPFIFO_A) {
chan->chid = args.volta.chid; chan->chid = args.volta.chid;
...@@ -341,8 +342,9 @@ nouveau_channel_dma(struct nouveau_drm *drm, struct nvif_device *device, ...@@ -341,8 +342,9 @@ nouveau_channel_dma(struct nouveau_drm *drm, struct nvif_device *device,
args.offset = chan->push.addr; args.offset = chan->push.addr;
do { do {
ret = nvif_object_init(&device->object, 0, *oclass++, ret = nvif_object_ctor(&device->object, "abi16ChanUser", 0,
&args, sizeof(args), &chan->user); *oclass++, &args, sizeof(args),
&chan->user);
if (ret == 0) { if (ret == 0) {
chan->chid = args.chid; chan->chid = args.chid;
return ret; return ret;
...@@ -390,8 +392,9 @@ nouveau_channel_init(struct nouveau_channel *chan, u32 vram, u32 gart) ...@@ -390,8 +392,9 @@ nouveau_channel_init(struct nouveau_channel *chan, u32 vram, u32 gart)
args.limit = device->info.ram_user - 1; args.limit = device->info.ram_user - 1;
} }
ret = nvif_object_init(&chan->user, vram, NV_DMA_IN_MEMORY, ret = nvif_object_ctor(&chan->user, "abi16ChanVramCtxDma", vram,
&args, sizeof(args), &chan->vram); NV_DMA_IN_MEMORY, &args, sizeof(args),
&chan->vram);
if (ret) if (ret)
return ret; return ret;
...@@ -414,8 +417,9 @@ nouveau_channel_init(struct nouveau_channel *chan, u32 vram, u32 gart) ...@@ -414,8 +417,9 @@ nouveau_channel_init(struct nouveau_channel *chan, u32 vram, u32 gart)
args.limit = chan->vmm->vmm.limit - 1; args.limit = chan->vmm->vmm.limit - 1;
} }
ret = nvif_object_init(&chan->user, gart, NV_DMA_IN_MEMORY, ret = nvif_object_ctor(&chan->user, "abi16ChanGartCtxDma", gart,
&args, sizeof(args), &chan->gart); NV_DMA_IN_MEMORY, &args, sizeof(args),
&chan->gart);
if (ret) if (ret)
return ret; return ret;
} }
...@@ -453,7 +457,7 @@ nouveau_channel_init(struct nouveau_channel *chan, u32 vram, u32 gart) ...@@ -453,7 +457,7 @@ nouveau_channel_init(struct nouveau_channel *chan, u32 vram, u32 gart)
/* allocate software object class (used for fences on <= nv05) */ /* allocate software object class (used for fences on <= nv05) */
if (device->info.family < NV_DEVICE_INFO_V0_CELSIUS) { if (device->info.family < NV_DEVICE_INFO_V0_CELSIUS) {
ret = nvif_object_init(&chan->user, 0x006e, ret = nvif_object_ctor(&chan->user, "abi16NvswFence", 0x006e,
NVIF_CLASS_SW_NV04, NVIF_CLASS_SW_NV04,
NULL, 0, &chan->nvsw); NULL, 0, &chan->nvsw);
if (ret) if (ret)
......
...@@ -260,7 +260,7 @@ nouveau_debugfs_init(struct nouveau_drm *drm) ...@@ -260,7 +260,7 @@ nouveau_debugfs_init(struct nouveau_drm *drm)
if (!drm->debugfs) if (!drm->debugfs)
return -ENOMEM; return -ENOMEM;
ret = nvif_object_init(&drm->client.device.object, 0, ret = nvif_object_ctor(&drm->client.device.object, "debugfsCtrl", 0,
NVIF_CLASS_CONTROL, NULL, 0, NVIF_CLASS_CONTROL, NULL, 0,
&drm->debugfs->ctrl); &drm->debugfs->ctrl);
if (ret) if (ret)
...@@ -273,7 +273,7 @@ void ...@@ -273,7 +273,7 @@ void
nouveau_debugfs_fini(struct nouveau_drm *drm) nouveau_debugfs_fini(struct nouveau_drm *drm)
{ {
if (drm->debugfs && drm->debugfs->ctrl.priv) if (drm->debugfs && drm->debugfs->ctrl.priv)
nvif_object_fini(&drm->debugfs->ctrl); nvif_object_dtor(&drm->debugfs->ctrl);
kfree(drm->debugfs); kfree(drm->debugfs);
drm->debugfs = NULL; drm->debugfs = NULL;
......
...@@ -290,7 +290,7 @@ static void ...@@ -290,7 +290,7 @@ static void
nouveau_accel_ce_fini(struct nouveau_drm *drm) nouveau_accel_ce_fini(struct nouveau_drm *drm)
{ {
nouveau_channel_idle(drm->cechan); nouveau_channel_idle(drm->cechan);
nvif_object_fini(&drm->ttm.copy); nvif_object_dtor(&drm->ttm.copy);
nouveau_channel_del(&drm->cechan); nouveau_channel_del(&drm->cechan);
} }
...@@ -328,9 +328,9 @@ static void ...@@ -328,9 +328,9 @@ static void
nouveau_accel_gr_fini(struct nouveau_drm *drm) nouveau_accel_gr_fini(struct nouveau_drm *drm)
{ {
nouveau_channel_idle(drm->channel); nouveau_channel_idle(drm->channel);
nvif_object_fini(&drm->ntfy); nvif_object_dtor(&drm->ntfy);
nvkm_gpuobj_del(&drm->notify); nvkm_gpuobj_del(&drm->notify);
nvif_object_fini(&drm->nvsw); nvif_object_dtor(&drm->nvsw);
nouveau_channel_del(&drm->channel); nouveau_channel_del(&drm->channel);
} }
...@@ -363,9 +363,9 @@ nouveau_accel_gr_init(struct nouveau_drm *drm) ...@@ -363,9 +363,9 @@ nouveau_accel_gr_init(struct nouveau_drm *drm)
* on TNT/TNT2 HW that lacks any kind of support in host. * on TNT/TNT2 HW that lacks any kind of support in host.
*/ */
if (device->info.family < NV_DEVICE_INFO_V0_TESLA) { if (device->info.family < NV_DEVICE_INFO_V0_TESLA) {
ret = nvif_object_init(&drm->channel->user, NVDRM_NVSW, ret = nvif_object_ctor(&drm->channel->user, "drmNvsw",
nouveau_abi16_swclass(drm), NULL, 0, NVDRM_NVSW, nouveau_abi16_swclass(drm),
&drm->nvsw); NULL, 0, &drm->nvsw);
if (ret == 0) { if (ret == 0) {
ret = RING_SPACE(drm->channel, 2); ret = RING_SPACE(drm->channel, 2);
if (ret == 0) { if (ret == 0) {
...@@ -394,8 +394,8 @@ nouveau_accel_gr_init(struct nouveau_drm *drm) ...@@ -394,8 +394,8 @@ nouveau_accel_gr_init(struct nouveau_drm *drm)
return; return;
} }
ret = nvif_object_init(&drm->channel->user, NvNotify0, ret = nvif_object_ctor(&drm->channel->user, "drmM2mfNtfy",
NV_DMA_IN_MEMORY, NvNotify0, NV_DMA_IN_MEMORY,
&(struct nv_dma_v0) { &(struct nv_dma_v0) {
.target = NV_DMA_V0_TARGET_VRAM, .target = NV_DMA_V0_TARGET_VRAM,
.access = NV_DMA_V0_ACCESS_RDWR, .access = NV_DMA_V0_ACCESS_RDWR,
......
...@@ -256,13 +256,13 @@ nouveau_fbcon_accel_fini(struct drm_device *dev) ...@@ -256,13 +256,13 @@ nouveau_fbcon_accel_fini(struct drm_device *dev)
fbcon->helper.fbdev->flags |= FBINFO_HWACCEL_DISABLED; fbcon->helper.fbdev->flags |= FBINFO_HWACCEL_DISABLED;
console_unlock(); console_unlock();
nouveau_channel_idle(drm->channel); nouveau_channel_idle(drm->channel);
nvif_object_fini(&fbcon->twod); nvif_object_dtor(&fbcon->twod);
nvif_object_fini(&fbcon->blit); nvif_object_dtor(&fbcon->blit);
nvif_object_fini(&fbcon->gdi); nvif_object_dtor(&fbcon->gdi);
nvif_object_fini(&fbcon->patt); nvif_object_dtor(&fbcon->patt);
nvif_object_fini(&fbcon->rop); nvif_object_dtor(&fbcon->rop);
nvif_object_fini(&fbcon->clip); nvif_object_dtor(&fbcon->clip);
nvif_object_fini(&fbcon->surf2d); nvif_object_dtor(&fbcon->surf2d);
} }
} }
......
...@@ -905,7 +905,7 @@ nouveau_svm_fault_buffer_dtor(struct nouveau_svm *svm, int id) ...@@ -905,7 +905,7 @@ nouveau_svm_fault_buffer_dtor(struct nouveau_svm *svm, int id)
nouveau_svm_fault_buffer_fini(svm, id); nouveau_svm_fault_buffer_fini(svm, id);
nvif_notify_fini(&buffer->notify); nvif_notify_fini(&buffer->notify);
nvif_object_fini(&buffer->object); nvif_object_dtor(&buffer->object);
} }
static int static int
...@@ -919,8 +919,8 @@ nouveau_svm_fault_buffer_ctor(struct nouveau_svm *svm, s32 oclass, int id) ...@@ -919,8 +919,8 @@ nouveau_svm_fault_buffer_ctor(struct nouveau_svm *svm, s32 oclass, int id)
buffer->id = id; buffer->id = id;
ret = nvif_object_init(device, 0, oclass, &args, sizeof(args), ret = nvif_object_ctor(device, "svmFaultBuffer", 0, oclass, &args,
&buffer->object); sizeof(args), &buffer->object);
if (ret < 0) { if (ret < 0) {
SVM_ERR(svm, "Fault buffer allocation failed: %d", ret); SVM_ERR(svm, "Fault buffer allocation failed: %d", ret);
return ret; return ret;
......
...@@ -168,33 +168,33 @@ nv04_fbcon_accel_init(struct fb_info *info) ...@@ -168,33 +168,33 @@ nv04_fbcon_accel_init(struct fb_info *info)
return -EINVAL; return -EINVAL;
} }
ret = nvif_object_init(&chan->user, 0x0062, ret = nvif_object_ctor(&chan->user, "fbconCtxSurf2d", 0x0062,
device->info.family >= NV_DEVICE_INFO_V0_CELSIUS ? device->info.family >= NV_DEVICE_INFO_V0_CELSIUS ?
0x0062 : 0x0042, NULL, 0, &nfbdev->surf2d); 0x0062 : 0x0042, NULL, 0, &nfbdev->surf2d);
if (ret) if (ret)
return ret; return ret;
ret = nvif_object_init(&chan->user, 0x0019, 0x0019, NULL, 0, ret = nvif_object_ctor(&chan->user, "fbconCtxClip", 0x0019, 0x0019,
&nfbdev->clip); NULL, 0, &nfbdev->clip);
if (ret) if (ret)
return ret; return ret;
ret = nvif_object_init(&chan->user, 0x0043, 0x0043, NULL, 0, ret = nvif_object_ctor(&chan->user, "fbconCtxRop", 0x0043, 0x0043,
&nfbdev->rop); NULL, 0, &nfbdev->rop);
if (ret) if (ret)
return ret; return ret;
ret = nvif_object_init(&chan->user, 0x0044, 0x0044, NULL, 0, ret = nvif_object_ctor(&chan->user, "fbconCtxPatt", 0x0044, 0x0044,
&nfbdev->patt); NULL, 0, &nfbdev->patt);
if (ret) if (ret)
return ret; return ret;
ret = nvif_object_init(&chan->user, 0x004a, 0x004a, NULL, 0, ret = nvif_object_ctor(&chan->user, "fbconGdiRectText", 0x004a, 0x004a,
&nfbdev->gdi); NULL, 0, &nfbdev->gdi);
if (ret) if (ret)
return ret; return ret;
ret = nvif_object_init(&chan->user, 0x005f, ret = nvif_object_ctor(&chan->user, "fbconImageBlit", 0x005f,
device->info.chipset >= 0x11 ? 0x009f : 0x005f, device->info.chipset >= 0x11 ? 0x009f : 0x005f,
NULL, 0, &nfbdev->blit); NULL, 0, &nfbdev->blit);
if (ret) if (ret)
......
...@@ -58,7 +58,7 @@ nv10_fence_context_del(struct nouveau_channel *chan) ...@@ -58,7 +58,7 @@ nv10_fence_context_del(struct nouveau_channel *chan)
{ {
struct nv10_fence_chan *fctx = chan->fence; struct nv10_fence_chan *fctx = chan->fence;
nouveau_fence_context_del(&fctx->base); nouveau_fence_context_del(&fctx->base);
nvif_object_fini(&fctx->sema); nvif_object_dtor(&fctx->sema);
chan->fence = NULL; chan->fence = NULL;
nouveau_fence_context_free(&fctx->base); nouveau_fence_context_free(&fctx->base);
} }
......
...@@ -90,7 +90,8 @@ nv17_fence_context_new(struct nouveau_channel *chan) ...@@ -90,7 +90,8 @@ nv17_fence_context_new(struct nouveau_channel *chan)
fctx->base.read = nv10_fence_read; fctx->base.read = nv10_fence_read;
fctx->base.sync = nv17_fence_sync; fctx->base.sync = nv17_fence_sync;
ret = nvif_object_init(&chan->user, NvSema, NV_DMA_FROM_MEMORY, ret = nvif_object_ctor(&chan->user, "fenceCtxDma", NvSema,
NV_DMA_FROM_MEMORY,
&(struct nv_dma_v0) { &(struct nv_dma_v0) {
.target = NV_DMA_V0_TARGET_VRAM, .target = NV_DMA_V0_TARGET_VRAM,
.access = NV_DMA_V0_ACCESS_RDWR, .access = NV_DMA_V0_ACCESS_RDWR,
......
...@@ -181,8 +181,8 @@ nv50_fbcon_accel_init(struct fb_info *info) ...@@ -181,8 +181,8 @@ nv50_fbcon_accel_init(struct fb_info *info)
return -EINVAL; return -EINVAL;
} }
ret = nvif_object_init(&chan->user, 0x502d, 0x502d, NULL, 0, ret = nvif_object_ctor(&chan->user, "fbconTwoD", 0x502d, 0x502d,
&nfbdev->twod); NULL, 0, &nfbdev->twod);
if (ret) if (ret)
return ret; return ret;
......
...@@ -51,7 +51,8 @@ nv50_fence_context_new(struct nouveau_channel *chan) ...@@ -51,7 +51,8 @@ nv50_fence_context_new(struct nouveau_channel *chan)
fctx->base.read = nv10_fence_read; fctx->base.read = nv10_fence_read;
fctx->base.sync = nv17_fence_sync; fctx->base.sync = nv17_fence_sync;
ret = nvif_object_init(&chan->user, NvSema, NV_DMA_IN_MEMORY, ret = nvif_object_ctor(&chan->user, "fenceCtxDma", NvSema,
NV_DMA_IN_MEMORY,
&(struct nv_dma_v0) { &(struct nv_dma_v0) {
.target = NV_DMA_V0_TARGET_VRAM, .target = NV_DMA_V0_TARGET_VRAM,
.access = NV_DMA_V0_ACCESS_RDWR, .access = NV_DMA_V0_ACCESS_RDWR,
......
...@@ -154,8 +154,8 @@ nvc0_fbcon_accel_init(struct fb_info *info) ...@@ -154,8 +154,8 @@ nvc0_fbcon_accel_init(struct fb_info *info)
struct nouveau_channel *chan = drm->channel; struct nouveau_channel *chan = drm->channel;
int ret, format; int ret, format;
ret = nvif_object_init(&chan->user, 0x902d, 0x902d, NULL, 0, ret = nvif_object_ctor(&chan->user, "fbconTwoD", 0x902d, 0x902d,
&nfbdev->twod); NULL, 0, &nfbdev->twod);
if (ret) if (ret)
return ret; return ret;
......
...@@ -50,7 +50,7 @@ nvif_client_resume(struct nvif_client *client) ...@@ -50,7 +50,7 @@ nvif_client_resume(struct nvif_client *client)
void void
nvif_client_dtor(struct nvif_client *client) nvif_client_dtor(struct nvif_client *client)
{ {
nvif_object_fini(&client->object); nvif_object_dtor(&client->object);
if (client->driver) { if (client->driver) {
if (client->driver->fini) if (client->driver->fini)
client->driver->fini(client->object.priv); client->driver->fini(client->object.priv);
...@@ -70,8 +70,9 @@ nvif_client_ctor(struct nvif_client *parent, const char *name, u64 device, ...@@ -70,8 +70,9 @@ nvif_client_ctor(struct nvif_client *parent, const char *name, u64 device,
int ret; int ret;
strncpy(args.name, name, sizeof(args.name)); strncpy(args.name, name, sizeof(args.name));
ret = nvif_object_init(parent != client ? &parent->object : NULL, ret = nvif_object_ctor(parent != client ? &parent->object : NULL,
0, NVIF_CLASS_CLIENT, &args, sizeof(args), name ? name : "nvifClient", 0,
NVIF_CLASS_CLIENT, &args, sizeof(args),
&client->object); &client->object);
if (ret) if (ret)
return ret; return ret;
......
...@@ -44,15 +44,15 @@ nvif_device_fini(struct nvif_device *device) ...@@ -44,15 +44,15 @@ nvif_device_fini(struct nvif_device *device)
nvif_user_fini(device); nvif_user_fini(device);
kfree(device->runlist); kfree(device->runlist);
device->runlist = NULL; device->runlist = NULL;
nvif_object_fini(&device->object); nvif_object_dtor(&device->object);
} }
int int
nvif_device_init(struct nvif_object *parent, u32 handle, s32 oclass, nvif_device_init(struct nvif_object *parent, u32 handle, s32 oclass,
void *data, u32 size, struct nvif_device *device) void *data, u32 size, struct nvif_device *device)
{ {
int ret = nvif_object_init(parent, handle, oclass, data, size, int ret = nvif_object_ctor(parent, "nvifDevice", handle,
&device->object); oclass, data, size, &device->object);
device->runlist = NULL; device->runlist = NULL;
device->user.func = NULL; device->user.func = NULL;
if (ret == 0) { if (ret == 0) {
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
void void
nvif_disp_dtor(struct nvif_disp *disp) nvif_disp_dtor(struct nvif_disp *disp)
{ {
nvif_object_fini(&disp->object); nvif_object_dtor(&disp->object);
} }
int int
...@@ -56,6 +56,6 @@ nvif_disp_ctor(struct nvif_device *device, s32 oclass, struct nvif_disp *disp) ...@@ -56,6 +56,6 @@ nvif_disp_ctor(struct nvif_device *device, s32 oclass, struct nvif_disp *disp)
if (cid < 0) if (cid < 0)
return cid; return cid;
return nvif_object_init(&device->object, 0, disps[cid].oclass, return nvif_object_ctor(&device->object, "nvifDisp", 0,
NULL, 0, &disp->object); disps[cid].oclass, NULL, 0, &disp->object);
} }
...@@ -40,7 +40,7 @@ nvif_mem_init_map(struct nvif_mmu *mmu, u8 type, u64 size, struct nvif_mem *mem) ...@@ -40,7 +40,7 @@ nvif_mem_init_map(struct nvif_mmu *mmu, u8 type, u64 size, struct nvif_mem *mem)
void void
nvif_mem_fini(struct nvif_mem *mem) nvif_mem_fini(struct nvif_mem *mem)
{ {
nvif_object_fini(&mem->object); nvif_object_dtor(&mem->object);
} }
int int
...@@ -67,7 +67,7 @@ nvif_mem_init_type(struct nvif_mmu *mmu, s32 oclass, int type, u8 page, ...@@ -67,7 +67,7 @@ nvif_mem_init_type(struct nvif_mmu *mmu, s32 oclass, int type, u8 page,
args->size = size; args->size = size;
memcpy(args->data, argv, argc); memcpy(args->data, argv, argc);
ret = nvif_object_init(&mmu->object, 0, oclass, args, ret = nvif_object_ctor(&mmu->object, "nvifMem", 0, oclass, args,
sizeof(*args) + argc, &mem->object); sizeof(*args) + argc, &mem->object);
if (ret == 0) { if (ret == 0) {
mem->type = mmu->type[type].type; mem->type = mmu->type[type].type;
......
...@@ -30,7 +30,7 @@ nvif_mmu_fini(struct nvif_mmu *mmu) ...@@ -30,7 +30,7 @@ nvif_mmu_fini(struct nvif_mmu *mmu)
kfree(mmu->kind); kfree(mmu->kind);
kfree(mmu->type); kfree(mmu->type);
kfree(mmu->heap); kfree(mmu->heap);
nvif_object_fini(&mmu->object); nvif_object_dtor(&mmu->object);
} }
int int
...@@ -50,8 +50,8 @@ nvif_mmu_init(struct nvif_object *parent, s32 oclass, struct nvif_mmu *mmu) ...@@ -50,8 +50,8 @@ nvif_mmu_init(struct nvif_object *parent, s32 oclass, struct nvif_mmu *mmu)
mmu->type = NULL; mmu->type = NULL;
mmu->kind = NULL; mmu->kind = NULL;
ret = nvif_object_init(parent, 0, oclass, &args, sizeof(args), ret = nvif_object_ctor(parent, "nvifMmu", 0, oclass, &args,
&mmu->object); sizeof(args), &mmu->object);
if (ret) if (ret)
goto done; goto done;
......
...@@ -242,7 +242,7 @@ nvif_object_map(struct nvif_object *object, void *argv, u32 argc) ...@@ -242,7 +242,7 @@ nvif_object_map(struct nvif_object *object, void *argv, u32 argc)
} }
void void
nvif_object_fini(struct nvif_object *object) nvif_object_dtor(struct nvif_object *object)
{ {
struct { struct {
struct nvif_ioctl_v0 ioctl; struct nvif_ioctl_v0 ioctl;
...@@ -260,8 +260,8 @@ nvif_object_fini(struct nvif_object *object) ...@@ -260,8 +260,8 @@ nvif_object_fini(struct nvif_object *object)
} }
int int
nvif_object_init(struct nvif_object *parent, u32 handle, s32 oclass, nvif_object_ctor(struct nvif_object *parent, const char *name, u32 handle,
void *data, u32 size, struct nvif_object *object) s32 oclass, void *data, u32 size, struct nvif_object *object)
{ {
struct { struct {
struct nvif_ioctl_v0 ioctl; struct nvif_ioctl_v0 ioctl;
...@@ -270,6 +270,7 @@ nvif_object_init(struct nvif_object *parent, u32 handle, s32 oclass, ...@@ -270,6 +270,7 @@ nvif_object_init(struct nvif_object *parent, u32 handle, s32 oclass,
int ret = 0; int ret = 0;
object->client = NULL; object->client = NULL;
object->name = name ? name : "nvifObject";
object->handle = handle; object->handle = handle;
object->oclass = oclass; object->oclass = oclass;
object->map.ptr = NULL; object->map.ptr = NULL;
...@@ -277,7 +278,7 @@ nvif_object_init(struct nvif_object *parent, u32 handle, s32 oclass, ...@@ -277,7 +278,7 @@ nvif_object_init(struct nvif_object *parent, u32 handle, s32 oclass,
if (parent) { if (parent) {
if (!(args = kmalloc(sizeof(*args) + size, GFP_KERNEL))) { if (!(args = kmalloc(sizeof(*args) + size, GFP_KERNEL))) {
nvif_object_fini(object); nvif_object_dtor(object);
return -ENOMEM; return -ENOMEM;
} }
...@@ -300,6 +301,6 @@ nvif_object_init(struct nvif_object *parent, u32 handle, s32 oclass, ...@@ -300,6 +301,6 @@ nvif_object_init(struct nvif_object *parent, u32 handle, s32 oclass,
} }
if (ret) if (ret)
nvif_object_fini(object); nvif_object_dtor(object);
return ret; return ret;
} }
...@@ -28,7 +28,7 @@ void ...@@ -28,7 +28,7 @@ void
nvif_user_fini(struct nvif_device *device) nvif_user_fini(struct nvif_device *device)
{ {
if (device->user.func) { if (device->user.func) {
nvif_object_fini(&device->user.object); nvif_object_dtor(&device->user.object);
device->user.func = NULL; device->user.func = NULL;
} }
} }
...@@ -53,7 +53,8 @@ nvif_user_init(struct nvif_device *device) ...@@ -53,7 +53,8 @@ nvif_user_init(struct nvif_device *device)
if (cid < 0) if (cid < 0)
return cid; return cid;
ret = nvif_object_init(&device->object, 0, users[cid].oclass, NULL, 0, ret = nvif_object_ctor(&device->object, "nvifUsermode",
0, users[cid].oclass, NULL, 0,
&device->user.object); &device->user.object);
if (ret) if (ret)
return ret; return ret;
......
...@@ -108,7 +108,7 @@ void ...@@ -108,7 +108,7 @@ void
nvif_vmm_fini(struct nvif_vmm *vmm) nvif_vmm_fini(struct nvif_vmm *vmm)
{ {
kfree(vmm->page); kfree(vmm->page);
nvif_object_fini(&vmm->object); nvif_object_dtor(&vmm->object);
} }
int int
...@@ -130,7 +130,7 @@ nvif_vmm_init(struct nvif_mmu *mmu, s32 oclass, bool managed, u64 addr, ...@@ -130,7 +130,7 @@ nvif_vmm_init(struct nvif_mmu *mmu, s32 oclass, bool managed, u64 addr,
args->size = size; args->size = size;
memcpy(args->data, argv, argc); memcpy(args->data, argv, argc);
ret = nvif_object_init(&mmu->object, 0, oclass, args, argn, ret = nvif_object_ctor(&mmu->object, "nvifVmm", 0, oclass, args, argn,
&vmm->object); &vmm->object);
if (ret) if (ret)
goto done; goto done;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment