Skip to contentSkip to conversation

tools/intel_display_crc: fix DRM device selection

PATCH In review Jani Nikula 3 participants 3 messages Jan 29

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools/intel_display_crc: fix DRM device selection

Initialize DRM device fd to -1 to allow automatic DRM device selection in igt_debugfs_path(). By the looks of it, this has been broken for years.

While at it, make the context variable local and initialize using designated initializers.

---
 tools/intel_display_crc.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
tools/intel_display_crc.c +4 -4
index 357ffb8229f6..347a439053a8 100644
@@ -83,14 +83,14 @@ static void print_crcs(display_crc_t *ctx)
 	igt_pipe_crc_free(pipe_crc);
 }
 
-static display_crc_t ctx;
-
 int main(int argc, char **argv)
 {
+	display_crc_t ctx = {
+		.fd = -1,
+		.n_crcs = 1,
+	};
 	int opt;
 
-	ctx.n_crcs = 1;
-
 	while ((opt = getopt(argc, argv, "p:n:")) != -1) {
 		switch (opt) {
 		case 'p':
Signature · 1 line
2.47.3
Reviewed-by on v1 1/1
#1 lore raw

Hi Jani,

Quoted 8 lines · Jani Nikula

Initialize DRM device fd to -1 to allow automatic DRM device selection in igt_debugfs_path(). By the looks of it, this has been broken for years.

While at it, make the context variable local and initialize using designated initializers.

LGTM

Regards,
Kamil

Quoted 30 lines
---
 tools/intel_display_crc.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
tools/intel_display_crc.c +4 -4
index 357ffb8229f6..347a439053a8 100644
@@ -83,14 +83,14 @@ static void print_crcs(display_crc_t *ctx)
 	igt_pipe_crc_free(pipe_crc);
 }
 
-static display_crc_t ctx;
-
 int main(int argc, char **argv)
 {
+	display_crc_t ctx = {
+		.fd = -1,
+		.n_crcs = 1,
+	};
 	int opt;
 
-	ctx.n_crcs = 1;
-
 	while ((opt = getopt(argc, argv, "p:n:")) != -1) {
 		switch (opt) {
 		case 'p':
Signature · 1 line
2.47.3