[PATCH i-g-t v2] tests/i915_pm_rpm: Debug patch for gitlab#5174

Swati Sharma swati2.sharma at intel.com
Fri Jul 22 05:57:41 UTC 2022


v2: debug prints

Signed-off-by: Swati Sharma <swati2.sharma at intel.com>
---
 lib/drmtest.c         |  8 +++++++-
 lib/igt_core.h        |  2 +-
 lib/igt_device_scan.c | 21 ++++++++++++++++++---
 3 files changed, 26 insertions(+), 5 deletions(-)

diff --git a/lib/drmtest.c b/lib/drmtest.c
index 09a9a2292..2fc0d0227 100644
--- a/lib/drmtest.c
+++ b/lib/drmtest.c
@@ -355,12 +355,16 @@ static int __open_driver_exact(const char *name, unsigned int chipset)
 static bool __get_card_for_nth_filter(int idx, struct igt_device_card *card)
 {
 	const char *filter;
+	bool ret;
 
 	if (igt_device_filter_count() > idx) {
 		filter = igt_device_filter_get(idx);
 		igt_debug("Looking for devices to open using filter %d: %s\n", idx, filter);
 
-		if (igt_device_card_match(filter, card)) {
+		ret = igt_device_card_match(filter, card);
+		printf("swati: ret=%d\n", ret);
+
+		if (ret) {
 			igt_debug("Filter matched %s | %s\n", card->card, card->render);
 			return true;
 		}
@@ -429,6 +433,8 @@ int __drm_open_driver_another(int idx, int chipset)
 {
 	int fd = -1;
 
+	printf("swati: idx=%d chipset=%d igt_device_filter_count()=%d\n", idx, chipset, igt_device_filter_count());
+
 	if (chipset != DRIVER_VGEM && igt_device_filter_count() > idx) {
 		struct igt_device_card card;
 		bool found;
diff --git a/lib/igt_core.h b/lib/igt_core.h
index aa98e8ed8..f2b54e0ad 100644
--- a/lib/igt_core.h
+++ b/lib/igt_core.h
@@ -1207,7 +1207,7 @@ void igt_vlog(const char *domain, enum igt_log_level level, const char *format,
  *
  * Wrapper for igt_log() for message at the IGT_LOG_DEBUG level.
  */
-#define igt_debug(f...) igt_log(IGT_LOG_DOMAIN, IGT_LOG_DEBUG, f)
+#define igt_debug(f...) igt_log(IGT_LOG_DOMAIN, IGT_LOG_INFO, f)
 
 /**
  * igt_info:
diff --git a/lib/igt_device_scan.c b/lib/igt_device_scan.c
index 5d98381f0..841b0b0c4 100644
--- a/lib/igt_device_scan.c
+++ b/lib/igt_device_scan.c
@@ -776,6 +776,7 @@ static void scan_drm_devices(void)
 	struct igt_device *dev;
 	int ret;
 
+	printf("swati: scanning drm devices\n");
 	udev = udev_new();
 	igt_assert(udev);
 
@@ -784,15 +785,20 @@ static void scan_drm_devices(void)
 
 	DBG("Scanning drm subsystem\n");
 	ret = udev_enumerate_add_match_subsystem(enumerate, "drm");
+	printf("swati: inside scan_drm_dev ret=%d\n", ret);
 	igt_assert(!ret);
 
 	ret = udev_enumerate_add_match_property(enumerate, "DEVNAME", "/dev/dri/*");
+	printf("swati: inside scan_drm_dev ret1=%d\n", ret);
 	igt_assert(!ret);
 
 	ret = udev_enumerate_scan_devices(enumerate);
+	printf("swati: inside scan_drm_dev ret3=%d\n", ret);
 	igt_assert(!ret);
 
 	devices = udev_enumerate_get_list_entry(enumerate);
+	if (devices == NULL)
+		printf("devices=NULL\n");
 	if (!devices)
 		return;
 
@@ -1645,14 +1651,15 @@ const char *igt_device_filter_get(int num)
 	if (num < 0)
 		return NULL;
 
-
 	igt_list_for_each_entry(filter, &device_filters, link) {
-		if (i == num)
+		if (i == num) {
+			printf("swati: filter->filter=%s\n", filter->filter);
 			return filter->filter;
+		}
 		i++;
 	}
 
-
+	printf("swati: returning NULL\n");
 	return NULL;
 }
 
@@ -1700,14 +1707,22 @@ static bool __igt_device_card_match(const char *filter,
 		return false;
 	memset(card, 0, sizeof(*card));
 
+	printf("swati: 1\n");
+
 	igt_devices_scan(false);
 
+	printf("swati: 2\n");
+
 	if (igt_device_filter_apply(filter) == false)
 		return false;
 
+	printf("swati: 3\n");
+
 	if (igt_list_empty(&igt_devs.filtered))
 		return false;
 
+	printf("swati: 4\n");
+
 	/* We take first one if more than one card matches filter */
 	dev = igt_list_first_entry(&igt_devs.filtered, dev, link);
 	if (request_pci_ss && !is_pci_subsystem(dev) && dev->parent
-- 
2.25.1



More information about the Intel-gfx-trybot mailing list