public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t] lib/debugfs: Nuke enum intel_pipe_crc_source
@ 2019-02-15 13:26 Ville Syrjala via igt-dev
  2019-02-15 16:59 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Ville Syrjala via igt-dev @ 2019-02-15 13:26 UTC (permalink / raw)
  To: igt-dev

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

No one is using anything but the "auto" crc source, so the enum
listing other options is quite pointless. Let's switch to just
using the string instead of the enum. That way any hypothetical
test that wants to use a more specific crc source can just
pass in the proper string.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 lib/igt_debugfs.c | 31 +++++++------------------------
 lib/igt_debugfs.h | 38 +++-----------------------------------
 2 files changed, 10 insertions(+), 59 deletions(-)

diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
index 6cfaa97579e7..9699e76b50c3 100644
--- a/lib/igt_debugfs.c
+++ b/lib/igt_debugfs.c
@@ -497,27 +497,9 @@ struct _igt_pipe_crc {
 	int flags;
 
 	enum pipe pipe;
-	enum intel_pipe_crc_source source;
+	char *source;
 };
 
-static const char *pipe_crc_sources[] = {
-	"none",
-	"plane1",
-	"plane2",
-	"pf",
-	"pipe",
-	"TV",
-	"DP-B",
-	"DP-C",
-	"DP-D",
-	"auto"
-};
-
-static const char *pipe_crc_source_name(enum intel_pipe_crc_source source)
-{
-        return pipe_crc_sources[source];
-}
-
 /**
  * igt_require_pipe_crc:
  *
@@ -660,7 +642,7 @@ void igt_require_hpd_storm_ctl(int drm_fd)
 }
 
 static igt_pipe_crc_t *
-pipe_crc_new(int fd, enum pipe pipe, enum intel_pipe_crc_source source, int flags)
+pipe_crc_new(int fd, enum pipe pipe, const char *source, int flags)
 {
 	igt_pipe_crc_t *pipe_crc;
 	char buf[128];
@@ -679,7 +661,7 @@ pipe_crc_new(int fd, enum pipe pipe, enum intel_pipe_crc_source source, int flag
 	pipe_crc->fd = fd;
 	pipe_crc->dir = debugfs;
 	pipe_crc->pipe = pipe;
-	pipe_crc->source = source;
+	pipe_crc->source = strdup(source);
 	pipe_crc->flags = flags;
 
 	return pipe_crc;
@@ -698,7 +680,7 @@ pipe_crc_new(int fd, enum pipe pipe, enum intel_pipe_crc_source source, int flag
  * least INTEL_PIPE_CRC_SOURCE_AUTO everywhere.
  */
 igt_pipe_crc_t *
-igt_pipe_crc_new(int fd, enum pipe pipe, enum intel_pipe_crc_source source)
+igt_pipe_crc_new(int fd, enum pipe pipe, const char *source)
 {
 	return pipe_crc_new(fd, pipe, source, O_RDONLY);
 }
@@ -716,7 +698,7 @@ igt_pipe_crc_new(int fd, enum pipe pipe, enum intel_pipe_crc_source source)
  * least INTEL_PIPE_CRC_SOURCE_AUTO everywhere.
  */
 igt_pipe_crc_t *
-igt_pipe_crc_new_nonblock(int fd, enum pipe pipe, enum intel_pipe_crc_source source)
+igt_pipe_crc_new_nonblock(int fd, enum pipe pipe, const char *source)
 {
 	return pipe_crc_new(fd, pipe, source, O_RDONLY | O_NONBLOCK);
 }
@@ -735,6 +717,7 @@ void igt_pipe_crc_free(igt_pipe_crc_t *pipe_crc)
 	close(pipe_crc->ctl_fd);
 	close(pipe_crc->crc_fd);
 	close(pipe_crc->dir);
+	free(pipe_crc->source);
 	free(pipe_crc);
 }
 
