From 3921812885665ff61f83b4cf35fa9e74048a07c4 Mon Sep 17 00:00:00 2001 From: Zhao Yakui Date: Fri, 6 May 2022 11:26:52 +0800 Subject: [PATCH] ACRN:DM:VGPU: Add more standard modes for EDID block EDID uses the bytes of 38-53 to support up to 8 standard modes. And it is based on the mechanism: Byte 0 defines the xres / 8 - 31 and byte 1 defines the aspect_ratio/refresh_rate. But now it uses the incorrect logic in course of adding standard mode, which causes that no standard mode is added in EDID block. Fix it and add another two standard modes so that the guest_vm can parse more modes from EDID. Tracked-On: #7376 Acked-by: Wang Yu Signed-off-by: Zhao Yakui --- devicemodel/hw/vdisplay_sdl.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/devicemodel/hw/vdisplay_sdl.c b/devicemodel/hw/vdisplay_sdl.c index 02b8a6de1..1e83bc7ba 100644 --- a/devicemodel/hw/vdisplay_sdl.c +++ b/devicemodel/hw/vdisplay_sdl.c @@ -105,6 +105,7 @@ static const struct timing_entry { uint32_t byte_t3;// byte idx in the Established Timings III Descriptor uint32_t bit; // bit idx uint8_t hz; // frequency + bool is_std; // the flag of standard mode } timings[] = { /* Established Timings I & II (all @ 60Hz) */ { .hpixel = 1024, .vpixel = 768, .byte = 36, .bit = 3, .hz = 60}, @@ -112,8 +113,10 @@ static const struct timing_entry { { .hpixel = 640, .vpixel = 480, .byte = 35, .bit = 5, .hz = 60 }, /* Standard Timings */ - { .hpixel = 1920, .vpixel = 1080, .hz = 60 }, - { .hpixel = 1280, .vpixel = 720, .hz = 60 }, + { .hpixel = 1920, .vpixel = 1080, .hz = 60, .is_std = true }, + { .hpixel = 1280, .vpixel = 720, .hz = 60, .is_std = true }, + { .hpixel = 1440, .vpixel = 900, .hz = 60, .is_std = true }, + { .hpixel = 1680, .vpixel = 1050, .hz = 60, .is_std = true }, }; typedef struct frame_param{ @@ -269,7 +272,7 @@ vdpy_edid_set_timing(uint8_t *addr, const base_param *b_param, TIMING_MODE mode) return; } case STDT: // Standard Timings - if(stdcnt < 8 && (timing->hpixel == b_param->h_pixel)) { + if(stdcnt < 8 && timing->is_std) { hpixel = (timing->hpixel >> 3) - 31; if (timing->hpixel == 0 || timing->vpixel == 0) { @@ -304,9 +307,9 @@ vdpy_edid_set_timing(uint8_t *addr, const base_param *b_param, TIMING_MODE mode) } break; } else { - return; + continue; } - + break; default: return; }