summaryrefslogtreecommitdiff
path: root/Kernel/Graphics/VirtIOGPU
diff options
context:
space:
mode:
authorTom <tomut@yahoo.com>2021-07-03 12:43:35 -0600
committerAndreas Kling <kling@serenityos.org>2021-07-04 23:59:17 +0200
commitfdae117600925e17dfbab54961dd68ddcfe27dc2 (patch)
tree420f1cd3daf1efb29c2039357433a1558292a183 /Kernel/Graphics/VirtIOGPU
parent45a2bc27d5126b5c0c0fed38a5cd8e9df4e049dd (diff)
downloadserenity-fdae117600925e17dfbab54961dd68ddcfe27dc2.zip
WindowServer: Implement support for combined buffer flipping + flushing
Some devices may require DMA transfers to flush the updated buffer areas prior to flipping. For those devices we track the areas that require flushing prior to the next flip. For devices that do not support flipping, but require flushing, we'll simply flush after updating the front buffer. This also adds a small optimization that skips these steps entirely for a screen that doesn't have any updates that need to be rendered.
Diffstat (limited to 'Kernel/Graphics/VirtIOGPU')
-rw-r--r--Kernel/Graphics/VirtIOGPU/VirtIOFrameBufferDevice.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/Kernel/Graphics/VirtIOGPU/VirtIOFrameBufferDevice.cpp b/Kernel/Graphics/VirtIOGPU/VirtIOFrameBufferDevice.cpp
index 0c55be5887..1b6d67e1f2 100644
--- a/Kernel/Graphics/VirtIOGPU/VirtIOFrameBufferDevice.cpp
+++ b/Kernel/Graphics/VirtIOGPU/VirtIOFrameBufferDevice.cpp
@@ -148,14 +148,16 @@ int VirtIOFrameBufferDevice::ioctl(FileDescription&, unsigned request, FlatPtr a
return 0;
}
case FB_IOCTL_FLUSH_BUFFERS: {
- FBRects user_dirty_rects;
- if (!copy_from_user(&user_dirty_rects, (FBRects*)arg))
+ FBFlushRects user_flush_rects;
+ if (!copy_from_user(&user_flush_rects, (FBFlushRects*)arg))
return -EFAULT;
- if (Checked<unsigned>::multiplication_would_overflow(user_dirty_rects.count, sizeof(FBRect)))
+ if (user_flush_rects.buffer_index != 0)
+ return -EINVAL;
+ if (Checked<unsigned>::multiplication_would_overflow(user_flush_rects.count, sizeof(FBRect)))
return -EFAULT;
- for (unsigned i = 0; i < user_dirty_rects.count; i++) {
+ for (unsigned i = 0; i < user_flush_rects.count; i++) {
FBRect user_dirty_rect;
- if (!copy_from_user(&user_dirty_rect, &user_dirty_rects.rects[i]))
+ if (!copy_from_user(&user_dirty_rect, &user_flush_rects.rects[i]))
return -EFAULT;
if (m_are_writes_active) {
VirtIOGPURect dirty_rect {