diff options
author | Toni Lönnberg <[email protected]> | 2018-11-08 14:48:20 +0200 |
---|---|---|
committer | Lionel Landwerlin <[email protected]> | 2018-11-13 15:10:12 +0000 |
commit | b00bccd01201b4673ffd1414eb80bdc63d46105f (patch) | |
tree | 0506ac16a056877022c092c618cb30f89375778f /src/intel/common/gen_decoder.c | |
parent | 8d4bb6e5cd674da31d665ea54f5a500e8c7c1a6f (diff) |
intel/decoder: Engine parameter for instructions
Preliminary work for adding handling of different pipes to gen_decoder. Each
instruction needs to have a definition describing which engine it is meant for.
If left undefined, by default, the instruction is defined for all engines.
v2: Changed to use the engine class definitions from UAPI
v3: Changed I915_ENGINE_CLASS_TO_MASK to use BITSET_BIT, change engine to
engine_mask, added check for incorrect engine and added the possibility to
define an instruction to multiple engines using the "|" as a delimiter in the
engine attribute.
v4: Fixed the memory leak.
v5: Removed an unnecessary ralloc_free().
Reviewed-by: Lionel Landwerlin <[email protected]>
Diffstat (limited to 'src/intel/common/gen_decoder.c')
-rw-r--r-- | src/intel/common/gen_decoder.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/intel/common/gen_decoder.c b/src/intel/common/gen_decoder.c index 8148b2f1489..326768fd721 100644 --- a/src/intel/common/gen_decoder.c +++ b/src/intel/common/gen_decoder.c @@ -165,6 +165,9 @@ create_group(struct parser_context *ctx, group->fixed_length = fixed_length; group->dword_length_field = NULL; group->dw_length = 0; + group->engine_mask = I915_ENGINE_CLASS_TO_MASK(I915_ENGINE_CLASS_RENDER) | + I915_ENGINE_CLASS_TO_MASK(I915_ENGINE_CLASS_VIDEO) | + I915_ENGINE_CLASS_TO_MASK(I915_ENGINE_CLASS_COPY); group->bias = 1; for (int i = 0; atts[i]; i += 2) { @@ -173,6 +176,28 @@ create_group(struct parser_context *ctx, group->dw_length = strtoul(atts[i + 1], &p, 0); } else if (strcmp(atts[i], "bias") == 0) { group->bias = strtoul(atts[i + 1], &p, 0); + } else if (strcmp(atts[i], "engine") == 0) { + void *mem_ctx = ralloc_context(NULL); + char *tmp = ralloc_strdup(mem_ctx, atts[i + 1]); + char *save_ptr; + char *tok = strtok_r(tmp, "|", &save_ptr); + + group->engine_mask = 0; + while (tok != NULL) { + if (strcmp(tok, "render") == 0) { + group->engine_mask |= I915_ENGINE_CLASS_TO_MASK(I915_ENGINE_CLASS_RENDER); + } else if (strcmp(tok, "video") == 0) { + group->engine_mask |= I915_ENGINE_CLASS_TO_MASK(I915_ENGINE_CLASS_VIDEO); + } else if (strcmp(tok, "blitter") == 0) { + group->engine_mask |= I915_ENGINE_CLASS_TO_MASK(I915_ENGINE_CLASS_COPY); + } else { + fprintf(stderr, "unknown engine class defined for instruction \"%s\": %s\n", name, atts[i + 1]); + } + + tok = strtok_r(NULL, "|", &save_ptr); + } + + ralloc_free(mem_ctx); } } |