]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/nouveau/ltc: split color vs depth/stencil zbc counts
authorBen Skeggs <bskeggs@redhat.com>
Wed, 1 Jun 2022 10:48:03 +0000 (20:48 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Wed, 9 Nov 2022 00:45:10 +0000 (10:45 +1000)
These differ on Ampere.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
13 files changed:
drivers/gpu/drm/nouveau/include/nvkm/subdev/ltc.h
drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.c
drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.h
drivers/gpu/drm/nouveau/nvkm/engine/gr/gp102.c
drivers/gpu/drm/nouveau/nvkm/subdev/ltc/base.c
drivers/gpu/drm/nouveau/nvkm/subdev/ltc/gf100.c
drivers/gpu/drm/nouveau/nvkm/subdev/ltc/gk104.c
drivers/gpu/drm/nouveau/nvkm/subdev/ltc/gm107.c
drivers/gpu/drm/nouveau/nvkm/subdev/ltc/gm200.c
drivers/gpu/drm/nouveau/nvkm/subdev/ltc/gp100.c
drivers/gpu/drm/nouveau/nvkm/subdev/ltc/gp102.c
drivers/gpu/drm/nouveau/nvkm/subdev/ltc/gp10b.c
drivers/gpu/drm/nouveau/nvkm/subdev/ltc/priv.h

index d32a326a9290740c26015654a7610a61f4c72848..213d5ff33cae3edb7e746a5cf62bb77b42e8474b 100644 (file)
@@ -4,7 +4,8 @@
 #include <core/subdev.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 {
        const struct nvkm_ltc_func *func;
@@ -18,11 +19,13 @@ struct nvkm_ltc {
        u32 tag_base;
        struct nvkm_memory *tag_ram;
 
-       int zbc_min;
-       int zbc_max;
-       u32 zbc_color[NVKM_LTC_MAX_ZBC_CNT][4];
-       u32 zbc_depth[NVKM_LTC_MAX_ZBC_CNT];
-       u32 zbc_stencil[NVKM_LTC_MAX_ZBC_CNT];
+       int zbc_color_min;
+       int zbc_color_max;
+       u32 zbc_color[NVKM_LTC_MAX_ZBC_COLOR_CNT][4];
+       int zbc_depth_min;
+       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);
index ee14115d669cabaa74440c118bf7de6633f72959..1a5ec366b672295901566b3a0fadabdedc8cbdd9 100644 (file)
@@ -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;
        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 != format)
                                continue;
@@ -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;
        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 != format)
                                continue;
@@ -955,7 +955,7 @@ 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, 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) {
                gf100_gr_zbc_color_get(gr, 1,  & zero[0],   &zero[4]); c++;
@@ -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);
-       for (index = d; index <= ltc->zbc_max; index++)
+       for (index = d; index <= ltc->zbc_depth_max; index++)
                gr->func->zbc->clear_depth(gr, index);
 
        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);
        }
 }
index c0038f906135567c64694cfa49d743f1cb5c1dcd..e90eb134b561fe143b379891bc8c6e706dd9943a 100644 (file)
@@ -105,9 +105,9 @@ struct gf100_gr {
        struct gf100_gr_pack *bundle;
        struct gf100_gr_pack *method;
 
-       struct gf100_gr_zbc_color zbc_color[NVKM_LTC_MAX_ZBC_CNT];
-       struct gf100_gr_zbc_depth zbc_depth[NVKM_LTC_MAX_ZBC_CNT];
-       struct gf100_gr_zbc_stencil zbc_stencil[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_DEPTH_CNT];
+       struct gf100_gr_zbc_stencil zbc_stencil[NVKM_LTC_MAX_ZBC_DEPTH_CNT];
 
        u8 rop_nr;
        u8 gpc_nr;
index 5b001f374be0b7992b8b819535b366abd058e5d1..1d1f3c0a901458a13ee8a7e4a9307dc5e689ab4f 100644 (file)
@@ -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;
        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 != format)
                                continue;
index fa683c1907955f2c561cfb6bd90787e62f464ae6..f742a7b7b1753a73066057f88093d9f6fc7e649d 100644 (file)
@@ -97,8 +97,10 @@ nvkm_ltc_init(struct nvkm_subdev *subdev)
        struct nvkm_ltc *ltc = nvkm_ltc(subdev);
        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]);
+
+       for (i = ltc->zbc_depth_min; i <= ltc->zbc_depth_max; i++) {
                ltc->func->zbc_clear_depth(ltc, i, ltc->zbc_depth[i]);
                if (ltc->func->zbc_clear_stencil)
                        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,
        nvkm_subdev_ctor(&nvkm_ltc, device, type, inst, &ltc->subdev);
        ltc->func = func;
        mutex_init(&ltc->mutex);
-       ltc->zbc_min = 1; /* reserve 0 for disabled */
-       ltc->zbc_max = min(func->zbc, NVKM_LTC_MAX_ZBC_CNT) - 1;
+       ltc->zbc_color_min = 1; /* reserve 0 for disabled */
+       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;
 }
