[RFC] Display Refresh Events Delivering Poc Combining Vblanks and Pageflips
Lu, Kechen
kechen.lu at intel.com
Fri Jul 12 10:37:23 UTC 2019
Hi,
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.
1. 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
2. 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
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.
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.
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.
Here is the POC you can have a try, kernel upstream in branch topic/display_event: https://github.com/intel/gvt-linux/tree/topic/display_event , topic/display_event: https://github.com/intel/Igvtg-qemu/tree/topic/display_event.
Thanks.
Best Regards,
Kechen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/intel-gvt-dev/attachments/20190712/7b551c7b/attachment.html>
More information about the intel-gvt-dev
mailing list