Commit 4500031f authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau/ltc: split color vs depth/stencil zbc counts

These differ on Ampere.
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
Reviewed-by: default avatarLyude Paul <lyude@redhat.com>
parent 1ed02c3f
...@@ -4,7 +4,8 @@ ...@@ -4,7 +4,8 @@
#include <core/subdev.h> #include <core/subdev.h>
#include <core/mm.h> #include <core/mm.h>
#define NVKM_LTC_MAX_ZBC_CNT 16 #define NVKM_LTC_MAX_ZBC_COLOR_CNT 16
#define NVKM_LTC_MAX_ZBC_DEPTH_CNT 16
struct nvkm_ltc { struct nvkm_ltc {
const struct nvkm_ltc_func *func; const struct nvkm_ltc_func *func;
...@@ -18,11 +19,13 @@ struct nvkm_ltc { ...@@ -18,11 +19,13 @@ struct nvkm_ltc {
u32 tag_base; u32 tag_base;
struct nvkm_memory *tag_ram; struct nvkm_memory *tag_ram;
int zbc_min; int zbc_color_min;
int zbc_max; int zbc_color_max;
u32 zbc_color[NVKM_LTC_MAX_ZBC_CNT][4]; u32 zbc_color[NVKM_LTC_MAX_ZBC_COLOR_CNT][4];
u32 zbc_depth[NVKM_LTC_MAX_ZBC_CNT]; int zbc_depth_min;
u32 zbc_stencil[NVKM_LTC_MAX_ZBC_CNT]; int zbc_depth_max;
u32 zbc_depth[NVKM_LTC_MAX_ZBC_DEPTH_CNT];
u32 zbc_stencil[NVKM_LTC_MAX_ZBC_DEPTH_CNT];
}; };
void nvkm_ltc_tags_clear(struct nvkm_device *, u32 first, u32 count); void nvkm_ltc_tags_clear(struct nvkm_device *, u32 first, u32 count);
......
...@@ -67,7 +67,7 @@ gf100_gr_zbc_color_get(struct gf100_gr *gr, int format, ...@@ -67,7 +67,7 @@ gf100_gr_zbc_color_get(struct gf100_gr *gr, int format,
struct nvkm_ltc *ltc = gr->base.engine.subdev.device->ltc; struct nvkm_ltc *ltc = gr->base.engine.subdev.device->ltc;
int zbc = -ENOSPC, i; int zbc = -ENOSPC, i;
for (i = ltc->zbc_min; i <= ltc->zbc_max; i++) { for (i = ltc->zbc_color_min; i <= ltc->zbc_color_max; i++) {
if (gr->zbc_color[i].format) { if (gr->zbc_color[i].format) {
if (gr->zbc_color[i].format != format) if (gr->zbc_color[i].format != format)
continue; continue;
...@@ -114,7 +114,7 @@ gf100_gr_zbc_depth_get(struct gf100_gr *gr, int format, ...@@ -114,7 +114,7 @@ gf100_gr_zbc_depth_get(struct gf100_gr *gr, int format,
struct nvkm_ltc *ltc = gr->base.engine.subdev.device->ltc; struct nvkm_ltc *ltc = gr->base.engine.subdev.device->ltc;
int zbc = -ENOSPC, i; int zbc = -ENOSPC, i;
for (i = ltc->zbc_min; i <= ltc->zbc_max; i++) { for (i = ltc->zbc_depth_min; i <= ltc->zbc_depth_max; i++) {
if (gr->zbc_depth[i].format) { if (gr->zbc_depth[i].format) {
if (gr->zbc_depth[i].format != format) if (gr->zbc_depth[i].format != format)
continue; continue;
...@@ -955,7 +955,7 @@ gf100_gr_zbc_init(struct gf100_gr *gr) ...@@ -955,7 +955,7 @@ gf100_gr_zbc_init(struct gf100_gr *gr)
const u32 f32_1[] = { 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, const u32 f32_1[] = { 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000,
0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000 }; 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000 };
struct nvkm_ltc *ltc = gr->base.engine.subdev.device->ltc; struct nvkm_ltc *ltc = gr->base.engine.subdev.device->ltc;
int index, c = ltc->zbc_min, d = ltc->zbc_min, s = ltc->zbc_min; int index, c = ltc->zbc_color_min, d = ltc->zbc_depth_min, s = ltc->zbc_depth_min;
if (!gr->zbc_color[0].format) { if (!gr->zbc_color[0].format) {
gf100_gr_zbc_color_get(gr, 1, & zero[0], &zero[4]); c++; gf100_gr_zbc_color_get(gr, 1, & zero[0], &zero[4]); c++;
...@@ -971,13 +971,13 @@ gf100_gr_zbc_init(struct gf100_gr *gr) ...@@ -971,13 +971,13 @@ gf100_gr_zbc_init(struct gf100_gr *gr)
} }
} }
for (index = c; index <= ltc->zbc_max; index++) for (index = c; index <= ltc->zbc_color_max; index++)
gr->func->zbc->clear_color(gr, index); gr->func->zbc->clear_color(gr, index);
for (index = d; index <= ltc->zbc_max; index++) for (index = d; index <= ltc->zbc_depth_max; index++)
gr->func->zbc->clear_depth(gr, index); gr->func->zbc->clear_depth(gr, index);
if (gr->func->zbc->clear_stencil) { if (gr->func->zbc->clear_stencil) {
for (index = s; index <= ltc->zbc_max; index++) for (index = s; index <= ltc->zbc_depth_max; index++)
gr->func->zbc->clear_stencil(gr, index); gr->func->zbc->clear_stencil(gr, index);
} }
} }
......
...@@ -105,9 +105,9 @@ struct gf100_gr { ...@@ -105,9 +105,9 @@ struct gf100_gr {
struct gf100_gr_pack *bundle; struct gf100_gr_pack *bundle;
struct gf100_gr_pack *method; struct gf100_gr_pack *method;
struct gf100_gr_zbc_color zbc_color[NVKM_LTC_MAX_ZBC_CNT]; struct gf100_gr_zbc_color zbc_color[NVKM_LTC_MAX_ZBC_COLOR_CNT];
struct gf100_gr_zbc_depth zbc_depth[NVKM_LTC_MAX_ZBC_CNT]; struct gf100_gr_zbc_depth zbc_depth[NVKM_LTC_MAX_ZBC_DEPTH_CNT];
struct gf100_gr_zbc_stencil zbc_stencil[NVKM_LTC_MAX_ZBC_CNT]; struct gf100_gr_zbc_stencil zbc_stencil[NVKM_LTC_MAX_ZBC_DEPTH_CNT];
u8 rop_nr; u8 rop_nr;
u8 gpc_nr; u8 gpc_nr;
......
...@@ -47,7 +47,7 @@ gp102_gr_zbc_stencil_get(struct gf100_gr *gr, int format, ...@@ -47,7 +47,7 @@ gp102_gr_zbc_stencil_get(struct gf100_gr *gr, int format,
struct nvkm_ltc *ltc = gr->base.engine.subdev.device->ltc; struct nvkm_ltc *ltc = gr->base.engine.subdev.device->ltc;
int zbc = -ENOSPC, i; int zbc = -ENOSPC, i;
for (i = ltc->zbc_min; i <= ltc->zbc_max; i++) { for (i = ltc->zbc_depth_min; i <= ltc->zbc_depth_max; i++) {
if (gr->zbc_stencil[i].format) { if (gr->zbc_stencil[i].format) {
if (gr->zbc_stencil[i].format != format) if (gr->zbc_stencil[i].format != format)
continue; continue;
......
...@@ -97,8 +97,10 @@ nvkm_ltc_init(struct nvkm_subdev *subdev) ...@@ -97,8 +97,10 @@ nvkm_ltc_init(struct nvkm_subdev *subdev)
struct nvkm_ltc *ltc = nvkm_ltc(subdev); struct nvkm_ltc *ltc = nvkm_ltc(subdev);
int i; int i;
for (i = ltc->zbc_min; i <= ltc->zbc_max; i++) { for (i = ltc->zbc_color_min; i <= ltc->zbc_color_max; i++)
ltc->func->zbc_clear_color(ltc, i, ltc->zbc_color[i]); ltc->func->zbc_clear_color(ltc, i, ltc->zbc_color[i]);
for (i = ltc->zbc_depth_min; i <= ltc->zbc_depth_max; i++) {
ltc->func->zbc_clear_depth(ltc, i, ltc->zbc_depth[i]); ltc->func->zbc_clear_depth(ltc, i, ltc->zbc_depth[i]);
if (ltc->func->zbc_clear_stencil) if (ltc->func->zbc_clear_stencil)
ltc->func->zbc_clear_stencil(ltc, i, ltc->zbc_stencil[i]); ltc->func->zbc_clear_stencil(ltc, i, ltc->zbc_stencil[i]);
...@@ -137,7 +139,9 @@ nvkm_ltc_new_(const struct nvkm_ltc_func *func, struct nvkm_device *device, ...@@ -137,7 +139,9 @@ nvkm_ltc_new_(const struct nvkm_ltc_func *func, struct nvkm_device *device,
nvkm_subdev_ctor(&nvkm_ltc, device, type, inst, &ltc->subdev); nvkm_subdev_ctor(&nvkm_ltc, device, type, inst, &ltc->subdev);
ltc->func = func; ltc->func = func;
mutex_init(&ltc->mutex); mutex_init(&ltc->mutex);
ltc->zbc_min = 1; /* reserve 0 for disabled */ ltc->zbc_color_min = 1; /* reserve 0 for disabled */
ltc->zbc_max = min(func->zbc, NVKM_LTC_MAX_ZBC_CNT) - 1; ltc->zbc_color_max = min(func->zbc_color, NVKM_LTC_MAX_ZBC_COLOR_CNT) - 1;
ltc->zbc_depth_min = 1; /* reserve 0 for disabled */
ltc->zbc_depth_max = min(func->zbc_depth, NVKM_LTC_MAX_ZBC_DEPTH_CNT) - 1;
return 0; return 0;
} }
...@@ -241,7 +241,8 @@ gf100_ltc = { ...@@ -241,7 +241,8 @@ gf100_ltc = {
.intr = gf100_ltc_intr, .intr = gf100_ltc_intr,
.cbc_clear = gf100_ltc_cbc_clear, .cbc_clear = gf100_ltc_cbc_clear,
.cbc_wait = gf100_ltc_cbc_wait, .cbc_wait = gf100_ltc_cbc_wait,
.zbc = 16, .zbc_color = 16,
.zbc_depth = 16,
.zbc_clear_color = gf100_ltc_zbc_clear_color, .zbc_clear_color = gf100_ltc_zbc_clear_color,
.zbc_clear_depth = gf100_ltc_zbc_clear_depth, .zbc_clear_depth = gf100_ltc_zbc_clear_depth,
.invalidate = gf100_ltc_invalidate, .invalidate = gf100_ltc_invalidate,
......
...@@ -42,7 +42,8 @@ gk104_ltc = { ...@@ -42,7 +42,8 @@ gk104_ltc = {
.intr = gf100_ltc_intr, .intr = gf100_ltc_intr,
.cbc_clear = gf100_ltc_cbc_clear, .cbc_clear = gf100_ltc_cbc_clear,
.cbc_wait = gf100_ltc_cbc_wait, .cbc_wait = gf100_ltc_cbc_wait,
.zbc = 16, .zbc_color = 16,
.zbc_depth = 16,
.zbc_clear_color = gf100_ltc_zbc_clear_color, .zbc_clear_color = gf100_ltc_zbc_clear_color,
.zbc_clear_depth = gf100_ltc_zbc_clear_depth, .zbc_clear_depth = gf100_ltc_zbc_clear_depth,
.invalidate = gf100_ltc_invalidate, .invalidate = gf100_ltc_invalidate,
......
...@@ -137,7 +137,8 @@ gm107_ltc = { ...@@ -137,7 +137,8 @@ gm107_ltc = {
.intr = gm107_ltc_intr, .intr = gm107_ltc_intr,
.cbc_clear = gm107_ltc_cbc_clear, .cbc_clear = gm107_ltc_cbc_clear,
.cbc_wait = gm107_ltc_cbc_wait, .cbc_wait = gm107_ltc_cbc_wait,
.zbc = 16, .zbc_color = 16,
.zbc_depth = 16,
.zbc_clear_color = gm107_ltc_zbc_clear_color, .zbc_clear_color = gm107_ltc_zbc_clear_color,
.zbc_clear_depth = gm107_ltc_zbc_clear_depth, .zbc_clear_depth = gm107_ltc_zbc_clear_depth,
.invalidate = gf100_ltc_invalidate, .invalidate = gf100_ltc_invalidate,
......
...@@ -49,7 +49,8 @@ gm200_ltc = { ...@@ -49,7 +49,8 @@ gm200_ltc = {
.intr = gm107_ltc_intr, .intr = gm107_ltc_intr,
.cbc_clear = gm107_ltc_cbc_clear, .cbc_clear = gm107_ltc_cbc_clear,
.cbc_wait = gm107_ltc_cbc_wait, .cbc_wait = gm107_ltc_cbc_wait,
.zbc = 16, .zbc_color = 16,
.zbc_depth = 16,
.zbc_clear_color = gm107_ltc_zbc_clear_color, .zbc_clear_color = gm107_ltc_zbc_clear_color,
.zbc_clear_depth = gm107_ltc_zbc_clear_depth, .zbc_clear_depth = gm107_ltc_zbc_clear_depth,
.invalidate = gf100_ltc_invalidate, .invalidate = gf100_ltc_invalidate,
......
...@@ -61,7 +61,8 @@ gp100_ltc = { ...@@ -61,7 +61,8 @@ gp100_ltc = {
.intr = gp100_ltc_intr, .intr = gp100_ltc_intr,
.cbc_clear = gm107_ltc_cbc_clear, .cbc_clear = gm107_ltc_cbc_clear,
.cbc_wait = gm107_ltc_cbc_wait, .cbc_wait = gm107_ltc_cbc_wait,
.zbc = 16, .zbc_color = 16,
.zbc_depth = 16,
.zbc_clear_color = gm107_ltc_zbc_clear_color, .zbc_clear_color = gm107_ltc_zbc_clear_color,
.zbc_clear_depth = gm107_ltc_zbc_clear_depth, .zbc_clear_depth = gm107_ltc_zbc_clear_depth,
.invalidate = gf100_ltc_invalidate, .invalidate = gf100_ltc_invalidate,
......
...@@ -36,7 +36,8 @@ gp102_ltc = { ...@@ -36,7 +36,8 @@ gp102_ltc = {
.intr = gp100_ltc_intr, .intr = gp100_ltc_intr,
.cbc_clear = gm107_ltc_cbc_clear, .cbc_clear = gm107_ltc_cbc_clear,
.cbc_wait = gm107_ltc_cbc_wait, .cbc_wait = gm107_ltc_cbc_wait,
.zbc = 16, .zbc_color = 16,
.zbc_depth = 16,
.zbc_clear_color = gm107_ltc_zbc_clear_color, .zbc_clear_color = gm107_ltc_zbc_clear_color,
.zbc_clear_depth = gm107_ltc_zbc_clear_depth, .zbc_clear_depth = gm107_ltc_zbc_clear_depth,
.zbc_clear_stencil = gp102_ltc_zbc_clear_stencil, .zbc_clear_stencil = gp102_ltc_zbc_clear_stencil,
......
...@@ -50,7 +50,8 @@ gp10b_ltc = { ...@@ -50,7 +50,8 @@ gp10b_ltc = {
.intr = gp100_ltc_intr, .intr = gp100_ltc_intr,
.cbc_clear = gm107_ltc_cbc_clear, .cbc_clear = gm107_ltc_cbc_clear,
.cbc_wait = gm107_ltc_cbc_wait, .cbc_wait = gm107_ltc_cbc_wait,
.zbc = 16, .zbc_color = 16,
.zbc_depth = 16,
.zbc_clear_color = gm107_ltc_zbc_clear_color, .zbc_clear_color = gm107_ltc_zbc_clear_color,
.zbc_clear_depth = gm107_ltc_zbc_clear_depth, .zbc_clear_depth = gm107_ltc_zbc_clear_depth,
.zbc_clear_stencil = gp102_ltc_zbc_clear_stencil, .zbc_clear_stencil = gp102_ltc_zbc_clear_stencil,
......
...@@ -16,7 +16,8 @@ struct nvkm_ltc_func { ...@@ -16,7 +16,8 @@ struct nvkm_ltc_func {
void (*cbc_clear)(struct nvkm_ltc *, u32 start, u32 limit); void (*cbc_clear)(struct nvkm_ltc *, u32 start, u32 limit);
void (*cbc_wait)(struct nvkm_ltc *); void (*cbc_wait)(struct nvkm_ltc *);
int zbc; int zbc_color;
int zbc_depth;
void (*zbc_clear_color)(struct nvkm_ltc *, int, const u32[4]); void (*zbc_clear_color)(struct nvkm_ltc *, int, const u32[4]);
void (*zbc_clear_depth)(struct nvkm_ltc *, int, const u32); void (*zbc_clear_depth)(struct nvkm_ltc *, int, const u32);
void (*zbc_clear_stencil)(struct nvkm_ltc *, int, const u32); void (*zbc_clear_stencil)(struct nvkm_ltc *, int, const u32);
......
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