From 32870e00e6cf3ab664f70cfcc903ff129b3efaca Mon Sep 17 00:00:00 2001 From: paravoid Date: Sat, 2 Jul 2022 07:02:24 +0300 Subject: [PATCH] screenshot: Use blt --- efigop/screenshot/efiboot.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/efigop/screenshot/efiboot.c b/efigop/screenshot/efiboot.c index 129ffc9..08bd119 100644 --- a/efigop/screenshot/efiboot.c +++ b/efigop/screenshot/efiboot.c @@ -1068,8 +1068,8 @@ Xscreenshot_efi() { return (0); } - void *FrameBufferBase; - UINTN FrameBufferSize; + void *pixels; + UINTN picsize; EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *gopi; EFI_GUID fs_guid = SIMPLE_FILE_SYSTEM_PROTOCOL; EFI_FILE_IO_INTERFACE *IOVolume; @@ -1081,14 +1081,17 @@ Xscreenshot_efi() { BS->LocateProtocol(&gop_guid, NULL, (void **)&gop); gopi = gop->Mode->Info; - FrameBufferBase = (void *)gop->Mode->FrameBufferBase; - FrameBufferSize = gopi->VerticalResolution * gopi->PixelsPerScanLine * 4; + picsize = gopi->VerticalResolution * gopi->PixelsPerScanLine * 4; + BS->AllocatePool(EfiLoaderData, picsize, &pixels); + /* This, Buffer, Operation, SourceX, SourceY, DestinationX, DestinationY, Width, Height, Delta (not needed here) */ + gop->Blt(gop, pixels, EfiBltVideoToBltBuffer, 0, 0, 0, 0, gopi->HorizontalResolution, gopi->VerticalResolution, 0); BS->LocateHandleBuffer(ByProtocol, &fs_guid, NULL, &nhandles, &handles); BS->HandleProtocol(handles[0], &fs_guid, (void **)&IOVolume); IOVolume->OpenVolume(IOVolume, &Volume); Volume->Open(Volume, &FileHandle, FileName, EFI_FILE_MODE_CREATE | EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE, 0); - FileHandle->Write(FileHandle, &FrameBufferSize, FrameBufferBase); + FileHandle->Write(FileHandle, &picsize, pixels); FileHandle->Close(FileHandle); + BS->FreePool(pixels); return (0); } -- 2.45.2