drm/nouveau/disp: allow user direct access to channel control registers

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
This commit is contained in:
Ben Skeggs 2014-08-10 04:10:28 +10:00
parent 648d4dfde7
commit b76f15295e
4 changed files with 24 additions and 1 deletions

View file

@ -82,6 +82,16 @@ nv50_disp_chan_destroy(struct nv50_disp_chan *chan)
nouveau_namedb_destroy(&chan->base); nouveau_namedb_destroy(&chan->base);
} }
int
nv50_disp_chan_map(struct nouveau_object *object, u64 *addr, u32 *size)
{
struct nv50_disp_chan *chan = (void *)object;
*addr = nv_device_resource_start(nv_device(object), 0) +
0x640000 + (chan->chid * 0x1000);
*size = 0x001000;
return 0;
}
u32 u32
nv50_disp_chan_rd32(struct nouveau_object *object, u64 addr) nv50_disp_chan_rd32(struct nouveau_object *object, u64 addr)
{ {
@ -496,6 +506,7 @@ nv50_disp_mast_ofuncs = {
.base.dtor = nv50_disp_dmac_dtor, .base.dtor = nv50_disp_dmac_dtor,
.base.init = nv50_disp_mast_init, .base.init = nv50_disp_mast_init,
.base.fini = nv50_disp_mast_fini, .base.fini = nv50_disp_mast_fini,
.base.map = nv50_disp_chan_map,
.base.rd32 = nv50_disp_chan_rd32, .base.rd32 = nv50_disp_chan_rd32,
.base.wr32 = nv50_disp_chan_wr32, .base.wr32 = nv50_disp_chan_wr32,
.chid = 0, .chid = 0,
@ -596,6 +607,7 @@ nv50_disp_sync_ofuncs = {
.base.dtor = nv50_disp_dmac_dtor, .base.dtor = nv50_disp_dmac_dtor,
.base.init = nv50_disp_dmac_init, .base.init = nv50_disp_dmac_init,
.base.fini = nv50_disp_dmac_fini, .base.fini = nv50_disp_dmac_fini,
.base.map = nv50_disp_chan_map,
.base.rd32 = nv50_disp_chan_rd32, .base.rd32 = nv50_disp_chan_rd32,
.base.wr32 = nv50_disp_chan_wr32, .base.wr32 = nv50_disp_chan_wr32,
.chid = 1, .chid = 1,
@ -684,6 +696,7 @@ nv50_disp_ovly_ofuncs = {
.base.dtor = nv50_disp_dmac_dtor, .base.dtor = nv50_disp_dmac_dtor,
.base.init = nv50_disp_dmac_init, .base.init = nv50_disp_dmac_init,
.base.fini = nv50_disp_dmac_fini, .base.fini = nv50_disp_dmac_fini,
.base.map = nv50_disp_chan_map,
.base.rd32 = nv50_disp_chan_rd32, .base.rd32 = nv50_disp_chan_rd32,
.base.wr32 = nv50_disp_chan_wr32, .base.wr32 = nv50_disp_chan_wr32,
.chid = 3, .chid = 3,
@ -800,6 +813,7 @@ nv50_disp_oimm_ofuncs = {
.base.dtor = nv50_disp_pioc_dtor, .base.dtor = nv50_disp_pioc_dtor,
.base.init = nv50_disp_pioc_init, .base.init = nv50_disp_pioc_init,
.base.fini = nv50_disp_pioc_fini, .base.fini = nv50_disp_pioc_fini,
.base.map = nv50_disp_chan_map,
.base.rd32 = nv50_disp_chan_rd32, .base.rd32 = nv50_disp_chan_rd32,
.base.wr32 = nv50_disp_chan_wr32, .base.wr32 = nv50_disp_chan_wr32,
.chid = 5, .chid = 5,
@ -846,6 +860,7 @@ nv50_disp_curs_ofuncs = {
.base.dtor = nv50_disp_pioc_dtor, .base.dtor = nv50_disp_pioc_dtor,
.base.init = nv50_disp_pioc_init, .base.init = nv50_disp_pioc_init,
.base.fini = nv50_disp_pioc_fini, .base.fini = nv50_disp_pioc_fini,
.base.map = nv50_disp_chan_map,
.base.rd32 = nv50_disp_chan_rd32, .base.rd32 = nv50_disp_chan_rd32,
.base.wr32 = nv50_disp_chan_wr32, .base.wr32 = nv50_disp_chan_wr32,
.chid = 7, .chid = 7,

View file

@ -116,6 +116,7 @@ struct nv50_disp_chan {
int chid; int chid;
}; };
int nv50_disp_chan_map(struct nouveau_object *, u64 *, u32 *);
u32 nv50_disp_chan_rd32(struct nouveau_object *, u64); u32 nv50_disp_chan_rd32(struct nouveau_object *, u64);
void nv50_disp_chan_wr32(struct nouveau_object *, u64, u32); void nv50_disp_chan_wr32(struct nouveau_object *, u64, u32);

View file

@ -326,6 +326,7 @@ nvd0_disp_mast_ofuncs = {
.base.dtor = nv50_disp_dmac_dtor, .base.dtor = nv50_disp_dmac_dtor,
.base.init = nvd0_disp_mast_init, .base.init = nvd0_disp_mast_init,
.base.fini = nvd0_disp_mast_fini, .base.fini = nvd0_disp_mast_fini,
.base.map = nv50_disp_chan_map,
.base.rd32 = nv50_disp_chan_rd32, .base.rd32 = nv50_disp_chan_rd32,
.base.wr32 = nv50_disp_chan_wr32, .base.wr32 = nv50_disp_chan_wr32,
.chid = 0, .chid = 0,
@ -418,6 +419,7 @@ nvd0_disp_sync_ofuncs = {
.base.dtor = nv50_disp_dmac_dtor, .base.dtor = nv50_disp_dmac_dtor,
.base.init = nvd0_disp_dmac_init, .base.init = nvd0_disp_dmac_init,
.base.fini = nvd0_disp_dmac_fini, .base.fini = nvd0_disp_dmac_fini,
.base.map = nv50_disp_chan_map,
.base.rd32 = nv50_disp_chan_rd32, .base.rd32 = nv50_disp_chan_rd32,
.base.wr32 = nv50_disp_chan_wr32, .base.wr32 = nv50_disp_chan_wr32,
.chid = 1, .chid = 1,
@ -497,6 +499,7 @@ nvd0_disp_ovly_ofuncs = {
.base.dtor = nv50_disp_dmac_dtor, .base.dtor = nv50_disp_dmac_dtor,
.base.init = nvd0_disp_dmac_init, .base.init = nvd0_disp_dmac_init,
.base.fini = nvd0_disp_dmac_fini, .base.fini = nvd0_disp_dmac_fini,
.base.map = nv50_disp_chan_map,
.base.rd32 = nv50_disp_chan_rd32, .base.rd32 = nv50_disp_chan_rd32,
.base.wr32 = nv50_disp_chan_wr32, .base.wr32 = nv50_disp_chan_wr32,
.chid = 5, .chid = 5,
@ -567,6 +570,7 @@ nvd0_disp_oimm_ofuncs = {
.base.dtor = nv50_disp_pioc_dtor, .base.dtor = nv50_disp_pioc_dtor,
.base.init = nvd0_disp_pioc_init, .base.init = nvd0_disp_pioc_init,
.base.fini = nvd0_disp_pioc_fini, .base.fini = nvd0_disp_pioc_fini,
.base.map = nv50_disp_chan_map,
.base.rd32 = nv50_disp_chan_rd32, .base.rd32 = nv50_disp_chan_rd32,
.base.wr32 = nv50_disp_chan_wr32, .base.wr32 = nv50_disp_chan_wr32,
.chid = 9, .chid = 9,
@ -582,6 +586,7 @@ nvd0_disp_curs_ofuncs = {
.base.dtor = nv50_disp_pioc_dtor, .base.dtor = nv50_disp_pioc_dtor,
.base.init = nvd0_disp_pioc_init, .base.init = nvd0_disp_pioc_init,
.base.fini = nvd0_disp_pioc_fini, .base.fini = nvd0_disp_pioc_fini,
.base.map = nv50_disp_chan_map,
.base.rd32 = nv50_disp_chan_rd32, .base.rd32 = nv50_disp_chan_rd32,
.base.wr32 = nv50_disp_chan_wr32, .base.wr32 = nv50_disp_chan_wr32,
.chid = 13, .chid = 13,

View file

@ -69,9 +69,11 @@ nv50_chan_create(struct nvif_object *disp, const u32 *oclass, u8 head,
int ret = nvif_object_init(disp, NULL, (oclass[0] << 16) | head, int ret = nvif_object_init(disp, NULL, (oclass[0] << 16) | head,
oclass[0], data, size, oclass[0], data, size,
&chan->user); &chan->user);
if (oclass++, ret == 0) if (oclass++, ret == 0) {
nvif_object_map(&chan->user);
return ret; return ret;
} }
}
return -ENOSYS; return -ENOSYS;
} }