Re: [Intel-gfx] [PATCH v2 4/4] drm/i915:bxt: Enable Pooled EU support

2015-07-17 Thread Chris Wilson
On Fri, Jul 17, 2015 at 07:13:34PM +0100, Arun Siluvery wrote:
> This mode allows to assign EUs to pools which can process work collectively.
> The command to enable this mode should be issued as part of context 
> initialization.
> 
> The pooled mode is global, once enabled it has to stay the same across all
> contexts until HW reset hence this is sent in auxiliary golden context batch.
> Thanks to Mika for the preliminary review and comments.
> 
> v2: explain why this is enabled in golden context, use feature flag while
> enabling the support (Chris)

You fell into the trap of telling userspace this was setup before we
actually do so.
 
> Cc: Mika Kuoppala 
> Cc: Chris Wilson 
> Cc: Armin Reese 
> Signed-off-by: Arun Siluvery 
> ---
>  drivers/gpu/drm/i915/i915_gem_render_state.c | 15 +++
>  drivers/gpu/drm/i915/i915_reg.h  |  2 ++
>  2 files changed, 17 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem_render_state.c 
> b/drivers/gpu/drm/i915/i915_gem_render_state.c
> index 5026a62..e4ff342 100644
> --- a/drivers/gpu/drm/i915/i915_gem_render_state.c
> +++ b/drivers/gpu/drm/i915/i915_gem_render_state.c
> @@ -93,6 +93,7 @@ free_gem:
>  
>  static int render_state_setup(struct render_state *so)
>  {
> + struct drm_device *dev = so->obj->base.dev;
>   const struct intel_renderstate_rodata *rodata = so->rodata;
>   unsigned int i = 0, reloc_index = 0;
>   struct page *page;
> @@ -134,6 +135,20 @@ static int render_state_setup(struct render_state *so)
>  
>   so->aux_batch_offset = i * sizeof(u32);
>  
> + if (HAS_POOLED_EU(dev)) {
> + u32 pool_config = 0;
> + struct drm_i915_private *dev_priv = to_i915(dev);

Just a minor, as this would be neater as

u32 pool_config =
INTEL_INFO(dev)->subslice_total == 3 ? 0x00777000 : 0;

At the very least keep both paths to set pool_config next to each other,
e.g.
u32 pool_config;
...
pool_config = 0;
if (INTEL_INFO(dev)->subslice_total == 3)
pool_config = 0x00777000;

Then we just have

> + OUT_BATCH(d, i, GEN9_MEDIA_POOL_STATE);
> + OUT_BATCH(d, i, GEN9_MEDIA_POOL_ENABLE);
> + OUT_BATCH(d, i, pool_config);
> + OUT_BATCH(d, i, 0);
> + OUT_BATCH(d, i, 0);
> + OUT_BATCH(d, i, 0);

Which is much easier to read.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH v2 4/4] drm/i915:bxt: Enable Pooled EU support

2015-07-17 Thread Arun Siluvery
This mode allows to assign EUs to pools which can process work collectively.
The command to enable this mode should be issued as part of context 
initialization.

The pooled mode is global, once enabled it has to stay the same across all
contexts until HW reset hence this is sent in auxiliary golden context batch.
Thanks to Mika for the preliminary review and comments.

v2: explain why this is enabled in golden context, use feature flag while
enabling the support (Chris)

Cc: Mika Kuoppala 
Cc: Chris Wilson 
Cc: Armin Reese 
Signed-off-by: Arun Siluvery 
---
 drivers/gpu/drm/i915/i915_gem_render_state.c | 15 +++
 drivers/gpu/drm/i915/i915_reg.h  |  2 ++
 2 files changed, 17 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_gem_render_state.c 
b/drivers/gpu/drm/i915/i915_gem_render_state.c
index 5026a62..e4ff342 100644
--- a/drivers/gpu/drm/i915/i915_gem_render_state.c
+++ b/drivers/gpu/drm/i915/i915_gem_render_state.c
@@ -93,6 +93,7 @@ free_gem:
 
 static int render_state_setup(struct render_state *so)
 {
+   struct drm_device *dev = so->obj->base.dev;
const struct intel_renderstate_rodata *rodata = so->rodata;
unsigned int i = 0, reloc_index = 0;
struct page *page;
@@ -134,6 +135,20 @@ static int render_state_setup(struct render_state *so)
 
so->aux_batch_offset = i * sizeof(u32);
 
+   if (HAS_POOLED_EU(dev)) {
+   u32 pool_config = 0;
+   struct drm_i915_private *dev_priv = to_i915(dev);
+
+   OUT_BATCH(d, i, GEN9_MEDIA_POOL_STATE);
+   OUT_BATCH(d, i, GEN9_MEDIA_POOL_ENABLE);
+   if (dev_priv->info.subslice_total == 3)
+   pool_config = 0x00777000;
+   OUT_BATCH(d, i, pool_config);
+   OUT_BATCH(d, i, 0);
+   OUT_BATCH(d, i, 0);
+   OUT_BATCH(d, i, 0);
+   }
+
OUT_BATCH(d, i, MI_BATCH_BUFFER_END);
so->aux_batch_size = (i * sizeof(u32)) - so->aux_batch_offset;
 
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index 9a2ffad..e052499 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -379,6 +379,8 @@
  */
 #define GFX_INSTR(opcode, flags) ((0x3 << 29) | ((opcode) << 24) | (flags))
 
+#define GEN9_MEDIA_POOL_STATE ((0x3 << 29) | (0x2 << 27) | (0x5 << 16) | 4)
+#define   GEN9_MEDIA_POOL_ENABLE  (1 << 31)
 #define GFX_OP_RASTER_RULES((0x3<<29)|(0x7<<24))
 #define GFX_OP_SCISSOR ((0x3<<29)|(0x1c<<24)|(0x10<<19))
 #define   SC_UPDATE_SCISSOR   (0x1<<1)
-- 
1.9.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx