-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SVG logo #266
Merged
Merged
SVG logo #266
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
c6a03e5
openvario-logo: the OpenVario logo as SVG file
c4a60fc
openvario-logo: new recipe, auto-convert the logo from SVG
MaxKellermann 8f56ae6
u-boot: support rendering BMP-RLE to 32 bit displays
MaxKellermann 1f80eba
openvario-logo: enable BMP RLE compression
MaxKellermann File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
160 changes: 160 additions & 0 deletions
160
meta-ov/recipes-bsp/u-boot/files/0001-video_bmp-implement-BMP-RLE-to-32-bit.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,160 @@ | ||
From fdad291b7837db232a9a8d071d8d587d8777a485 Mon Sep 17 00:00:00 2001 | ||
From: Max Kellermann <[email protected]> | ||
Date: Wed, 9 Feb 2022 17:55:27 +0100 | ||
Subject: [PATCH] video_bmp: implement BMP-RLE to 32 bit | ||
|
||
--- | ||
drivers/video/video_bmp.c | 130 ++++++++++++++++++++++++++++++++++++-- | ||
1 file changed, 126 insertions(+), 4 deletions(-) | ||
|
||
diff --git a/drivers/video/video_bmp.c b/drivers/video/video_bmp.c | ||
index 1e6f07ff4b..40141de9c5 100644 | ||
--- a/drivers/video/video_bmp.c | ||
+++ b/drivers/video/video_bmp.c | ||
@@ -19,6 +19,124 @@ | ||
#define BMP_RLE8_EOBMP 1 | ||
#define BMP_RLE8_DELTA 2 | ||
|
||
+static uchar *draw32_cte(uchar *fb, const struct bmp_color_table_entry *cte) | ||
+{ | ||
+ *(fb++) = cte->blue; | ||
+ *(fb++) = cte->green; | ||
+ *(fb++) = cte->red; | ||
+ *(fb++) = 0; | ||
+ return fb; | ||
+} | ||
+ | ||
+static uchar *draw_unencoded_bitmap32(uchar *fb, uchar *bmap, | ||
+ const struct bmp_color_table_entry *palette, | ||
+ int cnt) | ||
+{ | ||
+ while (cnt > 0) { | ||
+ fb = draw32_cte(fb, &palette[*bmap++]); | ||
+ cnt--; | ||
+ } | ||
+ | ||
+ return fb; | ||
+} | ||
+ | ||
+static uchar *draw_encoded_bitmap32(uchar *fb, | ||
+ const struct bmp_color_table_entry *cte, | ||
+ int cnt) | ||
+{ | ||
+ while (cnt > 0) { | ||
+ fb = draw32_cte(fb, cte); | ||
+ cnt--; | ||
+ } | ||
+ | ||
+ return fb; | ||
+} | ||
+ | ||
+static void video_display_rle8_bitmap32(struct udevice *dev, | ||
+ struct bmp_image *bmp, | ||
+ const struct bmp_color_table_entry *palette, | ||
+ uchar *fb, int x_off, int y_off, | ||
+ ulong width, ulong height) | ||
+{ | ||
+ struct video_priv *priv = dev_get_uclass_priv(dev); | ||
+ uchar *bmap; | ||
+ ulong cnt, runlen; | ||
+ int x, y; | ||
+ int decode = 1; | ||
+ | ||
+ debug("%s\n", __func__); | ||
+ bmap = (uchar *)bmp + get_unaligned_le32(&bmp->header.data_offset); | ||
+ | ||
+ x = 0; | ||
+ y = height - 1; | ||
+ | ||
+ while (decode) { | ||
+ if (bmap[0] == BMP_RLE8_ESCAPE) { | ||
+ switch (bmap[1]) { | ||
+ case BMP_RLE8_EOL: | ||
+ /* end of line */ | ||
+ bmap += 2; | ||
+ x = 0; | ||
+ y--; | ||
+ /* 32bpix, 4-byte per pixel, x should *4 */ | ||
+ fb -= (width * 4 + priv->line_length); | ||
+ break; | ||
+ case BMP_RLE8_EOBMP: | ||
+ /* end of bitmap */ | ||
+ decode = 0; | ||
+ break; | ||
+ case BMP_RLE8_DELTA: | ||
+ /* delta run */ | ||
+ x += bmap[2]; | ||
+ y -= bmap[3]; | ||
+ /* 32bpix, 4-byte per pixel, x should *4 */ | ||
+ fb = (uchar *)(priv->fb + (y + y_off - 1) | ||
+ * priv->line_length + (x + x_off) * 4); | ||
+ bmap += 4; | ||
+ break; | ||
+ default: | ||
+ /* unencoded run */ | ||
+ runlen = bmap[1]; | ||
+ bmap += 2; | ||
+ if (y < height) { | ||
+ if (x < width) { | ||
+ if (x + runlen > width) | ||
+ cnt = width - x; | ||
+ else | ||
+ cnt = runlen; | ||
+ fb = draw_unencoded_bitmap32(fb, bmap, palette, cnt); | ||
+ } | ||
+ x += runlen; | ||
+ } | ||
+ bmap += runlen; | ||
+ if (runlen & 1) | ||
+ bmap++; | ||
+ } | ||
+ } else { | ||
+ /* encoded run */ | ||
+ if (y < height) { | ||
+ runlen = bmap[0]; | ||
+ if (x < width) { | ||
+ /* aggregate the same code */ | ||
+ while (bmap[0] == 0xff && | ||
+ bmap[2] != BMP_RLE8_ESCAPE && | ||
+ bmap[1] == bmap[3]) { | ||
+ runlen += bmap[2]; | ||
+ bmap += 2; | ||
+ } | ||
+ if (x + runlen > width) | ||
+ cnt = width - x; | ||
+ else | ||
+ cnt = runlen; | ||
+ fb = draw_encoded_bitmap32(fb, &palette[bmap[1]], cnt); | ||
+ } | ||
+ x += runlen; | ||
+ } | ||
+ bmap += 2; | ||
+ } | ||
+ } | ||
+} | ||
+ | ||
static void draw_unencoded_bitmap(ushort **fbp, uchar *bmap, ushort *cmap, | ||
int cnt) | ||
{ | ||
@@ -277,13 +395,17 @@ int video_bmp_display(struct udevice *dev, ulong bmp_image, int x, int y, | ||
u32 compression = get_unaligned_le32(&bmp->header.compression); | ||
debug("compressed %d %d\n", compression, BMP_BI_RLE8); | ||
if (compression == BMP_BI_RLE8) { | ||
- if (bpix != 16) { | ||
+ if (bpix == 16) { | ||
+ video_display_rle8_bitmap(dev, bmp, cmap_base, fb, x, | ||
+ y, width, height); | ||
+ } else if (bpix == 32) { | ||
+ video_display_rle8_bitmap32(dev, bmp, palette, fb, x, | ||
+ y, width, height); | ||
+ } else { | ||
/* TODO implement render code for bpix != 16 */ | ||
- printf("Error: only support 16 bpix"); | ||
+ printf("Error: BMP-RLE on %d bpix unsupported", bpix); | ||
return -EPROTONOSUPPORT; | ||
} | ||
- video_display_rle8_bitmap(dev, bmp, cmap_base, fb, x, | ||
- y, width, height); | ||
break; | ||
} | ||
#endif |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-900 KB
meta-ov/recipes-bsp/u-boot/files/openvario-57-lvds-DS2/ov_booting_0.bmp
Binary file not shown.
Binary file removed
BIN
-900 KB
meta-ov/recipes-bsp/u-boot/files/openvario-57-lvds-DS2/ov_booting_1.bmp
Binary file not shown.
Binary file removed
BIN
-900 KB
meta-ov/recipes-bsp/u-boot/files/openvario-57-lvds-DS2/ov_booting_2.bmp
Binary file not shown.
Binary file removed
BIN
-900 KB
meta-ov/recipes-bsp/u-boot/files/openvario-57-lvds-DS2/ov_booting_3.bmp
Binary file not shown.
Binary file removed
BIN
-900 KB
meta-ov/recipes-bsp/u-boot/files/openvario-57-lvds-DS2/ov_recover_0.bmp
Binary file not shown.
Binary file removed
BIN
-900 KB
meta-ov/recipes-bsp/u-boot/files/openvario-57-lvds-DS2/ov_recover_1.bmp
Binary file not shown.
Binary file removed
BIN
-900 KB
meta-ov/recipes-bsp/u-boot/files/openvario-57-lvds-DS2/ov_recover_2.bmp
Binary file not shown.
Binary file removed
BIN
-900 KB
meta-ov/recipes-bsp/u-boot/files/openvario-57-lvds-DS2/ov_recover_3.bmp
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-2.93 MB
meta-ov/recipes-bsp/u-boot/files/openvario-7-AM070-DS2/ov_booting_0.bmp
Binary file not shown.
Binary file removed
BIN
-2.93 MB
meta-ov/recipes-bsp/u-boot/files/openvario-7-AM070-DS2/ov_booting_1.bmp
Binary file not shown.
Binary file removed
BIN
-2.93 MB
meta-ov/recipes-bsp/u-boot/files/openvario-7-AM070-DS2/ov_booting_2.bmp
Binary file not shown.
Binary file removed
BIN
-2.93 MB
meta-ov/recipes-bsp/u-boot/files/openvario-7-AM070-DS2/ov_booting_3.bmp
Binary file not shown.
Binary file removed
BIN
-2.93 MB
meta-ov/recipes-bsp/u-boot/files/openvario-7-AM070-DS2/ov_recover_0.bmp
Binary file not shown.
Binary file removed
BIN
-2.93 MB
meta-ov/recipes-bsp/u-boot/files/openvario-7-AM070-DS2/ov_recover_1.bmp
Binary file not shown.
Binary file removed
BIN
-2.93 MB
meta-ov/recipes-bsp/u-boot/files/openvario-7-AM070-DS2/ov_recover_2.bmp
Binary file not shown.
Binary file removed
BIN
-2.93 MB
meta-ov/recipes-bsp/u-boot/files/openvario-7-AM070-DS2/ov_recover_3.bmp
Binary file not shown.
Binary file removed
BIN
-1.1 MB
meta-ov/recipes-bsp/u-boot/files/openvario-7-CH070-DS2/ov_booting_0.bmp
Binary file not shown.
Binary file removed
BIN
-1.1 MB
meta-ov/recipes-bsp/u-boot/files/openvario-7-CH070-DS2/ov_booting_1.bmp
Binary file not shown.
Binary file removed
BIN
-1.1 MB
meta-ov/recipes-bsp/u-boot/files/openvario-7-CH070-DS2/ov_booting_2.bmp
Binary file not shown.
Binary file removed
BIN
-1.1 MB
meta-ov/recipes-bsp/u-boot/files/openvario-7-CH070-DS2/ov_booting_3.bmp
Binary file not shown.
Binary file removed
BIN
-1.1 MB
meta-ov/recipes-bsp/u-boot/files/openvario-7-CH070-DS2/ov_recover_0.bmp
Binary file not shown.
Binary file removed
BIN
-1.1 MB
meta-ov/recipes-bsp/u-boot/files/openvario-7-CH070-DS2/ov_recover_1.bmp
Binary file not shown.
Binary file removed
BIN
-1.1 MB
meta-ov/recipes-bsp/u-boot/files/openvario-7-CH070-DS2/ov_recover_2.bmp
Binary file not shown.
Binary file removed
BIN
-1.1 MB
meta-ov/recipes-bsp/u-boot/files/openvario-7-CH070-DS2/ov_recover_3.bmp
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-1.76 MB
meta-ov/recipes-bsp/u-boot/files/openvario-7-PQ070/ov_booting_0.bmp
Binary file not shown.
Binary file removed
BIN
-1.82 MB
meta-ov/recipes-bsp/u-boot/files/openvario-7-PQ070/ov_booting_1.bmp
Binary file not shown.
Binary file removed
BIN
-1.76 MB
meta-ov/recipes-bsp/u-boot/files/openvario-7-PQ070/ov_booting_2.bmp
Binary file not shown.
Binary file removed
BIN
-1.82 MB
meta-ov/recipes-bsp/u-boot/files/openvario-7-PQ070/ov_booting_3.bmp
Binary file not shown.
Binary file removed
BIN
-1.76 MB
meta-ov/recipes-bsp/u-boot/files/openvario-7-PQ070/ov_recover_0.bmp
Binary file not shown.
Binary file removed
BIN
-1.76 MB
meta-ov/recipes-bsp/u-boot/files/openvario-7-PQ070/ov_recover_1.bmp
Binary file not shown.
Binary file removed
BIN
-1.76 MB
meta-ov/recipes-bsp/u-boot/files/openvario-7-PQ070/ov_recover_2.bmp
Binary file not shown.
Binary file removed
BIN
-1.76 MB
meta-ov/recipes-bsp/u-boot/files/openvario-7-PQ070/ov_recover_3.bmp
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you planning to submit this upstream? It might be a PITA to fix this large patch once it stops applying cleanly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, though upstream is at a newer version, Yocto is outdated. And I need to clean up the patch a bit, it's somewhat quick'n'dirty code.
(And upstream is a confusing mess of dozens of per-vendor copies....)