From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-lf1-f44.google.com (mail-lf1-f44.google.com [209.85.167.44]) by mx.groups.io with SMTP id smtpd.web11.5057.1675850155062600126 for ; Wed, 08 Feb 2023 01:55:55 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=FCCIvSRi; spf=pass (domain: gmail.com, ip: 209.85.167.44, mailfrom: alibanejad1376@gmail.com) Received: by mail-lf1-f44.google.com with SMTP id j17so26333086lfr.3 for ; Wed, 08 Feb 2023 01:55:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=y16j1UeQwAK/RRPO7DkAdUfRLUs56S0wnOSA8vKjevY=; b=FCCIvSRiGUdezqCEbd4pwMGc3c74L59t+tGB+976fIplvDIvX49LGR5efy+5EucIt1 6WZKBgGVKrBrthNzKB+GN9+EQtzD6Yevmf74SB7Co67xC4aigpMBGN58vv4D92c0NK7c V7zEtJDNfc9JIkVlUIQCASYGCYcQFnfNo185d79qLtybuzcmpCf2brNYL6LyfnhSzkMi 7sWHRMRMUwfnIESu7hGWPJaOwgryzEXDAVE3Y3BnZrOl7nsq2ZfTspNZ6V4dliJE3+pe XCqtSgot5mdWuIn1ZsmMBgviYEeCqgOVuvb1qn7xGt5csWZI+leDMwIRogUwcGsaZCkK KKhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=y16j1UeQwAK/RRPO7DkAdUfRLUs56S0wnOSA8vKjevY=; b=CuJDqQSai+DPkYEdeQfQB/g23uzCJD19hF5eq/MfBIiLVgBcjew8oNgYTpX/3sT/iC BwTwGkP5zF80wHEDxwScy6PorDrn/Fc8e3QCzItaUEq/tdu/cNM7ul6aaufT0PENt7aZ i0uh1Zcip7dFTkDCkg+fygPavs13XnL0cQRWglG0DLzw4gDA6pVDwKM2ZlTTymW4yXTW 46DGujyjmLungfMPIQOosyAFQ/uYL1SoNGqamriIwt0H9ORwJxOGckZa6UB71dqotfU1 2PdTPUxK2iLw0rHjxbqxOHIgjUlqgny3Qg8XUPisnzCG/aUg9olk5ouRNWU10L37/G6C kCPA== X-Gm-Message-State: AO0yUKU/Gt4ANgVl6WG6ii9l4hxPmjM6Hc8Gu0Y0wEI9Rs3yfbg0JXQi siZ9y0tDsAV9RvwpfVD+uOcgEzysKy1r+LF/xtA= X-Google-Smtp-Source: AK7set+cMWfqhzccI+j6RudgHcsr+fCNCzI42xv+M15+VxYvQhFUDuCLi1BItAKEWkD7oumbRC7yCVhI9kGmcvkOndk= X-Received: by 2002:ac2:50d4:0:b0:4b5:6990:3c94 with SMTP id h20-20020ac250d4000000b004b569903c94mr1140658lfm.27.1675850152928; Wed, 08 Feb 2023 01:55:52 -0800 (PST) MIME-Version: 1.0 References: <6558368.1D856uYhSO@core> <0102018630466504-2ff97024-e158-48ea-9ea5-cc1e11d20bcc-000000@eu-west-1.amazonses.com> In-Reply-To: <0102018630466504-2ff97024-e158-48ea-9ea5-cc1e11d20bcc-000000@eu-west-1.amazonses.com> From: "Alireza Banejad" Date: Wed, 8 Feb 2023 13:25:46 +0330 Message-ID: Subject: Re: [edk2-devel] Graphic Output on qemu To: Michael Brown Cc: devel@edk2.groups.io, "Paul, Bill" Content-Type: multipart/alternative; boundary="0000000000000feb8205f42d45a6" --0000000000000feb8205f42d45a6 Content-Type: text/plain; charset="UTF-8" As my previous email, I mentioned that I am able to find the protocol since the LocateProtocol returns 0 (EFI_SUCCESS) (using the exact code you wrote) . But when I want to open it either with OpenProtocol or HandleProtocol I get a RETURN_UNSUPPORTED. Are you implying that by calling LocateProtocol() the protocol would also be opened? or do I still need to open it? if I still need to open then I am still getting the UNSUPPORTED Status. But if I don't need to open it I still don't know why I am not able to use the GOP methods. one example of the many examples which I get this error is as below: Status = gBS->HandleProtocol (SystemTable->ConsoleOutHandle, &gEfiGraphicsOutputProtocolGuid, (VOID **)&GraphicsOutput); if (EFI_ERROR (Status)) { Status = gBS->LocateProtocol (&gEfiGraphicsOutputProtocolGuid, NULL, (VOID **)&GraphicsOutput); if (EFI_ERROR (Status)) { Print (L"Error: Could not find a GOP instance!\n"); Status = EFI_NOT_FOUND; goto Done; } } Blt = NULL; ImageWidth = 0; ImageHeight = 0; Status = TranslateBmpToGopBlt ( BmpFileData, BmpFileSize, &Blt, &BltSize, &ImageHeight, &ImageWidth ); It is worth mentioning that the BmpFIleData and BmpFileSize are valid variables with the proper data stored. Anyways, the status code for the TranslateBmpToGopBlt returns a RETURN_UNSUPPORTED. This is the same with other GOP methods On Wed, Feb 8, 2023 at 12:36 PM Michael Brown wrote: > On 08/02/2023 08:03, Alireza Banejad wrote: > > Below is how I use the HandleProtocol function: > > > > Status = gBS->HandleProtocol ( > > gST->ConsoleOutHandle, > > &gEfiGraphicsOutputProtocolGuid, > > (VOID **)&GraphicsOutput > > ); > > You are querying only the ConsoleOutHandle, which is not necessarily > where the GOP will be installed. > > Use LocateProtocol() to find the protocol instance instead: > > > Status = gBS->LocateProtocol(&gEfiGraphicsOutputProtocolGuid, NULL, > (VOID **)&GraphicsOutput); > > HTH, > > Michael > > --0000000000000feb8205f42d45a6 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
As my previous email, I mentioned that I am able to find t= he protocol since the LocateProtocol returns 0 (EFI_SUCCESS) (using the exa= ct code you wrote) . But when I want to open it either with OpenProtocol or= HandleProtocol I get a RETURN_UNSUPPORTED. Are you implying that by callin= g LocateProtocol() the protocol would also be opened? or do I still need to= open it? if I still need to open then I am still getting the UNSUPPORTED S= tatus.
But if I don't need to open it I still don't know why I = am not able to use the GOP methods.=C2=A0
one example of the many= examples which I get this error is as below:


