Re: [PATCH v1] dm: vdisplay: add modes supported by Windows virtio-gpu driver


Sun, Peng
 

On Fri, 2022-05-20 at 15:32 +0800, Yu Wang wrote:
On Wed, May 18, 2022 at 04:31:18PM +0800,
peng.p.sun@... wrote:
From: Sun Peng <peng.p.sun@...>

Add 1280x1024@75, 1024x768@75, 1600x1200@60, 1600x900@60 modes.
Also you have removed 720p and changed the default one, right?

Please update the commit message.
[Sun, Peng] Correct, I remove it. I will update the commit message in
next version.


Tracked-On: #7507
Signed-off-by: Sun Peng <peng.p.sun@...>
---
 devicemodel/hw/vdisplay_sdl.c | 48 +++++++++++++++++--------------
----
 1 file changed, 23 insertions(+), 25 deletions(-)

diff --git a/devicemodel/hw/vdisplay_sdl.c
b/devicemodel/hw/vdisplay_sdl.c
index 1e83bc7ba..5944ac73a 100644
--- a/devicemodel/hw/vdisplay_sdl.c
+++ b/devicemodel/hw/vdisplay_sdl.c
@@ -27,13 +27,13 @@
 
 #define VDPY_MAX_WIDTH 1920
 #define VDPY_MAX_HEIGHT 1080
-#define VDPY_DEFAULT_WIDTH 1280
-#define VDPY_DEFAULT_HEIGHT 720
+#define VDPY_DEFAULT_WIDTH 1024
+#define VDPY_DEFAULT_HEIGHT 768
 #define VDPY_MIN_WIDTH 640
 #define VDPY_MIN_HEIGHT 480
 #define transto_10bits(color) (uint16_t)(color * 1024 + 0.5)
 
