@@ -99,6 +99,17 @@ int sandbox_sdl_set_bpp(struct udevice *dev, enum video_log2_bpp l2bpp)
return 0;
}
+static int sandbox_sdl_video_sync(struct udevice *dev)
+{
+ struct video_priv *priv = dev_get_uclass_priv(dev);
+ void *fb = priv->fb;
+
+ if (IS_ENABLED(CONFIG_VIDEO_COPY))
+ fb = priv->copy_fb;
+
+ return sandbox_sdl_sync(fb);
+}
+
static int sandbox_sdl_remove(struct udevice *dev)
{
/*
@@ -133,6 +144,10 @@ static const struct udevice_id sandbox_sdl_ids[] = {
{ }
};
+static struct video_ops sandbox_sdl_ops = {
+ .video_sync = sandbox_sdl_video_sync,
+};
+
U_BOOT_DRIVER(sandbox_lcd_sdl) = {
.name = "sandbox_lcd_sdl",
.id = UCLASS_VIDEO,
@@ -141,4 +156,5 @@ U_BOOT_DRIVER(sandbox_lcd_sdl) = {
.probe = sandbox_sdl_probe,
.remove = sandbox_sdl_remove,
.plat_auto = sizeof(struct sandbox_sdl_plat),
+ .ops = &sandbox_sdl_ops,
};
@@ -23,9 +23,6 @@
#include <dm/device_compat.h>
#include <dm/device-internal.h>
#include <dm/uclass-internal.h>
-#ifdef CONFIG_SANDBOX
-#include <asm/sdl.h>
-#endif
/*
* Theory of operation:
@@ -454,17 +451,6 @@ int video_sync(struct udevice *vid, bool force)
video_flush_dcache(vid);
-#if defined(CONFIG_VIDEO_SANDBOX_SDL)
- void *fb = priv->fb;
-
- if (IS_ENABLED(CONFIG_VIDEO_COPY))
- fb = priv->copy_fb;
-
- ret = sandbox_sdl_sync(fb);
- while (force && ret == -EAGAIN)
- ret = sandbox_sdl_sync(fb);
-#endif
-
if (IS_ENABLED(CONFIG_VIDEO_DAMAGE)) {
priv->damage.xstart = priv->xsize;
priv->damage.ystart = priv->ysize;
@@ -756,7 +756,7 @@ static int dm_test_video_damage(struct unit_test_state *uts)
ut_asserteq(1280, priv->damage.xend);
ut_asserteq(510, priv->damage.yend);
- video_sync(dev, false);
+ video_sync(dev, true);
ut_asserteq(priv->xsize, priv->damage.xstart);
ut_asserteq(priv->ysize, priv->damage.ystart);
ut_asserteq(0, priv->damage.xend);
The sandbox SDL video sync is handled in the uclass because there has been a sync rate limiter and a way to bypass that. Previous patches move the rate limit code into SDL-specific files, and provide a generic way to defer and force video syncs. Sandbox code shouldn't be in the uclasses if possible. Move the remaining sandbox sync call into the driver ops. Now that sandbox video sync attempts can defer without resetting video damage, force a video sync before checking that video syncs reset video damage. Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com> --- drivers/video/sandbox_sdl.c | 16 ++++++++++++++++ drivers/video/video-uclass.c | 14 -------------- test/dm/video.c | 2 +- 3 files changed, 17 insertions(+), 15 deletions(-)