summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2022-02-03 15:43:54 +0100
committerAndreas Kling <kling@serenityos.org>2022-02-03 16:11:26 +0100
commit200589ba279d20db81a8de5f2ed0f8587e42c2d6 (patch)
tree07a5ae0e9bfea3f8b8810ab1fd9678ad44f6c80c
parentca42621be17a85f0ec3513404a6fbce063be370d (diff)
downloadserenity-200589ba279d20db81a8de5f2ed0f8587e42c2d6.zip
Kernel: Turn VirtIOGPU operation lock from mutex into spinlock
-rw-r--r--Kernel/Graphics/VirtIOGPU/FramebufferDevice.cpp8
-rw-r--r--Kernel/Graphics/VirtIOGPU/GraphicsAdapter.cpp4
-rw-r--r--Kernel/Graphics/VirtIOGPU/GraphicsAdapter.h2
3 files changed, 7 insertions, 7 deletions
diff --git a/Kernel/Graphics/VirtIOGPU/FramebufferDevice.cpp b/Kernel/Graphics/VirtIOGPU/FramebufferDevice.cpp
index e70733e7d5..52160312d4 100644
--- a/Kernel/Graphics/VirtIOGPU/FramebufferDevice.cpp
+++ b/Kernel/Graphics/VirtIOGPU/FramebufferDevice.cpp
@@ -83,7 +83,7 @@ ErrorOr<void> FramebufferDevice::set_head_resolution(size_t head, size_t width,
auto& info = display_info();
- MutexLocker locker(adapter()->operation_lock());
+ SpinlockLocker locker(adapter()->operation_lock());
info.rect = {
.x = 0,
@@ -109,7 +109,7 @@ ErrorOr<void> FramebufferDevice::flush_head_buffer(size_t)
}
ErrorOr<void> FramebufferDevice::flush_rectangle(size_t buffer_index, FBRect const& rect)
{
- MutexLocker locker(adapter()->operation_lock());
+ SpinlockLocker locker(adapter()->operation_lock());
Protocol::Rect dirty_rect {
.x = rect.x,
.y = rect.y,
@@ -184,7 +184,7 @@ ErrorOr<void> FramebufferDevice::create_framebuffer()
}
m_framebuffer_sink_vmobject = TRY(Memory::AnonymousVMObject::try_create_with_physical_pages(pages.span()));
- MutexLocker locker(adapter()->operation_lock());
+ SpinlockLocker locker(adapter()->operation_lock());
m_current_buffer = &buffer_from_index(m_last_set_buffer_index.load());
create_buffer(m_main_buffer, 0, m_buffer_size);
create_buffer(m_back_buffer, m_buffer_size, m_buffer_size);
@@ -256,7 +256,7 @@ void FramebufferDevice::flush_displayed_image(Protocol::Rect const& dirty_rect,
void FramebufferDevice::set_buffer(int buffer_index)
{
auto& buffer = buffer_index == 0 ? m_main_buffer : m_back_buffer;
- MutexLocker locker(adapter()->operation_lock());
+ SpinlockLocker locker(adapter()->operation_lock());
if (&buffer == m_current_buffer)
return;
m_current_buffer = &buffer;
diff --git a/Kernel/Graphics/VirtIOGPU/GraphicsAdapter.cpp b/Kernel/Graphics/VirtIOGPU/GraphicsAdapter.cpp
index 27212ff2ed..49169e3327 100644
--- a/Kernel/Graphics/VirtIOGPU/GraphicsAdapter.cpp
+++ b/Kernel/Graphics/VirtIOGPU/GraphicsAdapter.cpp
@@ -90,7 +90,7 @@ void GraphicsAdapter::initialize()
}
VERIFY(success);
finish_init();
- MutexLocker locker(m_operation_lock);
+ SpinlockLocker locker(m_operation_lock);
// Get display information using VIRTIO_GPU_CMD_GET_DISPLAY_INFO
query_display_information();
query_display_edid({});
@@ -396,7 +396,7 @@ void GraphicsAdapter::populate_virtio_gpu_request_header(Protocol::ControlHeader
void GraphicsAdapter::flush_dirty_rectangle(ScanoutID scanout_id, ResourceID resource_id, Protocol::Rect const& dirty_rect)
{
- MutexLocker locker(m_operation_lock);
+ SpinlockLocker locker(m_operation_lock);
transfer_framebuffer_data_to_host(scanout_id, resource_id, dirty_rect);
flush_displayed_image(resource_id, dirty_rect);
}
diff --git a/Kernel/Graphics/VirtIOGPU/GraphicsAdapter.h b/Kernel/Graphics/VirtIOGPU/GraphicsAdapter.h
index d3dc3feb1f..a04e241d59 100644
--- a/Kernel/Graphics/VirtIOGPU/GraphicsAdapter.h
+++ b/Kernel/Graphics/VirtIOGPU/GraphicsAdapter.h
@@ -141,7 +141,7 @@ private:
// Synchronous commands
WaitQueue m_outstanding_request;
- Mutex m_operation_lock;
+ Spinlock m_operation_lock;
OwnPtr<Memory::Region> m_scratch_space;
};
}