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

Commit a1c93078 authored by Ben Skeggs's avatar Ben Skeggs
Browse files

drm/nouveau/disp: introduce object to track per-head functions/state



Primarily intended as a way to pass per-head state around during
supervisor handling, and share logic between NV50/GF119.

Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent 4b2b42f8
Loading
Loading
Loading
Loading
+1 −4
Original line number Original line Diff line number Diff line
@@ -8,10 +8,7 @@ struct nvkm_disp {
	const struct nvkm_disp_func *func;
	const struct nvkm_disp_func *func;
	struct nvkm_engine engine;
	struct nvkm_engine engine;


	struct {
	struct list_head head;
		int nr;
	} head;

	struct list_head outp;
	struct list_head outp;
	struct list_head conn;
	struct list_head conn;


+5 −0
Original line number Original line Diff line number Diff line
@@ -14,6 +14,11 @@ nvkm-y += nvkm/engine/disp/gp100.o
nvkm-y += nvkm/engine/disp/gp102.o
nvkm-y += nvkm/engine/disp/gp102.o
nvkm-y += nvkm/engine/disp/vga.o
nvkm-y += nvkm/engine/disp/vga.o


nvkm-y += nvkm/engine/disp/head.o
nvkm-y += nvkm/engine/disp/headnv04.o
nvkm-y += nvkm/engine/disp/headnv50.o
nvkm-y += nvkm/engine/disp/headgf119.o

nvkm-y += nvkm/engine/disp/dacnv50.o
nvkm-y += nvkm/engine/disp/dacnv50.o
nvkm-y += nvkm/engine/disp/piornv50.o
nvkm-y += nvkm/engine/disp/piornv50.o
nvkm-y += nvkm/engine/disp/sornv50.o
nvkm-y += nvkm/engine/disp/sornv50.o
+17 −6
Original line number Original line Diff line number Diff line
@@ -23,6 +23,7 @@
 */
 */
#include "priv.h"
#include "priv.h"
#include "conn.h"
#include "conn.h"
#include "head.h"
#include "outp.h"
#include "outp.h"


#include <core/client.h>
#include <core/client.h>
@@ -249,6 +250,7 @@ nvkm_disp_oneinit(struct nvkm_engine *engine)
	struct nvkm_bios *bios = disp->engine.subdev.device->bios;
	struct nvkm_bios *bios = disp->engine.subdev.device->bios;
	struct nvkm_outp *outp, *outt, *pair;
	struct nvkm_outp *outp, *outt, *pair;
	struct nvkm_conn *conn;
	struct nvkm_conn *conn;
	struct nvkm_head *head;
	struct nvbios_connE connE;
	struct nvbios_connE connE;
	struct dcb_output dcbE;
	struct dcb_output dcbE;
	u8  hpd = 0, ver, hdr;
	u8  hpd = 0, ver, hdr;
@@ -375,8 +377,11 @@ nvkm_disp_oneinit(struct nvkm_engine *engine)
	if (ret)
	if (ret)
		return ret;
		return ret;


	return nvkm_event_init(&nvkm_disp_vblank_func, 1,
	i = 0;
			       disp->head.nr, &disp->vblank);
	list_for_each_entry(head, &disp->head, head)
		i = max(i, head->id + 1);

	return nvkm_event_init(&nvkm_disp_vblank_func, 1, i, &disp->vblank);
}
}


static void *
static void *
@@ -405,6 +410,12 @@ nvkm_disp_dtor(struct nvkm_engine *engine)
		nvkm_outp_del(&outp);
		nvkm_outp_del(&outp);
	}
	}


	while (!list_empty(&disp->head)) {
		struct nvkm_head *head =
			list_first_entry(&disp->head, typeof(*head), head);
		nvkm_head_del(&head);
	}

	return data;
	return data;
}
}


