From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=59.124.61.242; helo=synology.com; envelope-from=yuchenlin@synology.com; receiver=edk2-devel@lists.01.org Received: from synology.com (synology.com [59.124.61.242]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id E691721189FBD for ; Thu, 1 Nov 2018 19:05:49 -0700 (PDT) Received: from _ (localhost [127.0.0.1]) by synology.com (Postfix) with ESMTPA id B273724647D0; Fri, 2 Nov 2018 10:05:46 +0800 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synology.com; s=123; t=1541124346; bh=6+g1FD8D4wDBq9tsFzz8PfHiQJeBLvWq3vsslZg3buM=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=jJYwwAn/ugCcLUzE+Xpfkky01oDt80d1BAjkGHGnqF7WZVM2WVC7NQAjSfRlIC23R ODsCm/Vu06dfTTeO7OWApt1KrLSaFuyaHGrenwS/W5Gm7iTw7vtbtSwOcxvXaOajlf 4x8oEmXz/0v4i5lreu8kjgP3iEwtHugFwRYxvhnE= MIME-Version: 1.0 Date: Fri, 02 Nov 2018 10:05:46 +0800 From: yuchenlin To: =?UTF-8?Q?Philippe_Mathieu-Daud=C3=A9?= Cc: edk2-devel@lists.01.org, phil@philjordan.eu, jordan.l.justen@intel.com, anthony.perard@citrix.com, lersek@redhat.com In-Reply-To: References: <20181024064008.26535-1-yuchenlin@synology.com> <20181024064008.26535-5-yuchenlin@synology.com> Message-ID: <63b6e971406cfe2067f786a1230636bb@synology.com> X-Sender: yuchenlin@synology.com User-Agent: Roundcube Webmail/1.1.2 X-Synology-MCP-Status: no X-Synology-Spam-Flag: no X-Synology-Spam-Status: score=0, required 6, WHITELIST_FROM_ADDRESS 0 X-Synology-Virus-Status: no Subject: Re: [PATCH 4/4] OvmfPkg: simply use the Bochs interface for vmsvga X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Nov 2018 02:05:50 -0000 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 2018-11-02 02:54, Philippe Mathieu-Daudé wrote: > Hi Yu-chen Lin, > > On 24/10/18 8:40, yuchenlin@synology.com wrote: >> From: yuchenlin >> >> BAR | std vga | vmsvga >> --------------------------------- >> 0 | Framebuffer | I/O space >> 1 | Reserved | Framebuffer >> 2 | MMIO | FIFO >> >> Because of the PCI BARs difference between std vga and >> vmsvga, we can not simply recognize the "QEMU VMWare SVGA" >> as the QEMU_VIDEO_BOCHS_MMIO variant. >> >> Instead, we remain variant QEMU_VIDEO_VMWARE_SVGA, and use >> it for: >> >> (1) Get framebuffer from correct PCI BAR >> (2) Prevent using BAR2 for MMIO >> >> Contributed-under: TianoCore Contribution Agreement 1.1 >> Signed-off-by: yuchenlin >> --- >> OvmfPkg/QemuVideoDxe/Driver.c | 16 +++++++++++++++- >> OvmfPkg/QemuVideoDxe/Gop.c | 3 ++- >> OvmfPkg/QemuVideoDxe/Qemu.h | 2 ++ >> 3 files changed, 19 insertions(+), 2 deletions(-) >> >> diff --git a/OvmfPkg/QemuVideoDxe/Driver.c >> b/OvmfPkg/QemuVideoDxe/Driver.c >> index 2304afd1e6..a1785c2285 100644 >> --- a/OvmfPkg/QemuVideoDxe/Driver.c >> +++ b/OvmfPkg/QemuVideoDxe/Driver.c >> @@ -16,6 +16,7 @@ >> #include "Qemu.h" >> #include >> +#include >> EFI_DRIVER_BINDING_PROTOCOL gQemuVideoDriverBinding = { >> QemuVideoControllerDriverSupported, >> @@ -69,6 +70,12 @@ QEMU_VIDEO_CARD gQemuVideoCardList[] = { >> 0x1050, >> QEMU_VIDEO_BOCHS_MMIO, >> L"QEMU VirtIO VGA" >> + },{ >> + PCI_CLASS_DISPLAY_VGA, >> + VMWARE_PCI_VENDOR_ID_VMWARE, >> + VMWARE_PCI_DEVICE_ID_VMWARE_SVGA2, >> + QEMU_VIDEO_VMWARE_SVGA, >> + L"QEMU VMWare SVGA" > > Looks OK. > >> },{ >> 0 /* end of list */ >> } >> @@ -256,6 +263,11 @@ QemuVideoControllerDriverStart ( >> goto ClosePciIo; >> } >> Private->Variant = Card->Variant; >> + Private->FrameBufferVramBarIndex = PCI_BAR_IDX0; >> + if (Private->Variant == QEMU_VIDEO_VMWARE_SVGA) { >> + Private->FrameBufferVramBarIndex = PCI_BAR_IDX1; > > OK, but why not use an 'else' clause? Will do Thanks, yuchenlin > >> + } >> + >> // >> // IsQxl is based on the detected Card->Variant, which at a later >> point might >> @@ -320,7 +332,8 @@ QemuVideoControllerDriverStart ( >> // Check if accessing the bochs interface works. >> // >> if (Private->Variant == QEMU_VIDEO_BOCHS_MMIO || >> - Private->Variant == QEMU_VIDEO_BOCHS) { >> + Private->Variant == QEMU_VIDEO_BOCHS || >> + Private->Variant == QEMU_VIDEO_VMWARE_SVGA) { >> UINT16 BochsId; >> BochsId = BochsRead(Private, VBE_DISPI_INDEX_ID); >> if ((BochsId & 0xFFF0) != VBE_DISPI_ID0) { >> @@ -383,6 +396,7 @@ QemuVideoControllerDriverStart ( >> break; >> case QEMU_VIDEO_BOCHS_MMIO: >> case QEMU_VIDEO_BOCHS: >> + case QEMU_VIDEO_VMWARE_SVGA: >> Status = QemuVideoBochsModeSetup (Private, IsQxl); >> break; >> default: >> diff --git a/OvmfPkg/QemuVideoDxe/Gop.c b/OvmfPkg/QemuVideoDxe/Gop.c >> index d490fa7a2e..3abc5eeb36 100644 >> --- a/OvmfPkg/QemuVideoDxe/Gop.c >> +++ b/OvmfPkg/QemuVideoDxe/Gop.c >> @@ -60,7 +60,7 @@ QemuVideoCompleteModeData ( >> Private->PciIo->GetBarAttributes ( >> Private->PciIo, >> - 0, >> + Private->FrameBufferVramBarIndex, > > OK > >> NULL, >> (VOID**) &FrameBufDesc >> ); >> @@ -177,6 +177,7 @@ Routine Description: >> break; >> case QEMU_VIDEO_BOCHS_MMIO: >> case QEMU_VIDEO_BOCHS: >> + case QEMU_VIDEO_VMWARE_SVGA: >> InitializeBochsGraphicsMode (Private, >> &QemuVideoBochsModes[ModeData->InternalModeIndex]); >> break; >> default: >> diff --git a/OvmfPkg/QemuVideoDxe/Qemu.h b/OvmfPkg/QemuVideoDxe/Qemu.h >> index d7da761705..3aac9eeca6 100644 >> --- a/OvmfPkg/QemuVideoDxe/Qemu.h >> +++ b/OvmfPkg/QemuVideoDxe/Qemu.h >> @@ -92,6 +92,7 @@ typedef enum { >> QEMU_VIDEO_CIRRUS_5446, >> QEMU_VIDEO_BOCHS, >> QEMU_VIDEO_BOCHS_MMIO, >> + QEMU_VIDEO_VMWARE_SVGA, >> } QEMU_VIDEO_VARIANT; >> typedef struct { >> @@ -120,6 +121,7 @@ typedef struct { >> QEMU_VIDEO_VARIANT Variant; >> FRAME_BUFFER_CONFIGURE *FrameBufferBltConfigure; >> UINTN FrameBufferBltConfigureSize; >> + UINT8 FrameBufferVramBarIndex; >> } QEMU_VIDEO_PRIVATE_DATA; >> /// >>