1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 07:37:35 +00:00

Kernel/VirtIO: Remove the m_class_name member

This class member was used only to determine the device type when
printing messages to the debug log. Instead, remove this class member,
and add a quick way to find the device type according to how the VirtIO
specification says to do that.

This simplifies construction of VirtIODevices a bit, because now the
constructor doesn't need to ask for a String identified with the device
type.
This commit is contained in:
Liav A 2021-08-27 11:41:27 +03:00 committed by Andreas Kling
parent 5a0aa66b73
commit 9a03c00f45
8 changed files with 56 additions and 35 deletions

View file

@ -16,7 +16,7 @@
namespace Kernel::Graphics::VirtIOGPU {
GPU::GPU(PCI::Address address)
: VirtIODevice(address, "GPU")
: VirtIODevice(address)
, m_scratch_space(MM.allocate_contiguous_kernel_region(32 * PAGE_SIZE, "VirtGPU Scratch Space", Memory::Region::Access::ReadWrite))
{
VERIFY(!!m_scratch_space);
@ -65,7 +65,7 @@ bool GPU::handle_device_config_change()
auto events = get_pending_events();
if (events & VIRTIO_GPU_EVENT_DISPLAY) {
// The host window was resized, in SerenityOS we completely ignore this event
dbgln_if(VIRTIO_DEBUG, "{}: Ignoring virtio gpu display resize event", m_class_name);
dbgln_if(VIRTIO_DEBUG, "VirtIOGPU: Ignoring virtio gpu display resize event");
clear_pending_events(VIRTIO_GPU_EVENT_DISPLAY);
}
if (events & ~VIRTIO_GPU_EVENT_DISPLAY) {

View file

@ -77,6 +77,8 @@ public:
void flush_dirty_rectangle(ScanoutID, Protocol::Rect const& dirty_rect, ResourceID);
private:
virtual StringView class_name() const override { return "VirtIOGPU"; }
struct Scanout {
RefPtr<FrameBufferDevice> framebuffer;
RefPtr<Console> console;