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.
11uint32_t get_gfx_mode();
12
13// Gets the maximum framebuffer graphics mode index.
14uint32_t get_gfx_max_mode();
15
16// Returns the horizontal or vertical resolution of the current mode.
17uint32_t get_gfx_hres();
18uint32_t get_gfx_vres();
19
20// Sets the framebuffer graphics mode.
21void 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.
26void set_gfx_mode_from_cmdline(const char* fbres);
27
28// Print all the supported framebuffer modes to the system console.
29void print_fb_modes();
30
31// Clears the screen and draws the Fuchsia logo.
32void draw_logo();
33
34typedef 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.
42void draw_text(const char* text, size_t length, fb_font* font, int x, int y);
43void draw_version(const char*);
44
45// Draws nodename in appropriate location based on mode.
46void draw_nodename(const char* text);
47