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 3/5] OvmfPkg/QemuVideoDxe: drop QEMU_VIDEO_BOCHS_MODES->ColorDepth
Date: Mon, 17 Jan 2022 10:58:15 +0100	[thread overview]
Message-ID: <20220117095817.1964424-4-kraxel@redhat.com> (raw)
In-Reply-To: <20220117095817.1964424-1-kraxel@redhat.com>

All video modes in the list are 32-bit,
so drop the useless ColorDepth field.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 OvmfPkg/QemuVideoDxe/Qemu.h       |  1 -
 OvmfPkg/QemuVideoDxe/Initialize.c | 80 +++++++++++++++----------------
 2 files changed, 39 insertions(+), 42 deletions(-)

diff --git a/OvmfPkg/QemuVideoDxe/Qemu.h b/OvmfPkg/QemuVideoDxe/Qemu.h
index fef648c967b2..1e6507f44caa 100644
--- a/OvmfPkg/QemuVideoDxe/Qemu.h
+++ b/OvmfPkg/QemuVideoDxe/Qemu.h
@@ -132,7 +132,6 @@ typedef struct {
 typedef struct {
   UINT32    Width;
   UINT32    Height;
-  UINT32    ColorDepth;
 } QEMU_VIDEO_BOCHS_MODES;
 
 #define QEMU_VIDEO_PRIVATE_DATA_FROM_GRAPHICS_OUTPUT_THIS(a) \
diff --git a/OvmfPkg/QemuVideoDxe/Initialize.c b/OvmfPkg/QemuVideoDxe/Initialize.c
index 8a70cf848483..2b174d13faf2 100644
--- a/OvmfPkg/QemuVideoDxe/Initialize.c
+++ b/OvmfPkg/QemuVideoDxe/Initialize.c
@@ -203,43 +203,43 @@ QemuVideoCirrusModeSetup (
 /// Table of supported video modes
 ///
 STATIC QEMU_VIDEO_BOCHS_MODES  QemuVideoBochsModes[] = {
-  { 640,  480,  32 },
-  { 800,  480,  32 },
-  { 800,  600,  32 },
-  { 832,  624,  32 },
-  { 960,  640,  32 },
-  { 1024, 600,  32 },
-  { 1024, 768,  32 },
-  { 1152, 864,  32 },
-  { 1152, 870,  32 },
-  { 1280, 720,  32 },
-  { 1280, 760,  32 },
-  { 1280, 768,  32 },
-  { 1280, 800,  32 },
-  { 1280, 960,  32 },
-  { 1280, 1024, 32 },
-  { 1360, 768,  32 },
-  { 1366, 768,  32 },
-  { 1400, 1050, 32 },
-  { 1440, 900,  32 },
-  { 1600, 900,  32 },
-  { 1600, 1200, 32 },
-  { 1680, 1050, 32 },
-  { 1920, 1080, 32 },
-  { 1920, 1200, 32 },
-  { 1920, 1440, 32 },
-  { 2000, 2000, 32 },
-  { 2048, 1536, 32 },
-  { 2048, 2048, 32 },
-  { 2560, 1440, 32 },
-  { 2560, 1600, 32 },
-  { 2560, 2048, 32 },
-  { 2800, 2100, 32 },
-  { 3200, 2400, 32 },
-  { 3840, 2160, 32 },
-  { 4096, 2160, 32 },
-  { 7680, 4320, 32 },
-  { 8192, 4320, 32 }
+  { 640,  480  },
+  { 800,  480  },
+  { 800,  600  },
+  { 832,  624  },
+  { 960,  640  },
+  { 1024, 600  },
+  { 1024, 768  },
+  { 1152, 864  },
+  { 1152, 870  },
+  { 1280, 720  },
+  { 1280, 760  },
+  { 1280, 768  },
+  { 1280, 800  },
+  { 1280, 960  },
+  { 1280, 1024 },
+  { 1360, 768  },
+  { 1366, 768  },
+  { 1400, 1050 },
+  { 1440, 900  },
+  { 1600, 900  },
+  { 1600, 1200 },
+  { 1680, 1050 },
+  { 1920, 1080 },
+  { 1920, 1200 },
+  { 1920, 1440 },
+  { 2000, 2000 },
+  { 2048, 1536 },
+  { 2048, 2048 },
+  { 2560, 1440 },
+  { 2560, 1600 },
+  { 2560, 2048 },
+  { 2800, 2100 },
+  { 3200, 2400 },
+  { 3840, 2160 },
+  { 4096, 2160 },
+  { 7680, 4320 },
+  { 8192, 4320 }
 };
 
 #define QEMU_VIDEO_BOCHS_MODE_COUNT \
@@ -348,14 +348,12 @@ QemuVideoBochsModeSetup (
   for (Index = 0; Index < QEMU_VIDEO_BOCHS_MODE_COUNT; Index++) {
     UINTN  RequiredFbSize;
 
-    ASSERT (VideoMode->ColorDepth % 8 == 0);
-    RequiredFbSize = (UINTN)VideoMode->Width * VideoMode->Height *
-                     (VideoMode->ColorDepth / 8);
+    RequiredFbSize = (UINTN)VideoMode->Width * VideoMode->Height * 4;
     if (RequiredFbSize <= AvailableFbSize) {
       ModeData->InternalModeIndex    = Index;
       ModeData->HorizontalResolution = VideoMode->Width;
       ModeData->VerticalResolution   = VideoMode->Height;
-      ModeData->ColorDepth           = VideoMode->ColorDepth;
+      ModeData->ColorDepth           = 32;
       DEBUG ((
         DEBUG_INFO,
         "Adding Mode %d as Bochs Internal Mode %d: %dx%d, %d-bit\n",
-- 
2.34.1


  parent reply	other threads:[~2022-01-17  9:59 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 ` [PATCH v2 2/5] OvmfPkg/QemuVideoDxe: simplify InitializeBochsGraphicsMode Gerd Hoffmann
2022-01-17  9:58 ` Gerd Hoffmann [this message]
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-4-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