-static unsigned char default_raw_argb[640 * 480 * 4];
+static unsigned char default_raw_argb[VDPY_DEFAULT_WIDTH *
VDPY_DEFAULT_HEIGHT * 4];
 
 struct state {
        bool is_ui_realized;
@@ -108,15 +108,18 @@ static const struct timing_entry {
        bool    is_std; // the flag of standard mode
 } timings[] = {
        /* Established Timings I & II (all @ 60Hz) */
+       { .hpixel = 1280, .vpixel = 1024, .byte  = 36, .bit = 0,
.hz = 75},
+       { .hpixel = 1024, .vpixel =  768, .byte  = 36, .bit = 1,
.hz = 75},
        { .hpixel = 1024, .vpixel =  768, .byte  = 36, .bit = 3,
.hz = 60},
        { .hpixel =  800, .vpixel =  600, .byte  = 35, .bit = 0,
.hz = 60 },
        { .hpixel =  640, .vpixel =  480, .byte  = 35, .bit = 5,
.hz = 60 },
 
        /* Standard Timings */
        { .hpixel = 1920, .vpixel = 1080, .hz = 60,  .is_std = true
},
-       { .hpixel = 1280, .vpixel =  720, .hz = 60,  .is_std = true
},
+       { .hpixel = 1680, .vpixel = 1050, .hz = 60,  .is_std = true
},
+       { .hpixel = 1600, .vpixel = 1200, .hz = 60,  .is_std = true
},
+       { .hpixel = 1600, .vpixel =  900, .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{
@@ -161,8 +164,8 @@ vdpy_edid_set_baseparam(base_param *b_param,
uint32_t width, uint32_t height)
 {
        b_param->h_pixel = width;
        b_param->v_pixel = height;
-       b_param->h_pixelmax = 0;
-       b_param->v_pixelmax = 0;
+       b_param->h_pixelmax = width;
+       b_param->v_pixelmax = height;
        b_param->rate = 60;
        b_param->width = width;
        b_param->height = height;
@@ -252,24 +255,21 @@ vdpy_edid_set_timing(uint8_t *addr, const
base_param *b_param, TIMING_MODE mode)
        size = sizeof(timings) / sizeof(timings[0]);
        for(; idx < size; idx++){
                timing = timings + idx;
-               if ((b_param->h_pixelmax && b_param->h_pixelmax <
timing->hpixel) ||
-                   (b_param->v_pixelmax && b_param->v_pixelmax <
timing->vpixel)) {
-                       continue;
After remove these 3 lines, the h_pixelmax, v_pixelmax and b_param
are
meaningless, right?
[Sun, Peng] Yes.

BTW, what is this logic for? If it is another logic, please submit
another patch.
[Sun, Peng] We don't want user use the resolutions which bigger than
window size for simple. But HSPE's UMD driver allow this behavior. Our
limitation will be meanless. So, I remove these lines.

-               }
+
                switch(mode){
                case ESTT: // Established Timings I & II
                        if(timing->byte) {
                                addr[timing->byte] |= (1 << timing-
bit);
                                break;
                        } else {
-                               return;
+                               continue;
                        }
                case ESTT3: // Established Timings III
                        if(timing->byte_t3){
                                addr[timing->byte_t3] |= (1 <<
timing->bit);
                                break;
                        } else {
-                               return;
+                               continue;
                        }
                case STDT: // Standard Timings
                        if(stdcnt < 8 && timing->is_std) {
@@ -311,7 +311,7 @@ vdpy_edid_set_timing(uint8_t *addr, const
base_param *b_param, TIMING_MODE mode)
                        }
                        break;
                default:
-                       return;
+                       continue;
                }
        }
        while(mode == STDT && stdcnt < 8){
@@ -429,7 +429,7 @@ vdpy_edid_generate(uint8_t *edid, size_t size,
struct edid_info *info)
        uint16_t id_product;
        uint32_t serial;
        uint8_t *desc;
-       base_param b_param, c_param;
+       base_param b_param;
 
        vdpy_edid_set_baseparam(&b_param, info->prefx, info-
prefy);
@@ -493,14 +493,12 @@ vdpy_edid_generate(uint8_t *edid, size_t
size, struct edid_info *info)
        vdpy_edid_set_timing(edid, &b_param, STDT);
 
        /* edid[125:54], Detailed Timing Descriptor - 18 bytes x 4
*/
-       // Detailed Timing Descriptor 1
+       // Preferred Timing Mode
        desc = edid + 54;
-       vdpy_edid_set_baseparam(&c_param, VDPY_MAX_WIDTH,
VDPY_MAX_HEIGHT);
-       vdpy_edid_set_descripter(desc, 0x1, 0, &c_param);
-       // Detailed Timing Descriptor 2
+       vdpy_edid_set_descripter(desc, 0x1, 0, &b_param);
+       // iDisplay Range Limits & Additional Timing Descriptor
(tag #FDh)
        desc += 18;
-       vdpy_edid_set_baseparam(&c_param, VDPY_DEFAULT_WIDTH,
VDPY_DEFAULT_HEIGHT);
-       vdpy_edid_set_descripter(desc, 0x1, 0, &c_param);
+       vdpy_edid_set_descripter(desc, 0, 0xfd, &b_param);
        // Display Product Name (ASCII) String Descriptor (tag
#FCh)
        desc += 18;
        vdpy_edid_set_descripter(desc, 0, 0xfc, &b_param);
@@ -526,10 +524,10 @@ vdpy_get_edid(int handle, uint8_t *edid,
size_t size)
                edid_info.maxx = VDPY_MAX_WIDTH;
                edid_info.maxy = VDPY_MAX_HEIGHT;
        } else {
-               edid_info.prefx = 0;
-               edid_info.prefy = 0;
-               edid_info.maxx = 0;
-               edid_info.maxy = 0;
+               edid_info.prefx = VDPY_DEFAULT_WIDTH;
+               edid_info.prefy = VDPY_DEFAULT_HEIGHT;
+               edid_info.maxx = VDPY_MAX_WIDTH;
+               edid_info.maxy = VDPY_MAX_HEIGHT;
        }
        edid_info.refresh_rate = 0;
        edid_info.vendor = NULL;
--
2.25.1



--
Sun Peng <peng.p.sun@...>
SSE/ACRN Upstream

Join acrn-dev@lists.projectacrn.org to automatically receive all group messages.