Commit e9d03335 authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau/gr/gp100-: use correct registers for zbc colour/depth setup

These were missed the first time around due to the driver version I traced
using the older registers still.
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent 7a058a90
......@@ -92,7 +92,7 @@ gf100_gr_zbc_color_get(struct gf100_gr *gr, int format,
memcpy(gr->zbc_color[zbc].l2, l2, sizeof(gr->zbc_color[zbc].l2));
gr->zbc_color[zbc].format = format;
nvkm_ltc_zbc_color_get(ltc, zbc, l2);
gf100_gr_zbc_clear_color(gr, zbc);
gr->func->zbc->clear_color(gr, zbc);
return zbc;
}
......@@ -137,10 +137,16 @@ gf100_gr_zbc_depth_get(struct gf100_gr *gr, int format,
gr->zbc_depth[zbc].ds = ds;
gr->zbc_depth[zbc].l2 = l2;
nvkm_ltc_zbc_depth_get(ltc, zbc, l2);
gf100_gr_zbc_clear_depth(gr, zbc);
gr->func->zbc->clear_depth(gr, zbc);
return zbc;
}
const struct gf100_gr_func_zbc
gf100_gr_zbc = {
.clear_color = gf100_gr_zbc_clear_color,
.clear_depth = gf100_gr_zbc_clear_depth,
};
/*******************************************************************************
* Graphics object classes
******************************************************************************/
......@@ -744,21 +750,21 @@ gf100_gr_zbc_init(struct gf100_gr *gr)
const u32 f32_1[] = { 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000,
0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000 };
struct nvkm_ltc *ltc = gr->base.engine.subdev.device->ltc;
int index;
int index, c = ltc->zbc_min, d = ltc->zbc_min;
if (!gr->zbc_color[0].format) {
gf100_gr_zbc_color_get(gr, 1, & zero[0], &zero[4]);
gf100_gr_zbc_color_get(gr, 2, & one[0], &one[4]);
gf100_gr_zbc_color_get(gr, 4, &f32_0[0], &f32_0[4]);
gf100_gr_zbc_color_get(gr, 4, &f32_1[0], &f32_1[4]);
gf100_gr_zbc_depth_get(gr, 1, 0x00000000, 0x00000000);
gf100_gr_zbc_depth_get(gr, 1, 0x3f800000, 0x3f800000);
}
for (index = ltc->zbc_min; index <= ltc->zbc_max; index++)
gf100_gr_zbc_clear_color(gr, index);
for (index = ltc->zbc_min; index <= ltc->zbc_max; index++)
gf100_gr_zbc_clear_depth(gr, index);
gf100_gr_zbc_color_get(gr, 1, & zero[0], &zero[4]); c++;
gf100_gr_zbc_color_get(gr, 2, & one[0], &one[4]); c++;
gf100_gr_zbc_color_get(gr, 4, &f32_0[0], &f32_0[4]); c++;
gf100_gr_zbc_color_get(gr, 4, &f32_1[0], &f32_1[4]); c++;
gf100_gr_zbc_depth_get(gr, 1, 0x00000000, 0x00000000); d++;
gf100_gr_zbc_depth_get(gr, 1, 0x3f800000, 0x3f800000); d++;
}
for (index = c; index <= ltc->zbc_max; index++)
gr->func->zbc->clear_color(gr, index);
for (index = d; index <= ltc->zbc_max; index++)
gr->func->zbc->clear_depth(gr, index);
}
/**
......@@ -2242,6 +2248,7 @@ gf100_gr = {
.gpccs.ucode = &gf100_gr_gpccs_ucode,
.rops = gf100_gr_rops,
.grctx = &gf100_grctx,
.zbc = &gf100_gr_zbc,
.sclass = {
{ -1, -1, FERMI_TWOD_A },
{ -1, -1, FERMI_MEMORY_TO_MEMORY_FORMAT_A },
......
......@@ -129,6 +129,11 @@ int gf100_gr_new_(const struct gf100_gr_func *, struct nvkm_device *,
int, struct nvkm_gr **);
void *gf100_gr_dtor(struct nvkm_gr *);
struct gf100_gr_func_zbc {
void (*clear_color)(struct gf100_gr *, int zbc);
void (*clear_depth)(struct gf100_gr *, int zbc);
};
struct gf100_gr_func {
void (*dtor)(struct gf100_gr *);
void (*oneinit_tiles)(struct gf100_gr *);
......@@ -170,6 +175,7 @@ struct gf100_gr_func {
int ppc_nr;
const struct gf100_grctx_func *grctx;
const struct nvkm_therm_clkgate_pack *clkgate_pack;
const struct gf100_gr_func_zbc *zbc;
struct nvkm_sclass sclass[];
};
......@@ -187,6 +193,7 @@ void gf100_gr_init_419eb4(struct gf100_gr *);
void gf100_gr_init_tex_hww_esr(struct gf100_gr *, int, int);
void gf100_gr_init_shader_exceptions(struct gf100_gr *, int, int);
void gf100_gr_init_400054(struct gf100_gr *);
extern const struct gf100_gr_func_zbc gf100_gr_zbc;
void gf117_gr_init_zcull(struct gf100_gr *);
......@@ -212,6 +219,9 @@ void gm200_gr_init_ds_hww_esr_2(struct gf100_gr *);
void gp100_gr_init_rop_active_fbps(struct gf100_gr *);
void gp100_gr_init_fecs_exceptions(struct gf100_gr *);
void gp100_gr_init_shader_exceptions(struct gf100_gr *, int, int);
extern const struct gf100_gr_func_zbc gp100_gr_zbc;
void gp100_gr_zbc_clear_color(struct gf100_gr *, int);
void gp100_gr_zbc_clear_depth(struct gf100_gr *, int);
void gp102_gr_init_swdx_pes_mask(struct gf100_gr *);
......
......@@ -134,6 +134,7 @@ gf104_gr = {
.gpccs.ucode = &gf100_gr_gpccs_ucode,
.rops = gf100_gr_rops,
.grctx = &gf104_grctx,
.zbc = &gf100_gr_zbc,
.sclass = {
{ -1, -1, FERMI_TWOD_A },
{ -1, -1, FERMI_MEMORY_TO_MEMORY_FORMAT_A },
......
......@@ -132,6 +132,7 @@ gf108_gr = {
.gpccs.ucode = &gf100_gr_gpccs_ucode,
.rops = gf100_gr_rops,
.grctx = &gf108_grctx,
.zbc = &gf100_gr_zbc,
.sclass = {
{ -1, -1, FERMI_TWOD_A },
{ -1, -1, FERMI_MEMORY_TO_MEMORY_FORMAT_A },
......
......@@ -106,6 +106,7 @@ gf110_gr = {
.gpccs.ucode = &gf100_gr_gpccs_ucode,
.rops = gf100_gr_rops,
.grctx = &gf110_grctx,
.zbc = &gf100_gr_zbc,
.sclass = {
{ -1, -1, FERMI_TWOD_A },
{ -1, -1, FERMI_MEMORY_TO_MEMORY_FORMAT_A },
......
......@@ -171,6 +171,7 @@ gf117_gr = {
.rops = gf100_gr_rops,
.ppc_nr = 1,
.grctx = &gf117_grctx,
.zbc = &gf100_gr_zbc,
.sclass = {
{ -1, -1, FERMI_TWOD_A },
{ -1, -1, FERMI_MEMORY_TO_MEMORY_FORMAT_A },
......
......@@ -197,6 +197,7 @@ gf119_gr = {
.gpccs.ucode = &gf100_gr_gpccs_ucode,
.rops = gf100_gr_rops,
.grctx = &gf119_grctx,
.zbc = &gf100_gr_zbc,
.sclass = {
{ -1, -1, FERMI_TWOD_A },
{ -1, -1, FERMI_MEMORY_TO_MEMORY_FORMAT_A },
......
......@@ -479,6 +479,7 @@ gk104_gr = {
.ppc_nr = 1,
.grctx = &gk104_grctx,
.clkgate_pack = gk104_clkgate_pack,
.zbc = &gf100_gr_zbc,
.sclass = {
{ -1, -1, FERMI_TWOD_A },
{ -1, -1, KEPLER_INLINE_TO_MEMORY_A },
......
......@@ -375,6 +375,7 @@ gk110_gr = {
.ppc_nr = 2,
.grctx = &gk110_grctx,
.clkgate_pack = gk110_clkgate_pack,
.zbc = &gf100_gr_zbc,
.sclass = {
{ -1, -1, FERMI_TWOD_A },
{ -1, -1, KEPLER_INLINE_TO_MEMORY_B },
......
......@@ -126,6 +126,7 @@ gk110b_gr = {
.rops = gf100_gr_rops,
.ppc_nr = 2,
.grctx = &gk110b_grctx,
.zbc = &gf100_gr_zbc,
.sclass = {
{ -1, -1, FERMI_TWOD_A },
{ -1, -1, KEPLER_INLINE_TO_MEMORY_B },
......
......@@ -184,6 +184,7 @@ gk208_gr = {
.rops = gf100_gr_rops,
.ppc_nr = 1,
.grctx = &gk208_grctx,
.zbc = &gf100_gr_zbc,
.sclass = {
{ -1, -1, FERMI_TWOD_A },
{ -1, -1, KEPLER_INLINE_TO_MEMORY_B },
......
......@@ -292,6 +292,7 @@ gk20a_gr = {
.rops = gf100_gr_rops,
.ppc_nr = 1,
.grctx = &gk20a_grctx,
.zbc = &gf100_gr_zbc,
.sclass = {
{ -1, -1, FERMI_TWOD_A },
{ -1, -1, KEPLER_INLINE_TO_MEMORY_A },
......
......@@ -419,6 +419,7 @@ gm107_gr = {
.rops = gf100_gr_rops,
.ppc_nr = 2,
.grctx = &gm107_grctx,
.zbc = &gf100_gr_zbc,
.sclass = {
{ -1, -1, FERMI_TWOD_A },
{ -1, -1, KEPLER_INLINE_TO_MEMORY_B },
......
......@@ -187,6 +187,7 @@ gm200_gr = {
.tpc_nr = 4,
.ppc_nr = 2,
.grctx = &gm200_grctx,
.zbc = &gf100_gr_zbc,
.sclass = {
{ -1, -1, FERMI_TWOD_A },
{ -1, -1, KEPLER_INLINE_TO_MEMORY_B },
......
......@@ -75,6 +75,7 @@ gm20b_gr = {
.rops = gm200_gr_rops,
.ppc_nr = 1,
.grctx = &gm20b_grctx,
.zbc = &gf100_gr_zbc,
.sclass = {
{ -1, -1, FERMI_TWOD_A },
{ -1, -1, KEPLER_INLINE_TO_MEMORY_B },
......
......@@ -29,6 +29,44 @@
/*******************************************************************************
* PGRAPH engine/subdev functions
******************************************************************************/
void
gp100_gr_zbc_clear_color(struct gf100_gr *gr, int zbc)
{
struct nvkm_device *device = gr->base.engine.subdev.device;
const int znum = zbc - 1;
const u32 zoff = znum * 4;
if (gr->zbc_color[zbc].format) {
nvkm_wr32(device, 0x418010 + zoff, gr->zbc_color[zbc].ds[0]);
nvkm_wr32(device, 0x41804c + zoff, gr->zbc_color[zbc].ds[1]);
nvkm_wr32(device, 0x418088 + zoff, gr->zbc_color[zbc].ds[2]);
nvkm_wr32(device, 0x4180c4 + zoff, gr->zbc_color[zbc].ds[3]);
}
nvkm_mask(device, 0x418100 + ((znum / 4) * 4),
0x0000007f << ((znum % 4) * 7),
gr->zbc_color[zbc].format << ((znum % 4) * 7));
}
void
gp100_gr_zbc_clear_depth(struct gf100_gr *gr, int zbc)
{
struct nvkm_device *device = gr->base.engine.subdev.device;
const int znum = zbc - 1;
const u32 zoff = znum * 4;
if (gr->zbc_depth[zbc].format)
nvkm_wr32(device, 0x418110 + zoff, gr->zbc_depth[zbc].ds);
nvkm_mask(device, 0x41814c + ((znum / 4) * 4),
0x0000007f << ((znum % 4) * 7),
gr->zbc_depth[zbc].format << ((znum % 4) * 7));
}
const struct gf100_gr_func_zbc
gp100_gr_zbc = {
.clear_color = gp100_gr_zbc_clear_color,
.clear_depth = gp100_gr_zbc_clear_depth,
};
void
gp100_gr_init_shader_exceptions(struct gf100_gr *gr, int gpc, int tpc)
......@@ -87,6 +125,7 @@ gp100_gr = {
.tpc_nr = 5,
.ppc_nr = 2,
.grctx = &gp100_grctx,
.zbc = &gp100_gr_zbc,
.sclass = {
{ -1, -1, FERMI_TWOD_A },
{ -1, -1, KEPLER_INLINE_TO_MEMORY_B },
......
......@@ -65,6 +65,7 @@ gp102_gr = {
.tpc_nr = 5,
.ppc_nr = 3,
.grctx = &gp102_grctx,
.zbc = &gp100_gr_zbc,
.sclass = {
{ -1, -1, FERMI_TWOD_A },
{ -1, -1, KEPLER_INLINE_TO_MEMORY_B },
......
......@@ -49,6 +49,7 @@ gp104_gr = {
.tpc_nr = 5,
.ppc_nr = 3,
.grctx = &gp104_grctx,
.zbc = &gp100_gr_zbc,
.sclass = {
{ -1, -1, FERMI_TWOD_A },
{ -1, -1, KEPLER_INLINE_TO_MEMORY_B },
......
......@@ -51,6 +51,7 @@ gp107_gr = {
.tpc_nr = 3,
.ppc_nr = 1,
.grctx = &gp107_grctx,
.zbc = &gp100_gr_zbc,
.sclass = {
{ -1, -1, FERMI_TWOD_A },
{ -1, -1, KEPLER_INLINE_TO_MEMORY_B },
......
......@@ -49,6 +49,7 @@ gp10b_gr = {
.tpc_nr = 2,
.ppc_nr = 1,
.grctx = &gp102_grctx,
.zbc = &gp100_gr_zbc,
.sclass = {
{ -1, -1, FERMI_TWOD_A },
{ -1, -1, KEPLER_INLINE_TO_MEMORY_B },
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment