[igt-dev] [PATCH i-g-t 1/3] lib/igt_power: Modify igt_power library for xe

Riana Tauro riana.tauro at intel.com
Thu Aug 17 05:52:59 UTC 2023


modify igt_pm library for xe tests. To check if a
device is dgfx the igt_power open call needs to be modified for
xe.

Signed-off-by: Riana Tauro <riana.tauro at intel.com>
---
 lib/igt_power.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/igt_power.c b/lib/igt_power.c
index 3b34be406..439d49fc3 100644
--- a/lib/igt_power.c
+++ b/lib/igt_power.c
@@ -12,6 +12,7 @@
 #include "igt_power.h"
 #include "igt_sysfs.h"
 
+#include "xe/xe_query.h"
 static const char *rapl_domains[] = { "cpu", "gpu", "pkg", "ram" };
 
 static int rapl_parse(struct rapl *r, const char *str)
@@ -99,11 +100,13 @@ static inline void rapl_close(struct rapl *r)
 int igt_power_open(int fd, struct igt_power *p, const char *domain)
 {
 	int i;
+	bool is_dgfx;
 
 	p->hwmon_fd = -1;
 	p->rapl.fd = -1;
 
-	if (gem_has_lmem(fd)) {
+	is_dgfx = is_xe_device(fd) ? xe_has_vram(fd) : gem_has_lmem(fd);
+	if (is_dgfx) {
 		if (strncmp(domain, "gpu", strlen("gpu")) == 0) {
 			p->hwmon_fd = igt_hwmon_open(fd);
 			if (p->hwmon_fd >= 0)
-- 
2.40.0



More information about the igt-dev mailing list