[igt-dev] [PATCH i-g-t v2 3/5] lib/amd: improve readablity for MALL capability check

Aurabindo Pillai aurabindo.pillai at amd.com
Fri Nov 3 18:22:28 UTC 2023


Move the hard coded string out of the function and define
an identifier for checking MALL supported/enabled status

Signed-off-by: Aurabindo Pillai <aurabindo.pillai at amd.com>
---
 lib/igt_amd.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/igt_amd.c b/lib/igt_amd.c
index 8c736b3e2..177a1094d 100644
--- a/lib/igt_amd.c
+++ b/lib/igt_amd.c
@@ -45,6 +45,8 @@
 #define Y6 64
 #define Y7 128
 
+#define mall_supported "mall supported: yes"
+#define mall_enabled "mall supported: yes, enabled: yes"
 
 uint32_t igt_amd_create_bo(int fd, uint64_t size)
 {
@@ -1192,11 +1194,11 @@ void igt_amd_get_mall_status(int drm_fd, bool *supported, bool *enabled)
 	if (!get_dm_capabilities(drm_fd, buf, 1024))
 		return;
 
-	mall_loc = strstr(buf, "mall supported: yes");
+	mall_loc = strstr(buf, mall_supported);
 	if (mall_loc)
 		*supported = true;
 
-	mall_loc = strstr(buf, "enabled: yes");
+	mall_loc = strstr(buf, mall_enabled);
 	if (mall_loc && *supported)
 		*enabled = true;
 }
-- 
2.39.2



More information about the igt-dev mailing list