drm/i915: use semaphores for the display plane
Subsystems (2)
PATCH v2 1/1 drm/i915: use semaphores for the display plane
In theory this will have performance and power improvements. Performance because we don't need to stall when the scanout BO is busy, and power because we don't have to stall when the BO is busy (and the ring can even go to sleep if the HW supports it).
v2:
squash 2 patches into 1 (me)
un-inline the enable_semaphores function (Daniel) remove comment about SNB hangs from i915_gem_object_sync (Chris) rename intel_enable_semaphores to i915_semaphore_is_enabled (me) removed page flip comment; "no why" (Chris)
To address other comments from Daniel (irc):
update the comment to say 'vt-d is crap, don't enable semaphores'
- I think you misinterpreted Chris' comment, it already exists.
checking out whether we can pageflip on the render ring on ivb (didn't work on early silicon)
- We don't want to enable workarounds for early silicon unless we have
to.
- I can't find any references in the docs about this.
optionally use it if the fb is already busy on the render ring
- This should be how the code already worked, unless I am misunderstanding your meaning.
--- drivers/gpu/drm/i915/i915_drv.c | 15 +++++++ drivers/gpu/drm/i915/i915_drv.h | 4 ++ drivers/gpu/drm/i915/i915_gem.c | 51 +++++++++++++++++++---- drivers/gpu/drm/i915/i915_gem_execbuffer.c | 60 +--------------------------- 4 files changed, 64 insertions(+), 66 deletions(-)
drivers/gpu/drm/i915/i915_drv.c +15 -0
@@ -389,6 +389,21 @@ void intel_detect_pch(struct drm_device *dev) } } +bool i915_semaphore_is_enabled (struct drm_device *dev) +{ +if (INTEL_INFO (dev)->gen <6 ) +return 0 ; + +if (i915_semaphores >=0 ) +return i915_semaphores; + +/* Enable semaphores on SNB when IO remapping is off */ +if (INTEL_INFO (dev)->gen ==6 ) +return !intel_iommu_enabled; + +return 1 ; +} +void __gen6_gt_force_wake_get (struct drm_i915_private *dev_priv) {int count;
drivers/gpu/drm/i915/i915_drv.h +4 -0
@@ -38,6 +38,7 @@#include <linux/i2c-algo-bit.h> #include <drm/intel-gtt.h> #include <linux/backlight.h> +#include <linux/intel-iommu.h> /* General customization: */
@@ -1209,6 +1210,8 @@ void i915_gem_lastclose(struct drm_device *dev);int __must_check i915_mutex_lock_interruptible (struct drm_device *dev);int __must_check i915_gem_object_wait_rendering (struct drm_i915_gem_object *obj); +int i915_gem_object_sync (struct drm_i915_gem_object *obj, +struct intel_ring_buffer *to);void i915_gem_object_move_to_active (struct drm_i915_gem_object *obj,struct intel_ring_buffer *ring,u32 seqno);
@@ -1416,6 +1419,7 @@ extern void gen6_set_rps(struct drm_device *dev, u8 val);extern void intel_detect_pch (struct drm_device *dev);extern int intel_trans_dp_port_sel (struct drm_crtc *crtc); +extern bool i915_semaphore_is_enabled (struct drm_device *dev);extern void __gen6_gt_force_wake_get (struct drm_i915_private *dev_priv);extern void __gen6_gt_force_wake_mt_get (struct drm_i915_private *dev_priv);extern void __gen6_gt_force_wake_put (struct drm_i915_private *dev_priv);
drivers/gpu/drm/i915/i915_gem.c +44 -7
69 lines not on this page · raw message
drivers/gpu/drm/i915/i915_gem_execbuffer.c +1 -59
72 lines not on this page · raw message
Signature · 1 line
1.7.9.5
Daniel Vetter
AppliedQuoted 18 lines · Ben Widawsky
In theory this will have performance and power improvements. Performance because we don't need to stall when the scanout BO is busy, and power because we don't have to stall when the BO is busy (and the ring can even go to sleep if the HW supports it).
v2:
squash 2 patches into 1 (me)
un-inline theenable_semaphoresfunction (Daniel) remove comment about SNB hangs fromi915_gem_object_sync(Chris) renameintel_enable_semaphorestoi915_semaphore_is_enabled(me) removed page flip comment; "no why" (Chris)To address other comments from Daniel (irc):
update the comment to say 'vt-d is crap, don't enable semaphores'
- I think you misinterpreted Chris' comment, it already exists.
checking out whether we can pageflip on the render ring on ivb (didn't work on early silicon)
- We don't want to enable workarounds for early silicon unless we have
Quoted 8 lines
to.- I can't find any references in the docs about this.
optionally use it if the fb is already busy on the render ring
- This should be how the code already worked, unless I am misunderstanding your meaning.CC Chris Wilson <[email protected]>Signed-off-by Ben Widawsky <[email protected]>
Queued for -next (with Chris' irc r-b added), thanks for the patch. -Daniel
Signature · 3 lines
Daniel Vetter Mail: [email protected] Mobile: +41 (0)79 365 57 48
Quoted 29 lines · Ben Widawsky
In theory this will have performance and power improvements. Performance because we don't need to stall when the scanout BO is busy, and power because we don't have to stall when the BO is busy (and the ring can even go to sleep if the HW supports it).
v2:
squash 2 patches into 1 (me)
un-inline theenable_semaphoresfunction (Daniel) remove comment about SNB hangs fromi915_gem_object_sync(Chris) renameintel_enable_semaphorestoi915_semaphore_is_enabled(me) removed page flip comment; "no why" (Chris)To address other comments from Daniel (irc):
update the comment to say 'vt-d is crap, don't enable semaphores'
- I think you misinterpreted Chris' comment, it already exists.
checking out whether we can pageflip on the render ring on ivb (didn't work on early silicon)
- We don't want to enable workarounds for early silicon unless we haveto.- I can't find any references in the docs about this.
optionally use it if the fb is already busy on the render ring
- This should be how the code already worked, unless I am misunderstanding your meaning.CC Chris Wilson <[email protected]>Signed-off-by Ben Widawsky <[email protected]>drivers/gpu/drm/i915/i915_gem.c +2
-0+int +i915_gem_object_sync(struct drm_i915_gem_object *obj,
drivers/gpu/drm/i915/i915_gem.c i915_gem_object_wait_rendering(struct drm_i915_gem_object *obj) · line 1967
Quoted 10 lines
drivers/gpu/drm/i915/i915_gem.c +10
-0+ struct intel_ring_buffer *to) +{ +struct intel_ring_buffer *from = obj->ring; +u32 seqno; +int ret, idx; + +if (from ==NULL || to == from) +return 0 ; + +if (!i915_semaphore_is_enabled (obj->base.dev))
Bug^ :(
-Chris
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
Quoted 28 lines · Chris Wilson
Quoted 26 lines · Ben Widawsky
In theory this will have performance and power improvements. Performance because we don't need to stall when the scanout BO is busy, and power because we don't have to stall when the BO is busy (and the ring can even go to sleep if the HW supports it).
v2:
squash 2 patches into 1 (me)
un-inline theenable_semaphoresfunction (Daniel) remove comment about SNB hangs fromi915_gem_object_sync(Chris) renameintel_enable_semaphorestoi915_semaphore_is_enabled(me) removed page flip comment; "no why" (Chris)To address other comments from Daniel (irc):
update the comment to say 'vt-d is crap, don't enable semaphores'
- I think you misinterpreted Chris' comment, it already exists.
checking out whether we can pageflip on the render ring on ivb (didn't work on early silicon)
- We don't want to enable workarounds for early silicon unless we haveto.- I can't find any references in the docs about this.
optionally use it if the fb is already busy on the render ring
- This should be how the code already worked, unless I am misunderstanding your meaning.CC Chris Wilson <[email protected]>Signed-off-by Ben Widawsky <[email protected]>
Quoted 13 lines
drivers/gpu/drm/i915/i915_gem.c i915_gem_object_wait_rendering(struct drm_i915_gem_object *obj) · line 1967
Quoted 12 lines
drivers/gpu/drm/i915/i915_gem.c +12
-0+int +i915_gem_object_sync (struct drm_i915_gem_object *obj, +struct intel_ring_buffer *to) +{ +struct intel_ring_buffer *from = obj->ring; +u32 seqno; +int ret, idx; + +if (from ==NULL || to == from) +return 0 ; + +if (!i915_semaphore_is_enabled (obj->base.dev))Bug^ :(
To elaborate, for to == NULL we need to do a synchronous wait_rendering, too. This happens for set_base and modeset. Furthermore I've noticed two other things while reading this function that imo deserve each another patch:
- we update from->sync_seqno before to->sync_to successfully emits the sync. That should happen after sync_to (and obviously only if that succeeds).
- the seqno - 1 semantics of sync_to is annoying me. Imo that kind of low-level stuff should be handled by the sync_to implementation.
Unfortunately neither the bug noticed by Chris nor the sync_seqno thing can easily be exercised with i-g-t :(
Cheers, Daniel
Signature · 3 lines
Daniel Vetter Mail: [email protected] Mobile: +41 (0)79 365 57 48
Quoted 43 lines · On Wed, 11 Apr 2012 14:06:42 +0200 Daniel Vetter <[email protected]> wrote:
Quoted 28 lines · Chris Wilson
Quoted 26 lines · Ben Widawsky
In theory this will have performance and power improvements. Performance because we don't need to stall when the scanout BO is busy, and power because we don't have to stall when the BO is busy (and the ring can even go to sleep if the HW supports it).
v2:
squash 2 patches into 1 (me)
un-inline theenable_semaphoresfunction (Daniel) remove comment about SNB hangs fromi915_gem_object_sync(Chris) renameintel_enable_semaphorestoi915_semaphore_is_enabled(me) removed page flip comment; "no why" (Chris)To address other comments from Daniel (irc):
update the comment to say 'vt-d is crap, don't enable semaphores'
- I think you misinterpreted Chris' comment, it already exists.
checking out whether we can pageflip on the render ring on ivb (didn't work on early silicon)
- We don't want to enable workarounds for early silicon unless we haveto.- I can't find any references in the docs about this.
optionally use it if the fb is already busy on the render ring
- This should be how the code already worked, unless I am misunderstanding your meaning.CC Chris Wilson <[email protected]>Signed-off-by Ben Widawsky <[email protected]>Quoted 13 lines
drivers/gpu/drm/i915/i915_gem.c i915_gem_object_wait_rendering(struct drm_i915_gem_object *obj) · line 1967
Quoted 12 lines
drivers/gpu/drm/i915/i915_gem.c +12
-0+int +i915_gem_object_sync (struct drm_i915_gem_object *obj, +struct intel_ring_buffer *to) +{ +struct intel_ring_buffer *from = obj->ring; +u32 seqno; +int ret, idx; + +if (from ==NULL || to == from) +return 0 ; + +if (!i915_semaphore_is_enabled (obj->base.dev))Bug^ :(
Quoted 4 lines
To elaborate, for to == NULL we need to do a synchronous
wait_rendering, too. This happens forset_baseand modeset. Furthermore I've noticed two other things while reading this function that imo deserve each another patch:
if (from == NULL && !obj->active) should suffice?
This sounds like a pretty bad hack when it at some point in modesetting code... who would have thought?
Quoted 3 lines
- we update
from->sync_seqnobeforeto->sync_tosuccessfully emits the sync. That should happen aftersync_to(and obviously only if that succeeds).
Probably a remnant of when ring_begin couldn't fail. This deserves to be fixed, I will do this today if y'all haven't done it already.
Quoted 2 lines
- the seqno - 1 semantics of
sync_tois annoying me. Imo that kind of low-level stuff should be handled by thesync_toimplementation.
If it ain't broke, don't fix it? I do agree with you, but I'll venture to guess that I am less annoyed by it.
Quoted 5 lines
Unfortunately neither the bug noticed by Chris nor the
sync_seqnothing can easily be exercised with i-g-t :(Cheers, Daniel
Quoted 46 lines · Ben Widawsky
Quoted 43 lines · On Wed, 11 Apr 2012 14:06:42 +0200 Daniel Vetter <[email protected]> wrote:
Quoted 41 lines · Chris Wilson
Quoted 29 lines · Ben Widawsky
In theory this will have performance and power improvements. Performance because we don't need to stall when the scanout BO is busy, and power because we don't have to stall when the BO is busy (and the ring can even go to sleep if the HW supports it).
v2:
squash 2 patches into 1 (me)
un-inline theenable_semaphoresfunction (Daniel) remove comment about SNB hangs fromi915_gem_object_sync(Chris) renameintel_enable_semaphorestoi915_semaphore_is_enabled(me) removed page flip comment; "no why" (Chris)To address other comments from Daniel (irc):
update the comment to say 'vt-d is crap, don't enable semaphores'
- I think you misinterpreted Chris' comment, it already exists.
checking out whether we can pageflip on the render ring on ivb (didn't work on early silicon)
- We don't want to enable workarounds for early silicon unless we haveto.- I can't find any references in the docs about this.
optionally use it if the fb is already busy on the render ring
- This should be how the code already worked, unless I am misunderstanding your meaning.CC Chris Wilson <[email protected]>Signed-off-by Ben Widawsky <[email protected]>drivers/gpu/drm/i915/i915_gem.c +2
-0+int +i915_gem_object_sync(struct drm_i915_gem_object *obj,drivers/gpu/drm/i915/i915_gem.c i915_gem_object_wait_rendering(struct drm_i915_gem_object *obj) · line 1967
Quoted 10 lines
drivers/gpu/drm/i915/i915_gem.c +10
-0+ struct intel_ring_buffer *to) +{ +struct intel_ring_buffer *from = obj->ring; +u32 seqno; +int ret, idx; + +if (from ==NULL || to == from) +return 0 ; + +if (!i915_semaphore_is_enabled (obj->base.dev))Bug^ :(
Quoted 6 lines
Quoted 4 lines
To elaborate, for to == NULL we need to do a synchronous
wait_rendering, too. This happens forset_baseand modeset. Furthermore I've noticed two other things while reading this function that imo deserve each another patch:if (from == NULL && !obj->active) should suffice?
if (to == NULL || !i915_sempahores)
return i915_gem_object_wait_rendering(obj);
-Chris
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
Quoted 52 lines · On Wed, 11 Apr 2012 16:52:33 +0100 Chris Wilson <[email protected]>…
Quoted 51 lines · Ben Widawsky
Quoted 47 lines · On Wed, 11 Apr 2012 14:06:42 +0200 Daniel Vetter <[email protected]> wrote:
Quoted 28 lines · Chris Wilson
Quoted 26 lines · Ben Widawsky
In theory this will have performance and power improvements. Performance because we don't need to stall when the scanout BO is busy, and power because we don't have to stall when the BO is busy (and the ring can even go to sleep if the HW supports it).
v2:
squash 2 patches into 1 (me)
un-inline theenable_semaphoresfunction (Daniel) remove comment about SNB hangs fromi915_gem_object_sync(Chris) renameintel_enable_semaphorestoi915_semaphore_is_enabled(me) removed page flip comment; "no why" (Chris)To address other comments from Daniel (irc):
update the comment to say 'vt-d is crap, don't enable semaphores'
- I think you misinterpreted Chris' comment, it already exists.
checking out whether we can pageflip on the render ring on ivb (didn't work on early silicon)
- We don't want to enable workarounds for early silicon unless we haveto.- I can't find any references in the docs about this.
optionally use it if the fb is already busy on the render ring
- This should be how the code already worked, unless I am misunderstanding your meaning.CC Chris Wilson <[email protected]>Signed-off-by Ben Widawsky <[email protected]>Quoted 13 lines
drivers/gpu/drm/i915/i915_gem.c i915_gem_object_wait_rendering(struct drm_i915_gem_object *obj) · line 1967
Quoted 12 lines
drivers/gpu/drm/i915/i915_gem.c +12
-0+int +i915_gem_object_sync (struct drm_i915_gem_object *obj, +struct intel_ring_buffer *to) +{ +struct intel_ring_buffer *from = obj->ring; +u32 seqno; +int ret, idx; + +if (from ==NULL || to == from) +return 0 ; + +if (!i915_semaphore_is_enabled (obj->base.dev))Bug^ :(
To elaborate, for to == NULL we need to do a synchronous
wait_rendering, too. This happens forset_baseand modeset. Furthermore I've noticed two other things while reading this function that imo deserve each another patch:
Quoted 6 lines
Quoted 1 line
if (from == NULL && !obj->active) should suffice?
if (to == NULL || !i915_sempahores)
returni915_gem_object_wait_rendering(obj);
-Chris
Ha, I misread it... I thought from->ring could be NULL, and we needed to wait for rendering. So wait, in this case, to and from are both NULL? Doesn't that mean both objects are already setup for use by display? A bad assumption, but I think it would technically work as the code is, today.