From: Keith Packard <keithp@keithp.com>
To: Daniel Vetter <daniel@ffwll.ch>
Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org
Cc: airlied@linux.ie, keithp@keithp.com
Subject: Re: [PATCH] drm: Don't prepare or cleanup unchanging frame buffers [v2]
Date: Sat, 06 Aug 2016 22:26:09 -0700 [thread overview]
Message-ID: <86a8gpkv4e.fsf@hiro.keithp.com> (raw)
In-Reply-To: <20160802135417.GO6232@phenom.ffwll.local>
[-- Attachment #1.1: Type: text/plain, Size: 680 bytes --]
Daniel Vetter <daniel@ffwll.ch> writes:
> Hm, I can't see v1 anywhere, but I think it'd be better. You can't store
> any transient state related to the current update in struct drm_plane. In
> this case the cleanup_buffers from a previous update might overlap (for
> nonblocking atomic commits) with the prepare_planes for the next one.
> Either we need special cleanup vs. error-path code, or some flag somewhere
> in the drm_plane_state.
Ok, here's pretty much the previous version, which works now that I've
fixed the intel driver. Instead of just comparing the fb's, I'm using
the framebuffer_changed function, which seems like a nice bit of
documentation if nothing else.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-drm-Don-t-prepare-or-cleanup-unchanging-frame-buffer.patch --]
[-- Type: text/x-diff, Size: 3024 bytes --]
From a75251d5762b1c200ed2f3dca2a5b00cc85bea95 Mon Sep 17 00:00:00 2001
From: Keith Packard <keithp@keithp.com>
Date: Sat, 4 Jun 2016 01:16:22 -0700
Subject: [PATCH] drm: Don't prepare or cleanup unchanging frame buffers [v3]
When reconfiguring a plane position (as in moving the cursor), the
frame buffer for the cursor isn't changing, so don't call the prepare
or cleanup driver functions.
This avoids making cursor position updates block on all pending rendering.
v3: use drm_atomic_helper_framebuffer_changed in both prepare and
cleanup phases instead of keeping state in the plane.
cc: dri-devel@lists.freedesktop.org
cc: David Airlie <airlied@linux.ie>
cc: Daniel Vetter <daniel@ffwll.ch>
Signed-off-by: Keith Packard <keithp@keithp.com>
---
drivers/gpu/drm/drm_atomic_helper.c | 25 +++++++++++++++----------
1 file changed, 15 insertions(+), 10 deletions(-)
diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
index ddfa0d1..72e50bc 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -1246,18 +1246,19 @@ EXPORT_SYMBOL(drm_atomic_helper_commit);
* Returns:
* 0 on success, negative error code on failure.
*/
+
int drm_atomic_helper_prepare_planes(struct drm_device *dev,
struct drm_atomic_state *state)
{
- int nplanes = dev->mode_config.num_total_plane;
+ struct drm_plane *plane;
+ struct drm_plane_state *plane_state;
int ret, i;
+ int max_prepared_i = 0;
- for (i = 0; i < nplanes; i++) {
+ for_each_plane_in_state(state, plane, plane_state, i) {
const struct drm_plane_helper_funcs *funcs;
- struct drm_plane *plane = state->planes[i];
- struct drm_plane_state *plane_state = state->plane_states[i];
- if (!plane)
+ if (!drm_atomic_helper_framebuffer_changed(dev, state, plane_state->crtc))
continue;
funcs = plane->helper_private;
@@ -1267,24 +1268,25 @@ int drm_atomic_helper_prepare_planes(struct drm_device *dev,
if (ret)
goto fail;
}
+ max_prepared_i = i;
}
return 0;
fail:
- for (i--; i >= 0; i--) {
+ for_each_plane_in_state(state, plane, plane_state, i) {
const struct drm_plane_helper_funcs *funcs;
- struct drm_plane *plane = state->planes[i];
- struct drm_plane_state *plane_state = state->plane_states[i];
- if (!plane)
+ if (i > max_prepared_i)
+ break;
+
+ if (!drm_atomic_helper_framebuffer_changed(dev, state, plane_state->crtc))
continue;
funcs = plane->helper_private;
if (funcs->cleanup_fb)
funcs->cleanup_fb(plane, plane_state);
-
}
return ret;
@@ -1527,6 +1529,9 @@ void drm_atomic_helper_cleanup_planes(struct drm_device *dev,
for_each_plane_in_state(old_state, plane, plane_state, i) {
const struct drm_plane_helper_funcs *funcs;
+ if (!drm_atomic_helper_framebuffer_changed(dev, old_state, plane_state->crtc))
+ continue;
+
funcs = plane->helper_private;
if (funcs->cleanup_fb)
--
2.8.1
[-- Attachment #1.3: Type: text/plain, Size: 15 bytes --]
--
-keith
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 810 bytes --]
next prev parent reply other threads:[~2016-08-07 5:26 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-31 8:08 [PATCH] drm: Don't prepare or cleanup unchanging frame buffers [v2] Keith Packard
2016-07-31 9:20 ` kbuild test robot
2016-08-02 13:54 ` Daniel Vetter
2016-08-07 5:26 ` Keith Packard [this message]
2016-08-08 9:00 ` Daniel Vetter
2016-08-08 15:17 ` Keith Packard
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=86a8gpkv4e.fsf@hiro.keithp.com \
--to=keithp@keithp.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).