Re: [igt-dev] [PATCH i-g-t] lib/debugfs: Nuke enum intel_pipe_crc_source

Chris Wilson
2019-02-15T19:54:29Z

Quoting Ville Syrjala via igt-dev (2019-02-15 13:26:38)
> 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);

xstrdup()
igt_assert(pipe_crc->source);

Probably merits an igt_assert(source) on entry as well.

> -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"

Ah that's the magic behind the patch being so tiny.

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris