diff options
author | Damien Lespiau <damien.lespiau@intel.com> | 2013-10-15 18:55:35 +0100 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2013-10-16 13:32:13 +0200 |
commit | b94dec877f97d22a27096d0c3d399c1427157aa2 (patch) | |
tree | 21de4ddd7131b9fcfacaf7bf50978c34be3488c3 /drivers/gpu/drm/i915/i915_debugfs.c | |
parent | e5f75aca193837c57a886c3fb83442fda88142e9 (diff) | |
download | lwn-b94dec877f97d22a27096d0c3d399c1427157aa2.tar.gz lwn-b94dec877f97d22a27096d0c3d399c1427157aa2.zip |
drm/i915: Generalize the CRC command format for future work
Let's move from writing 'A plane1' to 'pipe A plane1' to
i915_pipe_crc_ctl. This will allow us to extend the interface to
transcoders or DDIs in the future.
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/i915/i915_debugfs.c')
-rw-r--r-- | drivers/gpu/drm/i915/i915_debugfs.c | 56 |
1 files changed, 43 insertions, 13 deletions
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index 53a3f2224d1f..c609783dd9d3 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c @@ -1864,14 +1864,15 @@ static int pipe_crc_set_source(struct drm_device *dev, enum pipe pipe, /* * Parse pipe CRC command strings: - * command: wsp* pipe wsp+ source wsp* - * pipe: (A | B | C) + * command: wsp* object wsp+ name wsp+ source wsp* + * object: 'pipe' + * name: (A | B | C) * source: (none | plane1 | plane2 | pf) * wsp: (#0x20 | #0x9 | #0xA)+ * * eg.: - * "A plane1" -> Start CRC computations on plane1 of pipe A - * "A none" -> Stop CRC + * "pipe A plane1" -> Start CRC computations on plane1 of pipe A + * "pipe A none" -> Stop CRC */ static int pipe_crc_ctl_tokenize(char *buf, char *words[], int max_words) { @@ -1904,6 +1905,28 @@ static int pipe_crc_ctl_tokenize(char *buf, char *words[], int max_words) return n_words; } +enum intel_pipe_crc_object { + PIPE_CRC_OBJECT_PIPE, +}; + +static const char *pipe_crc_objects[] = { + "pipe", +}; + +static int +pipe_crc_ctl_parse_object(const char *buf, enum intel_pipe_crc_object *object) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(pipe_crc_objects); i++) + if (!strcmp(buf, pipe_crc_objects[i])) { + *object = i; + return 0; + } + + return -EINVAL; +} + static int pipe_crc_ctl_parse_pipe(const char *buf, enum pipe *pipe) { const char name = buf[0]; @@ -1932,25 +1955,32 @@ pipe_crc_ctl_parse_source(const char *buf, enum intel_pipe_crc_source *source) static int pipe_crc_ctl_parse(struct drm_device *dev, char *buf, size_t len) { -#define MAX_WORDS 2 +#define N_WORDS 3 int n_words; - char *words[MAX_WORDS]; + char *words[N_WORDS]; enum pipe pipe; + enum intel_pipe_crc_object object; enum intel_pipe_crc_source source; - n_words = pipe_crc_ctl_tokenize(buf, words, MAX_WORDS); - if (n_words != 2) { - DRM_DEBUG_DRIVER("tokenize failed, a command is 2 words\n"); + n_words = pipe_crc_ctl_tokenize(buf, words, N_WORDS); + if (n_words != N_WORDS) { + DRM_DEBUG_DRIVER("tokenize failed, a command is %d words\n", + N_WORDS); + return -EINVAL; + } + + if (pipe_crc_ctl_parse_object(words[0], &object) < 0) { + DRM_DEBUG_DRIVER("unknown object %s\n", words[0]); return -EINVAL; } - if (pipe_crc_ctl_parse_pipe(words[0], &pipe) < 0) { - DRM_DEBUG_DRIVER("unknown pipe %s\n", words[0]); + if (pipe_crc_ctl_parse_pipe(words[1], &pipe) < 0) { + DRM_DEBUG_DRIVER("unknown pipe %s\n", words[1]); return -EINVAL; } - if (pipe_crc_ctl_parse_source(words[1], &source) < 0) { - DRM_DEBUG_DRIVER("unknown source %s\n", words[1]); + if (pipe_crc_ctl_parse_source(words[2], &source) < 0) { + DRM_DEBUG_DRIVER("unknown source %s\n", words[2]); return -EINVAL; } |