summaryrefslogtreecommitdiff
path: root/include/video_console.h
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2020-07-03 06:12:23 +0300
committerBin Meng <bmeng.cn@gmail.com>2020-07-09 07:33:24 +0300
commit8c0b5d268d36b0d152bad343503e74056617ab43 (patch)
treeb903c03928c2edd7f57c320f33b5dc25993236ef /include/video_console.h
parent138dfea86ff2b7eda936043b2acc734a1425aeaa (diff)
downloadu-boot-8c0b5d268d36b0d152bad343503e74056617ab43.tar.xz
video: Add helpers for vidconsole for the copy framebuffer
Add a convenience function to call video_sync_copy() for a vidconsole. Also add a memmove() helper, which does the memmove() as well as the sync. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Anatolij Gustschin <agust@denx.de> Tested-by: Bin Meng <bmeng.cn@gmail.com>
Diffstat (limited to 'include/video_console.h')
-rw-r--r--include/video_console.h49
1 files changed, 49 insertions, 0 deletions
diff --git a/include/video_console.h b/include/video_console.h
index d3bc063165..06b798ef10 100644
--- a/include/video_console.h
+++ b/include/video_console.h
@@ -256,4 +256,53 @@ void vidconsole_position_cursor(struct udevice *dev, unsigned col,
*/
u32 vid_console_color(struct video_priv *priv, unsigned int idx);
+#ifdef CONFIG_VIDEO_COPY
+/**
+ * vidconsole_sync_copy() - Sync back to the copy framebuffer
+ *
+ * This ensures that the copy framebuffer has the same data as the framebuffer
+ * for a particular region. It should be called after the framebuffer is updated
+ *
+ * @from and @to can be in either order. The region between them is synced.
+ *
+ * @dev: Vidconsole device being updated
+ * @from: Start/end address within the framebuffer (->fb)
+ * @to: Other address within the frame buffer
+ * @return 0 if OK, -EFAULT if the start address is before the start of the
+ * frame buffer start
+ */
+int vidconsole_sync_copy(struct udevice *dev, void *from, void *to);
+
+/**
+ * vidconsole_memmove() - Perform a memmove() within the frame buffer
+ *
+ * This handles a memmove(), e.g. for scrolling. It also updates the copy
+ * framebuffer.
+ *
+ * @dev: Vidconsole device being updated
+ * @dst: Destination address within the framebuffer (->fb)
+ * @src: Source address within the framebuffer (->fb)
+ * @size: Number of bytes to transfer
+ * @return 0 if OK, -EFAULT if the start address is before the start of the
+ * frame buffer start
+ */
+int vidconsole_memmove(struct udevice *dev, void *dst, const void *src,
+ int size);
+#else
+static inline int vidconsole_sync_copy(struct udevice *dev, void *from,
+ void *to)
+{
+ return 0;
+}
+
+static inline int vidconsole_memmove(struct udevice *dev, void *dst,
+ const void *src, int size)
+{
+ memmove(dst, src, size);
+
+ return 0;
+}
+
+#endif
+
#endif