diff options
author | Nickey Yang <nickey.yang@rock-chips.com> | 2017-04-27 09:37:20 +0800 |
---|---|---|
committer | Martin Roth <martinroth@google.com> | 2017-05-01 17:52:12 +0200 |
commit | d0e465456eedd7d39442a82fe3b2186784a9ff60 (patch) | |
tree | c93d80a65e87269a0f51a6c0daa0399eb9d9523f /payloads/libpayload/drivers | |
parent | 43d0d0d1f494c763aedc686e1c8de1603d31d652 (diff) |
cbgfx: Add portrait screen support
cbgfx currently does not support portrait screen which height >width.
so add it.
Change-Id: I66fee6d73654e736a2db4a3d191f030c52a23e0d
Signed-off-by: Nickey Yang <nickey.yang@rock-chips.com>
Reviewed-on: https://review.coreboot.org/19474
Tested-by: build bot (Jenkins)
Reviewed-by: Julius Werner <jwerner@chromium.org>
Diffstat (limited to 'payloads/libpayload/drivers')
-rw-r--r-- | payloads/libpayload/drivers/video/graphics.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/payloads/libpayload/drivers/video/graphics.c b/payloads/libpayload/drivers/video/graphics.c index 4a8792c151..d4eaa09997 100644 --- a/payloads/libpayload/drivers/video/graphics.c +++ b/payloads/libpayload/drivers/video/graphics.c @@ -154,18 +154,18 @@ static int cbgfx_init(void) screen.offset.x = 0; screen.offset.y = 0; - /* Calculate canvas size & offset, assuming the screen is landscape */ + /* Calculate canvas size & offset. Canvas is always square. */ if (screen.size.height > screen.size.width) { - const int bpl = fbinfo->bytes_per_line; - LOG("Portrait screen not supported, forcing square image!\n"); - memset(fbaddr + screen.size.width * bpl, 0, - (screen.size.height - screen.size.width) * bpl); - screen.size.height = screen.size.width; + canvas.size.height = screen.size.width; + canvas.size.width = canvas.size.height; + canvas.offset.x = 0; + canvas.offset.y = (screen.size.height - canvas.size.height) / 2; + } else { + canvas.size.height = screen.size.height; + canvas.size.width = canvas.size.height; + canvas.offset.x = (screen.size.width - canvas.size.width) / 2; + canvas.offset.y = 0; } - canvas.size.height = screen.size.height; - canvas.size.width = canvas.size.height; - canvas.offset.x = (screen.size.width - canvas.size.width) / 2; - canvas.offset.y = 0; initialized = 1; LOG("cbgfx initialized: screen:width=%d, height=%d, offset=%d canvas:width=%d, height=%d, offset=%d\n", |