drm/atomic: Add connector atomic_check function.
Subsystems (2)
Maarten Lankhorst
maintainerPATCH 1/1 drm/atomic: Add connector atomic_check function.
The connector atomic check function may be called multiple times, or not at all. It's mostly useful for implementing properties but if you call check_modeset twice it can be used for other modeset related checks as well.
--- drivers/gpu/drm/drm_atomic_helper.c | 25 +++++++++++++++++---- include/drm/drm_modeset_helper_vtables.h | 37 ++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 4 deletions(-)
drivers/gpu/drm/drm_atomic_helper.c +21 -4
@@ -459,10 +459,20 @@ mode_fixup(struct drm_atomic_state *state)* * Check the state object to see if the requested state is physically possible. * This does all the crtc and connector related computations for an atomic -* update and adds any additional connectors needed for full modesets and calls -* down into &drm_crtc_helper_funcs.mode_fixup and -* &drm_encoder_helper_funcs.mode_fixup or -* &drm_encoder_helper_funcs.atomic_check functions of the driver backend. +* update and adds any additional connectors needed for full modesets. It calls +* the various per-object callbacks in the follow order: +* +* 1. &drm_connector_helper_funcs.atomic_best_encoder for determining the new encoder. +* 2. &drm_connector_helper_funcs.atomic_check to validate the connector state. +* 3. If it's determined a modeset is needed then all connectors on the affected crtc +* crtc are added. +* 4. &drm_bridge_funcs.mode_fixup is called on all encoder bridges. +* 5. &drm_encoder_helper_funcs.atomic_check is called to validate any encoder state. +* This function is only called when the encoder will be part of a configured crtc, +* it must not be used for implementing connector property validation. +* If this function is NULL, &drm_atomic_encoder_helper_funcs.mode_fixup is called +* instead. +* 6. &drm_crtc_helper_funcs.mode_fixup is called last, to fix up the mode with crtc constraints. * * &drm_crtc_state.mode_changed is set when the input mode is changed. * &drm_crtc_state.connectors_changed is set when a connector is added or
@@ -522,6 +532,8 @@ drm_atomic_helper_check_modeset(struct drm_device *dev,return ret;for_each_oldnew_connector_in_state (state, connector, old_connector_state, new_connector_state, i) { +const struct drm_connector_helper_funcs *funcs = connector->helper_private; +/* * This only sets crtc->connectors_changed for routing changes, * drivers must set crtc->connectors_changed themselves when
@@ -539,6 +551,11 @@ drm_atomic_helper_check_modeset(struct drm_device *dev, new_connector_state->link_status) new_crtc_state->connectors_changed = true; } + +if (funcs->atomic_check) + ret = funcs->atomic_check (connector, new_connector_state); +if (ret) +return ret; }/*
include/drm/drm_modeset_helper_vtables.h +37 -0
@@ -860,6 +860,43 @@ struct drm_connector_helper_funcs {*/ struct drm_encoder *(*atomic_best_encoder)(struct drm_connector *connector,struct drm_connector_state *connector_state); + +/** +* @atomic_check: +* +* Drivers should check connector properties in this +* hook. This function is called from &drm_atomic_helper_check_modeset. +* +* This function may not be called at all on a modeset or connector +* change, so it should only be used to validate properties. +* If it's required to validate all connectors from there, call +* &drm_atomic_helper_check_modeset twice. This will result in +* atomic_check possibly being called twice as well, which the callback +* should be made to handle correctly. +* +* This function is also allowed to inspect any other object's state and +* can add more state objects to the atomic commit if needed. Care must +* be taken though to ensure that state check and compute functions for +* these added states are all called, and derived state in other objects +* all updated. Again the recommendation is to just call check helpers +* until a maximal configuration is reached. +* +* NOTE: +* +* This function is called in the check phase of an atomic update. The +* driver is not allowed to change anything outside of the free-standing +* state objects passed-in or assembled in the overall &drm_atomic_state +* update tracking structure. +* +* RETURNS: +* +* 0 on success, -EINVAL if the state or the transition can't be +* supported, -ENOMEM on memory allocation failure and -EDEADLK if an +* attempt to obtain another state object ran into a &drm_modeset_lock +* deadlock. +*/ +int (*atomic_check)(struct drm_connector *connector, +struct drm_connector_state *state); };/**
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.BAT: success for drm/atomic: Add connector atomic_check function.
== Series Details ==
== Series Details ==
Series: drm/atomic: Add connector atomic_check function.
URL : https://patchwork.freedesktop.org/series/22507/
State : success
== Summary ==
Series 22507v1 drm/atomic: Add connector atomic_check function.
https://patchwork.freedesktop.org/api/1.0/series/22507/revisions/1/mbox/
Test gem_exec_flush:
Subgroup basic-batch-kernel-default-uc:
pass -> FAIL (fi-snb-2600) fdo#100007
Test gem_exec_suspend:
Subgroup basic-s4-devices:
pass -> DMESG-WARN (fi-kbl-7560u) fdo#100125fdo#100007 https://bugs.freedesktop.org/show_bug.cgi?id=100007
fdo#100125 https://bugs.freedesktop.org/show_bug.cgi?id=100125
fi-bdw-5557u total:278 pass:267 dwarn:0 dfail:0 fail:0 skip:11 time: 430s fi-bdw-gvtdvm total:278 pass:256 dwarn:8 dfail:0 fail:0 skip:14 time: 429s fi-bsw-n3050 total:278 pass:239 dwarn:0 dfail:0 fail:0 skip:39 time: 572s fi-bxt-j4205 total:278 pass:259 dwarn:0 dfail:0 fail:0 skip:19 time: 512s fi-bxt-t5700 total:278 pass:258 dwarn:0 dfail:0 fail:0 skip:20 time: 536s fi-byt-j1900 total:278 pass:251 dwarn:0 dfail:0 fail:0 skip:27 time: 487s fi-byt-n2820 total:278 pass:247 dwarn:0 dfail:0 fail:0 skip:31 time: 482s fi-hsw-4770 total:278 pass:262 dwarn:0 dfail:0 fail:0 skip:16 time: 410s fi-hsw-4770r total:278 pass:262 dwarn:0 dfail:0 fail:0 skip:16 time: 506s fi-ilk-650 total:278 pass:228 dwarn:0 dfail:0 fail:0 skip:50 time: 426s fi-ivb-3520m total:278 pass:260 dwarn:0 dfail:0 fail:0 skip:18 time: 493s fi-ivb-3770 total:278 pass:260 dwarn:0 dfail:0 fail:0 skip:18 time: 460s fi-kbl-7500u total:278 pass:260 dwarn:0 dfail:0 fail:0 skip:18 time: 455s fi-kbl-7560u total:278 pass:267 dwarn:1 dfail:0 fail:0 skip:10 time: 568s fi-skl-6260u total:278 pass:268 dwarn:0 dfail:0 fail:0 skip:10 time: 460s fi-skl-6700hq total:278 pass:261 dwarn:0 dfail:0 fail:0 skip:17 time: 570s fi-skl-6700k total:278 pass:256 dwarn:4 dfail:0 fail:0 skip:18 time: 460s fi-skl-6770hq total:278 pass:268 dwarn:0 dfail:0 fail:0 skip:10 time: 486s fi-skl-gvtdvm total:278 pass:265 dwarn:0 dfail:0 fail:0 skip:13 time: 434s fi-snb-2520m total:278 pass:250 dwarn:0 dfail:0 fail:0 skip:28 time: 531s fi-snb-2600 total:278 pass:248 dwarn:0 dfail:0 fail:1 skip:29 time: 410s
bdea8c440d1dba4f8f8145cf86852011f396282f drm-tip: 2017y-04m-05d-09h-08m-21s UTC integration manifest 9fcc128 drm/atomic: Add connector atomic_check function.
== Logs ==
For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_4405/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 27 lines · Maarten Lankhorst
The connector atomic check function may be called multiple times, or not at all. It's mostly useful for implementing properties but if you call
check_modesettwice it can be used for other modeset related checks as well.Signed-off-by Maarten Lankhorst <[email protected]>--- drivers/gpu/drm/drm_atomic_helper.c | 25 +++++++++++++++++---- include/drm/drm_modeset_helper_vtables.h | 37 ++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 4 deletions(-)drivers/gpu/drm/drm_atomic_helper.c +4
-4@@ -459,10 +459,20 @@ mode_fixup(struct drm_atomic_state *state)* * Check the state object to see if the requested state is physically possible. * This does all the crtc and connector related computations for an atomic -* update and adds any additional connectors needed for full modesets and calls -* down into &drm_crtc_helper_funcs.mode_fixup and -* &drm_encoder_helper_funcs.mode_fixup or -* &drm_encoder_helper_funcs.atomic_check functions of the driver backend. +* update and adds any additional connectors needed for full modesets. It calls +* the various per-object callbacks in the follow order: +* +* 1. &drm_connector_helper_funcs.atomic_best_encoder for determining the new encoder.
drivers/gpu/drm/drm_atomic_helper.c mode_fixup(struct drm_atomic_state *state) · line 475
Quoted 10 lines
drivers/gpu/drm/drm_atomic_helper.c +10
-0+* 2. &drm_connector_helper_funcs.atomic_check to validate the connector state. +* 3. If it's determined a modeset is needed then all connectors on the affected crtc +* crtc are added. +* 4. &drm_bridge_funcs.mode_fixup is called on all encoder bridges. +* 5. &drm_encoder_helper_funcs.atomic_check is called to validate any encoder state. +* This function is only called when the encoder will be part of a configured crtc, +* it must not be used for implementing connector property validation. +* If this function is NULL, &drm_atomic_encoder_helper_funcs.mode_fixup is called +* instead. +* 6. &drm_crtc_helper_funcs.mode_fixup is called last, to fix up the mode with crtc constraints.
Line too I think. And maybe insert empty lines between each item, to make them stand out more. Shouldn't affect rendering, but better to recheck.
Quoted 42 lines
drivers/gpu/drm/drm_atomic_helper.c +7
-0* * &drm_crtc_state.mode_changed is set when the input mode is changed. * &drm_crtc_state.connectors_changed is set when a connector is added or @@ -522,6 +532,8 @@ drm_atomic_helper_check_modeset(struct drm_device *dev,return ret;for_each_oldnew_connector_in_state (state, connector, old_connector_state, new_connector_state, i) { +const struct drm_connector_helper_funcs *funcs = connector->helper_private; +/* * This only sets crtc->connectors_changed for routing changes, * drivers must set crtc->connectors_changed themselves when @@ -539,6 +551,11 @@ drm_atomic_helper_check_modeset(struct drm_device *dev, new_connector_state->link_status) new_crtc_state->connectors_changed = true; } + +if (funcs->atomic_check) + ret = funcs->atomic_check (connector, new_connector_state); +if (ret) +return ret; }/* include/drm/drm_modeset_helper_vtables.h +10
-0@@ -860,6 +860,43 @@ struct drm_connector_helper_funcs {*/ struct drm_encoder *(*atomic_best_encoder)(struct drm_connector *connector,struct drm_connector_state *connector_state); + +/** +* @atomic_check: +* +* Drivers should check connector properties in this +* hook. This function is called from &drm_atomic_helper_check_modeset. +* +* This function may not be called at all on a modeset or connector +* change, so it should only be used to validate properties. +* If it's required to validate all connectors from there, call
include/drm/drm_modeset_helper_vtables.h struct drm_connector_helper_funcs { · line 882
Quoted 10 lines
include/drm/drm_modeset_helper_vtables.h +10
-0+* &drm_atomic_helper_check_modeset twice. This will result in +* atomic_check possibly being called twice as well, which the callback +* should be made to handle correctly. +* +* This function is also allowed to inspect any other object's state and +* can add more state objects to the atomic commit if needed. Care must +* be taken though to ensure that state check and compute functions for +* these added states are all called, and derived state in other objects +* all updated. Again the recommendation is to just call check helpers +* until a maximal configuration is reached.
I think it'd be good to highlight setting connectors_changed from this callback:
"If this callback determines that the property change requires a full modeset, it can set &drm_crtc_state->connectors_changed to steer the control flow in drm_atomic_helper_check_modeset()."
With those nits addressed, Reviewed-by: Daniel Vetter <[email protected]>
Would be good to get DK to r-b the patch too before merging, just for practice and coordination.
Cheers, Daniel
Quoted 27 lines
include/drm/drm_modeset_helper_vtables.h +17
-0+* +* NOTE: +* +* This function is called in the check phase of an atomic update. The +* driver is not allowed to change anything outside of the free-standing +* state objects passed-in or assembled in the overall &drm_atomic_state +* update tracking structure. +* +* RETURNS: +* +* 0 on success, -EINVAL if the state or the transition can't be +* supported, -ENOMEM on memory allocation failure and -EDEADLK if an +* attempt to obtain another state object ran into a &drm_modeset_lock +* deadlock. +*/ +int (*atomic_check)(struct drm_connector *connector, +struct drm_connector_state *state); };/** Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Maarten Lankhorst
maintainerOp 05-04-17 om 12:06 schreef Daniel Vetter:
Quoted 100 lines · Maarten Lankhorst
Quoted 27 lines
The connector atomic check function may be called multiple times, or not at all. It's mostly useful for implementing properties but if you call
check_modesettwice it can be used for other modeset related checks as well.Signed-off-by Maarten Lankhorst <[email protected]>--- drivers/gpu/drm/drm_atomic_helper.c | 25 +++++++++++++++++---- include/drm/drm_modeset_helper_vtables.h | 37 ++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 4 deletions(-)drivers/gpu/drm/drm_atomic_helper.c +4
-4@@ -459,10 +459,20 @@ mode_fixup(struct drm_atomic_state *state)* * Check the state object to see if the requested state is physically possible. * This does all the crtc and connector related computations for an atomic -* update and adds any additional connectors needed for full modesets and calls -* down into &drm_crtc_helper_funcs.mode_fixup and -* &drm_encoder_helper_funcs.mode_fixup or -* &drm_encoder_helper_funcs.atomic_check functions of the driver backend. +* update and adds any additional connectors needed for full modesets. It calls +* the various per-object callbacks in the follow order: +* +* 1. &drm_connector_helper_funcs.atomic_best_encoder for determining the new encoder. drivers/gpu/drm/drm_atomic_helper.c mode_fixup(struct drm_atomic_state *state) · line 475
Quoted 10 lines
drivers/gpu/drm/drm_atomic_helper.c +10
-0+* 2. &drm_connector_helper_funcs.atomic_check to validate the connector state. +* 3. If it's determined a modeset is needed then all connectors on the affected crtc +* crtc are added. +* 4. &drm_bridge_funcs.mode_fixup is called on all encoder bridges. +* 5. &drm_encoder_helper_funcs.atomic_check is called to validate any encoder state. +* This function is only called when the encoder will be part of a configured crtc, +* it must not be used for implementing connector property validation. +* If this function is NULL, &drm_atomic_encoder_helper_funcs.mode_fixup is called +* instead. +* 6. &drm_crtc_helper_funcs.mode_fixup is called last, to fix up the mode with crtc constraints. Line too I think. And maybe insert empty lines between each item, to make them stand out more. Shouldn't affect rendering, but better to recheck.
Quoted 42 lines
drivers/gpu/drm/drm_atomic_helper.c +7
-0* * &drm_crtc_state.mode_changed is set when the input mode is changed. * &drm_crtc_state.connectors_changed is set when a connector is added or @@ -522,6 +532,8 @@ drm_atomic_helper_check_modeset(struct drm_device *dev,return ret;for_each_oldnew_connector_in_state (state, connector, old_connector_state, new_connector_state, i) { +const struct drm_connector_helper_funcs *funcs = connector->helper_private; +/* * This only sets crtc->connectors_changed for routing changes, * drivers must set crtc->connectors_changed themselves when @@ -539,6 +551,11 @@ drm_atomic_helper_check_modeset(struct drm_device *dev, new_connector_state->link_status) new_crtc_state->connectors_changed = true; } + +if (funcs->atomic_check) + ret = funcs->atomic_check (connector, new_connector_state); +if (ret) +return ret; }/* include/drm/drm_modeset_helper_vtables.h +10
-0@@ -860,6 +860,43 @@ struct drm_connector_helper_funcs {*/ struct drm_encoder *(*atomic_best_encoder)(struct drm_connector *connector,struct drm_connector_state *connector_state); + +/** +* @atomic_check: +* +* Drivers should check connector properties in this +* hook. This function is called from &drm_atomic_helper_check_modeset. +* +* This function may not be called at all on a modeset or connector +* change, so it should only be used to validate properties. +* If it's required to validate all connectors from there, call include/drm/drm_modeset_helper_vtables.h struct drm_connector_helper_funcs { · line 882
Quoted 10 lines
include/drm/drm_modeset_helper_vtables.h +10
-0+* &drm_atomic_helper_check_modeset twice. This will result in +* atomic_check possibly being called twice as well, which the callback +* should be made to handle correctly. +* +* This function is also allowed to inspect any other object's state and +* can add more state objects to the atomic commit if needed. Care must +* be taken though to ensure that state check and compute functions for +* these added states are all called, and derived state in other objects +* all updated. Again the recommendation is to just call check helpers +* until a maximal configuration is reached. I think it'd be good to highlight setting
connectors_changedfrom this callback:"If this callback determines that the property change requires a full modeset, it can set
&drm_crtc_state->connectors_changedto steer the control flow indrm_atomic_helper_check_modeset()."
Quoted 6 lines
With those nits addressed, Reviewed-by: Daniel Vetter <[email protected]>
Would be good to get DK to r-b the patch too before merging, just for practice and coordination.
Cheers, Daniel
Could you review?
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 23 lines · Daniel Vetter
Quoted 22 lines · Maarten Lankhorst
The connector atomic check function may be called multiple times, or not at all. It's mostly useful for implementing properties but if you call
check_modesettwice it can be used for other modeset related checks as well.Signed-off-by Maarten Lankhorst <[email protected]>--- drivers/gpu/drm/drm_atomic_helper.c | 25 +++++++++++++++++---- include/drm/drm_modeset_helper_vtables.h | 37 ++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 4 deletions(-)drivers/gpu/drm/drm_atomic_helper.c +0
-3@@ -459,10 +459,20 @@ mode_fixup(struct drm_atomic_state *state)* * Check the state object to see if the requested state is physically possible. * This does all the crtc and connector related computations for an atomic -* update and adds any additional connectors needed for full modesets and calls -* down into &drm_crtc_helper_funcs.mode_fixup and -* &drm_encoder_helper_funcs.mode_fixup or
Quoted 8 lines
drivers/gpu/drm/drm_atomic_helper.c mode_fixup(struct drm_atomic_state *state) · line 468
Quoted 8 lines
drivers/gpu/drm/drm_atomic_helper.c +7
-1-* &drm_encoder_helper_funcs.atomic_check functions of the driver backend. +* update and adds any additional connectors needed for full modesets. It calls +* the various per-object callbacks in the follow order: +* +* 1. &drm_connector_helper_funcs.atomic_best_encoder for determining the new encoder. +* 2. &drm_connector_helper_funcs.atomic_check to validate the connector state. +* 3. If it's determined a modeset is needed then all connectors on the affected crtc +* crtc are added.
Typo - 'crtc' typed twice.
update_output_state which is called before _helper_check_modeset() also adds all affected connectors. Why is that not considered when you say affected connectors are added in Step 3? Is that because update_output_state() is in the legacy modeset path?
Quoted 44 lines
drivers/gpu/drm/drm_atomic_helper.c mode_fixup(struct drm_atomic_state *state) · line 475
Quoted 7 lines
drivers/gpu/drm/drm_atomic_helper.c +7
-0+* 4. &drm_bridge_funcs.mode_fixup is called on all encoder bridges. +* 5. &drm_encoder_helper_funcs.atomic_check is called to validate any encoder state. +* This function is only called when the encoder will be part of a configured crtc, +* it must not be used for implementing connector property validation. +* If this function is NULL, &drm_atomic_encoder_helper_funcs.mode_fixup is called +* instead. +* 6. &drm_crtc_helper_funcs.mode_fixup is called last, to fix up the mode with crtc constraints. Line too I think. And maybe insert empty lines between each item, to make them stand out more. Shouldn't affect rendering, but better to recheck.
Quoted 33 lines
drivers/gpu/drm/drm_atomic_helper.c +7
-0* * &drm_crtc_state.mode_changed is set when the input mode is changed. * &drm_crtc_state.connectors_changed is set when a connector is added or @@ -522,6 +532,8 @@ drm_atomic_helper_check_modeset(struct drm_device *dev,return ret;for_each_oldnew_connector_in_state (state, connector, old_connector_state, new_connector_state, i) { +const struct drm_connector_helper_funcs *funcs = connector->helper_private; +/* * This only sets crtc->connectors_changed for routing changes, * drivers must set crtc->connectors_changed themselves when @@ -539,6 +551,11 @@ drm_atomic_helper_check_modeset(struct drm_device *dev, new_connector_state->link_status) new_crtc_state->connectors_changed = true; } + +if (funcs->atomic_check) + ret = funcs->atomic_check (connector, new_connector_state); +if (ret) +return ret; }/* include/drm/drm_modeset_helper_vtables.h +1
-0@@ -860,6 +860,43 @@ struct drm_connector_helper_funcs {*/ struct drm_encoder *(*atomic_best_encoder)(struct drm_connector *connector,struct drm_connector_state *connector_state); +
Quoted 8 lines
include/drm/drm_modeset_helper_vtables.h struct drm_connector_helper_funcs { · line 871
Quoted 8 lines
include/drm/drm_modeset_helper_vtables.h +8
-0+/** +* @atomic_check: +* +* Drivers should check connector properties in this +* hook. This function is called from &drm_atomic_helper_check_modeset. +* +* This function may not be called at all on a modeset or connector +* change, so it should only be used to validate properties.
I did not understand this part - "function may not be called at all on a modeset or connector change". Why is that?
Quoted 2 lines
include/drm/drm_modeset_helper_vtables.h struct drm_connector_helper_funcs { · line 873
Quoted 2 lines
include/drm/drm_modeset_helper_vtables.h +2
-0+* If it's required to validate all connectors from there, call +* &drm_atomic_helper_check_modeset twice. This will result in
s/twice/again ?
Quoted 1 line
include/drm/drm_modeset_helper_vtables.h struct drm_connector_helper_funcs { · line 874
Quoted 1 line
include/drm/drm_modeset_helper_vtables.h +1
-0+* atomic_check possibly being called twice as well, which the callback
&drm_connector_helper_funcs.atomic_check?
I had to read this a couple of times to understand, but I guess, that's mostly me trying to piece things together.
-DK
Quoted 42 lines
include/drm/drm_modeset_helper_vtables.h struct drm_connector_helper_funcs { · line 882
Quoted 8 lines
include/drm/drm_modeset_helper_vtables.h +8
-0+* should be made to handle correctly. +* +* This function is also allowed to inspect any other object's state and +* can add more state objects to the atomic commit if needed. Care must +* be taken though to ensure that state check and compute functions for +* these added states are all called, and derived state in other objects +* all updated. Again the recommendation is to just call check helpers +* until a maximal configuration is reached. I think it'd be good to highlight setting
connectors_changedfrom this callback:"If this callback determines that the property change requires a full modeset, it can set
&drm_crtc_state->connectors_changedto steer the control flow indrm_atomic_helper_check_modeset()."With those nits addressed, Reviewed-by: Daniel Vetter <[email protected]>
Would be good to get DK to r-b the patch too before merging, just for practice and coordination.
Cheers, Daniel
Quoted 19 lines
include/drm/drm_modeset_helper_vtables.h +17
-0+* +* NOTE: +* +* This function is called in the check phase of an atomic update. The +* driver is not allowed to change anything outside of the free-standing +* state objects passed-in or assembled in the overall &drm_atomic_state +* update tracking structure. +* +* RETURNS: +* +* 0 on success, -EINVAL if the state or the transition can't be +* supported, -ENOMEM on memory allocation failure and -EDEADLK if an +* attempt to obtain another state object ran into a &drm_modeset_lock +* deadlock. +*/ +int (*atomic_check)(struct drm_connector *connector, +struct drm_connector_state *state); };
Quoted 9 lines
Quoted 8 lines
include/drm/drm_modeset_helper_vtables.h +0
-0/** Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Maarten Lankhorst
maintainerOp 06-04-17 om 03:27 schreef Pandiyan, Dhinakaran:
Quoted 34 lines · Daniel Vetter
Quoted 23 lines · Maarten Lankhorst
Quoted 22 lines
The connector atomic check function may be called multiple times, or not at all. It's mostly useful for implementing properties but if you call
check_modesettwice it can be used for other modeset related checks as well.Signed-off-by Maarten Lankhorst <[email protected]>--- drivers/gpu/drm/drm_atomic_helper.c | 25 +++++++++++++++++---- include/drm/drm_modeset_helper_vtables.h | 37 ++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 4 deletions(-)drivers/gpu/drm/drm_atomic_helper.c +0
-3@@ -459,10 +459,20 @@ mode_fixup(struct drm_atomic_state *state)* * Check the state object to see if the requested state is physically possible. * This does all the crtc and connector related computations for an atomic -* update and adds any additional connectors needed for full modesets and calls -* down into &drm_crtc_helper_funcs.mode_fixup and -* &drm_encoder_helper_funcs.mode_fixup or Quoted 8 lines
drivers/gpu/drm/drm_atomic_helper.c mode_fixup(struct drm_atomic_state *state) · line 468
Quoted 8 lines
drivers/gpu/drm/drm_atomic_helper.c +7
-1-* &drm_encoder_helper_funcs.atomic_check functions of the driver backend. +* update and adds any additional connectors needed for full modesets. It calls +* the various per-object callbacks in the follow order: +* +* 1. &drm_connector_helper_funcs.atomic_best_encoder for determining the new encoder. +* 2. &drm_connector_helper_funcs.atomic_check to validate the connector state. +* 3. If it's determined a modeset is needed then all connectors on the affected crtc +* crtc are added. Typo - 'crtc' typed twice.
Quoted 4 lines
update_output_statewhich is called before_helper_check_modeset()also adds all affected connectors. Why is that not considered when you say affected connectors are added in Step 3? Is that becauseupdate_output_state()is in the legacy modeset path?
Yes. update_output_state is just a legacy function.
When a crtc is cloned, a atomic update may only disable 1 connector and leave the other one enabled. In this case there's a modeset but all connectors are not checked yet.
Similar for changing crtc_state->active, which may also result in a modeset with no connectors added yet.
Quoted 46 lines
Quoted 46 lines
drivers/gpu/drm/drm_atomic_helper.c mode_fixup(struct drm_atomic_state *state) · line 475
Quoted 8 lines
drivers/gpu/drm/drm_atomic_helper.c +7
-0+* 4. &drm_bridge_funcs.mode_fixup is called on all encoder bridges. +* 5. &drm_encoder_helper_funcs.atomic_check is called to validate any encoder state. +* This function is only called when the encoder will be part of a configured crtc, +* it must not be used for implementing connector property validation. +* If this function is NULL, &drm_atomic_encoder_helper_funcs.mode_fixup is called +* instead. +* 6. &drm_crtc_helper_funcs.mode_fixup is called last, to fix up the mode with crtc constraints. Line too I think. And maybe insert empty lines between each item, to make them stand out more. Shouldn't affect rendering, but better to recheck.
Quoted 35 lines
drivers/gpu/drm/drm_atomic_helper.c +7
-0* * &drm_crtc_state.mode_changed is set when the input mode is changed. * &drm_crtc_state.connectors_changed is set when a connector is added or @@ -522,6 +532,8 @@ drm_atomic_helper_check_modeset(struct drm_device *dev,return ret;for_each_oldnew_connector_in_state (state, connector, old_connector_state, new_connector_state, i) { +const struct drm_connector_helper_funcs *funcs = connector->helper_private; +/* * This only sets crtc->connectors_changed for routing changes, * drivers must set crtc->connectors_changed themselves when @@ -539,6 +551,11 @@ drm_atomic_helper_check_modeset(struct drm_device *dev, new_connector_state->link_status) new_crtc_state->connectors_changed = true; } + +if (funcs->atomic_check) + ret = funcs->atomic_check (connector, new_connector_state); +if (ret) +return ret; }/* include/drm/drm_modeset_helper_vtables.h +3
-0@@ -860,6 +860,43 @@ struct drm_connector_helper_funcs {*/ struct drm_encoder *(*atomic_best_encoder)(struct drm_connector *connector,struct drm_connector_state *connector_state); + +/** +* @atomic_check:
Quoted 8 lines
Quoted 6 lines
include/drm/drm_modeset_helper_vtables.h struct drm_connector_helper_funcs { · line 871
Quoted 6 lines
include/drm/drm_modeset_helper_vtables.h +6
-0+* +* Drivers should check connector properties in this +* hook. This function is called from &drm_atomic_helper_check_modeset. +* +* This function may not be called at all on a modeset or connector +* change, so it should only be used to validate properties. I did not understand this part - "function may not be called at all on a modeset or connector change". Why is that?
I meant moving one connector to a different crtc, if there are 2 connectors on one of the crtc the check function for the other one may not be called the first time around.
I guess that falls under modeset, so that part may be killed.
Quoted 3 lines
Quoted 2 lines
include/drm/drm_modeset_helper_vtables.h struct drm_connector_helper_funcs { · line 873
Quoted 2 lines
include/drm/drm_modeset_helper_vtables.h +2
-0+* If it's required to validate all connectors from there, call +* &drm_atomic_helper_check_modeset twice. This will result in s/twice/again ?
Indeed.
Quoted 6 lines
Quoted 1 line
include/drm/drm_modeset_helper_vtables.h struct drm_connector_helper_funcs { · line 874
Quoted 1 line
include/drm/drm_modeset_helper_vtables.h +1
-0+* atomic_check possibly being called twice as well, which the callback &drm_connector_helper_funcs.atomic_check?
I had to read this a couple of times to understand, but I guess, that's mostly me trying to piece things together.
Yes.
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 129 lines · Maarten Lankhorst
Op 06-04-17 om 03:27 schreef Pandiyan, Dhinakaran:
Quoted 4 lines · Daniel Vetter
Quoted 3 lines · Maarten Lankhorst
Quoted 2 lines
The connector atomic check function may be called multiple times, or not at all. It's mostly useful for implementing properties but if
you
Quoted 1 line
Quoted 1 line
Quoted 1 line
call
check_modesettwice it can be used for other modeset relatedchecks
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
as well.
Signed-off-by Maarten Lankhorst <[email protected]>--- drivers/gpu/drm/drm_atomic_helper.c | 25 +++++++++++++++++---- include/drm/drm_modeset_helper_vtables.h | 37++++++++++++++++++++++++++++++++
Quoted 3 lines
Quoted 3 lines
Review
Quoted 3 lines
2 files changed, 58 insertions(+), 4 deletions(-)(quoted diff) +0
-0
b/drivers/gpu/drm/drm_atomic_helper.cQuoted 6 lines
Quoted 6 lines
drivers/gpu/drm/drm_atomic_helper.c mode_fixup(struct drm_atomic_state *state) · line 460
Quoted 6 lines
index
c3994b4d5f32..d550e79e8347100644drivers/gpu/drm/drm_atomic_helper.c +0
-0@@ -459,10 +459,20 @@ mode_fixup(struct drm_atomic_state *state)* * Check the state object to see if the requested state is physically possible.
Quoted 1 line
Quoted 1 line
drivers/gpu/drm/drm_atomic_helper.c mode_fixup(struct drm_atomic_state *state) · line 461
Quoted 1 line
drivers/gpu/drm/drm_atomic_helper.c +0
-0* This does all the crtc and connector related computations for an atomic
Quoted 1 line
Quoted 1 line
drivers/gpu/drm/drm_atomic_helper.c mode_fixup(struct drm_atomic_state *state) · line 462
Quoted 1 line
drivers/gpu/drm/drm_atomic_helper.c +0
-1-* update and adds any additional connectors needed for full modesets and calls
Quoted 3 lines
Quoted 3 lines
drivers/gpu/drm/drm_atomic_helper.c mode_fixup(struct drm_atomic_state *state)
Quoted 3 lines
drivers/gpu/drm/drm_atomic_helper.c +0
-3-* down into &drm_crtc_helper_funcs.mode_fixup and -* &drm_encoder_helper_funcs.mode_fixup or -* &drm_encoder_helper_funcs.atomic_check functions of the driver backend.
Quoted 1 line
Quoted 1 line
drivers/gpu/drm/drm_atomic_helper.c mode_fixup(struct drm_atomic_state *state) · line 462
Quoted 1 line
drivers/gpu/drm/drm_atomic_helper.c +1
-0+* update and adds any additional connectors needed for full modesets. It calls
Quoted 3 lines
Quoted 3 lines
drivers/gpu/drm/drm_atomic_helper.c mode_fixup(struct drm_atomic_state *state)
Quoted 3 lines
drivers/gpu/drm/drm_atomic_helper.c +3
-0+* the various per-object callbacks in the follow order: +* +* 1. &drm_connector_helper_funcs.atomic_best_encoder for determining the new encoder.
Quoted 1 line
Quoted 1 line
drivers/gpu/drm/drm_atomic_helper.c mode_fixup(struct drm_atomic_state *state) · line 466
Quoted 1 line
drivers/gpu/drm/drm_atomic_helper.c +1
-0+* 2. &drm_connector_helper_funcs.atomic_check to validate the connector state.
Quoted 1 line
Quoted 1 line
drivers/gpu/drm/drm_atomic_helper.c mode_fixup(struct drm_atomic_state *state) · line 467
Quoted 1 line
drivers/gpu/drm/drm_atomic_helper.c +1
-0+* 3. If it's determined a modeset is needed then all connectors on the affected crtc
Quoted 7 lines
Quoted 1 line
drivers/gpu/drm/drm_atomic_helper.c mode_fixup(struct drm_atomic_state *state) · line 468
Quoted 1 line
drivers/gpu/drm/drm_atomic_helper.c +1
-0+* crtc are added. Typo - 'crtc' typed twice.
update_output_statewhich is called before_helper_check_modeset()also adds all affected connectors. Why is that not considered when you say affected connectors are added in Step 3? Is that becauseupdate_output_state()is in the legacy modeset path?Yes.
update_output_stateis just a legacy function.When a crtc is cloned, a atomic update may only disable 1 connector and leave the other one enabled. In this case there's a modeset but all connectors are not checked yet.
Similar for changing
crtc_state->active, which may also result in a modeset with no connectors added yet.Quoted 3 lines
Quoted 3 lines
drivers/gpu/drm/drm_atomic_helper.c mode_fixup(struct drm_atomic_state *state) · line 470
Quoted 3 lines
drivers/gpu/drm/drm_atomic_helper.c +2
-0+* 4. &drm_bridge_funcs.mode_fixup is called on all encoder bridges. +* 5. &drm_encoder_helper_funcs.atomic_check is called to validate any encoder state.
Quoted 1 line
Quoted 1 line
drivers/gpu/drm/drm_atomic_helper.c mode_fixup(struct drm_atomic_state *state) · line 471
Quoted 1 line
drivers/gpu/drm/drm_atomic_helper.c +1
-0+* This function is only called when the encoder will be part of a configured crtc,
Quoted 1 line
Quoted 1 line
drivers/gpu/drm/drm_atomic_helper.c mode_fixup(struct drm_atomic_state *state) · line 472
Quoted 1 line
drivers/gpu/drm/drm_atomic_helper.c +1
-0+* it must not be used for implementing connector property validation.
Quoted 1 line
Quoted 1 line
drivers/gpu/drm/drm_atomic_helper.c mode_fixup(struct drm_atomic_state *state) · line 473
Quoted 1 line
drivers/gpu/drm/drm_atomic_helper.c +1
-0+* If this function is NULL, &drm_atomic_encoder_helper_funcs.mode_fixup is called
Quoted 2 lines
Quoted 2 lines
drivers/gpu/drm/drm_atomic_helper.c mode_fixup(struct drm_atomic_state *state) · line 475
Quoted 2 lines
drivers/gpu/drm/drm_atomic_helper.c +2
-0+* instead. +* 6. &drm_crtc_helper_funcs.mode_fixup is called last, to fix up the mode with crtc constraints.
Quoted 1 line
Quoted 1 line
Line too I think. And maybe insert empty lines between each item, to
make
Quoted 5 lines
Quoted 5 lines
them stand out more. Shouldn't affect rendering, but better to recheck.
Quoted 3 lines
drivers/gpu/drm/drm_atomic_helper.c +0
-0* * &drm_crtc_state.mode_changed is set when the input mode is changed. * &drm_crtc_state.connectors_changed is set when a connector is added or
Quoted 1 line
Quoted 1 line
drivers/gpu/drm/drm_atomic_helper.c drm_atomic_helper_check_modeset(struct drm_device
Quoted 1 line
drivers/gpu/drm/drm_atomic_helper.c +0
-0@@ -522,6 +532,8 @@ drm_atomic_helper_check_modeset(struct drm_device*dev,
Quoted 3 lines
Quoted 3 lines
drivers/gpu/drm/drm_atomic_helper.c drm_atomic_helper_check_modeset(struct drm_device *dev,
Quoted 3 lines
drivers/gpu/drm/drm_atomic_helper.c +0
-0return ret; for_each_oldnew_connector_in_state(state, connector,
old_connector_state,new_connector_state, i) {Quoted 1 line
Quoted 1 line
drivers/gpu/drm/drm_atomic_helper.c drm_atomic_helper_check_modeset(struct drm_device · line 535
Quoted 1 line
drivers/gpu/drm/drm_atomic_helper.c +1
-0+ const struct drm_connector_helper_funcs *funcs =
connector->helper_private;Quoted 3 lines
Quoted 3 lines
drivers/gpu/drm/drm_atomic_helper.c drm_atomic_helper_check_modeset(struct drm_device *dev,
Quoted 3 lines
drivers/gpu/drm/drm_atomic_helper.c +1
-0+/* * This only sets crtc->connectors_changed for routing changes,
Quoted 1 line
Quoted 1 line
drivers/gpu/drm/drm_atomic_helper.c drm_atomic_helper_check_modeset(struct drm_device · line 539
Quoted 1 line
drivers/gpu/drm/drm_atomic_helper.c +0
-0* drivers must set crtc->connectors_changed themselves when
Quoted 1 line
Quoted 1 line
drivers/gpu/drm/drm_atomic_helper.c drm_atomic_helper_check_modeset(struct drm_device
Quoted 1 line
drivers/gpu/drm/drm_atomic_helper.c +0
-0@@ -539,6 +551,11 @@ drm_atomic_helper_check_modeset(struct drm_device*dev,
Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/drm_atomic_helper.c drm_atomic_helper_check_modeset(struct drm_device *dev,
Quoted 6 lines
drivers/gpu/drm/drm_atomic_helper.c +3
-0new_connector_state->link_status) new_crtc_state->connectors_changed = true; } + +if (funcs->atomic_check) + ret = funcs->atomic_check(connector,
new_connector_state);Quoted 6 lines
Quoted 6 lines
Review
Quoted 6 lines
drivers/gpu/drm/drm_atomic_helper.c +2
-0+if (ret) +return ret; }/* (quoted diff) +0
-0
b/include/drm/drm_modeset_helper_vtables.hQuoted 6 lines
Quoted 6 lines
include/drm/drm_modeset_helper_vtables.h struct drm_connector_helper_funcs { · line 861
Quoted 6 lines
index
b304950b402d..7b5dd909f189100644include/drm/drm_modeset_helper_vtables.h +0
-0@@ -860,6 +860,43 @@ struct drm_connector_helper_funcs {*/ struct drm_encoder *(*atomic_best_encoder)(struct drm_connector*connector,
Quoted 1 line
Quoted 1 line
include/drm/drm_modeset_helper_vtables.h struct drm_connector_helper_funcs { · line 862
Quoted 1 line
include/drm/drm_modeset_helper_vtables.h +0
-0struct
drm_connector_state*connector_state);Quoted 6 lines
Quoted 6 lines
include/drm/drm_modeset_helper_vtables.h struct drm_connector_helper_funcs {
Quoted 6 lines
include/drm/drm_modeset_helper_vtables.h +6
-0+ +/** +* @atomic_check: +* +* Drivers should check connector properties in this +* hook. This function is called from
&drm_atomic_helper_check_modeset.Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
include/drm/drm_modeset_helper_vtables.h +3
-0+* +* This function may not be called at all on a modeset or connector +* change, so it should only be used to validate properties.
Quoted 8 lines
Quoted 2 lines
I did not understand this part - "function may not be called at all on a modeset or connector change". Why is that?
I meant moving one connector to a different crtc, if there are 2 connectors on one of the crtc the check function for the other one may not be called the first time around.
I guess that falls under modeset, so that part may be killed.
With the "crtc crtc" typo fixed and this change, Reviewed-by: Dhinakaran Pandiyan <[email protected]>
-DK
Quoted 9 lines
Quoted 3 lines
Quoted 2 lines
+ * If it's required to validate all connectors from there, call
Quoted 1 line
include/drm/drm_modeset_helper_vtables.h +1
-0+* &drm_atomic_helper_check_modeset twice. This will result in s/twice/again ?
Indeed.
Quoted 1 line
Quoted 1 line
include/drm/drm_modeset_helper_vtables.h struct drm_connector_helper_funcs { · line 873
Quoted 1 line
include/drm/drm_modeset_helper_vtables.h +1
-0+* atomic_check possibly being called twice as well, which the callback
Quoted 3 lines
&drm_connector_helper_funcs.atomic_check?
Quoted 8 lines
Quoted 2 lines
I had to read this a couple of times to understand, but I guess, that's mostly me trying to piece things together.
Yes.
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx