Commit f7a7d22a authored by Ben Skeggs's avatar Ben Skeggs

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

Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
Reviewed-by: default avatarLyude Paul <lyude@redhat.com>
parent 54d44bfc
...@@ -759,7 +759,7 @@ static void nv_crtc_destroy(struct drm_crtc *crtc) ...@@ -759,7 +759,7 @@ static void nv_crtc_destroy(struct drm_crtc *crtc)
nouveau_bo_unmap(nv_crtc->cursor.nvbo); nouveau_bo_unmap(nv_crtc->cursor.nvbo);
nouveau_bo_unpin(nv_crtc->cursor.nvbo); nouveau_bo_unpin(nv_crtc->cursor.nvbo);
nouveau_bo_ref(NULL, &nv_crtc->cursor.nvbo); nouveau_bo_ref(NULL, &nv_crtc->cursor.nvbo);
nvif_notify_fini(&nv_crtc->vblank); nvif_notify_dtor(&nv_crtc->vblank);
kfree(nv_crtc); kfree(nv_crtc);
} }
...@@ -1351,7 +1351,7 @@ nv04_crtc_create(struct drm_device *dev, int crtc_num) ...@@ -1351,7 +1351,7 @@ nv04_crtc_create(struct drm_device *dev, int crtc_num)
nv04_cursor_init(nv_crtc); nv04_cursor_init(nv_crtc);
ret = nvif_notify_init(&disp->disp.object, nv04_crtc_vblank_handler, ret = nvif_notify_ctor(&disp->disp.object, "kmsVbl", nv04_crtc_vblank_handler,
false, NV04_DISP_NTFY_VBLANK, false, NV04_DISP_NTFY_VBLANK,
&(struct nvif_notify_head_req_v0) { &(struct nvif_notify_head_req_v0) {
.head = nv_crtc->index, .head = nv_crtc->index,
......
...@@ -178,7 +178,7 @@ nv04_display_destroy(struct drm_device *dev) ...@@ -178,7 +178,7 @@ nv04_display_destroy(struct drm_device *dev)
nouveau_hw_save_vga_fonts(dev, 0); nouveau_hw_save_vga_fonts(dev, 0);
nvif_notify_fini(&disp->flip); nvif_notify_dtor(&disp->flip);
nouveau_display(dev)->priv = NULL; nouveau_display(dev)->priv = NULL;
kfree(disp); kfree(disp);
...@@ -215,7 +215,7 @@ nv04_display_create(struct drm_device *dev) ...@@ -215,7 +215,7 @@ nv04_display_create(struct drm_device *dev)
/* Request page flip completion event. */ /* Request page flip completion event. */
if (drm->nvsw.client) { if (drm->nvsw.client) {
nvif_notify_init(&drm->nvsw, nv04_flip_complete, nvif_notify_ctor(&drm->nvsw, "kmsFlip", nv04_flip_complete,
false, NV04_NVSW_NTFY_UEVENT, false, NV04_NVSW_NTFY_UEVENT,
NULL, 0, 0, &disp->flip); NULL, 0, 0, &disp->flip);
} }
......
...@@ -282,8 +282,9 @@ base507c_new_(const struct nv50_wndw_func *func, const u32 *format, ...@@ -282,8 +282,9 @@ base507c_new_(const struct nv50_wndw_func *func, const u32 *format,
return ret; return ret;
} }
ret = nvif_notify_init(&wndw->wndw.base.user, wndw->notify.func, ret = nvif_notify_ctor(&wndw->wndw.base.user, "kmsBaseNtfy",
false, NV50_DISP_BASE_CHANNEL_DMA_V0_NTFY_UEVENT, wndw->notify.func, false,
NV50_DISP_BASE_CHANNEL_DMA_V0_NTFY_UEVENT,
&(struct nvif_notify_uevent_req) {}, &(struct nvif_notify_uevent_req) {},
sizeof(struct nvif_notify_uevent_req), sizeof(struct nvif_notify_uevent_req),
sizeof(struct nvif_notify_uevent_rep), sizeof(struct nvif_notify_uevent_rep),
......
...@@ -489,7 +489,7 @@ nv50_head_destroy(struct drm_crtc *crtc) ...@@ -489,7 +489,7 @@ nv50_head_destroy(struct drm_crtc *crtc)
{ {
struct nv50_head *head = nv50_head(crtc); struct nv50_head *head = nv50_head(crtc);
nvif_notify_fini(&head->base.vblank); nvif_notify_dtor(&head->base.vblank);
nv50_lut_fini(&head->olut); nv50_lut_fini(&head->olut);
drm_crtc_cleanup(crtc); drm_crtc_cleanup(crtc);
kfree(head); kfree(head);
...@@ -598,7 +598,7 @@ nv50_head_create(struct drm_device *dev, int index) ...@@ -598,7 +598,7 @@ nv50_head_create(struct drm_device *dev, int index)
} }
} }
ret = nvif_notify_init(&disp->disp->object, nv50_head_vblank_handler, ret = nvif_notify_ctor(&disp->disp->object, "kmsVbl", nv50_head_vblank_handler,
false, NV04_DISP_NTFY_VBLANK, false, NV04_DISP_NTFY_VBLANK,
&(struct nvif_notify_head_req_v0) { &(struct nvif_notify_head_req_v0) {
.head = nv_crtc->index, .head = nv_crtc->index,
......
...@@ -192,7 +192,8 @@ ovly507e_new_(const struct nv50_wndw_func *func, const u32 *format, ...@@ -192,7 +192,8 @@ ovly507e_new_(const struct nv50_wndw_func *func, const u32 *format,
return ret; return ret;
} }
ret = nvif_notify_init(&wndw->wndw.base.user, wndw->notify.func, false, ret = nvif_notify_ctor(&wndw->wndw.base.user, "kmsOvlyNtfy",
wndw->notify.func, false,
NV50_DISP_OVERLAY_CHANNEL_DMA_V0_NTFY_UEVENT, NV50_DISP_OVERLAY_CHANNEL_DMA_V0_NTFY_UEVENT,
&(struct nvif_notify_uevent_req) {}, &(struct nvif_notify_uevent_req) {},
sizeof(struct nvif_notify_uevent_req), sizeof(struct nvif_notify_uevent_req),
......
...@@ -609,7 +609,7 @@ nv50_wndw_destroy(struct drm_plane *plane) ...@@ -609,7 +609,7 @@ nv50_wndw_destroy(struct drm_plane *plane)
nv50_wndw_ctxdma_del(ctxdma); nv50_wndw_ctxdma_del(ctxdma);
} }
nvif_notify_fini(&wndw->notify); nvif_notify_dtor(&wndw->notify);
nv50_dmac_destroy(&wndw->wimm); nv50_dmac_destroy(&wndw->wimm);
nv50_dmac_destroy(&wndw->wndw); nv50_dmac_destroy(&wndw->wndw);
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
struct nvif_notify { struct nvif_notify {
struct nvif_object *object; struct nvif_object *object;
const char *name;
int index; int index;
#define NVIF_NOTIFY_USER 0 #define NVIF_NOTIFY_USER 0
...@@ -24,10 +25,10 @@ struct nvif_notify { ...@@ -24,10 +25,10 @@ struct nvif_notify {
struct work_struct work; struct work_struct work;
}; };
int nvif_notify_init(struct nvif_object *, int (*func)(struct nvif_notify *), int nvif_notify_ctor(struct nvif_object *, const char *name,
bool work, u8 type, void *data, u32 size, u32 reply, int (*func)(struct nvif_notify *), bool work, u8 type,
struct nvif_notify *); void *data, u32 size, u32 reply, struct nvif_notify *);
int nvif_notify_fini(struct nvif_notify *); int nvif_notify_dtor(struct nvif_notify *);
int nvif_notify_get(struct nvif_notify *); int nvif_notify_get(struct nvif_notify *);
int nvif_notify_put(struct nvif_notify *); int nvif_notify_put(struct nvif_notify *);
int nvif_notify(const void *, u32, const void *, u32); int nvif_notify(const void *, u32, const void *, u32);
......
...@@ -105,7 +105,7 @@ nouveau_channel_del(struct nouveau_channel **pchan) ...@@ -105,7 +105,7 @@ nouveau_channel_del(struct nouveau_channel **pchan)
nvif_object_dtor(&chan->nvsw); nvif_object_dtor(&chan->nvsw);
nvif_object_dtor(&chan->gart); nvif_object_dtor(&chan->gart);
nvif_object_dtor(&chan->vram); nvif_object_dtor(&chan->vram);
nvif_notify_fini(&chan->kill); nvif_notify_dtor(&chan->kill);
nvif_object_dtor(&chan->user); nvif_object_dtor(&chan->user);
nvif_object_dtor(&chan->push.ctxdma); nvif_object_dtor(&chan->push.ctxdma);
nouveau_vma_del(&chan->push.vma); nouveau_vma_del(&chan->push.vma);
...@@ -366,7 +366,8 @@ nouveau_channel_init(struct nouveau_channel *chan, u32 vram, u32 gart) ...@@ -366,7 +366,8 @@ nouveau_channel_init(struct nouveau_channel *chan, u32 vram, u32 gart)
nvif_object_map(&chan->user, NULL, 0); nvif_object_map(&chan->user, NULL, 0);
if (chan->user.oclass >= FERMI_CHANNEL_GPFIFO) { if (chan->user.oclass >= FERMI_CHANNEL_GPFIFO) {
ret = nvif_notify_init(&chan->user, nouveau_channel_killed, ret = nvif_notify_ctor(&chan->user, "abi16ChanKilled",
nouveau_channel_killed,
true, NV906F_V0_NTFY_KILLED, true, NV906F_V0_NTFY_KILLED,
NULL, 0, 0, &chan->kill); NULL, 0, 0, &chan->kill);
if (ret == 0) if (ret == 0)
......
...@@ -409,7 +409,7 @@ static void ...@@ -409,7 +409,7 @@ static void
nouveau_connector_destroy(struct drm_connector *connector) nouveau_connector_destroy(struct drm_connector *connector)
{ {
struct nouveau_connector *nv_connector = nouveau_connector(connector); struct nouveau_connector *nv_connector = nouveau_connector(connector);
nvif_notify_fini(&nv_connector->hpd); nvif_notify_dtor(&nv_connector->hpd);
kfree(nv_connector->edid); kfree(nv_connector->edid);
drm_connector_unregister(connector); drm_connector_unregister(connector);
drm_connector_cleanup(connector); drm_connector_cleanup(connector);
...@@ -1450,7 +1450,8 @@ nouveau_connector_create(struct drm_device *dev, ...@@ -1450,7 +1450,8 @@ nouveau_connector_create(struct drm_device *dev,
break; break;
} }
ret = nvif_notify_init(&disp->disp.object, nouveau_connector_hotplug, ret = nvif_notify_ctor(&disp->disp.object, "kmsHotplug",
nouveau_connector_hotplug,
true, NV04_DISP_NTFY_CONN, true, NV04_DISP_NTFY_CONN,
&(struct nvif_notify_conn_req_v0) { &(struct nvif_notify_conn_req_v0) {
.mask = NVIF_NOTIFY_CONN_V0_ANY, .mask = NVIF_NOTIFY_CONN_V0_ANY,
......
...@@ -108,7 +108,7 @@ void ...@@ -108,7 +108,7 @@ void
nouveau_fence_context_del(struct nouveau_fence_chan *fctx) nouveau_fence_context_del(struct nouveau_fence_chan *fctx)
{ {
nouveau_fence_context_kill(fctx, 0); nouveau_fence_context_kill(fctx, 0);
nvif_notify_fini(&fctx->notify); nvif_notify_dtor(&fctx->notify);
fctx->dead = 1; fctx->dead = 1;
/* /*
...@@ -195,7 +195,8 @@ nouveau_fence_context_new(struct nouveau_channel *chan, struct nouveau_fence_cha ...@@ -195,7 +195,8 @@ nouveau_fence_context_new(struct nouveau_channel *chan, struct nouveau_fence_cha
if (!priv->uevent) if (!priv->uevent)
return; return;
ret = nvif_notify_init(&chan->user, nouveau_fence_wait_uevent_handler, ret = nvif_notify_ctor(&chan->user, "fenceNonStallIntr",
nouveau_fence_wait_uevent_handler,
false, NV826E_V0_NTFY_NON_STALL_INTERRUPT, false, NV826E_V0_NTFY_NON_STALL_INTERRUPT,
&(struct nvif_notify_uevent_req) { }, &(struct nvif_notify_uevent_req) { },
sizeof(struct nvif_notify_uevent_req), sizeof(struct nvif_notify_uevent_req),
......
...@@ -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_dtor(&buffer->notify);
nvif_object_dtor(&buffer->object); nvif_object_dtor(&buffer->object);
} }
...@@ -932,8 +932,8 @@ nouveau_svm_fault_buffer_ctor(struct nouveau_svm *svm, s32 oclass, int id) ...@@ -932,8 +932,8 @@ nouveau_svm_fault_buffer_ctor(struct nouveau_svm *svm, s32 oclass, int id)
buffer->getaddr = args.get; buffer->getaddr = args.get;
buffer->putaddr = args.put; buffer->putaddr = args.put;
ret = nvif_notify_init(&buffer->object, nouveau_svm_fault, true, ret = nvif_notify_ctor(&buffer->object, "svmFault", nouveau_svm_fault,
NVB069_V0_NTFY_FAULT, NULL, 0, 0, true, NVB069_V0_NTFY_FAULT, NULL, 0, 0,
&buffer->notify); &buffer->notify);
if (ret) if (ret)
return ret; return ret;
......
...@@ -142,7 +142,7 @@ nvif_notify(const void *header, u32 length, const void *data, u32 size) ...@@ -142,7 +142,7 @@ nvif_notify(const void *header, u32 length, const void *data, u32 size)
} }
int int
nvif_notify_fini(struct nvif_notify *notify) nvif_notify_dtor(struct nvif_notify *notify)
{ {
struct nvif_object *object = notify->object; struct nvif_object *object = notify->object;
struct { struct {
...@@ -162,9 +162,9 @@ nvif_notify_fini(struct nvif_notify *notify) ...@@ -162,9 +162,9 @@ nvif_notify_fini(struct nvif_notify *notify)
} }
int int
nvif_notify_init(struct nvif_object *object, int (*func)(struct nvif_notify *), nvif_notify_ctor(struct nvif_object *object, const char *name,
bool work, u8 event, void *data, u32 size, u32 reply, int (*func)(struct nvif_notify *), bool work, u8 event,
struct nvif_notify *notify) void *data, u32 size, u32 reply, struct nvif_notify *notify)
{ {
struct { struct {
struct nvif_ioctl_v0 ioctl; struct nvif_ioctl_v0 ioctl;
...@@ -174,6 +174,7 @@ nvif_notify_init(struct nvif_object *object, int (*func)(struct nvif_notify *), ...@@ -174,6 +174,7 @@ nvif_notify_init(struct nvif_object *object, int (*func)(struct nvif_notify *),
int ret = -ENOMEM; int ret = -ENOMEM;
notify->object = object; notify->object = object;
notify->name = name ? name : "nvifNotify";
notify->flags = 0; notify->flags = 0;
atomic_set(&notify->putcnt, 1); atomic_set(&notify->putcnt, 1);
notify->func = func; notify->func = func;
...@@ -204,6 +205,6 @@ nvif_notify_init(struct nvif_object *object, int (*func)(struct nvif_notify *), ...@@ -204,6 +205,6 @@ nvif_notify_init(struct nvif_object *object, int (*func)(struct nvif_notify *),
kfree(args); kfree(args);
done: done:
if (ret) if (ret)
nvif_notify_fini(notify); nvif_notify_dtor(notify);
return ret; return ret;
} }
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