Martin Roth has submitted this change and it was merged. ( https://review.coreboot.org/19474 )
Change subject: cbgfx: Add portrait screen support ......................................................................
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 --- M payloads/libpayload/drivers/video/graphics.c 1 file changed, 10 insertions(+), 10 deletions(-)
Approvals: Julius Werner: Looks good to me, approved build bot (Jenkins): Verified
diff --git a/payloads/libpayload/drivers/video/graphics.c b/payloads/libpayload/drivers/video/graphics.c index 4a8792c..d4eaa09 100644 --- a/payloads/libpayload/drivers/video/graphics.c +++ b/payloads/libpayload/drivers/video/graphics.c @@ -154,18 +154,18 @@ 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",