[Intel-gfx] [PATCH 3/5] drm/i915: Generate the engine name based on the instance number
Chris Wilson
chris at chris-wilson.co.uk
Thu Apr 6 20:10:59 UTC 2017
On Thu, Apr 06, 2017 at 05:55:42AM -0700, Oscar Mateo wrote:
> Not really needed, but makes the next change a little bit more compact.
>
> v2:
> - Use zero-based numbering for engine names: xcs0, xcs1.. xcsN (Tvrtko, Chris)
> - Make sure the mock engine name is null-terminated (Tvrtko, Chris)
>
> Cc: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
> Cc: Paulo Zanoni <paulo.r.zanoni at intel.com>
> Cc: Rodrigo Vivi <rodrigo.vivi at intel.com>
> Cc: Chris Wilson <chris at chris-wilson.co.uk>
> Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio at intel.com>
> Signed-off-by: Oscar Mateo <oscar.mateo at intel.com>
> ---
> drivers/gpu/drm/i915/intel_engine_cs.c | 6 ++++--
> drivers/gpu/drm/i915/intel_ringbuffer.h | 4 +++-
> drivers/gpu/drm/i915/selftests/mock_engine.c | 2 +-
> 3 files changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_engine_cs.c b/drivers/gpu/drm/i915/intel_engine_cs.c
> index bb10847..2409908 100644
> --- a/drivers/gpu/drm/i915/intel_engine_cs.c
> +++ b/drivers/gpu/drm/i915/intel_engine_cs.c
> @@ -71,7 +71,7 @@
> .init_legacy = intel_init_bsd_ring_buffer,
> },
> [VCS2] = {
> - .name = "vcs2",
> + .name = "vcs",
> .hw_id = VCS2_HW,
> .exec_id = I915_EXEC_BSD,
> .class = VIDEO_DECODE_CLASS,
> @@ -100,6 +100,7 @@
> {
> const struct engine_info *info = &intel_engines[id];
> struct intel_engine_cs *engine;
> + char instance[3] = "";
>
> GEM_BUG_ON(dev_priv->engine[id]);
> engine = kzalloc(sizeof(*engine), GFP_KERNEL);
> @@ -108,7 +109,8 @@
>
> engine->id = id;
> engine->i915 = dev_priv;
> - engine->name = info->name;
> + snprintf(instance, sizeof(instance), "%u", info->instance);
> + snprintf(engine->name, sizeof(engine->name), "%s%s", info->name, instance);
Huh? Please explain why not "%s%u", I'm feeling stupid.
-Chris
--
Chris Wilson, Intel Open Source Technology Centre
More information about the Intel-gfx
mailing list