drm/i915: Use DOUBLE_BUFFER_CTL instead of vblank evasion for GEN9+.
Subsystems (2)
RFC 1/1 drm/i915: Use DOUBLE_BUFFER_CTL instead of vblank evasion for GEN9+.
References: https://bugs.freedesktop.org/show_bug.cgi?id=104975
--- drivers/gpu/drm/i915/i915_drv.h | 2 ++ drivers/gpu/drm/i915/i915_reg.h | 3 +++ drivers/gpu/drm/i915/intel_display.c | 1 + drivers/gpu/drm/i915/intel_sprite.c | 16 ++++++++++++++++ 4 files changed, 22 insertions(+)
drivers/gpu/drm/i915/i915_drv.h +2 -0
@@ -1967,6 +1967,8 @@ struct drm_i915_private {/* Display functions */ struct drm_i915_display_funcs display; +spinlock_t display_evasion_lock; +/* PCH chipset type */ enum intel_pch pch_type;unsigned short pch_id;
drivers/gpu/drm/i915/i915_reg.h +3 -0
@@ -6594,6 +6594,9 @@ enum {#define DIGITAL_PORTA_HOTPLUG_SHORT_DETECT (1 << 0)#define DIGITAL_PORTA_HOTPLUG_LONG_DETECT (2 << 0) +#define DOUBLE_BUFFER_CTL _MMIO(0x44500) +#define DOUBLE_BUFFER_CTL_GLOBAL_DISABLE (1 << 0) +/* refresh rate hardware control */ #define RR_HW_CTL _MMIO(0x45300)#define RR_HW_LOW_POWER_FRAMES_MASK 0xff
drivers/gpu/drm/i915/intel_display.c +1 -0
@@ -14476,6 +14476,7 @@ int intel_modeset_init(struct drm_device *dev) dev_priv->modeset_wq =alloc_ordered_workqueue ("i915_modeset" ,0 );drm_mode_config_init (dev); +spin_lock_init (&dev_priv->display_evasion_lock); dev->mode_config.min_width =0 ; dev->mode_config.min_height =0 ;
drivers/gpu/drm/i915/intel_sprite.c +16 -0
@@ -98,6 +98,13 @@ void intel_pipe_update_start(const struct intel_crtc_state *new_crtc_state)intel_crtc_has_type (new_crtc_state,INTEL_OUTPUT_DSI );DEFINE_WAIT (wait); +if (INTEL_GEN (dev_priv) >=9 ) { +spin_lock_irq (&dev_priv->display_evasion_lock); +I915_WRITE (DOUBLE_BUFFER_CTL ,DOUBLE_BUFFER_CTL_GLOBAL_DISABLE ); + scanline =intel_get_crtc_scanline (crtc); + goto done; + } + vblank_start = adjusted_mode->crtc_vblank_start;if (adjusted_mode->flags &DRM_MODE_FLAG_INTERLACE ) vblank_start =DIV_ROUND_UP (vblank_start,2 );
@@ -166,6 +173,7 @@ void intel_pipe_update_start(const struct intel_crtc_state *new_crtc_state)while (need_vlv_dsi_wa && scanline == vblank_start) scanline =intel_get_crtc_scanline (crtc); +done: crtc->debug.scanline_start = scanline; crtc->debug.start_vbl_time =ktime_get (); crtc->debug.start_vbl_count =intel_crtc_get_vblank_counter (crtc);
@@ -192,6 +200,9 @@ void intel_pipe_update_end(struct intel_crtc_state *new_crtc_state)trace_i915_pipe_update_end (crtc, end_vbl_count, scanline_end); +if (INTEL_GEN (dev_priv) >=9 ) +I915_WRITE (DOUBLE_BUFFER_CTL ,0 ); +/* We're still in the vblank-evade critical section, this can't race. * Would be slightly nice to just grab the vblank count and arm the * event outside of the critical section - the spinlock might spin for a
@@ -206,6 +217,11 @@ void intel_pipe_update_end(struct intel_crtc_state *new_crtc_state) new_crtc_state->base.event =NULL ; } +if (INTEL_GEN (dev_priv) >=9 ) { +spin_unlock_irq (&dev_priv->display_evasion_lock); +return ; + } +local_irq_enable ();if (intel_vgpu_active (dev_priv))
Signature · 6 lines
2.16.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoting Maarten Lankhorst (2018-02-08 08:55:38)
drivers/gpu/drm/i915/intel_display.c int intel_modeset_init(struct drm_device *dev) · line 14476
Quoted 9 lines
References: https://bugs.freedesktop.org/show_bug.cgi?id=104975
Signed-off-by Maarten Lankhorst <[email protected]>---
drivers/gpu/drm/i915/intel_display.c +0
-0@@ -14476,6 +14476,7 @@ int intel_modeset_init(struct drm_device *dev) dev_priv->modeset_wq =alloc_ordered_workqueue ("i915_modeset" ,0 );
Noticed in passing, no error handling for a failed kmalloc here. -Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.BAT: success for drm/i915: Use DOUBLE_BUFFER_CTL instead of vblank evasion for GEN9+.
In reply to Maarten Lankhorst== Series Details ==
== Series Details ==
Series: drm/i915: Use DOUBLE_BUFFER_CTL instead of vblank evasion for GEN9+.
URL : https://patchwork.freedesktop.org/series/37879/
State : success
== Summary ==
Series 37879v1 drm/i915: Use DOUBLE_BUFFER_CTL instead of vblank evasion for GEN9+.
https://patchwork.freedesktop.org/api/1.0/series/37879/revisions/1/mbox/
Test debugfs_test:
Subgroup read_all_entries:
incomplete -> PASS (fi-snb-2520m) fdo#103713
Test gem_mmap_gtt:
Subgroup basic-small-bo-tiledx:
pass -> FAIL (fi-gdg-551) fdo#102575fdo#103713 https://bugs.freedesktop.org/show_bug.cgi?id=103713
fdo#102575 https://bugs.freedesktop.org/show_bug.cgi?id=102575
fi-bdw-5557u total:288 pass:267 dwarn:0 dfail:0 fail:0 skip:21 time:415s fi-bdw-gvtdvm total:288 pass:264 dwarn:0 dfail:0 fail:0 skip:24 time:423s fi-blb-e6850 total:288 pass:223 dwarn:1 dfail:0 fail:0 skip:64 time:374s fi-bsw-n3050 total:288 pass:242 dwarn:0 dfail:0 fail:0 skip:46 time:492s fi-bwr-2160 total:288 pass:183 dwarn:0 dfail:0 fail:0 skip:105 time:285s fi-bxt-dsi total:288 pass:258 dwarn:0 dfail:0 fail:0 skip:30 time:483s fi-bxt-j4205 total:288 pass:259 dwarn:0 dfail:0 fail:0 skip:29 time:487s fi-byt-j1900 total:288 pass:253 dwarn:0 dfail:0 fail:0 skip:35 time:468s fi-byt-n2820 total:288 pass:249 dwarn:0 dfail:0 fail:0 skip:39 time:457s fi-cfl-s2 total:288 pass:262 dwarn:0 dfail:0 fail:0 skip:26 time:573s fi-cnl-y3 total:288 pass:262 dwarn:0 dfail:0 fail:0 skip:26 time:578s fi-elk-e7500 total:288 pass:229 dwarn:0 dfail:0 fail:0 skip:59 time:415s fi-gdg-551 total:288 pass:179 dwarn:0 dfail:0 fail:1 skip:108 time:285s fi-glk-1 total:288 pass:260 dwarn:0 dfail:0 fail:0 skip:28 time:513s fi-hsw-4770 total:288 pass:261 dwarn:0 dfail:0 fail:0 skip:27 time:390s fi-ilk-650 total:288 pass:228 dwarn:0 dfail:0 fail:0 skip:60 time:411s fi-ivb-3520m total:288 pass:259 dwarn:0 dfail:0 fail:0 skip:29 time:458s fi-ivb-3770 total:288 pass:255 dwarn:0 dfail:0 fail:0 skip:33 time:417s fi-kbl-7500u total:288 pass:263 dwarn:1 dfail:0 fail:0 skip:24 time:455s fi-kbl-7560u total:288 pass:269 dwarn:0 dfail:0 fail:0 skip:19 time:498s fi-kbl-7567u total:288 pass:268 dwarn:0 dfail:0 fail:0 skip:20 time:450s fi-kbl-r total:288 pass:261 dwarn:0 dfail:0 fail:0 skip:27 time:499s fi-pnv-d510 total:288 pass:222 dwarn:1 dfail:0 fail:0 skip:65 time:600s fi-skl-6260u total:288 pass:268 dwarn:0 dfail:0 fail:0 skip:20 time:427s fi-skl-6600u total:288 pass:261 dwarn:0 dfail:0 fail:0 skip:27 time:503s fi-skl-6700hq total:288 pass:262 dwarn:0 dfail:0 fail:0 skip:26 time:525s fi-skl-6700k2 total:288 pass:264 dwarn:0 dfail:0 fail:0 skip:24 time:483s fi-skl-6770hq total:288 pass:268 dwarn:0 dfail:0 fail:0 skip:20 time:471s fi-skl-guc total:288 pass:260 dwarn:0 dfail:0 fail:0 skip:28 time:415s fi-skl-gvtdvm total:288 pass:265 dwarn:0 dfail:0 fail:0 skip:23 time:427s fi-snb-2520m total:288 pass:248 dwarn:0 dfail:0 fail:0 skip:40 time:523s fi-snb-2600 total:288 pass:248 dwarn:0 dfail:0 fail:0 skip:40 time:392s
Blacklisted hosts:
fi-glk-dsi total:288 pass:258 dwarn:0 dfail:0 fail:0 skip:30 time:471s
ede4b1ac40b2c32511532ddb6849b11c0183020e drm-tip: 2018y-02m-08d-07h-43m-06s UTC integration manifest 0438ef524341 drm/i915: Use DOUBLE_BUFFER_CTL instead of vblank evasion for GEN9+.
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_7941/issues.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.IGT: success for drm/i915: Use DOUBLE_BUFFER_CTL instead of vblank evasion for GEN9+.
In reply to Maarten Lankhorst== Series Details ==
== Series Details ==
Series: drm/i915: Use DOUBLE_BUFFER_CTL instead of vblank evasion for GEN9+.
URL : https://patchwork.freedesktop.org/series/37879/
State : success
== Summary ==
Test gem_exec_suspend:
Subgroup basic-s4:
fail -> SKIP (shard-hsw) fdo#103375
Test kms_flip:
Subgroup flip-vs-panning-vs-hang-interruptible:
dmesg-warn -> PASS (shard-snb) fdo#103821
Subgroup plain-flip-fb-recreate-interruptible:
fail -> PASS (shard-hsw) fdo#100368
Subgroup blocking-wf_vblank:
fail -> PASS (shard-hsw) fdo#103928
Test kms_cursor_crc:
Subgroup cursor-64x64-suspend:
skip -> FAIL (shard-snb) fdo#102365
Test kms_plane_lowres:
Subgroup pipe-b-tiling-y:
pass -> FAIL (shard-apl) fdo#103166
Test kms_cursor_legacy:
Subgroup 2x-long-flip-vs-cursor-legacy:
pass -> FAIL (shard-hsw) fdo#104873
Subgroup cursor-vs-flip-legacy:
pass -> FAIL (shard-apl) fdo#103355
Test kms_rotation_crc:
Subgroup sprite-rotation-90-flip:
pass -> FAIL (shard-apl) fdo#103356
Test drv_selftest:
Subgroup live_gtt:
pass -> INCOMPLETE (shard-apl) fdo#103927fdo#103375 https://bugs.freedesktop.org/show_bug.cgi?id=103375
fdo#103821 https://bugs.freedesktop.org/show_bug.cgi?id=103821
fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
fdo#103928 https://bugs.freedesktop.org/show_bug.cgi?id=103928
fdo#102365 https://bugs.freedesktop.org/show_bug.cgi?id=102365
fdo#103166 https://bugs.freedesktop.org/show_bug.cgi?id=103166
fdo#104873 https://bugs.freedesktop.org/show_bug.cgi?id=104873
fdo#103355 https://bugs.freedesktop.org/show_bug.cgi?id=103355
fdo#103356 https://bugs.freedesktop.org/show_bug.cgi?id=103356
fdo#103927 https://bugs.freedesktop.org/show_bug.cgi?id=103927
shard-apl total:3332 pass:1713 dwarn:1 dfail:0 fail:22 skip:1594 time:11947s shard-hsw total:3444 pass:1760 dwarn:1 dfail:0 fail:10 skip:1672 time:11834s shard-snb total:3444 pass:1350 dwarn:1 dfail:0 fail:11 skip:2082 time:6572s
Blacklisted hosts:
shard-kbl total:3380 pass:1855 dwarn:21 dfail:0 fail:20 skip:1483 time:9492s
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_7941/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 53 lines · Maarten Lankhorst
References: https://bugs.freedesktop.org/show_bug.cgi?id=104975
Signed-off-by Maarten Lankhorst <[email protected]>--- drivers/gpu/drm/i915/i915_drv.h | 2 ++ drivers/gpu/drm/i915/i915_reg.h | 3 +++ drivers/gpu/drm/i915/intel_display.c | 1 + drivers/gpu/drm/i915/intel_sprite.c | 16 ++++++++++++++++ 4 files changed, 22 insertions(+)drivers/gpu/drm/i915/i915_drv.h +2
-0@@ -1967,6 +1967,8 @@ struct drm_i915_private {/* Display functions */ struct drm_i915_display_funcs display; +spinlock_t display_evasion_lock; +/* PCH chipset type */ enum intel_pch pch_type;unsigned short pch_id;drivers/gpu/drm/i915/i915_reg.h +3
-0@@ -6594,6 +6594,9 @@ enum {#define DIGITAL_PORTA_HOTPLUG_SHORT_DETECT (1 << 0)#define DIGITAL_PORTA_HOTPLUG_LONG_DETECT (2 << 0) +#define DOUBLE_BUFFER_CTL _MMIO(0x44500) +#define DOUBLE_BUFFER_CTL_GLOBAL_DISABLE (1 << 0) +/* refresh rate hardware control */ #define RR_HW_CTL _MMIO(0x45300)#define RR_HW_LOW_POWER_FRAMES_MASK 0xffdrivers/gpu/drm/i915/intel_display.c +1
-0@@ -14476,6 +14476,7 @@ int intel_modeset_init(struct drm_device *dev) dev_priv->modeset_wq =alloc_ordered_workqueue ("i915_modeset" ,0 );drm_mode_config_init (dev); +spin_lock_init (&dev_priv->display_evasion_lock); dev->mode_config.min_width =0 ; dev->mode_config.min_height =0 ;drivers/gpu/drm/i915/intel_sprite.c +0
-0
drivers/gpu/drm/i915/intel_sprite.c void intel_pipe_update_start(const struct intel_crtc_state *new_crtc_state) · line 106
Quoted 9 lines
drivers/gpu/drm/i915/intel_sprite.c +6
-0@@ -98,6 +98,13 @@ void intel_pipe_update_start(const struct intel_crtc_state *new_crtc_state)intel_crtc_has_type (new_crtc_state,INTEL_OUTPUT_DSI );DEFINE_WAIT (wait); +if (INTEL_GEN (dev_priv) >=9 ) { +spin_lock_irq (&dev_priv->display_evasion_lock); +I915_WRITE (DOUBLE_BUFFER_CTL ,DOUBLE_BUFFER_CTL_GLOBAL_DISABLE ); + scanline =intel_get_crtc_scanline (crtc); + goto done; + }
I think we still want to do the vblank evasion. It gives us more accurate infromation on which frame the operation will complete. If we don't do it we may end up signalling the completion one frame late. Although I suppose it doesn't matter too much from the user POV since in each case we'd end up dropping a frame. Maybe for av sync etc. it might matter in some cases.
It would become even more important if we allowed flips to be overridden because then we'd really need to know whether the previous flip happened at all or not (so that we could signal fences and whatnot correctly to keep userspace informed on which framebuffer is actually being scanned out). And we might end up holding the lock across every vblank start, thus preventing the display from updating at all.
So I think we should use DOUBLE_BUFFER_CTL just make missing the deadline bit less dangerous in the presence of fragile hardware. I do think we should still try to optimize plane/pipe updates more to reduce the chances of that happening in general.
Also IIRC there are some "(dis)allow double buffer disable" bits in various hardware blocks which have to set correctly for this to work. Did you check whether we're setting them appropriately?
Quoted 41 lines
drivers/gpu/drm/i915/intel_sprite.c +10
-0+ vblank_start = adjusted_mode->crtc_vblank_start;if (adjusted_mode->flags &DRM_MODE_FLAG_INTERLACE ) vblank_start =DIV_ROUND_UP (vblank_start,2 );@@ -166,6 +173,7 @@ void intel_pipe_update_start(const struct intel_crtc_state *new_crtc_state)while (need_vlv_dsi_wa && scanline == vblank_start) scanline =intel_get_crtc_scanline (crtc); +done: crtc->debug.scanline_start = scanline; crtc->debug.start_vbl_time =ktime_get (); crtc->debug.start_vbl_count =intel_crtc_get_vblank_counter (crtc);@@ -192,6 +200,9 @@ void intel_pipe_update_end(struct intel_crtc_state *new_crtc_state)trace_i915_pipe_update_end (crtc, end_vbl_count, scanline_end); +if (INTEL_GEN (dev_priv) >=9 ) +I915_WRITE (DOUBLE_BUFFER_CTL ,0 ); +/* We're still in the vblank-evade critical section, this can't race. * Would be slightly nice to just grab the vblank count and arm the * event outside of the critical section - the spinlock might spin for a @@ -206,6 +217,11 @@ void intel_pipe_update_end(struct intel_crtc_state *new_crtc_state) new_crtc_state->base.event =NULL ; } +if (INTEL_GEN (dev_priv) >=9 ) { +spin_unlock_irq (&dev_priv->display_evasion_lock); +return ; + } +local_irq_enable ();if (intel_vgpu_active (dev_priv))Signature · 6 lines
2.16.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Op 08-02-18 om 19:27 schreef Ville Syrjälä:
Quoted 77 lines · Maarten Lankhorst
Quoted 53 lines
References: https://bugs.freedesktop.org/show_bug.cgi?id=104975
Signed-off-by Maarten Lankhorst <[email protected]>--- drivers/gpu/drm/i915/i915_drv.h | 2 ++ drivers/gpu/drm/i915/i915_reg.h | 3 +++ drivers/gpu/drm/i915/intel_display.c | 1 + drivers/gpu/drm/i915/intel_sprite.c | 16 ++++++++++++++++ 4 files changed, 22 insertions(+)drivers/gpu/drm/i915/i915_drv.h +2
-0@@ -1967,6 +1967,8 @@ struct drm_i915_private {/* Display functions */ struct drm_i915_display_funcs display; +spinlock_t display_evasion_lock; +/* PCH chipset type */ enum intel_pch pch_type;unsigned short pch_id;drivers/gpu/drm/i915/i915_reg.h +3
-0@@ -6594,6 +6594,9 @@ enum {#define DIGITAL_PORTA_HOTPLUG_SHORT_DETECT (1 << 0)#define DIGITAL_PORTA_HOTPLUG_LONG_DETECT (2 << 0) +#define DOUBLE_BUFFER_CTL _MMIO(0x44500) +#define DOUBLE_BUFFER_CTL_GLOBAL_DISABLE (1 << 0) +/* refresh rate hardware control */ #define RR_HW_CTL _MMIO(0x45300)#define RR_HW_LOW_POWER_FRAMES_MASK 0xffdrivers/gpu/drm/i915/intel_display.c +1
-0@@ -14476,6 +14476,7 @@ int intel_modeset_init(struct drm_device *dev) dev_priv->modeset_wq =alloc_ordered_workqueue ("i915_modeset" ,0 );drm_mode_config_init (dev); +spin_lock_init (&dev_priv->display_evasion_lock); dev->mode_config.min_width =0 ; dev->mode_config.min_height =0 ;drivers/gpu/drm/i915/intel_sprite.c +0
-0drivers/gpu/drm/i915/intel_sprite.c void intel_pipe_update_start(const struct intel_crtc_state *new_crtc_state) · line 106
Quoted 9 lines
drivers/gpu/drm/i915/intel_sprite.c +6
-0@@ -98,6 +98,13 @@ void intel_pipe_update_start(const struct intel_crtc_state *new_crtc_state)intel_crtc_has_type (new_crtc_state,INTEL_OUTPUT_DSI );DEFINE_WAIT (wait); +if (INTEL_GEN (dev_priv) >=9 ) { +spin_lock_irq (&dev_priv->display_evasion_lock); +I915_WRITE (DOUBLE_BUFFER_CTL ,DOUBLE_BUFFER_CTL_GLOBAL_DISABLE ); + scanline =intel_get_crtc_scanline (crtc); + goto done; + }I think we still want to do the vblank evasion. It gives us more accurate infromation on which frame the operation will complete. If we don't do it we may end up signalling the completion one frame late. Although I suppose it doesn't matter too much from the user POV since in each case we'd end up dropping a frame. Maybe for av sync etc. it might matter in some cases.
It would become even more important if we allowed flips to be overridden because then we'd really need to know whether the previous flip happened at all or not (so that we could signal fences and whatnot correctly to keep userspace informed on which framebuffer is actually being scanned out). And we might end up holding the lock across every vblank start, thus preventing the display from updating at all.
Quoted 8 lines
So I think we should use
DOUBLE_BUFFER_CTLjust make missing the deadline bit less dangerous in the presence of fragile hardware. I do think we should still try to optimize plane/pipe updates more to reduce the chances of that happening in general.Also IIRC there are some "(dis)allow double buffer disable" bits in various hardware blocks which have to set correctly for this to work. Did you check whether we're setting them appropriately?
The global switch doesn't mention this at least. It only mentions that async MMIO and command flips are not affected.
~Maarten
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx