public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Ville Syrjala <ville.syrjala@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t v2] lib/debugfs: Nuke enum intel_pipe_crc_source
Date: Wed, 20 Feb 2019 23:09:46 +0200	[thread overview]
Message-ID: <20190220210946.6188-1-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <20190215132638.18978-1-ville.syrjala@linux.intel.com>

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.

v2: Assert the string isn't NULL (Chris)

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Chris Wilson <chris@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

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

  parent reply	other threads:[~2019-02-20 21:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` Ville Syrjala [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190220210946.6188-1-ville.syrjala@linux.intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox