Path: blob/main/sys/contrib/edk2/Include/Protocol/GraphicsOutput.h
96339 views
/** @file1Graphics Output Protocol from the UEFI 2.0 specification.23Abstraction of a very simple graphics device.45Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>6SPDX-License-Identifier: BSD-2-Clause-Patent78**/910#ifndef __GRAPHICS_OUTPUT_H__11#define __GRAPHICS_OUTPUT_H__1213#define EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID \14{ \150x9042a9de, 0x23dc, 0x4a38, {0x96, 0xfb, 0x7a, 0xde, 0xd0, 0x80, 0x51, 0x6a } \16}1718typedef struct _EFI_GRAPHICS_OUTPUT_PROTOCOL EFI_GRAPHICS_OUTPUT_PROTOCOL;1920typedef struct {21UINT32 RedMask;22UINT32 GreenMask;23UINT32 BlueMask;24UINT32 ReservedMask;25} EFI_PIXEL_BITMASK;2627typedef enum {28///29/// A pixel is 32-bits and byte zero represents red, byte one represents green,30/// byte two represents blue, and byte three is reserved. This is the definition31/// for the physical frame buffer. The byte values for the red, green, and blue32/// components represent the color intensity. This color intensity value range33/// from a minimum intensity of 0 to maximum intensity of 255.34///35PixelRedGreenBlueReserved8BitPerColor,36///37/// A pixel is 32-bits and byte zero represents blue, byte one represents green,38/// byte two represents red, and byte three is reserved. This is the definition39/// for the physical frame buffer. The byte values for the red, green, and blue40/// components represent the color intensity. This color intensity value range41/// from a minimum intensity of 0 to maximum intensity of 255.42///43PixelBlueGreenRedReserved8BitPerColor,44///45/// The Pixel definition of the physical frame buffer.46///47PixelBitMask,48///49/// This mode does not support a physical frame buffer.50///51PixelBltOnly,52///53/// Valid EFI_GRAPHICS_PIXEL_FORMAT enum values are less than this value.54///55PixelFormatMax56} EFI_GRAPHICS_PIXEL_FORMAT;5758typedef struct {59///60/// The version of this data structure. A value of zero represents the61/// EFI_GRAPHICS_OUTPUT_MODE_INFORMATION structure as defined in this specification.62///63UINT32 Version;64///65/// The size of video screen in pixels in the X dimension.66///67UINT32 HorizontalResolution;68///69/// The size of video screen in pixels in the Y dimension.70///71UINT32 VerticalResolution;72///73/// Enumeration that defines the physical format of the pixel. A value of PixelBltOnly74/// implies that a linear frame buffer is not available for this mode.75///76EFI_GRAPHICS_PIXEL_FORMAT PixelFormat;77///78/// This bit-mask is only valid if PixelFormat is set to PixelPixelBitMask.79/// A bit being set defines what bits are used for what purpose such as Red, Green, Blue, or Reserved.80///81EFI_PIXEL_BITMASK PixelInformation;82///83/// Defines the number of pixel elements per video memory line.84///85UINT32 PixelsPerScanLine;86} EFI_GRAPHICS_OUTPUT_MODE_INFORMATION;8788/**89Returns information for an available graphics mode that the graphics device90and the set of active video output devices supports.9192@param This The EFI_GRAPHICS_OUTPUT_PROTOCOL instance.93@param ModeNumber The mode number to return information on.94@param SizeOfInfo A pointer to the size, in bytes, of the Info buffer.95@param Info A pointer to callee allocated buffer that returns information about ModeNumber.9697@retval EFI_SUCCESS Valid mode information was returned.98@retval EFI_DEVICE_ERROR A hardware error occurred trying to retrieve the video mode.99@retval EFI_INVALID_PARAMETER ModeNumber is not valid.100101**/102typedef103EFI_STATUS104(EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_QUERY_MODE)(105IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,106IN UINT32 ModeNumber,107OUT UINTN *SizeOfInfo,108OUT EFI_GRAPHICS_OUTPUT_MODE_INFORMATION **Info109);110111/**112Set the video device into the specified mode and clears the visible portions of113the output display to black.114115@param This The EFI_GRAPHICS_OUTPUT_PROTOCOL instance.116@param ModeNumber Abstraction that defines the current video mode.117118@retval EFI_SUCCESS The graphics mode specified by ModeNumber was selected.119@retval EFI_DEVICE_ERROR The device had an error and could not complete the request.120@retval EFI_UNSUPPORTED ModeNumber is not supported by this device.121122**/123typedef124EFI_STATUS125(EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_SET_MODE)(126IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,127IN UINT32 ModeNumber128);129130typedef struct {131UINT8 Blue;132UINT8 Green;133UINT8 Red;134UINT8 Reserved;135} EFI_GRAPHICS_OUTPUT_BLT_PIXEL;136137typedef union {138EFI_GRAPHICS_OUTPUT_BLT_PIXEL Pixel;139UINT32 Raw;140} EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION;141142///143/// actions for BltOperations144///145typedef enum {146///147/// Write data from the BltBuffer pixel (0, 0)148/// directly to every pixel of the video display rectangle149/// (DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height).150/// Only one pixel will be used from the BltBuffer. Delta is NOT used.151///152EfiBltVideoFill,153154///155/// Read data from the video display rectangle156/// (SourceX, SourceY) (SourceX + Width, SourceY + Height) and place it in157/// the BltBuffer rectangle (DestinationX, DestinationY )158/// (DestinationX + Width, DestinationY + Height). If DestinationX or159/// DestinationY is not zero then Delta must be set to the length in bytes160/// of a row in the BltBuffer.161///162EfiBltVideoToBltBuffer,163164///165/// Write data from the BltBuffer rectangle166/// (SourceX, SourceY) (SourceX + Width, SourceY + Height) directly to the167/// video display rectangle (DestinationX, DestinationY)168/// (DestinationX + Width, DestinationY + Height). If SourceX or SourceY is169/// not zero then Delta must be set to the length in bytes of a row in the170/// BltBuffer.171///172EfiBltBufferToVideo,173174///175/// Copy from the video display rectangle (SourceX, SourceY)176/// (SourceX + Width, SourceY + Height) to the video display rectangle177/// (DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height).178/// The BltBuffer and Delta are not used in this mode.179///180EfiBltVideoToVideo,181182EfiGraphicsOutputBltOperationMax183} EFI_GRAPHICS_OUTPUT_BLT_OPERATION;184185/**186Blt a rectangle of pixels on the graphics screen. Blt stands for BLock Transfer.187188@param This Protocol instance pointer.189@param BltBuffer The data to transfer to the graphics screen.190Size is at least Width*Height*sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL).191@param BltOperation The operation to perform when copying BltBuffer on to the graphics screen.192@param SourceX The X coordinate of source for the BltOperation.193@param SourceY The Y coordinate of source for the BltOperation.194@param DestinationX The X coordinate of destination for the BltOperation.195@param DestinationY The Y coordinate of destination for the BltOperation.196@param Width The width of a rectangle in the blt rectangle in pixels.197@param Height The height of a rectangle in the blt rectangle in pixels.198@param Delta Not used for EfiBltVideoFill or the EfiBltVideoToVideo operation.199If a Delta of zero is used, the entire BltBuffer is being operated on.200If a subrectangle of the BltBuffer is being used then Delta201represents the number of bytes in a row of the BltBuffer.202203@retval EFI_SUCCESS BltBuffer was drawn to the graphics screen.204@retval EFI_INVALID_PARAMETER BltOperation is not valid.205@retval EFI_DEVICE_ERROR The device had an error and could not complete the request.206207**/208typedef209EFI_STATUS210(EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_BLT)(211IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,212IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer OPTIONAL,213IN EFI_GRAPHICS_OUTPUT_BLT_OPERATION BltOperation,214IN UINTN SourceX,215IN UINTN SourceY,216IN UINTN DestinationX,217IN UINTN DestinationY,218IN UINTN Width,219IN UINTN Height,220IN UINTN Delta OPTIONAL221);222223typedef struct {224///225/// The number of modes supported by QueryMode() and SetMode().226///227UINT32 MaxMode;228///229/// Current Mode of the graphics device. Valid mode numbers are 0 to MaxMode -1.230///231UINT32 Mode;232///233/// Pointer to read-only EFI_GRAPHICS_OUTPUT_MODE_INFORMATION data.234///235EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info;236///237/// Size of Info structure in bytes.238///239UINTN SizeOfInfo;240///241/// Base address of graphics linear frame buffer.242/// Offset zero in FrameBufferBase represents the upper left pixel of the display.243///244EFI_PHYSICAL_ADDRESS FrameBufferBase;245///246/// Amount of frame buffer needed to support the active mode as defined by247/// PixelsPerScanLine xVerticalResolution x PixelElementSize.248///249UINTN FrameBufferSize;250} EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE;251252///253/// Provides a basic abstraction to set video modes and copy pixels to and from254/// the graphics controller's frame buffer. The linear address of the hardware255/// frame buffer is also exposed so software can write directly to the video hardware.256///257struct _EFI_GRAPHICS_OUTPUT_PROTOCOL {258EFI_GRAPHICS_OUTPUT_PROTOCOL_QUERY_MODE QueryMode;259EFI_GRAPHICS_OUTPUT_PROTOCOL_SET_MODE SetMode;260EFI_GRAPHICS_OUTPUT_PROTOCOL_BLT Blt;261///262/// Pointer to EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE data.263///264EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE *Mode;265};266267extern EFI_GUID gEfiGraphicsOutputProtocolGuid;268269#endif270271272