From e97ac38ff3b8bb8bbd10b3e44e3bbaf44b45bbd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20Ondra=C4=8Dka?= Date: Mon, 23 Feb 2026 14:12:16 +0100 Subject: [PATCH] r300: add shared HyperZ pipe-count helper Introduce r300_hyperz_pipe_count and use it in\nr300_setup_hyperz_properties.\n\nRV530 selects pipe topology from NUM_Z_PIPES, while other families use\nNUM_GB_PIPES. Keeping this in one helper avoids duplicated family checks\nand prepares follow-up HiZ clear sizing changes to reuse the same rule. Part-of: --- src/gallium/drivers/r300/r300_screen.h | 8 ++++++++ src/gallium/drivers/r300/r300_texture_desc.c | 6 +----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/gallium/drivers/r300/r300_screen.h b/src/gallium/drivers/r300/r300_screen.h index fc7996af580..f17b9e3ee33 100644 --- a/src/gallium/drivers/r300/r300_screen.h +++ b/src/gallium/drivers/r300/r300_screen.h @@ -53,6 +53,14 @@ radeon_winsys(struct pipe_screen *screen) { return r300_screen(screen)->rws; } +static inline unsigned +r300_hyperz_pipe_count(const struct r300_screen *screen) +{ + if (screen->caps.family == CHIP_RV530) + return screen->info.r300_num_z_pipes; + return screen->info.r300_num_gb_pipes; +} + /* Debug functionality. */ /** diff --git a/src/gallium/drivers/r300/r300_texture_desc.c b/src/gallium/drivers/r300/r300_texture_desc.c index 58b3f8a0f99..bec95837950 100644 --- a/src/gallium/drivers/r300/r300_texture_desc.c +++ b/src/gallium/drivers/r300/r300_texture_desc.c @@ -366,11 +366,7 @@ static void r300_setup_hyperz_properties(struct r300_screen *screen, tex->tex.microtile) { unsigned i, pipes; - if (screen->caps.family == CHIP_RV530) { - pipes = screen->info.r300_num_z_pipes; - } else { - pipes = screen->info.r300_num_gb_pipes; - } + pipes = r300_hyperz_pipe_count(screen); for (i = 0; i <= tex->b.last_level; i++) { unsigned zcomp_numdw, zcompsize, hiz_numdw, stride, height;