2 * GRUB -- GRand Unified Bootloader
3 * Copyright (C) 2006,2007,2008,2009 Free Software Foundation, Inc.
5 * GRUB is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * GRUB is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
19 #ifndef GRUB_VIDEO_HEADER
20 #define GRUB_VIDEO_HEADER 1
23 #include <grub/types.h>
24 #include <grub/list.h>
26 /* Video color in hardware dependent format. Users should not assume any
27 specific coding format. */
28 typedef grub_uint32_t grub_video_color_t
;
30 /* Video color in hardware independent format. */
31 typedef struct grub_video_rgba_color
37 } grub_video_rgba_color_t
;
39 /* This structure is driver specific and should not be accessed directly by
41 struct grub_video_render_target
;
43 /* Forward declarations for used data structures. */
44 struct grub_video_bitmap
;
46 /* Defines used to describe video mode or rendering target. */
47 /* If following is set render target contains currenly displayed image
48 after swapping buffers (otherwise it contains previously displayed image).
50 typedef enum grub_video_mode_type
52 GRUB_VIDEO_MODE_TYPE_RGB
= 0x00000001,
53 GRUB_VIDEO_MODE_TYPE_INDEX_COLOR
= 0x00000002,
54 GRUB_VIDEO_MODE_TYPE_1BIT_BITMAP
= 0x00000004,
55 GRUB_VIDEO_MODE_TYPE_YUV
= 0x00000008,
57 /* Defines used to mask flags. */
58 GRUB_VIDEO_MODE_TYPE_COLOR_MASK
= 0x0000000F,
60 GRUB_VIDEO_MODE_TYPE_DOUBLE_BUFFERED
= 0x00000010,
61 GRUB_VIDEO_MODE_TYPE_ALPHA
= 0x00000020,
62 GRUB_VIDEO_MODE_TYPE_PURE_TEXT
= 0x00000040,
63 GRUB_VIDEO_MODE_TYPE_UPDATING_SWAP
= 0x00000080,
64 GRUB_VIDEO_MODE_TYPE_OPERATIONAL_MASK
= 0x000000F0,
66 /* Defines used to specify requested bit depth. */
67 GRUB_VIDEO_MODE_TYPE_DEPTH_MASK
= 0x0000FF00,
68 #define GRUB_VIDEO_MODE_TYPE_DEPTH_POS 8
70 GRUB_VIDEO_MODE_TYPE_UNKNOWN
= 0x00010000,
71 GRUB_VIDEO_MODE_TYPE_HERCULES
= 0x00020000,
72 GRUB_VIDEO_MODE_TYPE_PLANAR
= 0x00040000,
73 GRUB_VIDEO_MODE_TYPE_NONCHAIN4
= 0x00080000,
74 GRUB_VIDEO_MODE_TYPE_CGA
= 0x00100000,
75 GRUB_VIDEO_MODE_TYPE_INFO_MASK
= 0x00FF0000,
76 } grub_video_mode_type_t
;
78 /* The basic render target representing the whole display. This always
79 renders to the back buffer when double-buffering is in use. */
80 #define GRUB_VIDEO_RENDER_TARGET_DISPLAY \
81 ((struct grub_video_render_target *) 0)
83 /* Defined blitting formats. */
84 enum grub_video_blit_format
86 /* Generic RGBA, use fields & masks. */
87 GRUB_VIDEO_BLIT_FORMAT_RGBA
,
89 /* Optimized RGBA's. */
90 GRUB_VIDEO_BLIT_FORMAT_RGBA_8888
,
91 GRUB_VIDEO_BLIT_FORMAT_BGRA_8888
,
93 /* Generic RGB, use fields & masks. */
94 GRUB_VIDEO_BLIT_FORMAT_RGB
,
96 /* Optimized RGB's. */
97 GRUB_VIDEO_BLIT_FORMAT_RGB_888
,
98 GRUB_VIDEO_BLIT_FORMAT_BGR_888
,
99 GRUB_VIDEO_BLIT_FORMAT_RGB_565
,
100 GRUB_VIDEO_BLIT_FORMAT_BGR_565
,
102 /* When needed, decode color or just use value as is. */
103 GRUB_VIDEO_BLIT_FORMAT_INDEXCOLOR
,
104 /* Like index but only 16-colors and F0 is a special value for transparency.
105 Could be extended to 4 bits of alpha and 4 bits of color if necessary.
106 Used internally for text rendering.
108 GRUB_VIDEO_BLIT_FORMAT_INDEXCOLOR_ALPHA
,
110 /* Two color bitmap; bits packed: rows are not padded to byte boundary. */
111 GRUB_VIDEO_BLIT_FORMAT_1BIT_PACKED
114 /* Define blitting operators. */
115 enum grub_video_blit_operators
117 /* Replace target bitmap data with source. */
118 GRUB_VIDEO_BLIT_REPLACE
,
119 /* Blend target and source based on source's alpha value. */
120 GRUB_VIDEO_BLIT_BLEND
123 struct grub_video_mode_info
125 /* Width of the screen. */
128 /* Height of the screen. */
131 /* Mode type bitmask. Contains information like is it Index color or
133 grub_video_mode_type_t mode_type
;
135 /* Bits per pixel. */
138 /* Bytes per pixel. */
139 unsigned int bytes_per_pixel
;
141 /* Pitch of one scanline. How many bytes there are for scanline. */
144 /* In index color mode, number of colors. In RGB mode this is 256. */
145 unsigned int number_of_colors
;
147 unsigned int mode_number
;
148 #define GRUB_VIDEO_MODE_NUMBER_INVALID 0xffffffff
150 /* Optimization hint how binary data is coded. */
151 enum grub_video_blit_format blit_format
;
153 /* How many bits are reserved for red color. */
154 unsigned int red_mask_size
;
156 /* What is location of red color bits. In Index Color mode, this is 0. */
157 unsigned int red_field_pos
;
159 /* How many bits are reserved for green color. */
160 unsigned int green_mask_size
;
162 /* What is location of green color bits. In Index Color mode, this is 0. */
163 unsigned int green_field_pos
;
165 /* How many bits are reserved for blue color. */
166 unsigned int blue_mask_size
;
168 /* What is location of blue color bits. In Index Color mode, this is 0. */
169 unsigned int blue_field_pos
;
171 /* How many bits are reserved in color. */
172 unsigned int reserved_mask_size
;
174 /* What is location of reserved color bits. In Index Color mode,
176 unsigned int reserved_field_pos
;
178 /* For 1-bit bitmaps, the background color. Used for bits = 0. */
180 grub_uint8_t bg_green
;
181 grub_uint8_t bg_blue
;
182 grub_uint8_t bg_alpha
;
184 /* For 1-bit bitmaps, the foreground color. Used for bits = 1. */
186 grub_uint8_t fg_green
;
187 grub_uint8_t fg_blue
;
188 grub_uint8_t fg_alpha
;
191 /* A 2D rectangle type. */
192 struct grub_video_rect
199 typedef struct grub_video_rect grub_video_rect_t
;
201 struct grub_video_signed_rect
208 typedef struct grub_video_signed_rect grub_video_signed_rect_t
;
210 struct grub_video_palette_data
212 grub_uint8_t r
; /* Red color value (0-255). */
213 grub_uint8_t g
; /* Green color value (0-255). */
214 grub_uint8_t b
; /* Blue color value (0-255). */
215 grub_uint8_t a
; /* Reserved bits value (0-255). */
218 struct grub_video_edid_info
220 grub_uint8_t header
[8];
221 grub_uint16_t manufacturer_id
;
222 grub_uint16_t product_id
;
223 grub_uint32_t serial_number
;
224 grub_uint8_t week_of_manufacture
;
225 grub_uint8_t year_of_manufacture
;
226 grub_uint8_t version
;
227 grub_uint8_t revision
;
229 grub_uint8_t video_input_definition
;
230 grub_uint8_t max_horizontal_image_size
;
231 grub_uint8_t max_vertical_image_size
;
232 grub_uint8_t display_gamma
;
233 grub_uint8_t feature_support
;
234 #define GRUB_VIDEO_EDID_FEATURE_PREFERRED_TIMING_MODE (1 << 1)
236 grub_uint8_t red_green_lo
;
237 grub_uint8_t blue_white_lo
;
238 grub_uint8_t red_x_hi
;
239 grub_uint8_t red_y_hi
;
240 grub_uint8_t green_x_hi
;
241 grub_uint8_t green_y_hi
;
242 grub_uint8_t blue_x_hi
;
243 grub_uint8_t blue_y_hi
;
244 grub_uint8_t white_x_hi
;
245 grub_uint8_t white_y_hi
;
247 grub_uint8_t established_timings_1
;
248 grub_uint8_t established_timings_2
;
249 grub_uint8_t manufacturer_reserved_timings
;
251 grub_uint16_t standard_timings
[8];
254 grub_uint16_t pixel_clock
;
255 /* Only valid if the pixel clock is non-null. */
256 grub_uint8_t horizontal_active_lo
;
257 grub_uint8_t horizontal_blanking_lo
;
258 grub_uint8_t horizontal_hi
;
259 grub_uint8_t vertical_active_lo
;
260 grub_uint8_t vertical_blanking_lo
;
261 grub_uint8_t vertical_hi
;
262 grub_uint8_t horizontal_sync_offset_lo
;
263 grub_uint8_t horizontal_sync_pulse_width_lo
;
264 grub_uint8_t vertical_sync_lo
;
265 grub_uint8_t sync_hi
;
266 grub_uint8_t horizontal_image_size_lo
;
267 grub_uint8_t vertical_image_size_lo
;
268 grub_uint8_t image_size_hi
;
269 grub_uint8_t horizontal_border
;
270 grub_uint8_t vertical_border
;
272 } detailed_timings
[4];
274 grub_uint8_t extension_flag
;
275 grub_uint8_t checksum
;
278 typedef enum grub_video_driver_id
280 GRUB_VIDEO_DRIVER_NONE
,
281 GRUB_VIDEO_DRIVER_VBE
,
282 GRUB_VIDEO_DRIVER_EFI_UGA
,
283 GRUB_VIDEO_DRIVER_EFI_GOP
,
284 GRUB_VIDEO_DRIVER_SM712
,
285 GRUB_VIDEO_DRIVER_VGA
,
286 GRUB_VIDEO_DRIVER_CIRRUS
,
287 GRUB_VIDEO_DRIVER_BOCHS
,
288 GRUB_VIDEO_DRIVER_SDL
,
289 GRUB_VIDEO_DRIVER_SIS315PRO
,
290 GRUB_VIDEO_DRIVER_RADEON_FULOONG2E
,
291 GRUB_VIDEO_DRIVER_COREBOOT
,
292 GRUB_VIDEO_DRIVER_IEEE1275
,
293 GRUB_VIDEO_ADAPTER_CAPTURE
,
294 GRUB_VIDEO_DRIVER_XEN
,
295 GRUB_VIDEO_DRIVER_RADEON_YEELOONG3A
296 } grub_video_driver_id_t
;
298 typedef enum grub_video_adapter_prio
300 GRUB_VIDEO_ADAPTER_PRIO_FALLBACK
= 60,
301 GRUB_VIDEO_ADAPTER_PRIO_FIRMWARE_DIRTY
= 70,
302 GRUB_VIDEO_ADAPTER_PRIO_FIRMWARE
= 80,
303 GRUB_VIDEO_ADAPTER_PRIO_NATIVE
= 100
304 } grub_video_adapter_prio_t
;
306 typedef enum grub_video_area_status
308 GRUB_VIDEO_AREA_DISABLED
,
309 GRUB_VIDEO_AREA_ENABLED
310 } grub_video_area_status_t
;
312 struct grub_video_adapter
314 /* The next video adapter. */
315 struct grub_video_adapter
*next
;
316 struct grub_video_adapter
**prev
;
318 /* The video adapter name. */
320 grub_video_driver_id_t id
;
322 grub_video_adapter_prio_t prio
;
324 /* Initialize the video adapter. */
325 grub_err_t (*init
) (void);
327 /* Clean up the video adapter. */
328 grub_err_t (*fini
) (void);
330 grub_err_t (*setup
) (unsigned int width
, unsigned int height
,
331 grub_video_mode_type_t mode_type
,
332 grub_video_mode_type_t mode_mask
);
334 grub_err_t (*get_info
) (struct grub_video_mode_info
*mode_info
);
336 grub_err_t (*get_info_and_fini
) (struct grub_video_mode_info
*mode_info
,
339 grub_err_t (*set_palette
) (unsigned int start
, unsigned int count
,
340 struct grub_video_palette_data
*palette_data
);
342 grub_err_t (*get_palette
) (unsigned int start
, unsigned int count
,
343 struct grub_video_palette_data
*palette_data
);
345 grub_err_t (*set_viewport
) (unsigned int x
, unsigned int y
,
346 unsigned int width
, unsigned int height
);
348 grub_err_t (*get_viewport
) (unsigned int *x
, unsigned int *y
,
349 unsigned int *width
, unsigned int *height
);
351 grub_err_t (*set_region
) (unsigned int x
, unsigned int y
,
352 unsigned int width
, unsigned int height
);
354 grub_err_t (*get_region
) (unsigned int *x
, unsigned int *y
,
355 unsigned int *width
, unsigned int *height
);
357 grub_err_t (*set_area_status
) (grub_video_area_status_t area_status
);
359 grub_err_t (*get_area_status
) (grub_video_area_status_t
*area_status
);
361 grub_video_color_t (*map_color
) (grub_uint32_t color_name
);
363 grub_video_color_t (*map_rgb
) (grub_uint8_t red
, grub_uint8_t green
,
366 grub_video_color_t (*map_rgba
) (grub_uint8_t red
, grub_uint8_t green
,
367 grub_uint8_t blue
, grub_uint8_t alpha
);
369 grub_err_t (*unmap_color
) (grub_video_color_t color
,
370 grub_uint8_t
*red
, grub_uint8_t
*green
,
371 grub_uint8_t
*blue
, grub_uint8_t
*alpha
);
373 grub_err_t (*fill_rect
) (grub_video_color_t color
, int x
, int y
,
374 unsigned int width
, unsigned int height
);
376 grub_err_t (*blit_bitmap
) (struct grub_video_bitmap
*bitmap
,
377 enum grub_video_blit_operators oper
,
378 int x
, int y
, int offset_x
, int offset_y
,
379 unsigned int width
, unsigned int height
);
381 grub_err_t (*blit_render_target
) (struct grub_video_render_target
*source
,
382 enum grub_video_blit_operators oper
,
383 int x
, int y
, int offset_x
, int offset_y
,
384 unsigned int width
, unsigned int height
);
386 grub_err_t (*scroll
) (grub_video_color_t color
, int dx
, int dy
);
388 grub_err_t (*swap_buffers
) (void);
390 grub_err_t (*create_render_target
) (struct grub_video_render_target
**result
,
391 unsigned int width
, unsigned int height
,
392 unsigned int mode_type
);
394 grub_err_t (*delete_render_target
) (struct grub_video_render_target
*target
);
396 grub_err_t (*set_active_render_target
) (struct grub_video_render_target
*target
);
398 grub_err_t (*get_active_render_target
) (struct grub_video_render_target
**target
);
400 int (*iterate
) (int (*hook
) (const struct grub_video_mode_info
*info
, void *hook_arg
), void *hook_arg
);
402 grub_err_t (*get_edid
) (struct grub_video_edid_info
*edid_info
);
404 void (*print_adapter_specific_info
) (void);
406 typedef struct grub_video_adapter
*grub_video_adapter_t
;
408 extern grub_video_adapter_t
EXPORT_VAR(grub_video_adapter_list
);
410 #ifndef GRUB_LST_GENERATOR
411 /* Register video driver. */
413 grub_video_register (grub_video_adapter_t adapter
)
415 grub_video_adapter_t
*p
;
416 for (p
= &grub_video_adapter_list
; *p
&& (*p
)->prio
> adapter
->prio
;
423 adapter
->next
->prev
= &adapter
->next
;
427 /* Unregister video driver. */
429 grub_video_unregister (grub_video_adapter_t adapter
)
431 grub_list_remove (GRUB_AS_LIST (adapter
));
434 #define FOR_VIDEO_ADAPTERS(var) FOR_LIST_ELEMENTS((var), (grub_video_adapter_list))
436 grub_err_t
EXPORT_FUNC (grub_video_restore
) (void);
438 grub_err_t
EXPORT_FUNC (grub_video_get_info
) (struct grub_video_mode_info
*mode_info
);
440 /* Framebuffer address may change as a part of normal operation
441 (e.g. double buffering). That's why you need to stop video subsystem to be
442 sure that framebuffer address doesn't change. To ensure this abstraction
443 grub_video_get_info_and_fini is the only function supplying framebuffer
445 grub_err_t
EXPORT_FUNC (grub_video_get_info_and_fini
) (struct grub_video_mode_info
*mode_info
,
448 enum grub_video_blit_format
EXPORT_FUNC(grub_video_get_blit_format
) (struct grub_video_mode_info
*mode_info
);
450 grub_err_t
grub_video_set_palette (unsigned int start
, unsigned int count
,
451 struct grub_video_palette_data
*palette_data
);
453 grub_err_t
EXPORT_FUNC (grub_video_get_palette
) (unsigned int start
,
455 struct grub_video_palette_data
*palette_data
);
457 grub_err_t
EXPORT_FUNC (grub_video_set_viewport
) (unsigned int x
,
460 unsigned int height
);
462 grub_err_t
EXPORT_FUNC (grub_video_get_viewport
) (unsigned int *x
,
465 unsigned int *height
);
467 grub_err_t
EXPORT_FUNC (grub_video_set_region
) (unsigned int x
,
470 unsigned int height
);
472 grub_err_t
EXPORT_FUNC (grub_video_get_region
) (unsigned int *x
,
475 unsigned int *height
);
477 grub_err_t
EXPORT_FUNC (grub_video_set_area_status
)
478 (grub_video_area_status_t area_status
);
480 grub_err_t
EXPORT_FUNC (grub_video_get_area_status
)
481 (grub_video_area_status_t
*area_status
);
483 grub_video_color_t
EXPORT_FUNC (grub_video_map_color
) (grub_uint32_t color_name
);
485 grub_video_color_t
EXPORT_FUNC (grub_video_map_rgb
) (grub_uint8_t red
,
489 grub_video_color_t
EXPORT_FUNC (grub_video_map_rgba
) (grub_uint8_t red
,
494 grub_err_t
EXPORT_FUNC (grub_video_unmap_color
) (grub_video_color_t color
,
498 grub_uint8_t
*alpha
);
500 grub_err_t
EXPORT_FUNC (grub_video_fill_rect
) (grub_video_color_t color
,
503 unsigned int height
);
505 grub_err_t
EXPORT_FUNC (grub_video_blit_bitmap
) (struct grub_video_bitmap
*bitmap
,
506 enum grub_video_blit_operators oper
,
508 int offset_x
, int offset_y
,
510 unsigned int height
);
512 grub_err_t
EXPORT_FUNC (grub_video_blit_render_target
) (struct grub_video_render_target
*source
,
513 enum grub_video_blit_operators oper
,
518 unsigned int height
);
520 grub_err_t
grub_video_scroll (grub_video_color_t color
, int dx
, int dy
);
522 grub_err_t
EXPORT_FUNC (grub_video_swap_buffers
) (void);
524 grub_err_t
EXPORT_FUNC (grub_video_create_render_target
) (struct grub_video_render_target
**result
,
527 unsigned int mode_type
);
529 grub_err_t
EXPORT_FUNC (grub_video_delete_render_target
) (struct grub_video_render_target
*target
);
531 grub_err_t
EXPORT_FUNC (grub_video_set_active_render_target
) (struct grub_video_render_target
*target
);
533 grub_err_t
grub_video_get_active_render_target (struct grub_video_render_target
**target
);
535 grub_err_t
EXPORT_FUNC (grub_video_edid_checksum
) (struct grub_video_edid_info
*edid_info
);
536 grub_err_t
EXPORT_FUNC (grub_video_edid_preferred_mode
) (struct grub_video_edid_info
*edid_info
,
538 unsigned int *height
);
540 grub_err_t
EXPORT_FUNC (grub_video_set_mode
) (const char *modestring
,
541 unsigned int modemask
,
542 unsigned int modevalue
);
545 grub_video_check_mode_flag (grub_video_mode_type_t flags
,
546 grub_video_mode_type_t mask
,
547 grub_video_mode_type_t flag
, int def
)
549 return (flag
& mask
) ? !! (flags
& flag
) : def
;
552 grub_video_driver_id_t
EXPORT_FUNC (grub_video_get_driver_id
) (void);
554 static __inline grub_video_rgba_color_t
555 grub_video_rgba_color_rgb (grub_uint8_t r
, grub_uint8_t g
, grub_uint8_t b
)
557 grub_video_rgba_color_t c
;
565 static __inline grub_video_color_t
566 grub_video_map_rgba_color (grub_video_rgba_color_t c
)
568 return grub_video_map_rgba (c
.red
, c
.green
, c
.blue
, c
.alpha
);
571 #ifndef GRUB_MACHINE_EMU
572 extern void grub_font_init (void);
573 extern void grub_font_fini (void);
574 extern void grub_gfxterm_init (void);
575 extern void grub_gfxterm_fini (void);
576 extern void grub_video_sm712_init (void);
577 extern void grub_video_sm712_fini (void);
578 extern void grub_video_sis315pro_init (void);
579 extern void grub_video_radeon_fuloong2e_init (void);
580 extern void grub_video_sis315pro_fini (void);
581 extern void grub_video_radeon_fuloong2e_fini (void);
582 extern void grub_video_radeon_yeeloong3a_init (void);
583 extern void grub_video_radeon_yeeloong3a_fini (void);
587 grub_video_set_adapter (grub_video_adapter_t adapter
);
589 grub_video_get_adapter (void);
591 grub_video_capture_start (const struct grub_video_mode_info
*mode_info
,
592 struct grub_video_palette_data
*palette
,
593 unsigned int palette_size
);
595 grub_video_capture_end (void);
598 grub_video_capture_get_framebuffer (void);
600 extern grub_video_adapter_t
EXPORT_VAR (grub_video_adapter_active
);
601 extern void (*grub_video_capture_refresh_cb
) (void);
603 #define GRUB_VIDEO_MI_RGB555(x) \
604 x.mode_type = GRUB_VIDEO_MODE_TYPE_RGB, \
606 x.bytes_per_pixel = 2, \
607 x.number_of_colors = 256, \
608 x.red_mask_size = 5, \
609 x.red_field_pos = 10, \
610 x.green_mask_size = 5, \
611 x.green_field_pos = 5, \
612 x.blue_mask_size = 5, \
615 #define GRUB_VIDEO_MI_RGB565(x) \
616 x.mode_type = GRUB_VIDEO_MODE_TYPE_RGB, \
618 x.bytes_per_pixel = 2, \
619 x.number_of_colors = 256, \
620 x.red_mask_size = 5, \
621 x.red_field_pos = 11, \
622 x.green_mask_size = 6, \
623 x.green_field_pos = 5, \
624 x.blue_mask_size = 5, \
627 #define GRUB_VIDEO_MI_RGB888(x) \
628 x.mode_type = GRUB_VIDEO_MODE_TYPE_RGB, \
630 x.bytes_per_pixel = 3, \
631 x.number_of_colors = 256, \
632 x.red_mask_size = 8, \
633 x.red_field_pos = 16, \
634 x.green_mask_size = 8, \
635 x.green_field_pos = 8, \
636 x.blue_mask_size = 8, \
639 #define GRUB_VIDEO_MI_RGBA8888(x) \
640 x.mode_type = GRUB_VIDEO_MODE_TYPE_RGB, \
642 x.bytes_per_pixel = 4, \
643 x.number_of_colors = 256, \
644 x.reserved_mask_size = 8, \
645 x.reserved_field_pos = 24, \
646 x.red_mask_size = 8, \
647 x.red_field_pos = 16, \
648 x.green_mask_size = 8, \
649 x.green_field_pos = 8, \
650 x.blue_mask_size = 8, \
654 #define GRUB_VIDEO_MI_BGR555(x) \
655 x.mode_type = GRUB_VIDEO_MODE_TYPE_RGB, \
657 x.bytes_per_pixel = 2, \
658 x.number_of_colors = 256, \
659 x.red_mask_size = 5, \
660 x.red_field_pos = 0, \
661 x.green_mask_size = 5, \
662 x.green_field_pos = 5, \
663 x.blue_mask_size = 5, \
664 x.blue_field_pos = 10
666 #define GRUB_VIDEO_MI_BGR565(x) \
667 x.mode_type = GRUB_VIDEO_MODE_TYPE_RGB, \
669 x.bytes_per_pixel = 2, \
670 x.number_of_colors = 256, \
671 x.red_mask_size = 5, \
672 x.red_field_pos = 0, \
673 x.green_mask_size = 6, \
674 x.green_field_pos = 5, \
675 x.blue_mask_size = 5, \
676 x.blue_field_pos = 11
678 #define GRUB_VIDEO_MI_BGR888(x) \
679 x.mode_type = GRUB_VIDEO_MODE_TYPE_RGB, \
681 x.bytes_per_pixel = 3, \
682 x.number_of_colors = 256, \
683 x.red_mask_size = 8, \
684 x.red_field_pos = 0, \
685 x.green_mask_size = 8, \
686 x.green_field_pos = 8, \
687 x.blue_mask_size = 8, \
688 x.blue_field_pos = 16
690 #define GRUB_VIDEO_MI_BGRA8888(x) \
691 x.mode_type = GRUB_VIDEO_MODE_TYPE_RGB, \
693 x.bytes_per_pixel = 4, \
694 x.number_of_colors = 256, \
695 x.reserved_mask_size = 8, \
696 x.reserved_field_pos = 24, \
697 x.red_mask_size = 8, \
698 x.red_field_pos = 0, \
699 x.green_mask_size = 8, \
700 x.green_field_pos = 8, \
701 x.blue_mask_size = 8, \
702 x.blue_field_pos = 16
704 #endif /* ! GRUB_VIDEO_HEADER */