From: Simon Glass <sjg@chromium.org>
To: U-Boot Mailing List <u-boot@lists.denx.de>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>,
Tom Rini <trini@konsulko.com>, Anatolij Gustschin <agust@denx.de>,
Simon Glass <sjg@chromium.org>
Subject: [PATCH v4 2/5] video: Move last_sync to private data
Date: Wed, 31 Jul 2024 08:44:09 -0600 [thread overview]
Message-ID: <20240731144412.790317-3-sjg@chromium.org> (raw)
In-Reply-To: <20240731144412.790317-1-sjg@chromium.org>
Rather than using a static variable, use the video device's private
data to remember when the last video sync was completed. This allows
each display to have its own sync and avoids using static data in SPL.
Signed-off-by: Simon Glass <sjg@chromium.org>
---
(no changes since v1)
drivers/video/video-uclass.c | 10 +++-------
include/video.h | 2 ++
2 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c
index ff1382f4a43..a95b5f199dc 100644
--- a/drivers/video/video-uclass.c
+++ b/drivers/video/video-uclass.c
@@ -349,6 +349,7 @@ void video_set_default_colors(struct udevice *dev, bool invert)
/* Flush video activity to the caches */
int video_sync(struct udevice *vid, bool force)
{
+ struct video_priv *priv = dev_get_uclass_priv(vid);
struct video_ops *ops = video_get_ops(vid);
int ret;
@@ -364,20 +365,15 @@ int video_sync(struct udevice *vid, bool force)
* out whether it exists? For now, ARM is safe.
*/
#if defined(CONFIG_ARM) && !CONFIG_IS_ENABLED(SYS_DCACHE_OFF)
- struct video_priv *priv = dev_get_uclass_priv(vid);
-
if (priv->flush_dcache) {
flush_dcache_range((ulong)priv->fb,
ALIGN((ulong)priv->fb + priv->fb_size,
CONFIG_SYS_CACHELINE_SIZE));
}
#elif defined(CONFIG_VIDEO_SANDBOX_SDL)
- struct video_priv *priv = dev_get_uclass_priv(vid);
- static ulong last_sync;
-
- if (force || get_timer(last_sync) > 100) {
+ if (force || get_timer(priv->last_sync) > 100) {
sandbox_sdl_sync(priv->fb);
- last_sync = get_timer(0);
+ priv->last_sync = get_timer(0);
}
#endif
return 0;
diff --git a/include/video.h b/include/video.h
index 4d8df9baaad..4013a949983 100644
--- a/include/video.h
+++ b/include/video.h
@@ -97,6 +97,7 @@ enum video_format {
* the LCD is updated
* @fg_col_idx: Foreground color code (bit 3 = bold, bit 0-2 = color)
* @bg_col_idx: Background color code (bit 3 = bold, bit 0-2 = color)
+ * @last_sync: Monotonic time of last video sync
*/
struct video_priv {
/* Things set up by the driver: */
@@ -121,6 +122,7 @@ struct video_priv {
bool flush_dcache;
u8 fg_col_idx;
u8 bg_col_idx;
+ ulong last_sync;
};
/**
--
2.34.1
next prev parent reply other threads:[~2024-07-31 14:44 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-31 14:44 [PATCH v4 0/5] video: Improve syncing performance with cyclic Simon Glass
2024-07-31 14:44 ` [PATCH v4 1/5] cyclic: Add a symbol for SPL Simon Glass
2024-07-31 14:44 ` Simon Glass [this message]
2024-07-31 14:44 ` [PATCH v4 3/5] video: Use cyclic to handle video sync Simon Glass
2024-07-31 14:44 ` [PATCH v4 4/5] sandbox: Increase cyclic CPU-time limit Simon Glass
2024-07-31 14:44 ` [PATCH v4 5/5] sandbox: Drop video-sync in serial driver Simon Glass
2024-07-31 18:52 ` [PATCH v4 0/5] video: Improve syncing performance with cyclic Anatolij Gustschin
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=20240731144412.790317-3-sjg@chromium.org \
--to=sjg@chromium.org \
--cc=agust@denx.de \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
--cc=xypron.glpk@gmx.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