@@ -420,10 +431,10 @@ nvkm_disp = {


int
int
nvkm_disp_ctor(const struct nvkm_disp_func *func, struct nvkm_device *device,
nvkm_disp_ctor(const struct nvkm_disp_func *func, struct nvkm_device *device,
	       int index, int heads, struct nvkm_disp *disp)
	       int index, struct nvkm_disp *disp)
{
{
	disp->func = func;
	disp->func = func;
	disp->head.nr = heads;
	INIT_LIST_HEAD(&disp->head);
	INIT_LIST_HEAD(&disp->outp);
	INIT_LIST_HEAD(&disp->outp);
	INIT_LIST_HEAD(&disp->conn);
	INIT_LIST_HEAD(&disp->conn);
	return nvkm_engine_ctor(&nvkm_disp, device, index, true, &disp->engine);
	return nvkm_engine_ctor(&nvkm_disp, device, index, true, &disp->engine);
@@ -431,9 +442,9 @@ nvkm_disp_ctor(const struct nvkm_disp_func *func, struct nvkm_device *device,


int
int
nvkm_disp_new_(const struct nvkm_disp_func *func, struct nvkm_device *device,
nvkm_disp_new_(const struct nvkm_disp_func *func, struct nvkm_device *device,
	       int index, int heads, struct nvkm_disp **pdisp)
	       int index, struct nvkm_disp **pdisp)
{
{
	if (!(*pdisp = kzalloc(sizeof(**pdisp), GFP_KERNEL)))
	if (!(*pdisp = kzalloc(sizeof(**pdisp), GFP_KERNEL)))
		return -ENOMEM;
		return -ENOMEM;
	return nvkm_disp_ctor(func, device, index, heads, *pdisp);
	return nvkm_disp_ctor(func, device, index, *pdisp);
}
}
+2 −1
Original line number Original line Diff line number Diff line
@@ -22,6 +22,7 @@
 * Authors: Ben Skeggs
 * Authors: Ben Skeggs
 */
 */
#include "dmacnv50.h"
#include "dmacnv50.h"
#include "head.h"
#include "rootnv50.h"
#include "rootnv50.h"


#include <core/client.h>
#include <core/client.h>
@@ -50,7 +51,7 @@ nv50_disp_base_new(const struct nv50_disp_dmac_func *func,
		nvif_ioctl(parent, "create disp base channel dma vers %d "
		nvif_ioctl(parent, "create disp base channel dma vers %d "
				   "pushbuf %016llx head %d\n",
				   "pushbuf %016llx head %d\n",
			   args->v0.version, args->v0.pushbuf, args->v0.head);
			   args->v0.version, args->v0.pushbuf, args->v0.head);
		if (args->v0.head > disp->base.head.nr)
		if (!nvkm_head_find(&disp->base, args->v0.head))
			return -EINVAL;
			return -EINVAL;
		push = args->v0.pushbuf;
		push = args->v0.pushbuf;
		head = args->v0.head;
		head = args->v0.head;
+2 −1
Original line number Original line Diff line number Diff line
@@ -22,6 +22,7 @@
 * Authors: Ben Skeggs
 * Authors: Ben Skeggs
 */
 */
#include "channv50.h"
#include "channv50.h"
#include "head.h"
#include "rootnv50.h"
#include "rootnv50.h"


#include <core/client.h>
#include <core/client.h>
@@ -48,7 +49,7 @@ nv50_disp_curs_new(const struct nv50_disp_chan_func *func,
	if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) {
	if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) {
		nvif_ioctl(parent, "create disp cursor vers %d head %d\n",
		nvif_ioctl(parent, "create disp cursor vers %d head %d\n",
			   args->v0.version, args->v0.head);
			   args->v0.version, args->v0.head);
		if (args->v0.head > disp->base.head.nr)
		if (!nvkm_head_find(&disp->base, args->v0.head))
			return -EINVAL;
			return -EINVAL;
		head = args->v0.head;
		head = args->v0.head;
	} else
	} else
Loading