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

drm/nouveau/disp/nv50-: initialise from the engine, rather than the user object



Engines are initialised on an as-needed basis, so this results in the
same behaviour, whilst allowing us to simplify things a bit.

Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent f5e088d6
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -220,6 +220,9 @@ nvkm_disp_fini(struct nvkm_engine *engine, bool suspend)
	struct nvkm_conn *conn;
	struct nvkm_outp *outp;

	if (disp->func->fini)
		disp->func->fini(disp);

	list_for_each_entry(outp, &disp->outp, head) {
		nvkm_outp_fini(outp);
	}
@@ -237,6 +240,7 @@ nvkm_disp_init(struct nvkm_engine *engine)
	struct nvkm_disp *disp = nvkm_disp(engine);
	struct nvkm_conn *conn;
	struct nvkm_outp *outp;
	struct nvkm_ior *ior;

	list_for_each_entry(conn, &disp->conn, head) {
		nvkm_conn_init(conn);
@@ -246,6 +250,19 @@ nvkm_disp_init(struct nvkm_engine *engine)
		nvkm_outp_init(outp);
	}

	if (disp->func->init) {
		int ret = disp->func->init(disp);
		if (ret)
			return ret;
	}

	/* Set 'normal' (ie. when it's attached to a head) state for
	 * each output resource to 'fully enabled'.
	 */
	list_for_each_entry(ior, &disp->ior, head) {
		ior->func->power(ior, true, true, true, true, true);
	}

	return 0;
}

+1 −0
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@
#define nv50_disp_chan(p) container_of((p), struct nv50_disp_chan, object)
#include <core/object.h>
#include "nv50.h"
struct nv50_disp_root;

struct nv50_disp_chan {
	const struct nv50_disp_chan_func *func;
+1 −1
Original line number Diff line number Diff line
@@ -31,7 +31,7 @@ int
gf119_disp_dmac_bind(struct nv50_disp_dmac *chan,
		     struct nvkm_object *object, u32 handle)
{
	return nvkm_ramht_insert(chan->base.root->ramht, object,
	return nvkm_ramht_insert(chan->base.root->disp->ramht, object,
				 chan->base.chid.user, -9, handle,
				 chan->base.chid.user << 27 | 0x00000001);
}
+6 −6
Original line number Diff line number Diff line
@@ -33,7 +33,7 @@

struct nv50_disp_dmac_object {
	struct nvkm_oproxy oproxy;
	struct nv50_disp_root *root;
	struct nv50_disp *disp;
	int hash;
};

@@ -42,7 +42,7 @@ nv50_disp_dmac_child_del_(struct nvkm_oproxy *base)
{
	struct nv50_disp_dmac_object *object =
		container_of(base, typeof(*object), oproxy);
	nvkm_ramht_remove(object->root->ramht, object->hash);
	nvkm_ramht_remove(object->disp->ramht, object->hash);
}

static const struct nvkm_oproxy_func
@@ -56,8 +56,8 @@ nv50_disp_dmac_child_new_(struct nv50_disp_chan *base,
			  void *data, u32 size, struct nvkm_object **pobject)
{
	struct nv50_disp_dmac *chan = nv50_disp_dmac(base);
	struct nv50_disp_root *root = chan->base.root;
	struct nvkm_device *device = root->disp->base.engine.subdev.device;
	struct nv50_disp *disp = chan->base.root->disp;
	struct nvkm_device *device = disp->base.engine.subdev.device;
	const struct nvkm_device_oclass *sclass = oclass->priv;
	struct nv50_disp_dmac_object *object;
	int ret;
@@ -65,7 +65,7 @@ nv50_disp_dmac_child_new_(struct nv50_disp_chan *base,
	if (!(object = kzalloc(sizeof(*object), GFP_KERNEL)))
		return -ENOMEM;
	nvkm_oproxy_ctor(&nv50_disp_dmac_child_func_, oclass, &object->oproxy);
	object->root = root;
	object->disp = disp;
	*pobject = &object->oproxy.base;

	ret = sclass->ctor(device, oclass, data, size, &object->oproxy.object);
@@ -177,7 +177,7 @@ int
nv50_disp_dmac_bind(struct nv50_disp_dmac *chan,
		    struct nvkm_object *object, u32 handle)
{
	return nvkm_ramht_insert(chan->base.root->ramht, object,
	return nvkm_ramht_insert(chan->base.root->disp->ramht, object,
				 chan->base.chid.user, -10, handle,
				 chan->base.chid.user << 28 |
				 chan->base.chid.user);
+2 −0
Original line number Diff line number Diff line
@@ -28,6 +28,8 @@

static const struct nv50_disp_func
g84_disp = {
	.init = nv50_disp_init,
	.fini = nv50_disp_fini,
	.intr = nv50_disp_intr,
	.uevent = &nv50_disp_chan_uevent,
	.super = nv50_disp_super,
Loading