xref: /haiku/headers/private/kernel/platform/efi/protocol/graphics-output.h (revision 485b5cf8bc00ab5aaee5db81a91d135dc61d9cc3)
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/types.h>
8 
9 #define EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID \
10     {0x9042a9de, 0x23dc, 0x4a38, {0x96, 0xfb, 0x7a, 0xde, 0xd0, 0x80, 0x51, 0x6a}}
11 extern efi_guid GraphicsOutputProtocol;
12 
13 typedef struct {
14     uint32_t RedMask;
15     uint32_t GreenMask;
16     uint32_t BlueMask;
17     uint32_t ReservedMask;
18 } efi_pixel_bitmask;
19 
20 typedef enum {
21     PixelRedGreenBlueReserved8BitPerColor,
22     PixelBlueGreenRedReserved8BitPerColor,
23     PixelBitMask,
24     PixelBltOnly,
25     PixelFormatMax
26 } efi_graphics_pixel_format;
27 
28 typedef struct {
29     uint32_t Version;
30     uint32_t HorizontalResolution;
31     uint32_t VerticalResolution;
32     efi_graphics_pixel_format PixelFormat;
33     efi_pixel_bitmask PixelInformation;
34     uint32_t PixelsPerScanLine;
35 } efi_graphics_output_mode_information;
36 
37 typedef struct {
38     uint32_t MaxMode;
39     uint32_t Mode;
40     efi_graphics_output_mode_information* Info;
41     size_t SizeOfInfo;
42     efi_physical_addr FrameBufferBase;
43     size_t FrameBufferSize;
44 } efi_graphics_output_mode;
45 
46 typedef struct {
47     uint8_t Blue;
48     uint8_t Green;
49     uint8_t Red;
50     uint8_t Reserved;
51 } efi_graphics_output_blt_pixel;
52 
53 typedef enum {
54     EfiBltVideoFill,
55     EfiBltVideoToBltBuffer,
56     EfiBltBufferToVideo,
57     EfiBltVideoToVideo,
58     EfiGraphicsOutputBltOperationMax
59 } efi_graphics_output_blt_operation;
60 
61 typedef struct efi_graphics_output_protocol {
62     efi_status (*QueryMode) (struct efi_graphics_output_protocol* self,
63                              uint32_t mode_num, size_t* info_len,
64                              efi_graphics_output_mode_information** info) EFIAPI;
65 
66     efi_status (*SetMode) (struct efi_graphics_output_protocol* self,
67                            uint32_t mode_num) EFIAPI;
68 
69     efi_status (*Blt) (struct efi_graphics_output_protocol* self,
70                        efi_graphics_output_blt_pixel* blt_buf,
71                        efi_graphics_output_blt_operation blt_operation,
72                        size_t src_x, size_t src_y, size_t dest_x, size_t dest_y,
73                        size_t width, size_t height, size_t delta) EFIAPI;
74 
75     efi_graphics_output_mode* Mode;
76 } efi_graphics_output_protocol;
77