Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH i-g-t v3 0/1] tests/xe_evict_ccs:Adjust object size as per VRAM
@ 2025-08-25  6:35 Sobin Thomas
  2025-08-25  6:35 ` [PATCH v3 i-g-t 1/1] " Sobin Thomas
  0 siblings, 1 reply; 2+ messages in thread
From: Sobin Thomas @ 2025-08-25  6:35 UTC (permalink / raw)
  To: igt-dev; +Cc: kamil.konieczny, zbigniew.kempczynski, Sobin Thomas

Some BIOS configurations do not support or enable resizable BAR,
resulting in a maximum VRAM size of 256MB. This patch adjusts the
maximum object size used in test conditions based on the available
VRAM.

Sobin Thomas (1):
  tests/xe_evict_ccs:Adjust object size as per VRAM

 tests/intel/xe_evict_ccs.c | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH v3 i-g-t 1/1] tests/xe_evict_ccs:Adjust object size as per VRAM
  2025-08-25  6:35 [PATCH i-g-t v3 0/1] tests/xe_evict_ccs:Adjust object size as per VRAM Sobin Thomas
@ 2025-08-25  6:35 ` Sobin Thomas
  0 siblings, 0 replies; 2+ messages in thread
From: Sobin Thomas @ 2025-08-25  6:35 UTC (permalink / raw)
  To: igt-dev; +Cc: kamil.konieczny, zbigniew.kempczynski, Sobin Thomas

Some BIOS configurations do not support or enable resizable BAR,
resulting in a maximum BAR size of 256MB. This patch adjusts the
maximum object size used in test conditions based on the available
VRAM.

Signed-off-by: Sobin Thomas <sobin.thomas@intel.com>
---
 tests/intel/xe_evict_ccs.c | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/tests/intel/xe_evict_ccs.c b/tests/intel/xe_evict_ccs.c
index 281d27015..8fc2308f7 100644
--- a/tests/intel/xe_evict_ccs.c
+++ b/tests/intel/xe_evict_ccs.c
@@ -343,6 +343,35 @@ static void set_config(int fd, uint32_t flags, const struct param *param,
 	igt_debug("nproc: %d, mem per proc: %dMB\n", nproc, config->mb_per_proc);
 }
 
+static void adjust_params_for_vram_size(uint64_t vram_size)
+{
+	uint64_t vram_mb = vram_size / (1024 * 1024);
+	int recommended_max_size_kb;
+	bool user_set_max_size = (params.max_size_kb != MAX_OBJ_KB);
+
+	 /* max_object_mb = VRAM_mb / 64, clamped between 2MB and 256MB
+	  * Formula works for all VRAM sizes with consistent behavior
+	  */
+	int max_object_mb = vram_mb / MIN_OBJ_KB;
+
+	max_object_mb = max_t(int, 2, min_t(int, max_object_mb, 256));
+	recommended_max_size_kb = max_object_mb * 1024;
+
+	igt_info("VRAM (%"PRIu64"MB): Calculated %d%% usage, %dMB max objects\n",
+		 vram_mb, params.vram_percent, max_object_mb);
+
+	if (user_set_max_size) {
+		igt_warn("User specified max object size (%dKB) may not be
+				optimal for %"PRIu64"MB VRAM (recommended: %dKB)\n",
+				params.max_size_kb, vram_mb, recommended_max_size_kb);
+	} else {
+		params.max_size_kb = recommended_max_size_kb;
+	}
+
+	igt_info("Final settings: %d%% VRAM, %dMB max object\n",
+		 params.vram_percent, params.max_size_kb / 1024);
+}
+
 static void evict_ccs(int fd, uint32_t flags, const struct param *param)
 {
 	struct config config;
@@ -500,6 +529,7 @@ igt_main_args("bdDn:p:s:S:V", NULL, help_str, opt_handler, NULL)
 		igt_require(xe_has_vram(fd));
 		vram_size = xe_visible_vram_size(fd, 0);
 		igt_assert(vram_size);
+		adjust_params_for_vram_size(vram_size);
 		has_flatccs = HAS_FLATCCS(intel_get_drm_devid(fd));
 	}
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-08-25  6:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-25  6:35 [PATCH i-g-t v3 0/1] tests/xe_evict_ccs:Adjust object size as per VRAM Sobin Thomas
2025-08-25  6:35 ` [PATCH v3 i-g-t 1/1] " Sobin Thomas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox