[igt-dev] [PATCH i-g-t 1/4] lib/amd: improve MALL capabilities checking logic

Aurabindo Pillai aurabindo.pillai at amd.com
Thu Nov 2 19:59:57 UTC 2023


improve strstr() arguments to be more accurate when
multiple features are exposed in DM capabilities end point

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

diff --git a/lib/igt_amd.c b/lib/igt_amd.c
index 84c6d7545..85afec99e 100644
--- a/lib/igt_amd.c
+++ b/lib/igt_amd.c
@@ -45,6 +45,12 @@
 #define Y6 64
 #define Y7 128
 
+#define SUPP "supported: yes"
+#define EN ", enabled: yes"
+
+#define MALL_SUPP "mall " SUPP
+#define MALL_EN MALL_SUPP EN
+
 struct dim2d
 {
     int w;
@@ -1197,11 +1203,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_SUPP);
 	if (mall_loc)
 		*supported = true;
 
-	mall_loc = strstr(buf, "enabled: yes");
+	mall_loc = strstr(buf, MALL_EN);
 	if (mall_loc && *supported)
 		*enabled = true;
 }
-- 
2.39.2



More information about the igt-dev mailing list