Classify the engines in class + instance
Subsystems (2)
cover Classify the engines in class + instance
This refactoring helps simplify a few things here and there.
Daniele Ceraolo Spurio (2):
drm/i915: Classify the engines in class + instance drm/i915: Use the engine class to get the context size
Oscar Mateo (3):
drm/i915: Use the same vfunc for BSD2 ring init drm/i915: Generate the engine name based on the instance number drm/i915: Split the engine info table in two levels, using class +
instance
drivers/gpu/drm/i915/intel_engine_cs.c | 90 +++++++++++++++++++--------- drivers/gpu/drm/i915/intel_lrc.c | 34 +++++++---- drivers/gpu/drm/i915/intel_lrc.h | 7 ++- drivers/gpu/drm/i915/intel_ringbuffer.c | 14 ----- drivers/gpu/drm/i915/intel_ringbuffer.h | 15 ++++- drivers/gpu/drm/i915/selftests/mock_engine.c | 2 +- 6 files changed, 104 insertions(+), 58 deletions(-)
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 1/5 drm/i915: Classify the engines in class + instance
From: Daniele Ceraolo Spurio <[email protected]>
In such a way that vcs and vcs2 are just two different instances (0 and 1) of the same engine class (VIDEO_DECODE_CLASS).
--- drivers/gpu/drm/i915/intel_engine_cs.c | 14 ++++++++++++++ drivers/gpu/drm/i915/intel_ringbuffer.h | 10 ++++++++++ 2 files changed, 24 insertions(+)
drivers/gpu/drm/i915/intel_engine_cs.c +14 -0
@@ -30,6 +30,8 @@const char *name;unsigned int exec_id;unsigned int hw_id; +enum intel_engine_class class; +u32 instance;u32 mmio_base;unsigned irq_shift;int (*init_legacy)(struct intel_engine_cs *engine);
@@ -39,6 +41,8 @@ .name = "rcs", .hw_id = RCS_HW, .exec_id = I915_EXEC_RENDER, + .class = RENDER_CLASS, + .instance = 0, .mmio_base = RENDER_RING_BASE, .irq_shift = GEN8_RCS_IRQ_SHIFT, .init_execlists = logical_render_ring_init,
@@ -48,6 +52,8 @@ .name = "bcs", .hw_id = BCS_HW, .exec_id = I915_EXEC_BLT, + .class = COPY_ENGINE_CLASS, + .instance = 0, .mmio_base = BLT_RING_BASE, .irq_shift = GEN8_BCS_IRQ_SHIFT, .init_execlists = logical_xcs_ring_init,
@@ -57,6 +63,8 @@ .name = "vcs", .hw_id = VCS_HW, .exec_id = I915_EXEC_BSD, + .class = VIDEO_DECODE_CLASS, + .instance = 0, .mmio_base = GEN6_BSD_RING_BASE, .irq_shift = GEN8_VCS1_IRQ_SHIFT, .init_execlists = logical_xcs_ring_init,
@@ -66,6 +74,8 @@ .name = "vcs2", .hw_id = VCS2_HW, .exec_id = I915_EXEC_BSD, + .class = VIDEO_DECODE_CLASS, + .instance = 1, .mmio_base = GEN8_BSD2_RING_BASE, .irq_shift = GEN8_VCS2_IRQ_SHIFT, .init_execlists = logical_xcs_ring_init,
@@ -75,6 +85,8 @@ .name = "vecs", .hw_id = VECS_HW, .exec_id = I915_EXEC_VEBOX, + .class = VIDEO_ENHANCEMENT_CLASS, + .instance = 0, .mmio_base = VEBOX_RING_BASE, .irq_shift = GEN8_VECS_IRQ_SHIFT, .init_execlists = logical_xcs_ring_init,
@@ -101,6 +113,8 @@ engine->hw_id = engine->guc_id = info->hw_id; engine->mmio_base = info->mmio_base; engine->irq_shift = info->irq_shift; + engine->class = info->class; + engine->instance = info->instance;/* Nothing to do here, execute in order of dependencies */ engine->schedule =NULL ;
drivers/gpu/drm/i915/intel_ringbuffer.h +10 -0
@@ -193,6 +193,16 @@ struct intel_engine_cs {enum intel_engine_id id;unsigned int exec_id;unsigned int hw_id; + +enum intel_engine_class { +RENDER_CLASS =0 , +VIDEO_DECODE_CLASS =1 , +VIDEO_ENHANCEMENT_CLASS =2 , +COPY_ENGINE_CLASS =3 , +OTHER_CLASS =4 + } class; +u8 instance; +unsigned int guc_id;u32 mmio_base;unsigned int irq_shift;
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 1/5] drm/i915: Classify the engines in class + instance
Quoted 21 lines · Oscar Mateo
From: Daniele Ceraolo Spurio <[email protected]>
In such a way that vcs and vcs2 are just two different instances (0 and 1) of the same engine class (
VIDEO_DECODE_CLASS).Cc Tvrtko Ursulin <[email protected]>Cc Paulo Zanoni <[email protected]>Cc Rodrigo Vivi <[email protected]>Cc Chris Wilson <[email protected]>Signed-off-by Daniele Ceraolo Spurio <[email protected]>Signed-off-by Oscar Mateo <[email protected]>--- drivers/gpu/drm/i915/intel_engine_cs.c | 14 ++++++++++++++ drivers/gpu/drm/i915/intel_ringbuffer.h | 10 ++++++++++ 2 files changed, 24 insertions(+)drivers/gpu/drm/i915/intel_engine_cs.c +0
-0
drivers/gpu/drm/i915/intel_engine_cs.c line 34
Quoted 5 lines
drivers/gpu/drm/i915/intel_engine_cs.c +2
-0@@ -30,6 +30,8 @@const char *name;unsigned int exec_id;unsigned int hw_id; +enum intel_engine_class class; +u32 instance;
Normal type I think, it's not anything hardware related to need explicit width. Or maybe make it u8 if it saves any space?
Quoted 64 lines
drivers/gpu/drm/i915/intel_engine_cs.c +12
-0u32 mmio_base;unsigned irq_shift;int (*init_legacy)(struct intel_engine_cs *engine);@@ -39,6 +41,8 @@ .name = "rcs", .hw_id = RCS_HW, .exec_id = I915_EXEC_RENDER, + .class = RENDER_CLASS, + .instance = 0, .mmio_base = RENDER_RING_BASE, .irq_shift = GEN8_RCS_IRQ_SHIFT, .init_execlists = logical_render_ring_init,@@ -48,6 +52,8 @@ .name = "bcs", .hw_id = BCS_HW, .exec_id = I915_EXEC_BLT, + .class = COPY_ENGINE_CLASS, + .instance = 0, .mmio_base = BLT_RING_BASE, .irq_shift = GEN8_BCS_IRQ_SHIFT, .init_execlists = logical_xcs_ring_init,@@ -57,6 +63,8 @@ .name = "vcs", .hw_id = VCS_HW, .exec_id = I915_EXEC_BSD, + .class = VIDEO_DECODE_CLASS, + .instance = 0, .mmio_base = GEN6_BSD_RING_BASE, .irq_shift = GEN8_VCS1_IRQ_SHIFT, .init_execlists = logical_xcs_ring_init,@@ -66,6 +74,8 @@ .name = "vcs2", .hw_id = VCS2_HW, .exec_id = I915_EXEC_BSD, + .class = VIDEO_DECODE_CLASS, + .instance = 1, .mmio_base = GEN8_BSD2_RING_BASE, .irq_shift = GEN8_VCS2_IRQ_SHIFT, .init_execlists = logical_xcs_ring_init,@@ -75,6 +85,8 @@ .name = "vecs", .hw_id = VECS_HW, .exec_id = I915_EXEC_VEBOX, + .class = VIDEO_ENHANCEMENT_CLASS, + .instance = 0, .mmio_base = VEBOX_RING_BASE, .irq_shift = GEN8_VECS_IRQ_SHIFT, .init_execlists = logical_xcs_ring_init,@@ -101,6 +113,8 @@ engine->hw_id = engine->guc_id = info->hw_id; engine->mmio_base = info->mmio_base; engine->irq_shift = info->irq_shift; + engine->class = info->class; + engine->instance = info->instance;/* Nothing to do here, execute in order of dependencies */ engine->schedule =NULL ;drivers/gpu/drm/i915/intel_ringbuffer.h +0
-0@@ -193,6 +193,16 @@ struct intel_engine_cs {enum intel_engine_id id;unsigned int exec_id;
drivers/gpu/drm/i915/intel_ringbuffer.h struct intel_engine_cs { · line 204
Quoted 10 lines
drivers/gpu/drm/i915/intel_ringbuffer.h +9
-0unsigned int hw_id; + +enum intel_engine_class { +RENDER_CLASS =0 , +VIDEO_DECODE_CLASS =1 , +VIDEO_ENHANCEMENT_CLASS =2 , +COPY_ENGINE_CLASS =3 , +OTHER_CLASS =4 + } class; +u8 instance;
Oh it is already u8 here! :)
drivers/gpu/drm/i915/intel_ringbuffer.h struct intel_engine_cs { · line 208
Quoted 5 lines
drivers/gpu/drm/i915/intel_ringbuffer.h +1
-0+unsigned int guc_id;u32 mmio_base;unsigned int irq_shift;
Looks OK to me. With the types aligned:
Regards,
Tvrtko
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 2/5 drm/i915: Use the same vfunc for BSD2 ring init
In reply to Oscar MateoIf we needed to do something different for the init functions, we could always look at the instance number to make the distinction.But, in any case, the two functions are virtually identical already (please notice that BSD2_RING is only used from gen8 onwards).
--- drivers/gpu/drm/i915/intel_engine_cs.c | 2 +- drivers/gpu/drm/i915/intel_ringbuffer.c | 14 -------------- drivers/gpu/drm/i915/intel_ringbuffer.h | 1 - 3 files changed, 1 insertion(+), 16 deletions(-)
drivers/gpu/drm/i915/intel_engine_cs.c +1 -1
@@ -79,7 +79,7 @@ .mmio_base = GEN8_BSD2_RING_BASE, .irq_shift = GEN8_VCS2_IRQ_SHIFT, .init_execlists = logical_xcs_ring_init, - .init_legacy = intel_init_bsd2_ring_buffer, + .init_legacy = intel_init_bsd_ring_buffer, }, [VECS] = { .name = "vecs",
drivers/gpu/drm/i915/intel_ringbuffer.c +0 -14
@@ -2175,20 +2175,6 @@ int intel_init_bsd_ring_buffer(struct intel_engine_cs *engine)return intel_init_ring_buffer (engine); } -/** -* Initialize the second BSD ring (eg. Broadwell GT3, Skylake GT3) -*/ -int intel_init_bsd2_ring_buffer (struct intel_engine_cs *engine) -{ -struct drm_i915_private *dev_priv = engine->i915; - -intel_ring_default_vfuncs (dev_priv, engine); - - engine->emit_flush = gen6_bsd_ring_flush; - -return intel_init_ring_buffer (engine); -} -int intel_init_blt_ring_buffer (struct intel_engine_cs *engine) {struct drm_i915_private *dev_priv = engine->i915;
drivers/gpu/drm/i915/intel_ringbuffer.h +0 -1
@@ -561,7 +561,6 @@ int intel_ring_pin(struct intel_ring *ring,int intel_init_render_ring_buffer (struct intel_engine_cs *engine);int intel_init_bsd_ring_buffer (struct intel_engine_cs *engine); -int intel_init_bsd2_ring_buffer (struct intel_engine_cs *engine);int intel_init_blt_ring_buffer (struct intel_engine_cs *engine);int intel_init_vebox_ring_buffer (struct intel_engine_cs *engine);
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 2/5] drm/i915: Use the same vfunc for BSD2 ring init
Quoted 61 lines · Oscar Mateo
If we needed to do something different for the init functions, we could always look at the instance number to make the distinction.But, in any case, the two functions are virtually identical already (please notice that
BSD2_RINGis only used from gen8 onwards).Cc Tvrtko Ursulin <[email protected]>Cc Paulo Zanoni <[email protected]>Cc Rodrigo Vivi <[email protected]>Cc Chris Wilson <[email protected]>Cc Daniele Ceraolo Spurio <[email protected]>Signed-off-by Oscar Mateo <[email protected]>--- drivers/gpu/drm/i915/intel_engine_cs.c | 2 +- drivers/gpu/drm/i915/intel_ringbuffer.c | 14 -------------- drivers/gpu/drm/i915/intel_ringbuffer.h | 1 - 3 files changed, 1 insertion(+), 16 deletions(-)drivers/gpu/drm/i915/intel_engine_cs.c +1
-1@@ -79,7 +79,7 @@ .mmio_base = GEN8_BSD2_RING_BASE, .irq_shift = GEN8_VCS2_IRQ_SHIFT, .init_execlists = logical_xcs_ring_init, - .init_legacy = intel_init_bsd2_ring_buffer, + .init_legacy = intel_init_bsd_ring_buffer, }, [VECS] = { .name = "vecs",drivers/gpu/drm/i915/intel_ringbuffer.c +0
-14@@ -2175,20 +2175,6 @@ int intel_init_bsd_ring_buffer(struct intel_engine_cs *engine)return intel_init_ring_buffer (engine); } -/** -* Initialize the second BSD ring (eg. Broadwell GT3, Skylake GT3) -*/ -int intel_init_bsd2_ring_buffer (struct intel_engine_cs *engine) -{ -struct drm_i915_private *dev_priv = engine->i915; - -intel_ring_default_vfuncs (dev_priv, engine); - - engine->emit_flush = gen6_bsd_ring_flush; - -return intel_init_ring_buffer (engine); -} -int intel_init_blt_ring_buffer (struct intel_engine_cs *engine) {struct drm_i915_private *dev_priv = engine->i915;drivers/gpu/drm/i915/intel_ringbuffer.h +0
-0
drivers/gpu/drm/i915/intel_ringbuffer.h int intel_ring_pin(struct intel_ring *ring, · line 566
Quoted 7 lines
drivers/gpu/drm/i915/intel_ringbuffer.h +0
-1@@ -561,7 +561,6 @@ int intel_ring_pin(struct intel_ring *ring,int intel_init_render_ring_buffer (struct intel_engine_cs *engine);int intel_init_bsd_ring_buffer (struct intel_engine_cs *engine); -int intel_init_bsd2_ring_buffer (struct intel_engine_cs *engine);int intel_init_blt_ring_buffer (struct intel_engine_cs *engine);int intel_init_vebox_ring_buffer (struct intel_engine_cs *engine);
Job is not done until there is nothing left to remove! :)
Doesn't depend on anything so could have been first in the series, or separate, but doesn't matter.
Regards,
Tvrtko
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 2/5] drm/i915: Use the same vfunc for BSD2 ring init
Quoted 74 lines · Tvrtko Ursulin
Quoted 62 lines · Oscar Mateo
If we needed to do something different for the init functions, we could always look at the instance number to make the distinction.But, in any case, the two functions are virtually identical already (please notice that
BSD2_RINGis only used from gen8 onwards).Cc Tvrtko Ursulin <[email protected]>Cc Paulo Zanoni <[email protected]>Cc Rodrigo Vivi <[email protected]>Cc Chris Wilson <[email protected]>Cc Daniele Ceraolo Spurio <[email protected]>Signed-off-by Oscar Mateo <[email protected]>--- drivers/gpu/drm/i915/intel_engine_cs.c | 2 +- drivers/gpu/drm/i915/intel_ringbuffer.c | 14 -------------- drivers/gpu/drm/i915/intel_ringbuffer.h | 1 - 3 files changed, 1 insertion(+), 16 deletions(-)drivers/gpu/drm/i915/intel_engine_cs.c +1
-1@@ -79,7 +79,7 @@ .mmio_base = GEN8_BSD2_RING_BASE, .irq_shift = GEN8_VCS2_IRQ_SHIFT, .init_execlists = logical_xcs_ring_init, - .init_legacy = intel_init_bsd2_ring_buffer, + .init_legacy = intel_init_bsd_ring_buffer, }, [VECS] = { .name = "vecs",drivers/gpu/drm/i915/intel_ringbuffer.c +0
-14@@ -2175,20 +2175,6 @@ int intel_init_bsd_ring_buffer(struct intel_engine_cs *engine)return intel_init_ring_buffer (engine); } -/** -* Initialize the second BSD ring (eg. Broadwell GT3, Skylake GT3) -*/ -int intel_init_bsd2_ring_buffer (struct intel_engine_cs *engine) -{ -struct drm_i915_private *dev_priv = engine->i915; - -intel_ring_default_vfuncs (dev_priv, engine); - - engine->emit_flush = gen6_bsd_ring_flush; - -return intel_init_ring_buffer (engine); -} -int intel_init_blt_ring_buffer (struct intel_engine_cs *engine) {struct drm_i915_private *dev_priv = engine->i915;drivers/gpu/drm/i915/intel_ringbuffer.h +0
-0drivers/gpu/drm/i915/intel_ringbuffer.h int intel_ring_pin(struct intel_ring *ring, · line 566
Quoted 7 lines
drivers/gpu/drm/i915/intel_ringbuffer.h +0
-1@@ -561,7 +561,6 @@ int intel_ring_pin(struct intel_ring *ring,int intel_init_render_ring_buffer (struct intel_engine_cs *engine);int intel_init_bsd_ring_buffer (struct intel_engine_cs *engine); -int intel_init_bsd2_ring_buffer (struct intel_engine_cs *engine);int intel_init_blt_ring_buffer (struct intel_engine_cs *engine);int intel_init_vebox_ring_buffer (struct intel_engine_cs *engine);Job is not done until there is nothing left to remove! :)
Quoted 7 lines
Doesn't depend on anything so could have been first in the series, or separate, but doesn't matter.
Reviewed-by Tvrtko Ursulin <[email protected]>Regards,
Tvrtko
Every program can be simplified by at least one line of code, and every program contains at least one bug; so every program can be simplified to one line of code that doesn't work :)
Thanks!
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 3/5 drm/i915: Generate the engine name based on the instance number
In reply to Oscar MateoNot really needed, but makes the next change a little bit more compact.
--- drivers/gpu/drm/i915/intel_engine_cs.c | 8 ++++++-- drivers/gpu/drm/i915/intel_ringbuffer.h | 4 +++- drivers/gpu/drm/i915/selftests/mock_engine.c | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/intel_engine_cs.c +6 -2
@@ -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,10 @@ engine->id = id; engine->i915 = dev_priv; - engine->name = info->name; +/* For historical reasons the engines are called: name, name2... */ +if (info->instance) +snprintf (instance,sizeof (instance),"%u" , info->instance +1 ); +snprintf (engine->name,sizeof (engine->name),"%s%s" , info->name, instance); engine->exec_id = info->exec_id; engine->hw_id = engine->guc_id = info->hw_id; engine->mmio_base = info->mmio_base;
drivers/gpu/drm/i915/intel_ringbuffer.h +3 -1
@@ -187,9 +187,11 @@ enum intel_engine_id {VECS }; +#define INTEL_ENGINE_CS_MAX_NAME 8 +struct intel_engine_cs {struct drm_i915_private *i915; -const char *name; +char name[INTEL_ENGINE_CS_MAX_NAME ];enum intel_engine_id id;unsigned int exec_id;unsigned int hw_id;
drivers/gpu/drm/i915/selftests/mock_engine.c +1 -1
@@ -140,7 +140,7 @@ struct intel_engine_cs *mock_engine(struct drm_i915_private *i915,/* minimal engine setup for requests */ engine->base.i915 = i915; - engine->base.name = name; +strncpy (engine->base.name, name,sizeof (engine->base.name) -1 ); engine->base.id = id++; engine->base.status_page.page_addr = (void *)(engine +1 );
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 3/5] drm/i915: Generate the engine name based on the instance number
Quoted 19 lines · Oscar Mateo
Not really needed, but makes the next change a little bit more compact.
Cc Tvrtko Ursulin <[email protected]>Cc Paulo Zanoni <[email protected]>Cc Rodrigo Vivi <[email protected]>Cc Chris Wilson <[email protected]>Cc Daniele Ceraolo Spurio <[email protected]>Signed-off-by Oscar Mateo <[email protected]>--- drivers/gpu/drm/i915/intel_engine_cs.c | 8 ++++++-- drivers/gpu/drm/i915/intel_ringbuffer.h | 4 +++- drivers/gpu/drm/i915/selftests/mock_engine.c | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-)drivers/gpu/drm/i915/intel_engine_cs.c +0
-0
drivers/gpu/drm/i915/intel_engine_cs.c line 74
Quoted 5 lines
drivers/gpu/drm/i915/intel_engine_cs.c +1
-1@@ -71,7 +71,7 @@ .init_legacy = intel_init_bsd_ring_buffer, }, [VCS2] = { - .name = "vcs2", + .name = "vcs",
Rename the field to class_name perhaps?
Quoted 12 lines
drivers/gpu/drm/i915/intel_engine_cs.c +1
-0.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 );
drivers/gpu/drm/i915/intel_engine_cs.c line 115
Quoted 8 lines
drivers/gpu/drm/i915/intel_engine_cs.c +4
-1@@ -108,7 +109,10 @@ engine->id = id; engine->i915 = dev_priv; - engine->name = info->name; +/* For historical reasons the engines are called: name, name2... */ +if (info->instance) +snprintf (instance,sizeof (instance),"%u" , info->instance +1 ); +snprintf (engine->name,sizeof (engine->name),"%s%s" , info->name, instance);
Since Chris has recently renamed all the engines, I'd say who cares about the numbering scheme. Just drop it for simplicity.
Quoted 25 lines
drivers/gpu/drm/i915/intel_engine_cs.c +0
-0engine->exec_id = info->exec_id; engine->hw_id = engine->guc_id = info->hw_id; engine->mmio_base = info->mmio_base;drivers/gpu/drm/i915/intel_ringbuffer.h +3
-1@@ -187,9 +187,11 @@ enum intel_engine_id {VECS }; +#define INTEL_ENGINE_CS_MAX_NAME 8 +struct intel_engine_cs {struct drm_i915_private *i915; -const char *name; +char name[INTEL_ENGINE_CS_MAX_NAME ];enum intel_engine_id id;unsigned int exec_id;unsigned int hw_id;drivers/gpu/drm/i915/selftests/mock_engine.c +0
-0
drivers/gpu/drm/i915/selftests/mock_engine.c struct intel_engine_cs *mock_engine(struct drm_i915_private *i915, · line 143
Quoted 5 lines
drivers/gpu/drm/i915/selftests/mock_engine.c +1
-1@@ -140,7 +140,7 @@ struct intel_engine_cs *mock_engine(struct drm_i915_private *i915,/* minimal engine setup for requests */ engine->base.i915 = i915; - engine->base.name = name; +strncpy (engine->base.name, name,sizeof (engine->base.name) -1 );
Can this miss to null-terminate? Or it relies on the mock_engine being kzalloced?
drivers/gpu/drm/i915/selftests/mock_engine.c struct intel_engine_cs *mock_engine(struct drm_i915_private *i915, · line 146
Quoted 4 lines
drivers/gpu/drm/i915/selftests/mock_engine.c +0
-0engine->base.id = id++; engine->base.status_page.page_addr = (void *)(engine +1 );
Regards,
Tvrtko
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 3/5] drm/i915: Generate the engine name based on the instance number
Quoted 12 lines · Tvrtko Ursulin
Quoted 10 lines · Oscar Mateo
drivers/gpu/drm/i915/intel_engine_cs.c +1
-0@@ -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,10 @@
Quoted 10 lines
drivers/gpu/drm/i915/intel_engine_cs.c line 115
Quoted 7 lines
drivers/gpu/drm/i915/intel_engine_cs.c +4
-1engine->id = id; engine->i915 = dev_priv; - engine->name = info->name; +/* For historical reasons the engines are called: name, name2... */ +if (info->instance) +snprintf (instance,sizeof (instance),"%u" , info->instance +1 ); +snprintf (engine->name,sizeof (engine->name),"%s%s" , info->name, instance);Since Chris has recently renamed all the engines, I'd say who cares about the numbering scheme. Just drop it for simplicity.
Seconded. class0 is ok, or if you are being fancy only use the classN format if there are multiples in the class. Though kiss says just use classN and be done with it.
-Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 3/5] drm/i915: Generate the engine name based on the instance number
In reply to Tvrtko UrsulinQuoted 16 lines · Tvrtko Ursulin
Quoted 14 lines · Oscar Mateo
Not really needed, but makes the next change a little bit more compact.
Cc Tvrtko Ursulin <[email protected]>Cc Paulo Zanoni <[email protected]>Cc Rodrigo Vivi <[email protected]>Cc Chris Wilson <[email protected]>Cc Daniele Ceraolo Spurio <[email protected]>Signed-off-by Oscar Mateo <[email protected]>--- drivers/gpu/drm/i915/intel_engine_cs.c | 8 ++++++-- drivers/gpu/drm/i915/intel_ringbuffer.h | 4 +++- drivers/gpu/drm/i915/selftests/mock_engine.c | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-)
Quoted 13 lines
drivers/gpu/drm/i915/intel_engine_cs.c line 74
Quoted 10 lines
drivers/gpu/drm/i915/intel_engine_cs.c +1
-1@@ -71,7 +71,7 @@ .init_legacy = intel_init_bsd_ring_buffer, }, [VCS2] = { - .name = "vcs2", + .name = "vcs",Rename the field to
class_nameperhaps?
In the following patch, when I move .name to the class table, it becomes much more obvious what it refers to, but I can change it to class_name if you feel strongly about it (or change it here and then back to name in the next patch?).
Quoted 13 lines
Quoted 13 lines
drivers/gpu/drm/i915/intel_engine_cs.c +1
-0.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,10 @@
Quoted 11 lines
drivers/gpu/drm/i915/intel_engine_cs.c
Quoted 8 lines
drivers/gpu/drm/i915/intel_engine_cs.c +4
-1engine->id = id; engine->i915 = dev_priv; - engine->name = info->name; +/* For historical reasons the engines are called: name, name2... */ +if (info->instance) +snprintf (instance,sizeof (instance),"%u" , info->instance +1 ); +snprintf (engine->name,sizeof (engine->name),"%s%s" , info->name, instance);Since Chris has recently renamed all the engines, I'd say who cares about the numbering scheme. Just drop it for simplicity.
Oooohh!
Can I also use zero-based numbering, like in the Bspec? (so xcs0, xcs1 ... xcsN?)
Quoted 27 lines
Quoted 27 lines
drivers/gpu/drm/i915/intel_engine_cs.c +0
-0engine->exec_id = info->exec_id; engine->hw_id = engine->guc_id = info->hw_id;engine->mmio_base = info->mmio_base;drivers/gpu/drm/i915/intel_ringbuffer.h +3
-1@@ -187,9 +187,11 @@ enum intel_engine_id {VECS }; +#define INTEL_ENGINE_CS_MAX_NAME 8 +struct intel_engine_cs {struct drm_i915_private *i915; -const char *name; +char name[INTEL_ENGINE_CS_MAX_NAME ];enum intel_engine_id id;unsigned int exec_id;unsigned int hw_id;drivers/gpu/drm/i915/selftests/mock_engine.c +0
-0@@ -140,7 +140,7 @@ struct intel_engine_cs *mock_engine(struct drm_i915_private *i915,
Quoted 7 lines
drivers/gpu/drm/i915/selftests/mock_engine.c struct intel_engine_cs *mock_engine(struct drm_i915_private *i915, · line 143
Quoted 4 lines
drivers/gpu/drm/i915/selftests/mock_engine.c +1
-1/* minimal engine setup for requests */ engine->base.i915 = i915; - engine->base.name = name; +strncpy (engine->base.name, name,sizeof (engine->base.name) -1 );Can this miss to null-terminate? Or it relies on the
mock_enginebeing kzalloced?
It relies on the kzalloc, but I can add a \0 at the end for extra security?
Quoted 8 lines
drivers/gpu/drm/i915/selftests/mock_engine.c struct intel_engine_cs *mock_engine(struct drm_i915_private *i915, · line 145
Quoted 4 lines
drivers/gpu/drm/i915/selftests/mock_engine.c +0
-0engine->base.id = id++; engine->base.status_page.page_addr = (void *)(engine +1 );Regards,
Tvrtko
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 3/5] drm/i915: Generate the engine name based on the instance number
Quoted 31 lines · Oscar Mateo
Quoted 15 lines · Tvrtko Ursulin
Quoted 14 lines · Oscar Mateo
Not really needed, but makes the next change a little bit more compact.
Cc Tvrtko Ursulin <[email protected]>Cc Paulo Zanoni <[email protected]>Cc Rodrigo Vivi <[email protected]>Cc Chris Wilson <[email protected]>Cc Daniele Ceraolo Spurio <[email protected]>Signed-off-by Oscar Mateo <[email protected]>--- drivers/gpu/drm/i915/intel_engine_cs.c | 8 ++++++-- drivers/gpu/drm/i915/intel_ringbuffer.h | 4 +++- drivers/gpu/drm/i915/selftests/mock_engine.c | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-)Quoted 14 lines
drivers/gpu/drm/i915/intel_engine_cs.c line 74
Quoted 11 lines
drivers/gpu/drm/i915/intel_engine_cs.c +1
-1@@ -71,7 +71,7 @@ .init_legacy = intel_init_bsd_ring_buffer, }, [VCS2] = { - .name = "vcs2", + .name = "vcs",Rename the field to
class_nameperhaps?
Quoted 4 lines
In the following patch, when I move .name to the class table, it becomes much more obvious what it refers to, but I can change it to
class_nameif you feel strongly about it (or change it here and then back to name in the next patch?).
No it's fine like it is, just a consequence of not looking-ahead enough.
Quoted 27 lines
Quoted 14 lines
Quoted 14 lines
drivers/gpu/drm/i915/intel_engine_cs.c +1
-0.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,10 @@Quoted 12 lines
drivers/gpu/drm/i915/intel_engine_cs.c
Quoted 8 lines
drivers/gpu/drm/i915/intel_engine_cs.c +4
-1engine->id = id; engine->i915 = dev_priv; - engine->name = info->name; +/* For historical reasons the engines are called: name, name2... */ +if (info->instance) +snprintf (instance,sizeof (instance),"%u" , info->instance +1 ); +snprintf (engine->name,sizeof (engine->name),"%s%s" , info->name, instance);Since Chris has recently renamed all the engines, I'd say who cares about the numbering scheme. Just drop it for simplicity.
Quoted 3 lines
Oooohh!
Can I also use zero-based numbering, like in the Bspec? (so xcs0, xcs1 ... xcsN?)
Sounds like the verdict is yes.
Quoted 39 lines
Quoted 30 lines
Quoted 30 lines
drivers/gpu/drm/i915/intel_engine_cs.c +0
-0engine->exec_id = info->exec_id; engine->hw_id = engine->guc_id = info->hw_id;engine->mmio_base = info->mmio_base;drivers/gpu/drm/i915/intel_ringbuffer.h +3
-1@@ -187,9 +187,11 @@ enum intel_engine_id {VECS }; +#define INTEL_ENGINE_CS_MAX_NAME 8 +struct intel_engine_cs {struct drm_i915_private *i915; -const char *name; +char name[INTEL_ENGINE_CS_MAX_NAME ];enum intel_engine_id id;unsigned int exec_id;unsigned int hw_id;drivers/gpu/drm/i915/selftests/mock_engine.c +0
-0@@ -140,7 +140,7 @@ struct intel_engine_cs *mock_engine(struct drm_i915_private *i915,Quoted 8 lines
drivers/gpu/drm/i915/selftests/mock_engine.c struct intel_engine_cs *mock_engine(struct drm_i915_private *i915, · line 143
Quoted 4 lines
drivers/gpu/drm/i915/selftests/mock_engine.c +1
-1/* minimal engine setup for requests */ engine->base.i915 = i915; - engine->base.name = name; +strncpy (engine->base.name, name,sizeof (engine->base.name) -1 );Can this miss to null-terminate? Or it relies on the
mock_enginebeing kzalloced?
Quoted 1 line
It relies on the kzalloc, but I can add a \0 at the end for extra security?
Not sure at the moment without checking in detail how much mock_engine already depends on being zeroed. But I guess null-terminating it at the end wouldn't harm. Or maybe snprintf to eliminate the dilemma if it creates neater code?
Regards,
Tvrtko
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 3/5] drm/i915: Generate the engine name based on the instance number
Quoted 112 lines · Tvrtko Ursulin
Quoted 31 lines · Oscar Mateo
Quoted 15 lines · Tvrtko Ursulin
Quoted 14 lines · Oscar Mateo
Not really needed, but makes the next change a little bit more compact.
Cc Tvrtko Ursulin <[email protected]>Cc Paulo Zanoni <[email protected]>Cc Rodrigo Vivi <[email protected]>Cc Chris Wilson <[email protected]>Cc Daniele Ceraolo Spurio <[email protected]>Signed-off-by Oscar Mateo <[email protected]>---
drivers/gpu/drm/i915/intel_engine_cs.c | 8 ++++++-- drivers/gpu/drm/i915/intel_ringbuffer.h | 4 +++- drivers/gpu/drm/i915/selftests/mock_engine.c | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-)Quoted 14 lines
drivers/gpu/drm/i915/intel_engine_cs.c line 74
Quoted 11 lines
drivers/gpu/drm/i915/intel_engine_cs.c +1
-1@@ -71,7 +71,7 @@ .init_legacy = intel_init_bsd_ring_buffer, }, [VCS2] = { - .name = "vcs2", + .name = "vcs",Rename the field to
class_nameperhaps?Quoted 4 lines
In the following patch, when I move .name to the class table, it becomes much more obvious what it refers to, but I can change it to
class_nameif you feel strongly about it (or change it here and then back to name in the next patch?).No it's fine like it is, just a consequence of not looking-ahead enough.
Quoted 27 lines
Quoted 14 lines
Quoted 14 lines
drivers/gpu/drm/i915/intel_engine_cs.c +1
-0.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,10 @@Quoted 12 lines
drivers/gpu/drm/i915/intel_engine_cs.c
Quoted 8 lines
drivers/gpu/drm/i915/intel_engine_cs.c +4
-1engine->id = id; engine->i915 = dev_priv; - engine->name = info->name; +/* For historical reasons the engines are called: name, name2... */ +if (info->instance) +snprintf (instance,sizeof (instance),"%u" , info->instance +1 ); +snprintf (engine->name,sizeof (engine->name),"%s%s" , info->name, instance);Since Chris has recently renamed all the engines, I'd say who cares about the numbering scheme. Just drop it for simplicity.
Quoted 3 lines
Oooohh!
Can I also use zero-based numbering, like in the Bspec? (so xcs0, xcs1 ... xcsN?)Sounds like the verdict is yes.
Quoted 39 lines
Quoted 38 lines
Quoted 28 lines
drivers/gpu/drm/i915/intel_engine_cs.c +0
-0engine->exec_id = info->exec_id; engine->hw_id = engine->guc_id = info->hw_id;engine->mmio_base = info->mmio_base;drivers/gpu/drm/i915/intel_ringbuffer.h +3
-1@@ -187,9 +187,11 @@ enum intel_engine_id {VECS }; +#define INTEL_ENGINE_CS_MAX_NAME 8 +struct intel_engine_cs {struct drm_i915_private *i915; -const char *name; +char name[INTEL_ENGINE_CS_MAX_NAME ];enum intel_engine_id id;unsigned int exec_id;unsigned int hw_id;drivers/gpu/drm/i915/selftests/mock_engine.c +0
-0drivers/gpu/drm/i915/selftests/mock_engine.c struct intel_engine_cs *mock_engine(struct · line 144
Quoted 6 lines
drivers/gpu/drm/i915/selftests/mock_engine.c +1
-1@@ -140,7 +140,7 @@ struct intel_engine_cs *mock_engine(struct drm_i915_private *i915,/* minimal engine setup for requests */ engine->base.i915 = i915; - engine->base.name = name; +strncpy (engine->base.name, name,sizeof (engine->base.name) -1 );Can this miss to null-terminate? Or it relies on the
mock_enginebeing kzalloced?
Quoted 4 lines
Quoted 1 line
It relies on the kzalloc, but I can add a \0 at the end for extra security?
Not sure at the moment without checking in detail how much
mock_enginealready depends on being zeroed.
It does depend on the kzalloc.
Quoted 3 lines
But I guess
null-terminating it at the end wouldn't harm. Or maybe snprintf to eliminate the dilemma if it creates neater code?
Indeed, I want my mockN! We may want multiple instances of the mock engine class in the future.
-Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 4/5 drm/i915: Split the engine info table in two levels, using class + instance
In reply to Oscar Mateo--- drivers/gpu/drm/i915/intel_engine_cs.c | 72 +++++++++++++++++++++------------- 1 file changed, 44 insertions(+), 28 deletions(-)
drivers/gpu/drm/i915/intel_engine_cs.c +44 -28
@@ -26,71 +26,83 @@#include "intel_ringbuffer.h" #include "intel_lrc.h" -static const struct engine_info { +struct engine_class_info {const char *name;unsigned int exec_id; +int (*init_legacy)(struct intel_engine_cs *engine); +int (*init_execlists)(struct intel_engine_cs *engine); +}; + +static const struct engine_class_info intel_engine_classes[] = { + [RENDER_CLASS ] = { + .name ="rcs" , + .exec_id =I915_EXEC_RENDER , + .init_execlists = logical_render_ring_init, + .init_legacy = intel_init_render_ring_buffer, + }, + [COPY_ENGINE_CLASS ] = { + .name ="bcs" , + .exec_id =I915_EXEC_BLT , + .init_execlists = logical_xcs_ring_init, + .init_legacy = intel_init_blt_ring_buffer, + }, + [VIDEO_DECODE_CLASS ] = { + .name ="vcs" , + .exec_id =I915_EXEC_BSD , + .init_execlists = logical_xcs_ring_init, + .init_legacy = intel_init_bsd_ring_buffer, + }, + [VIDEO_ENHANCEMENT_CLASS ] = { + .name ="vecs" , + .exec_id =I915_EXEC_VEBOX , + .init_execlists = logical_xcs_ring_init, + .init_legacy = intel_init_vebox_ring_buffer, + }, +}; + +struct engine_info {unsigned int hw_id;enum intel_engine_class class;u32 instance;u32 mmio_base;unsigned irq_shift; -int (*init_legacy)(struct intel_engine_cs *engine); -int (*init_execlists)(struct intel_engine_cs *engine); -} intel_engines[] = { +}; + +static const struct engine_info intel_engines[] = { [RCS ] = { - .name ="rcs" , .hw_id =RCS_HW , - .exec_id =I915_EXEC_RENDER , .class =RENDER_CLASS , .instance =0 , .mmio_base =RENDER_RING_BASE , .irq_shift =GEN8_RCS_IRQ_SHIFT , - .init_execlists = logical_render_ring_init, - .init_legacy = intel_init_render_ring_buffer, }, [BCS ] = { - .name ="bcs" , .hw_id =BCS_HW , - .exec_id =I915_EXEC_BLT , .class =COPY_ENGINE_CLASS , .instance =0 , .mmio_base =BLT_RING_BASE , .irq_shift =GEN8_BCS_IRQ_SHIFT , - .init_execlists = logical_xcs_ring_init, - .init_legacy = intel_init_blt_ring_buffer, }, [VCS ] = { - .name ="vcs" , .hw_id =VCS_HW , - .exec_id =I915_EXEC_BSD , .class =VIDEO_DECODE_CLASS , .instance =0 , .mmio_base =GEN6_BSD_RING_BASE , .irq_shift =GEN8_VCS1_IRQ_SHIFT , - .init_execlists = logical_xcs_ring_init, - .init_legacy = intel_init_bsd_ring_buffer, }, [VCS2 ] = { - .name ="vcs" , .hw_id =VCS2_HW , - .exec_id =I915_EXEC_BSD , .class =VIDEO_DECODE_CLASS , .instance =1 , .mmio_base =GEN8_BSD2_RING_BASE , .irq_shift =GEN8_VCS2_IRQ_SHIFT , - .init_execlists = logical_xcs_ring_init, - .init_legacy = intel_init_bsd_ring_buffer, }, [VECS ] = { - .name ="vecs" , .hw_id =VECS_HW , - .exec_id =I915_EXEC_VEBOX , .class =VIDEO_ENHANCEMENT_CLASS , .instance =0 , .mmio_base =VEBOX_RING_BASE , .irq_shift =GEN8_VECS_IRQ_SHIFT , - .init_execlists = logical_xcs_ring_init, - .init_legacy = intel_init_vebox_ring_buffer, }, };
@@ -99,6 +111,8 @@ enum intel_engine_id id) {const struct engine_info *info = &intel_engines[id]; +const struct engine_class_info *class_info = + &intel_engine_classes[info->class];struct intel_engine_cs *engine;char instance[3 ] ="" ;
@@ -112,8 +126,8 @@/* For historical reasons the engines are called: name, name2... */ if (info->instance)snprintf (instance,sizeof (instance),"%u" , info->instance +1 ); -snprintf (engine->name,sizeof (engine->name),"%s%s" , info->name, instance); - engine->exec_id = info->exec_id; +snprintf (engine->name,sizeof (engine->name),"%s%s" , class_info->name, instance); + engine->exec_id = class_info->exec_id; engine->hw_id = engine->guc_id = info->hw_id; engine->mmio_base = info->mmio_base; engine->irq_shift = info->irq_shift;
@@ -193,12 +207,14 @@ int intel_engines_init(struct drm_i915_private *dev_priv)int err =0 ;for_each_engine (engine, dev_priv, id) { +const struct engine_class_info *class_info = + &intel_engine_classes[engine->class];int (*init)(struct intel_engine_cs *engine);if (i915.enable_execlists) - init = intel_engines[id].init_execlists; + init = class_info->init_execlists;else - init = intel_engines[id].init_legacy; + init = class_info->init_legacy;if (!init) {kfree (engine); dev_priv->engine[id] =NULL ;
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 4/5] drm/i915: Split the engine info table in two levels, using class + instance
On 05/04/2017 10:30, Oscar Mateo wrote:
Commit message missing.
Quoted 150 lines
Cc Tvrtko Ursulin <[email protected]>Cc Paulo Zanoni <[email protected]>Cc Rodrigo Vivi <[email protected]>Cc Chris Wilson <[email protected]>Cc Daniele Ceraolo Spurio <[email protected]>Signed-off-by Oscar Mateo <[email protected]>--- drivers/gpu/drm/i915/intel_engine_cs.c | 72 +++++++++++++++++++++------------- 1 file changed, 44 insertions(+), 28 deletions(-)drivers/gpu/drm/i915/intel_engine_cs.c +42
-26@@ -26,71 +26,83 @@#include "intel_ringbuffer.h" #include "intel_lrc.h" -static const struct engine_info { +struct engine_class_info {const char *name;unsigned int exec_id; +int (*init_legacy)(struct intel_engine_cs *engine); +int (*init_execlists)(struct intel_engine_cs *engine); +}; + +static const struct engine_class_info intel_engine_classes[] = { + [RENDER_CLASS ] = { + .name ="rcs" , + .exec_id =I915_EXEC_RENDER , + .init_execlists = logical_render_ring_init, + .init_legacy = intel_init_render_ring_buffer, + }, + [COPY_ENGINE_CLASS ] = { + .name ="bcs" , + .exec_id =I915_EXEC_BLT , + .init_execlists = logical_xcs_ring_init, + .init_legacy = intel_init_blt_ring_buffer, + }, + [VIDEO_DECODE_CLASS ] = { + .name ="vcs" , + .exec_id =I915_EXEC_BSD , + .init_execlists = logical_xcs_ring_init, + .init_legacy = intel_init_bsd_ring_buffer, + }, + [VIDEO_ENHANCEMENT_CLASS ] = { + .name ="vecs" , + .exec_id =I915_EXEC_VEBOX , + .init_execlists = logical_xcs_ring_init, + .init_legacy = intel_init_vebox_ring_buffer, + }, +}; + +struct engine_info {unsigned int hw_id;enum intel_engine_class class;u32 instance;u32 mmio_base;unsigned irq_shift; -int (*init_legacy)(struct intel_engine_cs *engine); -int (*init_execlists)(struct intel_engine_cs *engine); -} intel_engines[] = { +}; + +static const struct engine_info intel_engines[] = { [RCS ] = { - .name ="rcs" , .hw_id =RCS_HW , - .exec_id =I915_EXEC_RENDER , .class =RENDER_CLASS , .instance =0 , .mmio_base =RENDER_RING_BASE , .irq_shift =GEN8_RCS_IRQ_SHIFT , - .init_execlists = logical_render_ring_init, - .init_legacy = intel_init_render_ring_buffer, }, [BCS ] = { - .name ="bcs" , .hw_id =BCS_HW , - .exec_id =I915_EXEC_BLT , .class =COPY_ENGINE_CLASS , .instance =0 , .mmio_base =BLT_RING_BASE , .irq_shift =GEN8_BCS_IRQ_SHIFT , - .init_execlists = logical_xcs_ring_init, - .init_legacy = intel_init_blt_ring_buffer, }, [VCS ] = { - .name ="vcs" , .hw_id =VCS_HW , - .exec_id =I915_EXEC_BSD , .class =VIDEO_DECODE_CLASS , .instance =0 , .mmio_base =GEN6_BSD_RING_BASE , .irq_shift =GEN8_VCS1_IRQ_SHIFT , - .init_execlists = logical_xcs_ring_init, - .init_legacy = intel_init_bsd_ring_buffer, }, [VCS2 ] = { - .name ="vcs" , .hw_id =VCS2_HW , - .exec_id =I915_EXEC_BSD , .class =VIDEO_DECODE_CLASS , .instance =1 , .mmio_base =GEN8_BSD2_RING_BASE , .irq_shift =GEN8_VCS2_IRQ_SHIFT , - .init_execlists = logical_xcs_ring_init, - .init_legacy = intel_init_bsd_ring_buffer, }, [VECS ] = { - .name ="vecs" , .hw_id =VECS_HW , - .exec_id =I915_EXEC_VEBOX , .class =VIDEO_ENHANCEMENT_CLASS , .instance =0 , .mmio_base =VEBOX_RING_BASE , .irq_shift =GEN8_VECS_IRQ_SHIFT , - .init_execlists = logical_xcs_ring_init, - .init_legacy = intel_init_vebox_ring_buffer, }, };@@ -99,6 +111,8 @@ enum intel_engine_id id) {const struct engine_info *info = &intel_engines[id]; +const struct engine_class_info *class_info = + &intel_engine_classes[info->class];struct intel_engine_cs *engine;char instance[3 ] ="" ;@@ -112,8 +126,8 @@/* For historical reasons the engines are called: name, name2... */ if (info->instance)snprintf (instance,sizeof (instance),"%u" , info->instance +1 ); -snprintf (engine->name,sizeof (engine->name),"%s%s" , info->name, instance); - engine->exec_id = info->exec_id; +snprintf (engine->name,sizeof (engine->name),"%s%s" , class_info->name, instance); + engine->exec_id = class_info->exec_id; engine->hw_id = engine->guc_id = info->hw_id; engine->mmio_base = info->mmio_base; engine->irq_shift = info->irq_shift;@@ -193,12 +207,14 @@ int intel_engines_init(struct drm_i915_private *dev_priv)int err =0 ;for_each_engine (engine, dev_priv, id) { +const struct engine_class_info *class_info = + &intel_engine_classes[engine->class];int (*init)(struct intel_engine_cs *engine);
drivers/gpu/drm/i915/intel_engine_cs.c int intel_engines_init(struct drm_i915_private *dev_priv) · line 220
Quoted 10 lines
drivers/gpu/drm/i915/intel_engine_cs.c +2
-2if (i915.enable_execlists) - init = intel_engines[id].init_execlists; + init = class_info->init_execlists;else - init = intel_engines[id].init_legacy; + init = class_info->init_legacy;if (!init) {kfree (engine); dev_priv->engine[id] =NULL ;
Looks OK to me but it will have to be rebased a bit if you accept my comments on the previous patches.
Regards,
Tvrtko
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 5/5 drm/i915: Use the engine class to get the context size
In reply to Oscar MateoFrom: Daniele Ceraolo Spurio <[email protected]>
Technically speaking, the context size is per engine class, not per instance.
--- drivers/gpu/drm/i915/intel_lrc.c | 34 ++++++++++++++++++++++------------ drivers/gpu/drm/i915/intel_lrc.h | 7 ++++++- 2 files changed, 28 insertions(+), 13 deletions(-)
drivers/gpu/drm/i915/intel_lrc.c +22 -12
@@ -1908,8 +1908,10 @@ static void execlists_init_reg_state(u32 *regs, }/** -* intel_lr_context_size() - return the size of the context for an engine -* @engine: which engine to find the context size for +* intel_lr_class_context_size() - return the size of the context for a given +* engine class +* @dev_priv: i915 device private +* @class: which engine class to find the context size for * * Each engine may require a different amount of space for a context image, * so when allocating (or copying) an image, this function can be used to
@@ -1921,25 +1923,33 @@ static void execlists_init_reg_state(u32 *regs,* in LRC mode, but does not include the "shared data page" used with * GuC submission. The caller should account for this if using the GuC. */ -uint32_t intel_lr_context_size (struct intel_engine_cs *engine) +uint32_t intel_lr_class_context_size (struct drm_i915_private *dev_priv, +enum intel_engine_class class) {int ret =0 ; -WARN_ON (INTEL_GEN (engine->i915) <8 ); +WARN_ON (INTEL_GEN (dev_priv) <8 ); -switch (engine->id) { -case RCS : -if (INTEL_GEN (engine->i915) >=9 ) +switch (class) { +case RENDER_CLASS : +switch (INTEL_GEN (dev_priv)) { +default : +DRM_ERROR ("Unknown context size for GEN\n" ); +case 9 : ret =GEN9_LR_CONTEXT_RENDER_SIZE ; -else +break ; +case 8 : ret =GEN8_LR_CONTEXT_RENDER_SIZE ; +break ; + }break ; -case VCS : -case BCS : -case VECS : -case VCS2 : +case VIDEO_DECODE_CLASS : +case VIDEO_ENHANCEMENT_CLASS : +case COPY_ENGINE_CLASS : ret =GEN8_LR_CONTEXT_OTHER_SIZE ;break ; +default : +MISSING_CASE (class); }return ret;
drivers/gpu/drm/i915/intel_lrc.h +6 -1
@@ -78,7 +78,12 @@ enum {struct drm_i915_private ;struct i915_gem_context ; -uint32_t intel_lr_context_size (struct intel_engine_cs *engine); +uint32_t intel_lr_class_context_size (struct drm_i915_private *dev_priv, +enum intel_engine_class class); +static inline uint32_t intel_lr_context_size (struct intel_engine_cs *engine) +{ +return intel_lr_class_context_size (engine->i915, engine->class); +}void intel_lr_context_resume (struct drm_i915_private *dev_priv); uint64_t intel_lr_context_descriptor(struct i915_gem_context *ctx,
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 5/5] drm/i915: Use the engine class to get the context size
Quoted 4 lines · Oscar Mateo
From: Daniele Ceraolo Spurio <[email protected]>
Technically speaking, the context size is per engine class, not per instance.
It is very nice to have the code match the documentation!
Quoted 39 lines
Cc Tvrtko Ursulin <[email protected]>Cc Paulo Zanoni <[email protected]>Cc Rodrigo Vivi <[email protected]>Cc Chris Wilson <[email protected]>Signed-off-by Daniele Ceraolo Spurio <[email protected]>Signed-off-by Oscar Mateo <[email protected]>--- drivers/gpu/drm/i915/intel_lrc.c | 34 ++++++++++++++++++++++------------ drivers/gpu/drm/i915/intel_lrc.h | 7 ++++++- 2 files changed, 28 insertions(+), 13 deletions(-)drivers/gpu/drm/i915/intel_lrc.c +6
-4@@ -1908,8 +1908,10 @@ static void execlists_init_reg_state(u32 *regs, }/** -* intel_lr_context_size() - return the size of the context for an engine -* @engine: which engine to find the context size for +* intel_lr_class_context_size() - return the size of the context for a given +* engine class +* @dev_priv: i915 device private +* @class: which engine class to find the context size for * * Each engine may require a different amount of space for a context image, * so when allocating (or copying) an image, this function can be used to @@ -1921,25 +1923,33 @@ static void execlists_init_reg_state(u32 *regs,* in LRC mode, but does not include the "shared data page" used with * GuC submission. The caller should account for this if using the GuC. */ -uint32_t intel_lr_context_size (struct intel_engine_cs *engine) +uint32_t intel_lr_class_context_size (struct drm_i915_private *dev_priv, +enum intel_engine_class class) {int ret =0 ; -WARN_ON (INTEL_GEN (engine->i915) <8 );
drivers/gpu/drm/i915/intel_lrc.c static void execlists_init_reg_state(u32 *regs, · line 1937
Quoted 10 lines
drivers/gpu/drm/i915/intel_lrc.c +6
-3+WARN_ON (INTEL_GEN (dev_priv) <8 ); -switch (engine->id) { -case RCS : -if (INTEL_GEN (engine->i915) >=9 ) +switch (class) { +case RENDER_CLASS : +switch (INTEL_GEN (dev_priv)) { +default : +DRM_ERROR ("Unknown context size for GEN\n" );
MISSING_CASE I think, otherwise it is too easy to miss in the noise. And it is MISSING_CASE for the class below which looks appropriate to me for this layer.
Quoted 32 lines
drivers/gpu/drm/i915/intel_lrc.c +10
-5+case 9 : ret =GEN9_LR_CONTEXT_RENDER_SIZE ; - else +break ; +case 8 : ret =GEN8_LR_CONTEXT_RENDER_SIZE ; +break ; + }break ; -case VCS : -case BCS : -case VECS : -case VCS2 : +case VIDEO_DECODE_CLASS : +case VIDEO_ENHANCEMENT_CLASS : +case COPY_ENGINE_CLASS : ret =GEN8_LR_CONTEXT_OTHER_SIZE ;break ; +default : +MISSING_CASE (class); }return ret;drivers/gpu/drm/i915/intel_lrc.h +0
-0@@ -78,7 +78,12 @@ enum {struct drm_i915_private ;struct i915_gem_context ;
drivers/gpu/drm/i915/intel_lrc.h enum { · line 89
Quoted 10 lines
drivers/gpu/drm/i915/intel_lrc.h +6
-1-uint32_t intel_lr_context_size (struct intel_engine_cs *engine); +uint32_t intel_lr_class_context_size (struct drm_i915_private *dev_priv, +enum intel_engine_class class); +static inline uint32_t intel_lr_context_size (struct intel_engine_cs *engine) +{ +return intel_lr_class_context_size (engine->i915, engine->class); +}void intel_lr_context_resume (struct drm_i915_private *dev_priv); uint64_t intel_lr_context_descriptor(struct i915_gem_context *ctx,
Otherwise looks fine to me. I also really hope to be able to use the class/instance cleanup in scope of the better VCS load balancing which is currently being looked at.
Regards,
Tvrtko
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.BAT: success for Classify the engines in class + instance
In reply to Oscar Mateo== Series Details ==
== Series Details ==
Series: Classify the engines in class + instance
URL : https://patchwork.freedesktop.org/series/22535/
State : success
== Summary ==
Series 22535v1 Classify the engines in class + instance
https://patchwork.freedesktop.org/api/1.0/series/22535/revisions/1/mbox/
fi-bdw-5557u total:278 pass:267 dwarn:0 dfail:0 fail:0 skip:11 time: 432s fi-bdw-gvtdvm total:278 pass:256 dwarn:8 dfail:0 fail:0 skip:14 time: 425s fi-bsw-n3050 total:278 pass:242 dwarn:0 dfail:0 fail:0 skip:36 time: 574s fi-bxt-t5700 total:278 pass:258 dwarn:0 dfail:0 fail:0 skip:20 time: 543s fi-byt-j1900 total:278 pass:254 dwarn:0 dfail:0 fail:0 skip:24 time: 479s fi-byt-n2820 total:278 pass:250 dwarn:0 dfail:0 fail:0 skip:28 time: 484s fi-hsw-4770 total:278 pass:262 dwarn:0 dfail:0 fail:0 skip:16 time: 412s fi-hsw-4770r total:278 pass:262 dwarn:0 dfail:0 fail:0 skip:16 time: 406s fi-ilk-650 total:278 pass:228 dwarn:0 dfail:0 fail:0 skip:50 time: 422s fi-ivb-3520m total:278 pass:260 dwarn:0 dfail:0 fail:0 skip:18 time: 488s fi-ivb-3770 total:278 pass:260 dwarn:0 dfail:0 fail:0 skip:18 time: 465s fi-kbl-7500u total:278 pass:260 dwarn:0 dfail:0 fail:0 skip:18 time: 455s fi-kbl-7560u total:278 pass:268 dwarn:0 dfail:0 fail:0 skip:10 time: 575s fi-skl-6260u total:278 pass:268 dwarn:0 dfail:0 fail:0 skip:10 time: 450s fi-skl-6700hq total:278 pass:261 dwarn:0 dfail:0 fail:0 skip:17 time: 573s fi-skl-6700k total:278 pass:256 dwarn:4 dfail:0 fail:0 skip:18 time: 459s fi-skl-6770hq total:278 pass:268 dwarn:0 dfail:0 fail:0 skip:10 time: 491s fi-skl-gvtdvm total:278 pass:265 dwarn:0 dfail:0 fail:0 skip:13 time: 436s fi-snb-2520m total:278 pass:250 dwarn:0 dfail:0 fail:0 skip:28 time: 529s fi-snb-2600 total:278 pass:249 dwarn:0 dfail:0 fail:0 skip:29 time: 411s
fi-bxt-j4205 failed to collect. IGT log at Patchwork_4413/fi-bxt-j4205/igt.log
39a0f48c8bc7c528cc705016dafa08a9dedfd36b drm-tip: 2017y-04m-05d-13h-22m-47s UTC integration manifest c328081 drm/i915: Use the engine class to get the context size
dab2e3f drm/i915: Split the engine info table in two levels, using class + instance f3c78f4 drm/i915: Generate the engine name based on the instance number
14f39bb drm/i915: Use the same vfunc for BSD2 ring init
50e8315 drm/i915: Classify the engines in class + instance
== Logs ==
For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_4413/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx