[coreboot-gerrit] Patch set updated for coreboot: cbgfx: add load_bitmap
Patrick Georgi (pgeorgi@google.com)
gerrit at coreboot.org
Wed Oct 21 20:52:46 CEST 2015
Patrick Georgi (pgeorgi at google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/11925
-gerrit
commit 81d09e8db6e65e9f70032ca06cc67b7bdde99aa9
Author: Daisuke Nojiri <dnojiri at chromium.org>
Date: Thu Sep 24 12:42:17 2015 -0700
cbgfx: add load_bitmap
This change adds load_bitmap API, which loads a bitmap file from cbfs
and returns a pointer to the image data.
BUG=none
BRANCH=tot
TEST=Tested on Samus
Change-Id: I7d7874f6f68c414dc877a012ad96c393e42dc35e
Signed-off-by: Patrick Georgi <pgeorgi at google.com>
Original-Commit-Id: 9d33e713a0cf6bd1365418dad989e47e86db01e4
Original-Change-Id: Idbf9682c2fa9df3f0bd296ca47edd02cd09cfd01
Original-Signed-off-by: Daisuke Nojiri <dnojiri at chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/302194
Original-Reviewed-by: Randall Spangler <rspangler at chromium.org>
---
payloads/libpayload/drivers/video/graphics.c | 15 +++++++++++++++
payloads/libpayload/include/cbgfx.h | 12 ++++++++++++
2 files changed, 27 insertions(+)
diff --git a/payloads/libpayload/drivers/video/graphics.c b/payloads/libpayload/drivers/video/graphics.c
index d4d08f8..c261473 100644
--- a/payloads/libpayload/drivers/video/graphics.c
+++ b/payloads/libpayload/drivers/video/graphics.c
@@ -5,6 +5,7 @@
*/
#include <libpayload.h>
+#include <cbfs.h>
#include <sysinfo.h>
#include "bitmap.h"
@@ -145,6 +146,20 @@ static int cbgfx_init(void)
return 0;
}
+void *load_bitmap(const char *name, size_t *size)
+{
+ static struct cbfs_media media;
+ static int cbfs_media_initialized = 0;
+ if (!cbfs_media_initialized) {
+ if (init_default_cbfs_media(&media)) {
+ printf("Failed to initialize default media\n");
+ return NULL;
+ }
+ }
+ cbfs_media_initialized = 1;
+ return cbfs_get_file_content(&media, name, CBFS_TYPE_RAW, size);
+}
+
int draw_box(const struct rect *box, const struct rgb_color *rgb)
{
struct vector top_left;
diff --git a/payloads/libpayload/include/cbgfx.h b/payloads/libpayload/include/cbgfx.h
index 3c28a13..cb037a0 100644
--- a/payloads/libpayload/include/cbgfx.h
+++ b/payloads/libpayload/include/cbgfx.h
@@ -74,6 +74,18 @@ struct rgb_color {
*/
/*
+ * Load a bitmap file from cbfs
+ *
+ * Memory is allocated automatically and it's caller's responsibility to free it
+ *
+ * name: name of the bitmap file
+ * size: (OUT) size of the image
+ *
+ * return: pointer to the image data in memory or NULL on error
+ */
+void *load_bitmap(const char *name, size_t *size);
+
+/*
* draw a box filled with a color on screen
*
* box: .offset points the coordinate of the top left corner and .size specifies
More information about the coreboot-gerrit
mailing list