From: Rob Clark <robdclark@gmail.com>
To: dri-devel@lists.freedesktop.org
Cc: Rob Clark <robdclark@chromium.org>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>,
linux-kernel@vger.kernel.org (open list)
Subject: [PATCH 1/2] drm: Fix dirtyfb stalls
Date: Sat, 8 May 2021 12:56:38 -0700 [thread overview]
Message-ID: <20210508195641.397198-2-robdclark@gmail.com> (raw)
In-Reply-To: <20210508195641.397198-1-robdclark@gmail.com>
From: Rob Clark <robdclark@chromium.org>
drm_atomic_helper_dirtyfb() will end up stalling for vblank on "video
mode" type displays, which is pointless and unnecessary. Add an
optional helper vfunc to determine if a plane is attached to a CRTC
that actually needs dirtyfb, and skip over them.
Signed-off-by: Rob Clark <robdclark@chromium.org>
---
drivers/gpu/drm/drm_damage_helper.c | 8 ++++++++
include/drm/drm_modeset_helper_vtables.h | 14 ++++++++++++++
2 files changed, 22 insertions(+)
diff --git a/drivers/gpu/drm/drm_damage_helper.c b/drivers/gpu/drm/drm_damage_helper.c
index 3a4126dc2520..a0bed1a2c2dc 100644
--- a/drivers/gpu/drm/drm_damage_helper.c
+++ b/drivers/gpu/drm/drm_damage_helper.c
@@ -211,6 +211,7 @@ int drm_atomic_helper_dirtyfb(struct drm_framebuffer *fb,
retry:
drm_for_each_plane(plane, fb->dev) {
struct drm_plane_state *plane_state;
+ struct drm_crtc *crtc;
ret = drm_modeset_lock(&plane->mutex, state->acquire_ctx);
if (ret)
@@ -221,6 +222,13 @@ int drm_atomic_helper_dirtyfb(struct drm_framebuffer *fb,
continue;
}
+ crtc = plane->state->crtc;
+ if (crtc->helper_private->needs_dirtyfb &&
+ !crtc->helper_private->needs_dirtyfb(crtc)) {
+ drm_modeset_unlock(&plane->mutex);
+ continue;
+ }
+
plane_state = drm_atomic_get_plane_state(state, plane);
if (IS_ERR(plane_state)) {
ret = PTR_ERR(plane_state);
diff --git a/include/drm/drm_modeset_helper_vtables.h b/include/drm/drm_modeset_helper_vtables.h
index eb706342861d..afa8ec5754e7 100644
--- a/include/drm/drm_modeset_helper_vtables.h
+++ b/include/drm/drm_modeset_helper_vtables.h
@@ -487,6 +487,20 @@ struct drm_crtc_helper_funcs {
bool in_vblank_irq, int *vpos, int *hpos,
ktime_t *stime, ktime_t *etime,
const struct drm_display_mode *mode);
+
+ /**
+ * @needs_dirtyfb
+ *
+ * Optional callback used by damage helpers to determine if fb_damage_clips
+ * update is needed.
+ *
+ * Returns:
+ *
+ * True if fb_damage_clips update is needed to handle DIRTYFB, False
+ * otherwise. If this callback is not implemented, then True is
+ * assumed.
+ */
+ bool (*needs_dirtyfb)(struct drm_crtc *crtc);
};
/**
--
2.30.2
next prev parent reply other threads:[~2021-05-08 19:53 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-08 19:56 [PATCH 0/2] drm: Fix atomic helper dirtyfb stalls Rob Clark
2021-05-08 19:56 ` Rob Clark [this message]
2021-05-10 16:14 ` [PATCH 1/2] drm: Fix " Daniel Vetter
2021-05-10 16:16 ` Daniel Vetter
2021-05-10 16:55 ` Rob Clark
2021-05-10 17:43 ` Daniel Vetter
2021-05-10 19:06 ` Rob Clark
2021-05-11 16:44 ` Daniel Vetter
2021-05-11 17:19 ` Rob Clark
2021-05-11 17:21 ` Daniel Vetter
2021-05-11 17:42 ` Rob Clark
2021-05-11 17:50 ` Daniel Vetter
2021-05-12 8:23 ` Pekka Paalanen
2021-05-12 8:44 ` Daniel Vetter
2021-05-12 9:46 ` Pekka Paalanen
2021-05-12 10:35 ` Daniel Vetter
2021-05-12 14:57 ` Rob Clark
2021-05-14 7:54 ` Pekka Paalanen
2021-05-14 14:43 ` Rob Clark
2021-05-08 19:56 ` [PATCH 2/2] drm/msm/dpu: Wire up needs_dirtyfb Rob Clark
2021-05-09 15:38 ` Tested houdek.ryan
2021-05-10 15:26 ` Tested Alex Deucher
2021-05-09 16:28 ` [PATCH 2/2] drm/msm/dpu: Wire up needs_dirtyfb Rob Clark
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=20210508195641.397198-2-robdclark@gmail.com \
--to=robdclark@gmail.com \
--cc=airlied@linux.ie \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=robdclark@chromium.org \
--cc=tzimmermann@suse.de \
/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;
as well as URLs for NNTP newsgroup(s).