{
int ret;
- ret = nvif_object_init(&disp->disp->object, 0, GV100_DISP_CAPS,
- NULL, 0, &disp->caps);
+ ret = nvif_object_ctor(&disp->disp->object, "dispCaps", 0,
+ GV100_DISP_CAPS, NULL, 0, &disp->caps);
if (ret) {
NV_ERROR(drm,
"Failed to init notifier caps region: %d\n",
if (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),
NV_DMA_IN_MEMORY,
&(struct nv_dma_v0) {
static inline void
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);
}
if (*pwndw = wndw, ret)
return ret;
- ret = nvif_object_init(&disp->disp->object, 0, oclass, &args,
- sizeof(args), &wndw->wimm.base.user);
+ ret = nvif_object_ctor(&disp->disp->object, "kmsCurs", 0, oclass,
+ &args, sizeof(args), &wndw->wimm.base.user);
if (ret) {
NV_ERROR(drm, "curs%04x allocation failed: %d\n", oclass, ret);
return ret;
while (oclass[0]) {
for (i = 0; i < n; i++) {
if (sclass[i].oclass == oclass[0]) {
- ret = nvif_object_init(disp, 0, oclass[0],
- data, size, &chan->user);
+ ret = nvif_object_ctor(disp, "kmsChan", 0,
+ oclass[0], data, size,
+ &chan->user);
if (ret == 0)
nvif_object_map(&chan->user, NULL, 0);
nvif_object_sclass_put(&sclass);
static void
nv50_chan_destroy(struct nv50_chan *chan)
{
- nvif_object_fini(&chan->user);
+ nvif_object_dtor(&chan->user);
}
/******************************************************************************
void
nv50_dmac_destroy(struct nv50_dmac *dmac)
{
- nvif_object_fini(&dmac->vram);
- nvif_object_fini(&dmac->sync);
+ nvif_object_dtor(&dmac->vram);
+ nvif_object_dtor(&dmac->sync);
nv50_chan_destroy(&dmac->base);
if (!syncbuf)
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,
&(struct nv_dma_v0) {
.target = NV_DMA_V0_TARGET_VRAM,
if (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,
&(struct nv_dma_v0) {
.target = NV_DMA_V0_TARGET_VRAM,
nv50_audio_component_fini(nouveau_drm(dev));
nvif_object_unmap(&disp->caps);
- nvif_object_fini(&disp->caps);
+ nvif_object_dtor(&disp->caps);
nv50_core_del(&disp->core);
nouveau_bo_unmap(disp->sync);
struct nv50_disp *disp = nv50_disp(drm->dev);
int ret;
- ret = nvif_object_init(&disp->disp->object, 0, oclass, &args,
- sizeof(args), &wndw->wimm.base.user);
+ ret = nvif_object_ctor(&disp->disp->object, "kmsOvim", 0, oclass,
+ &args, sizeof(args), &wndw->wimm.base.user);
if (ret) {
NV_ERROR(drm, "oimm%04x allocation failed: %d\n", oclass, ret);
return ret;
static void
nv50_wndw_ctxdma_del(struct nv50_wndw_ctxdma *ctxdma)
{
- nvif_object_fini(&ctxdma->object);
+ nvif_object_dtor(&ctxdma->object);
list_del(&ctxdma->head);
kfree(ctxdma);
}
argc += sizeof(args.gf119);
}
- ret = nvif_object_init(wndw->ctxdma.parent, handle, NV_DMA_IN_MEMORY,
- &args, argc, &ctxdma->object);
+ ret = nvif_object_ctor(wndw->ctxdma.parent, "kmsFbCtxDma", handle,
+ NV_DMA_IN_MEMORY, &args, argc, &ctxdma->object);
if (ret) {
nv50_wndw_ctxdma_del(ctxdma);
return ERR_PTR(ret);
/* SPDX-License-Identifier: MIT */
#ifndef __NVIF_OBJECT_H__
#define __NVIF_OBJECT_H__
-
#include <nvif/os.h>
struct nvif_sclass {
struct nvif_object {
struct nvif_client *client;
+ const char *name;
u32 handle;
s32 oclass;
void *priv; /*XXX: hack */
} map;
};
-int nvif_object_init(struct nvif_object *, u32 handle, s32 oclass, void *, u32,
- struct nvif_object *);
-void nvif_object_fini(struct nvif_object *);
+int nvif_object_ctor(struct nvif_object *, const char *name, u32 handle,
+ s32 oclass, void *, u32, struct nvif_object *);
+void nvif_object_dtor(struct nvif_object *);
int nvif_object_ioctl(struct nvif_object *, void *, u32, void **);
int nvif_object_sclass_get(struct nvif_object *, struct nvif_sclass **);
void nvif_object_sclass_put(struct nvif_sclass **);
nouveau_abi16_ntfy_fini(struct nouveau_abi16_chan *chan,
struct nouveau_abi16_ntfy *ntfy)
{
- nvif_object_fini(&ntfy->object);
+ nvif_object_dtor(&ntfy->object);
nvkm_mm_free(&chan->heap, &ntfy->node);
list_del(&ntfy->head);
kfree(ntfy);
list_add(&ntfy->head, &chan->notifiers);
client->route = NVDRM_OBJECT_ABI16;
- ret = nvif_object_init(&chan->chan->user, init->handle, oclass,
- NULL, 0, &ntfy->object);
+ ret = nvif_object_ctor(&chan->chan->user, "abi16EngObj", init->handle,
+ oclass, NULL, 0, &ntfy->object);
client->route = NVDRM_OBJECT_NVIF;
if (ret)
client->route = NVDRM_OBJECT_ABI16;
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),
&ntfy->object);
client->super = false;
if (chan == NULL)
continue;
- ret = nvif_object_init(&chan->user,
+ ret = nvif_object_ctor(&chan->user, "ttmBoMove",
mthd->oclass | (mthd->engine << 16),
mthd->oclass, NULL, 0,
&drm->ttm.copy);
if (ret == 0) {
ret = mthd->init(chan, drm->ttm.copy.handle);
if (ret) {
- nvif_object_fini(&drm->ttm.copy);
+ nvif_object_dtor(&drm->ttm.copy);
continue;
}
if (cli)
nouveau_svmm_part(chan->vmm->svmm, chan->inst);
- nvif_object_fini(&chan->nvsw);
- nvif_object_fini(&chan->gart);
- nvif_object_fini(&chan->vram);
+ nvif_object_dtor(&chan->nvsw);
+ nvif_object_dtor(&chan->gart);
+ nvif_object_dtor(&chan->vram);
nvif_notify_fini(&chan->kill);
- nvif_object_fini(&chan->user);
- nvif_object_fini(&chan->push.ctxdma);
+ nvif_object_dtor(&chan->user);
+ nvif_object_dtor(&chan->push.ctxdma);
nouveau_vma_del(&chan->push.vma);
nouveau_bo_unmap(chan->push.buffer);
if (chan->push.buffer && chan->push.buffer->pin_refcnt)
}
}
- ret = nvif_object_init(&device->object, 0, NV_DMA_FROM_MEMORY,
- &args, sizeof(args), &chan->push.ctxdma);
+ ret = nvif_object_ctor(&device->object, "abi16PushCtxDma", 0,
+ NV_DMA_FROM_MEMORY, &args, sizeof(args),
+ &chan->push.ctxdma);
if (ret) {
nouveau_channel_del(pchan);
return ret;
size = sizeof(args.nv50);
}
- ret = nvif_object_init(&device->object, 0, *oclass++,
- &args, size, &chan->user);
+ ret = nvif_object_ctor(&device->object, "abi16ChanUser", 0,
+ *oclass++, &args, size, &chan->user);
if (ret == 0) {
if (chan->user.oclass >= VOLTA_CHANNEL_GPFIFO_A) {
chan->chid = args.volta.chid;
args.offset = chan->push.addr;
do {
- ret = nvif_object_init(&device->object, 0, *oclass++,
- &args, sizeof(args), &chan->user);
+ ret = nvif_object_ctor(&device->object, "abi16ChanUser", 0,
+ *oclass++, &args, sizeof(args),
+ &chan->user);
if (ret == 0) {
chan->chid = args.chid;
return ret;
args.limit = device->info.ram_user - 1;
}
- ret = nvif_object_init(&chan->user, vram, NV_DMA_IN_MEMORY,
- &args, sizeof(args), &chan->vram);
+ ret = nvif_object_ctor(&chan->user, "abi16ChanVramCtxDma", vram,
+ NV_DMA_IN_MEMORY, &args, sizeof(args),
+ &chan->vram);
if (ret)
return ret;
args.limit = chan->vmm->vmm.limit - 1;
}
- ret = nvif_object_init(&chan->user, gart, NV_DMA_IN_MEMORY,
- &args, sizeof(args), &chan->gart);
+ ret = nvif_object_ctor(&chan->user, "abi16ChanGartCtxDma", gart,
+ NV_DMA_IN_MEMORY, &args, sizeof(args),
+ &chan->gart);
if (ret)
return ret;
}
/* allocate software object class (used for fences on <= nv05) */
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,
NULL, 0, &chan->nvsw);
if (ret)
if (!drm->debugfs)
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,
&drm->debugfs->ctrl);
if (ret)
nouveau_debugfs_fini(struct nouveau_drm *drm)
{
if (drm->debugfs && drm->debugfs->ctrl.priv)
- nvif_object_fini(&drm->debugfs->ctrl);
+ nvif_object_dtor(&drm->debugfs->ctrl);
kfree(drm->debugfs);
drm->debugfs = NULL;
nouveau_accel_ce_fini(struct nouveau_drm *drm)
{
nouveau_channel_idle(drm->cechan);
- nvif_object_fini(&drm->ttm.copy);
+ nvif_object_dtor(&drm->ttm.copy);
nouveau_channel_del(&drm->cechan);
}
nouveau_accel_gr_fini(struct nouveau_drm *drm)
{
nouveau_channel_idle(drm->channel);
- nvif_object_fini(&drm->ntfy);
+ nvif_object_dtor(&drm->ntfy);
nvkm_gpuobj_del(&drm->notify);
- nvif_object_fini(&drm->nvsw);
+ nvif_object_dtor(&drm->nvsw);
nouveau_channel_del(&drm->channel);
}
* on TNT/TNT2 HW that lacks any kind of support in host.
*/
if (device->info.family < NV_DEVICE_INFO_V0_TESLA) {
- ret = nvif_object_init(&drm->channel->user, NVDRM_NVSW,
- nouveau_abi16_swclass(drm), NULL, 0,
- &drm->nvsw);
+ ret = nvif_object_ctor(&drm->channel->user, "drmNvsw",
+ NVDRM_NVSW, nouveau_abi16_swclass(drm),
+ NULL, 0, &drm->nvsw);
if (ret == 0) {
ret = RING_SPACE(drm->channel, 2);
if (ret == 0) {
return;
}
- ret = nvif_object_init(&drm->channel->user, NvNotify0,
- NV_DMA_IN_MEMORY,
+ ret = nvif_object_ctor(&drm->channel->user, "drmM2mfNtfy",
+ NvNotify0, NV_DMA_IN_MEMORY,
&(struct nv_dma_v0) {
.target = NV_DMA_V0_TARGET_VRAM,
.access = NV_DMA_V0_ACCESS_RDWR,
fbcon->helper.fbdev->flags |= FBINFO_HWACCEL_DISABLED;
console_unlock();
nouveau_channel_idle(drm->channel);
- nvif_object_fini(&fbcon->twod);
- nvif_object_fini(&fbcon->blit);
- nvif_object_fini(&fbcon->gdi);
- nvif_object_fini(&fbcon->patt);
- nvif_object_fini(&fbcon->rop);
- nvif_object_fini(&fbcon->clip);
- nvif_object_fini(&fbcon->surf2d);
+ nvif_object_dtor(&fbcon->twod);
+ nvif_object_dtor(&fbcon->blit);
+ nvif_object_dtor(&fbcon->gdi);
+ nvif_object_dtor(&fbcon->patt);
+ nvif_object_dtor(&fbcon->rop);
+ nvif_object_dtor(&fbcon->clip);
+ nvif_object_dtor(&fbcon->surf2d);
}
}
nouveau_svm_fault_buffer_fini(svm, id);
nvif_notify_fini(&buffer->notify);
- nvif_object_fini(&buffer->object);
+ nvif_object_dtor(&buffer->object);
}
static int
buffer->id = id;
- ret = nvif_object_init(device, 0, oclass, &args, sizeof(args),
- &buffer->object);
+ ret = nvif_object_ctor(device, "svmFaultBuffer", 0, oclass, &args,
+ sizeof(args), &buffer->object);
if (ret < 0) {
SVM_ERR(svm, "Fault buffer allocation failed: %d", ret);
return ret;
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 ?
0x0062 : 0x0042, NULL, 0, &nfbdev->surf2d);
if (ret)
return ret;
- ret = nvif_object_init(&chan->user, 0x0019, 0x0019, NULL, 0,
- &nfbdev->clip);
+ ret = nvif_object_ctor(&chan->user, "fbconCtxClip", 0x0019, 0x0019,
+ NULL, 0, &nfbdev->clip);
if (ret)
return ret;
- ret = nvif_object_init(&chan->user, 0x0043, 0x0043, NULL, 0,
- &nfbdev->rop);
+ ret = nvif_object_ctor(&chan->user, "fbconCtxRop", 0x0043, 0x0043,
+ NULL, 0, &nfbdev->rop);
if (ret)
return ret;
- ret = nvif_object_init(&chan->user, 0x0044, 0x0044, NULL, 0,
- &nfbdev->patt);
+ ret = nvif_object_ctor(&chan->user, "fbconCtxPatt", 0x0044, 0x0044,
+ NULL, 0, &nfbdev->patt);
if (ret)
return ret;
- ret = nvif_object_init(&chan->user, 0x004a, 0x004a, NULL, 0,
- &nfbdev->gdi);
+ ret = nvif_object_ctor(&chan->user, "fbconGdiRectText", 0x004a, 0x004a,
+ NULL, 0, &nfbdev->gdi);
if (ret)
return ret;
- ret = nvif_object_init(&chan->user, 0x005f,
+ ret = nvif_object_ctor(&chan->user, "fbconImageBlit", 0x005f,
device->info.chipset >= 0x11 ? 0x009f : 0x005f,
NULL, 0, &nfbdev->blit);
if (ret)
{
struct nv10_fence_chan *fctx = chan->fence;
nouveau_fence_context_del(&fctx->base);
- nvif_object_fini(&fctx->sema);
+ nvif_object_dtor(&fctx->sema);
chan->fence = NULL;
nouveau_fence_context_free(&fctx->base);
}
fctx->base.read = nv10_fence_read;
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) {
.target = NV_DMA_V0_TARGET_VRAM,
.access = NV_DMA_V0_ACCESS_RDWR,
return -EINVAL;
}
- ret = nvif_object_init(&chan->user, 0x502d, 0x502d, NULL, 0,
- &nfbdev->twod);
+ ret = nvif_object_ctor(&chan->user, "fbconTwoD", 0x502d, 0x502d,
+ NULL, 0, &nfbdev->twod);
if (ret)
return ret;
fctx->base.read = nv10_fence_read;
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) {
.target = NV_DMA_V0_TARGET_VRAM,
.access = NV_DMA_V0_ACCESS_RDWR,
struct nouveau_channel *chan = drm->channel;
int ret, format;
- ret = nvif_object_init(&chan->user, 0x902d, 0x902d, NULL, 0,
- &nfbdev->twod);
+ ret = nvif_object_ctor(&chan->user, "fbconTwoD", 0x902d, 0x902d,
+ NULL, 0, &nfbdev->twod);
if (ret)
return ret;
void
nvif_client_dtor(struct nvif_client *client)
{
- nvif_object_fini(&client->object);
+ nvif_object_dtor(&client->object);
if (client->driver) {
if (client->driver->fini)
client->driver->fini(client->object.priv);
int ret;
strncpy(args.name, name, sizeof(args.name));
- ret = nvif_object_init(parent != client ? &parent->object : NULL,
- 0, NVIF_CLASS_CLIENT, &args, sizeof(args),
+ ret = nvif_object_ctor(parent != client ? &parent->object : NULL,
+ name ? name : "nvifClient", 0,
+ NVIF_CLASS_CLIENT, &args, sizeof(args),
&client->object);
if (ret)
return ret;
nvif_user_fini(device);
kfree(device->runlist);
device->runlist = NULL;
- nvif_object_fini(&device->object);
+ nvif_object_dtor(&device->object);
}
int
nvif_device_init(struct nvif_object *parent, u32 handle, s32 oclass,
void *data, u32 size, struct nvif_device *device)
{
- int ret = nvif_object_init(parent, handle, oclass, data, size,
- &device->object);
+ int ret = nvif_object_ctor(parent, "nvifDevice", handle,
+ oclass, data, size, &device->object);
device->runlist = NULL;
device->user.func = NULL;
if (ret == 0) {
void
nvif_disp_dtor(struct nvif_disp *disp)
{
- nvif_object_fini(&disp->object);
+ nvif_object_dtor(&disp->object);
}
int
if (cid < 0)
return cid;
- return nvif_object_init(&device->object, 0, disps[cid].oclass,
- NULL, 0, &disp->object);
+ return nvif_object_ctor(&device->object, "nvifDisp", 0,
+ disps[cid].oclass, NULL, 0, &disp->object);
}
void
nvif_mem_fini(struct nvif_mem *mem)
{
- nvif_object_fini(&mem->object);
+ nvif_object_dtor(&mem->object);
}
int
args->size = size;
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);
if (ret == 0) {
mem->type = mmu->type[type].type;
kfree(mmu->kind);
kfree(mmu->type);
kfree(mmu->heap);
- nvif_object_fini(&mmu->object);
+ nvif_object_dtor(&mmu->object);
}
int
mmu->type = NULL;
mmu->kind = NULL;
- ret = nvif_object_init(parent, 0, oclass, &args, sizeof(args),
- &mmu->object);
+ ret = nvif_object_ctor(parent, "nvifMmu", 0, oclass, &args,
+ sizeof(args), &mmu->object);
if (ret)
goto done;
}
void
-nvif_object_fini(struct nvif_object *object)
+nvif_object_dtor(struct nvif_object *object)
{
struct {
struct nvif_ioctl_v0 ioctl;
}
int
-nvif_object_init(struct nvif_object *parent, u32 handle, s32 oclass,
- void *data, u32 size, struct nvif_object *object)
+nvif_object_ctor(struct nvif_object *parent, const char *name, u32 handle,
+ s32 oclass, void *data, u32 size, struct nvif_object *object)
{
struct {
struct nvif_ioctl_v0 ioctl;
int ret = 0;
object->client = NULL;
+ object->name = name ? name : "nvifObject";
object->handle = handle;
object->oclass = oclass;
object->map.ptr = NULL;
if (parent) {
if (!(args = kmalloc(sizeof(*args) + size, GFP_KERNEL))) {
- nvif_object_fini(object);
+ nvif_object_dtor(object);
return -ENOMEM;
}
}
if (ret)
- nvif_object_fini(object);
+ nvif_object_dtor(object);
return ret;
}
nvif_user_fini(struct nvif_device *device)
{
if (device->user.func) {
- nvif_object_fini(&device->user.object);
+ nvif_object_dtor(&device->user.object);
device->user.func = NULL;
}
}
if (cid < 0)
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);
if (ret)
return ret;
nvif_vmm_fini(struct nvif_vmm *vmm)
{
kfree(vmm->page);
- nvif_object_fini(&vmm->object);
+ nvif_object_dtor(&vmm->object);
}
int
args->size = size;
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);
if (ret)
goto done;