=
Status =3D gBS->HandleProtocol (SystemTable->ConsoleOutHan= dle, &gEfiGraphicsOutputProtocolGuid, (VOID **)&GraphicsOutput);=C2=A0 if (EFI_ERROR (Status)) {
=C2=A0 =C2=A0 Status =3D gBS->Locat= eProtocol (&gEfiGraphicsOutputProtocolGuid, NULL, (VOID **)&Graphic= sOutput);
=C2=A0 =C2=A0 if (EFI_ERROR (Status)) {
=C2=A0 =C2=A0 =C2= =A0 Print (L"Error: Could not find a GOP instance!\n");
=C2=A0= =C2=A0 =C2=A0 Status =3D EFI_NOT_FOUND;
=C2=A0 =C2=A0 =C2=A0 goto Done;=
=C2=A0 =C2=A0 }
=C2=A0 }
Blt =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =3D NULL;
=C2=A0 ImageWidth =C2=A0=3D 0;
=C2=A0 ImageHeight =3D 0= ;
=C2=A0 Status =C2=A0 =C2=A0 =C2=A0=3D =C2=A0TranslateBmpToGopBlt (
= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0BmpFil= eData,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0BmpFileSize,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0&Blt,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0&BltSize,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&ImageHeight,
=C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&ImageWidth
=C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0);
It is worth mentioning that the BmpFIleData and BmpFileSize are val= id variables with the proper data stored. Anyways, the status code for the = TranslateBmpToGopBlt returns a RETURN_UNSUPPORTED. This is the same with ot= her GOP methods

On Wed, Feb 8, 2023 at 12:36 PM Michael Brown <mcb30@ipxe.org> wrote:
On 08/02/2023 08:03, Alireza Ba= nejad wrote:
> Below is how I use the HandleProtocol=C2=A0function:
>
>=C2=A0 =C2=A0 Status =3D gBS->HandleProtocol (
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 g= ST->ConsoleOutHandle,
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 &= amp;gEfiGraphicsOutputProtocolGuid,
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (= VOID **)&GraphicsOutput
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 )= ;

You are querying only the ConsoleOutHandle, which is not necessarily
where the GOP will be installed.

Use LocateProtocol() to find the protocol instance instead:


=C2=A0 =C2=A0Status =3D gBS->LocateProtocol(&gEfiGraphicsOutputProto= colGuid, NULL,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (VOID **)&GraphicsOutput);

HTH,

Michael

--0000000000000feb8205f42d45a6--