Patrick Rudolph has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/39430 )
Change subject: edid_fill_fb: Add row_alignment argument ......................................................................
edid_fill_fb: Add row_alignment argument
Calculate bytes_per_line internally if not set by using a new row_alignment argument in bytes. If row_alignment is set to 0 the bytes_per_line will not be aligned.
Future patches will get rid of externally provided bytes_per_line.
Change-Id: I4ce88193c5e324a2a7b04e0a7e3438172afca038 Signed-off-by: Patrick Rudolph patrick.rudolph@9elements.com --- M src/device/oprom/realmode/x86.c M src/device/oprom/yabel/vbe.c M src/drivers/aspeed/common/ast_mode_corebootfb.c M src/drivers/emulation/qemu/bochs.c M src/drivers/emulation/qemu/cirrus.c M src/drivers/intel/fsp1_1/fsp_gop.c M src/drivers/intel/fsp2_0/graphics.c M src/drivers/intel/gma/gma-gfx_init.ads M src/drivers/intel/gma/hires_fb/gma-gfx_init.adb M src/drivers/xgi/common/xgi_coreboot.c M src/include/edid.h M src/include/framebuffer_info.h M src/lib/edid_fill_fb.c M src/mainboard/google/daisy/mainboard.c M src/mainboard/google/kukui/mainboard.c M src/mainboard/google/oak/mainboard.c M src/mainboard/google/peach_pit/mainboard.c M src/northbridge/intel/i945/gma.c M src/soc/nvidia/tegra124/display.c M src/soc/rockchip/rk3288/display.c M src/soc/rockchip/rk3399/display.c 21 files changed, 56 insertions(+), 35 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/30/39430/1
diff --git a/src/device/oprom/realmode/x86.c b/src/device/oprom/realmode/x86.c index 660b5f0..fe15c48 100644 --- a/src/device/oprom/realmode/x86.c +++ b/src/device/oprom/realmode/x86.c @@ -377,6 +377,7 @@ le16_to_cpu(mode_info.vesa.y_resolution), le16_to_cpu(mode_info.vesa.bytes_per_scanline), mode_info.vesa.bits_per_pixel, + 0, mode_info.vesa.reserved_mask_pos, mode_info.vesa.reserved_mask_size, mode_info.vesa.red_mask_pos, diff --git a/src/device/oprom/yabel/vbe.c b/src/device/oprom/yabel/vbe.c index e7faf9a..cb7d5b6 100644 --- a/src/device/oprom/yabel/vbe.c +++ b/src/device/oprom/yabel/vbe.c @@ -761,6 +761,7 @@ le16_to_cpu(mode_info.vesa.y_resolution), le16_to_cpu(mode_info.vesa.bytes_per_scanline), mode_info.vesa.bits_per_pixel, + 0, mode_info.vesa.reserved_mask_pos, mode_info.vesa.reserved_mask_size, mode_info.vesa.red_mask_pos, diff --git a/src/drivers/aspeed/common/ast_mode_corebootfb.c b/src/drivers/aspeed/common/ast_mode_corebootfb.c index 2ec85ac..f9a02e3 100644 --- a/src/drivers/aspeed/common/ast_mode_corebootfb.c +++ b/src/drivers/aspeed/common/ast_mode_corebootfb.c @@ -247,7 +247,7 @@ ast_hide_cursor(&crtc);
/* Advertise new mode */ - set_vbe_mode_info_valid(&edid, fb.mmio_addr); + set_vbe_mode_info_valid(&edid, fb.mmio_addr, 8);
/* Clear display */ memset((void *)fb.mmio_addr, 0, edid.bytes_per_line * edid.y_resolution); diff --git a/src/drivers/emulation/qemu/bochs.c b/src/drivers/emulation/qemu/bochs.c index d9e4ce1..91aa413 100644 --- a/src/drivers/emulation/qemu/bochs.c +++ b/src/drivers/emulation/qemu/bochs.c @@ -118,7 +118,7 @@ edid.panel_bits_per_color = 8; edid.panel_bits_per_pixel = 24; edid_set_framebuffer_bits_per_pixel(&edid, 32, 0); - set_vbe_mode_info_valid(&edid, addr); + set_vbe_mode_info_valid(&edid, addr, 0); }
static void bochs_init_text_mode(struct device *dev) diff --git a/src/drivers/emulation/qemu/cirrus.c b/src/drivers/emulation/qemu/cirrus.c index 6b1968c..4968613 100644 --- a/src/drivers/emulation/qemu/cirrus.c +++ b/src/drivers/emulation/qemu/cirrus.c @@ -318,7 +318,7 @@ edid.panel_bits_per_color = 8; edid.panel_bits_per_pixel = 24; edid_set_framebuffer_bits_per_pixel(&edid, 32, 0); - set_vbe_mode_info_valid(&edid, addr); + set_vbe_mode_info_valid(&edid, addr, 0); }
static void cirrus_init_text_mode(struct device *dev) diff --git a/src/drivers/intel/fsp1_1/fsp_gop.c b/src/drivers/intel/fsp1_1/fsp_gop.c index e2c6336..7fcb1c3 100644 --- a/src/drivers/intel/fsp1_1/fsp_gop.c +++ b/src/drivers/intel/fsp1_1/fsp_gop.c @@ -36,7 +36,8 @@ vbt_gop->GraphicsMode.HorizontalResolution, vbt_gop->GraphicsMode.VerticalResolution, vbt_gop->GraphicsMode.PixelsPerScanLine * 4, - 32); + 32, + 0); }
BOOT_STATE_INIT_ENTRY(BS_DEV_INIT, BS_ON_EXIT, fill_framebuffer_info, NULL); diff --git a/src/drivers/intel/fsp2_0/graphics.c b/src/drivers/intel/fsp2_0/graphics.c index 3d06336..f5a2d2e 100644 --- a/src/drivers/intel/fsp2_0/graphics.c +++ b/src/drivers/intel/fsp2_0/graphics.c @@ -110,6 +110,7 @@ ginfo->vertical_resolution, ginfo->pixels_per_scanline * 4, 32, + 0, fbinfo->rsvd.pos, fbinfo->rsvd.size, fbinfo->red.pos, diff --git a/src/drivers/intel/gma/gma-gfx_init.ads b/src/drivers/intel/gma/gma-gfx_init.ads index 31ab5cf..f9e0fe4 100644 --- a/src/drivers/intel/gma/gma-gfx_init.ads +++ b/src/drivers/intel/gma/gma-gfx_init.ads @@ -16,7 +16,8 @@ x_resolution : word32; y_resolution : word32; bytes_per_line : word32; - bits_per_pixel : word8) + bits_per_pixel : word8; + row_alignment : word32) return Interfaces.C.int;
pragma import (C, c_fb_set_framebuffer_info, "fb_set_framebuffer_info"); diff --git a/src/drivers/intel/gma/hires_fb/gma-gfx_init.adb b/src/drivers/intel/gma/hires_fb/gma-gfx_init.adb index 0ecf14f..2980232 100644 --- a/src/drivers/intel/gma/hires_fb/gma-gfx_init.adb +++ b/src/drivers/intel/gma/hires_fb/gma-gfx_init.adb @@ -21,7 +21,8 @@ x_resolution : word32; y_resolution : word32; bytes_per_line : word32; - bits_per_pixel : word8) + bits_per_pixel : word8; + row_alignment : word32) is use type word32; ignored : Interfaces.C.int; @@ -30,7 +31,8 @@ x_resolution, y_resolution, bytes_per_line, - bits_per_pixel + bits_per_pixel, + row_alignment ); end fb_set_framebuffer_info;
@@ -102,7 +104,8 @@ word32(fb.Width), word32(fb.Height), 4 * word32 (fb.Stride), - 32); + 32, + 16); end if; end if; end if; diff --git a/src/drivers/xgi/common/xgi_coreboot.c b/src/drivers/xgi/common/xgi_coreboot.c index 9c60e3a..b52cad0 100644 --- a/src/drivers/xgi/common/xgi_coreboot.c +++ b/src/drivers/xgi/common/xgi_coreboot.c @@ -363,7 +363,8 @@ xgifb_info->video_width, xgifb_info->video_height, xgifb_info->video_width * xgifb_info->video_bpp, - xgifb_info->video_bpp); + xgifb_info->video_bpp, + 0); } else { /* * FIXME diff --git a/src/include/edid.h b/src/include/edid.h index 70d21eb..b630b14 100644 --- a/src/include/edid.h +++ b/src/include/edid.h @@ -109,7 +109,8 @@ int decode_edid(unsigned char *edid, int size, struct edid *out); void edid_set_framebuffer_bits_per_pixel(struct edid *edid, int fb_bpp, int row_byte_alignment); -struct fb_info *set_vbe_mode_info_valid(const struct edid *edid, uintptr_t fb_addr); +struct fb_info *set_vbe_mode_info_valid(const struct edid *edid, uintptr_t fb_addr, + uint32_t row_alignment); void set_vbe_framebuffer_orientation(enum lb_fb_orientation orientation); int set_display_mode(struct edid *edid, enum edid_modes mode);
diff --git a/src/include/framebuffer_info.h b/src/include/framebuffer_info.h index 70ec11c..1bdffe0 100644 --- a/src/include/framebuffer_info.h +++ b/src/include/framebuffer_info.h @@ -28,15 +28,15 @@ bool fb_fill_framebuffer_info_ex(struct fb_info *info, uintptr_t fb_addr, uint32_t x_resolution, uint32_t y_resolution, uint32_t bytes_per_line, - uint8_t bits_per_pixel, uint8_t reserved_mask_pos, - uint8_t reserved_mask_size, uint8_t red_mask_pos, - uint8_t red_mask_size, uint8_t green_mask_pos, - uint8_t green_mask_size, uint8_t blue_mask_pos, - uint8_t blue_mask_size); + uint8_t bits_per_pixel, uint32_t row_alignment, + uint8_t reserved_mask_pos, uint8_t reserved_mask_size, + uint8_t red_mask_pos, uint8_t red_mask_size, + uint8_t green_mask_pos, uint8_t green_mask_size, + uint8_t blue_mask_pos, uint8_t blue_mask_size);
struct fb_info *fb_set_framebuffer_info(uintptr_t fb_addr, uint32_t x_resolution, uint32_t y_resolution, uint32_t bytes_per_line, - uint8_t bits_per_pixel); + uint8_t bits_per_pixel, uint32_t row_alignment);
void fb_set_orientation(struct fb_info *info, enum lb_fb_orientation orientation); diff --git a/src/lib/edid_fill_fb.c b/src/lib/edid_fill_fb.c index 8a1613e..89a62b2 100644 --- a/src/lib/edid_fill_fb.c +++ b/src/lib/edid_fill_fb.c @@ -56,11 +56,11 @@ bool fb_fill_framebuffer_info_ex(struct fb_info *info, uintptr_t fb_addr, uint32_t x_resolution, uint32_t y_resolution, uint32_t bytes_per_line, - uint8_t bits_per_pixel, uint8_t reserved_mask_pos, - uint8_t reserved_mask_size, uint8_t red_mask_pos, - uint8_t red_mask_size, uint8_t green_mask_pos, - uint8_t green_mask_size, uint8_t blue_mask_pos, - uint8_t blue_mask_size) + uint8_t bits_per_pixel, uint32_t row_alignment, + uint8_t reserved_mask_pos, uint8_t reserved_mask_size, + uint8_t red_mask_pos, uint8_t red_mask_size, + uint8_t green_mask_pos, uint8_t green_mask_size, + uint8_t blue_mask_pos, uint8_t blue_mask_size) { /* Validate */ if (!info) @@ -77,6 +77,14 @@ y_resolution, (bytes_per_line * y_resolution), (void *)fb_addr);
+ if (!row_alignment) + row_alignment = 1; + + if (!bytes_per_line) + bytes_per_line = x_resolution * bits_per_pixel / 8; + + bytes_per_line = ALIGN_UP(bytes_per_line, row_alignment); + /* Update */ info->edid_fb.physical_address = fb_addr; info->edid_fb.x_resolution = x_resolution; @@ -107,8 +115,8 @@ */ struct fb_info * fb_set_framebuffer_info(uintptr_t fb_addr, uint32_t x_resolution, - uint32_t y_resolution, uint32_t bytes_per_line, - uint8_t bits_per_pixel) + uint32_t y_resolution, uint32_t bytes_per_line, + uint8_t bits_per_pixel, uint32_t row_alignment) { struct fb_info *info = fb_new_framebuffer_info(); if (!info) @@ -119,7 +127,8 @@ case 24: /* packed into 4-byte words */ if (!fb_fill_framebuffer_info_ex(info, fb_addr, x_resolution, y_resolution, - bytes_per_line, bits_per_pixel, 24, 8, 16, 8, 8, 8, 0, 8)) { + bytes_per_line, bits_per_pixel, row_alignment, 24, 8, 16, 8, 8, 8, + 0, 8)) { printk(BIOS_ERR, "%s: failed to add framebuffer info\n", __func__); free(info); return NULL; @@ -128,7 +137,8 @@ case 16: /* packed into 2-byte words */ if (!fb_fill_framebuffer_info_ex(info, fb_addr, x_resolution, y_resolution, - bytes_per_line, bits_per_pixel, 0, 0, 11, 5, 5, 6, 0, 5)) { + bytes_per_line, bits_per_pixel, row_alignment, 0, 0, 11, 5, 5, 6, + 0, 5)) { printk(BIOS_ERR, "%s: failed to add framebuffer info\n", __func__); free(info); return NULL; @@ -155,10 +165,11 @@ /* * Take an edid, and create a framebuffer. Set fb_valid to 1. */ -struct fb_info *set_vbe_mode_info_valid(const struct edid *edid, uintptr_t fb_addr) +struct fb_info *set_vbe_mode_info_valid(const struct edid *edid, uintptr_t fb_addr, + uint32_t row_alignment) { return fb_set_framebuffer_info(fb_addr, edid->x_resolution, edid->y_resolution, - edid->bytes_per_line, edid->framebuffer_bits_per_pixel); + edid->bytes_per_line, edid->framebuffer_bits_per_pixel, row_alignment); }
int fill_lb_framebuffer(struct lb_framebuffer *framebuffer) diff --git a/src/mainboard/google/daisy/mainboard.c b/src/mainboard/google/daisy/mainboard.c index 30f8805..05479ed 100644 --- a/src/mainboard/google/daisy/mainboard.c +++ b/src/mainboard/google/daisy/mainboard.c @@ -277,7 +277,7 @@
sdmmc_vdd();
- set_vbe_mode_info_valid(&edid, (uintptr_t)fb_addr); + set_vbe_mode_info_valid(&edid, (uintptr_t)fb_addr, 0);
lcd_vdd();
diff --git a/src/mainboard/google/kukui/mainboard.c b/src/mainboard/google/kukui/mainboard.c index 47aa40c..436be30 100644 --- a/src/mainboard/google/kukui/mainboard.c +++ b/src/mainboard/google/kukui/mainboard.c @@ -173,7 +173,7 @@ return false; } mtk_ddp_mode_set(edid); - struct fb_info *info = set_vbe_mode_info_valid(edid, 0); + struct fb_info *info = set_vbe_mode_info_valid(edid, 0, 0); if (info) fb_set_orientation(info, panel->s->orientation);
diff --git a/src/mainboard/google/oak/mainboard.c b/src/mainboard/google/oak/mainboard.c index 421826c..7fe0408 100644 --- a/src/mainboard/google/oak/mainboard.c +++ b/src/mainboard/google/oak/mainboard.c @@ -238,7 +238,7 @@ }
mtk_ddp_mode_set(&edid); - set_vbe_mode_info_valid(&edid, (uintptr_t)0); + set_vbe_mode_info_valid(&edid, (uintptr_t)0, 0); }
static void mainboard_init(struct device *dev) diff --git a/src/mainboard/google/peach_pit/mainboard.c b/src/mainboard/google/peach_pit/mainboard.c index 553c2ad..3b1c8b0 100644 --- a/src/mainboard/google/peach_pit/mainboard.c +++ b/src/mainboard/google/peach_pit/mainboard.c @@ -416,7 +416,7 @@
sdmmc_vdd();
- set_vbe_mode_info_valid(&edid, (uintptr_t)fb_addr); + set_vbe_mode_info_valid(&edid, (uintptr_t)fb_addr, 0);
/* * The reset value for FIMD SYSMMU register MMU_CTRL:0x14640000 diff --git a/src/northbridge/intel/i945/gma.c b/src/northbridge/intel/i945/gma.c index 98e30e7..f1d20f2 100644 --- a/src/northbridge/intel/i945/gma.c +++ b/src/northbridge/intel/i945/gma.c @@ -386,7 +386,7 @@ (void *)pgfx, hactive * vactive * 4); memset((void *)pgfx, 0x00, hactive * vactive * 4);
- set_vbe_mode_info_valid(&edid, pgfx); + set_vbe_mode_info_valid(&edid, pgfx, 64); } else { vga_misc_write(0x67);
diff --git a/src/soc/nvidia/tegra124/display.c b/src/soc/nvidia/tegra124/display.c index 6fa3bdf..d54c3f0 100644 --- a/src/soc/nvidia/tegra124/display.c +++ b/src/soc/nvidia/tegra124/display.c @@ -330,5 +330,5 @@ edid.mode.ha = config->xres; edid_set_framebuffer_bits_per_pixel(&edid, config->framebuffer_bits_per_pixel, 32); - set_vbe_mode_info_valid(&edid, (uintptr_t)(framebuffer_base_mb*MiB)); + set_vbe_mode_info_valid(&edid, (uintptr_t)(framebuffer_base_mb*MiB), 32); } diff --git a/src/soc/rockchip/rk3288/display.c b/src/soc/rockchip/rk3288/display.c index a66b2d4..54aac15 100644 --- a/src/soc/rockchip/rk3288/display.c +++ b/src/soc/rockchip/rk3288/display.c @@ -138,5 +138,5 @@ break; }
- set_vbe_mode_info_valid(&edid, (uintptr_t)lcdbase); + set_vbe_mode_info_valid(&edid, (uintptr_t)lcdbase, 0); } diff --git a/src/soc/rockchip/rk3399/display.c b/src/soc/rockchip/rk3399/display.c index 9cd4053..401c917 100644 --- a/src/soc/rockchip/rk3399/display.c +++ b/src/soc/rockchip/rk3399/display.c @@ -174,7 +174,7 @@ break; } mainboard_power_on_backlight(); - set_vbe_mode_info_valid(&edid, (uintptr_t)0); + set_vbe_mode_info_valid(&edid, (uintptr_t)0, 0);
return; }