[coreboot-gerrit] Change in coreboot[master]: libpayload: cbgfx: Show square images on portrait displays
Martin Roth (Code Review)
gerrit at coreboot.org
Mon Apr 17 18:12:03 CEST 2017
Martin Roth has submitted this change and it was merged. ( https://review.coreboot.org/19279 )
Change subject: libpayload: cbgfx: Show square images on portrait displays
......................................................................
libpayload: cbgfx: Show square images on portrait displays
CBGFX currently doesn't support portrait screens at all. This will have
to be fixed eventually but might take a bit of effort. As a first step
to make devices with a portrait panel somewhat usable, this patch will
just force a square canvas on these panels and keep the bottom part of
the screen black.
Also switch set_pixel to calculate framebuffer position via
bytes_per_line instead of x_resolution. This is supposed to be the
canonical way to do that and may differ in cases where the display
controller requires a certain alignment from framebuffer lines.
Change-Id: I47dd3bf95ab8a7d8b7e1913e0ddab346eedd46f1
Signed-off-by: Julius Werner <jwerner at chromium.org>
Reviewed-on: https://review.coreboot.org/19279
Tested-by: build bot (Jenkins)
Reviewed-by: Daisuke Nojiri <dnojiri at chromium.org>
---
M payloads/libpayload/drivers/video/graphics.c
1 file changed, 7 insertions(+), 4 deletions(-)
Approvals:
Daisuke Nojiri: 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 f1d916a..4a8792c 100644
--- a/payloads/libpayload/drivers/video/graphics.c
+++ b/payloads/libpayload/drivers/video/graphics.c
@@ -125,9 +125,9 @@
static inline void set_pixel(struct vector *coord, uint32_t color)
{
const int bpp = fbinfo->bits_per_pixel;
+ const int bpl = fbinfo->bytes_per_line;
int i;
- uint8_t * const pixel = fbaddr + (coord->x +
- coord->y * fbinfo->x_resolution) * bpp / 8;
+ uint8_t * const pixel = fbaddr + coord->y * bpl + coord->x * bpp / 8;
for (i = 0; i < bpp / 8; i++)
pixel[i] = (color >> (i * 8));
}
@@ -156,8 +156,11 @@
/* Calculate canvas size & offset, assuming the screen is landscape */
if (screen.size.height > screen.size.width) {
- LOG("Portrait screen not supported\n");
- return CBGFX_ERROR_PORTRAIT_SCREEN;
+ 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.height;
canvas.size.width = canvas.size.height;
--
To view, visit https://review.coreboot.org/19279
To unsubscribe, visit https://review.coreboot.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I47dd3bf95ab8a7d8b7e1913e0ddab346eedd46f1
Gerrit-PatchSet: 2
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Owner: Julius Werner <jwerner at chromium.org>
Gerrit-Reviewer: Daisuke Nojiri <dnojiri at chromium.org>
Gerrit-Reviewer: Martin Roth <martinroth at google.com>
Gerrit-Reviewer: Paul Menzel <paulepanter at users.sourceforge.net>
Gerrit-Reviewer: build bot (Jenkins)
More information about the coreboot-gerrit
mailing list