OSDN Git Service

drm/nouveau/disp: switch vblank semaphore release to nvkm_event_ntfy
authorBen Skeggs <bskeggs@redhat.com>
Wed, 1 Jun 2022 10:46:37 +0000 (20:46 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Wed, 9 Nov 2022 00:44:27 +0000 (10:44 +1000)
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
drivers/gpu/drm/nouveau/include/nvif/event.h
drivers/gpu/drm/nouveau/include/nvkm/engine/disp.h
drivers/gpu/drm/nouveau/nvkm/engine/disp/base.c
drivers/gpu/drm/nouveau/nvkm/engine/sw/gf100.c
drivers/gpu/drm/nouveau/nvkm/engine/sw/nv50.c
drivers/gpu/drm/nouveau/nvkm/engine/sw/nv50.h

index a510ba4..7521196 100644 (file)
@@ -61,8 +61,6 @@ struct nvif_notify_head_req_v0 {
 
 struct nvif_notify_head_rep_v0 {
        /* nvif_notify_rep ... */
-       __u8  version;
-       __u8  pad01[7];
 };
 
 struct nvif_notify_conn_req_v0 {
index eaf10f5..ad9aef2 100644 (file)
@@ -16,6 +16,7 @@ struct nvkm_disp {
        struct list_head conns;
 
        struct nvkm_event hpd;
+#define NVKM_DISP_HEAD_EVENT_VBLANK BIT(0)
        struct nvkm_event vblank;
 
        struct {
index 55c97dc..7d28613 100644 (file)
@@ -90,8 +90,7 @@ nvkm_disp_vblank_func = {
 void
 nvkm_disp_vblank(struct nvkm_disp *disp, int head)
 {
-       struct nvif_notify_head_rep_v0 rep = {};
-       nvkm_event_send(&disp->vblank, 1, head, &rep, sizeof(rep));
+       nvkm_event_send(&disp->vblank, NVKM_DISP_HEAD_EVENT_VBLANK, head, NULL, 0);
 }
 
 static int
index 55abf83..c3cf6f2 100644 (file)
  ******************************************************************************/
 
 static int
-gf100_sw_chan_vblsem_release(struct nvkm_notify *notify)
+gf100_sw_chan_vblsem_release(struct nvkm_event_ntfy *notify, u32 bits)
 {
        struct nv50_sw_chan *chan =
-               container_of(notify, typeof(*chan), vblank.notify[notify->index]);
+               container_of(notify, typeof(*chan), vblank.notify[notify->id]);
        struct nvkm_sw *sw = chan->base.sw;
        struct nvkm_device *device = sw->engine.subdev.device;
        u32 inst = chan->base.fifo->inst->addr >> 12;
@@ -50,7 +50,7 @@ gf100_sw_chan_vblsem_release(struct nvkm_notify *notify)
        nvkm_wr32(device, 0x060010, lower_32_bits(chan->vblank.offset));
        nvkm_wr32(device, 0x060014, chan->vblank.value);
 
-       return NVKM_NOTIFY_DROP;
+       return NVKM_EVENT_DROP;
 }
 
 static bool
@@ -73,7 +73,7 @@ gf100_sw_chan_mthd(struct nvkm_sw_chan *base, int subc, u32 mthd, u32 data)
                return true;
        case 0x040c:
                if (data < device->disp->vblank.index_nr) {
-                       nvkm_notify_get(&chan->vblank.notify[data]);
+                       nvkm_event_ntfy_allow(&chan->vblank.notify[data]);
                        return true;
                }
                break;
@@ -120,16 +120,8 @@ gf100_sw_chan_new(struct nvkm_sw *sw, struct nvkm_fifo_chan *fifoch,
                return ret;
 
        for (i = 0; disp && i < disp->vblank.index_nr; i++) {
-               ret = nvkm_notify_init(NULL, &disp->vblank,
-                                      gf100_sw_chan_vblsem_release, false,
-                                      &(struct nvif_notify_head_req_v0) {
-                                       .head = i,
-                                      },
-                                      sizeof(struct nvif_notify_head_req_v0),
-                                      sizeof(struct nvif_notify_head_rep_v0),
-                                      &chan->vblank.notify[i]);
-               if (ret)
-                       return ret;
+               nvkm_event_ntfy_add(&disp->vblank, i, NVKM_DISP_HEAD_EVENT_VBLANK, true,
+                                   gf100_sw_chan_vblsem_release, &chan->vblank.notify[i]);
        }
 
        return 0;
index 1fdd094..9d7a9b7 100644 (file)
  ******************************************************************************/
 
 static int
-nv50_sw_chan_vblsem_release(struct nvkm_notify *notify)
+nv50_sw_chan_vblsem_release(struct nvkm_event_ntfy *notify, u32 bits)
 {
        struct nv50_sw_chan *chan =
-               container_of(notify, typeof(*chan), vblank.notify[notify->index]);
+               container_of(notify, typeof(*chan), vblank.notify[notify->id]);
        struct nvkm_sw *sw = chan->base.sw;
        struct nvkm_device *device = sw->engine.subdev.device;
 
@@ -55,7 +55,7 @@ nv50_sw_chan_vblsem_release(struct nvkm_notify *notify)
                nvkm_wr32(device, 0x060014, chan->vblank.value);
        }
 
-       return NVKM_NOTIFY_DROP;
+       return NVKM_EVENT_DROP;
 }
 
 static bool
@@ -70,7 +70,7 @@ nv50_sw_chan_mthd(struct nvkm_sw_chan *base, int subc, u32 mthd, u32 data)
        case 0x0404: chan->vblank.value  = data; return true;
        case 0x0408:
                if (data < device->disp->vblank.index_nr) {
-                       nvkm_notify_get(&chan->vblank.notify[data]);
+                       nvkm_event_ntfy_allow(&chan->vblank.notify[data]);
                        return true;
                }
                break;
@@ -85,8 +85,10 @@ nv50_sw_chan_dtor(struct nvkm_sw_chan *base)
 {
        struct nv50_sw_chan *chan = nv50_sw_chan(base);
        int i;
+
        for (i = 0; i < ARRAY_SIZE(chan->vblank.notify); i++)
-               nvkm_notify_fini(&chan->vblank.notify[i]);
+               nvkm_event_ntfy_del(&chan->vblank.notify[i]);
+
        return chan;
 }
 
@@ -113,16 +115,8 @@ nv50_sw_chan_new(struct nvkm_sw *sw, struct nvkm_fifo_chan *fifoch,
                return ret;
 
        for (i = 0; disp && i < disp->vblank.index_nr; i++) {
-               ret = nvkm_notify_init(NULL, &disp->vblank,
-                                      nv50_sw_chan_vblsem_release, false,
-                                      &(struct nvif_notify_head_req_v0) {
-                                       .head = i,
-                                      },
-                                      sizeof(struct nvif_notify_head_req_v0),
-                                      sizeof(struct nvif_notify_head_rep_v0),
-                                      &chan->vblank.notify[i]);
-               if (ret)
-                       return ret;
+               nvkm_event_ntfy_add(&disp->vblank, i, NVKM_DISP_HEAD_EVENT_VBLANK, true,
+                                   nv50_sw_chan_vblsem_release, &chan->vblank.notify[i]);
        }
 
        return 0;
index 6d364d7..b42289c 100644 (file)
@@ -5,12 +5,12 @@
 #include "priv.h"
 #include "chan.h"
 #include "nvsw.h"
-#include <core/notify.h>
+#include <core/event.h>
 
 struct nv50_sw_chan {
        struct nvkm_sw_chan base;
        struct {
-               struct nvkm_notify notify[4];
+               struct nvkm_event_ntfy notify[4];
                u32 ctxdma;
                u64 offset;
                u32 value;