Commit e79c9a0b authored by Ben Skeggs's avatar Ben Skeggs

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

Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
Reviewed-by: default avatarLyude Paul <lyude@redhat.com>
parent b495396c
...@@ -510,7 +510,7 @@ nv50_crc_ctx_init(struct nv50_head *head, struct nvif_mmu *mmu, ...@@ -510,7 +510,7 @@ nv50_crc_ctx_init(struct nv50_head *head, struct nvif_mmu *mmu,
struct nv50_core *core = nv50_disp(head->base.base.dev)->core; struct nv50_core *core = nv50_disp(head->base.base.dev)->core;
int ret; int ret;
ret = nvif_mem_init_map(mmu, NVIF_MEM_VRAM, len, &ctx->mem); ret = nvif_mem_ctor_map(mmu, "kmsCrcNtfy", NVIF_MEM_VRAM, len, &ctx->mem);
if (ret) if (ret)
return ret; return ret;
...@@ -531,7 +531,7 @@ nv50_crc_ctx_init(struct nv50_head *head, struct nvif_mmu *mmu, ...@@ -531,7 +531,7 @@ nv50_crc_ctx_init(struct nv50_head *head, struct nvif_mmu *mmu,
return 0; return 0;
fail_fini: fail_fini:
nvif_mem_fini(&ctx->mem); nvif_mem_dtor(&ctx->mem);
return ret; return ret;
} }
...@@ -539,7 +539,7 @@ static inline void ...@@ -539,7 +539,7 @@ 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_dtor(&ctx->ntfy); nvif_object_dtor(&ctx->ntfy);
nvif_mem_fini(&ctx->mem); nvif_mem_dtor(&ctx->mem);
} }
int nv50_crc_set_source(struct drm_crtc *crtc, const char *source_str) int nv50_crc_set_source(struct drm_crtc *crtc, const char *source_str)
......
...@@ -113,7 +113,7 @@ nv50_dmac_destroy(struct nv50_dmac *dmac) ...@@ -113,7 +113,7 @@ nv50_dmac_destroy(struct nv50_dmac *dmac)
nv50_chan_destroy(&dmac->base); nv50_chan_destroy(&dmac->base);
nvif_mem_fini(&dmac->push); nvif_mem_dtor(&dmac->push);
} }
int int
...@@ -140,7 +140,8 @@ nv50_dmac_create(struct nvif_device *device, struct nvif_object *disp, ...@@ -140,7 +140,8 @@ nv50_dmac_create(struct nvif_device *device, struct nvif_object *disp,
if (device->info.family == NV_DEVICE_INFO_V0_PASCAL) if (device->info.family == NV_DEVICE_INFO_V0_PASCAL)
type |= NVIF_MEM_VRAM; type |= NVIF_MEM_VRAM;
ret = nvif_mem_init_map(&cli->mmu, type, 0x1000, &dmac->push); ret = nvif_mem_ctor_map(&cli->mmu, "kmsChanPush", type, 0x1000,
&dmac->push);
if (ret) if (ret)
return ret; return ret;
......
...@@ -60,7 +60,7 @@ nv50_lut_fini(struct nv50_lut *lut) ...@@ -60,7 +60,7 @@ nv50_lut_fini(struct nv50_lut *lut)
{ {
int i; int i;
for (i = 0; i < ARRAY_SIZE(lut->mem); i++) for (i = 0; i < ARRAY_SIZE(lut->mem); i++)
nvif_mem_fini(&lut->mem[i]); nvif_mem_dtor(&lut->mem[i]);
} }
int int
...@@ -70,8 +70,8 @@ nv50_lut_init(struct nv50_disp *disp, struct nvif_mmu *mmu, ...@@ -70,8 +70,8 @@ nv50_lut_init(struct nv50_disp *disp, struct nvif_mmu *mmu,
const u32 size = disp->disp->object.oclass < GF110_DISP ? 257 : 1025; const u32 size = disp->disp->object.oclass < GF110_DISP ? 257 : 1025;
int i; int i;
for (i = 0; i < ARRAY_SIZE(lut->mem); i++) { for (i = 0; i < ARRAY_SIZE(lut->mem); i++) {
int ret = nvif_mem_init_map(mmu, NVIF_MEM_VRAM, size * 8, int ret = nvif_mem_ctor_map(mmu, "kmsLut", NVIF_MEM_VRAM,
&lut->mem[i]); size * 8, &lut->mem[i]);
if (ret) if (ret)
return ret; return ret;
} }
......
...@@ -10,11 +10,13 @@ struct nvif_mem { ...@@ -10,11 +10,13 @@ struct nvif_mem {
u64 size; u64 size;
}; };
int nvif_mem_init_type(struct nvif_mmu *mmu, s32 oclass, int type, u8 page, int nvif_mem_ctor_type(struct nvif_mmu *mmu, const char *name, s32 oclass,
u64 size, void *argv, u32 argc, struct nvif_mem *); int type, u8 page, u64 size, void *argv, u32 argc,
int nvif_mem_init(struct nvif_mmu *mmu, s32 oclass, u8 type, u8 page, struct nvif_mem *);
u64 size, void *argv, u32 argc, struct nvif_mem *); int nvif_mem_ctor(struct nvif_mmu *mmu, const char *name, s32 oclass, u8 type,
void nvif_mem_fini(struct nvif_mem *); u8 page, u64 size, void *argv, u32 argc, struct nvif_mem *);
void nvif_mem_dtor(struct nvif_mem *);
int nvif_mem_init_map(struct nvif_mmu *, u8 type, u64 size, struct nvif_mem *); int nvif_mem_ctor_map(struct nvif_mmu *, const char *name, u8 type, u64 size,
struct nvif_mem *);
#endif #endif
...@@ -87,7 +87,7 @@ nouveau_mem_fini(struct nouveau_mem *mem) ...@@ -87,7 +87,7 @@ nouveau_mem_fini(struct nouveau_mem *mem)
nvif_vmm_put(&mem->cli->drm->client.vmm.vmm, &mem->vma[1]); nvif_vmm_put(&mem->cli->drm->client.vmm.vmm, &mem->vma[1]);
nvif_vmm_put(&mem->cli->drm->client.vmm.vmm, &mem->vma[0]); nvif_vmm_put(&mem->cli->drm->client.vmm.vmm, &mem->vma[0]);
mutex_lock(&mem->cli->drm->master.lock); mutex_lock(&mem->cli->drm->master.lock);
nvif_mem_fini(&mem->mem); nvif_mem_dtor(&mem->mem);
mutex_unlock(&mem->cli->drm->master.lock); mutex_unlock(&mem->cli->drm->master.lock);
} }
...@@ -121,7 +121,7 @@ nouveau_mem_host(struct ttm_mem_reg *reg, struct ttm_dma_tt *tt) ...@@ -121,7 +121,7 @@ nouveau_mem_host(struct ttm_mem_reg *reg, struct ttm_dma_tt *tt)
mutex_lock(&drm->master.lock); mutex_lock(&drm->master.lock);
cli->base.super = true; cli->base.super = true;
ret = nvif_mem_init_type(mmu, cli->mem->oclass, type, PAGE_SHIFT, ret = nvif_mem_ctor_type(mmu, "ttmHostMem", cli->mem->oclass, type, PAGE_SHIFT,
reg->num_pages << PAGE_SHIFT, reg->num_pages << PAGE_SHIFT,
&args, sizeof(args), &mem->mem); &args, sizeof(args), &mem->mem);
cli->base.super = super; cli->base.super = super;
...@@ -144,7 +144,7 @@ nouveau_mem_vram(struct ttm_mem_reg *reg, bool contig, u8 page) ...@@ -144,7 +144,7 @@ nouveau_mem_vram(struct ttm_mem_reg *reg, bool contig, u8 page)
cli->base.super = true; cli->base.super = true;
switch (cli->mem->oclass) { switch (cli->mem->oclass) {
case NVIF_CLASS_MEM_GF100: case NVIF_CLASS_MEM_GF100:
ret = nvif_mem_init_type(mmu, cli->mem->oclass, ret = nvif_mem_ctor_type(mmu, "ttmVram", cli->mem->oclass,
drm->ttm.type_vram, page, size, drm->ttm.type_vram, page, size,
&(struct gf100_mem_v0) { &(struct gf100_mem_v0) {
.contig = contig, .contig = contig,
...@@ -152,7 +152,7 @@ nouveau_mem_vram(struct ttm_mem_reg *reg, bool contig, u8 page) ...@@ -152,7 +152,7 @@ nouveau_mem_vram(struct ttm_mem_reg *reg, bool contig, u8 page)
&mem->mem); &mem->mem);
break; break;
case NVIF_CLASS_MEM_NV50: case NVIF_CLASS_MEM_NV50:
ret = nvif_mem_init_type(mmu, cli->mem->oclass, ret = nvif_mem_ctor_type(mmu, "ttmVram", cli->mem->oclass,
drm->ttm.type_vram, page, size, drm->ttm.type_vram, page, size,
&(struct nv50_mem_v0) { &(struct nv50_mem_v0) {
.bankswz = mmu->kind[mem->kind] == 2, .bankswz = mmu->kind[mem->kind] == 2,
......
...@@ -25,27 +25,29 @@ ...@@ -25,27 +25,29 @@
#include <nvif/if000a.h> #include <nvif/if000a.h>
int int
nvif_mem_init_map(struct nvif_mmu *mmu, u8 type, u64 size, struct nvif_mem *mem) nvif_mem_ctor_map(struct nvif_mmu *mmu, const char *name, u8 type, u64 size,
struct nvif_mem *mem)
{ {
int ret = nvif_mem_init(mmu, mmu->mem, NVIF_MEM_MAPPABLE | type, 0, int ret = nvif_mem_ctor(mmu, name, mmu->mem, NVIF_MEM_MAPPABLE | type,
size, NULL, 0, mem); 0, size, NULL, 0, mem);
if (ret == 0) { if (ret == 0) {
ret = nvif_object_map(&mem->object, NULL, 0); ret = nvif_object_map(&mem->object, NULL, 0);
if (ret) if (ret)
nvif_mem_fini(mem); nvif_mem_dtor(mem);
} }
return ret; return ret;
} }
void void
nvif_mem_fini(struct nvif_mem *mem) nvif_mem_dtor(struct nvif_mem *mem)
{ {
nvif_object_dtor(&mem->object); nvif_object_dtor(&mem->object);
} }
int int
nvif_mem_init_type(struct nvif_mmu *mmu, s32 oclass, int type, u8 page, nvif_mem_ctor_type(struct nvif_mmu *mmu, const char *name, s32 oclass,
u64 size, void *argv, u32 argc, struct nvif_mem *mem) int type, u8 page, u64 size, void *argv, u32 argc,
struct nvif_mem *mem)
{ {
struct nvif_mem_v0 *args; struct nvif_mem_v0 *args;
u8 stack[128]; u8 stack[128];
...@@ -67,8 +69,8 @@ nvif_mem_init_type(struct nvif_mmu *mmu, s32 oclass, int type, u8 page, ...@@ -67,8 +69,8 @@ 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_ctor(&mmu->object, "nvifMem", 0, oclass, args, ret = nvif_object_ctor(&mmu->object, name ? name : "nvifMem", 0, oclass,
sizeof(*args) + argc, &mem->object); args, sizeof(*args) + argc, &mem->object);
if (ret == 0) { if (ret == 0) {
mem->type = mmu->type[type].type; mem->type = mmu->type[type].type;
mem->page = args->page; mem->page = args->page;
...@@ -83,8 +85,8 @@ nvif_mem_init_type(struct nvif_mmu *mmu, s32 oclass, int type, u8 page, ...@@ -83,8 +85,8 @@ nvif_mem_init_type(struct nvif_mmu *mmu, s32 oclass, int type, u8 page,
} }
int int
nvif_mem_init(struct nvif_mmu *mmu, s32 oclass, u8 type, u8 page, nvif_mem_ctor(struct nvif_mmu *mmu, const char *name, s32 oclass, u8 type,
u64 size, void *argv, u32 argc, struct nvif_mem *mem) u8 page, u64 size, void *argv, u32 argc, struct nvif_mem *mem)
{ {
int ret = -EINVAL, i; int ret = -EINVAL, i;
...@@ -92,8 +94,8 @@ nvif_mem_init(struct nvif_mmu *mmu, s32 oclass, u8 type, u8 page, ...@@ -92,8 +94,8 @@ nvif_mem_init(struct nvif_mmu *mmu, s32 oclass, u8 type, u8 page,
for (i = 0; ret && i < mmu->type_nr; i++) { for (i = 0; ret && i < mmu->type_nr; i++) {
if ((mmu->type[i].type & type) == type) { if ((mmu->type[i].type & type) == type) {
ret = nvif_mem_init_type(mmu, oclass, i, page, size, ret = nvif_mem_ctor_type(mmu, name, oclass, i, page,
argv, argc, mem); size, argv, argc, mem);
} }
} }
......
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