<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from rtf -->
<style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
</head>
<body>
<font face="Calibri" size="2"><span style="font-size:11pt;">
<div>Hi,</div>
<div><font face="Times New Roman"> </font></div>
<div>As the discussions we have before about the vblank and pageflip events shows that these two display event delivering favors have their own drawbacks, i.e. </div>
<ol style="margin:0;padding-left:36pt;">
<li>vblanks would trigger 60 times per second constantly but sometimes cause extra and unnecessary handling and performance drops if no pageflip happens, though it can avoid overwhelmed events in such cases like moving the cursor frequently causing userspace
window manager ui overhead </li><li>pageflip events only would be embarrassing when happening to a single framebuffer like in Linux textmode console, almost no pageflips are triggered, as a consequence, the userspace does not refresh the display while framebuffer updates, thus user experience
drops. Plus, just like the vblanks, if overwhelmed events deliver to userspace, the performance drops as well</li></ol>
<div><font face="Times New Roman"> </font></div>
<div>These days we tried some ways to make tradeoff and take the advantage of the both two favors. To be brief, the basic idea is to deliver display refresh events at the vblank, and we skip some unneccessay vblank events if there is no cursor/primay pageflip
happens during this period checking the flip_done_event bitmap. In addition, if we happen to a single framebuffer case, i.e. no pageflip happens in a certain period, we still deliver all vblank events to userspace.</div>
<div><font face="Times New Roman"> </font></div>
<div>To simplify the events delivering, we have only one eventfd responsible for these display refresh events, using partitioned 8 byte eventfd count value to designate different events and up to eight. Here we define two events, i.e. console refresh and cursor
refresh events and its corresponding increasement value, e.g. for primary(or console) framebuffer refresh events DISPLAY_CON_REFRESH_EVENT, the increased val is in highest one byte. When handling the event, if this byte has value, userspace knows the console
refresh events delivered. </div>
<div> </div>
<div>If after some vblanks there is no pageflip, we would assume current case is single framebuffer and deliver all the vblank events to notify userspace to update. Although we still have some tricks to determine if this single framebuffer has updates and skip
ones without update, these tricks such as using checksum or hash to compare the framebuffer content are computing-intensive and consuming much cpu resource when idle. So to single framebuffer case, delivering fully vblank events are great tradeoff.</div>
<div><font face="Times New Roman"> </font></div>
<div>Here is the POC you can have a try, kernel upstream in branch topic/display_event: <a href="https://github.com/intel/gvt-linux/tree/topic/display_event"><font color="#0563C1"><u>https://github.com/intel/gvt-linux/tree/topic/display_event</u></font></a>
, topic/display_event: <a href="https://github.com/intel/Igvtg-qemu/tree/topic/display_event"><font color="#0563C1"><u>https://github.com/intel/Igvtg-qemu/tree/topic/display_event</u></font></a>. </div>
<div><font face="Times New Roman"> </font></div>
<div>Thanks.</div>
<div><font face="Times New Roman"> </font></div>
<div>Best Regards,</div>
<div>Kechen</div>
<div><font face="Times New Roman"> </font></div>
<div><font face="Times New Roman"> </font></div>
<div><font face="Times New Roman"> </font></div>
</span></font>
</body>
</html>