lib: Rename fill_lb_framebuffer to get_lb_framebuffer

Rename `fill_lb_framebuffer` to `get_lb_framebuffer` to better
reflect that it returns framebuffer information.

The new `get_lb_framebuffer` returns a constant pointer to the
framebuffer structure instead of filling a provided structure.
This simplifies the API and avoids an unnecessary memory copy.

The file `edid_fill_fb.c` is renamed to `framebuffer_info.c`
to better match the function it now contains.

Call sites in `coreboot_table.c` and `render_bmp.c` are
updated to use the new API.

TEST=emerge-tanjiro coreboot; check the FW logo is correctly drawn.
BUG=b:319511268

Change-Id: I8d7b20a0524b6bc9fff9e6461fa0c253345df790
Signed-off-by: Yidi Lin <yidilin@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/90725
Reviewed-by: Yu-Ping Wu <yupingso@google.com>
Reviewed-by: Chen-Tsung Hsieh <chentsung@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
This commit is contained in:
Yidi Lin 2026-01-12 15:01:12 +08:00
commit 1d2b399fd7
5 changed files with 16 additions and 19 deletions

View file

@ -33,9 +33,9 @@ void lb_efi_fw_info(struct lb_header *header);
/* Adds LB_TAG_CAPSULE table entries. */
void lb_efi_capsules(struct lb_header *header);
/* Define this function to fill in the frame buffer returning 0 on success and
< 0 on error. */
int fill_lb_framebuffer(struct lb_framebuffer *framebuffer);
/* Define this function to get the frame buffer returning lb_framebuffer object
on success and NULL on error. */
const struct lb_framebuffer *get_lb_framebuffer(void);
/* Allow arch to add records. */
void lb_arch_add_records(struct lb_header *header);

View file

@ -154,8 +154,8 @@ ramstage-$(CONFIG_BOOTSPLASH) += jpeg.c
ramstage-$(CONFIG_COLLECT_TIMESTAMPS) += timestamp.c
ramstage-$(CONFIG_COVERAGE) += libgcov.c
ramstage-y += dp_aux.c
ramstage-y += framebuffer_info.c
ramstage-y += edid.c
ramstage-y += edid_fill_fb.c
ramstage-y += memrange.c
ramstage-$(CONFIG_GENERIC_GPIO_LIB) += gpio.c
ramstage-$(CONFIG_GENERIC_UDELAY) += timer.c

View file

@ -142,13 +142,13 @@ static void lb_pcie(struct lb_header *header)
static void lb_framebuffer(struct lb_header *header)
{
struct lb_framebuffer *framebuffer;
struct lb_framebuffer fb = {0};
const struct lb_framebuffer *fb;
if (!CONFIG(LINEAR_FRAMEBUFFER) || fill_lb_framebuffer(&fb))
if (!CONFIG(LINEAR_FRAMEBUFFER) || !(fb = get_lb_framebuffer()))
return;
framebuffer = (struct lb_framebuffer *)lb_new_record(header);
memcpy(framebuffer, &fb, sizeof(*framebuffer));
memcpy(framebuffer, fb, sizeof(*framebuffer));
framebuffer->tag = LB_TAG_FRAMEBUFFER;
framebuffer->size = sizeof(*framebuffer);

View file

@ -181,14 +181,13 @@ struct fb_info *fb_new_framebuffer_info_from_edid(const struct edid *edid,
edid->bytes_per_line, edid->framebuffer_bits_per_pixel);
}
int fill_lb_framebuffer(struct lb_framebuffer *framebuffer)
const struct lb_framebuffer *get_lb_framebuffer(void)
{
struct fb_info *i;
list_for_each(i, list, node) {
//TODO: Add support for advertising all framebuffers in this list
*framebuffer = i->fb;
return 0;
return &i->fb;
}
return -1;
return NULL;
}

View file

@ -689,16 +689,14 @@ void render_logo_to_framebuffer(struct logo_config *config)
if (config->framebuffer_base == 0) {
/* Try to load from already populated framebuffer information */
struct lb_framebuffer framebuffer;
memset(&framebuffer, 0, sizeof(struct lb_framebuffer));
fill_lb_framebuffer(&framebuffer);
const struct lb_framebuffer *fb = get_lb_framebuffer();
/* Exit if framebuffer is still not available */
if (framebuffer.physical_address == 0)
if (!fb)
return;
config->framebuffer_base = framebuffer.physical_address;
config->horizontal_resolution = framebuffer.x_resolution;
config->vertical_resolution = framebuffer.y_resolution;
config->bytes_per_scanline = framebuffer.bytes_per_line;
config->framebuffer_base = fb->physical_address;
config->horizontal_resolution = fb->x_resolution;
config->vertical_resolution = fb->y_resolution;
config->bytes_per_scanline = fb->bytes_per_line;
}
/*