1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-01-29 16:51:30 +00:00

refactor(core): rename xframebuffer to framebuffer

[no changelog]
This commit is contained in:
cepetr 2024-11-13 11:04:53 +01:00 committed by cepetr
parent d4286ff584
commit c11dc5dcd3
25 changed files with 66 additions and 66 deletions

View File

@ -15,7 +15,7 @@ micropython = []
protobuf = ["micropython"]
ui = []
dma2d = []
xframebuffer = []
framebuffer = []
display_mono = []
display_rgb565 = ["ui_antialiasing"]
display_rgba8888 = ["ui_antialiasing"]

View File

@ -138,9 +138,9 @@ fn prepare_bindings() -> bindgen::Builder {
let bindgen_macros_env = env::var("BINDGEN_MACROS").ok();
add_bindgen_macros(&mut clang_args, bindgen_macros_env.as_deref());
#[cfg(feature = "xframebuffer")]
#[cfg(feature = "framebuffer")]
{
bindings = bindings.clang_args(&["-DXFRAMEBUFFER"]);
bindings = bindings.clang_args(&["-DFRAMEBUFFER"]);
}
clang_args.push(&build_dir_include);

View File

@ -1,6 +1,6 @@
use super::ffi;
#[cfg(feature = "xframebuffer")]
#[cfg(feature = "framebuffer")]
use core::ptr;
pub use ffi::{DISPLAY_RESX, DISPLAY_RESY};
@ -52,7 +52,7 @@ pub fn refresh() {
}
}
#[cfg(feature = "xframebuffer")]
#[cfg(feature = "framebuffer")]
pub fn get_frame_buffer() -> (&'static mut [u8], usize) {
let mut fb_info = ffi::display_fb_info_t {
ptr: ptr::null_mut(),

View File

@ -11,12 +11,12 @@ use without_alloc::alloc::LocalAllocLeakExt;
const ALIGN_PAD: usize = 8;
#[cfg(feature = "xframebuffer")]
#[cfg(feature = "framebuffer")]
const ZLIB_CACHE_SLOTS: usize = 1;
#[cfg(not(feature = "xframebuffer"))]
#[cfg(not(feature = "framebuffer"))]
const ZLIB_CACHE_SLOTS: usize = 3;
#[cfg(not(feature = "xframebuffer"))]
#[cfg(not(feature = "framebuffer"))]
const RENDER_BUFF_SIZE: usize = (240 * 2 * 16) + ALIGN_PAD;
#[cfg(feature = "ui_overlay")]
@ -26,12 +26,12 @@ const IMAGE_BUFF_SIZE: usize = 2048 + ALIGN_PAD;
pub type ImageBuff = [u8; IMAGE_BUFF_SIZE];
#[cfg(not(feature = "xframebuffer"))]
#[cfg(not(feature = "framebuffer"))]
pub type RenderBuff = [u8; RENDER_BUFF_SIZE];
pub type ImageBuffRef<'a> = RefMut<'a, ImageBuff>;
#[cfg(not(feature = "xframebuffer"))]
#[cfg(not(feature = "framebuffer"))]
pub type RenderBuffRef<'a> = RefMut<'a, RenderBuff>;
pub struct DrawingCache<'a> {
@ -44,7 +44,7 @@ pub struct DrawingCache<'a> {
#[cfg(feature = "ui_blurring")]
blur_cache: RefCell<BlurCache<'a>>,
#[cfg(not(feature = "xframebuffer"))]
#[cfg(not(feature = "framebuffer"))]
render_buff: &'a RefCell<RenderBuff>,
}
@ -72,7 +72,7 @@ impl<'a> DrawingCache<'a> {
#[cfg(feature = "ui_blurring")]
blur_cache: RefCell::new(unwrap!(BlurCache::new(bump_a), "Blur cache alloc")),
#[cfg(not(feature = "xframebuffer"))]
#[cfg(not(feature = "framebuffer"))]
render_buff: unwrap!(alloc_buf(bump_b), "Render buff alloc"),
}
}
@ -95,7 +95,7 @@ impl<'a> DrawingCache<'a> {
}
/// Returns a buffer used for ProgressiveRenderer slice
#[cfg(not(feature = "xframebuffer"))]
#[cfg(not(feature = "framebuffer"))]
pub fn render_buff(&self) -> Option<RenderBuffRef<'a>> {
self.render_buff.try_borrow_mut().ok()
}
@ -127,7 +127,7 @@ impl<'a> DrawingCache<'a> {
pub const fn get_bump_b_size() -> usize {
let mut size = 0;
#[cfg(not(feature = "xframebuffer"))]
#[cfg(not(feature = "framebuffer"))]
{
size += core::mem::size_of::<RefCell<RenderBuff>>();
}

View File

@ -4,17 +4,17 @@ use static_alloc::Bump;
/// Memory reserved for `ProgressiveRenderer`s shape storage.
/// ProgressiveRenderer is used if framebuffer is not available.
#[cfg(not(feature = "xframebuffer"))]
#[cfg(not(feature = "framebuffer"))]
pub const SHAPE_MEM_SIZE: usize = 5 * 1024;
#[cfg(feature = "xframebuffer")]
#[cfg(feature = "framebuffer")]
pub const SHAPE_MEM_SIZE: usize = 0;
/// Maximum number of shapes on a single screen
/// (if you change it, you will probably need to change
/// the memory size above)
#[cfg(not(feature = "xframebuffer"))]
#[cfg(not(feature = "framebuffer"))]
pub const SHAPE_MAX_COUNT: usize = 45;
#[cfg(feature = "xframebuffer")]
#[cfg(feature = "framebuffer")]
pub const SHAPE_MAX_COUNT: usize = 0;
/// Size of `bump_a` memory that might not be accessible by DMA

View File

@ -4,18 +4,18 @@ mod direct_canvas;
pub use direct_canvas::render_on_canvas;
pub mod fake_display;
#[cfg(all(feature = "xframebuffer", feature = "display_mono"))]
#[cfg(all(feature = "framebuffer", feature = "display_mono"))]
pub mod fb_mono8;
#[cfg(all(feature = "xframebuffer", feature = "display_rgb565"))]
#[cfg(all(feature = "framebuffer", feature = "display_rgb565"))]
pub mod fb_rgb565;
#[cfg(all(feature = "xframebuffer", feature = "display_rgba8888",))]
#[cfg(all(feature = "framebuffer", feature = "display_rgba8888",))]
pub mod fb_rgba8888;
#[cfg(all(not(feature = "xframebuffer"), feature = "display_rgb565"))]
#[cfg(all(not(feature = "framebuffer"), feature = "display_rgb565"))]
pub mod nofb_rgb565;
mod _new_rendering {
#[cfg(not(feature = "xframebuffer"))]
mod _xframebuffer {
#[cfg(not(feature = "framebuffer"))]
mod _framebuffer {
#[cfg(feature = "display_rgb565")]
pub use super::super::nofb_rgb565::{render_on_display, ConcreteRenderer};
@ -23,8 +23,8 @@ mod _new_rendering {
pub use super::super::fake_display::{render_on_display, ConcreteRenderer};
}
#[cfg(feature = "xframebuffer")]
mod _xframebuffer {
#[cfg(feature = "framebuffer")]
mod _framebuffer {
#[cfg(feature = "display_rgb565")]
pub use super::super::fb_rgb565::{render_on_display, ConcreteRenderer};
@ -39,7 +39,7 @@ mod _new_rendering {
pub use super::super::fb_mono8::{render_on_display, ConcreteRenderer};
}
pub use _xframebuffer::{render_on_display, ConcreteRenderer};
pub use _framebuffer::{render_on_display, ConcreteRenderer};
}
pub use _new_rendering::{render_on_display, ConcreteRenderer};

View File

@ -10,7 +10,7 @@ mod corner_highlight;
mod display;
#[cfg(feature = "ui_jpeg_decoder")]
mod jpeg;
#[cfg(not(feature = "xframebuffer"))]
#[cfg(not(feature = "framebuffer"))]
mod progressive_render;
mod qrcode;
mod rawimage;
@ -33,7 +33,7 @@ pub use corner_highlight::CornerHighlight;
pub use display::{render_on_canvas, render_on_display, unlock_bumps_on_failure, ConcreteRenderer};
#[cfg(feature = "ui_jpeg_decoder")]
pub use jpeg::JpegImage;
#[cfg(not(feature = "xframebuffer"))]
#[cfg(not(feature = "framebuffer"))]
pub use progressive_render::ProgressiveRenderer;
pub use qrcode::QrImage;
pub use rawimage::RawImage;

View File

@ -102,7 +102,7 @@ int display_set_orientation(int angle);
// Returned value is one of 0, 90, 180, 270.
int display_get_orientation(void);
#ifdef XFRAMEBUFFER
#ifdef FRAMEBUFFER
typedef struct {
// Pointer to the top-left pixel
@ -120,7 +120,7 @@ typedef struct {
// Return `false` if the framebuffer is not available.
bool display_get_frame_buffer(display_fb_info_t *fb);
#else // XFRAMEBUFFER
#else // FRAMEBUFFER
// Waits for the vertical synchronization pulse.
//

View File

@ -150,7 +150,7 @@ __attribute((no_stack_protector)) void syscall_handler(uint32_t *args,
args[0] = display_get_orientation();
} break;
#if XFRAMEBUFFER
#if FRAMEBUFFER
case SYSCALL_DISPLAY_GET_FB_INFO: {
display_fb_info_t *fb = (display_fb_info_t *)args[0];
args[0] = (uint32_t)display_get_frame_buffer__verified(fb);

View File

@ -122,13 +122,13 @@ int display_get_orientation(void) {
return (int)syscall_invoke0(SYSCALL_DISPLAY_GET_ORIENTATION);
}
#ifdef XFRAMEBUFFER
#ifdef FRAMEBUFFER
bool display_get_frame_buffer(display_fb_info_t *fb) {
return (bool)syscall_invoke1((uint32_t)fb, SYSCALL_DISPLAY_GET_FB_INFO);
}
#else // XFRAMEBUFFER
#else // FRAMEBUFFER
void display_wait_for_sync(void) {
syscall_invoke0(SYSCALL_DISPLAY_WAIT_FOR_SYNC);

View File

@ -131,7 +131,7 @@ access_violation:
// ---------------------------------------------------------------------
#ifdef XFRAMEBUFFER
#ifdef FRAMEBUFFER
bool display_get_frame_buffer__verified(display_fb_info_t *fb) {
if (!probe_write_access(fb, sizeof(*fb))) {
@ -151,7 +151,7 @@ access_violation:
return false;
}
#endif // XFRAMEBUFFER
#endif // FRAMEBUFFER
void display_fill__verified(const gfx_bitblt_t *bb) {
if (!probe_read_access(bb, sizeof(*bb))) {

View File

@ -42,7 +42,7 @@ void reboot_and_upgrade__verified(const uint8_t hash[32]);
// ---------------------------------------------------------------------
#include "display.h"
#ifdef XFRAMEBUFFER
#ifdef FRAMEBUFFER
bool display_get_frame_buffer__verified(display_fb_info_t *fb);
#endif

View File

@ -72,7 +72,7 @@ void display_init(display_content_mode_t mode) {
backlight_pwm_init(BACKLIGHT_RETAIN);
}
#ifdef XFRAMEBUFFER
#ifdef FRAMEBUFFER
#ifndef BOARDLOADER
display_io_init_te_interrupt();
#endif
@ -88,7 +88,7 @@ void display_deinit(display_content_mode_t mode) {
return;
}
#ifdef XFRAMEBUFFER
#ifdef FRAMEBUFFER
#ifndef BOARDLOADER
// Ensure that the ready frame buffer is transfered to
// the display controller
@ -122,7 +122,7 @@ int display_set_backlight(int level) {
return 0;
}
#ifdef XFRAMEBUFFER
#ifdef FRAMEBUFFER
#ifndef BOARDLOADER
// if turning on the backlight, wait until the panel is refreshed
if (backlight_pwm_get() < level && !is_mode_exception()) {
@ -147,7 +147,7 @@ int display_set_orientation(int angle) {
if (angle == 0 || angle == 90 || angle == 180 || angle == 270) {
drv->orientation_angle = angle;
#ifdef XFRAMEBUFFER
#ifdef FRAMEBUFFER
display_physical_fb_clear();
#endif

View File

@ -22,13 +22,13 @@
#include <trezor_types.h>
#ifdef XFRAMEBUFFER
#ifdef FRAMEBUFFER
// Clears both physical frame buffers
void display_physical_fb_clear(void);
void display_ensure_refreshed(void);
#endif // XFRAMEBUFFER
#endif // FRAMEBUFFER
#endif // TREZORHAL_DISPLAY_FB_H

View File

@ -4,7 +4,7 @@
#include <trezor_bsp.h>
#include <trezor_types.h>
#ifdef XFRAMEBUFFER
#ifdef FRAMEBUFFER
// Number of frame buffers used (1 or 2)
// If 1 buffer is selected, some animations may not
@ -38,14 +38,14 @@ typedef struct {
} frame_buffer_queue_t;
#endif // XFRAMEBUFFER
#endif // FRAMEBUFFER
// Display driver state
typedef struct {
// Set if the driver is initialized
bool initialized;
#ifdef XFRAMEBUFFER
#ifdef FRAMEBUFFER
// Framebuffer queue
// (accessed & updated in the context of the main thread
// and the interrupt context)

View File

@ -268,7 +268,7 @@ int display_get_orientation(void) {
return drv->orientation_angle;
}
#ifdef XFRAMEBUFFER
#ifdef FRAMEBUFFER
bool display_get_frame_buffer(display_fb_info_t *fb) {
display_driver_t *drv = &g_display_driver;
@ -288,7 +288,7 @@ bool display_get_frame_buffer(display_fb_info_t *fb) {
return true;
}
#else // XFRAMEBUFFER
#else // FRAMEBUFFER
void display_wait_for_sync(void) {
// not implemented in the emulator

View File

@ -51,9 +51,9 @@ def configure(
defines += ["USE_RGB_COLORS=1"]
features_available.append("dma2d")
defines += ["XFRAMEBUFFER"]
defines += ["FRAMEBUFFER"]
defines += ["DISPLAY_RGB565"]
features_available.append("xframebuffer")
features_available.append("framebuffer")
features_available.append("display_rgb565")
sources += ["embed/trezorhal/stm32f4/sdram.c"]

View File

@ -78,9 +78,9 @@ def configure(
features_available.append("dma2d")
features_available.append("ui_color_32bit")
defines += ["XFRAMEBUFFER"]
defines += ["FRAMEBUFFER"]
defines += ["DISPLAY_RGBA8888"]
features_available.append("xframebuffer")
features_available.append("framebuffer")
features_available.append("display_rgba8888")
defines += [

View File

@ -17,8 +17,8 @@ def configure(
hw_revision = 0
mcu = "STM32F427xx"
defines += ["XFRAMEBUFFER", "DISPLAY_MONO"]
features_available.append("xframebuffer")
defines += ["FRAMEBUFFER", "DISPLAY_MONO"]
features_available.append("framebuffer")
features_available.append("display_mono")
defines += [mcu]

View File

@ -16,8 +16,8 @@ def configure(
hw_revision = 10
board = "T2B1/boards/trezor_r_v10.h"
defines += ["XFRAMEBUFFER"]
features_available.append("xframebuffer")
defines += ["FRAMEBUFFER"]
features_available.append("framebuffer")
features_available.append("display_mono")
mcu = "STM32F427xx"

View File

@ -17,8 +17,8 @@ def configure(
hw_revision = 0
mcu = "STM32U585xx"
defines += ["XFRAMEBUFFER", "DISPLAY_MONO"]
features_available.append("xframebuffer")
defines += ["FRAMEBUFFER", "DISPLAY_MONO"]
features_available.append("framebuffer")
features_available.append("display_mono")
defines += [mcu]

View File

@ -16,8 +16,8 @@ def configure(
hw_model = get_hw_model_as_number("T3B1")
hw_revision = "B"
defines += ["XFRAMEBUFFER"]
features_available.append("xframebuffer")
defines += ["FRAMEBUFFER"]
features_available.append("framebuffer")
features_available.append("display_mono")
mcu = "STM32U585xx"

View File

@ -17,8 +17,8 @@ def configure(
hw_revision = 0
mcu = "STM32U585xx"
defines += ["XFRAMEBUFFER", "DISPLAY_RGB565"]
features_available.append("xframebuffer")
defines += ["FRAMEBUFFER", "DISPLAY_RGB565"]
features_available.append("framebuffer")
features_available.append("display_rgb565")
defines += ["USE_RGB_COLORS=1"]

View File

@ -16,10 +16,10 @@ def configure(
hw_model = get_hw_model_as_number("T3T1")
hw_revision = 0
features_available.append("xframebuffer")
features_available.append("framebuffer")
features_available.append("display_rgb565")
defines += ["DISPLAY_RGB565"]
defines += ["XFRAMEBUFFER"]
defines += ["FRAMEBUFFER"]
defines += ["USE_RGB_COLORS=1"]
mcu = "STM32U585xx"

View File

@ -17,8 +17,8 @@ def configure(
hw_revision = 0
mcu = "STM32F427xx"
defines += ["XFRAMEBUFFER", "DISPLAY_RGBA8888", "UI_COLOR_32BIT"]
features_available.append("xframebuffer")
defines += ["FRAMEBUFFER", "DISPLAY_RGBA8888", "UI_COLOR_32BIT"]
features_available.append("framebuffer")
features_available.append("display_rgba8888")
features_available.append("ui_color_32bit")
defines += ["USE_RGB_COLORS=1"]