@@ -801,7 +784,7 @@ static void read_one_crc(igt_pipe_crc_t *pipe_crc, igt_crc_t *out)
  */
 void igt_pipe_crc_start(igt_pipe_crc_t *pipe_crc)
 {
-	const char *src = pipe_crc_source_name(pipe_crc->source);
+	const char *src = pipe_crc->source;
 	struct pollfd pfd;
 	char buf[32];
 
diff --git a/lib/igt_debugfs.h b/lib/igt_debugfs.h
index 1233cd8f7a07..0b92f91c248a 100644
--- a/lib/igt_debugfs.h
+++ b/lib/igt_debugfs.h
@@ -82,39 +82,7 @@ typedef struct {
 	uint32_t crc[DRM_MAX_CRC_NR];
 } igt_crc_t;
 
-/**
- * intel_pipe_crc_source:
- * @INTEL_PIPE_CRC_SOURCE_NONE: No source
- * @INTEL_PIPE_CRC_SOURCE_PLANE1: Plane 1
- * @INTEL_PIPE_CRC_SOURCE_PLANE2: Plane 2
- * @INTEL_PIPE_CRC_SOURCE_PF: Panel Filter
- * @INTEL_PIPE_CRC_SOURCE_PIPE: Pipe
- * @INTEL_PIPE_CRC_SOURCE_TV: TV
- * @INTEL_PIPE_CRC_SOURCE_DP_B: DisplayPort B
- * @INTEL_PIPE_CRC_SOURCE_DP_C: DisplayPort C
- * @INTEL_PIPE_CRC_SOURCE_DP_D: DisplayPort D
- * @INTEL_PIPE_CRC_SOURCE_AUTO: Automatic source selection
- * @INTEL_PIPE_CRC_SOURCE_MAX: Number of available sources
- *
- * Enumeration of all supported pipe CRC sources. Not all platforms and all
- * outputs support all of them. Generic tests should just use
- * INTEL_PIPE_CRC_SOURCE_AUTO. It should always map to an end-of-pipe CRC
- * suitable for checking planes, cursor, color correction and any other
- * output-agnostic features.
- */
-enum intel_pipe_crc_source {
-        INTEL_PIPE_CRC_SOURCE_NONE,
-        INTEL_PIPE_CRC_SOURCE_PLANE1,
-        INTEL_PIPE_CRC_SOURCE_PLANE2,
-        INTEL_PIPE_CRC_SOURCE_PF,
-        INTEL_PIPE_CRC_SOURCE_PIPE,
-        INTEL_PIPE_CRC_SOURCE_TV,
-        INTEL_PIPE_CRC_SOURCE_DP_B,
-        INTEL_PIPE_CRC_SOURCE_DP_C,
-        INTEL_PIPE_CRC_SOURCE_DP_D,
-        INTEL_PIPE_CRC_SOURCE_AUTO,
-        INTEL_PIPE_CRC_SOURCE_MAX,
-};
+#define INTEL_PIPE_CRC_SOURCE_AUTO "auto"
 
 void igt_assert_crc_equal(const igt_crc_t *a, const igt_crc_t *b);
 bool igt_check_crc_equal(const igt_crc_t *a, const igt_crc_t *b);
@@ -123,9 +91,9 @@ char *igt_crc_to_string(igt_crc_t *crc);
 
 void igt_require_pipe_crc(int fd);
 igt_pipe_crc_t *
-igt_pipe_crc_new(int fd, enum pipe pipe, enum intel_pipe_crc_source source);
+igt_pipe_crc_new(int fd, enum pipe pipe, const char *source);
 igt_pipe_crc_t *
-igt_pipe_crc_new_nonblock(int fd, enum pipe pipe, enum intel_pipe_crc_source source);
+igt_pipe_crc_new_nonblock(int fd, enum pipe pipe, const char *source);
 void igt_pipe_crc_free(igt_pipe_crc_t *pipe_crc);
 void igt_pipe_crc_start(igt_pipe_crc_t *pipe_crc);
 void igt_pipe_crc_stop(igt_pipe_crc_t *pipe_crc);
-- 
2.19.2

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-02-21  2:20 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-15 13:26 [igt-dev] [PATCH i-g-t] lib/debugfs: Nuke enum intel_pipe_crc_source Ville Syrjala via igt-dev
2019-02-15 16:59 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2019-02-15 19:41 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2019-02-15 19:54 ` [igt-dev] [PATCH i-g-t] " Chris Wilson
2019-02-20 21:09 ` [igt-dev] [PATCH i-g-t v2] " Ville Syrjala
2019-02-20 21:54 ` [igt-dev] ✓ Fi.CI.BAT: success for lib/debugfs: Nuke enum intel_pipe_crc_source (rev2) Patchwork
2019-02-21  2:20 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox