1 // Copyright 2016 The Fuchsia Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #pragma once
6 
7 #include <efi/protocol/graphics-output.h>
8 #include <efi/system-table.h>
9 
10 // Gets the current framebuffer graphics mode.
11 uint32_t get_gfx_mode(void);
12 
13 // Gets the maximum framebuffer graphics mode index.
14 uint32_t get_gfx_max_mode(void);
15 
16 // Returns the horizontal or vertical resolution of the current mode.
17 uint32_t get_gfx_hres(void);
18 uint32_t get_gfx_vres(void);
19 
20 // Sets the framebuffer graphics mode.
21 void set_gfx_mode(uint32_t mode);
22 
23 // Sets the graphics mode based on a string of the form "WxH" where W and H are
24 // integers representing width and height of the mode. This is usually obtained
25 // from the bootloader.fbres commandline argument.
26 void set_gfx_mode_from_cmdline(const char* fbres);
27 
28 // Print all the supported framebuffer modes to the system console.
29 void print_fb_modes(void);
30 
31 // Clears the screen and draws the Fuchsia logo.
32 void draw_logo(void);
33 
34 typedef struct font_t {
35     const uint16_t* data;
36     unsigned width;
37     unsigned height;
38     efi_graphics_output_blt_pixel* color;
39 } fb_font;
40 
41 // Draws provided text at coordinate x and y of the framebuffer.
42 void draw_text(const char* text, size_t length, fb_font* font, int x, int y);
43 void draw_version(const char*);
44 
45 // Draws nodename in appropriate location based on mode.
46 void draw_nodename(const char* text);
47