From 92106b166671a315a2b1e8f5cc467f2fa0823301 Mon Sep 17 00:00:00 2001 From: Patrick Rudolph Date: Wed, 19 Feb 2020 12:54:06 +0100 Subject: drivers: Replace multiple fill_lb_framebuffer with single instance Currently it's not possible to add multiple graphics drivers into one coreboot image. This patch series will fix this issue by providing a single API that multiple graphics drivers can use. This is required for platforms that have two graphic cards, but different graphic drivers, like Intel+Aspeed on server platforms or Intel+Nvidia on consumer notebooks. The goal is to remove duplicated fill_fb_framebuffer(), the advertisment of multiple independent framebuffers in coreboot tables, and better runtime/build time graphic configuration options. Replace all duplications of fill_fb_framebuffer and provide a single one in edid_fill_fb.c. Should not change the current behaviour as still only one graphic driver can be active at time. Change-Id: Ife507f7e7beaf59854e533551b4b87ea6980c1f4 Signed-off-by: Patrick Rudolph Reviewed-on: https://review.coreboot.org/c/coreboot/+/39003 Reviewed-by: Angel Pons Reviewed-by: Frans Hendriks Reviewed-by: Christian Walter Tested-by: build bot (Jenkins) --- src/drivers/intel/gma/hires_fb/gma-gfx_init.adb | 59 +++++++++---------------- 1 file changed, 20 insertions(+), 39 deletions(-) (limited to 'src/drivers/intel/gma/hires_fb') 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 92d3a16963..b213030b2b 100644 --- a/src/drivers/intel/gma/hires_fb/gma-gfx_init.adb +++ b/src/drivers/intel/gma/hires_fb/gma-gfx_init.adb @@ -18,56 +18,29 @@ with GMA.Mainboard; package body GMA.GFX_Init is - fb_valid : boolean := false; - - linear_fb_addr : word64; - - fb : Framebuffer_Type; - - function fill_lb_framebuffer - (framebuffer : in out lb_framebuffer) - return Interfaces.C.int - is - use type word32; - use type Interfaces.C.int; - begin - if fb_valid then - framebuffer := - (tag => 0, - size => 0, - physical_address => linear_fb_addr, - x_resolution => word32 (fb.Width), - y_resolution => word32 (fb.Height), - bytes_per_line => 4 * word32 (fb.Stride), - bits_per_pixel => 32, - reserved_mask_pos => 24, - reserved_mask_size => 8, - red_mask_pos => 16, - red_mask_size => 8, - green_mask_pos => 8, - green_mask_size => 8, - blue_mask_pos => 0, - blue_mask_size => 8); - return 0; - else - return -1; - end if; - end fill_lb_framebuffer; - ---------------------------------------------------------------------------- procedure gfxinit (lightup_ok : out Interfaces.C.int) is use type pos32; use type word64; + use type word32; + use type Interfaces.C.size_t; ports : Port_List; configs : Pipe_Configs; success : boolean; + linear_fb_addr : word64; + + fb : Framebuffer_Type; + min_h : pos32 := Config.LINEAR_FRAMEBUFFER_MAX_WIDTH; min_v : pos32 := Config.LINEAR_FRAMEBUFFER_MAX_HEIGHT; + + fbinfo : Interfaces.C.size_t; + begin lightup_ok := 0; @@ -108,9 +81,17 @@ is HW.GFX.GMA.Update_Outputs (configs); HW.GFX.GMA.Map_Linear_FB (linear_fb_addr, fb); - fb_valid := linear_fb_addr /= 0; - - lightup_ok := (if fb_valid then 1 else 0); + if linear_fb_addr /= 0 then + fbinfo := c_fb_add_framebuffer_info + (fb_addr => Interfaces.C.size_t (linear_fb_addr), + x_resolution => word32 (fb.Width), + y_resolution => word32 (fb.Height), + bytes_per_line => word32 (fb.Stride) * 4, + bits_per_pixel => 32); + if fbinfo /= 0 then + lightup_ok := 1; + end if; + end if; end if; end if; end if; -- cgit v1.2.3