aboutsummaryrefslogtreecommitdiff
path: root/hw/display/edid-generate.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2022-03-04 22:13:35 +0000
committerPeter Maydell <peter.maydell@linaro.org>2022-03-04 22:13:35 +0000
commit5c8463886d50eeb0337bd121ab877cf692731e36 (patch)
tree0140f272447424272065def0a4389d7adc529812 /hw/display/edid-generate.c
parent3d1fbc59665ff8a5d74b0fd30583044fe99e1117 (diff)
parent02218aedb1c851340207db89b8eeb96843fed241 (diff)
Merge remote-tracking branch 'remotes/kraxel/tags/kraxel-20220304-pull-request' into staging
usb: fixes for ohci, xhci, mtp and redirect audio: latency fixes ui: opengl and cocoa fixes firmware: ovmf tabel aprser fixes # gpg: Signature made Fri 04 Mar 2022 14:18:47 GMT # gpg: using RSA key A0328CFFB93A17A79901FE7D4CB6D8EED3E87138 # gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" [full] # gpg: aka "Gerd Hoffmann <gerd@kraxel.org>" [full] # gpg: aka "Gerd Hoffmann (private) <kraxel@gmail.com>" [full] # Primary key fingerprint: A032 8CFF B93A 17A7 9901 FE7D 4CB6 D8EE D3E8 7138 * remotes/kraxel/tags/kraxel-20220304-pull-request: (35 commits) hw/display/vmware_vga: replace fprintf calls with trace events edid: Fix clock of Detailed Timing Descriptor softmmu/qdev-monitor: Add virtio-gpu-gl aliases ui/cocoa: Add Services menu ui/clipboard: fix use-after-free regression ui: do not create a surface when resizing a GL scanout ui/console: fix texture leak when calling surface_gl_create_texture() ui/console: fix crash when using gl context with non-gl listeners docs: Add spec of OVMF GUIDed table for SEV guests hw/i386: Replace magic number with field length calculation hw/i386: Improve bounds checking in OVMF table parsing coreaudio: Notify error in coreaudio_init_out hw/usb/redirect.c: Stop using qemu_oom_check() sdlaudio: fix samples vs. frames mix-up paaudio: fix samples vs. frames mix-up ossaudio: reduce effective playback buffer size dsoundaudio: reduce effective playback buffer size paaudio: reduce effective playback buffer size audio: restore mixing-engine playback buffer size Revert "audio: fix wavcapture segfault" ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/display/edid-generate.c')
-rw-r--r--hw/display/edid-generate.c66
1 files changed, 32 insertions, 34 deletions
diff --git a/hw/display/edid-generate.c b/hw/display/edid-generate.c
index bccf32af69..2cb819675e 100644
--- a/hw/display/edid-generate.c
+++ b/hw/display/edid-generate.c
@@ -255,33 +255,31 @@ static void edid_desc_dummy(uint8_t *desc)
edid_desc_type(desc, 0x10);
}
-static void edid_desc_timing(uint8_t *desc, uint32_t refresh_rate,
+static void edid_desc_timing(uint8_t *desc, const Timings *timings,
uint32_t xres, uint32_t yres,
uint32_t xmm, uint32_t ymm)
{
- Timings timings;
- generate_timings(&timings, refresh_rate, xres, yres);
- stl_le_p(desc, timings.clock);
+ stw_le_p(desc, timings->clock);
desc[2] = xres & 0xff;
- desc[3] = timings.xblank & 0xff;
+ desc[3] = timings->xblank & 0xff;
desc[4] = (((xres & 0xf00) >> 4) |
- ((timings.xblank & 0xf00) >> 8));
+ ((timings->xblank & 0xf00) >> 8));
desc[5] = yres & 0xff;
- desc[6] = timings.yblank & 0xff;
+ desc[6] = timings->yblank & 0xff;
desc[7] = (((yres & 0xf00) >> 4) |
- ((timings.yblank & 0xf00) >> 8));
+ ((timings->yblank & 0xf00) >> 8));
- desc[8] = timings.xfront & 0xff;
- desc[9] = timings.xsync & 0xff;
+ desc[8] = timings->xfront & 0xff;
+ desc[9] = timings->xsync & 0xff;
- desc[10] = (((timings.yfront & 0x00f) << 4) |
- ((timings.ysync & 0x00f) << 0));
- desc[11] = (((timings.xfront & 0x300) >> 2) |
- ((timings.xsync & 0x300) >> 4) |
- ((timings.yfront & 0x030) >> 2) |
- ((timings.ysync & 0x030) >> 4));
+ desc[10] = (((timings->yfront & 0x00f) << 4) |
+ ((timings->ysync & 0x00f) << 0));
+ desc[11] = (((timings->xfront & 0x300) >> 2) |
+ ((timings->xsync & 0x300) >> 4) |
+ ((timings->yfront & 0x030) >> 2) |
+ ((timings->ysync & 0x030) >> 4));
desc[12] = xmm & 0xff;
desc[13] = ymm & 0xff;
@@ -348,13 +346,10 @@ static void init_displayid(uint8_t *did)
edid_checksum(did + 1, did[2] + 4);
}
-static void qemu_displayid_generate(uint8_t *did, uint32_t refresh_rate,
+static void qemu_displayid_generate(uint8_t *did, const Timings *timings,
uint32_t xres, uint32_t yres,
uint32_t xmm, uint32_t ymm)
{
- Timings timings;
- generate_timings(&timings, refresh_rate, xres, yres);
-
did[0] = 0x70; /* display id extension */
did[1] = 0x13; /* version 1.3 */
did[2] = 23; /* length */
@@ -364,21 +359,21 @@ static void qemu_displayid_generate(uint8_t *did, uint32_t refresh_rate,
did[6] = 0x00; /* revision */
did[7] = 0x14; /* block length */
- did[8] = timings.clock & 0xff;
- did[9] = (timings.clock & 0xff00) >> 8;
- did[10] = (timings.clock & 0xff0000) >> 16;
+ did[8] = timings->clock & 0xff;
+ did[9] = (timings->clock & 0xff00) >> 8;
+ did[10] = (timings->clock & 0xff0000) >> 16;
did[11] = 0x88; /* leave aspect ratio undefined */
stw_le_p(did + 12, 0xffff & (xres - 1));
- stw_le_p(did + 14, 0xffff & (timings.xblank - 1));
- stw_le_p(did + 16, 0xffff & (timings.xfront - 1));
- stw_le_p(did + 18, 0xffff & (timings.xsync - 1));
+ stw_le_p(did + 14, 0xffff & (timings->xblank - 1));
+ stw_le_p(did + 16, 0xffff & (timings->xfront - 1));
+ stw_le_p(did + 18, 0xffff & (timings->xsync - 1));
stw_le_p(did + 20, 0xffff & (yres - 1));
- stw_le_p(did + 22, 0xffff & (timings.yblank - 1));
- stw_le_p(did + 24, 0xffff & (timings.yfront - 1));
- stw_le_p(did + 26, 0xffff & (timings.ysync - 1));
+ stw_le_p(did + 22, 0xffff & (timings->yblank - 1));
+ stw_le_p(did + 24, 0xffff & (timings->yfront - 1));
+ stw_le_p(did + 26, 0xffff & (timings->ysync - 1));
edid_checksum(did + 1, did[2] + 4);
}
@@ -386,6 +381,7 @@ static void qemu_displayid_generate(uint8_t *did, uint32_t refresh_rate,
void qemu_edid_generate(uint8_t *edid, size_t size,
qemu_edid_info *info)
{
+ Timings timings;
uint8_t *desc = edid + 54;
uint8_t *xtra3 = NULL;
uint8_t *dta = NULL;
@@ -409,9 +405,6 @@ void qemu_edid_generate(uint8_t *edid, size_t size,
if (!info->prefy) {
info->prefy = 800;
}
- if (info->prefx >= 4096 || info->prefy >= 4096) {
- large_screen = 1;
- }
if (info->width_mm && info->height_mm) {
width_mm = info->width_mm;
height_mm = info->height_mm;
@@ -421,6 +414,11 @@ void qemu_edid_generate(uint8_t *edid, size_t size,
height_mm = qemu_edid_dpi_to_mm(dpi, info->prefy);
}
+ generate_timings(&timings, refresh_rate, info->prefx, info->prefy);
+ if (info->prefx >= 4096 || info->prefy >= 4096 || timings.clock >= 65536) {
+ large_screen = 1;
+ }
+
/* =============== extensions =============== */
if (size >= 256) {
@@ -501,7 +499,7 @@ void qemu_edid_generate(uint8_t *edid, size_t size,
if (!large_screen) {
/* The DTD section has only 12 bits to store the resolution */
- edid_desc_timing(desc, refresh_rate, info->prefx, info->prefy,
+ edid_desc_timing(desc, &timings, info->prefx, info->prefy,
width_mm, height_mm);
desc = edid_desc_next(edid, dta, desc);
}
@@ -536,7 +534,7 @@ void qemu_edid_generate(uint8_t *edid, size_t size,
/* =============== display id extensions =============== */
if (did && large_screen) {
- qemu_displayid_generate(did, refresh_rate, info->prefx, info->prefy,
+ qemu_displayid_generate(did, &timings, info->prefx, info->prefy,
width_mm, height_mm);
}