16QemuVideoCompleteModeInfo (
22 if (ModeData->ColorDepth == 8) {
24 Info->PixelInformation.RedMask = PIXEL_RED_MASK;
25 Info->PixelInformation.GreenMask = PIXEL_GREEN_MASK;
26 Info->PixelInformation.BlueMask = PIXEL_BLUE_MASK;
27 Info->PixelInformation.ReservedMask = 0;
28 }
else if (ModeData->ColorDepth == 24) {
30 Info->PixelInformation.RedMask = PIXEL24_RED_MASK;
31 Info->PixelInformation.GreenMask = PIXEL24_GREEN_MASK;
32 Info->PixelInformation.BlueMask = PIXEL24_BLUE_MASK;
33 Info->PixelInformation.ReservedMask = 0;
34 }
else if (ModeData->ColorDepth == 32) {
35 DEBUG ((DEBUG_INFO,
"PixelBlueGreenRedReserved8BitPerColor\n"));
37 Info->PixelInformation.RedMask = 0;
38 Info->PixelInformation.GreenMask = 0;
39 Info->PixelInformation.BlueMask = 0;
40 Info->PixelInformation.ReservedMask = 0;
42 DEBUG ((DEBUG_ERROR,
"%a: Invalid ColorDepth %u", __func__, ModeData->ColorDepth));
46 Info->PixelsPerScanLine = Info->HorizontalResolution;
51QemuVideoCompleteModeData (
61 ModeData = &Private->ModeData[Mode->Mode];
63 QemuVideoCompleteModeInfo (ModeData, Info);
65 Private->PciIo->GetBarAttributes (
67 Private->FrameBufferVramBarIndex,
69 (VOID **)&FrameBufDesc
72 Mode->FrameBufferBase = FrameBufDesc->AddrRangeMin;
74 Mode->FrameBufferSize = Mode->FrameBufferSize * ((ModeData->ColorDepth + 7) / 8);
80 "FrameBufferBase: 0x%Lx, FrameBufferSize: 0x%Lx\n",
81 Mode->FrameBufferBase,
82 (UINT64)Mode->FrameBufferSize
86 Status =
gDS->SetMemorySpaceCapabilities (
87 FrameBufDesc->AddrRangeMin,
88 FrameBufDesc->AddrLen,
89 EFI_MEMORY_UC | EFI_MEMORY_WC | EFI_MEMORY_XP
93 Status =
gDS->SetMemorySpaceAttributes (
94 FrameBufDesc->AddrRangeMin,
95 FrameBufDesc->AddrLen,
96 EFI_MEMORY_WC | EFI_MEMORY_XP
110QemuVideoGraphicsOutputQueryMode (
112 IN UINT32 ModeNumber,
141 Private = QEMU_VIDEO_PRIVATE_DATA_FROM_GRAPHICS_OUTPUT_THIS (This);
143 if ((Info ==
NULL) || (SizeOfInfo ==
NULL) || (ModeNumber >= This->Mode->MaxMode)) {
144 return EFI_INVALID_PARAMETER;
149 return EFI_OUT_OF_RESOURCES;
154 ModeData = &Private->ModeData[ModeNumber];
155 (*Info)->HorizontalResolution = ModeData->HorizontalResolution;
156 (*Info)->VerticalResolution = ModeData->VerticalResolution;
157 QemuVideoCompleteModeInfo (ModeData, *Info);
164QemuVideoGraphicsOutputSetMode (
188 RETURN_STATUS Status;
191 Private = QEMU_VIDEO_PRIVATE_DATA_FROM_GRAPHICS_OUTPUT_THIS (This);
193 if (ModeNumber >= This->Mode->MaxMode) {
194 return EFI_UNSUPPORTED;
197 ModeData = &Private->ModeData[ModeNumber];
199 switch (Private->Variant) {
200 case QEMU_VIDEO_CIRRUS_5430:
201 case QEMU_VIDEO_CIRRUS_5446:
204 case QEMU_VIDEO_BOCHS_MMIO:
205 case QEMU_VIDEO_BOCHS:
206 InitializeBochsGraphicsMode (Private, ModeData);
210 return EFI_DEVICE_ERROR;
213 This->Mode->Mode = ModeNumber;
214 This->Mode->Info->HorizontalResolution = ModeData->HorizontalResolution;
215 This->Mode->Info->VerticalResolution = ModeData->VerticalResolution;
218 QemuVideoCompleteModeData (Private, This->Mode);
224 (VOID *)(
UINTN)This->Mode->FrameBufferBase,
226 Private->FrameBufferBltConfigure,
227 &Private->FrameBufferBltConfigureSize
233 if (Private->FrameBufferBltConfigure !=
NULL) {
234 FreePool (Private->FrameBufferBltConfigure);
237 Private->FrameBufferBltConfigure =
239 ASSERT (Private->FrameBufferBltConfigure !=
NULL);
245 (VOID *)(
UINTN)This->Mode->FrameBufferBase,
247 Private->FrameBufferBltConfigure,
248 &Private->FrameBufferBltConfigureSize
257 ZeroMem (&Black,
sizeof (Black));
259 Private->FrameBufferBltConfigure,
266 This->Mode->Info->HorizontalResolution,
267 This->Mode->Info->VerticalResolution,
277QemuVideoGraphicsOutputBlt (
323 Private = QEMU_VIDEO_PRIVATE_DATA_FROM_GRAPHICS_OUTPUT_THIS (This);
329 OriginalTPL =
gBS->RaiseTPL (TPL_NOTIFY);
331 switch (BltOperation) {
337 Private->FrameBufferBltConfigure,
351 Status = EFI_INVALID_PARAMETER;
355 gBS->RestoreTPL (OriginalTPL);
361QemuVideoGraphicsOutputConstructor (
368 GraphicsOutput = &Private->GraphicsOutput;
369 GraphicsOutput->QueryMode = QemuVideoGraphicsOutputQueryMode;
370 GraphicsOutput->SetMode = QemuVideoGraphicsOutputSetMode;
371 GraphicsOutput->Blt = QemuVideoGraphicsOutputBlt;
376 Status =
gBS->AllocatePool (
379 (VOID **)&Private->GraphicsOutput.
Mode
381 if (EFI_ERROR (Status)) {
385 Status =
gBS->AllocatePool (
388 (VOID **)&Private->GraphicsOutput.
Mode->
Info
390 if (EFI_ERROR (Status)) {
394 Private->GraphicsOutput.
Mode->
MaxMode = (UINT32)Private->MaxMode;
395 Private->GraphicsOutput.
Mode->
Mode = GRAPHICS_OUTPUT_INVALIDE_MODE_NUMBER;
396 Private->FrameBufferBltConfigure =
NULL;
397 Private->FrameBufferBltConfigureSize = 0;
402 Status = GraphicsOutput->SetMode (GraphicsOutput, 0);
403 if (EFI_ERROR (Status)) {
409 Private->ModeData[Private->GraphicsOutput.
Mode->
Mode].HorizontalResolution,
410 Private->ModeData[Private->GraphicsOutput.
Mode->
Mode].VerticalResolution
420 Private->GraphicsOutput.
Mode =
NULL;
426QemuVideoGraphicsOutputDestructor (
442 if (Private->FrameBufferBltConfigure !=
NULL) {
443 FreePool (Private->FrameBufferBltConfigure);
446 if (Private->GraphicsOutput.
Mode !=
NULL) {
448 gBS->FreePool (Private->GraphicsOutput.
Mode->
Info);
451 gBS->FreePool (Private->GraphicsOutput.
Mode);
PACKED struct @89 EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR
VOID *EFIAPI ZeroMem(OUT VOID *Buffer, IN UINTN Length)
VOID EFIAPI FreePool(IN VOID *Buffer)
RETURN_STATUS EFIAPI FrameBufferBlt(IN FRAME_BUFFER_CONFIGURE *Configure, IN OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer OPTIONAL, IN EFI_GRAPHICS_OUTPUT_BLT_OPERATION BltOperation, IN UINTN SourceX, IN UINTN SourceY, IN UINTN DestinationX, IN UINTN DestinationY, IN UINTN Width, IN UINTN Height, IN UINTN Delta)
RETURN_STATUS EFIAPI FrameBufferBltConfigure(IN VOID *FrameBuffer, IN EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *FrameBufferInfo, IN OUT FRAME_BUFFER_CONFIGURE *Configure, IN OUT UINTN *ConfigureSize)
#define RETURN_BUFFER_TOO_SMALL
#define ASSERT_EFI_ERROR(StatusParameter)
#define ASSERT_RETURN_ERROR(StatusParameter)
#define DEBUG(Expression)
EFI_GRAPHICS_OUTPUT_BLT_OPERATION
@ PixelBlueGreenRedReserved8BitPerColor
VOID DrawLogo(QEMU_VIDEO_PRIVATE_DATA *Private, UINTN ScreenWidth, UINTN ScreenHeight)
VOID InitializeCirrusGraphicsMode(QEMU_VIDEO_PRIVATE_DATA *Private, QEMU_VIDEO_CIRRUS_MODES *ModeData)
QEMU_VIDEO_CIRRUS_MODES QemuVideoCirrusModes[]
#define FeaturePcdGet(TokenName)
VOID *EFIAPI AllocatePool(IN UINTN AllocationSize)
#define EFI_PAGES_TO_SIZE(Pages)
#define EFI_SIZE_TO_PAGES(Size)
EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE * Mode
UINT32 VerticalResolution
UINT32 HorizontalResolution
EFI_GRAPHICS_OUTPUT_MODE_INFORMATION * Info