index fd8aeafc812d4e0a39426fe8b14e07368bc20811..de71ba3c92921600d83079553baeb302c3b514b7 100644 (file)
@@ -241,7 +241,8 @@ gf100_ltc = {
        .intr = gf100_ltc_intr,
        .cbc_clear = gf100_ltc_cbc_clear,
        .cbc_wait = gf100_ltc_cbc_wait,
-       .zbc = 16,
+       .zbc_color = 16,
+       .zbc_depth = 16,
        .zbc_clear_color = gf100_ltc_zbc_clear_color,
        .zbc_clear_depth = gf100_ltc_zbc_clear_depth,
        .invalidate = gf100_ltc_invalidate,
index 94aa09244d67379cf176d6fe660b14ebd03c058f..5d61e3c6ff5904035a73b5f76268f001abb1661a 100644 (file)
@@ -42,7 +42,8 @@ gk104_ltc = {
        .intr = gf100_ltc_intr,
        .cbc_clear = gf100_ltc_cbc_clear,
        .cbc_wait = gf100_ltc_cbc_wait,
-       .zbc = 16,
+       .zbc_color = 16,
+       .zbc_depth = 16,
        .zbc_clear_color = gf100_ltc_zbc_clear_color,
        .zbc_clear_depth = gf100_ltc_zbc_clear_depth,
        .invalidate = gf100_ltc_invalidate,
index 54d1d65d5a858d4f3072a266657bb801f6d3c681..18685d849657061450dbe956fe8d39beafbf985a 100644 (file)
@@ -137,7 +137,8 @@ gm107_ltc = {
        .intr = gm107_ltc_intr,
        .cbc_clear = gm107_ltc_cbc_clear,
        .cbc_wait = gm107_ltc_cbc_wait,
-       .zbc = 16,
+       .zbc_color = 16,
+       .zbc_depth = 16,
        .zbc_clear_color = gm107_ltc_zbc_clear_color,
        .zbc_clear_depth = gm107_ltc_zbc_clear_depth,
        .invalidate = gf100_ltc_invalidate,
index 8cfdbbdd8e8d8862e565100c31ab675e15da0681..7a9464b9def5fb607f1d1f85dd5d481d96350401 100644 (file)
@@ -49,7 +49,8 @@ gm200_ltc = {
        .intr = gm107_ltc_intr,
        .cbc_clear = gm107_ltc_cbc_clear,
        .cbc_wait = gm107_ltc_cbc_wait,
-       .zbc = 16,
+       .zbc_color = 16,
+       .zbc_depth = 16,
        .zbc_clear_color = gm107_ltc_zbc_clear_color,
        .zbc_clear_depth = gm107_ltc_zbc_clear_depth,
        .invalidate = gf100_ltc_invalidate,
index a4a6cd9b435adad7c893b30c003b2f696b51d8f1..1a17a451754c3a8ab43fd1996686d4056d8ac80c 100644 (file)
@@ -61,7 +61,8 @@ gp100_ltc = {
        .intr = gp100_ltc_intr,
        .cbc_clear = gm107_ltc_cbc_clear,
        .cbc_wait = gm107_ltc_cbc_wait,
-       .zbc = 16,
+       .zbc_color = 16,
+       .zbc_depth = 16,
        .zbc_clear_color = gm107_ltc_zbc_clear_color,
        .zbc_clear_depth = gm107_ltc_zbc_clear_depth,
        .invalidate = gf100_ltc_invalidate,
index ff05d617e7f453b1ef3895261bef81b5d4824054..265a05fd5f6bca4dcf164860d094155b4036ecfc 100644 (file)
@@ -36,7 +36,8 @@ gp102_ltc = {
        .intr = gp100_ltc_intr,
        .cbc_clear = gm107_ltc_cbc_clear,
        .cbc_wait = gm107_ltc_cbc_wait,
-       .zbc = 16,
+       .zbc_color = 16,
+       .zbc_depth = 16,
        .zbc_clear_color = gm107_ltc_zbc_clear_color,
        .zbc_clear_depth = gm107_ltc_zbc_clear_depth,
        .zbc_clear_stencil = gp102_ltc_zbc_clear_stencil,
index dfebd796cb4ba1febd700c659296c75c19a12ec4..e7e8fdf3adab7a0c9454f57b8ad91f4e787bc6da 100644 (file)
@@ -50,7 +50,8 @@ gp10b_ltc = {
        .intr = gp100_ltc_intr,
        .cbc_clear = gm107_ltc_cbc_clear,
        .cbc_wait = gm107_ltc_cbc_wait,
-       .zbc = 16,
+       .zbc_color = 16,
+       .zbc_depth = 16,
        .zbc_clear_color = gm107_ltc_zbc_clear_color,
        .zbc_clear_depth = gm107_ltc_zbc_clear_depth,
        .zbc_clear_stencil = gp102_ltc_zbc_clear_stencil,
index 2bebe139005d95a045e5279b5ecbaea257d3eb64..134e90c9e8613314b9ecf37e4642df6375629a92 100644 (file)
@@ -16,7 +16,8 @@ struct nvkm_ltc_func {
        void (*cbc_clear)(struct nvkm_ltc *, u32 start, u32 limit);
        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_depth)(struct nvkm_ltc *, int, const u32);
        void (*zbc_clear_stencil)(struct nvkm_ltc *, int, const u32);