[igt-dev] [PATCH i-g-t v3] tests/kms_atomic_transition: Lower drm log level to avoid exceeding disk usage limit

Mohammed Thasleem mohammed.thasleem at intel.com
Thu Aug 17 16:06:01 UTC 2023


Set drm debug log level for DP messages and DRIVER messages to fix
exceeding disk usage limit in modeset-transition test cases.

v2: -Rename DEBUG_LEVEL to DRM_DEBUG_LEVEL.
    -Declared log level globally.
    -Added check for checking default log level before update.
v3: -Close sysfs_fd.

Signed-off-by: Mohammed Thasleem <mohammed.thasleem at intel.com>
---
 tests/kms_atomic_transition.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/tests/kms_atomic_transition.c b/tests/kms_atomic_transition.c
index a470eb88c..5398997b7 100644
--- a/tests/kms_atomic_transition.c
+++ b/tests/kms_atomic_transition.c
@@ -27,9 +27,11 @@
  */
 #include "igt.h"
 #include "igt_rand.h"
+#include "igt_sysfs.h"
 #include "drmtest.h"
 #include "sw_sync.h"
 #include <errno.h>
+#include <fcntl.h>
 #include <pthread.h>
 #include <stdbool.h>
 #include <stdio.h>
@@ -44,13 +46,17 @@
 #define DRM_CAP_CURSOR_HEIGHT 0x9
 #endif
 
+#define DRM_DEBUG_LEVEL "/sys/module/drm/parameters/"
+#define LOG_LEVEL 0xa
+
 struct plane_parms {
 	struct igt_fb *fb;
 	uint32_t width, height, mask;
 };
 
 typedef struct {
-	int drm_fd;
+	int drm_fd, sysfs_fd;
+	uint32_t old_drm_log_level;
 	struct igt_fb fbs[2], argb_fb, sprite_fb;
 	igt_display_t display;
 	bool extended;
@@ -1065,6 +1071,9 @@ static void run_modeset_transition(data_t *data, int requested_outputs, bool non
 	int num_outputs = 0;
 	enum pipe pipe;
 
+	if (data->old_drm_log_level > LOG_LEVEL)
+		igt_sysfs_set_u32(data->sysfs_fd, "debug", LOG_LEVEL);
+
 	for_each_pipe(&data->display, pipe) {
 		igt_output_t *output;
 
@@ -1207,6 +1216,9 @@ igt_main_args("", long_opts, help_str, opt_handler, &data)
 
 		igt_display_require_output(&data.display);
 
+		igt_require((data.sysfs_fd = open(DRM_DEBUG_LEVEL, O_RDONLY)) >= 0);
+		data.old_drm_log_level = igt_sysfs_get_u32(data.sysfs_fd, "debug");
+
 		for_each_connected_output(&data.display, output)
 			count++;
 	}
@@ -1281,7 +1293,9 @@ igt_main_args("", long_opts, help_str, opt_handler, &data)
 	}
 
 	igt_fixture {
+		igt_sysfs_set_u32(data.sysfs_fd, "debug", data.old_drm_log_level);
 		igt_display_fini(&data.display);
 		drm_close_driver(data.drm_fd);
+		drm_close_driver(data.sysfs_fd);
 	}
 }
-- 
2.25.1



More information about the igt-dev mailing list