coreboot/src/lib/render_bmp.h
Kapil Porwal 9a8ba5b39a {lib, drivers/intel}: Move BMP rendering logic out of SoC code
This patch refactors the BMP rendering logic, moving it from
drivers/intel/fsp2_0 to src/lib. This centralizes the code
responsible for rendering BMP images to the framebuffer.

Key changes:
- Move BMP rendering functions (e.g., calculate_logo_coordinates,
  copy_logo_to_framebuffer) and their dependencies to
  src/lib/render_bmp.c and src/lib/render_bmp.h.
- Decouple BMP definitions from UEFI headers by introducing new
  coreboot-specific structures for BMP images and BLT pixels.
- Consolidate bootsplash-related declarations into bootsplash.h,
  including new `fw_splash_vertical_alignment`,
  `fw_splash_horizontal_alignment`, and `struct logo_config`.
- Update `soc_load_logo_by_coreboot` to use the new common
  `load_and_render_logo_to_framebuffer` function and `struct
  logo_config` for rendering.
- Relocate `release_logo` to `src/lib/render_bmp.c` for better
  module structure.
- Update `src/lib/Makefile.mk` to include the new render_bmp.c.

This refactoring improves code organization and reusability, making
BMP rendering accessible without tight coupling to Intel-specific
driver code.

BUG=b:427387842
TEST=Verify firmware splash screen on google/fatcat.

Change-Id: I0e20ea7e44b4b3ccdb2d4aa9b6aa10ed3447ccfc
Signed-off-by: Kapil Porwal <kapilporwal@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/88361
Reviewed-by: Subrata Banik <subratabanik@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2025-07-23 17:11:10 +00:00

58 lines
1.1 KiB
C

/* SPDX-License-Identifier: GPL-2.0-or-later */
#ifndef __RENDER_BMP_H__
#define __RENDER_BMP_H__
#ifndef OFFSET_OF
#if (defined (__GNUC__) && __GNUC__ >= 4) || defined (__clang__)
#define OFFSET_OF(TYPE, Field) ((size_t) __builtin_offsetof(TYPE, Field))
#endif
#endif
#ifndef OFFSET_OF
#define OFFSET_OF(TYPE, Field) ((size_t) &(((TYPE *)0)->Field))
#endif
#pragma pack(1)
struct bmp_color_map {
uint8_t Blue;
uint8_t Green;
uint8_t Red;
uint8_t Reserved;
};
struct bmp_image_header {
char CharB; // 'B'
char CharM; // 'M'
uint32_t Size;
uint16_t Reserved[2];
uint32_t ImageOffset;
uint32_t HeaderSize;
uint32_t PixelWidth;
uint32_t PixelHeight;
uint16_t Planes;
uint16_t BitPerPixel; // 1, 4, 8, 24 or 32
uint32_t CompressionType;
uint32_t ImageSize; // Compressed image size in bytes
uint32_t XPixelsPerMeter;
uint32_t YPixelsPerMeter;
uint32_t NumberOfColors;
uint32_t ImportantColors;
};
struct blt_pixel {
uint8_t Blue;
uint8_t Green;
uint8_t Red;
uint8_t Reserved;
};
struct logo_coordinates {
uint32_t x;
uint32_t y;
};
#pragma pack()
#endif // __RENDER_BMP_H__