Commit 1d4dce28 authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau/disp: switch vblank semaphore release to nvkm_event_ntfy

Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
Reviewed-by: default avatarLyude Paul <lyude@redhat.com>
parent b418ff88
...@@ -61,8 +61,6 @@ struct nvif_notify_head_req_v0 { ...@@ -61,8 +61,6 @@ struct nvif_notify_head_req_v0 {
struct nvif_notify_head_rep_v0 { struct nvif_notify_head_rep_v0 {
/* nvif_notify_rep ... */ /* nvif_notify_rep ... */
__u8 version;
__u8 pad01[7];
}; };
struct nvif_notify_conn_req_v0 { struct nvif_notify_conn_req_v0 {
......
...@@ -16,6 +16,7 @@ struct nvkm_disp { ...@@ -16,6 +16,7 @@ struct nvkm_disp {
struct list_head conns; struct list_head conns;
struct nvkm_event hpd; struct nvkm_event hpd;
#define NVKM_DISP_HEAD_EVENT_VBLANK BIT(0)
struct nvkm_event vblank; struct nvkm_event vblank;
struct { struct {
......
...@@ -90,8 +90,7 @@ nvkm_disp_vblank_func = { ...@@ -90,8 +90,7 @@ nvkm_disp_vblank_func = {
void void
nvkm_disp_vblank(struct nvkm_disp *disp, int head) nvkm_disp_vblank(struct nvkm_disp *disp, int head)
{ {
struct nvif_notify_head_rep_v0 rep = {}; nvkm_event_send(&disp->vblank, NVKM_DISP_HEAD_EVENT_VBLANK, head, NULL, 0);
nvkm_event_send(&disp->vblank, 1, head, &rep, sizeof(rep));
} }
static int static int
......
...@@ -36,10 +36,10 @@ ...@@ -36,10 +36,10 @@
******************************************************************************/ ******************************************************************************/
static int 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 = 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_sw *sw = chan->base.sw;
struct nvkm_device *device = sw->engine.subdev.device; struct nvkm_device *device = sw->engine.subdev.device;
u32 inst = chan->base.fifo->inst->addr >> 12; u32 inst = chan->base.fifo->inst->addr >> 12;
...@@ -50,7 +50,7 @@ gf100_sw_chan_vblsem_release(struct nvkm_notify *notify) ...@@ -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, 0x060010, lower_32_bits(chan->vblank.offset));
nvkm_wr32(device, 0x060014, chan->vblank.value); nvkm_wr32(device, 0x060014, chan->vblank.value);
return NVKM_NOTIFY_DROP; return NVKM_EVENT_DROP;
} }
static bool static bool
...@@ -73,7 +73,7 @@ gf100_sw_chan_mthd(struct nvkm_sw_chan *base, int subc, u32 mthd, u32 data) ...@@ -73,7 +73,7 @@ gf100_sw_chan_mthd(struct nvkm_sw_chan *base, int subc, u32 mthd, u32 data)
return true; return true;
case 0x040c: case 0x040c:
if (data < device->disp->vblank.index_nr) { if (data < device->disp->vblank.index_nr) {
nvkm_notify_get(&chan->vblank.notify[data]); nvkm_event_ntfy_allow(&chan->vblank.notify[data]);
return true; return true;
} }
break; break;
...@@ -120,16 +120,8 @@ gf100_sw_chan_new(struct nvkm_sw *sw, struct nvkm_fifo_chan *fifoch, ...@@ -120,16 +120,8 @@ gf100_sw_chan_new(struct nvkm_sw *sw, struct nvkm_fifo_chan *fifoch,
return ret; return ret;
for (i = 0; disp && i < disp->vblank.index_nr; i++) { for (i = 0; disp && i < disp->vblank.index_nr; i++) {
ret = nvkm_notify_init(NULL, &disp->vblank, nvkm_event_ntfy_add(&disp->vblank, i, NVKM_DISP_HEAD_EVENT_VBLANK, true,
gf100_sw_chan_vblsem_release, false, gf100_sw_chan_vblsem_release, &chan->vblank.notify[i]);
&(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;
} }
return 0; return 0;
......
...@@ -36,10 +36,10 @@ ...@@ -36,10 +36,10 @@
******************************************************************************/ ******************************************************************************/
static int 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 = 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_sw *sw = chan->base.sw;
struct nvkm_device *device = sw->engine.subdev.device; struct nvkm_device *device = sw->engine.subdev.device;
...@@ -55,7 +55,7 @@ nv50_sw_chan_vblsem_release(struct nvkm_notify *notify) ...@@ -55,7 +55,7 @@ nv50_sw_chan_vblsem_release(struct nvkm_notify *notify)
nvkm_wr32(device, 0x060014, chan->vblank.value); nvkm_wr32(device, 0x060014, chan->vblank.value);
} }
return NVKM_NOTIFY_DROP; return NVKM_EVENT_DROP;
} }
static bool static bool
...@@ -70,7 +70,7 @@ nv50_sw_chan_mthd(struct nvkm_sw_chan *base, int subc, u32 mthd, u32 data) ...@@ -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 0x0404: chan->vblank.value = data; return true;
case 0x0408: case 0x0408:
if (data < device->disp->vblank.index_nr) { if (data < device->disp->vblank.index_nr) {
nvkm_notify_get(&chan->vblank.notify[data]); nvkm_event_ntfy_allow(&chan->vblank.notify[data]);
return true; return true;
} }
break; break;
...@@ -85,8 +85,10 @@ nv50_sw_chan_dtor(struct nvkm_sw_chan *base) ...@@ -85,8 +85,10 @@ nv50_sw_chan_dtor(struct nvkm_sw_chan *base)
{ {
struct nv50_sw_chan *chan = nv50_sw_chan(base); struct nv50_sw_chan *chan = nv50_sw_chan(base);
int i; int i;
for (i = 0; i < ARRAY_SIZE(chan->vblank.notify); 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; return chan;
} }
...@@ -113,16 +115,8 @@ nv50_sw_chan_new(struct nvkm_sw *sw, struct nvkm_fifo_chan *fifoch, ...@@ -113,16 +115,8 @@ nv50_sw_chan_new(struct nvkm_sw *sw, struct nvkm_fifo_chan *fifoch,
return ret; return ret;
for (i = 0; disp && i < disp->vblank.index_nr; i++) { for (i = 0; disp && i < disp->vblank.index_nr; i++) {
ret = nvkm_notify_init(NULL, &disp->vblank, nvkm_event_ntfy_add(&disp->vblank, i, NVKM_DISP_HEAD_EVENT_VBLANK, true,
nv50_sw_chan_vblsem_release, false, nv50_sw_chan_vblsem_release, &chan->vblank.notify[i]);
&(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;
} }
return 0; return 0;
......
...@@ -5,12 +5,12 @@ ...@@ -5,12 +5,12 @@
#include "priv.h" #include "priv.h"
#include "chan.h" #include "chan.h"
#include "nvsw.h" #include "nvsw.h"
#include <core/notify.h> #include <core/event.h>
struct nv50_sw_chan { struct nv50_sw_chan {
struct nvkm_sw_chan base; struct nvkm_sw_chan base;
struct { struct {
struct nvkm_notify notify[4]; struct nvkm_event_ntfy notify[4];
u32 ctxdma; u32 ctxdma;
u64 offset; u64 offset;
u32 value; u32 value;
......
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