From: Boris Brezillon <boris.brezillon@bootlin.com>
To: Eric Anholt <eric@anholt.net>
Cc: Boris Brezillon <boris.brezillon@bootlin.com>,
dri-devel@lists.freedesktop.org
Subject: [PATCH 3/6] drm/vc4: Don't check plane state more than once
Date: Thu, 15 Nov 2018 11:37:18 +0100 [thread overview]
Message-ID: <20181115103721.25601-4-boris.brezillon@bootlin.com> (raw)
In-Reply-To: <20181115103721.25601-1-boris.brezillon@bootlin.com>
We are about to use vc4_plane_mode_set() in the async check path, but
async check can decide that async update is not possible and force the
driver to fallback to a sync update.
All the checks that have been done on the plane state during async check
stay valid, and checking it again is not necessary. Add a ->checked
field to vc4_plane_state, and use it to track the status of the state
(checked or not).
Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
---
drivers/gpu/drm/vc4/vc4_drv.h | 5 +++++
drivers/gpu/drm/vc4/vc4_plane.c | 10 ++++++++++
2 files changed, 15 insertions(+)
diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h
index 9ed05fb61eb6..d1000c4805c2 100644
--- a/drivers/gpu/drm/vc4/vc4_drv.h
+++ b/drivers/gpu/drm/vc4/vc4_drv.h
@@ -370,6 +370,11 @@ struct vc4_plane_state {
* to enable background color fill.
*/
bool needs_bg_fill;
+
+ /* Mark the state as checked. Useful to avoid checking it twice when
+ * async update is not possible.
+ */
+ bool checked;
};
static inline struct vc4_plane_state *
diff --git a/drivers/gpu/drm/vc4/vc4_plane.c b/drivers/gpu/drm/vc4/vc4_plane.c
index 392a51f2bf8f..09c7478b095b 100644
--- a/drivers/gpu/drm/vc4/vc4_plane.c
+++ b/drivers/gpu/drm/vc4/vc4_plane.c
@@ -154,6 +154,7 @@ static struct drm_plane_state *vc4_plane_duplicate_state(struct drm_plane *plane
return NULL;
memset(&vc4_state->lbm, 0, sizeof(vc4_state->lbm));
+ vc4_state->checked = 0;
__drm_atomic_helper_plane_duplicate_state(plane, &vc4_state->base);
@@ -510,6 +511,8 @@ static int vc4_plane_mode_set(struct drm_plane *plane,
u32 hvs_format = format->hvs;
int ret, i;
+ if (vc4_state->checked)
+ return 0;
ret = vc4_plane_setup_clipping_and_scaling(state);
if (ret)
@@ -792,6 +795,13 @@ static int vc4_plane_mode_set(struct drm_plane *plane,
vc4_state->needs_bg_fill = fb->format->has_alpha || !covers_screen ||
state->alpha != DRM_BLEND_ALPHA_OPAQUE;
+ /* Flag the state as already checked to avoid checking it twice in case
+ * the async update check already called vc4_plane_mode_set() and
+ * decided to fallback to sync update because async update was not
+ * possible.
+ */
+ vc4_state->checked = 1;
+
return 0;
}
--
2.17.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2018-11-15 10:37 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-15 10:37 [PATCH 0/6] drm/vc4: Allow scaling on cursor planes Boris Brezillon
2018-11-15 10:37 ` [PATCH 1/6] drm/vc4: Make vc4_lbm_size() return 0 when vertical scaling is disabled Boris Brezillon
2018-11-15 20:39 ` Eric Anholt
2018-11-15 10:37 ` [PATCH 2/6] drm/vc4: Move LBM creation out of vc4_plane_mode_set() Boris Brezillon
2018-11-15 20:39 ` Eric Anholt
2018-11-15 21:10 ` Boris Brezillon
2018-11-20 4:41 ` Eric Anholt
2018-11-15 10:37 ` Boris Brezillon [this message]
2018-11-15 20:41 ` [PATCH 3/6] drm/vc4: Don't check plane state more than once Eric Anholt
2018-11-15 21:12 ` Boris Brezillon
2018-11-20 4:38 ` Eric Anholt
2018-11-15 10:37 ` [PATCH 4/6] drm/vc4: Rework the async update logic Boris Brezillon
2018-11-15 20:49 ` Eric Anholt
2018-11-15 21:21 ` Boris Brezillon
2018-11-20 4:44 ` Eric Anholt
2018-11-15 10:37 ` [PATCH 5/6] drm/vc4: Allow scaling on cursor plane Boris Brezillon
2018-11-15 20:50 ` Eric Anholt
2018-11-15 10:37 ` [PATCH 6/6] drm/vc4: Allow YUV formats on cursor planes Boris Brezillon
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=20181115103721.25601-4-boris.brezillon@bootlin.com \
--to=boris.brezillon@bootlin.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=eric@anholt.net \
/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