drm/i915/bdw: Enable full PPGTT
Subsystems (2)
PATCH 1/1 drm/i915/bdw: Enable full PPGTT
Broadwell is perfectly capable of full PPGTT. I've been using it for some time, and seen no especially ill effects.
--- drivers/gpu/drm/i915/i915_drv.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +1 -2
@@ -1830,8 +1830,7 @@ struct drm_i915_cmd_table {#define HAS_HW_CONTEXTS (dev) (INTEL_INFO(dev)->gen >= 6)#define HAS_ALIASING_PPGTT (dev) (INTEL_INFO(dev)->gen >= 6 && !IS_VALLEYVIEW(dev)) -#define HAS_PPGTT (dev) (INTEL_INFO(dev)->gen >= 7 && !IS_VALLEYVIEW(dev) \ - && !IS_BROADWELL(dev)) +#define HAS_PPGTT (dev) (INTEL_INFO(dev)->gen >= 7 && !IS_VALLEYVIEW(dev))#define USES_PPGTT (dev) intel_enable_ppgtt(dev, false)#define USES_FULL_PPGTT (dev) intel_enable_ppgtt(dev, true)
Signature · 1 line
1.9.1
Quoted 4 lines · Ben Widawsky
Broadwell is perfectly capable of full PPGTT. I've been using it for some time, and seen no especially ill effects.
Signed-off-by Ben Widawsky <[email protected]>
Nak. I spoke too soon. 1 context + default works fine. More than that gets ugly.
Quoted 25 lines
--- drivers/gpu/drm/i915/i915_drv.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/gpu/drm/i915/i915_drv.h +1
-2@@ -1830,8 +1830,7 @@ struct drm_i915_cmd_table {#define HAS_HW_CONTEXTS (dev) (INTEL_INFO(dev)->gen >= 6)#define HAS_ALIASING_PPGTT (dev) (INTEL_INFO(dev)->gen >= 6 && !IS_VALLEYVIEW(dev)) -#define HAS_PPGTT (dev) (INTEL_INFO(dev)->gen >= 7 && !IS_VALLEYVIEW(dev) \ - && !IS_BROADWELL(dev)) +#define HAS_PPGTT (dev) (INTEL_INFO(dev)->gen >= 7 && !IS_VALLEYVIEW(dev))#define USES_PPGTT (dev) intel_enable_ppgtt(dev, false)#define USES_FULL_PPGTT (dev) intel_enable_ppgtt(dev, true)Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 1 line
Ben Widawsky, Intel Open Source Technology Center
PATCH 1/3 drm/i915/ppgtt: Load address space after mi_set_context
On GEN8 the PDPs are saved and restored with context, which means we must set them after the context switch has occurred. If we do not do this, we end up saving the new PDPs for the old context.
The next patch will go one step further and actually only load the PDPs once.
Example of a problem
LRI PDPs 1MI_SET_CONTEXT barLRI_PDPs 2MI_SET_CONTEXT foo // save PDPs 2 to bar's context
// load foos PDPs
LRI PDPs 1MI_SET_CONTEXT bar // save PDPs 1 to foo's context
It's all wacky. This should allow full PPGTT on Broadwell to work.
--- drivers/gpu/drm/i915/i915_gem_context.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/i915_gem_context.c +18 -6
@@ -667,13 +667,12 @@ static int do_switch(struct intel_ring_buffer *ring,*/ from = ring->last_context; -if (USES_FULL_PPGTT (ring->dev)) { - ret = ppgtt->switch_mm (ppgtt, ring, false); -if (ret) - goto unpin_out; - } -if (ring != &dev_priv->ring[RCS ]) { +if (USES_FULL_PPGTT (ring->dev)) { + ret = ppgtt->switch_mm (ppgtt, ring, false); +if (ret) + goto unpin_out; + }if (from)i915_gem_context_unreference (from); goto done;
@@ -711,6 +710,19 @@ static int do_switch(struct intel_ring_buffer *ring,if (ret) goto unpin_out; +if (USES_FULL_PPGTT (ring->dev)) { + ret = ppgtt->switch_mm (ppgtt, ring, false); +/* The hardware context switch is emitted, but we haven't +* actually changed the state - so it's probably safe to bail +* here. Still, let the user know something dangerous has +* happened. +*/ +if (ret) { +DRM_ERROR ("Failed to change address space on context switch\n" ); + goto unpin_out; + } + } +for (i =0 ; i <MAX_L3_SLICES ; i++) {if (!(to->remap_slice & (1 <<i)))continue ;
Signature · 1 line
1.9.1
PATCH 2/3 drm/i915/bdw: Render ring PDP is restored with context
So let's not do it every time we switch.
--- drivers/gpu/drm/i915/i915_gem_context.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_gem_context.c +1 -1
@@ -710,7 +710,7 @@ static int do_switch(struct intel_ring_buffer *ring,if (ret) goto unpin_out; -if (USES_FULL_PPGTT (ring->dev)) { +if (USES_FULL_PPGTT (ring->dev) && !to->is_initialized) { ret = ppgtt->switch_mm (ppgtt, ring, false);/* The hardware context switch is emitted, but we haven't * actually changed the state - so it's probably safe to bail
Signature · 1 line
1.9.1
PATCH v2 2/3 drm/i915/bdw: Render ring PDP is restored with context
So let's not do it every time we switch.
v2: v1 skipped the switch for all gens. We still need it pre-gen8.
--- drivers/gpu/drm/i915/i915_gem_context.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_gem_context.c +2 -1
@@ -710,7 +710,8 @@ static int do_switch(struct intel_ring_buffer *ring,if (ret) goto unpin_out; -if (USES_FULL_PPGTT (ring->dev)) { +if (USES_FULL_PPGTT (ring->dev) && + (!IS_GEN8 (ring->dev) || !to->is_initialized)) { ret = ppgtt->switch_mm (ppgtt, ring, false);/* The hardware context switch is emitted, but we haven't * actually changed the state - so it's probably safe to bail
Signature · 1 line
1.9.1
Re: [PATCH 2/3] [v2] drm/i915/bdw: Render ring PDP is restored with context
Quoted 5 lines · Ben Widawsky
So let's not do it every time we switch.
v2: v1 skipped the switch for all gens. We still need it pre-gen8.
Signed-off-by Ben Widawsky <[email protected]>
Please ignore this patch. I actually need to rework some stuff. 1 and 3 are still good though.
Quoted 25 lines
--- drivers/gpu/drm/i915/i915_gem_context.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/gpu/drm/i915/i915_gem_context.c +2
-1@@ -710,7 +710,8 @@ static int do_switch(struct intel_ring_buffer *ring,if (ret) goto unpin_out; -if (USES_FULL_PPGTT (ring->dev)) { +if (USES_FULL_PPGTT (ring->dev) && + (!IS_GEN8 (ring->dev) || !to->is_initialized)) { ret = ppgtt->switch_mm (ppgtt, ring, false);/* The hardware context switch is emitted, but we haven't * actually changed the state - so it's probably safe to bail Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 1 line
Ben Widawsky, Intel Open Source Technology Center
PATCH 3/3 drm/i915/bdw: Enable full PPGTT
In reply to Ben WidawskyBroadwell is perfectly capable of full PPGTT. I've been using it for some time, and seen no especially ill effects.
--- drivers/gpu/drm/i915/i915_drv.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +1 -2
@@ -1830,8 +1830,7 @@ struct drm_i915_cmd_table {#define HAS_HW_CONTEXTS (dev) (INTEL_INFO(dev)->gen >= 6)#define HAS_ALIASING_PPGTT (dev) (INTEL_INFO(dev)->gen >= 6 && !IS_VALLEYVIEW(dev)) -#define HAS_PPGTT (dev) (INTEL_INFO(dev)->gen >= 7 && !IS_VALLEYVIEW(dev) \ - && !IS_BROADWELL(dev)) +#define HAS_PPGTT (dev) (INTEL_INFO(dev)->gen >= 7 && !IS_VALLEYVIEW(dev))#define USES_PPGTT (dev) intel_enable_ppgtt(dev, false)#define USES_FULL_PPGTT (dev) intel_enable_ppgtt(dev, true)
Signature · 1 line
1.9.1