DRM and i915 fixes to handle hotplug/unplug for 8K tiled displays
cover DRM and i915 fixes to handle hotplug/unplug for 8K tiled displays
With these patches now DRM and i915 gracefully handles hotplugging and unplugging of either the master or slave connectors in case of tiled displays.
These patches ensure proper handling of just 1 tile connected and also fixes the teardown (disable sequence)
Case1: Boot with single port connected
drm/ fbcon fallsback to the next lower non tiled mode
Case2: Now hotplug second port
Here if fbcon has been already resized to lower mode we cannot change the fbcon size and it still displays lower non tiled mode
Case3: With both ports connected
Here it displays the full 8K tiled mode
Case4: Unplug master/slave:
It does a full modeset and displays next lower mode
Case5: Hotplug second port back in:
It now does a full modeset again to display full 8K
Manasi Navare (5):
drm: Handle connector tile support only for modes that match tile size drm/fbdev: Fallback to non tiled mode if all tiles not present drm/i915/dp: Make sure all tiled connectors get added to the state
with full modeset
drm/i915/dp: Make port sync mode assignments only if all tiles present drm/i915/dp: Disable Port sync mode correctly on teardown
drivers/gpu/drm/drm_client_modeset.c | 72 ++++++++++++ drivers/gpu/drm/drm_fb_helper.c | 4 +- drivers/gpu/drm/i915/display/intel_display.c | 109 ++++++++++++++++++- 3 files changed, 181 insertions(+), 4 deletions(-)
Signature · 6 lines
2.19.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/5 drm: Handle connector tile support only for modes that match tile size
DRM Fb driver expects multiple CRTCs if it sees connector->has_tile is set, but we need to handle tile support and look for multiple CRTCs only for the modes that match the tile size. The other modes should be able to be displayed without tile support or uisng single CRTC.
This patch adds the check to match the tile size with requested mode to handle the tile support.
--- drivers/gpu/drm/drm_fb_helper.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_fb_helper.c +3 -1
@@ -1558,7 +1558,9 @@ static int drm_fb_helper_single_fb_probe(struct drm_fb_helper *fb_helper,for (j =0 ; j < mode_set->num_connectors; j++) {struct drm_connector *connector = mode_set->connectors[j]; -if (connector->has_tile) { +if (connector->has_tile && + desired_mode->hdisplay == connector->tile_h_size && + desired_mode->vdisplay == connector->tile_v_size) { lasth = (connector->tile_h_loc == (connector->num_h_tile -1 )); lastv = (connector->tile_v_loc == (connector->num_v_tile -1 ));/* cloning to multiple tiles is just crazy-talk, so: */
Signature · 6 lines
2.19.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 2/5 drm/fbdev: Fallback to non tiled mode if all tiles not present
In reply to Manasi NavareIn case of tiled displays, if we hotplug just one connector, fbcon currently just selects the preferred mode and if it is tiled mode then that becomes a problem if rest of the tiles are not present.
So in the fbdev driver on hotplug when we probe the client modeset, if we dont find all the connectors for all tiles, then on a connector with one tile, just fallback to the first available non tiled mode to display over a single connector.
On the hotplug of the consecutive tiled connectors, if the tiled mode no longer exists because of fbcon size limitation, then return no modes for consecutive tiles but retain the non tiled mode on the 0th tile.
Use the same logic in case of connected boot case as well. This has been tested with Dell UP328K tiled monitor.
v3:
* Chcek Num tiled conns that are connected (Manasi) v2:
* Set the modes on consecutive hotplugged tiles to no mode if tiled mode is pruned (Dave)
v1:
* Just handle the 1st connector hotplug case
* v1 Reviewed-by: Dave Airlie <[email protected]>
Bugzilla: https://gitlab.freedesktop.org/drm/intel/issues/5
--- drivers/gpu/drm/drm_client_modeset.c | 72 ++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+)
drivers/gpu/drm/drm_client_modeset.c +72 -0
@@ -114,6 +114,33 @@ drm_client_find_modeset(struct drm_client_dev *client, struct drm_crtc *crtc)return NULL ; } +static struct drm_display_mode * +drm_connector_get_tiled_mode (struct drm_connector *connector) +{ +struct drm_display_mode *mode; + +list_for_each_entry (mode, &connector->modes, head) { +if (mode->hdisplay == connector->tile_h_size && + mode->vdisplay == connector->tile_v_size) +return mode; + } +return NULL ; +} + +static struct drm_display_mode * +drm_connector_fallback_non_tiled_mode (struct drm_connector *connector) +{ +struct drm_display_mode *mode; + +list_for_each_entry (mode, &connector->modes, head) { +if (mode->hdisplay == connector->tile_h_size && + mode->vdisplay == connector->tile_v_size) +continue ; +return mode; + } +return NULL ; +} +static struct drm_display_mode *drm_connector_has_preferred_mode (struct drm_connector *connector,int width,int height) {
@@ -348,8 +375,15 @@ static bool drm_client_target_preferred(struct drm_connector **connectors,struct drm_connector *connector;u64 conn_configured =0 ;int tile_pass =0 ; +int num_tiled_conns =0 ;int i; +for (i =0 ; i < connector_count; i++) { +if (connectors[i]->has_tile && + connectors[i]->status == connector_status_connected) + num_tiled_conns++; + } + retry:for (i =0 ; i < connector_count; i++) { connector = connectors[i];
@@ -399,6 +433,28 @@ static bool drm_client_target_preferred(struct drm_connector **connectors,list_for_each_entry (modes[i], &connector->modes, head)break ; } +/* +* In case of tiled mode if all tiles not present fallback to +* first available non tiled mode. +* After all tiles are present, try to find the tiled mode +* for all and if tiled mode not present due to fbcon size +* limitations, use first non tiled mode only for +* tile 0,0 and set to no mode for all other tiles. +*/ +if (connector->has_tile) { +if (num_tiled_conns < + connector->num_h_tile * connector->num_v_tile || + (connector->tile_h_loc ==0 && + connector->tile_v_loc ==0 && + !drm_connector_get_tiled_mode (connector))) { +DRM_DEBUG_KMS ("Falling back to non tiled mode on Connector %d\n" , + connector->base.id); + modes[i] =drm_connector_fallback_non_tiled_mode (connector); + }else { + modes[i] =drm_connector_get_tiled_mode (connector); + } + } +DRM_DEBUG_KMS ("found mode %s\n" , modes[i] ? modes[i]->name :"none" ); conn_configured |=BIT_ULL (i);
@@ -515,6 +571,7 @@ static bool drm_client_firmware_config(struct drm_client_dev *client,bool fallback = true, ret = true;int num_connectors_enabled =0 ;int num_connectors_detected =0 ; +int num_tiled_conns =0 ;struct drm_modeset_acquire_ctx ctx;if (!drm_drv_uses_atomic_modeset (dev))
@@ -532,6 +589,11 @@ static bool drm_client_firmware_config(struct drm_client_dev *client,memcpy (save_enabled, enabled, count); mask =GENMASK (count -1 ,0 ); conn_configured =0 ; +for (i =0 ; i < count; i++) { +if (connectors[i]->has_tile && + connectors[i]->status == connector_status_connected) + num_tiled_conns++; + } retry: conn_seq = conn_configured;for (i =0 ; i < count; i++) {
@@ -631,6 +693,16 @@ static bool drm_client_firmware_config(struct drm_client_dev *client, connector->name); modes[i] = &connector->state->crtc->mode; } +/* +* In case of tiled modes, if all tiles are not present +* then fallback to a non tiled mode. +*/ +if (connector->has_tile && + num_tiled_conns < connector->num_h_tile * connector->num_v_tile) { +DRM_DEBUG_KMS ("Falling back to non tiled mode on Connector %d\n" , + connector->base.id); + modes[i] =drm_connector_fallback_non_tiled_mode (connector); + } crtcs[i] = new_crtc; DRM_DEBUG_KMS("connector %s on [CRTC:%d:%s]: %dx%d%s\n",
Signature · 6 lines
2.19.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 3/5 drm/i915/dp: Make sure all tiled connectors get added to the state with full modeset
In reply to Manasi NavareIn case of tiled displays, all the tiles are linke dto each other for transcoder port sync. So in intel_atomic_check() we need to make sure that we add all the tiles to the modeset and if one of the tiles needs a full modeset then mark all other tiles for a full modeset.
Bugzilla: https://gitlab.freedesktop.org/drm/intel/issues/5
--- drivers/gpu/drm/i915/display/intel_display.c | 78 ++++++++++++++++++++ 1 file changed, 78 insertions(+)
drivers/gpu/drm/i915/display/intel_display.c +78 -0
@@ -14066,6 +14066,80 @@ static int intel_atomic_check_crtcs(struct intel_atomic_state *state)return 0 ; } +static int +intel_dp_modeset_all_tiles (struct drm_i915_private *dev_priv, +struct intel_atomic_state *state,int tile_grp_id) +{ +struct drm_connector *conn_iter; +struct drm_connector_list_iter conn_list_iter; +struct drm_crtc_state *crtc_state; + +drm_connector_list_iter_begin (&dev_priv->drm, &conn_list_iter); +drm_for_each_connector_iter (conn_iter, &conn_list_iter) { +struct drm_connector_state *conn_iter_state; + +if (!conn_iter->has_tile) +continue ; + conn_iter_state =drm_atomic_get_connector_state (&state->base, + conn_iter); +if (IS_ERR (conn_iter_state)) { +drm_connector_list_iter_end (&conn_list_iter); +return PTR_ERR (conn_iter_state); + } + +if (!conn_iter_state->crtc) +continue ; + +if (conn_iter->tile_group->id != tile_grp_id) +continue ; + + crtc_state =drm_atomic_get_crtc_state (&state->base, conn_iter_state->crtc); +if (IS_ERR (crtc_state)) { +drm_connector_list_iter_end (&conn_list_iter); +return PTR_ERR (conn_iter_state); + } + crtc_state->mode_changed = true; + } +drm_connector_list_iter_end (&conn_list_iter); + +return 0 ; +} + +static int +intel_dp_atomic_trans_port_sync_check (struct drm_i915_private *dev_priv, +struct intel_atomic_state *state) +{ +struct drm_connector *connector; +struct drm_crtc_state *crtc_state; +struct drm_connector_state *connector_state; +int i, ret, tile_grp_id =0 ; + +if (INTEL_GEN (dev_priv) <11 ) +return 0 ; + +/* Is tiled, mark all other tiled CRTCs as needing a modeset */ +for_each_new_connector_in_state (&state->base, connector, connector_state, i) { +if (!connector->has_tile) +continue ; +if (connector_state->crtc && + tile_grp_id != connector->tile_group->id) { + crtc_state =drm_atomic_get_new_crtc_state (&state->base, + connector_state->crtc); +if (!drm_atomic_crtc_needs_modeset (crtc_state)) +continue ; + + tile_grp_id = connector->tile_group->id; + }else +continue ; + + ret =intel_dp_modeset_all_tiles (dev_priv, state, tile_grp_id); +if (ret) +return ret; + } + +return 0 ; +} +/** * intel_atomic_check - validate state object * @dev: drm device
@@ -14093,6 +14167,10 @@ static int intel_atomic_check(struct drm_device *dev,if (ret) goto fail; + ret =intel_dp_atomic_trans_port_sync_check (dev_priv, state); +if (ret) + goto fail; +for_each_oldnew_intel_crtc_in_state (state, crtc, old_crtc_state, new_crtc_state, i) {if (!needs_modeset (new_crtc_state)) {
Signature · 6 lines
2.19.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 4/5 drm/i915/dp: Make port sync mode assignments only if all tiles present
In reply to Manasi NavareAdd an extra check before making master slave assignments for tiled displays to make sure we make these assignments only if all tiled connectors are present. If not then initialize the state to defaults so it does a normal non tiled modeset without transcoder port sync.
Bugzilla: https://gitlab.freedesktop.org/drm/intel/issues/5
--- drivers/gpu/drm/i915/display/intel_display.c | 28 ++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/display/intel_display.c +26 -2
@@ -12048,6 +12048,12 @@ static bool c8_planes_changed(const struct intel_crtc_state *new_crtc_state)return !old_crtc_state->c8_planes != !new_crtc_state->c8_planes; } +static void initialize_trans_port_sync_mode_state (struct intel_crtc_state *crtc_state) +{ + crtc_state->master_transcoder =INVALID_TRANSCODER ; + crtc_state->sync_mode_slaves_mask =0 ; +} +static int icl_add_sync_mode_crtcs (struct intel_crtc_state *crtc_state) {struct drm_crtc *crtc = crtc_state->uapi.crtc;
@@ -12059,11 +12065,22 @@ static int icl_add_sync_mode_crtcs(struct intel_crtc_state *crtc_state)struct drm_crtc *master_crtc =NULL ;struct drm_crtc_state *master_crtc_state;struct intel_crtc_state *master_pipe_config; -int i, tile_group_id; +int i, tile_group_id =0 , num_tiled_conns =0 ;if (INTEL_GEN (dev_priv) <11 )return 0 ; +/* If all tiles not present do not make master slave assignments +* Here we assume all tiles belong to the same tile group for now. +*/ +for_each_new_connector_in_state (&state->base, connector, connector_state, i) { +if (connector->has_tile) { +if (!tile_group_id) + tile_group_id = connector->tile_group->id; + num_tiled_conns++; + } + } +/* * In case of tiled displays there could be one or more slaves but there is * only one master. Lets make the CRTC used by the connector corresponding
@@ -12077,8 +12094,15 @@ static int icl_add_sync_mode_crtcs(struct intel_crtc_state *crtc_state)if (!connector->has_tile)continue ;if (crtc_state->hw.mode.hdisplay != connector->tile_h_size || - crtc_state->hw.mode.vdisplay != connector->tile_v_size) + crtc_state->hw.mode.vdisplay != connector->tile_v_size) { +initialize_trans_port_sync_mode_state (crtc_state);return 0 ; + } +if (connector->tile_group->id == tile_group_id && + num_tiled_conns < connector->num_h_tile * connector->num_v_tile) { +initialize_trans_port_sync_mode_state (crtc_state); +return 0 ; + }if (connector->tile_h_loc == connector->num_h_tile -1 && connector->tile_v_loc == connector->num_v_tile -1 )continue ;
Signature · 6 lines
2.19.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 5/5 drm/i915/dp: Disable Port sync mode correctly on teardown
In reply to Manasi NavareWhile clearing the Ports ync mode enable and master select bits we need to make sure that we perform a RMW for disable else it sets the other bits casuing unwanted sideeffects.
Bugzilla: https://gitlab.freedesktop.org/drm/intel/issues/5
--- drivers/gpu/drm/i915/display/intel_display.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/display/intel_display.c +2 -1
@@ -4599,7 +4599,8 @@ static void icl_disable_transcoder_port_sync(const struct intel_crtc_state *old_ transcoder_name(old_crtc_state->cpu_transcoder)); reg =TRANS_DDI_FUNC_CTL2 (old_crtc_state->cpu_transcoder); - trans_ddi_func_ctl2_val = ~(PORT_SYNC_MODE_ENABLE | + trans_ddi_func_ctl2_val =I915_READ (reg); + trans_ddi_func_ctl2_val &= ~(PORT_SYNC_MODE_ENABLE |PORT_SYNC_MODE_MASTER_SELECT_MASK );I915_WRITE (reg, trans_ddi_func_ctl2_val); }
Signature · 6 lines
2.19.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Patchwork
CI[Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for DRM and i915 fixes to handle hotplug/unplug for 8K tiled displays
In reply to Manasi Navare== Series Details ==
== Series Details ==
Series: DRM and i915 fixes to handle hotplug/unplug for 8K tiled displays
URL : https://patchwork.freedesktop.org/series/70722/
State : warning
== Summary ==
$ dim checkpatch origin/drm-tip e95624b467dd drm: Handle connector tile support only for modes that match tile size 26cd16d87f13 drm/fbdev: Fallback to non tiled mode if all tiles not present -:26: WARNING:TYPO_SPELLING: 'Chcek' may be misspelled - perhaps 'Check'? #26: * Chcek Num tiled conns that are connected (Manasi)
total: 0 errors, 1 warnings, 0 checks, 110 lines checked09aa086f5c07 drm/i915/dp: Make sure all tiled connectors get added to the state with full modeset -:84: CHECK:BRACES: braces {} should be used on all arms of this statement
#84: FILE: drivers/gpu/drm/i915/display/intel_display.c:14124:
+ if (connector_state->crtc &&
[...]
+ } else
[...]
-:92: CHECK:BRACES: Unbalanced braces around else statement #92: FILE: drivers/gpu/drm/i915/display/intel_display.c:14132:
+ } else
total: 0 errors, 0 warnings, 2 checks, 90 lines checked4d39ec6004ef drm/i915/dp: Make port sync mode assignments only if all tiles present bc6fd5c9dfe5 drm/i915/dp: Disable Port sync mode correctly on teardown
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI[Intel-gfx] ✗ Fi.CI.BAT: failure for DRM and i915 fixes to handle hotplug/unplug for 8K tiled displays
In reply to Manasi Navare== Series Details ==
== Series Details ==
Series: DRM and i915 fixes to handle hotplug/unplug for 8K tiled displays
URL : https://patchwork.freedesktop.org/series/70722/
State : failure
== Summary ==
CI Bug Log - changes from CI_DRM_7534 -> Patchwork_15682
====================================================
Summary
-------
**FAILURE**
Serious unknown changes coming with Patchwork_15682 absolutely need to be verified manually.
If you think the reported changes have nothing to do with the changes introduced in Patchwork_15682, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.
External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15682/index.html
Possible new issues
-------------------
Here are the unknown changes that may have been introduced in Patchwork_15682:
### IGT changes ###
#### Possible regressions ####
* igt@i915_selftest@live_blt:
- fi-ivb-3770: [PASS][1] -> [DMESG-FAIL][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7534/fi-ivb-3770/igt@i915_selftest@live_blt.html
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15682/fi-ivb-3770/igt@i915_selftest@live_blt.html
- fi-hsw-4770r: NOTRUN -> [DMESG-FAIL][3]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15682/fi-hsw-4770r/igt@i915_selftest@live_blt.html
Known issues
------------
Here are the changes found in Patchwork_15682 that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@gem_sync@basic-all:
- fi-tgl-y: [PASS][4] -> [INCOMPLETE][5] ([i915#470])
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7534/fi-tgl-y/igt@[email protected]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15682/fi-tgl-y/igt@[email protected]
* igt@i915_pm_rpm@module-reload:
- fi-skl-6770hq: [PASS][6] -> [FAIL][7] ([i915#178])
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7534/fi-skl-6770hq/igt@[email protected]
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15682/fi-skl-6770hq/igt@[email protected]
* igt@i915_selftest@live_blt:
- fi-hsw-4770: [PASS][8] -> [DMESG-FAIL][9] ([i915#725])
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7534/fi-hsw-4770/igt@i915_selftest@live_blt.html
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15682/fi-hsw-4770/igt@i915_selftest@live_blt.html
#### Possible fixes ####
* igt@gem_ctx_create@basic-files:
- {fi-tgl-u}: [INCOMPLETE][10] ([fdo#111735]) -> [PASS][11]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7534/fi-tgl-u/igt@[email protected]
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15682/fi-tgl-u/igt@[email protected]
* igt@kms_chamelium@hdmi-hpd-fast:
- fi-kbl-7500u: [FAIL][12] ([fdo#111407]) -> [PASS][13]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7534/fi-kbl-7500u/igt@[email protected]
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15682/fi-kbl-7500u/igt@[email protected]
{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).
[fdo#111407]: https://bugs.freedesktop.org/show_bug.cgi?id=111407
[fdo#111735]: https://bugs.freedesktop.org/show_bug.cgi?id=111735
[i915#178]: https://gitlab.freedesktop.org/drm/intel/issues/178
[i915#470]: https://gitlab.freedesktop.org/drm/intel/issues/470
[i915#472]: https://gitlab.freedesktop.org/drm/intel/issues/472
[i915#725]: https://gitlab.freedesktop.org/drm/intel/issues/725
Participating hosts (53 -> 47)
------------------------------
Additional (2): fi-hsw-4770r fi-kbl-7560u
Missing (8): fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-ctg-p8600 fi-kbl-x1275 fi-byt-clapper fi-bdw-samus
Build changes
-------------
* CI: CI-20190529 -> None
* Linux: CI_DRM_7534 -> Patchwork_15682
CI-20190529: 20190529
CI_DRM_7534: 66a6222c16abb82d6a4480b0a7ff8e375cc6a3a6 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_5342: 3e43fb3fa97ce25819444d63848439acf6e397b5 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_15682: bc6fd5c9dfe590959996329e69a8708dc385a306 @ git://anongit.freedesktop.org/gfx-ci/linux
== Linux commits ==
bc6fd5c9dfe5 drm/i915/dp: Disable Port sync mode correctly on teardown 4d39ec6004ef drm/i915/dp: Make port sync mode assignments only if all tiles present 09aa086f5c07 drm/i915/dp: Make sure all tiled connectors get added to the state with full modeset 26cd16d87f13 drm/fbdev: Fallback to non tiled mode if all tiles not present e95624b467dd drm: Handle connector tile support only for modes that match tile size
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15682/index.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx