mirror of
https://github.com/torvalds/linux.git
synced 2024-12-26 12:52:30 +00:00
drm/nv50-/sw: share engine/channel constructor between implementations
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
This commit is contained in:
parent
c46c3ddf1f
commit
7589563eb3
@ -147,12 +147,13 @@ nv50_software_vblsem_release(struct nouveau_eventh *event, int head)
|
|||||||
return NVKM_EVENT_DROP;
|
return NVKM_EVENT_DROP;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
int
|
||||||
nv50_software_context_ctor(struct nouveau_object *parent,
|
nv50_software_context_ctor(struct nouveau_object *parent,
|
||||||
struct nouveau_object *engine,
|
struct nouveau_object *engine,
|
||||||
struct nouveau_oclass *oclass, void *data, u32 size,
|
struct nouveau_oclass *oclass, void *data, u32 size,
|
||||||
struct nouveau_object **pobject)
|
struct nouveau_object **pobject)
|
||||||
{
|
{
|
||||||
|
struct nv50_software_cclass *pclass = (void *)oclass;
|
||||||
struct nv50_software_chan *chan;
|
struct nv50_software_chan *chan;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@ -162,30 +163,32 @@ nv50_software_context_ctor(struct nouveau_object *parent,
|
|||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
chan->vblank.channel = nv_gpuobj(parent->parent)->addr >> 12;
|
chan->vblank.channel = nv_gpuobj(parent->parent)->addr >> 12;
|
||||||
chan->vblank.event.func = nv50_software_vblsem_release;
|
chan->vblank.event.func = pclass->vblank;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct nouveau_oclass
|
static struct nv50_software_cclass
|
||||||
nv50_software_cclass = {
|
nv50_software_cclass = {
|
||||||
.handle = NV_ENGCTX(SW, 0x50),
|
.base.handle = NV_ENGCTX(SW, 0x50),
|
||||||
.ofuncs = &(struct nouveau_ofuncs) {
|
.base.ofuncs = &(struct nouveau_ofuncs) {
|
||||||
.ctor = nv50_software_context_ctor,
|
.ctor = nv50_software_context_ctor,
|
||||||
.dtor = _nouveau_software_context_dtor,
|
.dtor = _nouveau_software_context_dtor,
|
||||||
.init = _nouveau_software_context_init,
|
.init = _nouveau_software_context_init,
|
||||||
.fini = _nouveau_software_context_fini,
|
.fini = _nouveau_software_context_fini,
|
||||||
},
|
},
|
||||||
|
.vblank = nv50_software_vblsem_release,
|
||||||
};
|
};
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* software engine/subdev functions
|
* software engine/subdev functions
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
static int
|
int
|
||||||
nv50_software_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
|
nv50_software_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
|
||||||
struct nouveau_oclass *oclass, void *data, u32 size,
|
struct nouveau_oclass *oclass, void *data, u32 size,
|
||||||
struct nouveau_object **pobject)
|
struct nouveau_object **pobject)
|
||||||
{
|
{
|
||||||
|
struct nv50_software_oclass *pclass = (void *)oclass;
|
||||||
struct nv50_software_priv *priv;
|
struct nv50_software_priv *priv;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@ -194,8 +197,8 @@ nv50_software_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
|
|||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
nv_engine(priv)->cclass = &nv50_software_cclass;
|
nv_engine(priv)->cclass = pclass->cclass;
|
||||||
nv_engine(priv)->sclass = nv50_software_sclass;
|
nv_engine(priv)->sclass = pclass->sclass;
|
||||||
nv_subdev(priv)->intr = nv04_software_intr;
|
nv_subdev(priv)->intr = nv04_software_intr;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -209,4 +212,6 @@ nv50_software_oclass = &(struct nv50_software_oclass) {
|
|||||||
.init = _nouveau_software_init,
|
.init = _nouveau_software_init,
|
||||||
.fini = _nouveau_software_fini,
|
.fini = _nouveau_software_fini,
|
||||||
},
|
},
|
||||||
|
.cclass = &nv50_software_cclass.base,
|
||||||
|
.sclass = nv50_software_sclass,
|
||||||
}.base;
|
}.base;
|
||||||
|
@ -5,12 +5,23 @@
|
|||||||
|
|
||||||
struct nv50_software_oclass {
|
struct nv50_software_oclass {
|
||||||
struct nouveau_oclass base;
|
struct nouveau_oclass base;
|
||||||
|
struct nouveau_oclass *cclass;
|
||||||
|
struct nouveau_oclass *sclass;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct nv50_software_priv {
|
struct nv50_software_priv {
|
||||||
struct nouveau_software base;
|
struct nouveau_software base;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
int nv50_software_ctor(struct nouveau_object *, struct nouveau_object *,
|
||||||
|
struct nouveau_oclass *, void *, u32,
|
||||||
|
struct nouveau_object **);
|
||||||
|
|
||||||
|
struct nv50_software_cclass {
|
||||||
|
struct nouveau_oclass base;
|
||||||
|
int (*vblank)(struct nouveau_eventh *, int);
|
||||||
|
};
|
||||||
|
|
||||||
struct nv50_software_chan {
|
struct nv50_software_chan {
|
||||||
struct nouveau_software_chan base;
|
struct nouveau_software_chan base;
|
||||||
struct {
|
struct {
|
||||||
@ -22,4 +33,9 @@ struct nv50_software_chan {
|
|||||||
} vblank;
|
} vblank;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
int nv50_software_context_ctor(struct nouveau_object *,
|
||||||
|
struct nouveau_object *,
|
||||||
|
struct nouveau_oclass *, void *, u32,
|
||||||
|
struct nouveau_object **);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -154,66 +154,31 @@ nvc0_software_vblsem_release(struct nouveau_eventh *event, int head)
|
|||||||
return NVKM_EVENT_DROP;
|
return NVKM_EVENT_DROP;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static struct nv50_software_cclass
|
||||||
nvc0_software_context_ctor(struct nouveau_object *parent,
|
|
||||||
struct nouveau_object *engine,
|
|
||||||
struct nouveau_oclass *oclass, void *data, u32 size,
|
|
||||||
struct nouveau_object **pobject)
|
|
||||||
{
|
|
||||||
struct nv50_software_chan *chan;
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
ret = nouveau_software_context_create(parent, engine, oclass, &chan);
|
|
||||||
*pobject = nv_object(chan);
|
|
||||||
if (ret)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
chan->vblank.channel = nv_gpuobj(parent->parent)->addr >> 12;
|
|
||||||
chan->vblank.event.func = nvc0_software_vblsem_release;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct nouveau_oclass
|
|
||||||
nvc0_software_cclass = {
|
nvc0_software_cclass = {
|
||||||
.handle = NV_ENGCTX(SW, 0xc0),
|
.base.handle = NV_ENGCTX(SW, 0xc0),
|
||||||
.ofuncs = &(struct nouveau_ofuncs) {
|
.base.ofuncs = &(struct nouveau_ofuncs) {
|
||||||
.ctor = nvc0_software_context_ctor,
|
.ctor = nv50_software_context_ctor,
|
||||||
.dtor = _nouveau_software_context_dtor,
|
.dtor = _nouveau_software_context_dtor,
|
||||||
.init = _nouveau_software_context_init,
|
.init = _nouveau_software_context_init,
|
||||||
.fini = _nouveau_software_context_fini,
|
.fini = _nouveau_software_context_fini,
|
||||||
},
|
},
|
||||||
|
.vblank = nvc0_software_vblsem_release,
|
||||||
};
|
};
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* software engine/subdev functions
|
* software engine/subdev functions
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
static int
|
|
||||||
nvc0_software_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
|
|
||||||
struct nouveau_oclass *oclass, void *data, u32 size,
|
|
||||||
struct nouveau_object **pobject)
|
|
||||||
{
|
|
||||||
struct nv50_software_priv *priv;
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
ret = nouveau_software_create(parent, engine, oclass, &priv);
|
|
||||||
*pobject = nv_object(priv);
|
|
||||||
if (ret)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
nv_engine(priv)->cclass = &nvc0_software_cclass;
|
|
||||||
nv_engine(priv)->sclass = nvc0_software_sclass;
|
|
||||||
nv_subdev(priv)->intr = nv04_software_intr;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct nouveau_oclass *
|
struct nouveau_oclass *
|
||||||
nvc0_software_oclass = &(struct nv50_software_oclass) {
|
nvc0_software_oclass = &(struct nv50_software_oclass) {
|
||||||
.base.handle = NV_ENGINE(SW, 0xc0),
|
.base.handle = NV_ENGINE(SW, 0xc0),
|
||||||
.base.ofuncs = &(struct nouveau_ofuncs) {
|
.base.ofuncs = &(struct nouveau_ofuncs) {
|
||||||
.ctor = nvc0_software_ctor,
|
.ctor = nv50_software_ctor,
|
||||||
.dtor = _nouveau_software_dtor,
|
.dtor = _nouveau_software_dtor,
|
||||||
.init = _nouveau_software_init,
|
.init = _nouveau_software_init,
|
||||||
.fini = _nouveau_software_fini,
|
.fini = _nouveau_software_fini,
|
||||||
},
|
},
|
||||||
|
.cclass = &nvc0_software_cclass.base,
|
||||||
|
.sclass = nvc0_software_sclass,
|
||||||
}.base;
|
}.base;
|
||||||
|
Loading…
Reference in New Issue
Block a user