Apple Screen Info

From OSDev.wiki
Revision as of 00:04, 23 March 2024 by osdev>Distrohopper39b (Created page with "Before the introduction of GOP to Apple Macs in 2009, Apple used a proprietary protocol known as Apple Screen Info to serve graphics information === Definitions === These...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Before the introduction of GOP to Apple Macs in 2009, Apple used a proprietary protocol known as Apple Screen Info to serve graphics information

Definitions

These should be placed in a header file or in the main EFI program.

#define APPLE_SCREEN_INFO_PROTOCOL_GUID {0xe316e100, 0x0751, 0x4c49, {0x90, 0x56, 0x48, 0x6c, 0x7e, 0x47, 0x29, 0x03}}

typedef struct _APPLE_SCREEN_INFO_PROTOCOL APPLE_SCREEN_INFO_PROTOCOL;

typedef EFI_STATUS (EFIAPI *GetAppleScreenInfo)(APPLE_SCREEN_INFO_PROTOCOL *This, UINT64 *BaseAddress, UINT64 *FrameBufferSize, UINT32 *BytesPerRow, UINT32 *Width, UINT32 *Height, UINT32 *Depth);

struct _APPLE_SCREEN_INFO_PROTOCOL {
    GetAppleScreenInfo GetInfo;
};

Detection

  EFI_GUID AppleScreenInfoGuid = APPLE_SCREEN_INFO_PROTOCOL_GUID;
  APPLE_SCREEN_INFO_PROTOCOL *AppleScreenInfo;
  UINT64 BaseAddress, FrameBufferSize;
  UINT32 BytesPerRow, Width, Height, Depth;

  Status = uefi_call_wrapper(gBS->LocateProtocol, 3, &AppleScreenInfo, NULL, (VOID **) &AppleScreenInfoGuid); // leave out uefi_call_wrapper if using TianoCore
  if (Status != EFI_SUCCESS)
  {
    Print(L"Failed to find Apple Screen Info protocol! Status = %d\n", Status);
    return Status;
  }
  Status = uefi_call_wrapper(AppleScreenInfo->GetInfo, 7, AppleScreenInfo, &BaseAddress, &FrameBufferSize, &BytesPerRow, &Width, &Height, &Depth);
  if (Status != UEFI_SUCCESS)
  {
    Print(L"Failed to get Apple Screen Information! Status = %d\n", Status);
    return Status;
  }