summaryrefslogtreecommitdiff
path: root/Kernel/Graphics/VirtIOGPU
diff options
context:
space:
mode:
authorLiav A <liavalb@gmail.com>2022-12-16 15:37:32 +0200
committerSam Atkins <atkinssj@gmail.com>2022-12-19 10:19:57 +0000
commit12d4bbbd11811659cd8feb759107c3491c0f8d9e (patch)
treeb36e5917afd060931496fe7dc585d77ffba638db /Kernel/Graphics/VirtIOGPU
parentbb491a681dd877d782422e107ee3316e670c4ae8 (diff)
downloadserenity-12d4bbbd11811659cd8feb759107c3491c0f8d9e.zip
Kernel/Graphics: Disable double buffering for the VirtIO driver
The performance that we achieve from this technique is visually worse compared to turning off this feature, so let's not use this until we figure out why it happens.
Diffstat (limited to 'Kernel/Graphics/VirtIOGPU')
-rw-r--r--Kernel/Graphics/VirtIOGPU/DisplayConnector.cpp34
-rw-r--r--Kernel/Graphics/VirtIOGPU/DisplayConnector.h5
-rw-r--r--Kernel/Graphics/VirtIOGPU/GraphicsAdapter.cpp1
3 files changed, 12 insertions, 28 deletions
diff --git a/Kernel/Graphics/VirtIOGPU/DisplayConnector.cpp b/Kernel/Graphics/VirtIOGPU/DisplayConnector.cpp
index b72c0ddc11..d0118f7267 100644
--- a/Kernel/Graphics/VirtIOGPU/DisplayConnector.cpp
+++ b/Kernel/Graphics/VirtIOGPU/DisplayConnector.cpp
@@ -96,16 +96,13 @@ ErrorOr<void> VirtIODisplayConnector::set_safe_mode_setting()
return set_mode_setting(safe_mode_setting);
}
-ErrorOr<void> VirtIODisplayConnector::set_y_offset(size_t y)
+ErrorOr<void> VirtIODisplayConnector::set_y_offset(size_t)
{
- VERIFY(m_control_lock.is_locked());
- if (y == 0)
- m_last_set_buffer_index.store(0);
- else if (y == m_display_info.rect.height)
- m_last_set_buffer_index.store(1);
- else
- return Error::from_errno(EINVAL);
- return {};
+ // NOTE (FIXME?): We don't do double buffering because when using double buffering,
+ // perfomance visually looks terrible (everything look sluggish) compared to not using it,
+ // so until we figure out why (and we might not figure this and double buffering is simply not needed)
+ // this happens, we simply don't support it.
+ return Error::from_errno(ENOTSUP);
}
ErrorOr<void> VirtIODisplayConnector::unblank()
{
@@ -125,14 +122,9 @@ ErrorOr<void> VirtIODisplayConnector::flush_rectangle(size_t buffer_index, FBRec
.height = rect.height
};
- bool main_buffer = (buffer_index == 0);
- m_graphics_adapter->transfer_framebuffer_data_to_host({}, *this, dirty_rect, main_buffer);
- if (m_last_set_buffer_index.load() == buffer_index) {
- // Flushing directly to screen
- flush_displayed_image(dirty_rect, main_buffer);
- } else {
- set_dirty_displayed_rect(dirty_rect, main_buffer);
- }
+ m_graphics_adapter->transfer_framebuffer_data_to_host({}, *this, dirty_rect, true);
+ // Flushing directly to screen
+ flush_displayed_image(dirty_rect, true);
return {};
}
@@ -147,13 +139,9 @@ ErrorOr<void> VirtIODisplayConnector::flush_first_surface()
.height = m_display_info.rect.height
};
- auto current_buffer_index = m_last_set_buffer_index.load();
- VERIFY(is_valid_buffer_index(current_buffer_index));
-
- bool main_buffer = (current_buffer_index == 0);
- m_graphics_adapter->transfer_framebuffer_data_to_host({}, *this, dirty_rect, main_buffer);
+ m_graphics_adapter->transfer_framebuffer_data_to_host({}, *this, dirty_rect, true);
// Flushing directly to screen
- flush_displayed_image(dirty_rect, main_buffer);
+ flush_displayed_image(dirty_rect, true);
return {};
}
diff --git a/Kernel/Graphics/VirtIOGPU/DisplayConnector.h b/Kernel/Graphics/VirtIOGPU/DisplayConnector.h
index 82d23edc4c..7eb774a2d6 100644
--- a/Kernel/Graphics/VirtIOGPU/DisplayConnector.h
+++ b/Kernel/Graphics/VirtIOGPU/DisplayConnector.h
@@ -42,7 +42,7 @@ public:
private:
void initialize_console();
virtual bool mutable_mode_setting_capable() const override { return true; }
- virtual bool double_framebuffering_capable() const override { return true; }
+ virtual bool double_framebuffering_capable() const override { return false; }
virtual bool partial_flush_support() const override { return true; }
virtual ErrorOr<void> set_mode_setting(ModeSetting const&) override;
virtual ErrorOr<void> set_safe_mode_setting() override;
@@ -86,9 +86,6 @@ private:
Graphics::VirtIOGPU::Protocol::DisplayInfoResponse::Display m_display_info {};
Graphics::VirtIOGPU::ScanoutID m_scanout_id;
- // 2D framebuffer Member data
- Atomic<size_t, AK::memory_order_relaxed> m_last_set_buffer_index { 0 };
-
constexpr static size_t NUM_TRANSFER_REGION_PAGES = 256;
};
diff --git a/Kernel/Graphics/VirtIOGPU/GraphicsAdapter.cpp b/Kernel/Graphics/VirtIOGPU/GraphicsAdapter.cpp
index da960a5adb..9813b2bb1a 100644
--- a/Kernel/Graphics/VirtIOGPU/GraphicsAdapter.cpp
+++ b/Kernel/Graphics/VirtIOGPU/GraphicsAdapter.cpp
@@ -56,7 +56,6 @@ ErrorOr<void> VirtIOGraphicsAdapter::mode_set_resolution(Badge<VirtIODisplayConn
VERIFY(connector.scanout_id() < VIRTIO_GPU_MAX_SCANOUTS);
auto rounded_buffer_size = TRY(calculate_framebuffer_size(width, height));
TRY(attach_physical_range_to_framebuffer(connector, true, 0, rounded_buffer_size));
- TRY(attach_physical_range_to_framebuffer(connector, false, rounded_buffer_size, rounded_buffer_size));
return {};
}