Skip to contentSkip to conversation

Support graphics output protocol in EFI

PATCH In review Bean 4 participants 6 messages Jul 12, 2009 – Jul 14, 2009

lore
Share & tools
lore

Bean

author
#0 lore raw

PATCH 1/1 Support graphics output protocol in EFI

Hi,

MacBooks 5.x supports the new graphics output protocol in UEFI, while the older UGA draw protocol doesn't work anymore. This patch add support for graphics output protocol so that linux loader can get video information correctly.

Signature · 1 line
Bean
include/grub/efi/graphics_output.h new file +92 -0
new file mode 100644
index 0000000..a100c09
@@ -0,0 +1,92 @@
+/* graphics_output.h - definitions of the graphics output protocol */
+/*
+ *  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_GRAPHICS_OUTPUT_HEADER
+#define GRUB_EFI_GRAPHICS_OUTPUT_HEADER	1
+
+#include <grub/efi/uga_draw.h>
+
+#define GRUB_EFI_GRAPHICS_OUTPUT_GUID \
+  { 0x9042a9de, 0x23dc, 0x4a38, { 0x96, 0xfb, 0x7a, 0xde, 0xd0, 0x80, 0x51, 0x6a }}
+
+struct grub_efi_pixel_bitmask
+{
+  grub_uint32_t red_mask;
+  grub_uint32_t green_mask;
+  grub_uint32_t blue_mask;
+  grub_uint32_t reserved_mask;
+};
+
+enum grub_efi_graphics_pixel_format
+  {
+    GRUB_EFI_PIXEL_RGB_RESERVED_8BIT_PER_COLOR,
+    GRUB_EFI_PIXEL_BGR_RESERVED_8BIT_PER_COLOR,
+    GRUB_EFI_PIXEL_BIT_MASK,
+    GRUB_EFI_PIXEL_BLT_ONLY,
+    GRUB_EFI_PIXEL_FORMAT_MAX
+  };
+
+struct grub_efi_graphics_output_mode_information
+{
+  grub_uint32_t version;
+  grub_uint32_t horizontal_resolution;
+  grub_uint32_t vertical_resolution;
+  enum grub_efi_graphics_pixel_format pixel_format;
+  struct grub_efi_pixel_bitmask pixel_information;
+  grub_uint32_t pixels_per_scan_line;
+};
+
+struct grub_efi_graphics_output_mode
+{
+  grub_uint32_t max_mode;
+  grub_uint32_t mode;
+  struct grub_efi_graphics_output_mode_information *info;
+  grub_efi_uintn_t size_of_info;
+  grub_efi_physical_address_t frame_buffer_base;
+  grub_efi_uintn_t frame_buffer_size;
+};
+
+struct grub_efi_graphics_output_protocol
+{
+  grub_efi_status_t
+  (*query_mode) (struct grub_efi_graphics_output_protocol *this,
+		 grub_uint32_t mode_number,
+		 grub_efi_uintn_t *size_of_info,
+		 struct grub_efi_graphics_output_mode_information **info);
+
+  grub_efi_status_t
+  (*set_mode) (struct grub_efi_graphics_output_protocol *this,
+	       grub_uint32_t mode_number);
+
+  grub_efi_status_t
+  (*blt) (struct grub_efi_uga_draw_protocol *this,
+	  struct grub_efi_uga_pixel *blt_buffer,
+	  enum grub_efi_uga_blt_operation blt_operation,
+	  grub_efi_uintn_t src_x,
+	  grub_efi_uintn_t src_y,
+	  grub_efi_uintn_t dest_x,
+	  grub_efi_uintn_t dest_y,
+	  grub_efi_uintn_t width,
+	  grub_efi_uintn_t height,
+	  grub_efi_uintn_t delta);
+
+  struct grub_efi_graphics_output_mode *mode;
+};
+
+#endif
loader/i386/efi/linux.c +44 -20

96 lines not on this page · raw message

#1 lore raw
Quoted 6 lines · Bean

Hi,

MacBooks 5.x supports the new graphics output protocol in UEFI, while the older UGA draw protocol doesn't work anymore. This patch add support for graphics output protocol so that linux loader can get video information correctly.

The patch looks good and doesn't introduce any compiler warnings.

I wonder why it's only implemented for i386, but not for x86_64.

Signature · 2 lines
Regards,
Pavel Roskin
author
#2 lore raw

Hi,

loader/i386/linux.c works for both i386 and x86_64, although the directory might be a little misleading. In act, MacBook 5.x is x86_64 and users from ubuntu forum have confirmed that it works, so it should be all right.

Quoted 22 lines · Pavel Roskin
Quoted 6 lines · Bean

Hi,

MacBooks 5.x supports the new graphics output protocol in UEFI, while the older UGA draw protocol doesn't work anymore. This patch add support for graphics output protocol so that linux loader can get video information correctly.

The patch looks good and doesn't introduce any compiler warnings.

I wonder why it's only implemented for i386, but not for x86_64.

--
Regards,
Pavel Roskin

_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel

Signature · 1 line
Bean
#3 lore raw

Quoting Bean <[email protected]>:

Quoted 2 lines

loader/i386/linux.c works for both i386 and x86_64, although the directory might be a little misleading.

Yes, it was misleading. We may want to rename i386 to x86 for the "dual purpose" code.

Quoted 3 lines

In act, MacBook 5.x is x86_64
and users from ubuntu forum have confirmed that it works, so it should be all right.

OK then, no objections.

Signature · 2 lines
Regards,
Pavel Roskin
#4 lore raw
In reply to Bean
Quoted 6 lines · Bean

Hi,

MacBooks 5.x supports the new graphics output protocol in UEFI, while the older UGA draw protocol doesn't work anymore. This patch add support for graphics output protocol so that linux loader can get video information correctly.

Hi,

Please could you get Vladimir to check this patch? He's working (or had plans for) splitting arch-specific parts of the EFI video support so we can e.g. use gfxterm on EFI or port the generic Linux loader to EFI.

(He's just back from vacation, but I suppose he'll read this mail soonish now :-))

Signature · 5 lines
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."
#5 lore raw
In reply to Bean
Quoted 6 lines · Bean

Hi,

MacBooks 5.x supports the new graphics output protocol in UEFI, while the older UGA draw protocol doesn't work anymore. This patch add support for graphics output protocol so that linux loader can get video information correctly.

This patch duplicates some functionality from vga.mod (some framebuffer code). Could you perhaps transform GOP into backend for fb.mod. You can find my current WIP in gfxsplit+sdl+collin branch in my git. I'll split and improve (add a function get_fbinfo_an_fini) my gfxsplit patch from this branch tomorrow unless I'll still be too tired for it.

Quoted 10 lines

--
Bean

_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel

Signature · 4 lines
Regards
Vladimir 'phcoder' Serbinenko

Personal git repository: http://repo.or.cz/w/grub2/phcoder.git