Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 29c0ca73 authored by Ben Skeggs's avatar Ben Skeggs
Browse files

drm/nouveau/disp/nv50-: fetch head/OR state at beginning of supervisor



This data will be used by essentially every part of the supervisor
handling process.

Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent 3607bfd3
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -21,8 +21,27 @@
 */
#include "ior.h"

static void
gf119_dac_state(struct nvkm_ior *dac, struct nvkm_ior_state *state)
{
	struct nvkm_device *device = dac->disp->engine.subdev.device;
	const u32 coff = (state == &dac->asy) * 0x20000 + dac->id * 0x20;
	u32 ctrl = nvkm_rd32(device, 0x640180 + coff);

	state->proto_evo = (ctrl & 0x00000f00) >> 8;
	switch (state->proto_evo) {
	case 0: state->proto = CRT; break;
	default:
		state->proto = UNKNOWN;
		break;
	}

	state->head = ctrl & 0x0000000f;
}

static const struct nvkm_ior_func
gf119_dac = {
	.state = gf119_dac_state,
};

int
+19 −0
Original line number Diff line number Diff line
@@ -126,8 +126,27 @@ nv50_dac_power(NV50_DISP_MTHD_V1)
	return 0;
}

static void
nv50_dac_state(struct nvkm_ior *dac, struct nvkm_ior_state *state)
{
	struct nvkm_device *device = dac->disp->engine.subdev.device;
	const u32 coff = dac->id * 8 + (state == &dac->arm) * 4;
	u32 ctrl = nvkm_rd32(device, 0x610b58 + coff);

	state->proto_evo = (ctrl & 0x00000f00) >> 8;
	switch (state->proto_evo) {
	case 0: state->proto = CRT; break;
	default:
		state->proto = UNKNOWN;
		break;
	}

	state->head = ctrl & 0x00000003;
}

static const struct nvkm_ior_func
nv50_dac = {
	.state = nv50_dac_state,
};

int
+1 −0
Original line number Diff line number Diff line
@@ -362,6 +362,7 @@ gf119_disp_super(struct work_struct *work)

	if (disp->super & 0x00000001) {
		nv50_disp_chan_mthd(disp->chan[0], NV_DBG_DEBUG);
		nv50_disp_super_1(disp);
		list_for_each_entry(head, &disp->base.head, head) {
			if (!(mask[head->id] & 0x00001000))
				continue;
+9 −0
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@ struct nvkm_ior {
	struct list_head head;

	struct nvkm_ior_state {
		unsigned rgdiv;
		unsigned proto_evo:4;
		enum nvkm_ior_proto {
			CRT,
			TMDS,
@@ -23,6 +25,8 @@ struct nvkm_ior {
			DP,
			UNKNOWN
		} proto:3;
		unsigned link:2;
		unsigned head:4;
	} arm, asy;

	/* Armed DP state. */
@@ -35,6 +39,7 @@ struct nvkm_ior {
};

struct nvkm_ior_func {
	void (*state)(struct nvkm_ior *, struct nvkm_ior_state *);
};

int nvkm_ior_new_(const struct nvkm_ior_func *func, struct nvkm_disp *,
@@ -42,6 +47,10 @@ int nvkm_ior_new_(const struct nvkm_ior_func *func, struct nvkm_disp *,
void nvkm_ior_del(struct nvkm_ior **);
struct nvkm_ior *nvkm_ior_find(struct nvkm_disp *, enum nvkm_ior_type, int id);

void nv50_sor_state(struct nvkm_ior *, struct nvkm_ior_state *);
void g94_sor_state(struct nvkm_ior *, struct nvkm_ior_state *);
void gf119_sor_state(struct nvkm_ior *, struct nvkm_ior_state *);

#define IOR_MSG(i,l,f,a...) do {                                               \
	struct nvkm_ior *_ior = (i);                                           \
	nvkm_##l(&_ior->disp->engine.subdev, "%s: "f, _ior->name, ##a);        \
+18 −0
Original line number Diff line number Diff line
@@ -678,6 +678,23 @@ nv50_disp_intr_unk10_0(struct nv50_disp *disp, int head)
	exec_script(disp, head, 1);
}

void
nv50_disp_super_1(struct nv50_disp *disp)
{
	struct nvkm_head *head;
	struct nvkm_ior *ior;

	list_for_each_entry(head, &disp->base.head, head) {
		head->func->state(head, &head->arm);
		head->func->state(head, &head->asy);
	}

	list_for_each_entry(ior, &disp->base.ior, head) {
		ior->func->state(ior, &ior->arm);
		ior->func->state(ior, &ior->asy);
	}
}

void
nv50_disp_super(struct work_struct *work)
{
@@ -692,6 +709,7 @@ nv50_disp_super(struct work_struct *work)

	if (disp->super & 0x00000010) {
		nv50_disp_chan_mthd(disp->chan[0], NV_DBG_DEBUG);
		nv50_disp_super_1(disp);
		list_for_each_entry(head, &disp->base.head, head) {
			if (!(super & (0x00000020 << head->id)))
				continue;
Loading