summaryrefslogtreecommitdiff
path: root/drivers/video
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2021-11-19 13:23:50 -0700
committerAnatolij Gustschin <agust@denx.de>2021-12-26 23:02:19 +0100
commit8657ad43f353386be5fb6a517650322e804c98b4 (patch)
tree3623a28f6fb32df01a51060e2baa3d77da6a8d17 /drivers/video
parent84051743917e5a34936bc47923838fd5eda24f43 (diff)
sandbox: video: Add BMP tests for 32bpp and 8bpp modes
Add a few more tests for BMP rendering. Use a back door into the sandbox SDL driver to adjust the resolution at runtime. The truetype code does not support 8bpp. Add this so that the display is not blank when running in this mode. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/console_truetype.c21
-rw-r--r--drivers/video/sandbox_sdl.c19
2 files changed, 39 insertions, 1 deletions
diff --git a/drivers/video/console_truetype.c b/drivers/video/console_truetype.c
index 98427f4c618..de8b86bbacc 100644
--- a/drivers/video/console_truetype.c
+++ b/drivers/video/console_truetype.c
@@ -274,6 +274,27 @@ static int console_truetype_putc_xy(struct udevice *dev, uint x, uint y,
*/
for (row = 0; row < height; row++) {
switch (vid_priv->bpix) {
+ case VIDEO_BPP8:
+ if (IS_ENABLED(CONFIG_VIDEO_BPP8)) {
+ u8 *dst = line + xoff;
+ int i;
+
+ for (i = 0; i < width; i++) {
+ int val = *bits;
+ int out;
+
+ if (vid_priv->colour_bg)
+ val = 255 - val;
+ out = val;
+ if (vid_priv->colour_fg)
+ *dst++ |= out;
+ else
+ *dst++ &= out;
+ bits++;
+ }
+ end = dst;
+ }
+ break;
#ifdef CONFIG_VIDEO_BPP16
case VIDEO_BPP16: {
uint16_t *dst = (uint16_t *)line + xoff;
diff --git a/drivers/video/sandbox_sdl.c b/drivers/video/sandbox_sdl.c
index eb321ad17f5..2afe66fab1a 100644
--- a/drivers/video/sandbox_sdl.c
+++ b/drivers/video/sandbox_sdl.c
@@ -12,6 +12,7 @@
#include <asm/sdl.h>
#include <asm/state.h>
#include <asm/u-boot-sandbox.h>
+#include <dm/device-internal.h>
#include <dm/test.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -79,6 +80,23 @@ static void set_bpp(struct udevice *dev, enum video_log2_bpp l2bpp)
uc_plat->size *= 2;
}
+int sandbox_sdl_set_bpp(struct udevice *dev, enum video_log2_bpp l2bpp)
+{
+ int ret;
+
+ if (device_active(dev))
+ return -EINVAL;
+ sandbox_sdl_remove_display();
+
+ set_bpp(dev, l2bpp);
+
+ ret = device_probe(dev);
+ if (ret)
+ return ret;
+
+ return 0;
+}
+
static int sandbox_sdl_remove(struct udevice *dev)
{
/*
@@ -89,7 +107,6 @@ static int sandbox_sdl_remove(struct udevice *dev)
*
* sandbox_sdl_remove_display();
*/
-
return 0;
}