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 DB9092117D28A for ; Tue, 23 Oct 2018 04:12:57 -0700 (PDT) Received: from _ (localhost [127.0.0.1]) by synology.com (Postfix) with ESMTPA id 9903024B42B4; Tue, 23 Oct 2018 19:12:55 +0800 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synology.com; s=123; t=1540293175; bh=5zNZebRK3iFpAy2G9WE4wAI8/0k9gd73bCQZ/g6qGbE=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=nkwISbV8BUw4IjKvdwZ0311zOWn+SKKnnGlD1csvdJIRuoX8Tb9cCG6YnkXQMtyRi pq/Do3p4XSmKuE63fQizZhMTKbZkg9cLvNXBvOWa3QHET6D3X+fqDTGIeS2zqFNO1l naOoadJb+ijiuejmVxQwfui2U7/yMjhyYONHTvfU= MIME-Version: 1.0 Date: Tue, 23 Oct 2018 19:12:55 +0800 From: yuchenlin To: Laszlo Ersek Cc: edk2-devel@lists.01.org, jordan.l.justen@intel.com, ard.biesheuvel@linaro.org, anthony.perard@citrix.com, julien.grall@linaro.org, Gerd Hoffmann , Phil Dennis-Jordan In-Reply-To: References: <20181023024057.21942-1-yuchenlin@synology.com> Message-ID: <3f1bacc3feaf1ce6de3b42f91cf689ea@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] OvmfPkg: initialize bochs when initializing 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: Tue, 23 Oct 2018 11:12:59 -0000 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Hi, Laszlo On 2018-10-23 18:18, Laszlo Ersek wrote: > (1) Adding Gerd (because he maintains video in QEMU), and Phil > Dennis-Jordan (for authoring commit c137d9508169, > "OvmfPkg/QemuVideoDxe: > VMWare SVGA device support", 2017-04-07). > > > On 10/23/18 04:40, yuchenlin@synology.com wrote: >> From: yuchenlin >> >> When driver doesn't set fifo config, the vmsvga will fall back >> to std vga. However, we don't initialize vbe related port. It >> causes blank screen in qemu console. > > (2) The words "when driver doesn't set fifo config" tell me nothing. > The > QemuVideoDxe directory has zero instances of the word "fifo". The same > applies to "OvmfPkg/Include/IndustryStandard/VmwareSvga.h". > > In addition, the "vmsvga will fall back to std vga" statement is also > unclear. Is that a statement about the QEMU device model's behavior? > About FIFO, you can refer to https://github.com/prepare/vmware-svga/blob/master/doc/svga_interface.txt#L34, "The main advantage of VMware's SVGA device over alternatives like VBE is that the virtual machine can explicitly indicate which ares of the screen have changed by sending update rectangles through the device's command FIFO." According to https://github.com/prepare/vmware-svga/blob/master/doc/svga_interface.txt#L533, to use vmsvga's FIFO. Driver should setup FIFO and set SVGA_REG_CONFIG_DONE to 1. However, OVMF doesn't do it. In this case, vmsvga will fall back to vga. It is QEMU device model's behavior after commit 104bd1dc70 (vmsvga: fix vmsvga_update_display). > I vaguely suspect that your intent might be to say, "QemuVideoDxe does > not perform a necessary configuration step, and therefore it cannot > drive QEMU's VMW SVGA device". However, if that is indeed your intent, > then I believe something must have changed recently in QEMU, because > QemuVideoDxe *definitely* worked when Phil contributed the VMW SVGA > driver logic, in commit c137d9508169. > > Are we talking about a QEMU regression, or a driver-side configuration > step that QemuVideoDxe has always missed (and we're being punished for > it only now)? > This is QEMU behavior change in commit 104bd1dc70 (vmsvga: fix vmsvga_update_display). In my opinion, it is a correct change. > >> This patch will fix "Guest has not initialized the display (yet)" >> when using qemu -device vmware-svga with ovmf. > > Right, as I write above, this definitely worked earlier. I suggest > bisecting QEMU (and/or testing older QEMU machine types) to identify > the > QEMU side change. Once we know that, we can decide whether this is a > QEMU regression, or just exposing a long-standing OVMF bug. In my opinion, it is a long-standing OVMF bug, which is based on the wrong behavior of QEMU's vmsvga. It relied on dirty memory region to call dpy_gfx_update for updating display. > > Comments about the code below: > > >> Contributed-under: TianoCore Contribution Agreement 1.1 >> Signed-off-by: yuchenlin >> --- >> OvmfPkg/QemuVideoDxe/Driver.c | 3 +-- >> 1 file changed, 1 insertion(+), 2 deletions(-) >> >> diff --git a/OvmfPkg/QemuVideoDxe/Driver.c >> b/OvmfPkg/QemuVideoDxe/Driver.c >> index 0dce80e59..255c01881 100644 >> --- a/OvmfPkg/QemuVideoDxe/Driver.c >> +++ b/OvmfPkg/QemuVideoDxe/Driver.c >> @@ -1067,8 +1067,7 @@ InitializeVmwareSvgaGraphicsMode ( >> >> VmwareSvgaWrite (Private, VmwareSvgaRegEnable, 1); >> >> - SetDefaultPalette (Private); >> - ClearScreen (Private); >> + InitializeBochsGraphicsMode (Private, ModeData); >> } >> >> EFI_STATUS >> > > (3) Calling InitializeBochsGraphicsMode() from within > InitializeVmwareSvgaGraphicsMode() seems wrong, considering the current > structure of the driver. > > We only have InitializeXxxGraphicsMode() calls in > QemuVideoGraphicsOutputSetMode(). In order to determine which variant > to > call, we check the "Private->Variant" field, in a "switch" statement. > Therefore: > > (3a) If a general fallback from "VmwareSvga" to "Bochs" is necessary, > then the fallback logic should be added to earlier code that sets the > Variant field. > > You can see an example for that in the QemuVideoControllerDriverStart() > function, near the debug message "QemuVideo: No mmio bar, fallback to > port io". There the Variant field is degraded from the originally > detected QEMU_VIDEO_BOCHS_MMIO value, to QEMU_VIDEO_BOCHS. > > (3b) Or else, if calling InitializeVmwareSvgaGraphicsMode() is fine as > a > basis, but we also need the actions of InitializeBochsGraphicsMode() > *in > addition*, then please: > > - extract the common actions from InitializeBochsGraphicsMode() to a > new > helper function, and call the helper from both > InitializeBochsGraphicsMode() and InitializeVmwareSvgaGraphicsMode(), > > - explain, in InitializeVmwareSvgaGraphicsMode(), *why* the Bochs > config > actions are necessary, in addition to the VmwareSvga actions. > > Thanks, > Laszlo Thanks, yuchenlin