Commit f82fb646 authored by Ben Skeggs's avatar Ben Skeggs Committed by Dave Airlie
Browse files

drm/nouveau/gsp: add hal for disp.chan.dmac_alloc()



565.57.01 has incompatible changes to
NV50VAIO_CHANNELDMA_ALLOCATION_PARAMETERS.

Signed-off-by: default avatarBen Skeggs <bskeggs@nvidia.com>
Reviewed-by: default avatarDave Airlie <airlied@redhat.com>
Reviewed-by: default avatarTimur Tabi <ttabi@nvidia.com>
Tested-by: default avatarTimur Tabi <ttabi@nvidia.com>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent 8887abb8
Loading
Loading
Loading
Loading
+20 −11
Original line number Diff line number Diff line
@@ -164,27 +164,35 @@ r535_dmac_fini(struct nvkm_disp_chan *chan)
	r535_chan_fini(chan);
}

static int
r535_dmac_alloc(struct nvkm_disp *disp, u32 oclass, int inst, u32 put_offset,
		struct nvkm_gsp_object *dmac)
{
	NV50VAIO_CHANNELDMA_ALLOCATION_PARAMETERS *args;

	args = nvkm_gsp_rm_alloc_get(&disp->rm.object, (oclass << 16) | inst, oclass,
				     sizeof(*args), dmac);
	if (IS_ERR(args))
		return PTR_ERR(args);

	args->channelInstance = inst;
	args->offset = put_offset;

	return nvkm_gsp_rm_alloc_wr(dmac, args);
}

static int
r535_dmac_init(struct nvkm_disp_chan *chan)
{
	const struct nvkm_rm_api *rmapi = chan->disp->rm.objcom.client->gsp->rm->api;
	NV50VAIO_CHANNELDMA_ALLOCATION_PARAMETERS *args;
	int ret;

	ret = rmapi->disp->chan.set_pushbuf(chan->disp, chan->object.oclass, chan->head, chan->memory);
	if (ret)
		return ret;

	args = nvkm_gsp_rm_alloc_get(&chan->disp->rm.object,
				     (chan->object.oclass << 16) | chan->head,
				     chan->object.oclass, sizeof(*args), &chan->rm.object);
	if (IS_ERR(args))
		return PTR_ERR(args);

	args->channelInstance = chan->head;
	args->offset = chan->suspend_put;

	return nvkm_gsp_rm_alloc_wr(&chan->rm.object, args);
	return rmapi->disp->chan.dmac_alloc(chan->disp, chan->object.oclass, chan->head,
					    chan->suspend_put, &chan->rm.object);
}

static int
@@ -1780,5 +1788,6 @@ r535_disp = {
	},
	.chan = {
		.set_pushbuf = r535_disp_chan_set_pushbuf,
		.dmac_alloc = r535_dmac_alloc,
	}
};
+2 −0
Original line number Diff line number Diff line
@@ -94,6 +94,8 @@ struct nvkm_rm_api {
		struct {
			int (*set_pushbuf)(struct nvkm_disp *, s32 oclass, int inst,
					   struct nvkm_memory *);
			int (*dmac_alloc)(struct nvkm_disp *, u32 oclass, int inst, u32 put_offset,
					  struct nvkm_gsp_object *);
		} chan;
	} *disp;