summaryrefslogtreecommitdiffstats
path: root/include/grub/efi/graphics_output.h
blob: e4388127c6653ba516130c2759216bd84ab60b0a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
/*
 *  GRUB  --  GRand Unified Bootloader
 *  Copyright (C) 2009  Free Software Foundation, Inc.
 *
 *  GRUB is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  GRUB is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef GRUB_EFI_GOP_HEADER
#define GRUB_EFI_GOP_HEADER	1

/* Based on UEFI specification.  */

#define GRUB_EFI_GOP_GUID \
  { 0x9042a9de, 0x23dc, 0x4a38, { 0x96, 0xfb, 0x7a, 0xde, 0xd0, 0x80, 0x51, 0x6a }}

typedef enum
  {
    GRUB_EFI_GOT_RGBA8,
    GRUB_EFI_GOT_BGRA8,
    GRUB_EFI_GOT_BITMASK,
    GRUB_EFI_GOT_BLT_ONLY,
  }
  grub_efi_gop_pixel_format_t;

typedef enum
  {
    GRUB_EFI_BLT_VIDEO_FILL,
    GRUB_EFI_BLT_VIDEO_TO_BLT_BUFFER,
    GRUB_EFI_BLT_BUFFER_TO_VIDEO,
    GRUB_EFI_BLT_VIDEO_TO_VIDEO,
    GRUB_EFI_BLT_OPERATION_MAX
  }
  grub_efi_gop_blt_operation_t;

struct grub_efi_gop_blt_pixel
{
  grub_uint8_t blue;
  grub_uint8_t green;
  grub_uint8_t red;
  grub_uint8_t reserved;
};

struct grub_efi_gop_pixel_bitmask
{
  grub_uint32_t r;
  grub_uint32_t g;
  grub_uint32_t b;
  grub_uint32_t a;
};

struct grub_efi_gop_mode_info
{
  grub_efi_uint32_t version;
  grub_efi_uint32_t width;
  grub_efi_uint32_t height;
  grub_efi_gop_pixel_format_t pixel_format;
  struct grub_efi_gop_pixel_bitmask pixel_bitmask;
  grub_efi_uint32_t pixels_per_scanline;
};

struct grub_efi_gop_mode
{
  grub_efi_uint32_t max_mode;
  grub_efi_uint32_t mode;
  struct grub_efi_gop_mode_info *info;
  grub_efi_uintn_t info_size;
  grub_efi_physical_address_t fb_base;
  grub_efi_uintn_t fb_size;
};

/* Forward declaration.  */
struct grub_efi_gop;

typedef grub_efi_status_t
(*grub_efi_gop_query_mode_t) (struct grub_efi_gop *this,
			      grub_efi_uint32_t mode_number,
			      grub_efi_uintn_t *size_of_info,
			      struct grub_efi_gop_mode_info **info);

typedef grub_efi_status_t
(*grub_efi_gop_set_mode_t) (struct grub_efi_gop *this,
			    grub_efi_uint32_t mode_number);

typedef grub_efi_status_t
(*grub_efi_gop_blt_t) (struct grub_efi_gop *this,
		       void *buffer,
		       grub_efi_uintn_t operation,
		       grub_efi_uintn_t sx,
		       grub_efi_uintn_t sy,
		       grub_efi_uintn_t dx,
		       grub_efi_uintn_t dy,
		       grub_efi_uintn_t width,
		       grub_efi_uintn_t height,
		       grub_efi_uintn_t delta);

struct grub_efi_gop
{
  grub_efi_gop_query_mode_t query_mode;
  grub_efi_gop_set_mode_t set_mode;
  grub_efi_gop_blt_t blt;
  struct grub_efi_gop_mode *mode;
};

#endif