Change video_mode_type to an enum, fix collisions and add a bit more info
This commit is contained in:
parent
d2467d2361
commit
4dd58a6edd
3 changed files with 39 additions and 21 deletions
|
@ -55,6 +55,10 @@ hook (const struct grub_video_mode_info *info)
|
|||
grub_printf ("Planar ");
|
||||
if (info->mode_type & GRUB_VIDEO_MODE_TYPE_HERCULES)
|
||||
grub_printf ("Hercules ");
|
||||
if (info->mode_type & GRUB_VIDEO_MODE_TYPE_CGA)
|
||||
grub_printf ("CGA ");
|
||||
if (info->mode_type & GRUB_VIDEO_MODE_TYPE_NONCHAIN4)
|
||||
grub_printf ("Non-chain 4 ");
|
||||
if (info->mode_type & GRUB_VIDEO_MODE_TYPE_1BIT_BITMAP)
|
||||
grub_printf ("Monochrome ");
|
||||
if (info->mode_type & GRUB_VIDEO_MODE_TYPE_UNKNOWN)
|
||||
|
|
|
@ -564,6 +564,7 @@ vbe2videoinfo (grub_uint32_t mode,
|
|||
|
||||
/* CGA is basically 4-bit packed pixel. */
|
||||
case GRUB_VBE_MEMORY_MODEL_CGA:
|
||||
mode_info->mode_type |= GRUB_VIDEO_MODE_TYPE_CGA;
|
||||
case GRUB_VBE_MEMORY_MODEL_PACKED_PIXEL:
|
||||
mode_info->mode_type |= GRUB_VIDEO_MODE_TYPE_INDEX_COLOR;
|
||||
break;
|
||||
|
@ -575,8 +576,10 @@ vbe2videoinfo (grub_uint32_t mode,
|
|||
|
||||
/* Non chain 4 is a special case of planar. */
|
||||
case GRUB_VBE_MEMORY_MODEL_NONCHAIN4_256:
|
||||
mode_info->mode_type |= GRUB_VIDEO_MODE_TYPE_NONCHAIN4;
|
||||
case GRUB_VBE_MEMORY_MODEL_PLANAR:
|
||||
mode_info->mode_type |= GRUB_VIDEO_MODE_TYPE_PLANAR;
|
||||
mode_info->mode_type |= GRUB_VIDEO_MODE_TYPE_PLANAR
|
||||
| GRUB_VIDEO_MODE_TYPE_INDEX_COLOR;
|
||||
break;
|
||||
|
||||
case GRUB_VBE_MEMORY_MODEL_YUV:
|
||||
|
|
|
@ -38,24 +38,33 @@ struct grub_video_bitmap;
|
|||
/* If following is set render target contains currenly displayed image
|
||||
after swapping buffers (otherwise it contains previously displayed image).
|
||||
*/
|
||||
#define GRUB_VIDEO_MODE_TYPE_YUV 0x00000800
|
||||
#define GRUB_VIDEO_MODE_TYPE_PLANAR 0x00000400
|
||||
#define GRUB_VIDEO_MODE_TYPE_HERCULES 0x00000200
|
||||
#define GRUB_VIDEO_MODE_TYPE_UNKNOWN 0x00000100
|
||||
#define GRUB_VIDEO_MODE_TYPE_UPDATING_SWAP 0x00000080
|
||||
#define GRUB_VIDEO_MODE_TYPE_PURE_TEXT 0x00000040
|
||||
#define GRUB_VIDEO_MODE_TYPE_ALPHA 0x00000020
|
||||
#define GRUB_VIDEO_MODE_TYPE_DOUBLE_BUFFERED 0x00000010
|
||||
#define GRUB_VIDEO_MODE_TYPE_1BIT_BITMAP 0x00000004
|
||||
#define GRUB_VIDEO_MODE_TYPE_INDEX_COLOR 0x00000002
|
||||
#define GRUB_VIDEO_MODE_TYPE_RGB 0x00000001
|
||||
typedef enum grub_video_mode_type
|
||||
{
|
||||
GRUB_VIDEO_MODE_TYPE_RGB = 0x00000001,
|
||||
GRUB_VIDEO_MODE_TYPE_INDEX_COLOR = 0x00000002,
|
||||
GRUB_VIDEO_MODE_TYPE_1BIT_BITMAP = 0x00000004,
|
||||
GRUB_VIDEO_MODE_TYPE_YUV = 0x00000008,
|
||||
|
||||
/* Defines used to mask flags. */
|
||||
#define GRUB_VIDEO_MODE_TYPE_COLOR_MASK 0x0000000F
|
||||
/* Defines used to mask flags. */
|
||||
GRUB_VIDEO_MODE_TYPE_COLOR_MASK = 0x0000000F,
|
||||
|
||||
/* Defines used to specify requested bit depth. */
|
||||
#define GRUB_VIDEO_MODE_TYPE_DEPTH_MASK 0x0000ff00
|
||||
#define GRUB_VIDEO_MODE_TYPE_DEPTH_POS 8
|
||||
GRUB_VIDEO_MODE_TYPE_DOUBLE_BUFFERED = 0x00000010,
|
||||
GRUB_VIDEO_MODE_TYPE_ALPHA = 0x00000020,
|
||||
GRUB_VIDEO_MODE_TYPE_PURE_TEXT = 0x00000040,
|
||||
GRUB_VIDEO_MODE_TYPE_UPDATING_SWAP = 0x00000080,
|
||||
GRUB_VIDEO_MODE_TYPE_OPERATIONAL_MASK = 0x000000F0,
|
||||
|
||||
/* Defines used to specify requested bit depth. */
|
||||
GRUB_VIDEO_MODE_TYPE_DEPTH_MASK = 0x0000FF00,
|
||||
#define GRUB_VIDEO_MODE_TYPE_DEPTH_POS 8
|
||||
|
||||
GRUB_VIDEO_MODE_TYPE_UNKNOWN = 0x00010000,
|
||||
GRUB_VIDEO_MODE_TYPE_HERCULES = 0x00020000,
|
||||
GRUB_VIDEO_MODE_TYPE_PLANAR = 0x00040000,
|
||||
GRUB_VIDEO_MODE_TYPE_NONCHAIN4 = 0x00080000,
|
||||
GRUB_VIDEO_MODE_TYPE_CGA = 0x00100000,
|
||||
GRUB_VIDEO_MODE_TYPE_INFO_MASK = 0x00FF0000,
|
||||
} grub_video_mode_type_t;
|
||||
|
||||
/* The basic render target representing the whole display. This always
|
||||
renders to the back buffer when double-buffering is in use. */
|
||||
|
@ -107,7 +116,7 @@ struct grub_video_mode_info
|
|||
|
||||
/* Mode type bitmask. Contains information like is it Index color or
|
||||
RGB mode. */
|
||||
unsigned int mode_type;
|
||||
grub_video_mode_type_t mode_type;
|
||||
|
||||
/* Bits per pixel. */
|
||||
unsigned int bpp;
|
||||
|
@ -232,7 +241,8 @@ struct grub_video_adapter
|
|||
grub_err_t (*fini) (void);
|
||||
|
||||
grub_err_t (*setup) (unsigned int width, unsigned int height,
|
||||
unsigned int mode_type, unsigned int mode_mask);
|
||||
grub_video_mode_type_t mode_type,
|
||||
grub_video_mode_type_t mode_mask);
|
||||
|
||||
grub_err_t (*get_info) (struct grub_video_mode_info *mode_info);
|
||||
|
||||
|
@ -409,8 +419,9 @@ grub_err_t EXPORT_FUNC (grub_video_set_mode) (const char *modestring,
|
|||
unsigned int modevalue);
|
||||
|
||||
static inline int
|
||||
grub_video_check_mode_flag (unsigned int flags, unsigned int mask,
|
||||
unsigned int flag, int def)
|
||||
grub_video_check_mode_flag (grub_video_mode_type_t flags,
|
||||
grub_video_mode_type_t mask,
|
||||
grub_video_mode_type_t flag, int def)
|
||||
{
|
||||
return (flag & mask) ? !! (flags & flag) : def;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue