Skip to content

Commit

Permalink
Kernel: Improve debug prints for VirtIOGPU device config events
Browse files Browse the repository at this point in the history
  • Loading branch information
ccapitalK authored and alimpfard committed Jul 18, 2021
1 parent 4dddc56 commit 04226f0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
14 changes: 12 additions & 2 deletions Kernel/Graphics/VirtIOGPU/GPU.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,17 @@ void GPU::create_framebuffer_devices()

bool GPU::handle_device_config_change()
{
return false;
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);
clear_pending_events(VIRTIO_GPU_EVENT_DISPLAY);
}
if (events & ~VIRTIO_GPU_EVENT_DISPLAY) {
dbgln("GPU: Got unknown device config change event: 0x{:x}", events);
return false;
}
return true;
}

void GPU::handle_queue_update(u16 queue_index)
Expand Down Expand Up @@ -98,7 +108,7 @@ void GPU::query_display_information()
for (size_t i = 0; i < VIRTIO_GPU_MAX_SCANOUTS; ++i) {
auto& scanout = m_scanouts[i].display_info;
scanout = response.scanout_modes[i];
dbgln_if(VIRTIO_DEBUG, "Scanout {}: enabled: {} x: {}, y: {}, width: {}, height: {}", i, !!scanout.enabled, scanout.rect.x, scanout.rect.y, scanout.rect.width, scanout.rect.height);
dbgln_if(VIRTIO_DEBUG, "GPU: Scanout {}: enabled: {} x: {}, y: {}, width: {}, height: {}", i, !!scanout.enabled, scanout.rect.x, scanout.rect.y, scanout.rect.width, scanout.rect.height);
if (scanout.enabled && !m_default_scanout.has_value())
m_default_scanout = i;
}
Expand Down
2 changes: 2 additions & 0 deletions Kernel/Graphics/VirtIOGPU/GPU.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
#define MAX_VIRTIOGPU_RESOLUTION_WIDTH 3840
#define MAX_VIRTIOGPU_RESOLUTION_HEIGHT 2160

#define VIRTIO_GPU_EVENT_DISPLAY (1 << 0)

namespace Kernel::Graphics::VirtIOGPU {

class Console;
Expand Down

0 comments on commit 04226f0

Please sign in to comment.