From 1dfed59c4973792c930e36aef8e7e24c1cfc1b26 Mon Sep 17 00:00:00 2001
From: Kenneth Graunke <kenneth@whitecape.org>
Date: Tue, 25 Feb 2025 21:27:21 -0800
Subject: [PATCH] intel: Use devinfo->urb.min_entries[GS and TCS] for setting
 URB configs

We were not using the minimum values from devinfo for anything.  For
tessellation control, the minimum value is 0, so we continue taking
MAX2 of that with 1 when tessellation is enabled so we have at least
something guaranteed to be present.  For geometry, the minimum value
is already non-zero (and updated by the previous patch).

This will have the side-effect of raising the minimum number of URB
entries for geometry stages.  This is currently not known to fix
anything, but should be more closely following the documentation.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33764>
---
 src/intel/common/intel_urb_config.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/src/intel/common/intel_urb_config.c b/src/intel/common/intel_urb_config.c
index 600a4607eb61c..82ba380469037 100644
--- a/src/intel/common/intel_urb_config.c
+++ b/src/intel/common/intel_urb_config.c
@@ -122,17 +122,11 @@ intel_get_urb_config(const struct intel_device_info *devinfo,
       [MESA_SHADER_VERTEX] = tess_present && devinfo->ver == 8 ?
          192 : devinfo->urb.min_entries[MESA_SHADER_VERTEX],
 
-      /* There are two constraints on the minimum amount of URB space we can
-       * allocate:
-       *
-       * (1) We need room for at least 2 URB entries, since we always operate
-       * the GS in DUAL_OBJECT mode.
-       *
-       * (2) We can't allocate less than nr_gs_entries_granularity.
-       */
-      [MESA_SHADER_GEOMETRY] = gs_present ? 2 : 0,
+      [MESA_SHADER_GEOMETRY] = gs_present ?
+         devinfo->urb.min_entries[MESA_SHADER_GEOMETRY] : 0,
 
-      [MESA_SHADER_TESS_CTRL] = tess_present ? 1 : 0,
+      [MESA_SHADER_TESS_CTRL] = tess_present ?
+         MAX2(devinfo->urb.min_entries[MESA_SHADER_TESS_CTRL], 1) : 0,
 
       [MESA_SHADER_TESS_EVAL] = tess_present ?
          devinfo->urb.min_entries[MESA_SHADER_TESS_EVAL] : 0,
-- 
GitLab