Add Hercules, Planar and YUV to videoinfo (not tested)

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2010-09-12 01:45:58 +02:00
parent 30d71dbced
commit d2467d2361
3 changed files with 50 additions and 5 deletions

View file

@ -34,6 +34,8 @@ hook (const struct grub_video_mode_info *info)
grub_printf (" 0x%03x ", info->mode_number); grub_printf (" 0x%03x ", info->mode_number);
grub_printf ("%4d x %4d x %2d ", info->width, info->height, info->bpp); grub_printf ("%4d x %4d x %2d ", info->width, info->height, info->bpp);
if (info->mode_type & GRUB_VIDEO_MODE_TYPE_PURE_TEXT)
grub_printf ("Text-only ");
/* Show mask and position details for direct color modes. */ /* Show mask and position details for direct color modes. */
if (info->mode_type & GRUB_VIDEO_MODE_TYPE_RGB) if (info->mode_type & GRUB_VIDEO_MODE_TYPE_RGB)
grub_printf ("Direct, mask: %d/%d/%d/%d pos: %d/%d/%d/%d", grub_printf ("Direct, mask: %d/%d/%d/%d pos: %d/%d/%d/%d",
@ -47,6 +49,17 @@ hook (const struct grub_video_mode_info *info)
info->reserved_field_pos); info->reserved_field_pos);
if (info->mode_type & GRUB_VIDEO_MODE_TYPE_INDEX_COLOR) if (info->mode_type & GRUB_VIDEO_MODE_TYPE_INDEX_COLOR)
grub_printf ("Packed "); grub_printf ("Packed ");
if (info->mode_type & GRUB_VIDEO_MODE_TYPE_YUV)
grub_printf ("YUV ");
if (info->mode_type & GRUB_VIDEO_MODE_TYPE_PLANAR)
grub_printf ("Planar ");
if (info->mode_type & GRUB_VIDEO_MODE_TYPE_HERCULES)
grub_printf ("Hercules ");
if (info->mode_type & GRUB_VIDEO_MODE_TYPE_1BIT_BITMAP)
grub_printf ("Monochrome ");
if (info->mode_type & GRUB_VIDEO_MODE_TYPE_UNKNOWN)
grub_printf ("Unknown ");
grub_printf ("\n"); grub_printf ("\n");
return 0; return 0;

View file

@ -555,14 +555,39 @@ vbe2videoinfo (grub_uint32_t mode,
mode_info->width = vbeinfo->x_resolution; mode_info->width = vbeinfo->x_resolution;
mode_info->height = vbeinfo->y_resolution; mode_info->height = vbeinfo->y_resolution;
mode_info->mode_type = 0;
switch (vbeinfo->memory_model) switch (vbeinfo->memory_model)
{ {
case GRUB_VBE_MEMORY_MODEL_TEXT:
mode_info->mode_type |= GRUB_VIDEO_MODE_TYPE_PURE_TEXT;
break;
/* CGA is basically 4-bit packed pixel. */
case GRUB_VBE_MEMORY_MODEL_CGA:
case GRUB_VBE_MEMORY_MODEL_PACKED_PIXEL: case GRUB_VBE_MEMORY_MODEL_PACKED_PIXEL:
mode_info->mode_type = GRUB_VIDEO_MODE_TYPE_INDEX_COLOR; mode_info->mode_type |= GRUB_VIDEO_MODE_TYPE_INDEX_COLOR;
break;
case GRUB_VBE_MEMORY_MODEL_HERCULES:
mode_info->mode_type |= GRUB_VIDEO_MODE_TYPE_HERCULES
| GRUB_VIDEO_MODE_TYPE_1BIT_BITMAP;
break;
/* Non chain 4 is a special case of planar. */
case GRUB_VBE_MEMORY_MODEL_NONCHAIN4_256:
case GRUB_VBE_MEMORY_MODEL_PLANAR:
mode_info->mode_type |= GRUB_VIDEO_MODE_TYPE_PLANAR;
break;
case GRUB_VBE_MEMORY_MODEL_YUV:
mode_info->mode_type |= GRUB_VIDEO_MODE_TYPE_YUV;
break; break;
case GRUB_VBE_MEMORY_MODEL_DIRECT_COLOR: case GRUB_VBE_MEMORY_MODEL_DIRECT_COLOR:
mode_info->mode_type = GRUB_VIDEO_MODE_TYPE_RGB; mode_info->mode_type |= GRUB_VIDEO_MODE_TYPE_RGB;
break;
default:
mode_info->mode_type |= GRUB_VIDEO_MODE_TYPE_UNKNOWN;
break; break;
} }
@ -585,6 +610,9 @@ vbe2videoinfo (grub_uint32_t mode,
case 8: case 8:
mode_info->bytes_per_pixel = 1; mode_info->bytes_per_pixel = 1;
break; break;
case 4:
mode_info->bytes_per_pixel = 0;
break;
} }
if (controller_info.version >= 0x300) if (controller_info.version >= 0x300)

View file

@ -38,6 +38,10 @@ struct grub_video_bitmap;
/* If following is set render target contains currenly displayed image /* If following is set render target contains currenly displayed image
after swapping buffers (otherwise it contains previously 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_UPDATING_SWAP 0x00000080
#define GRUB_VIDEO_MODE_TYPE_PURE_TEXT 0x00000040 #define GRUB_VIDEO_MODE_TYPE_PURE_TEXT 0x00000040
#define GRUB_VIDEO_MODE_TYPE_ALPHA 0x00000020 #define GRUB_VIDEO_MODE_TYPE_ALPHA 0x00000020