summaryrefslogtreecommitdiff
path: root/Kernel/Graphics/VirtIOGPU/GPU.h
diff options
context:
space:
mode:
authorSahan Fernando <sahan.h.fernando@gmail.com>2021-07-08 02:07:21 +1000
committerAli Mohammad Pur <Ali.mpfard@gmail.com>2021-07-18 19:58:17 +0430
commit2845c6753ed2d0d9a0e13d8237e32f18a7d7a2d8 (patch)
tree0634f6aefadea652d9c8afe2c500c556a7eab00f /Kernel/Graphics/VirtIOGPU/GPU.h
parentd9330c42faed9c3dd29f7cdf580fbeebc4668c2c (diff)
downloadserenity-2845c6753ed2d0d9a0e13d8237e32f18a7d7a2d8.zip
Kernel: Clean up VirtIOGPU class interfaces
Diffstat (limited to 'Kernel/Graphics/VirtIOGPU/GPU.h')
-rw-r--r--Kernel/Graphics/VirtIOGPU/GPU.h49
1 files changed, 23 insertions, 26 deletions
diff --git a/Kernel/Graphics/VirtIOGPU/GPU.h b/Kernel/Graphics/VirtIOGPU/GPU.h
index cf48327a1f..86c75f02ca 100644
--- a/Kernel/Graphics/VirtIOGPU/GPU.h
+++ b/Kernel/Graphics/VirtIOGPU/GPU.h
@@ -43,21 +43,7 @@ public:
GPU(PCI::Address);
virtual ~GPU() override;
- void flush_dirty_window(ScanoutID, Protocol::Rect const& dirty_rect, ResourceID);
-
- auto& display_info(ScanoutID scanout) const
- {
- VERIFY(scanout.value() < VIRTIO_GPU_MAX_SCANOUTS);
- return m_scanouts[scanout.value()].display_info;
- }
- auto& display_info(ScanoutID scanout)
- {
- VERIFY(scanout.value() < VIRTIO_GPU_MAX_SCANOUTS);
- return m_scanouts[scanout.value()].display_info;
- }
-
void create_framebuffer_devices();
-
template<typename F>
IterationDecision for_each_framebuffer(F f)
{
@@ -77,22 +63,39 @@ public:
return m_scanouts[m_default_scanout.value().value()].console;
return {};
}
+ auto& display_info(ScanoutID scanout) const
+ {
+ VERIFY(scanout.value() < VIRTIO_GPU_MAX_SCANOUTS);
+ return m_scanouts[scanout.value()].display_info;
+ }
+ auto& display_info(ScanoutID scanout)
+ {
+ VERIFY(scanout.value() < VIRTIO_GPU_MAX_SCANOUTS);
+ return m_scanouts[scanout.value()].display_info;
+ }
+
+ void flush_dirty_rectangle(ScanoutID, Protocol::Rect const& dirty_rect, ResourceID);
private:
+ struct Scanout {
+ RefPtr<FrameBufferDevice> framebuffer;
+ RefPtr<Console> console;
+ Protocol::DisplayInfoResponse::Display display_info {};
+ };
+
virtual bool handle_device_config_change() override;
virtual void handle_queue_update(u16 queue_index) override;
+ u32 get_pending_events();
+ void clear_pending_events(u32 event_bitmask);
auto& operation_lock() { return m_operation_lock; }
+ ResourceID allocate_resource_id();
+
+ PhysicalAddress start_of_scratch_space() const { return m_scratch_space->physical_page(0)->paddr(); }
AK::BinaryBufferWriter create_scratchspace_writer()
{
return { Bytes(m_scratch_space->vaddr().as_ptr(), m_scratch_space->size()) };
}
-
- u32 get_pending_events();
- void clear_pending_events(u32 event_bitmask);
-
- ResourceID allocate_resource_id();
- PhysicalAddress start_of_scratch_space() const { return m_scratch_space->physical_page(0)->paddr(); }
void synchronous_virtio_gpu_command(PhysicalAddress buffer_start, size_t request_size, size_t response_size);
void populate_virtio_gpu_request_header(Protocol::ControlHeader& header, Protocol::CommandType ctrl_type, u32 flags = 0);
@@ -105,17 +108,11 @@ private:
void transfer_framebuffer_data_to_host(ScanoutID scanout, Protocol::Rect const& rect, ResourceID resource_id);
void flush_displayed_image(Protocol::Rect const& dirty_rect, ResourceID resource_id);
- struct Scanout {
- RefPtr<FrameBufferDevice> framebuffer;
- RefPtr<Console> console;
- Protocol::DisplayInfoResponse::Display display_info {};
- };
Optional<ScanoutID> m_default_scanout;
size_t m_num_scanouts { 0 };
Scanout m_scanouts[VIRTIO_GPU_MAX_SCANOUTS];
Configuration const* m_device_configuration { nullptr };
-
ResourceID m_resource_id_counter { 0 };
// Synchronous commands