Skip to content
This repository was archived by the owner on Jan 30, 2025. It is now read-only.

Commit

Permalink
vm_tools: sommelier: add helpful debug messages
Browse files Browse the repository at this point in the history
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 <[email protected]>
Commit-Queue: Max Lee <[email protected]>
Tested-by: Max Lee <[email protected]>
  • Loading branch information
Max Lee authored and Chromeos LUCI committed Apr 23, 2024
1 parent bca26c5 commit 599aeac
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 1 deletion.
7 changes: 6 additions & 1 deletion sommelier-viewporter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 <assert.h>
#include <stdlib.h>

#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)

Expand Down Expand Up @@ -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,
Expand All @@ -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 = {
Expand Down
27 changes: 27 additions & 0 deletions sommelier-window.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <wayland-client-protocol.h>

#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)
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand All @@ -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
Expand All @@ -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;
Expand All @@ -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;
}
}

Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down
11 changes: 11 additions & 0 deletions sommelier.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down Expand Up @@ -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) {
Expand All @@ -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;
Expand Down Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down Expand Up @@ -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) {
Expand All @@ -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;
}
}

Expand Down

0 comments on commit 599aeac

Please sign in to comment.