Kernel: Improve debug prints for VirtIOGPU device config events

This commit is contained in:
Sahan Fernando 2021-07-08 00:15:32 +10:00 committed by Ali Mohammad Pur
parent 4dddc56ad9
commit 04226f0c0a
Notes: sideshowbarker 2024-07-18 08:49:21 +09:00
2 changed files with 14 additions and 2 deletions

View File

@ -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)
@ -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;
}

View File

@ -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;