[igt-dev] [PATCH i-g-t v2] lib/debugfs: Nuke enum intel_pipe_crc_source
Ville Syrjala
ville.syrjala at linux.intel.com
Wed Feb 20 21:09:46 UTC 2019
From: Ville Syrjälä <ville.syrjala at 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.
v2: Assert the string isn't NULL (Chris)
Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
---
lib/igt_debugfs.c | 34 ++++++++++------------------------
lib/igt_debugfs.h | 38 +++-----------------------------------
2 files changed, 13 insertions(+), 59 deletions(-)
diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
index 640c78e972e9..8cbb83bd9fc9 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,12 +642,14 @@ 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];
int debugfs;
+ igt_assert(source);
+
debugfs = igt_debugfs_dir(fd);
igt_assert(debugfs != -1);
@@ -679,7 +663,8 @@ 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);
+ igt_assert(pipe_crc->source);
pipe_crc->flags = flags;
return pipe_crc;
@@ -698,7 +683,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 +701,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 +720,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 +787,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 b9cf0f813773..f8e57a6bf7b6 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
More information about the igt-dev
mailing list