Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 64cb5a31 authored by Ben Skeggs's avatar Ben Skeggs
Browse files

drm/nouveau/gr/gf100-: abstract fetching rop count



Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent 5ec3def7
Loading
Loading
Loading
Loading
+10 −2
Original line number Original line Diff line number Diff line
@@ -702,6 +702,13 @@ gf100_gr_pack_mmio[] = {
 * PGRAPH engine/subdev functions
 * PGRAPH engine/subdev functions
 ******************************************************************************/
 ******************************************************************************/


int
gf100_gr_rops(struct gf100_gr *gr)
{
	struct nvkm_device *device = gr->base.engine.subdev.device;
	return (nvkm_rd32(device, 0x409604) & 0x001f0000) >> 16;
}

void
void
gf100_gr_zbc_init(struct gf100_gr *gr)
gf100_gr_zbc_init(struct gf100_gr *gr)
{
{
@@ -1633,7 +1640,7 @@ gf100_gr_oneinit(struct nvkm_gr *base)
		nvkm_wo32(gr->unk4188b8, i, 0x00000010);
		nvkm_wo32(gr->unk4188b8, i, 0x00000010);
	nvkm_done(gr->unk4188b8);
	nvkm_done(gr->unk4188b8);


	gr->rop_nr = (nvkm_rd32(device, 0x409604) & 0x001f0000) >> 16;
	gr->rop_nr = gr->func->rops(gr);
	gr->gpc_nr = nvkm_rd32(device, 0x409604) & 0x0000001f;
	gr->gpc_nr = nvkm_rd32(device, 0x409604) & 0x0000001f;
	for (i = 0; i < gr->gpc_nr; i++) {
	for (i = 0; i < gr->gpc_nr; i++) {
		gr->tpc_nr[i]  = nvkm_rd32(device, GPC_UNIT(i, 0x2608));
		gr->tpc_nr[i]  = nvkm_rd32(device, GPC_UNIT(i, 0x2608));
@@ -1946,6 +1953,7 @@ gf100_gr = {
	.mmio = gf100_gr_pack_mmio,
	.mmio = gf100_gr_pack_mmio,
	.fecs.ucode = &gf100_gr_fecs_ucode,
	.fecs.ucode = &gf100_gr_fecs_ucode,
	.gpccs.ucode = &gf100_gr_gpccs_ucode,
	.gpccs.ucode = &gf100_gr_gpccs_ucode,
	.rops = gf100_gr_rops,
	.grctx = &gf100_grctx,
	.grctx = &gf100_grctx,
	.sclass = {
	.sclass = {
		{ -1, -1, FERMI_TWOD_A },
		{ -1, -1, FERMI_TWOD_A },
+2 −0
Original line number Original line Diff line number Diff line
@@ -129,12 +129,14 @@ struct gf100_gr_func {
	struct {
	struct {
		struct gf100_gr_ucode *ucode;
		struct gf100_gr_ucode *ucode;
	} gpccs;
	} gpccs;
	int (*rops)(struct gf100_gr *);
	int ppc_nr;
	int ppc_nr;
	const struct gf100_grctx_func *grctx;
	const struct gf100_grctx_func *grctx;
	struct nvkm_sclass sclass[];
	struct nvkm_sclass sclass[];
};
};


int gf100_gr_init(struct gf100_gr *);
int gf100_gr_init(struct gf100_gr *);
int gf100_gr_rops(struct gf100_gr *);


int gk104_gr_init(struct gf100_gr *);
int gk104_gr_init(struct gf100_gr *);


+1 −0
Original line number Original line Diff line number Diff line
@@ -118,6 +118,7 @@ gf104_gr = {
	.mmio = gf104_gr_pack_mmio,
	.mmio = gf104_gr_pack_mmio,
	.fecs.ucode = &gf100_gr_fecs_ucode,
	.fecs.ucode = &gf100_gr_fecs_ucode,
	.gpccs.ucode = &gf100_gr_gpccs_ucode,
	.gpccs.ucode = &gf100_gr_gpccs_ucode,
	.rops = gf100_gr_rops,
	.grctx = &gf104_grctx,
	.grctx = &gf104_grctx,
	.sclass = {
	.sclass = {
		{ -1, -1, FERMI_TWOD_A },
		{ -1, -1, FERMI_TWOD_A },
+1 −0
Original line number Original line Diff line number Diff line
@@ -109,6 +109,7 @@ gf108_gr = {
	.mmio = gf108_gr_pack_mmio,
	.mmio = gf108_gr_pack_mmio,
	.fecs.ucode = &gf100_gr_fecs_ucode,
	.fecs.ucode = &gf100_gr_fecs_ucode,
	.gpccs.ucode = &gf100_gr_gpccs_ucode,
	.gpccs.ucode = &gf100_gr_gpccs_ucode,
	.rops = gf100_gr_rops,
	.grctx = &gf108_grctx,
	.grctx = &gf108_grctx,
	.sclass = {
	.sclass = {
		{ -1, -1, FERMI_TWOD_A },
		{ -1, -1, FERMI_TWOD_A },
+1 −0
Original line number Original line Diff line number Diff line
@@ -90,6 +90,7 @@ gf110_gr = {
	.mmio = gf110_gr_pack_mmio,
	.mmio = gf110_gr_pack_mmio,
	.fecs.ucode = &gf100_gr_fecs_ucode,
	.fecs.ucode = &gf100_gr_fecs_ucode,
	.gpccs.ucode = &gf100_gr_gpccs_ucode,
	.gpccs.ucode = &gf100_gr_gpccs_ucode,
	.rops = gf100_gr_rops,
	.grctx = &gf110_grctx,
	.grctx = &gf110_grctx,
	.sclass = {
	.sclass = {
		{ -1, -1, FERMI_TWOD_A },
		{ -1, -1, FERMI_TWOD_A },
Loading