From: Thomas Zimmermann <tzimmermann@suse.de>
To: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
Rob Clark <robdclark@gmail.com>,
Abhinav Kumar <quic_abhinavk@quicinc.com>,
Sean Paul <sean@poorly.run>,
Marijn Suijten <marijn.suijten@somainline.org>,
Chandan Uddaraju <chandanu@codeaurora.org>,
Jeykumar Sankaran <jsanka@codeaurora.org>,
Jordan Crouse <jordan@cosmicpenguin.net>,
Sravanthi Kollukuduru <skolluku@codeaurora.org>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
Archit Taneja <architt@codeaurora.org>,
Rajesh Yadav <ryadav@codeaurora.org>,
linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org,
Simona Vetter <simona.vetter@ffwll.ch>
Subject: Re: [PATCH 0/6] drm: enforce rules for drm_atomic_helper_check_modeset()
Date: Fri, 10 Jan 2025 14:30:55 +0100 [thread overview]
Message-ID: <29dcf748-c571-4c91-92b7-481be5a43ff5@suse.de> (raw)
In-Reply-To: <t7ga7l7hi5y634hc6sklp6mzae3jfqs66nkalviojrzrgez3kf@b4h4ue6fdj7j>
Hi
Am 10.01.25 um 00:57 schrieb Dmitry Baryshkov:
> On Thu, Jan 09, 2025 at 02:53:16PM +0100, Thomas Zimmermann wrote:
>> Hi
>>
>>
>> Am 22.12.24 um 06:00 schrieb Dmitry Baryshkov:
>>> As pointed out by Simona, the drm_atomic_helper_check_modeset() and
>>> drm_atomic_helper_check() require the former function is rerun if the
>>> driver's callbacks modify crtc_state->mode_changed. MSM is one of the
>>> drivers which failed to follow this requirement.
>> I'm concerned about the implications of this series. How does a driver
>> upgrade from simple pageflip to full modeset if necessary? The solution in
>> msm appears to be to run the related test before drm_atomic_helper_check().
>> (Right?)
>>
>> My corner case is in mgag200, which has to reprogram the PLL if the color
>> mode changes. So it sets mode_changed to true in the primary plane's
>> atomic_check. [1] This works in practice because the plane checks run before
>> the CRTC checks. So the CRTC code will do the correct thing. Reprogramming
>> the PLL means to disable the display at some point. So it comes down to a
>> full modeset.
>>
>> You mention that drm_atomic_helper_check() needs to rerun if mode_changed
>> flips. Would it be possible to implement this instead within the helper?
> I think this should be a driver's decision. For MSM it was easier to
> move the mode_changed changes and to isolate that before calling into
> the drm_atomic_helper_check_modeset() code. Other drivers might prefer
> to rerun the helper.
Is it legal to do something like
int atomic_check(state)
{
ret = drm_atomic_helper_check(state)
if (state->dirty_needs_modeset)
ret = drm_atomic_helper_check(state)
return ret;
}
within the driver ? It appears that the atomic helpers warn then.
Best regards
Thomas
>
>> Best regards
>> Thomas
>>
>> [1] https://elixir.bootlin.com/linux/v6.12/source/drivers/gpu/drm/mgag200/mgag200_mode.c#L493
>>
>>> As suggested by Simona, implement generic code to verify that the
>>> drivers abide to those requirement and rework MSM driver to follow that
>>> restrictions.
>>>
>>> There are no dependencies between core and MSM parts, so they can go
>>> separately via corresponding trees.
>>>
>>> Reported-by: Simona Vetter <simona.vetter@ffwll.ch>
>>> Link: https://lore.kernel.org/dri-devel/ZtW_S0j5AEr4g0QW@phenom.ffwll.local/
>>> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
>>> ---
>>> Dmitry Baryshkov (6):
>>> drm/atomic-helper: document drm_atomic_helper_check() restrictions
>>> drm/atomic: prepare to check that drivers follow restrictions for needs_modeset
>>> drm/msm/dpu: don't use active in atomic_check()
>>> drm/msm/dpu: move needs_cdm setting to dpu_encoder_get_topology()
>>> drm/msm/dpu: simplify dpu_encoder_get_topology() interface
>>> drm/msm/dpu: don't set crtc_state->mode_changed from atomic_check()
>>>
>>> drivers/gpu/drm/drm_atomic.c | 3 +
>>> drivers/gpu/drm/drm_atomic_helper.c | 86 ++++++++++++++++++++++++++---
>>> drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 4 --
>>> drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 82 +++++++++++++++++----------
>>> drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h | 4 ++
>>> drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 26 +++++++++
>>> drivers/gpu/drm/msm/msm_atomic.c | 13 ++++-
>>> drivers/gpu/drm/msm/msm_kms.h | 7 +++
>>> include/drm/drm_atomic.h | 10 ++++
>>> 9 files changed, 192 insertions(+), 43 deletions(-)
>>> ---
>>> base-commit: b72747fdde637ebf52e181671bf6f41cd773b3e1
>>> change-id: 20241222-drm-dirty-modeset-88079bd27ae6
>>>
>>> Best regards,
>> --
>> --
>> Thomas Zimmermann
>> Graphics Driver Developer
>> SUSE Software Solutions Germany GmbH
>> Frankenstrasse 146, 90461 Nuernberg, Germany
>> GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
>> HRB 36809 (AG Nuernberg)
>>
--
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)
next prev parent reply other threads:[~2025-01-10 13:30 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-22 5:00 [PATCH 0/6] drm: enforce rules for drm_atomic_helper_check_modeset() Dmitry Baryshkov
2024-12-22 5:00 ` [PATCH 1/6] drm/atomic-helper: document drm_atomic_helper_check() restrictions Dmitry Baryshkov
2025-01-08 17:26 ` Simona Vetter
2025-01-09 5:26 ` Abhinav Kumar
2024-12-22 5:00 ` [PATCH 2/6] drm/atomic: prepare to check that drivers follow restrictions for needs_modeset Dmitry Baryshkov
2025-01-08 17:53 ` Simona Vetter
2025-01-08 18:32 ` Dmitry Baryshkov
2024-12-22 5:00 ` [PATCH 3/6] drm/msm/dpu: don't use active in atomic_check() Dmitry Baryshkov
2025-01-08 17:56 ` Simona Vetter
2025-01-09 1:19 ` Abhinav Kumar
2025-01-09 4:22 ` Dmitry Baryshkov
2025-01-09 5:37 ` Abhinav Kumar
2024-12-22 5:00 ` [PATCH 4/6] drm/msm/dpu: move needs_cdm setting to dpu_encoder_get_topology() Dmitry Baryshkov
2025-01-09 1:26 ` Abhinav Kumar
2024-12-22 5:00 ` [PATCH 5/6] drm/msm/dpu: simplify dpu_encoder_get_topology() interface Dmitry Baryshkov
2025-01-09 1:32 ` Abhinav Kumar
2024-12-22 5:00 ` [PATCH 6/6] drm/msm/dpu: don't set crtc_state->mode_changed from atomic_check() Dmitry Baryshkov
2025-01-08 17:55 ` Simona Vetter
2025-01-08 18:55 ` Dmitry Baryshkov
2025-01-09 2:27 ` Abhinav Kumar
2025-01-09 4:11 ` Abhinav Kumar
2025-01-09 4:26 ` Dmitry Baryshkov
2025-01-09 5:22 ` Abhinav Kumar
2025-01-09 12:12 ` Dmitry Baryshkov
2025-01-09 4:24 ` Dmitry Baryshkov
2025-01-09 13:53 ` [PATCH 0/6] drm: enforce rules for drm_atomic_helper_check_modeset() Thomas Zimmermann
2025-01-09 23:57 ` Dmitry Baryshkov
2025-01-10 13:30 ` Thomas Zimmermann [this message]
2025-01-13 8:47 ` Dmitry Baryshkov
2025-01-23 12:08 ` Dmitry Baryshkov
2025-01-23 12:36 ` (subset) " Dmitry Baryshkov
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=29dcf748-c571-4c91-92b7-481be5a43ff5@suse.de \
--to=tzimmermann@suse.de \
--cc=airlied@gmail.com \
--cc=architt@codeaurora.org \
--cc=chandanu@codeaurora.org \
--cc=dmitry.baryshkov@linaro.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=freedreno@lists.freedesktop.org \
--cc=jordan@cosmicpenguin.net \
--cc=jsanka@codeaurora.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=marijn.suijten@somainline.org \
--cc=mripard@kernel.org \
--cc=quic_abhinavk@quicinc.com \
--cc=robdclark@gmail.com \
--cc=ryadav@codeaurora.org \
--cc=sean@poorly.run \
--cc=simona.vetter@ffwll.ch \
--cc=simona@ffwll.ch \
--cc=skolluku@codeaurora.org \
/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