public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Gerd Hoffmann" <kraxel@redhat.com>
To: devel@edk2.groups.io
Cc: Gerd Hoffmann <kraxel@redhat.com>,
	Jordan Justen <jordan.l.justen@intel.com>,
	Min Xu <min.m.xu@intel.com>, Jiewen Yao <jiewen.yao@intel.com>,
	Julien Grall <julien@xen.org>,
	Tom Lendacky <thomas.lendacky@amd.com>,
	Brijesh Singh <brijesh.singh@amd.com>,
	James Bottomley <jejb@linux.ibm.com>,
	Erdem Aktas <erdemaktas@google.com>,
	Pawel Polawski <ppolawsk@redhat.com>,
	Anthony Perard <anthony.perard@citrix.com>,
	Ard Biesheuvel <ardb+tianocore@kernel.org>
Subject: [PATCH v2 2/5] OvmfPkg/QemuVideoDxe: simplify InitializeBochsGraphicsMode
Date: Mon, 17 Jan 2022 10:58:14 +0100	[thread overview]
Message-ID: <20220117095817.1964424-3-kraxel@redhat.com> (raw)
In-Reply-To: <20220117095817.1964424-1-kraxel@redhat.com>

struct QEMU_VIDEO_MODE_DATA has all the data needed to set the video
mode, there is no need to take the extra indirection and use
struct QEMU_VIDEO_BOCHS_MODES.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 OvmfPkg/QemuVideoDxe/Qemu.h       |  3 +--
 OvmfPkg/QemuVideoDxe/Driver.c     | 14 +++++++-------
 OvmfPkg/QemuVideoDxe/Gop.c        |  2 +-
 OvmfPkg/QemuVideoDxe/Initialize.c |  2 +-
 4 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/OvmfPkg/QemuVideoDxe/Qemu.h b/OvmfPkg/QemuVideoDxe/Qemu.h
index 8f05898f862c..fef648c967b2 100644
--- a/OvmfPkg/QemuVideoDxe/Qemu.h
+++ b/OvmfPkg/QemuVideoDxe/Qemu.h
@@ -150,7 +150,6 @@ extern UINT16                        Seq_800_600_256_60[];
 extern UINT8                         Crtc_1024_768_256_60[];
 extern UINT16                        Seq_1024_768_256_60[];
 extern QEMU_VIDEO_CIRRUS_MODES       QemuVideoCirrusModes[];
-extern QEMU_VIDEO_BOCHS_MODES        QemuVideoBochsModes[];
 extern EFI_DRIVER_BINDING_PROTOCOL   gQemuVideoDriverBinding;
 extern EFI_COMPONENT_NAME_PROTOCOL   gQemuVideoComponentName;
 extern EFI_COMPONENT_NAME2_PROTOCOL  gQemuVideoComponentName2;
