diff options
author | Julius Werner <jwerner@chromium.org> | 2019-06-27 16:52:37 -0700 |
---|---|---|
committer | Julius Werner <jwerner@chromium.org> | 2019-06-29 00:31:14 +0000 |
commit | ce4d39d2d74817e88c8804c1a55ad417301466f7 (patch) | |
tree | 00bc640a171bf416036cf012308f702971def9c9 /payloads/libpayload/drivers/video | |
parent | c22ebc9339bf75ab55bbb885ede0c63314f46014 (diff) | |
download | coreboot-ce4d39d2d74817e88c8804c1a55ad417301466f7.tar.xz |
libpayload: cbgfx: Run cbgfx_init() before we need it for draw_box()
calculate_color() uses the 'fbinfo' global that is initialized by
cbgfx_init(), so we need to run the latter before we can run the former
or we get a null pointer access.
Change-Id: I73ca8e20ca36f64d699379d504fd41dc2084f157
Signed-off-by: Julius Werner <jwerner@chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/33855
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Diffstat (limited to 'payloads/libpayload/drivers/video')
-rw-r--r-- | payloads/libpayload/drivers/video/graphics.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/payloads/libpayload/drivers/video/graphics.c b/payloads/libpayload/drivers/video/graphics.c index 49563267a9..85a8642c72 100644 --- a/payloads/libpayload/drivers/video/graphics.c +++ b/payloads/libpayload/drivers/video/graphics.c @@ -183,6 +183,10 @@ int draw_box(const struct rect *box, const struct rgb_color *rgb) struct vector top_left; struct vector size; struct vector p, t; + + if (cbgfx_init()) + return CBGFX_ERROR_INIT; + const uint32_t color = calculate_color(rgb, 0); const struct scale top_left_s = { .x = { .n = box->offset.x, .d = CANVAS_SCALE, }, @@ -193,9 +197,6 @@ int draw_box(const struct rect *box, const struct rgb_color *rgb) .y = { .n = box->size.y, .d = CANVAS_SCALE, } }; - if (cbgfx_init()) - return CBGFX_ERROR_INIT; - transform_vector(&top_left, &canvas.size, &top_left_s, &canvas.offset); transform_vector(&size, &canvas.size, &size_s, &vzero); add_vectors(&t, &top_left, &size); |