<html><body><div style="font-family: times new roman, new york, times, serif; font-size: 12pt; color: #000000"><div>As already stated by Javier the difference was not the CPU usage but user experience.<br>I think that mainly the Windows engine is free to do its own job while our driver complete<br>the operation. Looking at Windows calls to our driver looks like Windows keep another<br>frame buffer and periodically (didn't try to understand when exactly or how often) pass<br>dirty rects to update the card (QXL in this case) frame buffer.<br>I have the feeling (don't know how to verify) that if the driver returns STATUS_PENDING<br>Windows will collapse dirty rects while the driver is doing its job basically decreasing calls<br>to our driver but doing the proper frame buffer updates.<br><br>Frediano<br><br></div><div><br></div><hr id="zwchr"><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;" data-mce-style="border-left: 2px solid #1010FF; margin-left: 5px; padding-left: 5px; color: #000; font-weight: normal; font-style: normal; text-decoration: none; font-family: Helvetica,Arial,sans-serif; font-size: 12pt;"><br><div><br></div><div dir="ltr">Hello Javier,<div><br></div><div>After implementing the pushing thread in current qxl-wddm-dod I measure the CPU consumption in PresentDisplayOnly call and in the thread on pushing drawables to the device. The results show that the time to push drawables is negligible in relation to time of copying dirty rects to the device memory (in average the proportion is ~ 1/500) and in typical case the pushing thread serves only single 'present' operation and then waits for next operation.</div><div>I tried in on Win10 with 2-3 G memory and 1-2 CPUs with regular user activity (opening windows, redrawing, scrolling etc)</div><div><br></div><div>Do I miss something?</div><div><br></div><div>Thanks,</div><div>Yuri</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Nov 25, 2016 at 11:11 AM, Javier Celaya <span dir="ltr"><<a href="mailto:javier.celaya@flexvdi.com" target="_blank" data-mce-href="mailto:javier.celaya@flexvdi.com">javier.celaya@flexvdi.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex" data-mce-style="margin: 0 0 0 .8ex; border-left: 1px #ccc solid; padding-left: 1ex;"><div><div>Hello Yuri</div><div><br></div><div>El vie, 25-11-2016 a las 01:08 +0200, Yuri Benditovich escribió:</div><blockquote><div dir="ltr"><div><div><span style="color:rgb(0,0,0);font-family:"courier new",courier,monaco,monospace,sans-serif;font-size:16px" data-mce-style="color: #000000; font-family: 'courier new',courier,monaco,monospace,sans-serif; font-size: 16px;">I'm porting to [qxl-wddm-dod] set of flexvdi changes</span><br></div></div><div style="color:rgb(0,0,0);font-family:"courier new",courier,monaco,monospace,sans-serif;font-size:16px" data-mce-style="color: #000000; font-family: 'courier new',courier,monaco,monospace,sans-serif; font-size: 16px;"><span style="font-size:12pt" data-mce-style="font-size: 12pt;">related to execution of '</span><span style="font-size:12pt" data-mce-style="font-size: 12pt;">present display only' events</span></div><div style="color:rgb(0,0,0);font-family:"courier new",courier,monaco,monospace,sans-serif;font-size:16px" data-mce-style="color: #000000; font-family: 'courier new',courier,monaco,monospace,sans-serif; font-size: 16px;"><span style="font-size:12pt" data-mce-style="font-size: 12pt;">in separate thread. There are 2<b> questions below</b> I'd like to ask and k</span><span style="font-size:12pt" data-mce-style="font-size: 12pt;">now your opinion.</span></div><div style="color:rgb(0,0,0);font-family:"courier new",courier,monaco,monospace,sans-serif;font-size:16px" data-mce-style="color: #000000; font-family: 'courier new',courier,monaco,monospace,sans-serif; font-size: 16px;"><span style="font-size:12pt" data-mce-style="font-size: 12pt;"><br></span></div><div style="color:rgb(0,0,0);font-family:"courier new",courier,monaco,monospace,sans-serif;font-size:16px" data-mce-style="color: #000000; font-family: 'courier new',courier,monaco,monospace,sans-serif; font-size: 16px;"><span style="font-size:12pt" data-mce-style="font-size: 12pt;">I see there 2 aspects:</span></div><div style="color:rgb(0,0,0);font-family:"courier new",courier,monaco,monospace,sans-serif;font-size:16px" data-mce-style="color: #000000; font-family: 'courier new',courier,monaco,monospace,sans-serif; font-size: 16px;"><span style="font-size:12pt" data-mce-style="font-size: 12pt;">- reliability</span></div><div style="color:rgb(0,0,0);font-family:"courier new",courier,monaco,monospace,sans-serif;font-size:16px" data-mce-style="color: #000000; font-family: 'courier new',courier,monaco,monospace,sans-serif; font-size: 16px;"><span style="font-size:12pt" data-mce-style="font-size: 12pt;">- performance</span></div><div style="color:rgb(0,0,0);font-family:"courier new",courier,monaco,monospace,sans-serif;font-size:16px" data-mce-style="color: #000000; font-family: 'courier new',courier,monaco,monospace,sans-serif; font-size: 16px;"><br></div><div style="color:rgb(0,0,0);font-family:"courier new",courier,monaco,monospace,sans-serif;font-size:16px" data-mce-style="color: #000000; font-family: 'courier new',courier,monaco,monospace,sans-serif; font-size: 16px;"><br></div><div style="color:rgb(0,0,0);font-family:"courier new",courier,monaco,monospace,sans-serif;font-size:16px" data-mce-style="color: #000000; font-family: 'courier new',courier,monaco,monospace,sans-serif; font-size: 16px;"><span style="font-size:12pt" data-mce-style="font-size: 12pt;"><span data-mce-style="text-decoration: underline;" style="text-decoration: underline;">Reliability:</span></span></div><div style="color:rgb(0,0,0);font-family:"courier new",courier,monaco,monospace,sans-serif;font-size:16px" data-mce-style="color: #000000; font-family: 'courier new',courier,monaco,monospace,sans-serif; font-size: 16px;"><span style="font-size:12pt" data-mce-style="font-size: 12pt;">I see in flexvdi mailing list existing report of</span></div><div style="color:rgb(0,0,0);font-family:"courier new",courier,monaco,monospace,sans-serif;font-size:16px" data-mce-style="color: #000000; font-family: 'courier new',courier,monaco,monospace,sans-serif; font-size: 16px;"><span style="font-size:12pt" data-mce-style="font-size: 12pt;">BSOD upon system shutdown. Possible cause is lack of</span></div><div style="color:rgb(0,0,0);font-family:"courier new",courier,monaco,monospace,sans-serif;font-size:16px" data-mce-style="color: #000000; font-family: 'courier new',courier,monaco,monospace,sans-serif; font-size: 16px;"><span style="font-size:12pt" data-mce-style="font-size: 12pt;">synchronization between system flows, hardware availability and worker thread state </span><span style="font-size:12pt" data-mce-style="font-size: 12pt;">(last patch in flexvdi 'Terminate working thread on exit' </span><span style="font-size:12pt" data-mce-style="font-size: 12pt;">introduces termination procedure but nobody calls it, </span><span style="font-size:12pt" data-mce-style="font-size: 12pt;">as I can see)</span></div><div style="color:rgb(0,0,0);font-family:"courier new",courier,monaco,monospace,sans-serif;font-size:16px" data-mce-style="color: #000000; font-family: 'courier new',courier,monaco,monospace,sans-serif; font-size: 16px;"><span style="font-size:12pt" data-mce-style="font-size: 12pt;">The lack of synchronization may cause also races in</span></div><div style="color:rgb(0,0,0);font-family:"courier new",courier,monaco,monospace,sans-serif;font-size:16px" data-mce-style="color: #000000; font-family: 'courier new',courier,monaco,monospace,sans-serif; font-size: 16px;"><span style="font-size:12pt" data-mce-style="font-size: 12pt;">power</span><span style="font-size:12pt" data-mce-style="font-size: 12pt;"> management flows and (possible) on changing</span></div><div style="color:rgb(0,0,0);font-family:"courier new",courier,monaco,monospace,sans-serif;font-size:16px" data-mce-style="color: #000000; font-family: 'courier new',courier,monaco,monospace,sans-serif; font-size: 16px;"><span style="font-size:12pt" data-mce-style="font-size: 12pt;">operating mode.</span></div><div style="color:rgb(0,0,0);font-family:"courier new",courier,monaco,monospace,sans-serif;font-size:16px" data-mce-style="color: #000000; font-family: 'courier new',courier,monaco,monospace,sans-serif; font-size: 16px;"><span style="font-size:12pt" data-mce-style="font-size: 12pt;"><br></span></div><div style="color:rgb(0,0,0);font-family:"courier new",courier,monaco,monospace,sans-serif;font-size:16px" data-mce-style="color: #000000; font-family: 'courier new',courier,monaco,monospace,sans-serif; font-size: 16px;"><strong><span style="font-size:12pt" data-mce-style="font-size: 12pt;">Question 1:</span></strong></div><div style="color:rgb(0,0,0);font-family:"courier new",courier,monaco,monospace,sans-serif;font-size:16px" data-mce-style="color: #000000; font-family: 'courier new',courier,monaco,monospace,sans-serif; font-size: 16px;"><strong><span style="font-size:12pt" data-mce-style="font-size: 12pt;">Do you have some additional recommendation which</span></strong></div><div style="color:rgb(0,0,0);font-family:"courier new",courier,monaco,monospace,sans-serif;font-size:16px" data-mce-style="color: #000000; font-family: 'courier new',courier,monaco,monospace,sans-serif; font-size: 16px;"><strong><span style="font-size:12pt" data-mce-style="font-size: 12pt;">flows shall be specially checked for races with</span></strong></div><div style="color:rgb(0,0,0);font-family:"courier new",courier,monaco,monospace,sans-serif;font-size:16px" data-mce-style="color: #000000; font-family: 'courier new',courier,monaco,monospace,sans-serif; font-size: 16px;"><strong><span style="font-size:12pt" data-mce-style="font-size: 12pt;">rendering thread?</span></strong></div></div></blockquote><div><br></div><div>Unfortunately, the truth is, we have not thoroughly tested our code to remove these races yet. The clients this driver was intended for are still stuck using Windows XP/7, and our development is stalled. So, I cannot think of any situation you should check that you do not know about yet.</div><div><br></div><blockquote><div dir="ltr"><div style="color:rgb(0,0,0);font-family:"courier new",courier,monaco,monospace,sans-serif;font-size:16px" data-mce-style="color: #000000; font-family: 'courier new',courier,monaco,monospace,sans-serif; font-size: 16px;"><br></div><div style="color:rgb(0,0,0);font-family:"courier new",courier,monaco,monospace,sans-serif;font-size:16px" data-mce-style="color: #000000; font-family: 'courier new',courier,monaco,monospace,sans-serif; font-size: 16px;"><span style="font-size:12pt" data-mce-style="font-size: 12pt;"><span data-mce-style="text-decoration: underline;" style="text-decoration: underline;">Performance:</span></span></div><div style="color:rgb(0,0,0);font-family:"courier new",courier,monaco,monospace,sans-serif;font-size:16px" data-mce-style="color: #000000; font-family: 'courier new',courier,monaco,monospace,sans-serif; font-size: 16px;"><span style="font-size:12pt" data-mce-style="font-size: 12pt;"></span><span style="font-size:12pt" data-mce-style="font-size: 12pt;">It looks like </span>the change should not affect total CPU consumption for</div><div style="color:rgb(0,0,0);font-family:"courier new",courier,monaco,monospace,sans-serif;font-size:16px" data-mce-style="color: #000000; font-family: 'courier new',courier,monaco,monospace,sans-serif; font-size: 16px;">the rendering, it splits more or less the same operations over</div><div style="color:rgb(0,0,0);font-family:"courier new",courier,monaco,monospace,sans-serif;font-size:16px" data-mce-style="color: #000000; font-family: 'courier new',courier,monaco,monospace,sans-serif; font-size: 16px;">2 different threads. <span style="font-size:12pt" data-mce-style="font-size: 12pt;">It is still possible that the </span><span style="font-size:12pt" data-mce-style="font-size: 12pt;">change can improve</span></div><div style="color:rgb(0,0,0);font-family:"courier new",courier,monaco,monospace,sans-serif;font-size:16px" data-mce-style="color: #000000; font-family: 'courier new',courier,monaco,monospace,sans-serif; font-size: 16px;"><span style="font-size:12pt" data-mce-style="font-size: 12pt;">common user experience </span><span style="font-size:12pt" data-mce-style="font-size: 12pt;">due to </span><span style="font-size:12pt" data-mce-style="font-size: 12pt;">faster indication of operation completion to </span><span style="font-size:12pt" data-mce-style="font-size: 12pt;">the OS.</span></div></div></blockquote><div><br></div><div>We were not trying to reduce total CPU consumption. After all, the driver just copies rects from main memory to VRAM and passes them to the spice server; there is little to reduce there. Rather, we tried to increase the throughput of graphic operations, by not locking the DirectX subsystem while we wait for the spice server to accept new drawables. That is, we do not mind using more CPU if that results in painting faster.</div><div>On the other hand, I was thinking that maybe we could get the DirectX subsystem to provide the rects already in VRAM if we described it as a linear memory segment on driver initialization. In that way, the copying operation could also be removed. However, I am not sure if this actually works or even how to do it, it is just an idea.</div><div><br></div><blockquote><div dir="ltr"><div style="color:rgb(0,0,0);font-family:"courier new",courier,monaco,monospace,sans-serif;font-size:16px" data-mce-style="color: #000000; font-family: 'courier new',courier,monaco,monospace,sans-serif; font-size: 16px;"><strong><span style="font-size:12pt" data-mce-style="font-size: 12pt;"><br></span></strong></div><div style="color:rgb(0,0,0);font-family:"courier new",courier,monaco,monospace,sans-serif;font-size:16px" data-mce-style="color: #000000; font-family: 'courier new',courier,monaco,monospace,sans-serif; font-size: 16px;"><strong><span style="font-size:12pt" data-mce-style="font-size: 12pt;">Question 2:</span></strong></div><div style="color:rgb(0,0,0);font-family:"courier new",courier,monaco,monospace,sans-serif;font-size:16px" data-mce-style="color: #000000; font-family: 'courier new',courier,monaco,monospace,sans-serif; font-size: 16px;"><strong><span style="font-size:12pt" data-mce-style="font-size: 12pt;">Do you have some ideas how to make quantitive</span></strong></div><div style="color:rgb(0,0,0);font-family:"courier new",courier,monaco,monospace,sans-serif;font-size:16px" data-mce-style="color: #000000; font-family: 'courier new',courier,monaco,monospace,sans-serif; font-size: 16px;"><strong><span style="font-size:12pt" data-mce-style="font-size: 12pt;">evaluation of this possible </span></strong><strong style="font-size:12pt" data-mce-style="font-size: 12pt;"><span style="font-size:12pt" data-mce-style="font-size: 12pt;">improvement of user experience? </span></strong></div><div style="color:rgb(0,0,0);font-family:"courier new",courier,monaco,monospace,sans-serif;font-size:16px" data-mce-style="color: #000000; font-family: 'courier new',courier,monaco,monospace,sans-serif; font-size: 16px;"><span style="font-size:12pt" data-mce-style="font-size: 12pt;"><br></span></div><div style="color:rgb(0,0,0);font-family:"courier new",courier,monaco,monospace,sans-serif;font-size:16px" data-mce-style="color: #000000; font-family: 'courier new',courier,monaco,monospace,sans-serif; font-size: 16px;"><span style="font-size:12pt" data-mce-style="font-size: 12pt;">I think about: </span></div><div style="color:rgb(0,0,0);font-family:"courier new",courier,monaco,monospace,sans-serif;font-size:16px" data-mce-style="color: #000000; font-family: 'courier new',courier,monaco,monospace,sans-serif; font-size: 16px;"><span style="font-size:12pt" data-mce-style="font-size: 12pt;">- finding scenarios when we receive </span><span style="font-size:12pt" data-mce-style="font-size: 12pt;">rendering calls (PresentDisplayOnly) when the worker </span><span style="font-size:12pt" data-mce-style="font-size: 12pt;">thread is still processing previous operation. If they exist this can mean that some bottleneck solved in GDI.</span></div><div style="color:rgb(0,0,0);font-family:"courier new",courier,monaco,monospace,sans-serif;font-size:16px" data-mce-style="color: #000000; font-family: 'courier new',courier,monaco,monospace,sans-serif; font-size: 16px;"><span style="font-size:12pt" data-mce-style="font-size: 12pt;">- writing or getting tool that loads the graphics</span></div><div style="color:rgb(0,0,0);font-family:"courier new",courier,monaco,monospace,sans-serif;font-size:16px" data-mce-style="color: #000000; font-family: 'courier new',courier,monaco,monospace,sans-serif; font-size: 16px;"><span style="font-size:12pt" data-mce-style="font-size: 12pt;">adapter by heavy operations (like continuos moving of window / scrolling etc) with CPU consumption measurement</span></div></div></blockquote><div><br></div><div>We used a simple tool to measure the performance: it creates a window and continuously issues WM_PAINT events where the full background is filled with color, then measures the number of processed events per second (not CPU). It is quite naive, but it provides a good starting reference, since the tool, with the XDDM QXL driver in Windows 7, outputs almost twice as much paint events as executing it in Windows 8 with the WDDM QXL driver. There are other measurements you can try to obtain, like how much time does it take until a paint event gets to the spice server queue, ready to be sent to the client (although I'm not sure how to measure it). This delay affects the user perception of performance.</div><div><br></div><blockquote><div dir="ltr"><div style="color:rgb(0,0,0);font-family:"courier new",courier,monaco,monospace,sans-serif;font-size:16px" data-mce-style="color: #000000; font-family: 'courier new',courier,monaco,monospace,sans-serif; font-size: 16px;"><br></div><div style="color:rgb(0,0,0);font-family:"courier new",courier,monaco,monospace,sans-serif;font-size:16px" data-mce-style="color: #000000; font-family: 'courier new',courier,monaco,monospace,sans-serif; font-size: 16px;"><br></div><div style="color:rgb(0,0,0);font-family:"courier new",courier,monaco,monospace,sans-serif;font-size:16px" data-mce-style="color: #000000; font-family: 'courier new',courier,monaco,monospace,sans-serif; font-size: 16px;"><span style="font-size:12pt" data-mce-style="font-size: 12pt;">Please share your thoughts.</span></div><div style="color:rgb(0,0,0);font-family:"courier new",courier,monaco,monospace,sans-serif;font-size:16px" data-mce-style="color: #000000; font-family: 'courier new',courier,monaco,monospace,sans-serif; font-size: 16px;"><span style="font-size:12pt" data-mce-style="font-size: 12pt;"><br></span></div><div style="color:rgb(0,0,0);font-family:"courier new",courier,monaco,monospace,sans-serif;font-size:16px" data-mce-style="color: #000000; font-family: 'courier new',courier,monaco,monospace,sans-serif; font-size: 16px;">Thanks,</div><div style="color:rgb(0,0,0);font-family:"courier new",courier,monaco,monospace,sans-serif;font-size:16px" data-mce-style="color: #000000; font-family: 'courier new',courier,monaco,monospace,sans-serif; font-size: 16px;">Yuri</div><div style="color:rgb(0,0,0);font-family:"courier new",courier,monaco,monospace,sans-serif;font-size:16px" data-mce-style="color: #000000; font-family: 'courier new',courier,monaco,monospace,sans-serif; font-size: 16px;"><br></div></div></blockquote><div><br></div></div></blockquote></div><br></div><br>_______________________________________________<br>Spice-devel mailing list<br>Spice-devel@lists.freedesktop.org<br>https://lists.freedesktop.org/mailman/listinfo/spice-devel<br></blockquote><div><br></div></div></body></html>