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

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
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -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 {
+1 −0
Original line number Diff line number Diff line
@@ -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 {
+1 −2
Original line number Diff line number Diff line
@@ -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
+6 −14
Original line number Diff line number Diff line
@@ -36,10 +36,10 @@
 ******************************************************************************/

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;
+9 −15
Original line number Diff line number Diff line
@@ -36,10 +36,10 @@
 ******************************************************************************/

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;
Loading