From 599aeacdc1f2f7df978048eeb94927ed794e1d50 Mon Sep 17 00:00:00 2001 From: Max Lee Date: Fri, 19 Apr 2024 15:18:49 +1000 Subject: [PATCH] vm_tools: sommelier: add helpful debug messages BUG=b:328699937,b:331688838 TEST=N/A Change-Id: I4a6456e5083d275a09a38afb45db37b10e242e7e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform2/+/5467271 Reviewed-by: Chloe Pelling Commit-Queue: Max Lee Tested-by: Max Lee --- sommelier-viewporter.cc | 7 ++++++- sommelier-window.cc | 27 +++++++++++++++++++++++++++ sommelier.cc | 11 +++++++++++ 3 files changed, 44 insertions(+), 1 deletion(-) diff --git a/sommelier-viewporter.cc b/sommelier-viewporter.cc index dc063c5..c5fd9d0 100644 --- a/sommelier-viewporter.cc +++ b/sommelier-viewporter.cc @@ -2,12 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "sommelier.h" // NOLINT(build/include_directory) +#include "sommelier.h" // NOLINT(build/include_directory) #include "sommelier-tracing.h" // NOLINT(build/include_directory) #include #include +#include "sommelier-logging.h" // NOLINT(build/include_directory) #include "viewporter-client-protocol.h" // NOLINT(build/include_directory) #include "viewporter-server-protocol.h" // NOLINT(build/include_directory) @@ -40,6 +41,9 @@ static void sl_viewport_set_source(struct wl_client* client, host->viewport.src_y = y; host->viewport.src_width = width; host->viewport.src_height = height; + LOG(VERBOSE) << "viewport src set " << wl_fixed_to_int(width) << "x" + << wl_fixed_to_int(height) << " (" << wl_fixed_to_int(x) << "," + << wl_fixed_to_int(y) << ")"; } static void sl_viewport_set_destination(struct wl_client* client, @@ -53,6 +57,7 @@ static void sl_viewport_set_destination(struct wl_client* client, host->viewport.dst_width = width; host->viewport.dst_height = height; + LOG(VERBOSE) << "viewport dst set " << width << "x" << height; } static const struct wp_viewport_interface sl_viewport_implementation = { diff --git a/sommelier-window.cc b/sommelier-window.cc index 6522dd1..d32b255 100644 --- a/sommelier-window.cc +++ b/sommelier-window.cc @@ -12,6 +12,7 @@ #include #include "sommelier.h" // NOLINT(build/include_directory) +#include "sommelier-logging.h" // NOLINT(build/include_directory) #include "sommelier-tracing.h" // NOLINT(build/include_directory) #include "sommelier-transform.h" // NOLINT(build/include_directory) #include "viewporter-shim.h" // NOLINT(build/include_directory) @@ -313,6 +314,10 @@ bool sl_window_is_containerized(struct sl_window* window) { // half-perimeter) than specified value. ((window->max_width + window->max_height == 0) || (window->max_width + window->max_height >= 400)); + if (window_containerized && !probably_game_window) { + LOG(VERBOSE) << window + << " is not a game window! max_width=" << window->max_width; + } window_containerized = probably_game_window && window->ctx->quirks.IsEnabled( window, quirks::FEATURE_CONTAINERIZE_WINDOWS); @@ -432,6 +437,8 @@ void sl_internal_toplevel_configure_size_containerized(struct sl_window* window, window->next_config.values[mut_config_idx++] = width_in_pixels; window->next_config.values[mut_config_idx++] = height_in_pixels; window->next_config.values[mut_config_idx++] = 0; + LOG(VERBOSE) << window << " size set to " << width_in_pixels << "x" + << height_in_pixels; return; } @@ -469,6 +476,8 @@ void sl_internal_toplevel_configure_size_containerized(struct sl_window* window, window->next_config.values[mut_config_idx++] = safe_window_width; window->next_config.values[mut_config_idx++] = safe_window_height; window->next_config.values[mut_config_idx++] = 0; + LOG(VERBOSE) << window << " size(safe) set to " << safe_window_width << "x" + << safe_window_height; if (window->use_emulated_rects && window->compositor_fullscreen) { // If we are using emulated rects and the window is fullscreen in @@ -537,6 +546,8 @@ void sl_internal_toplevel_configure_size_containerized(struct sl_window* window, safe_window_width; window->viewport_width = host_width; } + LOG(VERBOSE) << window << " viewport set to " << window->viewport_width << "x" + << window->viewport_height; if (window->use_emulated_rects) { // Pointer scaling is being done in XWayland as well, assuming the viewport @@ -629,14 +640,20 @@ void sl_internal_toplevel_configure_size(struct sl_window* window, XCB_CONFIG_WINDOW_HEIGHT | XCB_CONFIG_WINDOW_BORDER_WIDTH; if (window->viewport_override) { + LOG(VERBOSE) << window << " viewport override, size set to " + << window->width << "x" << window->height; window->next_config.values[mut_config_idx++] = window->width; window->next_config.values[mut_config_idx++] = window->height; window->next_config.values[mut_config_idx++] = 0; } else if (window->use_emulated_rects) { + LOG(VERBOSE) << window << " emulated, size set to " + << window->emulated_width << "x" << window->emulated_height; window->next_config.values[mut_config_idx++] = window->emulated_width; window->next_config.values[mut_config_idx++] = window->emulated_height; window->next_config.values[mut_config_idx++] = 0; } else { + LOG(VERBOSE) << window << " size set to " << width_in_pixels << "x" + << height_in_pixels; window->next_config.values[mut_config_idx++] = width_in_pixels; window->next_config.values[mut_config_idx++] = height_in_pixels; window->next_config.values[mut_config_idx++] = 0; @@ -655,6 +672,8 @@ void sl_internal_toplevel_configure_position(struct sl_window* window, window->next_config.mask |= XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y; window->next_config.values[mut_config_idx++] = window->emulated_x; window->next_config.values[mut_config_idx++] = window->emulated_y; + LOG(VERBOSE) << window << " position set to emulated " << window->emulated_x + << "," << window->emulated_y; } else if (x != kUnspecifiedCoord && y != kUnspecifiedCoord) { // Convert to virtual coordinates @@ -667,6 +686,8 @@ void sl_internal_toplevel_configure_position(struct sl_window* window, window->next_config.mask |= XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y; window->next_config.values[mut_config_idx++] = guest_x; window->next_config.values[mut_config_idx++] = guest_y; + LOG(VERBOSE) << window << " position set to specified " << guest_x << "," + << guest_y; } else if (!(window->size_flags & (US_POSITION | P_POSITION))) { uint32_t new_x = 0; @@ -686,6 +707,7 @@ void sl_internal_toplevel_configure_position(struct sl_window* window, window->next_config.mask |= XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y; window->next_config.values[mut_config_idx++] = new_x; window->next_config.values[mut_config_idx++] = new_y; + LOG(VERBOSE) << window << " position set to new " << new_x << "," << new_y; } } @@ -758,6 +780,8 @@ void sl_internal_toplevel_configure_state(struct sl_window* window, sl_internal_toplevel_configure_set_activated(window, activated); + LOG(VERBOSE) << window << " state change, fullscreen=" << window->fullscreen + << " compositor_fullscreen=" << window->compositor_fullscreen; // Override previous state definitions window->next_config.states_length = state_idx; } @@ -826,6 +850,9 @@ void sl_internal_toplevel_configure_state_containerized( zaura_surface_set_frame(window->aura_surface, ZAURA_SURFACE_FRAME_TYPE_NORMAL); } + + LOG(VERBOSE) << window << " state change, fullscreen=" << window->fullscreen + << " compositor_fullscreen=" << window->compositor_fullscreen; // Override previous state definitions window->next_config.states_length = state_idx; } diff --git a/sommelier.cc b/sommelier.cc index 1671f4e..9d9f1bd 100644 --- a/sommelier.cc +++ b/sommelier.cc @@ -1349,6 +1349,7 @@ void sl_handle_map_request(struct sl_context* ctx, // behaviour is consistent with sl_handle_client_message(). window->maximized = maximize_h && maximize_v; window->fullscreen = fullscreen; + LOG(VERBOSE) << window << " fullscreen=" << fullscreen; if (window->maximized) { if (window->fullscreen) { value = @@ -1458,6 +1459,8 @@ void sl_handle_map_request(struct sl_context* ctx, if (window->size_flags & P_MIN_SIZE) { window->min_width = size_hints.min_width; window->min_height = size_hints.min_height; + LOG(VERBOSE) << window << " min=" << window->min_width << "x" + << window->min_height; } if (window->size_flags & P_MAX_SIZE) { if (size_hints.max_width < INT_MAX) { @@ -1470,6 +1473,8 @@ void sl_handle_map_request(struct sl_context* ctx, } else { window->max_height = 0; } + LOG(VERBOSE) << window << " max=" << window->max_width << "x" + << window->max_height; } window->border_width = 0; @@ -1858,6 +1863,7 @@ void sl_handle_client_message(struct sl_context* ctx, window->name); if (action == NET_WM_STATE_ADD) { window->fullscreen = 1; + LOG(VERBOSE) << window << " fullscreen=1"; if (window->xdg_toplevel && !window->iconified) { xdg_toplevel_set_fullscreen(window->xdg_toplevel, nullptr); } else { @@ -1869,6 +1875,7 @@ void sl_handle_client_message(struct sl_context* ctx, window->maybe_promote_to_fullscreen = true; window->fullscreen = 0; + LOG(VERBOSE) << window << " fullscreen=0"; if (window->xdg_toplevel && !window->iconified) { xdg_toplevel_unset_fullscreen(window->xdg_toplevel); } else { @@ -2320,6 +2327,8 @@ void sl_handle_property_notify(struct sl_context* ctx, if (window->size_flags & P_MIN_SIZE) { window->min_width = size_hints.min_width; window->min_height = size_hints.min_height; + LOG(VERBOSE) << window << " min=" << window->min_width << "x" + << window->min_height; } if (window->size_flags & P_MAX_SIZE) { if (size_hints.max_width < INT_MAX) { @@ -2332,6 +2341,8 @@ void sl_handle_property_notify(struct sl_context* ctx, } else { window->max_height = 0; } + LOG(VERBOSE) << window << " max=" << window->max_width << "x" + << window->max_height; } }