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>
This commit is contained in:
parent
43d0d0d1f4
commit
d0e465456e
|
@ -154,18 +154,18 @@ static int cbgfx_init(void)
|
||||||
screen.offset.x = 0;
|
screen.offset.x = 0;
|
||||||
screen.offset.y = 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) {
|
if (screen.size.height > screen.size.width) {
|
||||||
const int bpl = fbinfo->bytes_per_line;
|
canvas.size.height = screen.size.width;
|
||||||
LOG("Portrait screen not supported, forcing square image!\n");
|
canvas.size.width = canvas.size.height;
|
||||||
memset(fbaddr + screen.size.width * bpl, 0,
|
canvas.offset.x = 0;
|
||||||
(screen.size.height - screen.size.width) * bpl);
|
canvas.offset.y = (screen.size.height - canvas.size.height) / 2;
|
||||||
screen.size.height = screen.size.width;
|
} 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;
|
initialized = 1;
|
||||||
LOG("cbgfx initialized: screen:width=%d, height=%d, offset=%d canvas:width=%d, height=%d, offset=%d\n",
|
LOG("cbgfx initialized: screen:width=%d, height=%d, offset=%d canvas:width=%d, height=%d, offset=%d\n",
|
||||||
|
|
Loading…
Reference in New Issue