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

565.57.01 has incompatible changes to
NV50VAIO_CHANNELDMA_ALLOCATION_PARAMETERS.

Signed-off-by: Ben Skeggs <bskeggs@nvidia.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Timur Tabi <ttabi@nvidia.com>
Tested-by: Timur Tabi <ttabi@nvidia.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
Ben Skeggs 2024-11-14 13:02:39 +10:00 committed by Dave Airlie
parent 8887abb8cb
commit f82fb646e1
2 changed files with 22 additions and 11 deletions

View File

@ -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,
}
};

View File

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