Sure, I've attached a few related functions.
Date: Wed, 8 Oct 2014 22:32:10 -0300
From: rafaelrodrigues.mach...@gmail.com
To: edk2-devel@lists.sourceforge.net
Subject: Re: [edk2] BltLibVideoToBltBuffer returns black pixels
Hi J. E.
Is it possible for you to send us some code related to this ? Maybe the
important parts only.
I think it'll be easier to try to help.
Thanks Rafael R. Machado
2014-10-08 19:43 GMT-03:00 J. E. <nszero...@hotmail.com>:
I always use the last handle in the handle list, it works on 100% of the PC's
Ive tested. Some PC's have 3 or 4 handles.
However I'd prefer to do it the correct way so I will query the protocol as
suggested.
I currently use:
nGOPHandleIndex = handleCount - 1;
Status = gBS->HandleProtocol(
handleBuffer[nGOPHandleIndex],
&gEfiGraphicsOutputProtocolGuid,
(VOID **)&(GraphicsOutput));
The PC that returns black pixels has 2 total handles.
If I choose the 1st handle, there is no graphics output at all. It stays on the
console text screen.
If I choose the 2nd handle, there is graphics output, but
BltLibVideoToBltBuffer returns black pixels.
So I am definitely using the correct handle for GOP graphics.
I was thinking maybe the BlitLib was using the 1st handle instead of the 2nd
handle, but I couldn't find a way to set the handle index in BlitLib. Even if
it was using the 1st handle, wouldn't I see bits of ASCII characters in the
returned blit from the console? I see no text, just black.
BltLibVideoToBltBuffer also has no option to set the handle.
So it seems the BIOS in question simply hasn't implemented proper
Screen-to-Blit functionality.
I suppose it's not a feature many people would use so it would be easy for some
BIOS developers to forget to test/implement this function.
Thanks.
Date: Wed, 8 Oct 2014 12:27:18 -0500
From: tcrog...@gmail.com
To: edk2-devel@lists.sourceforge.net
Subject: Re: [edk2] BltLibVideoToBltBuffer returns black pixels
Another way is to get it from the ConOut device path. There's a UEFI variable
called "ConOut" (refer to UEFI spec) that holds a device path. Doing a
LocateDevicePath() with gEfiGraphicsOutputProtocolGuid and this device path
gives you the handle to GOP that ConOut is using. Just OpenProtocol() with this
handle to get the GOP instance.
On Wed, Oct 8, 2014 at 11:17 AM, Rafael Machado
<rafaelrodrigues.mach...@gmail.com> wrote:
Hi J. E.
Just one question.Are you sure that this GOP you are using is handled by the
current active graphic device ?
I'm asking this because some time ago I had one problem like this, and the
situation was that my system had two gop handles, but the first one that was
detected was not related to the active device.
To check this I used the Edid protocol.
Thanks and RegardsRafael R. Machado
2014-10-03 3:15 GMT-03:00 J. E. <nszero...@hotmail.com>:
BltLibVideoToBltBuffer seems to be unreliable on some PC's. Most work fine, but
a select few return black pixels, no errors. EFI_STATUS = EFI_SUCCESS.
If BltLibVideoToBltBuffer returns black pixels does that mean the
hardware/firmware doesn't support screen-to-buffer functionality?
I assume this is because someone didnt test the function or feel the need to
implement the function in the BIOS code or GOP driver, rather than a GOP handle
issue.
------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel
------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel
------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel
------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel
------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel
BOOLEAN GOPInit(BOOLEAN bWant800x600)
{
EFI_STATUS Status;
//UINTN index;
UINTN handleCount;
EFI_HANDLE *handleBuffer;
UINTN nGOPHandleIndex = 0;
UINTN nChosenMode = 0;
if (FeaturePcdGet (PcdConOutGopSupport))
{
Print(L"GFX GOP PcdConOutGopSupport TRUE\n");
}
else
{
Print(L"GFX GOP PcdConOutGopSupport FALSE\n");
return FALSE;
}
//
Status = gBS->LocateHandleBuffer(
ByProtocol,
&gEfiGraphicsOutputProtocolGuid,
NULL,
&handleCount,
&handleBuffer);
if(EFI_ERROR(Status))
{
Print(L"GFX Error: Failed to get GOP Handle Buffer\n");
return FALSE;
}
//Print(L"GFX GOP Handle count = %d\n", handleCount);
if(g_bInEmulator) nGOPHandleIndex = 0;
else nGOPHandleIndex = handleCount-1;
//nGOPHandleIndex = 0;
Print(L"GFX GOP Handle chosen = %d of %d\n", nGOPHandleIndex,
handleCount-1);
Status = gBS->HandleProtocol(
handleBuffer[nGOPHandleIndex],
&gEfiGraphicsOutputProtocolGuid,
(VOID **)&(GraphicsOutput));
if(EFI_ERROR(Status))
{
Print(L"GFX Error: Failed to get GOP\n");
return FALSE;
}
FreePool(handleBuffer);
ListModes();
nChosenMode = DetermineBestResolution(); //GetMatchingMode(800, 600);
Print (L"Mode chosen: %d\n", nChosenMode);
//Print (L"Press a key to init GFX ...\n");
//WaitKey();
// Set graphics mode
Status = SetGraphicsMode(nChosenMode);
if(EFI_ERROR(Status))
{
Print(L"GFX Error: Failed to set graphics mode. %r\n", Status);
return FALSE;
}
// Configure BlitLib
Status = BltLibConfigure (
(VOID*)(UINTN) GraphicsOutput->Mode->FrameBufferBase,
GraphicsOutput->Mode->Info
);
if (EFI_ERROR (Status))
{
Print(L"GFX Error: Failed to configure BltLib\n");
return FALSE;
}
bScreenToBlitSupported = TestScreenToBlit();
return TRUE;
}
// -1 = text mode
EFI_STATUS SetGraphicsMode(INTN nMode)
{
EFI_STATUS Status;
int nModeChoice = 0;
if(bUsingUGA)
{
Print (L"SetGraphicsMode for UGA not implemented!\n");
return EFI_UNSUPPORTED;
}
else
{
//Status = GraphicsOutput->SetMode(GraphicsOutput,
GraphicsOutput->Mode->MaxMode-1);
//if(bEnable) Status = GraphicsOutput->SetMode(GraphicsOutput,
1);//EfiConsoleControlScreenGraphics);
//else Status = GraphicsOutput->SetMode(GraphicsOutput,
0);
nModeChoice = 0;
Print(L"GFX GOP Setting Mode: %d...\n", nMode);
if(nMode >= 0) Status = GraphicsOutput->SetMode(GraphicsOutput,
(INT32)nMode);//EfiConsoleControlScreenGraphics);
else Status = SimpleTextOut->SetMode (SimpleTextOut,
0);//Status = GraphicsOutput->SetMode(GraphicsOutput,
0);//SetTextMode();//Status =
GraphicsOutput->SetMode(ConsoleControl,EfiConsoleControlScreenText);
//if(bEnable) Status =
ConsoleControl->SetMode(ConsoleControl,EfiConsoleControlScreenGraphics);
//else Status =
ConsoleControl->SetMode(ConsoleControl,EfiConsoleControlScreenText);
if(EFI_ERROR(Status) == FALSE)
{
mWidth =
GraphicsOutput->Mode->Info->HorizontalResolution;
mHeight =
GraphicsOutput->Mode->Info->VerticalResolution;
SetRect(&_rcScreenRect, 0, 0, mWidth,
mHeight);//SetRect(&_rcScreenRect, 0, 0, mWidth-1, mHeight-1);
_nCurrentGraphicsMode = nMode;
//bScreenToBlitSupported = TestScreenToBlit();
//Print(L"GFX Screen to Blit supported: %s\n",
bScreenToBlitSupported==TRUE?L"TRUE":L"FALSE");
//WaitKey();
}
//Print(L"SetGraphicsMode result: %r\n", Status);
return Status;
}
}
EFI_GRAPHICS_OUTPUT_BLT_PIXEL* GetScreenArea(UINTN x, UINTN y, UINTN width,
UINTN height)
{
EFI_GRAPHICS_OUTPUT_BLT_PIXEL* blt;
EFI_STATUS Status;
blt = AllocatePool(width * height *
sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
if(blt == NULL) return NULL;
Status = BltLibVideoToBltBuffer(blt, x, y, width, height);
if(EFI_ERROR(Status))
{
Print(L"BltLibVideoToBltBuffer FAILED: %r\n", Status);
FreePool(blt);
return NULL;
}
return blt;
}
BOOLEAN TestScreenToBlit()
{
EFI_GRAPHICS_OUTPUT_BLT_PIXEL pixel;
CHAR16 sTemp[128];
FillArea(0, 0, 10, 10, mGraphicsEfiColors[15]);
pixel = GetPixel(5, 5);
UnicodeSPrint(sTemp, 256, L"RGB: %d %d %d\n", pixel.Red, pixel.Green,
pixel.Blue);
Debug(sTemp);
if(pixel.Red != mGraphicsEfiColors[15].Red) return FALSE;
return TRUE;
}
------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel