From: "Michel Dänzer" <michel-otUistvHUpPR7s880joybQ@public.gmane.org>
To: "Grodzovsky,
Andrey" <Andrey.Grodzovsky-5C7GfCeVMHo@public.gmane.org>,
Laurent Pinchart
<laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
Cc: "nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org"
<nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>,
dc_upstream <dc_upstream-5C7GfCeVMHo@public.gmane.org>,
"dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org"
<dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>,
"amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org"
<amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>,
"daniel.vetter-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org"
<daniel.vetter-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Subject: Re: [PATCH 3/4] drm/amd/display: Switch to using atomic_helper for flip.
Date: Thu, 19 Jan 2017 11:14:12 +0900 [thread overview]
Message-ID: <0ea84f93-df8a-906b-94e5-dc2dff9364e2@daenzer.net> (raw)
In-Reply-To: <DM5PR12MB1147CFCD90203061E0F2EB95EA7F0-2J9CzHegvk9IwjGPM8RDJwdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
On 19/01/17 07:18 AM, Grodzovsky, Andrey wrote:
>> From: Michel Dänzer [mailto:michel@daenzer.net]
>> On 17/01/17 07:16 AM, Laurent Pinchart wrote:
>>> On Monday 16 Jan 2017 10:44:57 Andrey Grodzovsky wrote:
>>>> Change-Id: Iad3e0b9b3546e4e4dc79be9233daf4fe4dba83e0
>>>> Signed-off-by: Andrey Grodzovsky <Andrey.Grodzovsky@amd.com>
>>>> ---
>>>> .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.c | 92 ++---------
>> -------
>>>> 1 file changed, 6 insertions(+), 86 deletions(-)
>>>>
>>>> diff --git
>> a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c
>>>> b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c
>> index
>>>> a443b70..d4664bf 100644
>>>> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c
>>>> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c
>>>> @@ -1060,83 +1060,6 @@ static int dm_crtc_funcs_atomic_set_property(
>>>> return 0;
>>>> }
>>>>
>>>> -
>>>> -static int amdgpu_atomic_helper_page_flip(struct drm_crtc *crtc,
>>>> - struct drm_framebuffer *fb,
>>>> - struct drm_pending_vblank_event *event,
>>>> - uint32_t flags)
>>>> -{
>>>> - struct drm_plane *plane = crtc->primary;
>>>> - struct amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc);
>>>> - struct drm_atomic_state *state;
>>>> - struct drm_plane_state *plane_state;
>>>> - struct drm_crtc_state *crtc_state;
>>>> - int ret = 0;
>>>> -
>>>> - state = drm_atomic_state_alloc(plane->dev);
>>>> - if (!state)
>>>> - return -ENOMEM;
>>>> -
>>>> - ret = drm_crtc_vblank_get(crtc);
>>>
>>> The DRM core's atomic page flip helper doesn't get/put vblank. Have
>>> you double-checked that removing them isn't a problem ?
>>
>> This patch makes the amdgpu DM code use the page_flip_target hook.
>> drm_mode_page_flip_ioctl calls drm_crtc_vblank_get before the
>> page_flip_target hook.
>>
>> You're right though that the fact that drm_atomic_helper_page_flip doesn't
>> call drm_crtc_vblank_get is a bit alarming. From the
>> DRM_IOCTL_MODE_PAGE_FLIP POV, drm_crtc_vblank_get must be called
>> when userspace calls the ioctl (either by drm_mode_page_flip_ioctl or the
>> page_flip hook implementation), and drm_crtc_vblank_put must be called
>> when the flip completes and the event is sent to userspace. How is this
>> supposed to be handled with atomic?
>
> First let me ask you - why we have to enable vlbank as part of pflip,
> I understand why it has to be enbbled in WAIT_FOR_VBLANK IOCTL
> but not sure about PFLIP IOCTL.
It's required for the vblank sequence counter to be accurate in the page
flip completion event sent to userspace.
> IMHO in atomic as before in legacy page_flip, it's up to the driver
> implementation in atomic_commit hook to manage vblank ISR on,off.
When using the page_flip hook, it's all up to the implementation of that
hook. When using the page_flip_target hook, drm_mode_page_flip_ioctl
calls vblank_get, so the hook implementation must make sure that a
matching vblank_put call is made when the flip completes.
>> Andrey, did you check via code audit and/or testing that the vblank
>> reference count is still balanced after this change?
>>
> With the page_flip_target yes, if I switch back to page_flip hook then
> vblank ISR never gets enabled on FLIP IPCTL and then I see warning in DAL's
> pflip done IRQ handler from vblank_put which is obvious,
For drivers using the atomic_helpers for flip, maybe there should be (or
might be already) a corresponding helper which deals with things like
this when the flip completes, so drivers don't have to call vblank_put
and such.
Anyway, it sounds like the vblank_get/puts are balanced with this patch
for now.
> which BTW didn't impact the flips, I still was able to run glxgears
> in vsync mode.
I don't think glxgears relies on the vblank sequence numbers being accurate.
--
Earthling Michel Dänzer | http://www.amd.com
Libre software enthusiast | Mesa and X developer
_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau
next prev parent reply other threads:[~2017-01-19 2:14 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-16 15:44 [PATCH 0/4] Allow ASYNC flip with atomic helpers Andrey Grodzovsky
2017-01-16 15:44 ` [PATCH 1/4] drm/atomic: Save flip flags in drm_plane_state Andrey Grodzovsky
2017-01-16 22:18 ` Laurent Pinchart
2017-01-17 4:03 ` Grodzovsky, Andrey
[not found] ` <DM5PR12MB1147FF9E484370F1572CB9C3EA7C0-2J9CzHegvk9IwjGPM8RDJwdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2017-01-17 9:03 ` Laurent Pinchart
2017-01-17 8:14 ` Ville Syrjälä
[not found] ` <1484581498-32309-2-git-send-email-Andrey.Grodzovsky-5C7GfCeVMHo@public.gmane.org>
2017-01-16 20:21 ` Gustavo Padovan
2017-01-16 20:53 ` Grodzovsky, Andrey
2017-01-23 8:54 ` Daniel Vetter
2017-01-23 19:48 ` Cheng, Tony
[not found] ` <MWHPR12MB14066404FBCEF3C03EF24BF998720-Gy0DoCVfaSXS1+HfpYZxvgdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2017-01-26 5:01 ` Grodzovsky, Andrey
[not found] ` <DM5PR12MB1147AEF3F8CFFAD4B69E114EEA770-2J9CzHegvk9IwjGPM8RDJwdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2017-01-26 9:40 ` Daniel Vetter
2017-01-26 9:39 ` Daniel Vetter
[not found] ` <1484581498-32309-1-git-send-email-Andrey.Grodzovsky-5C7GfCeVMHo@public.gmane.org>
2017-01-16 15:44 ` [PATCH 2/4] drm/amdgpu: Remove flip_flag from amdgpu_crtc Andrey Grodzovsky
2017-01-16 22:15 ` Laurent Pinchart
2017-01-16 15:44 ` [PATCH 3/4] drm/amd/display: Switch to using atomic_helper for flip Andrey Grodzovsky
2017-01-16 22:16 ` Laurent Pinchart
2017-01-18 1:50 ` Michel Dänzer
2017-01-18 12:02 ` Laurent Pinchart
2017-01-18 22:18 ` Grodzovsky, Andrey
[not found] ` <DM5PR12MB1147CFCD90203061E0F2EB95EA7F0-2J9CzHegvk9IwjGPM8RDJwdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2017-01-19 2:14 ` Michel Dänzer [this message]
2017-01-19 4:57 ` [PATCH v3 2/3] " Andrey Grodzovsky
2017-01-16 15:44 ` [PATCH 4/4] drm/nouveau/kms/nv50: Switch to using atomic helper " Andrey Grodzovsky
2017-01-16 20:39 ` [PATCH 0/4] Allow ASYNC flip with atomic helpers Laurent Pinchart
2017-01-16 21:13 ` Harry Wentland
2017-01-16 22:14 ` Laurent Pinchart
2017-01-23 8:53 ` Daniel Vetter
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=0ea84f93-df8a-906b-94e5-dc2dff9364e2@daenzer.net \
--to=michel-otuistvhuppr7s880joybq@public.gmane.org \
--cc=Andrey.Grodzovsky-5C7GfCeVMHo@public.gmane.org \
--cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
--cc=daniel.vetter-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=dc_upstream-5C7GfCeVMHo@public.gmane.org \
--cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
--cc=laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org \
--cc=nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.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