From: Harry Wentland <harry.wentland@amd.com>
To: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>,
amd-gfx@lists.freedesktop.org
Cc: Alex Deucher <alexander.deucher@amd.com>,
Aurabindo Pillai <aurabindo.pillai@amd.com>,
Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Subject: Re: [PATCH 3/3] drm/amd/display: Move dc_state copy in commit_tail after dc_commit_state
Date: Tue, 11 Oct 2022 18:03:10 -0400 [thread overview]
Message-ID: <28a3aa2b-3ffd-4b71-d358-3b18acccde9c@amd.com> (raw)
In-Reply-To: <20221011181140.94595-4-Rodrigo.Siqueira@amd.com>
On 2022-10-11 14:11, Rodrigo Siqueira wrote:
> From: Aurabindo Pillai <aurabindo.pillai@amd.com>
>
> [Why&How]
> With the new commit sequence, we do not want the state to be copied before
> the call to dc_commit_state() since this leaks the phantom streams into
> new state.
>
What are phantom streams? Why are they needed? Please elaborate.
> Fix this by doing the dc state copy right after the dc_commit_state()
> call.
>
> Cc: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
> Cc: Harry Wentland <harry.wentland@amd.com>
> Reviewed-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
> Signed-off-by: Aurabindo Pillai <aurabindo.pillai@amd.com>
> ---
> .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 17 +++++++++--------
> 1 file changed, 9 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index 63f076a46260..17a9108f8186 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -7999,15 +7999,8 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state)
> drm_atomic_helper_update_legacy_modeset_state(dev, state);
>
> dm_state = dm_atomic_get_new_state(state);
> - if (dm_state && dm_state->context) {
> + if (dm_state && dm_state->context)
> dc_state = dm_state->context;
> - } else {
> - /* No state changes, retain current state. */
> - dc_state_temp = dc_create_state(dm->dc);
> - ASSERT(dc_state_temp);
> - dc_state = dc_state_temp;
> - dc_resource_state_copy_construct_current(dm->dc, dc_state);
> - }
If I understand this right this change means that when we do a
"fast" update we'll simply modify the existing dc_state directly,
instead of operating on a copy. Is this safe? Keep in mind that
calls in amdgpu_dm can be multi-threaded, unlike calls on other
OSes that use our driver.
In particular, it looks like dm_enable_per_frame_crtc_master_sync
is called on dc_state before the dc_lock is taken. Could this
lead to issues similar to the ones outlined by Nick in his commit
when he wrote this code:
eb3dc8978596 ("drm/amd/display: Use private obj helpers for dm_atomic_state")
>
> for_each_oldnew_crtc_in_state (state, crtc, old_crtc_state,
> new_crtc_state, i) {
> @@ -8127,6 +8120,14 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state)
> mutex_unlock(&dm->dc_lock);
> }
>
> + if (dc_state == NULL) {
> + /* No state changes, retain current state. */
> + dc_state_temp = dc_create_state(dm->dc);
> + ASSERT(dc_state_temp);
> + dc_state = dc_state_temp;
> + dc_resource_state_copy_construct_current(dm->dc, dc_state);
> + }
> +
Does moving this down serve a purpose other than the one to preserve
this code?
Moving this means that dc_commit_state (now delegating to
dc_commit_streams on some ASICs) is operating on dc->current_state
whereas dc_commit_updates_for_stream (now delegating to
dc_update_planes_and_stream on some ASICs) is operating on
the state copy, i.e. the local dc_state.
Is this really the intention? Will this make our lives easier or
harder? This code is already hard to parse. I fail to see how this
will improve that situation.
Harry
> for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) {
> struct amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc);
>
next prev parent reply other threads:[~2022-10-11 22:03 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-11 18:11 [PATCH 0/3] Update DC commit sequence Rodrigo Siqueira
2022-10-11 18:11 ` [PATCH 1/3] drm/amd/display: Add functions for new " Rodrigo Siqueira
2022-10-11 18:47 ` Harry Wentland
2022-10-11 18:11 ` [PATCH 2/3] drm/amd/display: Enable new commit sequence only for DCN32x Rodrigo Siqueira
2022-10-11 22:08 ` Harry Wentland
2022-10-11 18:11 ` [PATCH 3/3] drm/amd/display: Move dc_state copy in commit_tail after dc_commit_state Rodrigo Siqueira
2022-10-11 22:03 ` Harry Wentland [this message]
2022-10-11 18:52 ` [PATCH 0/3] Update DC commit sequence Wheeler, Daniel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=28a3aa2b-3ffd-4b71-d358-3b18acccde9c@amd.com \
--to=harry.wentland@amd.com \
--cc=Rodrigo.Siqueira@amd.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=aurabindo.pillai@amd.com \
--cc=nicholas.kazlauskas@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox