From 6911219ccc445f833264cf5a5a4b9439b9670b40 Mon Sep 17 00:00:00 2001 From: Julius Werner Date: Mon, 14 Mar 2016 17:29:55 -0700 Subject: edid: Add helper function to calculate bits-per-pixel dependent values Coreboot and most payloads support three basic pixel widths for the framebuffer. It assumes 32 by default, but several chipsets need to override that value with whatever else they're supporting. Our struct edid contains multiple convenience values that are directly derived from this (and other properties), so changing the bits per pixel always requires recalculating all those dependents in the chipset code. This patch provides a small convenience wrapper that can be used to consistently update the whole struct edid with a new pixel width instead, so we no longer need to duplicate those calculations everywhere. BUG=None TEST=Booted Oak in all three pixel widths (which it conveniently all supports), confirmed that images looked good. Change-Id: I5376dd4e28cf107ac2fba1dc418f5e1c5a2e2de6 Signed-off-by: Julius Werner Reviewed-on: https://review.coreboot.org/14158 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi --- src/drivers/emulation/qemu/bochs.c | 5 +---- src/drivers/emulation/qemu/cirrus.c | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-) (limited to 'src/drivers/emulation/qemu') diff --git a/src/drivers/emulation/qemu/bochs.c b/src/drivers/emulation/qemu/bochs.c index ae2975d543..f32fee008c 100644 --- a/src/drivers/emulation/qemu/bochs.c +++ b/src/drivers/emulation/qemu/bochs.c @@ -111,12 +111,9 @@ static void bochs_init(struct device *dev) /* setup coreboot framebuffer */ edid.mode.ha = width; edid.mode.va = height; - edid.x_resolution = width; - edid.y_resolution = height; - edid.bytes_per_line = width * 4; - edid.framebuffer_bits_per_pixel = 32; edid.panel_bits_per_color = 8; edid.panel_bits_per_pixel = 24; + edid_set_framebuffer_bits_per_pixel(&edid, 32); set_vbe_mode_info_valid(&edid, addr); #else vga_misc_write(0x1); diff --git a/src/drivers/emulation/qemu/cirrus.c b/src/drivers/emulation/qemu/cirrus.c index 42cc120215..84c2958031 100644 --- a/src/drivers/emulation/qemu/cirrus.c +++ b/src/drivers/emulation/qemu/cirrus.c @@ -330,12 +330,9 @@ static void cirrus_init(struct device *dev) struct edid edid; edid.mode.ha = width; edid.mode.va = height; - edid.x_resolution = width; - edid.y_resolution = height; - edid.bytes_per_line = width * 4; - edid.framebuffer_bits_per_pixel = 32; edid.panel_bits_per_color = 8; edid.panel_bits_per_pixel = 24; + edid_set_framebuffer_bits_per_pixel(&edid, 32); set_vbe_mode_info_valid(&edid, addr); #else vga_misc_write(0x1); -- cgit v1.2.3