@@ -414,7 +413,7 @@ InitializeCirrusGraphicsMode (
 VOID
 InitializeBochsGraphicsMode (
   QEMU_VIDEO_PRIVATE_DATA  *Private,
-  QEMU_VIDEO_BOCHS_MODES   *ModeData
+  QEMU_VIDEO_MODE_DATA     *ModeData
   );
 
 VOID
diff --git a/OvmfPkg/QemuVideoDxe/Driver.c b/OvmfPkg/QemuVideoDxe/Driver.c
index d9f0a2464aa3..b91909a14e59 100644
--- a/OvmfPkg/QemuVideoDxe/Driver.c
+++ b/OvmfPkg/QemuVideoDxe/Driver.c
@@ -987,14 +987,14 @@ VgaOutb (
 VOID
 InitializeBochsGraphicsMode (
   QEMU_VIDEO_PRIVATE_DATA  *Private,
-  QEMU_VIDEO_BOCHS_MODES   *ModeData
+  QEMU_VIDEO_MODE_DATA     *ModeData
   )
 {
   DEBUG ((
     DEBUG_INFO,
     "InitializeBochsGraphicsMode: %dx%d @ %d\n",
-    ModeData->Width,
-    ModeData->Height,
+    ModeData->HorizontalResolution,
+    ModeData->VerticalResolution,
     ModeData->ColorDepth
     ));
 
@@ -1007,10 +1007,10 @@ InitializeBochsGraphicsMode (
   BochsWrite (Private, VBE_DISPI_INDEX_Y_OFFSET, 0);
 
   BochsWrite (Private, VBE_DISPI_INDEX_BPP, (UINT16)ModeData->ColorDepth);
-  BochsWrite (Private, VBE_DISPI_INDEX_XRES, (UINT16)ModeData->Width);
-  BochsWrite (Private, VBE_DISPI_INDEX_VIRT_WIDTH, (UINT16)ModeData->Width);
-  BochsWrite (Private, VBE_DISPI_INDEX_YRES, (UINT16)ModeData->Height);
-  BochsWrite (Private, VBE_DISPI_INDEX_VIRT_HEIGHT, (UINT16)ModeData->Height);
+  BochsWrite (Private, VBE_DISPI_INDEX_XRES, (UINT16)ModeData->HorizontalResolution);
+  BochsWrite (Private, VBE_DISPI_INDEX_VIRT_WIDTH, (UINT16)ModeData->HorizontalResolution);
+  BochsWrite (Private, VBE_DISPI_INDEX_YRES, (UINT16)ModeData->VerticalResolution);
+  BochsWrite (Private, VBE_DISPI_INDEX_VIRT_HEIGHT, (UINT16)ModeData->VerticalResolution);
 
   BochsWrite (
     Private,
diff --git a/OvmfPkg/QemuVideoDxe/Gop.c b/OvmfPkg/QemuVideoDxe/Gop.c
index 5ad0afe88378..0c4dea7fb6f2 100644
--- a/OvmfPkg/QemuVideoDxe/Gop.c
+++ b/OvmfPkg/QemuVideoDxe/Gop.c
@@ -177,7 +177,7 @@ Routine Description:
       break;
     case QEMU_VIDEO_BOCHS_MMIO:
     case QEMU_VIDEO_BOCHS:
-      InitializeBochsGraphicsMode (Private, &QemuVideoBochsModes[ModeData->InternalModeIndex]);
+      InitializeBochsGraphicsMode (Private, ModeData);
       break;
     default:
       ASSERT (FALSE);
diff --git a/OvmfPkg/QemuVideoDxe/Initialize.c b/OvmfPkg/QemuVideoDxe/Initialize.c
index 533ec661d64f..8a70cf848483 100644
--- a/OvmfPkg/QemuVideoDxe/Initialize.c
+++ b/OvmfPkg/QemuVideoDxe/Initialize.c
@@ -202,7 +202,7 @@ QemuVideoCirrusModeSetup (
 ///
 /// Table of supported video modes
 ///
-QEMU_VIDEO_BOCHS_MODES  QemuVideoBochsModes[] = {
+STATIC QEMU_VIDEO_BOCHS_MODES  QemuVideoBochsModes[] = {
   { 640,  480,  32 },
   { 800,  480,  32 },
   { 800,  600,  32 },
-- 
2.34.1


  parent reply	other threads:[~2022-01-17  9:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-17  9:58 [PATCH v2 0/5] OvmfPkg/QemuVideoDxe: pick up display resolution settings from the host Gerd Hoffmann
2022-01-17  9:58 ` [PATCH v2 1/5] OvmfPkg: add PcdVideoResolutionSource Gerd Hoffmann
2022-01-17  9:58 ` Gerd Hoffmann [this message]
2022-01-17  9:58 ` [PATCH v2 3/5] OvmfPkg/QemuVideoDxe: drop QEMU_VIDEO_BOCHS_MODES->ColorDepth Gerd Hoffmann
2022-01-17  9:58 ` [PATCH v2 4/5] OvmfPkg/QemuVideoDxe: factor out QemuVideoBochsAddMode Gerd Hoffmann
2022-01-17  9:58 ` [PATCH v2 5/5] OvmfPkg/QemuVideoDxe: parse edid blob, detect display resolution Gerd Hoffmann
2022-01-29 17:08 ` [PATCH v2 0/5] OvmfPkg/QemuVideoDxe: pick up display resolution settings from the host Ard Biesheuvel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220117095817.1964424-3-kraxel@redhat.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox