From: Yunxiang Li <Yunxiang.Li@amd.com>
To: <dri-devel@lists.freedesktop.org>
Cc: Yunxiang Li <Yunxiang.Li@amd.com>
Subject: [PATCH 1/2] drm: Fix vblank refcount during modeset
Date: Fri, 22 Jul 2022 17:52:33 -0400 [thread overview]
Message-ID: <20220722215234.129793-1-Yunxiang.Li@amd.com> (raw)
drm_crtc_vblank_off increments the refcount to prevent vblank from
getting enabled during modeset, but this causes the refcount elsewhere
to be off if they call drm_vblank_get without checking the return and
do a drm_vblank_put later. This can be reproduced by toggling vrr mode
on amdgpu.
Since drm_crtc_vblank_on later re-enables vblank if the refcount is not
zero, letting drm_vblank_get succeed during modeset should fix the behavior.
Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/1380
Signed-off-by: Yunxiang Li <Yunxiang.Li@amd.com>
---
drivers/gpu/drm/drm_vblank.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
index 2ff31717a3de..159d13b5d97b 100644
--- a/drivers/gpu/drm/drm_vblank.c
+++ b/drivers/gpu/drm/drm_vblank.c
@@ -1174,7 +1174,7 @@ int drm_vblank_get(struct drm_device *dev, unsigned int pipe)
if (atomic_add_return(1, &vblank->refcount) == 1) {
ret = drm_vblank_enable(dev, pipe);
} else {
- if (!vblank->enabled) {
+ if (!vblank->enabled && !vblank->inmodeset) {
atomic_dec(&vblank->refcount);
ret = -EINVAL;
}
--
2.37.1
next reply other threads:[~2022-07-22 21:52 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-22 21:52 Yunxiang Li [this message]
2022-07-22 21:52 ` [PATCH 2/2] drm: get lock before accessing vblank refcount Yunxiang Li
2022-09-06 19:20 ` Daniel Vetter
2022-09-06 20:18 ` Li, Yunxiang (Teddy)
2022-09-06 21:58 ` Daniel Vetter
2022-08-02 14:51 ` [PATCH 1/2] drm: Fix vblank refcount during modeset Li, Yunxiang (Teddy)
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=20220722215234.129793-1-Yunxiang.Li@amd.com \
--to=yunxiang.li@amd.com \
--cc=dri-devel@lists.freedesktop.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.