[PATCH 04/21] drm/nouveau/nvif: add nvif_event_stat
Ben Skeggs
bskeggs at nvidia.com
Thu Jun 13 16:59:56 UTC 2024
Return an enum rather than an int from nvif_event callbacks.
Also moves the NVIF_EVENT_* definitions to driverif.h, with the
rest of the DRM<->NVKM interfaces.
Signed-off-by: Ben Skeggs <bskeggs at nvidia.com>
---
drivers/gpu/drm/nouveau/dispnv04/crtc.c | 4 ++--
drivers/gpu/drm/nouveau/dispnv04/disp.h | 2 +-
drivers/gpu/drm/nouveau/dispnv50/head.c | 2 +-
drivers/gpu/drm/nouveau/include/nvif/driverif.h | 5 +++++
drivers/gpu/drm/nouveau/include/nvif/event.h | 5 ++---
drivers/gpu/drm/nouveau/nouveau_chan.c | 2 +-
drivers/gpu/drm/nouveau/nouveau_connector.c | 4 ++--
drivers/gpu/drm/nouveau/nouveau_fence.c | 2 +-
drivers/gpu/drm/nouveau/nouveau_svm.c | 2 +-
9 files changed, 16 insertions(+), 12 deletions(-)
diff --git a/drivers/gpu/drm/nouveau/dispnv04/crtc.c b/drivers/gpu/drm/nouveau/dispnv04/crtc.c
index 225716d47c56..d7575ece9214 100644
--- a/drivers/gpu/drm/nouveau/dispnv04/crtc.c
+++ b/drivers/gpu/drm/nouveau/dispnv04/crtc.c
@@ -1072,7 +1072,7 @@ nv04_finish_page_flip(struct nouveau_channel *chan,
return 0;
}
-int
+enum nvif_event_stat
nv04_flip_complete(struct nvif_event *event, void *argv, u32 argc)
{
struct nv04_display *disp = container_of(event, typeof(*disp), flip);
@@ -1272,7 +1272,7 @@ static const struct drm_plane_funcs nv04_primary_plane_funcs = {
DRM_PLANE_NON_ATOMIC_FUNCS,
};
-static int
+static enum nvif_event_stat
nv04_crtc_vblank_handler(struct nvif_event *event, void *repv, u32 repc)
{
struct nouveau_crtc *nv_crtc = container_of(event, struct nouveau_crtc, vblank);
diff --git a/drivers/gpu/drm/nouveau/dispnv04/disp.h b/drivers/gpu/drm/nouveau/dispnv04/disp.h
index 8eba76ab880e..88df31b6ac6b 100644
--- a/drivers/gpu/drm/nouveau/dispnv04/disp.h
+++ b/drivers/gpu/drm/nouveau/dispnv04/disp.h
@@ -182,5 +182,5 @@ nouveau_bios_run_init_table(struct drm_device *dev, u16 table,
);
}
-int nv04_flip_complete(struct nvif_event *, void *, u32);
+enum nvif_event_stat nv04_flip_complete(struct nvif_event *, void *, u32);
#endif
diff --git a/drivers/gpu/drm/nouveau/dispnv50/head.c b/drivers/gpu/drm/nouveau/dispnv50/head.c
index 4ad117b01d69..fd7791540f6f 100644
--- a/drivers/gpu/drm/nouveau/dispnv50/head.c
+++ b/drivers/gpu/drm/nouveau/dispnv50/head.c
@@ -549,7 +549,7 @@ nvd9_head_func = {
.late_register = nv50_head_late_register,
};
-static int
+static enum nvif_event_stat
nv50_head_vblank_handler(struct nvif_event *event, void *repv, u32 repc)
{
struct nouveau_crtc *nv_crtc = container_of(event, struct nouveau_crtc, vblank);
diff --git a/drivers/gpu/drm/nouveau/include/nvif/driverif.h b/drivers/gpu/drm/nouveau/include/nvif/driverif.h
index 40f58a94c09a..0476dd6621b5 100644
--- a/drivers/gpu/drm/nouveau/include/nvif/driverif.h
+++ b/drivers/gpu/drm/nouveau/include/nvif/driverif.h
@@ -23,6 +23,11 @@ struct nvif_cgrp_priv;
struct nvif_chan_priv;
struct nvif_engobj_priv;
+enum nvif_event_stat {
+ NVIF_EVENT_KEEP,
+ NVIF_EVENT_DROP,
+};
+
struct nvif_event_impl {
void (*del)(struct nvif_event_priv *);
int (*allow)(struct nvif_event_priv *);
diff --git a/drivers/gpu/drm/nouveau/include/nvif/event.h b/drivers/gpu/drm/nouveau/include/nvif/event.h
index 42c2d0b5f66b..6c52de0e17d0 100644
--- a/drivers/gpu/drm/nouveau/include/nvif/event.h
+++ b/drivers/gpu/drm/nouveau/include/nvif/event.h
@@ -2,11 +2,10 @@
#ifndef __NVIF_EVENT_H__
#define __NVIF_EVENT_H__
#include <nvif/object.h>
+#include <nvif/driverif.h>
struct nvif_event;
-#define NVIF_EVENT_KEEP 0
-#define NVIF_EVENT_DROP 1
-typedef int (*nvif_event_func)(struct nvif_event *, void *repv, u32 repc);
+typedef enum nvif_event_stat (*nvif_event_func)(struct nvif_event *, void *repv, u32 repc);
struct nvif_event {
const struct nvif_event_impl *impl;
diff --git a/drivers/gpu/drm/nouveau/nouveau_chan.c b/drivers/gpu/drm/nouveau/nouveau_chan.c
index 3a17e30d6c49..6a2b7e21afbf 100644
--- a/drivers/gpu/drm/nouveau/nouveau_chan.c
+++ b/drivers/gpu/drm/nouveau/nouveau_chan.c
@@ -47,7 +47,7 @@ nouveau_channel_kill(struct nouveau_channel *chan)
nouveau_fence_context_kill(chan->fence, -ENODEV);
}
-static int
+static enum nvif_event_stat
nouveau_channel_killed(struct nvif_event *event, void *repv, u32 repc)
{
struct nouveau_channel *chan = container_of(event, typeof(*chan), kill);
diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c
index 7d9cba7bcb8f..e3071ea845e6 100644
--- a/drivers/gpu/drm/nouveau/nouveau_connector.c
+++ b/drivers/gpu/drm/nouveau/nouveau_connector.c
@@ -1199,7 +1199,7 @@ nouveau_connector_hpd(struct nouveau_connector *nv_connector, u64 bits)
spin_unlock_irqrestore(&drm->hpd_lock, flags);
}
-static int
+static enum nvif_event_stat
nouveau_connector_irq(struct nvif_event *event, void *repv, u32 repc)
{
struct nouveau_connector *nv_connector = container_of(event, typeof(*nv_connector), irq);
@@ -1208,7 +1208,7 @@ nouveau_connector_irq(struct nvif_event *event, void *repv, u32 repc)
return NVIF_EVENT_KEEP;
}
-static int
+static enum nvif_event_stat
nouveau_connector_hotplug(struct nvif_event *event, void *repv, u32 repc)
{
struct nouveau_connector *nv_connector = container_of(event, typeof(*nv_connector), hpd);
diff --git a/drivers/gpu/drm/nouveau/nouveau_fence.c b/drivers/gpu/drm/nouveau/nouveau_fence.c
index 9443cbaa8cff..2b6b60ec10fa 100644
--- a/drivers/gpu/drm/nouveau/nouveau_fence.c
+++ b/drivers/gpu/drm/nouveau/nouveau_fence.c
@@ -168,7 +168,7 @@ nouveau_fence_uevent_work(struct work_struct *work)
spin_unlock_irqrestore(&fctx->lock, flags);
}
-static int
+static enum nvif_event_stat
nouveau_fence_wait_uevent_handler(struct nvif_event *event, void *repv, u32 repc)
{
struct nouveau_fence_chan *fctx = container_of(event, typeof(*fctx), event);
diff --git a/drivers/gpu/drm/nouveau/nouveau_svm.c b/drivers/gpu/drm/nouveau/nouveau_svm.c
index 5b94f6e3a39d..b8a3c3d2d3aa 100644
--- a/drivers/gpu/drm/nouveau/nouveau_svm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_svm.c
@@ -870,7 +870,7 @@ nouveau_svm_fault(struct work_struct *work)
nouveau_svm_fault_replay(svm);
}
-static int
+static enum nvif_event_stat
nouveau_svm_event(struct nvif_event *event, void *argv, u32 argc)
{
struct nouveau_svm_fault_buffer *buffer = container_of(event, typeof(*buffer), notify);
--
2.44.0
More information about the dri-devel
mailing list