drm/i915/dp: Preliminary support for 2 pipe 1 port mode for 5K@120
Subsystems (2)
RFC 1/1 drm/i915/dp: Preliminary support for 2 pipe 1 port mode for 5K@120
On Gen 11 platform, to enable resolutions like 5K@120 where
the pixel clock is greater than pipe pixel rate, we need to split it across 2 pipes and enable it using DSC and big joiner. In order to support this dual pipe single port mode, we need to link two crtcs involved in this ganged mode.
This patch is a RFC patch that links two crtcs using linked_crtc pointer in intel_crtc_state and slave to indicate if the crtc is a master or slave. Here the HW necessitates the first CRTC to be the master CRTC through which the final output will be driven and the next consecutive CRTC should be slave crtc.
This is currently not tested, but I wanted to get some inputs on this approach. The idea is to follow the same approach used in Ganged plane mode for NV12 planes.
Matt Roper <[email protected]>
--- drivers/gpu/drm/i915/intel_display.c | 63 ++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_drv.h | 6 +++ 2 files changed, 69 insertions(+)
drivers/gpu/drm/i915/intel_display.c +63 -0
@@ -10900,6 +10900,63 @@ static bool check_single_encoder_cloning(struct drm_atomic_state *state,return true; } +static bool icl_dual_pipe_mode (struct drm_i915_private *dev_priv, +struct drm_crtc_state *crtc_state) +{ +if (crtc_state->mode.clock <=2 * dev_priv->max_cdclk_freq) +return false; + +return true; +} + +static int icl_set_linked_crtcs (struct drm_atomic_state *state) +{ +struct drm_i915_private *dev_priv =to_i915 (state->dev); +struct drm_crtc *crtc; +struct drm_crtc_state *crtc_state; +struct intel_crtc_state *linked_state =NULL ; +struct intel_crtc *slave_crtc =NULL ; +int i; + +for_each_new_crtc_in_state (state, crtc, crtc_state, i) { +struct intel_crtc_state *pipe_config = +to_intel_crtc_state (crtc_state); +struct intel_crtc *intel_crtc =to_intel_crtc (crtc); + +if (crtc_state->active) +continue ; + +if (!icl_dual_pipe_mode (dev_priv, crtc_state)) +continue ; + +if (!pipe_config->linked_crtc) { + slave_crtc =intel_get_crtc_for_pipe (dev_priv, + intel_crtc->pipe +1 ); +if (!slave_crtc) +return PTR_ERR (slave_crtc); + + linked_state =intel_atomic_get_crtc_state (state, slave_crtc); +if (IS_ERR (linked_state)) +return PTR_ERR (linked_state); + + pipe_config->linked_crtc = slave_crtc; + pipe_config->slave = false; + linked_state->linked_crtc = intel_crtc; + linked_state->slave = true; +// Update the intel_state->active_crtcs if needed + +DRM_DEBUG_KMS ("Using [CRTC:%d:%s] as master and [CRTC:%d:%s] as slave\n" , + intel_crtc->base.base.id, intel_crtc->base.name, + slave_crtc->base.base.id, slave_crtc->base.name); + +break ; + } + } + +return 0 ; + +} +static int icl_add_linked_planes (struct intel_atomic_state *state) {struct intel_plane *plane, *linked;
@@ -12702,6 +12759,12 @@ static int intel_atomic_check(struct drm_device *dev,if (ret)return ret; +if (INTEL_GEN (dev_priv) >=11 ) { + ret =icl_set_linked_crtcs (state); +if (ret) +return ret; + } +for_each_oldnew_crtc_in_state (state, crtc, old_crtc_state, crtc_state, i) {struct intel_crtc_state *pipe_config =to_intel_crtc_state (crtc_state);
drivers/gpu/drm/i915/intel_drv.h +6 -0
@@ -959,6 +959,12 @@ struct intel_crtc_state {/* Forward Error correction State */ bool fec_enable; + +/* Pointer to linked crtc in dual pipe mode */ +struct intel_crtc *linked_crtc; + +/* Flag to indicate whether this crtc is master or slave */ +bool slave; };struct intel_crtc {
Signature · 6 lines
2.19.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.CHECKPATCH: warning for drm/i915/dp: Preliminary support for 2 pipe 1 port mode for 5K@120
== Series Details ==
== Series Details ==
Series: drm/i915/dp: Preliminary support for 2 pipe 1 port mode for 5K@120
URL : https://patchwork.freedesktop.org/series/55586/
State : warning
== Summary ==
$ dim checkpatch origin/drm-tip 7cdae1834120 drm/i915/dp: Preliminary support for 2 pipe 1 port mode for 5K@120 -:22: WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit description (prefer a maximum 75 chars per line) #22: This is currently not tested, but I wanted to get some inputs on this approach.
-:96: CHECK:BRACES: Blank lines aren't necessary before a close brace '}' #96: FILE: drivers/gpu/drm/i915/intel_display.c:10958:
+
+}
total: 0 errors, 1 warnings, 1 checks, 87 lines checked
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.BAT: success for drm/i915/dp: Preliminary support for 2 pipe 1 port mode for 5K@120
In reply to Manasi Navare== Series Details ==
== Series Details ==
Series: drm/i915/dp: Preliminary support for 2 pipe 1 port mode for 5K@120
URL : https://patchwork.freedesktop.org/series/55586/
State : success
== Summary ==
CI Bug Log - changes from CI_DRM_5465 -> Patchwork_12009
====================================================
Summary
-------
**SUCCESS**
No regressions found.
External URL: https://patchwork.freedesktop.org/api/1.0/series/55586/revisions/1/mbox/
Known issues
------------
Here are the changes found in Patchwork_12009 that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@amdgpu/amd_basic@userptr:
- fi-kbl-8809g: PASS -> DMESG-WARN [fdo#108965]
* igt@i915_selftest@live_hangcheck:
- fi-bwr-2160: PASS -> DMESG-FAIL [fdo#108735]
* igt@kms_chamelium@dp-hpd-fast:
- fi-kbl-7500u: PASS -> DMESG-WARN [fdo#102505] / [fdo#103558] / [fdo#105602]
* igt@kms_pipe_crc_basic@nonblocking-crc-pipe-a-frame-sequence:
- fi-byt-clapper: PASS -> FAIL [fdo#103191] / [fdo#107362]
{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).
[fdo#102505]: https://bugs.freedesktop.org/show_bug.cgi?id=102505
[fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
[fdo#103191]: https://bugs.freedesktop.org/show_bug.cgi?id=103191
[fdo#103558]: https://bugs.freedesktop.org/show_bug.cgi?id=103558
[fdo#105602]: https://bugs.freedesktop.org/show_bug.cgi?id=105602
[fdo#107362]: https://bugs.freedesktop.org/show_bug.cgi?id=107362
[fdo#108654]: https://bugs.freedesktop.org/show_bug.cgi?id=108654
[fdo#108735]: https://bugs.freedesktop.org/show_bug.cgi?id=108735
[fdo#108965]: https://bugs.freedesktop.org/show_bug.cgi?id=108965
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109278]: https://bugs.freedesktop.org/show_bug.cgi?id=109278
Participating hosts (44 -> 42)
------------------------------
Additional (2): fi-byt-j1900 fi-gdg-551
Missing (4): fi-kbl-soraka fi-ilk-m540 fi-byt-squawks fi-bsw-cyan
Build changes
-------------
* Linux: CI_DRM_5465 -> Patchwork_12009
CI_DRM_5465: 95a4790b382426fed48253664a12a4d7b63167b6 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4783: 23f39950e824b8a8f31cfb26fc9b37ab1aca656f @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_12009: 7cdae183412046e7cb8ccf0a4f85ed76268ade6b @ git://anongit.freedesktop.org/gfx-ci/linux
== Linux commits ==
7cdae1834120 drm/i915/dp: Preliminary support for 2 pipe 1 port mode for 5K@120
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12009/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.IGT: success for drm/i915/dp: Preliminary support for 2 pipe 1 port mode for 5K@120
In reply to Manasi Navare== Series Details ==
== Series Details ==
Series: drm/i915/dp: Preliminary support for 2 pipe 1 port mode for 5K@120
URL : https://patchwork.freedesktop.org/series/55586/
State : success
== Summary ==
CI Bug Log - changes from CI_DRM_5465_full -> Patchwork_12009_full
====================================================
Summary
-------
**SUCCESS**
No regressions found.
Known issues
------------
Here are the changes found in Patchwork_12009_full that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@gem_tiled_blits@normal:
- shard-apl: PASS -> INCOMPLETE [fdo#103927]
* igt@kms_busy@extended-modeset-hang-newfb-with-reset-render-a:
- shard-kbl: NOTRUN -> DMESG-WARN [fdo#107956]
* igt@kms_color@pipe-c-legacy-gamma:
- shard-apl: PASS -> FAIL [fdo#104782]
* igt@kms_cursor_crc@cursor-128x42-onscreen:
- shard-apl: PASS -> FAIL [fdo#103232]
* igt@kms_cursor_crc@cursor-64x64-random:
- shard-glk: PASS -> FAIL [fdo#103232] +1
* igt@kms_frontbuffer_tracking@fbc-2p-primscrn-spr-indfb-draw-mmap-wc:
- shard-glk: PASS -> FAIL [fdo#103167] +1
* igt@kms_plane@plane-position-covered-pipe-a-planes:
- shard-glk: PASS -> FAIL [fdo#103166]
* igt@kms_plane_alpha_blend@pipe-b-alpha-transparant-fb:
- shard-kbl: NOTRUN -> FAIL [fdo#108145]
* igt@kms_plane_alpha_blend@pipe-b-constant-alpha-max:
- shard-glk: PASS -> FAIL [fdo#108145]
* igt@kms_plane_multiple@atomic-pipe-a-tiling-none:
- shard-apl: PASS -> FAIL [fdo#103166]
* igt@kms_setmode@basic:
- shard-apl: PASS -> FAIL [fdo#99912]
- shard-hsw: PASS -> FAIL [fdo#99912]
#### Possible fixes ####
* igt@kms_cursor_crc@cursor-256x256-dpms:
- shard-glk: FAIL [fdo#103232] -> PASS
* igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-mmap-gtt:
- shard-apl: FAIL [fdo#103167] -> PASS
* igt@kms_frontbuffer_tracking@fbc-2p-primscrn-spr-indfb-onoff:
- shard-glk: FAIL [fdo#103167] -> PASS +2
* igt@kms_frontbuffer_tracking@fbc-rgb101010-draw-pwrite:
- shard-snb: {SKIP} [fdo#109271] -> PASS +1
* igt@kms_plane@plane-position-covered-pipe-c-planes:
- shard-glk: FAIL [fdo#103166] -> PASS +2
* igt@kms_plane_alpha_blend@pipe-c-alpha-opaque-fb:
- shard-glk: FAIL [fdo#108145] -> PASS
* igt@kms_plane_multiple@atomic-pipe-a-tiling-y:
- shard-apl: FAIL [fdo#103166] -> PASS +2
* igt@perf_pmu@rc6:
- shard-kbl: {SKIP} [fdo#109271] -> PASS
* igt@tools_test@tools_test:
- shard-glk: {SKIP} [fdo#109271] -> PASS
{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).
[fdo#103166]: https://bugs.freedesktop.org/show_bug.cgi?id=103166
[fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
[fdo#103232]: https://bugs.freedesktop.org/show_bug.cgi?id=103232
[fdo#103927]: https://bugs.freedesktop.org/show_bug.cgi?id=103927
[fdo#104782]: https://bugs.freedesktop.org/show_bug.cgi?id=104782
[fdo#107956]: https://bugs.freedesktop.org/show_bug.cgi?id=107956
[fdo#108145]: https://bugs.freedesktop.org/show_bug.cgi?id=108145
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109278]: https://bugs.freedesktop.org/show_bug.cgi?id=109278
[fdo#109350]: https://bugs.freedesktop.org/show_bug.cgi?id=109350
[fdo#99912]: https://bugs.freedesktop.org/show_bug.cgi?id=99912
Participating hosts (7 -> 5)
------------------------------
Missing (2): shard-skl shard-iclb
Build changes
-------------
* Linux: CI_DRM_5465 -> Patchwork_12009
CI_DRM_5465: 95a4790b382426fed48253664a12a4d7b63167b6 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4783: 23f39950e824b8a8f31cfb26fc9b37ab1aca656f @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_12009: 7cdae183412046e7cb8ccf0a4f85ed76268ade6b @ git://anongit.freedesktop.org/gfx-ci/linux
piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12009/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Op 22-01-2019 om 22:12 schreef Manasi Navare:
Quoted 115 lines
On Gen 11 platform, to enable resolutions like 5K@120 where
the pixel clock is greater than pipe pixel rate, we need to split it across 2 pipes and enable it using DSC and big joiner. In order to support this dual pipe single port mode, we need to link two crtcs involved in this ganged mode.This patch is a RFC patch that links two crtcs using
linked_crtcpointer inintel_crtc_stateand slave to indicate if the crtc is a master or slave. Here the HW necessitates the first CRTC to be the master CRTC through which the final output will be driven and the next consecutive CRTC should be slave crtc.This is currently not tested, but I wanted to get some inputs on this approach. The idea is to follow the same approach used in Ganged plane mode for NV12 planes.
Suggested-by Maarten Lankhorst <[email protected]>,Matt Roper <[email protected]>
Cc Ville Syrjälä <[email protected]>Cc Matt Roper <[email protected]>Cc Maarten Lankhorst <[email protected]>Signed-off-by Manasi Navare <[email protected]>--- drivers/gpu/drm/i915/intel_display.c | 63 ++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_drv.h | 6 +++ 2 files changed, 69 insertions(+)drivers/gpu/drm/i915/intel_display.c +63
-0@@ -10900,6 +10900,63 @@ static bool check_single_encoder_cloning(struct drm_atomic_state *state,return true; } +static bool icl_dual_pipe_mode (struct drm_i915_private *dev_priv, +struct drm_crtc_state *crtc_state) +{ +if (crtc_state->mode.clock <=2 * dev_priv->max_cdclk_freq) +return false; + +return true; +} + +static int icl_set_linked_crtcs (struct drm_atomic_state *state) +{ +struct drm_i915_private *dev_priv =to_i915 (state->dev); +struct drm_crtc *crtc; +struct drm_crtc_state *crtc_state; +struct intel_crtc_state *linked_state =NULL ; +struct intel_crtc *slave_crtc =NULL ; +int i; + +for_each_new_crtc_in_state (state, crtc, crtc_state, i) { +struct intel_crtc_state *pipe_config = +to_intel_crtc_state (crtc_state); +struct intel_crtc *intel_crtc =to_intel_crtc (crtc); + +if (crtc_state->active) +continue ; + +if (!icl_dual_pipe_mode (dev_priv, crtc_state)) +continue ; + +if (!pipe_config->linked_crtc) { + slave_crtc =intel_get_crtc_for_pipe (dev_priv, + intel_crtc->pipe +1 ); +if (!slave_crtc) +return PTR_ERR (slave_crtc); + + linked_state =intel_atomic_get_crtc_state (state, slave_crtc); +if (IS_ERR (linked_state)) +return PTR_ERR (linked_state); + + pipe_config->linked_crtc = slave_crtc; + pipe_config->slave = false; + linked_state->linked_crtc = intel_crtc; + linked_state->slave = true; +// Update the intel_state->active_crtcs if needed + +DRM_DEBUG_KMS ("Using [CRTC:%d:%s] as master and [CRTC:%d:%s] as slave\n" , + intel_crtc->base.base.id, intel_crtc->base.name, + slave_crtc->base.base.id, slave_crtc->base.name); + +break ; + } + } + +return 0 ; + +} +static int icl_add_linked_planes (struct intel_atomic_state *state) {struct intel_plane *plane, *linked;@@ -12702,6 +12759,12 @@ static int intel_atomic_check(struct drm_device *dev,if (ret)return ret; +if (INTEL_GEN (dev_priv) >=11 ) { + ret =icl_set_linked_crtcs (state); +if (ret) +return ret; + } +for_each_oldnew_crtc_in_state (state, crtc, old_crtc_state, crtc_state, i) {struct intel_crtc_state *pipe_config =to_intel_crtc_state (crtc_state);drivers/gpu/drm/i915/intel_drv.h +0
-0@@ -959,6 +959,12 @@ struct intel_crtc_state {/* Forward Error correction State */
drivers/gpu/drm/i915/intel_drv.h struct intel_crtc_state { · line 970
Quoted 10 lines
drivers/gpu/drm/i915/intel_drv.h +6
-0bool fec_enable; + +/* Pointer to linked crtc in dual pipe mode */ +struct intel_crtc *linked_crtc; + +/* Flag to indicate whether this crtc is master or slave */ +bool slave; };struct intel_crtc {
Hey,
Looks good for a first iteration, and I think with some tweaks it will work well.
The link should be broken in the first for_each_oldnew_crtc_in_state loop in intel_atomic_check, after needs_modeset() is evaluated to true, but before the early return on !enable.
After that we should call icl_set_linked_crtcs before the if (any_ms) branch, making sure we try to re-establish to the same if needs_modeset() == false, but note that the linked pipe might not be available, in which case we need to unset crtc_state->update_pipe and set crtc_state->mode_changed again to establish the new mapping and undo the fastset.
It sounds complicated, but it will be similar to the nv12 planes mapping, except only on modeset, with special code for undoing fastset.
Your code may also not work if we try to set a 5k120 mode on the last pipe, it will try to get a nonexistent pipe or dereference random memory, it might be better to create a separate get_dual_pipe_crtc() function which returns the correct crtc or NULL.
~Maarten
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 12 lines · Manasi Navare
On Gen 11 platform, to enable resolutions like 5K@120 where
the pixel clock is greater than pipe pixel rate, we need to split it across 2 pipes and enable it using DSC and big joiner. In order to support this dual pipe single port mode, we need to link two crtcs involved in this ganged mode.This patch is a RFC patch that links two crtcs using
linked_crtcpointer inintel_crtc_stateand slave to indicate if the crtc is a master or slave. Here the HW necessitates the first CRTC to be the master CRTC through which the final output will be driven and the next consecutive CRTC should be slave crtc.
Quoted 3 lines
This is currently not tested, but I wanted to get some inputs on this approach. The idea is to follow the same approach used in Ganged plane mode for NV12 planes.
This doesn't actually do much so not quite sure what I'm supposed to say.
The more I've thought about the two pipe one port case the more I'm thinking we'll need to do something like:
struct drm_foo_uapi_state {
/* all the uapi visible state for the obj */
};struct drm_foo_state {
struct drm_foo_uapi_state uapi;
/*
* derived state, including duplicates of the pieces
* of the uapi state we need to massage when stealing
* planes/crtcs for internal uses.
*/
};And then change all the uapi facing code to play with the uapi stuff only, and find out where we need to do the uapi->derived copy for planes/crtcs actually enabled by userspace.
Embedding it like that means all the state iterators etc. will keep working, and we don't have to change all the driver code playing around with the state. Ie. changes would be limited to mostly the uapi facing code.
We didn't have to do this for the nv12 thing because we got lucky and the difference between the two planes turned out to be minimal. But in the two pipe case we have massage much more state.
Quoted 112 lines
Suggested-by Maarten Lankhorst <[email protected]>,Matt Roper <[email protected]>
Cc Ville Syrjälä <[email protected]>Cc Matt Roper <[email protected]>Cc Maarten Lankhorst <[email protected]>Signed-off-by Manasi Navare <[email protected]>--- drivers/gpu/drm/i915/intel_display.c | 63 ++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_drv.h | 6 +++ 2 files changed, 69 insertions(+)drivers/gpu/drm/i915/intel_display.c +63
-0@@ -10900,6 +10900,63 @@ static bool check_single_encoder_cloning(struct drm_atomic_state *state,return true; } +static bool icl_dual_pipe_mode (struct drm_i915_private *dev_priv, +struct drm_crtc_state *crtc_state) +{ +if (crtc_state->mode.clock <=2 * dev_priv->max_cdclk_freq) +return false; + +return true; +} + +static int icl_set_linked_crtcs (struct drm_atomic_state *state) +{ +struct drm_i915_private *dev_priv =to_i915 (state->dev); +struct drm_crtc *crtc; +struct drm_crtc_state *crtc_state; +struct intel_crtc_state *linked_state =NULL ; +struct intel_crtc *slave_crtc =NULL ; +int i; + +for_each_new_crtc_in_state (state, crtc, crtc_state, i) { +struct intel_crtc_state *pipe_config = +to_intel_crtc_state (crtc_state); +struct intel_crtc *intel_crtc =to_intel_crtc (crtc); + +if (crtc_state->active) +continue ; + +if (!icl_dual_pipe_mode (dev_priv, crtc_state)) +continue ; + +if (!pipe_config->linked_crtc) { + slave_crtc =intel_get_crtc_for_pipe (dev_priv, + intel_crtc->pipe +1 ); +if (!slave_crtc) +return PTR_ERR (slave_crtc); + + linked_state =intel_atomic_get_crtc_state (state, slave_crtc); +if (IS_ERR (linked_state)) +return PTR_ERR (linked_state); + + pipe_config->linked_crtc = slave_crtc; + pipe_config->slave = false; + linked_state->linked_crtc = intel_crtc; + linked_state->slave = true; +// Update the intel_state->active_crtcs if needed + +DRM_DEBUG_KMS ("Using [CRTC:%d:%s] as master and [CRTC:%d:%s] as slave\n" , + intel_crtc->base.base.id, intel_crtc->base.name, + slave_crtc->base.base.id, slave_crtc->base.name); + +break ; + } + } + +return 0 ; + +} +static int icl_add_linked_planes (struct intel_atomic_state *state) {struct intel_plane *plane, *linked;@@ -12702,6 +12759,12 @@ static int intel_atomic_check(struct drm_device *dev,if (ret)return ret; +if (INTEL_GEN (dev_priv) >=11 ) { + ret =icl_set_linked_crtcs (state); +if (ret) +return ret; + } +for_each_oldnew_crtc_in_state (state, crtc, old_crtc_state, crtc_state, i) {struct intel_crtc_state *pipe_config =to_intel_crtc_state (crtc_state);drivers/gpu/drm/i915/intel_drv.h +6
-0@@ -959,6 +959,12 @@ struct intel_crtc_state {/* Forward Error correction State */ bool fec_enable; + +/* Pointer to linked crtc in dual pipe mode */ +struct intel_crtc *linked_crtc; + +/* Flag to indicate whether this crtc is master or slave */ +bool slave; };struct intel_crtc {Signature · 1 line
2.19.1
Signature · 6 lines
Ville Syrjälä Intel _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Hi Ville/Maarten/Matt,
Thanks for all your comments, please see my comments/concerns below
Quoted 38 lines · Ville Syrjälä
Quoted 12 lines · Manasi Navare
On Gen 11 platform, to enable resolutions like 5K@120 where
the pixel clock is greater than pipe pixel rate, we need to split it across 2 pipes and enable it using DSC and big joiner. In order to support this dual pipe single port mode, we need to link two crtcs involved in this ganged mode.This patch is a RFC patch that links two crtcs using
linked_crtcpointer inintel_crtc_stateand slave to indicate if the crtc is a master or slave. Here the HW necessitates the first CRTC to be the master CRTC through which the final output will be driven and the next consecutive CRTC should be slave crtc.Quoted 3 lines
This is currently not tested, but I wanted to get some inputs on this approach. The idea is to follow the same approach used in Ganged plane mode for NV12 planes.
This doesn't actually do much so not quite sure what I'm supposed to say.
The more I've thought about the two pipe one port case the more I'm thinking we'll need to do something like:
struct drm_foo_uapi_state { /* all the uapi visible state for the obj */ };struct drm_foo_state { struct drm_foo_uapi_state uapi; /* * derived state, including duplicates of the pieces * of the uapi state we need to massage when stealing * planes/crtcs for internal uses. */ };
Quoted 3 lines
And then change all the uapi facing code to play with the uapi stuff only, and find out where we need to do the
uapi->derivedcopy for planes/crtcs actually enabled by userspace.
It makes sense to have a subset of fields in a separate struct that is uapi facing and that would the values set by and exposed to userspace for Eg the mode while have the rest in a derived state that would be essentially map to half of the mode being sent on each crtc, half of the plane etc.
But one thing that I am not clear on is why do we need this separation at the drm level? Initial design discussion we had we concluded that drm_stomic_state and drm_crtc_state would not change while the intel_crtc_state will be state where we can have intel_crtc_uapi_state struct with all the uapi visible fields. And the remaining fields outside of that will be the ones derived for half the mode, half the planes etc for each of the 2 crtcs involved in the modeset.
The uapi visible struct in intel_crtc_state will remain same across both these crtcs and the slave crtc configurations can be done using the master intel_crtc_uapi_state.
What do you think of this approach or I am missing something here because of which you feel that having these two states at drm level would be better?
Manasi
Quoted 120 lines
Embedding it like that means all the state iterators etc. will keep working, and we don't have to change all the driver code playing around with the state. Ie. changes would be limited to mostly the uapi facing code.
We didn't have to do this for the nv12 thing because we got lucky and the difference between the two planes turned out to be minimal. But in the two pipe case we have massage much more state.
Quoted 109 lines
Suggested-by Maarten Lankhorst <[email protected]>,Matt Roper <[email protected]>
Cc Ville Syrjälä <[email protected]>Cc Matt Roper <[email protected]>Cc Maarten Lankhorst <[email protected]>Signed-off-by Manasi Navare <[email protected]>--- drivers/gpu/drm/i915/intel_display.c | 63 ++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_drv.h | 6 +++ 2 files changed, 69 insertions(+)drivers/gpu/drm/i915/intel_display.c +63
-0@@ -10900,6 +10900,63 @@ static bool check_single_encoder_cloning(struct drm_atomic_state *state,return true; } +static bool icl_dual_pipe_mode (struct drm_i915_private *dev_priv, +struct drm_crtc_state *crtc_state) +{ +if (crtc_state->mode.clock <=2 * dev_priv->max_cdclk_freq) +return false; + +return true; +} + +static int icl_set_linked_crtcs (struct drm_atomic_state *state) +{ +struct drm_i915_private *dev_priv =to_i915 (state->dev); +struct drm_crtc *crtc; +struct drm_crtc_state *crtc_state; +struct intel_crtc_state *linked_state =NULL ; +struct intel_crtc *slave_crtc =NULL ; +int i; + +for_each_new_crtc_in_state (state, crtc, crtc_state, i) { +struct intel_crtc_state *pipe_config = +to_intel_crtc_state (crtc_state); +struct intel_crtc *intel_crtc =to_intel_crtc (crtc); + +if (crtc_state->active) +continue ; + +if (!icl_dual_pipe_mode (dev_priv, crtc_state)) +continue ; + +if (!pipe_config->linked_crtc) { + slave_crtc =intel_get_crtc_for_pipe (dev_priv, + intel_crtc->pipe +1 ); +if (!slave_crtc) +return PTR_ERR (slave_crtc); + + linked_state =intel_atomic_get_crtc_state (state, slave_crtc); +if (IS_ERR (linked_state)) +return PTR_ERR (linked_state); + + pipe_config->linked_crtc = slave_crtc; + pipe_config->slave = false; + linked_state->linked_crtc = intel_crtc; + linked_state->slave = true; +// Update the intel_state->active_crtcs if needed + +DRM_DEBUG_KMS ("Using [CRTC:%d:%s] as master and [CRTC:%d:%s] as slave\n" , + intel_crtc->base.base.id, intel_crtc->base.name, + slave_crtc->base.base.id, slave_crtc->base.name); + +break ; + } + } + +return 0 ; + +} +static int icl_add_linked_planes (struct intel_atomic_state *state) {struct intel_plane *plane, *linked;@@ -12702,6 +12759,12 @@ static int intel_atomic_check(struct drm_device *dev,if (ret)return ret; +if (INTEL_GEN (dev_priv) >=11 ) { + ret =icl_set_linked_crtcs (state); +if (ret) +return ret; + } +for_each_oldnew_crtc_in_state (state, crtc, old_crtc_state, crtc_state, i) {struct intel_crtc_state *pipe_config =to_intel_crtc_state (crtc_state);drivers/gpu/drm/i915/intel_drv.h +6
-0@@ -959,6 +959,12 @@ struct intel_crtc_state {/* Forward Error correction State */ bool fec_enable; + +/* Pointer to linked crtc in dual pipe mode */ +struct intel_crtc *linked_crtc; + +/* Flag to indicate whether this crtc is master or slave */ +bool slave; };
Quoted 7 lines
Quoted 3 lines
drivers/gpu/drm/i915/intel_drv.h +0
-0struct intel_crtc {Signature · 1 line
2.19.1Signature · 2 lines
Ville Syrjälä Intel
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 16 lines · Manasi Navare
On Gen 11 platform, to enable resolutions like 5K@120 where
the pixel clock is greater than pipe pixel rate, we need to split it across 2 pipes and enable it using DSC and big joiner. In order to support this dual pipe single port mode, we need to link two crtcs involved in this ganged mode.This patch is a RFC patch that links two crtcs using
linked_crtcpointer inintel_crtc_stateand slave to indicate if the crtc is a master or slave. Here the HW necessitates the first CRTC to be the master CRTC through which the final output will be driven and the next consecutive CRTC should be slave crtc.This is currently not tested, but I wanted to get some inputs on this approach. The idea is to follow the same approach used in Ganged plane mode for NV12 planes.
Quoted 6 lines
Suggested-by Maarten Lankhorst <[email protected]>,Matt Roper <[email protected]>
Cc Ville Syrjälä <[email protected]>Cc Matt Roper <[email protected]>Cc Maarten Lankhorst <[email protected]>Signed-off-by Manasi Navare <[email protected]>
Looks like the right general approach of using slave/master. I agree with Ville and Maarten's feedback as well.
The other thing we're going to need to worry about is dealing with all the planes on the two crtc's. Suppose we have a userspace-visible state of:
Pipe A: off
Pipe B: 5000x2000@120 (using round numbers to make example simpler)
Plane 0: RGB32: pos (0,0), width=5000, height=2000
Plane 1: RGB32: pos (100,100), width=100, height=100
Plane 2: RGB32: pos (4800,1800), width=100, height=100
Plane 3: RGB32: pos (0,0), width=3000, height=2000
Plane 4: NV12: pos (2000,0), width=1000, height=2000
Plane 5: off
Plane 6: offPipe C: off
this means that we need to grab extra planes on the other CRTC and adjust their size, position, and/or surface offsets accordingly. So the internal driver state that we actually program into the hardware needs to be something like:
Pipe A: off
Pipe B: 2500x1000 (master)
Plane 0: pos (0,0), width=2500, height=2000
Plane 1: pos (100,100), width=100, height=100
Plane 2: off
Plane 3: pos (0, 0), width=2500, height=2000
Plane 4{UV}: pos (2000, 0), width=500, height=2000
Plane 5{Y}: pos (2000, 0), width=500, height=2000
Plane 6: off
Pipe C: 2500x1000 (slave)
Plane 0: pos (0,0), offset=(2500,0), width=2500, height=2000
Plane 1: off
Plane 2: pos (2300,1800), width=100, height=100
Plane 3: pos (0, 0), offset=(2500, 0), width=500, height=2000
Plane 4{UV}: pos (0, 0), offset=(500,0), width=500, height=2000
Plane 5{Y}: pos (0, 0), offset=(500,0), width=500, height=2000
Plane 6: offSo I think Ville is right; we're going to need to really copy a lot of the userspace-facing state data into our own internal state structures so that we can do the various adjustments on it. As you can see above there are cases (2pi1po + nv12) where a single userspace plane request translates into us programming four different sets of plane register values.
Matt
Quoted 106 lines
--- drivers/gpu/drm/i915/intel_display.c | 63 ++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_drv.h | 6 +++ 2 files changed, 69 insertions(+)drivers/gpu/drm/i915/intel_display.c +63
-0@@ -10900,6 +10900,63 @@ static bool check_single_encoder_cloning(struct drm_atomic_state *state,return true; } +static bool icl_dual_pipe_mode (struct drm_i915_private *dev_priv, +struct drm_crtc_state *crtc_state) +{ +if (crtc_state->mode.clock <=2 * dev_priv->max_cdclk_freq) +return false; + +return true; +} + +static int icl_set_linked_crtcs (struct drm_atomic_state *state) +{ +struct drm_i915_private *dev_priv =to_i915 (state->dev); +struct drm_crtc *crtc; +struct drm_crtc_state *crtc_state; +struct intel_crtc_state *linked_state =NULL ; +struct intel_crtc *slave_crtc =NULL ; +int i; + +for_each_new_crtc_in_state (state, crtc, crtc_state, i) { +struct intel_crtc_state *pipe_config = +to_intel_crtc_state (crtc_state); +struct intel_crtc *intel_crtc =to_intel_crtc (crtc); + +if (crtc_state->active) +continue ; + +if (!icl_dual_pipe_mode (dev_priv, crtc_state)) +continue ; + +if (!pipe_config->linked_crtc) { + slave_crtc =intel_get_crtc_for_pipe (dev_priv, + intel_crtc->pipe +1 ); +if (!slave_crtc) +return PTR_ERR (slave_crtc); + + linked_state =intel_atomic_get_crtc_state (state, slave_crtc); +if (IS_ERR (linked_state)) +return PTR_ERR (linked_state); + + pipe_config->linked_crtc = slave_crtc; + pipe_config->slave = false; + linked_state->linked_crtc = intel_crtc; + linked_state->slave = true; +// Update the intel_state->active_crtcs if needed + +DRM_DEBUG_KMS ("Using [CRTC:%d:%s] as master and [CRTC:%d:%s] as slave\n" , + intel_crtc->base.base.id, intel_crtc->base.name, + slave_crtc->base.base.id, slave_crtc->base.name); + +break ; + } + } + +return 0 ; + +} +static int icl_add_linked_planes (struct intel_atomic_state *state) {struct intel_plane *plane, *linked;@@ -12702,6 +12759,12 @@ static int intel_atomic_check(struct drm_device *dev,if (ret)return ret; +if (INTEL_GEN (dev_priv) >=11 ) { + ret =icl_set_linked_crtcs (state); +if (ret) +return ret; + } +for_each_oldnew_crtc_in_state (state, crtc, old_crtc_state, crtc_state, i) {struct intel_crtc_state *pipe_config =to_intel_crtc_state (crtc_state);drivers/gpu/drm/i915/intel_drv.h +6
-0@@ -959,6 +959,12 @@ struct intel_crtc_state {/* Forward Error correction State */ bool fec_enable; + +/* Pointer to linked crtc in dual pipe mode */ +struct intel_crtc *linked_crtc; + +/* Flag to indicate whether this crtc is master or slave */ +bool slave; };struct intel_crtc {Signature · 1 line
2.19.1
Signature · 9 lines
Matt Roper Graphics Software Engineer IoTG Platform Enabling & Development Intel Corporation (916) 356-2795 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Op 23-01-2019 om 18:31 schreef Matt Roper:
Quoted 64 lines · Manasi Navare
Quoted 16 lines
On Gen 11 platform, to enable resolutions like 5K@120 where
the pixel clock is greater than pipe pixel rate, we need to split it across 2 pipes and enable it using DSC and big joiner. In order to support this dual pipe single port mode, we need to link two crtcs involved in this ganged mode.This patch is a RFC patch that links two crtcs using
linked_crtcpointer inintel_crtc_stateand slave to indicate if the crtc is a master or slave. Here the HW necessitates the first CRTC to be the master CRTC through which the final output will be driven and the next consecutive CRTC should be slave crtc.This is currently not tested, but I wanted to get some inputs on this approach. The idea is to follow the same approach used in Ganged plane mode for NV12 planes.
Quoted 6 lines
Suggested-by Maarten Lankhorst <[email protected]>,Matt Roper <[email protected]>
Cc Ville Syrjälä <[email protected]>Cc Matt Roper <[email protected]>Cc Maarten Lankhorst <[email protected]>Signed-off-by Manasi Navare <[email protected]>Looks like the right general approach of using slave/master. I agree with Ville and Maarten's feedback as well.
The other thing we're going to need to worry about is dealing with all the planes on the two crtc's. Suppose we have a userspace-visible state of:
Pipe A: off
Pipe B: 5000x2000@120 (using round numbers to make example simpler)Plane 0: RGB32: pos (0,0), width=5000, height=2000 Plane 1: RGB32: pos (100,100), width=100, height=100 Plane 2: RGB32: pos (4800,1800), width=100, height=100 Plane 3: RGB32: pos (0,0), width=3000, height=2000 Plane 4: NV12: pos (2000,0), width=1000, height=2000 Plane 5: off Plane 6: offPipe C: off
this means that we need to grab extra planes on the other CRTC and adjust their size, position, and/or surface offsets accordingly. So the internal driver state that we actually program into the hardware needs to be something like:
Pipe A: off Pipe B: 2500x1000 (master) Plane 0: pos (0,0), width=2500, height=2000 Plane 1: pos (100,100), width=100, height=100 Plane 2: off Plane 3: pos (0, 0), width=2500, height=2000 Plane 4{UV}: pos (2000, 0), width=500, height=2000 Plane 5{Y}: pos (2000, 0), width=500, height=2000 Plane 6: off Pipe C: 2500x1000 (slave) Plane 0: pos (0,0), offset=(2500,0), width=2500, height=2000 Plane 1: off Plane 2: pos (2300,1800), width=100, height=100 Plane 3: pos (0, 0), offset=(2500, 0), width=500, height=2000 Plane 4{UV}: pos (0, 0), offset=(500,0), width=500, height=2000 Plane 5{Y}: pos (0, 0), offset=(500,0), width=500, height=2000 Plane 6: off
Quoted 6 lines
So I think Ville is right; we're going to need to really copy a lot of the userspace-facing state data into our own internal state structures so that we can do the various adjustments on it. As you can see above there are cases (2pi1po + nv12) where a single userspace plane request translates into us programming four different sets of plane register values.
Yeah I fear you're right.
Lets see, we would need to sanitize the driver big time..
struct drm_crtc_state {
struct drm_crtc *crtc;
bool enable;
bool active;
bool planes_changed : 1;
bool mode_changed : 1;
bool active_changed : 1;
bool connectors_changed : 1;
bool zpos_changed : 1; // unused
bool color_mgmt_changed : 1;
bool no_vblank : 1; //unused
u32 plane_mask;
u32 connector_mask;
u32 encoder_mask;
struct drm_display_mode adjusted_mode;
struct drm_display_mode mode;
struct drm_property_blob *mode_blob;
struct drm_property_blob *degamma_lut;
struct drm_property_blob *ctm;
struct drm_property_blob *gamma_lut;
u32 target_vblank; // unused
u32 pageflip_flags; // unused
struct drm_pending_vblank_event *event;
struct drm_crtc_commit *commit;
struct drm_atomic_state *state;
};
First the good, it looks like we can safely re-use the following in the slave, without affecting userspace:
struct drm_crtc * crtc;
u32 last_vblank_count; // ignored in i915
struct drm_display_mode adjusted_mode; // sort of handled by core, but on disable we can write our own mode here struct drm_pending_vblank_event * event; // handled by core
struct drm_atomic_state * state; // handled by core
Then one we might use inside i915, but should not inside the driver:
struct drm_display_mode mode; -> use crtc_state.adjusted_mode..
Then the bad, we can easily get from the master safely. We only need to add special handling in intel_color.c:
struct drm_property_blob * degamma_lut;
struct drm_property_blob * ctm;
struct drm_property_blob * gamma_lut;
Also bad,
u32 plane_mask; // See below.
u32 connector_mask; // Hmm, I don't think we care about connectors on slave, do we? Just special handling in the modeset calculations needed u32 encoder_mask; // Handled by core, but probably fine to leave as 0. Can't touch this. Don't need to either.
bool planes_changed:1;
bool mode_changed:1;
bool active_changed:1;
bool connectors_changed:1;
bool color_mgmt_changed:1;
Whatever for most of those, can ignore the masks probably. Just make sure master plane state checks the slave plane state as well, and ignore direct checks of slave plane state. Because this is a 1:1 mapping, it should be fine.
And finally, the ugly:
bool enable;
bool active;
The biggest issues are crtc_state->active and crtc_state->enable. i915 uses it a lot, and even the core makes a lot of decisions based on it. We should probably only steal crtc's that doesn't have crtc_state->enable set.
But one problem at a time..
plane_state is relatively easy, because even if we can't touch plane_mask and the atomic details for the planes, we need to derive this from the master plane check function anyway. Fortunately we have our own intel_crtc_state->active_planes already used in the plane update functions we just need to be sure that the planes are part of the state. We should probably completely ignore the slave planes in the plane atomic check called from the core when it's used as a slave..
Once for plane_state:
struct drm_plane_state {
struct drm_plane *plane;
struct drm_crtc *crtc;
struct drm_framebuffer *fb;
struct dma_fence *fence;
int32_t crtc_x;
int32_t crtc_y;
uint32_t crtc_w, crtc_h;
uint32_t src_x;
uint32_t src_y;
uint32_t src_h, src_w;
u16 alpha;
uint16_t pixel_blend_mode;
unsigned int rotation;
unsigned int zpos;
unsigned int normalized_zpos;
enum drm_color_encoding color_encoding;
enum drm_color_range color_range;
struct drm_rect src, dst;
bool visible;
struct drm_crtc_commit *commit;
struct drm_atomic_state *state;
};
Good:
struct drm_plane *plane;
struct dma_fence *fence; // must be copied from master plane_state struct drm_rect src, dst; // can fill in what we want here.. bool visible; // ignored by core mostly, but set and used by driver unsigned int zpos;
unsigned int normalized_zpos;
struct drm_crtc_commit *commit;
struct drm_atomic_state *state;
Bad:
// We don't use the below anyway, we must use the src and dst rects..
int32_t crtc_x;
int32_t crtc_y;
uint32_t crtc_w, crtc_h;
uint32_t src_x;
uint32_t src_y;
uint32_t src_h, src_w;
// Props we should use from master, I think we can ignore most of this by copying intel_plane_state->plane_ctl / intel_plane_state->plane_color_ctl from the master plane. u16 alpha;
unsigned int rotation;
uint16_t pixel_blend_mode;
enum drm_color_encoding color_encoding;
enum drm_color_range color_range;
On hdr planes only, we program the CSC, so we need special care for those in that case:
enum drm_color_encoding color_encoding;
enum drm_color_range color_range;
Ugly:
struct drm_crtc *crtc; // might be NULL
struct drm_framebuffer *fb; // is NULL, or even worse it may point to a different FB, so treat anything touching plane_state->fb with suspicion
So to sum it all up, we need to be very careful in a lot of places to handle deviating values correctly..
Most important ones are crtc_state->active and crtc_state->enable. For planes, plane_state->crtc might be null, and plane_state->fb anything. Planes are easier to solve though, but crtc_state is all over the place. :(
~Maarten
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 103 lines · Maarten Lankhorst
Op 23-01-2019 om 18:31 schreef Matt Roper:
Quoted 64 lines · Manasi Navare
Quoted 16 lines
On Gen 11 platform, to enable resolutions like 5K@120 where
the pixel clock is greater than pipe pixel rate, we need to split it across 2 pipes and enable it using DSC and big joiner. In order to support this dual pipe single port mode, we need to link two crtcs involved in this ganged mode.This patch is a RFC patch that links two crtcs using
linked_crtcpointer inintel_crtc_stateand slave to indicate if the crtc is a master or slave. Here the HW necessitates the first CRTC to be the master CRTC through which the final output will be driven and the next consecutive CRTC should be slave crtc.This is currently not tested, but I wanted to get some inputs on this approach. The idea is to follow the same approach used in Ganged plane mode for NV12 planes.
Quoted 6 lines
Suggested-by Maarten Lankhorst <[email protected]>,Matt Roper <[email protected]>
Cc Ville Syrjälä <[email protected]>Cc Matt Roper <[email protected]>Cc Maarten Lankhorst <[email protected]>Signed-off-by Manasi Navare <[email protected]>Looks like the right general approach of using slave/master. I agree with Ville and Maarten's feedback as well.
The other thing we're going to need to worry about is dealing with all the planes on the two crtc's. Suppose we have a userspace-visible state of:
Pipe A: off
Pipe B: 5000x2000@120 (using round numbers to make example simpler)Plane 0: RGB32: pos (0,0), width=5000, height=2000 Plane 1: RGB32: pos (100,100), width=100, height=100 Plane 2: RGB32: pos (4800,1800), width=100, height=100 Plane 3: RGB32: pos (0,0), width=3000, height=2000 Plane 4: NV12: pos (2000,0), width=1000, height=2000 Plane 5: off Plane 6: offPipe C: off
this means that we need to grab extra planes on the other CRTC and adjust their size, position, and/or surface offsets accordingly. So the internal driver state that we actually program into the hardware needs to be something like:
Pipe A: off Pipe B: 2500x1000 (master) Plane 0: pos (0,0), width=2500, height=2000 Plane 1: pos (100,100), width=100, height=100 Plane 2: off Plane 3: pos (0, 0), width=2500, height=2000 Plane 4{UV}: pos (2000, 0), width=500, height=2000 Plane 5{Y}: pos (2000, 0), width=500, height=2000 Plane 6: off Pipe C: 2500x1000 (slave) Plane 0: pos (0,0), offset=(2500,0), width=2500, height=2000 Plane 1: off Plane 2: pos (2300,1800), width=100, height=100 Plane 3: pos (0, 0), offset=(2500, 0), width=500, height=2000 Plane 4{UV}: pos (0, 0), offset=(500,0), width=500, height=2000 Plane 5{Y}: pos (0, 0), offset=(500,0), width=500, height=2000 Plane 6: offQuoted 6 lines
So I think Ville is right; we're going to need to really copy a lot of the userspace-facing state data into our own internal state structures so that we can do the various adjustments on it. As you can see above there are cases (2pi1po + nv12) where a single userspace plane request translates into us programming four different sets of plane register values.
Yeah I fear you're right.
Lets see, we would need to sanitize the driver big time..struct
drm_crtc_state{
structdrm_crtc*crtc;
bool enable;
bool active;
boolplanes_changed: 1;
boolmode_changed: 1;
boolactive_changed: 1;
boolconnectors_changed: 1;
boolzpos_changed: 1; // unused
boolcolor_mgmt_changed: 1;
boolno_vblank: 1; //unused
u32plane_mask;
u32connector_mask;
u32encoder_mask;
structdrm_display_modeadjusted_mode;
structdrm_display_modemode;
structdrm_property_blob*mode_blob;
structdrm_property_blob*degamma_lut;
structdrm_property_blob*ctm;
structdrm_property_blob*gamma_lut;
u32target_vblank; // unused
u32pageflip_flags; // unused
structdrm_pending_vblank_event*event;
structdrm_crtc_commit*commit;
structdrm_atomic_state*state;
};
Quoted 6 lines
First the good, it looks like we can safely re-use the following in the slave, without affecting userspace:
structdrm_crtc* crtc;
u32last_vblank_count; // ignored in i915
structdrm_display_modeadjusted_mode; // sort of handled by core, but on disable we can write our own mode here structdrm_pending_vblank_event* event; // handled by core
structdrm_atomic_state* state; // handled by core
Okay so these above fields can be part of the drm_crtc_uapi_state as suggested by Ville. So that these exposed to the userspace do not change irrespective of master-slave behaviour and can be just used to configure master_crtc and slave_crtc Correct? So these will not be part of drm_master_crtc_state and drm_slave_crtc_state
Quoted 4 lines
Then one we might use inside i915, but should not inside the driver:
structdrm_display_modemode; -> use crtc_state.adjusted_mode..
Shouldnt the mode represent the true mode and not the mode/2 going to each of the crtcs? And then the adjusted mode can reflect the mode/2?
Quoted 5 lines
Then the bad, we can easily get from the master safely. We only need to add special handling in
intel_color.c:
structdrm_property_blob*degamma_lut;
structdrm_property_blob* ctm;
structdrm_property_blob*gamma_lut;
So they can actually be in the drm_crtc_uapi_state and used for both master and slave in i915?
Quoted 11 lines
Also bad,
u32plane_mask; // See below.
u32connector_mask; // Hmm, I don't think we care about connectors on slave, do we? Just special handling in the modeset calculations needed u32encoder_mask; // Handled by core, but probably fine to leave as 0. Can't touch this. Don't need to either.
bool planes_changed:1;
bool mode_changed:1;
bool active_changed:1;
bool connectors_changed:1;
bool color_mgmt_changed:1;
Quoted 3 lines
Whatever for most of those, can ignore the masks probably. Just make sure master plane state checks the slave plane state as well, and ignore direct checks of slave plane state. Because this is a 1:1 mapping, it should be fine.
So leave these fields as is for both master and slave crtc states i i915, slave state derives from master's.
Quoted 8 lines
And finally, the ugly:
bool enable;
bool active;The biggest issues are
crtc_state->activeandcrtc_state->enable. i915 uses it a lot, and even the core makes a lot of decisions based on it. We should probably only steal crtc's that doesn't havecrtc_state->enableset.
Correct, the stealing crtc logic should check for crtc_state->enable. So if the master and slave crtc states are created right up in DRM, then once slave crtc is stolen its crtc_enable should be set then.
So again drm_crtc_master_state and drm_crtc_slave_state each will have these fields, correct?
So to summarize your suggestion is that we create a drm_crtc_uapi_state which will be the state common to both master and slave crtcs. Then have the derived states as drm_crtc_master_state and drm_crtc_slave_state Also split the drm_plane_master_state and drm_plane_slave_state to map planes across the two crtcs.
Is my understanding correct so far, I analyze your plane_state comments next. First wanted to understand if my interpretation of the crtc_state is correct
Manasi
Quoted 68 lines
But one problem at a time..
plane_stateis relatively easy, because even if we can't touchplane_maskand the atomic details for the planes, we need to derive this from the master plane check function anyway. Fortunately we have our ownintel_crtc_state->active_planesalready used in the plane update functions we just need to be sure that the planes are part of the state. We should probably completely ignore the slave planes in the plane atomic check called from the core when it's used as a slave..Once for
plane_state:
structdrm_plane_state{
structdrm_plane*plane;
structdrm_crtc*crtc;
structdrm_framebuffer*fb;
structdma_fence*fence;
int32_tcrtc_x;
int32_tcrtc_y;
uint32_tcrtc_w,crtc_h;
uint32_tsrc_x;
uint32_tsrc_y;
uint32_tsrc_h,src_w;
u16 alpha;
uint16_tpixel_blend_mode;
unsigned int rotation;
unsigned int zpos;
unsigned intnormalized_zpos;
enumdrm_color_encodingcolor_encoding;
enumdrm_color_rangecolor_range;
structdrm_rectsrc, dst;
bool visible;
structdrm_crtc_commit*commit;
structdrm_atomic_state*state;
};Good:
structdrm_plane*plane;
structdma_fence*fence; // must be copied from masterplane_statestructdrm_rectsrc, dst; // can fill in what we want here.. bool visible; // ignored by core mostly, but set and used by driver unsigned int zpos;
unsigned intnormalized_zpos;
structdrm_crtc_commit*commit;
structdrm_atomic_state*state;Bad:
// We don't use the below anyway, we must use the src and dst rects..
int32_tcrtc_x;
int32_tcrtc_y;
uint32_tcrtc_w,crtc_h;
uint32_tsrc_x;
uint32_tsrc_y;
uint32_tsrc_h,src_w;// Props we should use from master, I think we can ignore most of this by copying
intel_plane_state->plane_ctl/intel_plane_state->plane_color_ctlfrom the master plane. u16 alpha;
unsigned int rotation;
uint16_tpixel_blend_mode;
enumdrm_color_encodingcolor_encoding;
enumdrm_color_rangecolor_range;On hdr planes only, we program the CSC, so we need special care for those in that case:
enumdrm_color_encodingcolor_encoding;
enumdrm_color_rangecolor_range;Ugly:
structdrm_crtc*crtc; // might be NULL
structdrm_framebuffer*fb; // is NULL, or even worse it may point to a different FB, so treat anything touchingplane_state->fbwith suspicion
Quoted 8 lines
So to sum it all up, we need to be very careful in a lot of places to handle deviating values correctly..
Most important ones are
crtc_state->activeandcrtc_state->enable. For planes,plane_state->crtcmight be null, andplane_state->fbanything. Planes are easier to solve though, butcrtc_stateis all over the place. :(~Maarten
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx