drm/i915: IVB MI_DISPLAY_FLIP cacheline trick v2
Subsystems (2)
cover drm/i915: IVB MI_DISPLAY_FLIP cacheline trick v2
From: Ville Syrjälä <[email protected]>
BSpec tells us that the entire MI_DISPLAY_FLIP packet must be contained within a single cacheline on IVB. This series achieves that.
Changes since my original patch [1]:
* Move the logic into a new intel_ring_begin_cacheline_safe() function (as suggested by Daniel).
* Actually handle the case when the ring would wrap due to the extra dwords. With the original patch, the MI_DISPLAY_FLIP packet might still end up straddling two cachelines in this case.
Changes since v1 [2]:
* Just do the simple cacheline alignment trick Chris suggested
[1] https://bugs.freedesktop.org/show_bug.cgi?id=74053#
[2] http://lists.freedesktop.org/archives/intel-gfx/2014-February/039921.html
Ville Syrjälä (2):
drm/i915: Add intel_ring_cachline_align()
drm/i915: Prevent MI_DISPLAY_FLIP straddling two cachelines on IVB
drivers/gpu/drm/i915/intel_display.c | 14 ++++++++++++++ drivers/gpu/drm/i915/intel_ringbuffer.c | 21 +++++++++++++++++++++ drivers/gpu/drm/i915/intel_ringbuffer.h | 1 + 3 files changed, 36 insertions(+)
Signature · 6 lines
1.8.3.2 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v3 2/2 drm/i915: Prevent MI_DISPLAY_FLIP straddling two cachelines on IVB
From: Ville Syrjälä <[email protected]>
According to BSpec the entire MI_DISPLAY_FLIP packet must be contained in a single cacheline. Make sure that happens.
v2: Use intel_ring_begin_cacheline_safe()
v3: Use intel_ring_cacheline_align() (Chris)
Cc: Bjoern C <[email protected]>
Cc: Alexandru DAMIAN <[email protected]>
Cc: Enrico Tagliavini <[email protected]>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=74053
--- drivers/gpu/drm/i915/intel_display.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
drivers/gpu/drm/i915/intel_display.c +14 -0
@@ -8609,6 +8609,20 @@ static int intel_gen7_queue_flip(struct drm_device *dev,if (ring->id ==RCS ) len +=6 ; +/* +* BSpec MI_DISPLAY_FLIP for IVB: +* "The full packet must be contained within the same cache line." +* +* Currently the LRI+SRM+MI_DISPLAY_FLIP all fit within the same +* cacheline, if we ever start emitting more commands before +* the MI_DISPLAY_FLIP we may need to first emit everything else, +* then do the cacheline alignment, and finally emit the +* MI_DISPLAY_FLIP. +*/ + ret =intel_ring_cacheline_align (ring); +if (ret) + goto err_unpin; + ret =intel_ring_begin (ring, len);if (ret) goto err_unpin;
Signature · 6 lines
1.8.3.2 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH v3 2/2] drm/i915: Prevent MI_DISPLAY_FLIP straddling two cachelines on IVB
Quoted 5 lines · On Tue, Feb 11, 2014 at 07:52:06PM +0200, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
According to BSpec the entire
MI_DISPLAY_FLIPpacket must be contained in a single cacheline. Make sure that happens.
Quoted 8 lines
v2: Use
intel_ring_begin_cacheline_safe()
v3: Useintel_ring_cacheline_align()(Chris)Cc: Bjoern C <[email protected]>
Cc: Alexandru DAMIAN <[email protected]>
Cc: Enrico Tagliavini <[email protected]>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=74053Signed-off-by Ville Syrjälä <[email protected]>
I would have used intel_ring_align_cacheline() as it seems more natural for me to say...
Both,
-Chris
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
Re: [PATCH v3 2/2] drm/i915: Prevent MI_DISPLAY_FLIP straddling two cachelines on IVB
Quoted 9 lines · Chris Wilson
Quoted 8 lines · On Tue, Feb 11, 2014 at 07:52:06PM +0200, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
According to BSpec the entire
MI_DISPLAY_FLIPpacket must be contained in a single cacheline. Make sure that happens.v2: Use
intel_ring_begin_cacheline_safe()
v3: Useintel_ring_cacheline_align()(Chris)
Quoted 8 lines
Quoted 5 lines
Cc: Bjoern C <[email protected]>
Cc: Alexandru DAMIAN <[email protected]>
Cc: Enrico Tagliavini <[email protected]>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=74053Signed-off-by Ville Syrjälä <[email protected]>I would have used
intel_ring_align_cacheline()as it seems more natural for me to say...
I had it as intel_ring_align_to_cacheline(), but then changed it when I saw Daniel's suggestion for the name. So you can blame Daniel for this ;) But I have no emotional attachment to the chosen name. So if you prefer we rename it, I'm fine with that.
Signature · 2 lines
Ville Syrjälä Intel OTC
Re: [PATCH v3 2/2] drm/i915: Prevent MI_DISPLAY_FLIP straddling two cachelines on IVB
In reply to Chris WilsonQuoted 15 lines · Chris Wilson
Quoted 5 lines · On Tue, Feb 11, 2014 at 07:52:06PM +0200, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
According to BSpec the entire
MI_DISPLAY_FLIPpacket must be contained in a single cacheline. Make sure that happens.Quoted 8 lines
v2: Use
intel_ring_begin_cacheline_safe()
v3: Useintel_ring_cacheline_align()(Chris)Cc: Bjoern C <[email protected]>
Cc: Alexandru DAMIAN <[email protected]>
Cc: Enrico Tagliavini <[email protected]>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=74053Signed-off-by Ville Syrjälä <[email protected]>
Quoted 5 lines
I would have used
intel_ring_align_cacheline()as it seems more natural for me to say...Both,
Reviewed-by Chris Wilson <[email protected]>
Both merged to -fixes with cc: stable slapped on them. -Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
PATCH 1/2 drm/i915: Add intel_ring_cachline_align()
In reply to [email protected]From: Ville Syrjälä <[email protected]>
intel_ring_cachline_align() emits MI_NOOPs until the ring tail is aligned to a cacheline boundary.
--- drivers/gpu/drm/i915/intel_ringbuffer.c | 21 +++++++++++++++++++++ drivers/gpu/drm/i915/intel_ringbuffer.h | 1 + 2 files changed, 22 insertions(+)
drivers/gpu/drm/i915/intel_ringbuffer.c +21 -0
@@ -1638,6 +1638,27 @@ int intel_ring_begin(struct intel_ring_buffer *ring,return 0 ; } +/* Align the ring tail to a cacheline boundary */ +int intel_ring_cacheline_align (struct intel_ring_buffer *ring) +{ +int num_dwords = (64 - (ring->tail &63 )) /sizeof (uint32_t ); +int ret; + +if (num_dwords ==0 ) +return 0 ; + + ret =intel_ring_begin (ring, num_dwords); +if (ret) +return ret; + +while (num_dwords--) +intel_ring_emit (ring,MI_NOOP ); + +intel_ring_advance (ring); + +return 0 ; +} +void intel_ring_init_seqno (struct intel_ring_buffer *ring,u32 seqno) {struct drm_i915_private *dev_priv = ring->dev->dev_private;
drivers/gpu/drm/i915/intel_ringbuffer.h +1 -0
@@ -235,6 +235,7 @@ intel_write_status_page(struct intel_ring_buffer *ring,void intel_cleanup_ring_buffer (struct intel_ring_buffer *ring);int __must_check intel_ring_begin (struct intel_ring_buffer *ring,int n); +int __must_check intel_ring_cacheline_align (struct intel_ring_buffer *ring);static inline void intel_ring_emit (struct intel_ring_buffer *ring,u32 data) {
Signature · 6 lines
1.8.3.2 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx