TianoCore EDK2 master
Loading...
Searching...
No Matches
Gop.c
Go to the documentation of this file.
1
12#include <Library/PcdLib.h>
13
14#include "VirtioGpu.h"
15
39VOID
41 IN OUT VGPU_GOP *VgpuGop,
42 IN BOOLEAN DisableHead
43 )
44{
45 EFI_STATUS Status;
46
47 ASSERT (VgpuGop->ResourceId != 0);
48 ASSERT (VgpuGop->BackingStore != NULL);
49
50 //
51 // If any of the following host-side destruction steps fail, we can't get out
52 // of an inconsistent state, so we'll hang. In general errors in object
53 // destruction can hardly be recovered from.
54 //
55 if (DisableHead) {
56 //
57 // Dissociate head (scanout) #0 from the currently used 2D host resource,
58 // by setting ResourceId=0 for it.
59 //
60 Status = VirtioGpuSetScanout (
61 VgpuGop->ParentBus, // VgpuDev
62 0,
63 0,
64 0,
65 0, // X, Y, Width, Height
66 0, // ScanoutId
67 0 // ResourceId
68 );
69 //
70 // HACK BEGINS HERE
71 //
72 // According to the GPU Device section of the VirtIo specification, the
73 // above operation is valid:
74 //
75 // "The driver can use resource_id = 0 to disable a scanout."
76 //
77 // However, in practice QEMU does not allow us to disable head (scanout) #0
78 // -- it rejects the command with response code 0x1202
79 // (VIRTIO_GPU_RESP_ERR_INVALID_SCANOUT_ID). Looking at the QEMU source
80 // code, function virtio_gpu_set_scanout() in "hw/display/virtio-gpu.c",
81 // this appears fully intentional, despite not being documented in the
82 // spec.
83 //
84 // Surprisingly, ignoring the error here, and proceeding to release
85 // host-side resources that presumably underlie head (scanout) #0, work
86 // without any problems -- the driver survives repeated "disconnect" /
87 // "connect -r" commands in the UEFI shell.
88 //
89 // So, for now, let's just suppress the error.
90 //
91 Status = EFI_SUCCESS;
92 //
93 // HACK ENDS HERE
94 //
95
96 ASSERT_EFI_ERROR (Status);
97 if (EFI_ERROR (Status)) {
98 CpuDeadLoop ();
99 }
100 }
101
102 //
103 // Detach backing pages from the currently used 2D host resource.
104 //
105 Status = VirtioGpuResourceDetachBacking (
106 VgpuGop->ParentBus, // VgpuDev
107 VgpuGop->ResourceId // ResourceId
108 );
109 ASSERT_EFI_ERROR (Status);
110 if (EFI_ERROR (Status)) {
111 CpuDeadLoop ();
112 }
113
114 //
115 // Unmap and release backing pages.
116 //
118 VgpuGop->ParentBus, // VgpuDev
119 VgpuGop->NumberOfPages, // NumberOfPages
120 VgpuGop->BackingStore, // HostAddress
121 VgpuGop->BackingStoreMap // Mapping
122 );
123 VgpuGop->BackingStore = NULL;
124 VgpuGop->NumberOfPages = 0;
125 VgpuGop->BackingStoreMap = NULL;
126
127 //
128 // Destroy the currently used 2D host resource.
129 //
130 Status = VirtioGpuResourceUnref (
131 VgpuGop->ParentBus, // VgpuDev
132 VgpuGop->ResourceId // ResourceId
133 );
134 ASSERT_EFI_ERROR (Status);
135 if (EFI_ERROR (Status)) {
136 CpuDeadLoop ();
137 }
138
139 VgpuGop->ResourceId = 0;
140}
141
142//
143// The resolutions supported by this driver.
144//
145typedef struct {
146 UINT32 Width;
147 UINT32 Height;
149
150STATIC CONST GOP_RESOLUTION mGopResolutions[] = {
151 { 640, 480 },
152 { 800, 480 },
153 { 800, 600 },
154 { 832, 624 },
155 { 960, 640 },
156 { 1024, 600 },
157 { 1024, 768 },
158 { 1152, 864 },
159 { 1152, 870 },
160 { 1280, 720 },
161 { 1280, 760 },
162 { 1280, 768 },
163 { 1280, 800 },
164 { 1280, 960 },
165 { 1280, 1024 },
166 { 1360, 768 },
167 { 1366, 768 },
168 { 1400, 1050 },
169 { 1440, 900 },
170 { 1600, 900 },
171 { 1600, 1200 },
172 { 1680, 1050 },
173 { 1920, 1080 },
174 { 1920, 1200 },
175 { 1920, 1440 },
176 { 2000, 2000 },
177 { 2048, 1536 },
178 { 2048, 2048 },
179 { 2560, 1440 },
180 { 2560, 1600 },
181 { 2560, 2048 },
182 { 2800, 2100 },
183 { 3200, 2400 },
184 { 3840, 2160 },
185 { 4096, 2160 },
186 { 7680, 4320 },
187 { 8192, 4320 },
188};
189
190//
191// Macro for casting VGPU_GOP.Gop to VGPU_GOP.
192//
193#define VGPU_GOP_FROM_GOP(GopPointer) \
194 CR (GopPointer, VGPU_GOP, Gop, VGPU_GOP_SIG)
195
196STATIC
197VOID
198EFIAPI
199GopNativeResolution (
200 IN VGPU_GOP *VgpuGop,
201 OUT UINT32 *XRes,
202 OUT UINT32 *YRes
203 )
204{
205 volatile VIRTIO_GPU_RESP_DISPLAY_INFO DisplayInfo;
206 EFI_STATUS Status;
207 UINTN Index;
208
209 Status = VirtioGpuGetDisplayInfo (VgpuGop->ParentBus, &DisplayInfo);
210 if (Status != EFI_SUCCESS) {
211 return;
212 }
213
214 for (Index = 0; Index < VIRTIO_GPU_MAX_SCANOUTS; Index++) {
215 if (!DisplayInfo.Pmodes[Index].Enabled ||
216 !DisplayInfo.Pmodes[Index].Rectangle.Width ||
217 !DisplayInfo.Pmodes[Index].Rectangle.Height)
218 {
219 continue;
220 }
221
222 DEBUG ((
223 DEBUG_INFO,
224 "%a: #%d: %dx%d\n",
225 __func__,
226 Index,
227 DisplayInfo.Pmodes[Index].Rectangle.Width,
228 DisplayInfo.Pmodes[Index].Rectangle.Height
229 ));
230 if ((*XRes == 0) || (*YRes == 0)) {
231 *XRes = DisplayInfo.Pmodes[Index].Rectangle.Width;
232 *YRes = DisplayInfo.Pmodes[Index].Rectangle.Height;
233 }
234 }
235}
236
237STATIC
238VOID
239EFIAPI
240GopInitialize (
242 )
243{
244 VGPU_GOP *VgpuGop;
245 EFI_STATUS Status;
246 UINT32 XRes = 0, YRes = 0, Index;
247
248 VgpuGop = VGPU_GOP_FROM_GOP (This);
249
250 //
251 // Set up the Gop -> GopMode -> GopModeInfo pointer chain, and the other
252 // (nonzero) constant fields.
253 //
254 // No direct framebuffer access is supported, only Blt() is.
255 //
256 VgpuGop->Gop.Mode = &VgpuGop->GopMode;
257
258 VgpuGop->GopMode.MaxMode = (UINT32)(ARRAY_SIZE (mGopResolutions));
259 VgpuGop->GopMode.Info = &VgpuGop->GopModeInfo;
260 VgpuGop->GopMode.SizeOfInfo = sizeof VgpuGop->GopModeInfo;
261
262 VgpuGop->GopModeInfo.PixelFormat = PixelBltOnly;
263
264 //
265 // query host for display resolution
266 //
267 GopNativeResolution (VgpuGop, &XRes, &YRes);
268 if ((XRes < 640) || (YRes < 480)) {
269 /* ignore hint, GraphicsConsoleDxe needs 640x480 or larger */
270 return;
271 }
272
273 if (PcdGet8 (PcdVideoResolutionSource) == 0) {
274 Status = PcdSet32S (PcdVideoHorizontalResolution, XRes);
275 ASSERT_RETURN_ERROR (Status);
276 Status = PcdSet32S (PcdVideoVerticalResolution, YRes);
277 ASSERT_RETURN_ERROR (Status);
278 Status = PcdSet8S (PcdVideoResolutionSource, 2);
279 ASSERT_RETURN_ERROR (Status);
280 }
281
282 VgpuGop->NativeXRes = XRes;
283 VgpuGop->NativeYRes = YRes;
284 for (Index = 0; Index < ARRAY_SIZE (mGopResolutions); Index++) {
285 if ((mGopResolutions[Index].Width == XRes) &&
286 (mGopResolutions[Index].Height == YRes))
287 {
288 // native resolution already is in mode list
289 return;
290 }
291 }
292
293 // add to mode list
294 VgpuGop->GopMode.MaxMode++;
295}
296
297//
298// EFI_GRAPHICS_OUTPUT_PROTOCOL member functions.
299//
300STATIC
302EFIAPI
303GopQueryMode (
305 IN UINT32 ModeNumber,
306 OUT UINTN *SizeOfInfo,
308 )
309{
311
312 if ((Info == NULL) ||
313 (SizeOfInfo == NULL) ||
314 (ModeNumber >= This->Mode->MaxMode))
315 {
316 return EFI_INVALID_PARAMETER;
317 }
318
319 GopModeInfo = AllocateZeroPool (sizeof *GopModeInfo);
320 if (GopModeInfo == NULL) {
321 return EFI_OUT_OF_RESOURCES;
322 }
323
324 if (ModeNumber < ARRAY_SIZE (mGopResolutions)) {
325 GopModeInfo->HorizontalResolution = mGopResolutions[ModeNumber].Width;
326 GopModeInfo->VerticalResolution = mGopResolutions[ModeNumber].Height;
327 } else {
328 VGPU_GOP *VgpuGop = VGPU_GOP_FROM_GOP (This);
329 GopModeInfo->HorizontalResolution = VgpuGop->NativeXRes;
330 GopModeInfo->VerticalResolution = VgpuGop->NativeYRes;
331 }
332
333 GopModeInfo->PixelFormat = PixelBltOnly;
334 GopModeInfo->PixelsPerScanLine = GopModeInfo->HorizontalResolution;
335
336 *SizeOfInfo = sizeof *GopModeInfo;
337 *Info = GopModeInfo;
338 return EFI_SUCCESS;
339}
340
341STATIC
343EFIAPI
344GopSetMode (
346 IN UINT32 ModeNumber
347 )
348{
349 VGPU_GOP *VgpuGop;
350 UINT32 NewResourceId;
351 UINTN NewNumberOfBytes;
352 UINTN NewNumberOfPages;
353 VOID *NewBackingStore;
354 EFI_PHYSICAL_ADDRESS NewBackingStoreDeviceAddress;
355 VOID *NewBackingStoreMap;
356 UINTN SizeOfInfo;
358
359 EFI_STATUS Status;
360 EFI_STATUS Status2;
361
362 if (!This->Mode) {
363 // SetMode() call in InitVgpuGop() triggers this.
364 GopInitialize (This);
365 }
366
367 Status = GopQueryMode (This, ModeNumber, &SizeOfInfo, &GopModeInfo);
368 if (Status != EFI_SUCCESS) {
369 return Status;
370 }
371
372 VgpuGop = VGPU_GOP_FROM_GOP (This);
373
374 //
375 // Distinguish the first (internal) call from the other (protocol consumer)
376 // calls.
377 //
378 if (VgpuGop->ResourceId == 0) {
379 //
380 // This is the first time we create a host side resource.
381 //
382 NewResourceId = 1;
383 } else {
384 //
385 // We already have an active host side resource. Create the new one without
386 // interfering with the current one, so that we can cleanly bail out on
387 // error, without disturbing the current graphics mode.
388 //
389 // The formula below will alternate between IDs 1 and 2.
390 //
391 NewResourceId = 3 - VgpuGop->ResourceId;
392 }
393
394 //
395 // Create the 2D host resource.
396 //
398 VgpuGop->ParentBus, // VgpuDev
399 NewResourceId, // ResourceId
400 VirtioGpuFormatB8G8R8X8Unorm, // Format
401 GopModeInfo->HorizontalResolution, // Width
402 GopModeInfo->VerticalResolution // Height
403 );
404 if (EFI_ERROR (Status)) {
405 return Status;
406 }
407
408 //
409 // Allocate, zero and map guest backing store, for bus master common buffer
410 // operation.
411 //
412 NewNumberOfBytes = GopModeInfo->HorizontalResolution *
413 GopModeInfo->VerticalResolution * sizeof (UINT32);
414 NewNumberOfPages = EFI_SIZE_TO_PAGES (NewNumberOfBytes);
416 VgpuGop->ParentBus, // VgpuDev
417 NewNumberOfPages, // NumberOfPages
418 &NewBackingStore, // HostAddress
419 &NewBackingStoreDeviceAddress, // DeviceAddress
420 &NewBackingStoreMap // Mapping
421 );
422 if (EFI_ERROR (Status)) {
423 goto DestroyHostResource;
424 }
425
426 //
427 // Attach backing store to the host resource.
428 //
429 Status = VirtioGpuResourceAttachBacking (
430 VgpuGop->ParentBus, // VgpuDev
431 NewResourceId, // ResourceId
432 NewBackingStoreDeviceAddress, // BackingStoreDeviceAddress
433 NewNumberOfPages // NumberOfPages
434 );
435 if (EFI_ERROR (Status)) {
436 goto UnmapAndFreeBackingStore;
437 }
438
439 //
440 // Point head (scanout) #0 to the host resource.
441 //
442 Status = VirtioGpuSetScanout (
443 VgpuGop->ParentBus, // VgpuDev
444 0, // X
445 0, // Y
446 GopModeInfo->HorizontalResolution, // Width
447 GopModeInfo->VerticalResolution, // Height
448 0, // ScanoutId
449 NewResourceId // ResourceId
450 );
451 if (EFI_ERROR (Status)) {
452 goto DetachBackingStore;
453 }
454
455 //
456 // If this is not the first (i.e., internal) call, then we have to (a) flush
457 // the new resource to head (scanout) #0, after having flipped the latter to
458 // the former above, plus (b) release the old resources.
459 //
460 if (VgpuGop->ResourceId != 0) {
461 Status = VirtioGpuResourceFlush (
462 VgpuGop->ParentBus, // VgpuDev
463 0, // X
464 0, // Y
465 GopModeInfo->HorizontalResolution, // Width
466 GopModeInfo->VerticalResolution, // Height
467 NewResourceId // ResourceId
468 );
469 if (EFI_ERROR (Status)) {
470 //
471 // Flip head (scanout) #0 back to the current resource. If this fails, we
472 // cannot continue, as this error occurs on the error path and is
473 // therefore non-recoverable.
474 //
475 Status2 = VirtioGpuSetScanout (
476 VgpuGop->ParentBus, // VgpuDev
477 0, // X
478 0, // Y
479 VgpuGop->GopModeInfo.HorizontalResolution, // Width
480 VgpuGop->GopModeInfo.VerticalResolution, // Height
481 0, // ScanoutId
482 VgpuGop->ResourceId // ResourceId
483 );
484 ASSERT_EFI_ERROR (Status2);
485 if (EFI_ERROR (Status2)) {
486 CpuDeadLoop ();
487 }
488
489 goto DetachBackingStore;
490 }
491
492 //
493 // Flush successful; release the old resources (without disabling head
494 // (scanout) #0).
495 //
496 ReleaseGopResources (VgpuGop, FALSE /* DisableHead */);
497 }
498
499 //
500 // This is either the first (internal) call when we have no old resources
501 // yet, or we've changed the mode successfully and released the old
502 // resources.
503 //
504 ASSERT (VgpuGop->ResourceId == 0);
505 ASSERT (VgpuGop->BackingStore == NULL);
506
507 VgpuGop->ResourceId = NewResourceId;
508 VgpuGop->BackingStore = NewBackingStore;
509 VgpuGop->NumberOfPages = NewNumberOfPages;
510 VgpuGop->BackingStoreMap = NewBackingStoreMap;
511
512 //
513 // Populate Mode and ModeInfo (mutable fields only).
514 //
515 VgpuGop->GopMode.Mode = ModeNumber;
516 CopyMem (&VgpuGop->GopModeInfo, GopModeInfo, sizeof VgpuGop->GopModeInfo);
517 FreePool (GopModeInfo);
518 return EFI_SUCCESS;
519
520DetachBackingStore:
521 Status2 = VirtioGpuResourceDetachBacking (VgpuGop->ParentBus, NewResourceId);
522 ASSERT_EFI_ERROR (Status2);
523 if (EFI_ERROR (Status2)) {
524 CpuDeadLoop ();
525 }
526
527UnmapAndFreeBackingStore:
529 VgpuGop->ParentBus, // VgpuDev
530 NewNumberOfPages, // NumberOfPages
531 NewBackingStore, // HostAddress
532 NewBackingStoreMap // Mapping
533 );
534
535DestroyHostResource:
536 Status2 = VirtioGpuResourceUnref (VgpuGop->ParentBus, NewResourceId);
537 ASSERT_EFI_ERROR (Status2);
538 if (EFI_ERROR (Status2)) {
539 CpuDeadLoop ();
540 }
541
542 FreePool (GopModeInfo);
543 return Status;
544}
545
546STATIC
548EFIAPI
549GopBlt (
551 IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer OPTIONAL,
553 IN UINTN SourceX,
554 IN UINTN SourceY,
555 IN UINTN DestinationX,
556 IN UINTN DestinationY,
557 IN UINTN Width,
558 IN UINTN Height,
559 IN UINTN Delta OPTIONAL
560 )
561{
562 VGPU_GOP *VgpuGop;
563 UINT32 CurrentHorizontal;
564 UINT32 CurrentVertical;
565 UINTN SegmentSize;
566 UINTN Y;
567 UINTN ResourceOffset;
568 EFI_STATUS Status;
569
570 VgpuGop = VGPU_GOP_FROM_GOP (This);
571 CurrentHorizontal = VgpuGop->GopModeInfo.HorizontalResolution;
572 CurrentVertical = VgpuGop->GopModeInfo.VerticalResolution;
573
574 //
575 // We can avoid pixel format conversion in the guest because the internal
576 // representation of EFI_GRAPHICS_OUTPUT_BLT_PIXEL and that of
577 // VirtioGpuFormatB8G8R8X8Unorm are identical.
578 //
579 SegmentSize = Width * sizeof (UINT32);
580
581 //
582 // Delta is relevant for operations that read a rectangle from, or write a
583 // rectangle to, BltBuffer.
584 //
585 // In these cases, Delta is the stride of BltBuffer, in bytes. If Delta is
586 // zero, then Width is the entire width of BltBuffer, and the stride is
587 // supposed to be calculated from Width.
588 //
589 if ((BltOperation == EfiBltVideoToBltBuffer) ||
590 (BltOperation == EfiBltBufferToVideo))
591 {
592 if (Delta == 0) {
593 Delta = SegmentSize;
594 }
595 }
596
597 //
598 // For operations that write to the display, check if the destination fits
599 // onto the display.
600 //
601 if ((BltOperation == EfiBltVideoFill) ||
602 (BltOperation == EfiBltBufferToVideo) ||
603 (BltOperation == EfiBltVideoToVideo))
604 {
605 if ((DestinationX > CurrentHorizontal) ||
606 (Width > CurrentHorizontal - DestinationX) ||
607 (DestinationY > CurrentVertical) ||
608 (Height > CurrentVertical - DestinationY))
609 {
610 return EFI_INVALID_PARAMETER;
611 }
612 }
613
614 //
615 // For operations that read from the display, check if the source fits onto
616 // the display.
617 //
618 if ((BltOperation == EfiBltVideoToBltBuffer) ||
619 (BltOperation == EfiBltVideoToVideo))
620 {
621 if ((SourceX > CurrentHorizontal) ||
622 (Width > CurrentHorizontal - SourceX) ||
623 (SourceY > CurrentVertical) ||
624 (Height > CurrentVertical - SourceY))
625 {
626 return EFI_INVALID_PARAMETER;
627 }
628 }
629
630 //
631 // Render the request. For requests that do not modify the display, there
632 // won't be further steps.
633 //
634 switch (BltOperation) {
635 case EfiBltVideoFill:
636 //
637 // Write data from the BltBuffer pixel (0, 0) directly to every pixel of
638 // the video display rectangle (DestinationX, DestinationY) (DestinationX +
639 // Width, DestinationY + Height). Only one pixel will be used from the
640 // BltBuffer. Delta is NOT used.
641 //
642 for (Y = 0; Y < Height; ++Y) {
643 SetMem32 (
644 VgpuGop->BackingStore +
645 (DestinationY + Y) * CurrentHorizontal + DestinationX,
646 SegmentSize,
647 *(UINT32 *)BltBuffer
648 );
649 }
650
651 break;
652
654 //
655 // Read data from the video display rectangle (SourceX, SourceY) (SourceX +
656 // Width, SourceY + Height) and place it in the BltBuffer rectangle
657 // (DestinationX, DestinationY ) (DestinationX + Width, DestinationY +
658 // Height). If DestinationX or DestinationY is not zero then Delta must be
659 // set to the length in bytes of a row in the BltBuffer.
660 //
661 for (Y = 0; Y < Height; ++Y) {
662 CopyMem (
663 (UINT8 *)BltBuffer +
664 (DestinationY + Y) * Delta + DestinationX * sizeof *BltBuffer,
665 VgpuGop->BackingStore +
666 (SourceY + Y) * CurrentHorizontal + SourceX,
667 SegmentSize
668 );
669 }
670
671 return EFI_SUCCESS;
672
674 //
675 // Write data from the BltBuffer rectangle (SourceX, SourceY) (SourceX +
676 // Width, SourceY + Height) directly to the video display rectangle
677 // (DestinationX, DestinationY) (DestinationX + Width, DestinationY +
678 // Height). If SourceX or SourceY is not zero then Delta must be set to the
679 // length in bytes of a row in the BltBuffer.
680 //
681 for (Y = 0; Y < Height; ++Y) {
682 CopyMem (
683 VgpuGop->BackingStore +
684 (DestinationY + Y) * CurrentHorizontal + DestinationX,
685 (UINT8 *)BltBuffer +
686 (SourceY + Y) * Delta + SourceX * sizeof *BltBuffer,
687 SegmentSize
688 );
689 }
690
691 break;
692
694 //
695 // Copy from the video display rectangle (SourceX, SourceY) (SourceX +
696 // Width, SourceY + Height) to the video display rectangle (DestinationX,
697 // DestinationY) (DestinationX + Width, DestinationY + Height). The
698 // BltBuffer and Delta are not used in this mode.
699 //
700 // A single invocation of CopyMem() handles overlap between source and
701 // destination (that is, within a single line), but for multiple
702 // invocations, we must handle overlaps.
703 //
704 if (SourceY < DestinationY) {
705 Y = Height;
706 while (Y > 0) {
707 --Y;
708 CopyMem (
709 VgpuGop->BackingStore +
710 (DestinationY + Y) * CurrentHorizontal + DestinationX,
711 VgpuGop->BackingStore +
712 (SourceY + Y) * CurrentHorizontal + SourceX,
713 SegmentSize
714 );
715 }
716 } else {
717 for (Y = 0; Y < Height; ++Y) {
718 CopyMem (
719 VgpuGop->BackingStore +
720 (DestinationY + Y) * CurrentHorizontal + DestinationX,
721 VgpuGop->BackingStore +
722 (SourceY + Y) * CurrentHorizontal + SourceX,
723 SegmentSize
724 );
725 }
726 }
727
728 break;
729
730 default:
731 return EFI_INVALID_PARAMETER;
732 }
733
734 //
735 // For operations that wrote to the display, submit the updated area to the
736 // host -- update the host resource from guest memory.
737 //
738 ResourceOffset = sizeof (UINT32) * (DestinationY * CurrentHorizontal +
739 DestinationX);
740 Status = VirtioGpuTransferToHost2d (
741 VgpuGop->ParentBus, // VgpuDev
742 (UINT32)DestinationX, // X
743 (UINT32)DestinationY, // Y
744 (UINT32)Width, // Width
745 (UINT32)Height, // Height
746 ResourceOffset, // Offset
747 VgpuGop->ResourceId // ResourceId
748 );
749 if (EFI_ERROR (Status)) {
750 return Status;
751 }
752
753 //
754 // Flush the updated resource to the display.
755 //
756 Status = VirtioGpuResourceFlush (
757 VgpuGop->ParentBus, // VgpuDev
758 (UINT32)DestinationX, // X
759 (UINT32)DestinationY, // Y
760 (UINT32)Width, // Width
761 (UINT32)Height, // Height
762 VgpuGop->ResourceId // ResourceId
763 );
764 return Status;
765}
766
767//
768// Template for initializing VGPU_GOP.Gop.
769//
770CONST EFI_GRAPHICS_OUTPUT_PROTOCOL mGopTemplate = {
771 GopQueryMode,
772 GopSetMode,
773 GopBlt,
774 NULL // Mode, to be overwritten in the actual protocol instance
775};
UINT64 UINTN
VOID EFIAPI CpuDeadLoop(VOID)
Definition: CpuDeadLoop.c:25
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
VOID *EFIAPI SetMem32(OUT VOID *Buffer, IN UINTN Length, IN UINT32 Value)
VOID VirtioGpuUnmapAndFreeBackingStore(IN VGPU_DEV *VgpuDev, IN UINTN NumberOfPages, IN VOID *HostAddress, IN VOID *Mapping)
Definition: Commands.c:317
EFI_STATUS VirtioGpuAllocateZeroAndMapBackingStore(IN VGPU_DEV *VgpuDev, IN UINTN NumberOfPages, OUT VOID **HostAddress, OUT EFI_PHYSICAL_ADDRESS *DeviceAddress, OUT VOID **Mapping)
Definition: Commands.c:244
EFI_STATUS VirtioGpuResourceCreate2d(IN OUT VGPU_DEV *VgpuDev, IN UINT32 ResourceId, IN VIRTIO_GPU_FORMATS Format, IN UINT32 Width, IN UINT32 Height)
Definition: Commands.c:622
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
#define NULL
Definition: Base.h:319
#define CONST
Definition: Base.h:259
#define STATIC
Definition: Base.h:264
#define FALSE
Definition: Base.h:307
#define ARRAY_SIZE(Array)
Definition: Base.h:1393
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
#define ASSERT_EFI_ERROR(StatusParameter)
Definition: DebugLib.h:462
#define ASSERT_RETURN_ERROR(StatusParameter)
Definition: DebugLib.h:493
#define DEBUG(Expression)
Definition: DebugLib.h:434
EFI_GRAPHICS_OUTPUT_BLT_OPERATION
@ EfiBltVideoToBltBuffer
@ EfiBltBufferToVideo
@ EfiBltVideoFill
@ EfiBltVideoToVideo
@ PixelBltOnly
#define PcdGet8(TokenName)
Definition: PcdLib.h:336
#define PcdSet32S(TokenName, Value)
Definition: PcdLib.h:497
#define PcdSet8S(TokenName, Value)
Definition: PcdLib.h:469
UINT64 EFI_PHYSICAL_ADDRESS
Definition: UefiBaseType.h:50
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
#define EFI_SIZE_TO_PAGES(Size)
Definition: UefiBaseType.h:200
#define EFI_SUCCESS
Definition: UefiBaseType.h:112
VOID ReleaseGopResources(IN OUT VGPU_GOP *VgpuGop, IN BOOLEAN DisableHead)
Definition: Gop.c:40
EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE * Mode
EFI_GRAPHICS_PIXEL_FORMAT PixelFormat
EFI_GRAPHICS_OUTPUT_MODE_INFORMATION * Info