Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1KZpvi-0002Te-O8 for mharc-grub-devel@gnu.org; Sun, 31 Aug 2008 12:37:34 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KZpvg-0002Rk-Dr for grub-devel@gnu.org; Sun, 31 Aug 2008 12:37:32 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KZpvf-0002RA-7z for grub-devel@gnu.org; Sun, 31 Aug 2008 12:37:32 -0400 Received: from [199.232.76.173] (port=51287 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KZpve-0002Qu-Qx for grub-devel@gnu.org; Sun, 31 Aug 2008 12:37:30 -0400 Received: from gateway14.websitewelcome.com ([69.56.160.5]:53739) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1KZpve-000674-CY for grub-devel@gnu.org; Sun, 31 Aug 2008 12:37:30 -0400 Received: (qmail 20452 invoked from network); 31 Aug 2008 16:49:37 -0000 Received: from gator297.hostgator.com (74.53.228.114) by gateway14.websitewelcome.com with SMTP; 31 Aug 2008 16:49:37 -0000 Received: from c-67-185-142-228.hsd1.wa.comcast.net ([67.185.142.228]:56774 helo=gamma.lan) by gator297.hostgator.com with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.68) (envelope-from ) id 1KZpva-0007s9-Ux; Sun, 31 Aug 2008 11:37:27 -0500 Date: Sun, 31 Aug 2008 09:37:23 -0700 From: Colin D Bennett To: The development of GRUB 2 Message-ID: <20080831093723.3c11b80d@gamma.lan> In-Reply-To: <48BABFF9.4000904@nic.fi> References: <20080830235952.4c686b44@gamma.lan> <48BA64B0.7070605@nic.fi> <20080831064323.1531de53@gamma.lan> <48BABFF9.4000904@nic.fi> X-Mailer: Claws Mail 3.5.0 (GTK+ 2.12.11; i686-pc-linux-gnu) Mime-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/WbYDqtcce+ntgLcYOVKowkW"; protocol="application/pgp-signature"; micalg=PGP-SHA1 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator297.hostgator.com X-AntiAbuse: Original Domain - gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - gibibit.com X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) Cc: Subject: [PATCH] GSoC #08 [v2] vbeinfo enhancements X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Aug 2008 16:37:32 -0000 --Sig_/WbYDqtcce+ntgLcYOVKowkW Content-Type: multipart/mixed; boundary="MP_/ov9rAHMWm=mNiEM4_kNiXzw" --MP_/ov9rAHMWm=mNiEM4_kNiXzw Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On Sun, 31 Aug 2008 18:59:53 +0300 Vesa J=C3=A4=C3=A4skel=C3=A4inen wrote: > Colin D Bennett wrote: > > On Sun, 31 Aug 2008 12:30:24 +0300 > > Vesa J=C3=A4=C3=A4skel=C3=A4inen wrote: > >=20 > >> Colin D Bennett wrote: > >>> This patch adds more information to the vbeinfo output, including > >>> the video adapter VBE version, total video memory, and the color > >>> layout of each video mode. > >> Thanks for the patch. In it went with a slight modification. > >> > >> I think we need to get rid of those magic values there thou... > >=20 > > Which magic values? >=20 > 0x04 and 0x06 as used on memory model at least. There might be > something else, those were there already... OK, I have replaced those and added the other VBE constants for those fields. Even though many of the values are not currently used, it seems to help document the other possible values and uses of the field. Attached are both a full patch, and an incremental patch against the first version. Regards, Colin --MP_/ov9rAHMWm=mNiEM4_kNiXzw Content-Type: text/plain; name=08_ChangeLog.txt Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename=08_ChangeLog.txt 2008-08-30 Colin D Bennett * commands/i386/pc/vbeinfo.c (grub_cmd_vbeinfo): Show VBE version and total video memory in 'vbeinfo' output; show color format details for each video mode. Added constant values for VBE mode info values, and replaced magic numbers with references to constants. --MP_/ov9rAHMWm=mNiEM4_kNiXzw Content-Type: text/x-patch; name=08_vbeinfo-enhancements.patch Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename=08_vbeinfo-enhancements.patch =3D=3D=3D modified file 'commands/i386/pc/vbeinfo.c' --- commands/i386/pc/vbeinfo.c 2007-07-21 22:32:33 +0000 +++ commands/i386/pc/vbeinfo.c 2008-08-31 16:26:53 +0000 @@ -26,6 +26,31 @@ #include #include =20 +/* Bits from the VBE "mode_attributes" field in the mode info struct. */ +#define VBE_MODEATTR_SUPPORTED (1 << 0) +#define VBE_MODEATTR_RESERVED_1 (1 << 1) +#define VBE_MODEATTR_BIOS_TTY_OUTPUT_SUPPORT (1 << 2) +#define VBE_MODEATTR_COLOR (1 << 3) +#define VBE_MODEATTR_GRAPHICS (1 << 4) +#define VBE_MODEATTR_VGA_COMPATIBLE (1 << 5) +#define VBE_MODEATTR_VGA_WINDOWED_AVAIL (1 << 6) +#define VBE_MODEATTR_LINEAR_FB_AVAIL (1 << 7) +#define VBE_MODEATTR_DOUBLE_SCAN_AVAIL (1 << 8) +#define VBE_MODEATTR_INTERLACED_AVAIL (1 << 9) +#define VBE_MODEATTR_TRIPLE_BUF_AVAIL (1 << 10) +#define VBE_MODEATTR_STEREO_AVAIL (1 << 11) +#define VBE_MODEATTR_DUAL_DISPLAY_START (1 << 12) + +/* Values for the VBE memory_model field in the mode info struct. */ +#define VBE_MODE_MEMORY_MODEL_TEXT 0x00 +#define VBE_MODE_MEMORY_MODEL_CGA 0x01 +#define VBE_MODE_MEMORY_MODEL_HERCULES 0x02 +#define VBE_MODE_MEMORY_MODEL_PLANAR 0x03 +#define VBE_MODE_MEMORY_MODEL_PACKED_PIXEL 0x04 +#define VBE_MODE_MEMORY_MODEL_NONCHAIN4_256 0x05 +#define VBE_MODE_MEMORY_MODEL_DIRECT_COLOR 0x06 +#define VBE_MODE_MEMORY_MODEL_YUV 0x07 + static void * real2pm (grub_vbe_farptr_t ptr) { @@ -48,12 +73,19 @@ grub_err_t err; char *modevar; =20 - grub_printf ("List of compatible video modes:\n"); - err =3D grub_vbe_probe (&controller_info); if (err !=3D GRUB_ERR_NONE) return err; =20 + grub_printf ("VBE info: version: %d.%d OEM software rev: %d.%d\n", + controller_info.version >> 8,=20 + controller_info.version & 0xFF, + controller_info.oem_software_rev >> 8, + controller_info.oem_software_rev & 0xFF); + /* The total_memory field is in 64 KiB units. */ + grub_printf (" total memory: %d KiB\n", + (controller_info.total_memory << 16) / 1024); + /* Because the information on video modes is stored in a temporary place, it is better to copy it to somewhere safe. */ p =3D video_mode_list =3D real2pm (controller_info.video_mode_ptr); @@ -67,6 +99,10 @@ =20 grub_memcpy (saved_video_mode_list, video_mode_list, video_mode_list_siz= e); =20 + grub_printf ("List of compatible video modes:\n"); + grub_printf ("Legend: P=3DPacked pixel, D=3DDirect color, " + "mask/pos=3DR/G/B/reserved\n");=20 + /* Walk through all video modes listed. */ for (p =3D saved_video_mode_list; *p !=3D 0xFFFF; p++) { @@ -80,33 +116,33 @@ continue; } =20 - if ((mode_info_tmp.mode_attributes & 0x001) =3D=3D 0) + if ((mode_info_tmp.mode_attributes & VBE_MODEATTR_SUPPORTED) =3D=3D = 0) /* If not available, skip it. */ continue; =20 - if ((mode_info_tmp.mode_attributes & 0x002) =3D=3D 0) + if ((mode_info_tmp.mode_attributes & VBE_MODEATTR_RESERVED_1) =3D=3D= 0) /* Not enough information. */ continue; =20 - if ((mode_info_tmp.mode_attributes & 0x008) =3D=3D 0) + if ((mode_info_tmp.mode_attributes & VBE_MODEATTR_COLOR) =3D=3D 0) /* Monochrome is unusable. */ continue; =20 - if ((mode_info_tmp.mode_attributes & 0x080) =3D=3D 0) + if ((mode_info_tmp.mode_attributes & VBE_MODEATTR_LINEAR_FB_AVAIL) = =3D=3D 0) /* We support only linear frame buffer modes. */ continue; =20 - if ((mode_info_tmp.mode_attributes & 0x010) =3D=3D 0) + if ((mode_info_tmp.mode_attributes & VBE_MODEATTR_GRAPHICS) =3D=3D 0) /* We allow only graphical modes. */ continue; =20 switch (mode_info_tmp.memory_model) { - case 0x04: - memory_model =3D "Packed Pixel"; + case VBE_MODE_MEMORY_MODEL_PACKED_PIXEL: + memory_model =3D "Packed"; break; - case 0x06: - memory_model =3D "Direct Color"; + case VBE_MODE_MEMORY_MODEL_DIRECT_COLOR: + memory_model =3D "Direct"; break; =20 default: @@ -116,12 +152,23 @@ if (! memory_model) continue; =20 - grub_printf ("0x%03x: %d x %d x %d bpp (%s)\n", - mode, + grub_printf ("0x%03x: %4d x %4d x %2d %s",=20 + mode, mode_info_tmp.x_resolution, mode_info_tmp.y_resolution, mode_info_tmp.bits_per_pixel, - memory_model); + memory_model); + if (memory_model[0] =3D=3D 'D') + grub_printf (", mask: %d/%d/%d/%d pos: %d/%d/%d/%d", + mode_info_tmp.red_mask_size, + mode_info_tmp.green_mask_size, + mode_info_tmp.blue_mask_size, + mode_info_tmp.rsvd_mask_size, + mode_info_tmp.red_field_position, + mode_info_tmp.green_field_position, + mode_info_tmp.blue_field_position, + mode_info_tmp.rsvd_field_position); + grub_printf ("\n"); } =20 grub_free (saved_video_mode_list); --MP_/ov9rAHMWm=mNiEM4_kNiXzw Content-Type: text/x-patch; name=08_vbeinfo-enhancements_v1_v2.patch Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename=08_vbeinfo-enhancements_v1_v2.patch =3D=3D=3D modified file 'commands/i386/pc/vbeinfo.c' --- commands/i386/pc/vbeinfo.c 2008-08-31 04:27:54 +0000 +++ commands/i386/pc/vbeinfo.c 2008-08-31 16:30:27 +0000 @@ -26,6 +26,31 @@ #include #include =20 +/* Bits from the VBE "mode_attributes" field in the mode info struct. */ +#define VBE_MODEATTR_SUPPORTED (1 << 0) +#define VBE_MODEATTR_RESERVED_1 (1 << 1) +#define VBE_MODEATTR_BIOS_TTY_OUTPUT_SUPPORT (1 << 2) +#define VBE_MODEATTR_COLOR (1 << 3) +#define VBE_MODEATTR_GRAPHICS (1 << 4) +#define VBE_MODEATTR_VGA_COMPATIBLE (1 << 5) +#define VBE_MODEATTR_VGA_WINDOWED_AVAIL (1 << 6) +#define VBE_MODEATTR_LINEAR_FB_AVAIL (1 << 7) +#define VBE_MODEATTR_DOUBLE_SCAN_AVAIL (1 << 8) +#define VBE_MODEATTR_INTERLACED_AVAIL (1 << 9) +#define VBE_MODEATTR_TRIPLE_BUF_AVAIL (1 << 10) +#define VBE_MODEATTR_STEREO_AVAIL (1 << 11) +#define VBE_MODEATTR_DUAL_DISPLAY_START (1 << 12) + +/* Values for the VBE memory_model field in the mode info struct. */ +#define VBE_MODE_MEMORY_MODEL_TEXT 0x00 +#define VBE_MODE_MEMORY_MODEL_CGA 0x01 +#define VBE_MODE_MEMORY_MODEL_HERCULES 0x02 +#define VBE_MODE_MEMORY_MODEL_PLANAR 0x03 +#define VBE_MODE_MEMORY_MODEL_PACKED_PIXEL 0x04 +#define VBE_MODE_MEMORY_MODEL_NONCHAIN4_256 0x05 +#define VBE_MODE_MEMORY_MODEL_DIRECT_COLOR 0x06 +#define VBE_MODE_MEMORY_MODEL_YUV 0x07 + static void * real2pm (grub_vbe_farptr_t ptr) { @@ -57,6 +82,7 @@ controller_info.version & 0xFF, controller_info.oem_software_rev >> 8, controller_info.oem_software_rev & 0xFF); + /* The total_memory field is in 64 KiB units. */ grub_printf (" total memory: %d KiB\n", (controller_info.total_memory << 16) / 1024); =20 @@ -90,32 +116,32 @@ continue; } =20 - if ((mode_info_tmp.mode_attributes & 0x001) =3D=3D 0) + if ((mode_info_tmp.mode_attributes & VBE_MODEATTR_SUPPORTED) =3D=3D = 0) /* If not available, skip it. */ continue; =20 - if ((mode_info_tmp.mode_attributes & 0x002) =3D=3D 0) + if ((mode_info_tmp.mode_attributes & VBE_MODEATTR_RESERVED_1) =3D=3D= 0) /* Not enough information. */ continue; =20 - if ((mode_info_tmp.mode_attributes & 0x008) =3D=3D 0) + if ((mode_info_tmp.mode_attributes & VBE_MODEATTR_COLOR) =3D=3D 0) /* Monochrome is unusable. */ continue; =20 - if ((mode_info_tmp.mode_attributes & 0x080) =3D=3D 0) + if ((mode_info_tmp.mode_attributes & VBE_MODEATTR_LINEAR_FB_AVAIL) = =3D=3D 0) /* We support only linear frame buffer modes. */ continue; =20 - if ((mode_info_tmp.mode_attributes & 0x010) =3D=3D 0) + if ((mode_info_tmp.mode_attributes & VBE_MODEATTR_GRAPHICS) =3D=3D 0) /* We allow only graphical modes. */ continue; =20 switch (mode_info_tmp.memory_model) { - case 0x04: + case VBE_MODE_MEMORY_MODEL_PACKED_PIXEL: memory_model =3D "Packed"; break; - case 0x06: + case VBE_MODE_MEMORY_MODEL_DIRECT_COLOR: memory_model =3D "Direct"; break; =20 --MP_/ov9rAHMWm=mNiEM4_kNiXzw-- --Sig_/WbYDqtcce+ntgLcYOVKowkW Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) iEYEARECAAYFAki6yMYACgkQokx8fzcGbYfS2QCfbjW5AZ6QtILN+G7LrkXpr/zG VLQAoIrl4SEGz5RYq7XYxu3HU2E+OKww =Oawc -----END PGP SIGNATURE----- --Sig_/WbYDqtcce+ntgLcYOVKowkW--