wayland: improve logging (#17291)

* wayland: improve logging

* wayland: minor cleanup
This commit is contained in:
Aleksey Samoilov 2024-12-27 18:51:13 +04:00 committed by GitHub
parent 26350527f3
commit 4fc6bbe8c2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 54 additions and 37 deletions

View File

@ -705,7 +705,7 @@ bool gfx_ctx_wl_init_common(
if (!wl->idle_inhibit_manager)
{
RARCH_LOG("[Wayland]: Compositor doesn't support zwp_idle_inhibit_manager_v1 protocol\n");
RARCH_LOG("[Wayland]: Compositor doesn't support the %s protocol!\n", zwp_idle_inhibit_manager_v1_interface.name);
#ifdef HAVE_DBUS
dbus_ensure_connection();
#endif
@ -713,18 +713,48 @@ bool gfx_ctx_wl_init_common(
if (!wl->deco_manager)
{
RARCH_LOG("[Wayland]: Compositor doesn't support zxdg_decoration_manager_v1 protocol\n");
RARCH_LOG("[Wayland]: Compositor doesn't support the %s protocol!\n", zxdg_decoration_manager_v1_interface.name);
}
if (!wl->viewporter)
{
RARCH_LOG("[Wayland]: Compositor doesn't support the %s protocol!\n", wp_viewporter_interface.name);
}
if (!wl->fractional_scale_manager)
{
RARCH_LOG("[Wayland]: Compositor doesn't support the %s protocol!\n", wp_fractional_scale_manager_v1_interface.name);
}
if (!wl->cursor_shape_manager)
{
RARCH_LOG("[Wayland]: Compositor doesn't support the %s protocol!\n", wp_cursor_shape_manager_v1_interface.name);
}
if (!wl->content_type_manager)
{
RARCH_LOG("[Wayland]: Compositor doesn't support the %s protocol!\n", wp_content_type_manager_v1_interface.name);
}
if (!wl->pointer_constraints)
{
RARCH_LOG("[Wayland]: Compositor doesn't support the %s protocol!\n", zwp_pointer_constraints_v1_interface.name);
}
if (!wl->relative_pointer_manager)
{
RARCH_LOG("[Wayland]: Compositor doesn't support the %s protocol!\n", zwp_relative_pointer_manager_v1_interface.name);
}
wl->surface = wl_compositor_create_surface(wl->compositor);
if (wl->viewporter)
wl->viewport = wp_viewporter_get_viewport(wl->viewporter, wl->surface);
if (wl->fractional_scale_manager)
{
wl->fractional_scale = wp_fractional_scale_manager_v1_get_fractional_scale(
wl->fractional_scale_manager, wl->surface);
wp_fractional_scale_v1_add_listener(wl->fractional_scale, &wp_fractional_scale_v1_listener, wl);
RARCH_LOG("[Wayland]: fractional_scale_v1 enabled\n");
}
if (wl->content_type_manager)

View File

@ -32,15 +32,6 @@
#include "../../input/input_keymaps.h"
#include "../../verbosity.h"
/* Generated from idle-inhibit-unstable-v1.xml */
#include "../common/wayland/idle-inhibit-unstable-v1.h"
/* Generated from xdg-shell.xml */
#include "../common/wayland/xdg-shell.h"
/* Generated from xdg-decoration-unstable-v1.h */
#include "../common/wayland/xdg-decoration-unstable-v1.h"
#ifdef HAVE_EGL
#include <wayland-egl.h>
#include <poll.h>

View File

@ -32,15 +32,6 @@
#include "../../input/input_keymaps.h"
#include "../../verbosity.h"
/* Generated from idle-inhibit-unstable-v1.xml */
#include "../common/wayland/idle-inhibit-unstable-v1.h"
/* Generated from xdg-shell.xml */
#include "../common/wayland/xdg-shell.h"
/* Generated from xdg-decoration-unstable-v1.h */
#include "../common/wayland/xdg-decoration-unstable-v1.h"
#include "../common/vulkan_common.h"
#include <retro_timers.h>

View File

@ -727,21 +727,22 @@ static bool wl_setup_data_device(gfx_ctx_wayland_data_t *wl)
static void wl_registry_handle_global(void *data, struct wl_registry *reg,
uint32_t id, const char *interface, uint32_t version)
{
int found = 1;
gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data;
RARCH_DBG("[Wayland]: Add global %u, interface %s, version %u\n",
id, interface, version);
if (string_is_equal(interface, wl_compositor_interface.name))
if (string_is_equal(interface, wl_compositor_interface.name) && found++)
wl->compositor = (struct wl_compositor*)wl_registry_bind(reg,
id, &wl_compositor_interface, MIN(version, 4));
else if (string_is_equal(interface, wp_viewporter_interface.name))
else if (string_is_equal(interface, wp_viewporter_interface.name) && found++)
wl->viewporter = (struct wp_viewporter*)wl_registry_bind(reg,
id, &wp_viewporter_interface, MIN(version, 1));
else if (string_is_equal(interface, wp_fractional_scale_manager_v1_interface.name))
else if (string_is_equal(interface, wp_fractional_scale_manager_v1_interface.name) && found++)
wl->fractional_scale_manager = (struct wp_fractional_scale_manager_v1*)
wl_registry_bind(reg, id, &wp_fractional_scale_manager_v1_interface, MIN(version, 1));
else if (string_is_equal(interface, wl_output_interface.name))
else if (string_is_equal(interface, wl_output_interface.name) && found++)
{
display_output_t *od = (display_output_t*)
calloc(1, sizeof(display_output_t));
@ -756,51 +757,55 @@ static void wl_registry_handle_global(void *data, struct wl_registry *reg,
wl_list_insert(&wl->all_outputs, &od->link);
wl_display_roundtrip(wl->input.dpy);
}
else if (string_is_equal(interface, xdg_wm_base_interface.name))
else if (string_is_equal(interface, xdg_wm_base_interface.name) && found++)
wl->xdg_shell = (struct xdg_wm_base*)
wl_registry_bind(reg, id, &xdg_wm_base_interface, MIN(version, 3));
else if (string_is_equal(interface, wl_shm_interface.name))
else if (string_is_equal(interface, wl_shm_interface.name) && found++)
wl->shm = (struct wl_shm*)wl_registry_bind(reg, id, &wl_shm_interface, MIN(version, 1));
else if (string_is_equal(interface, wl_seat_interface.name))
else if (string_is_equal(interface, wl_seat_interface.name) && found++)
{
wl->seat = (struct wl_seat*)wl_registry_bind(reg, id, &wl_seat_interface, MIN(version, 2));
wl_seat_add_listener(wl->seat, &seat_listener, wl);
wl_setup_data_device(wl);
}
else if (string_is_equal(interface, wl_data_device_manager_interface.name))
else if (string_is_equal(interface, wl_data_device_manager_interface.name) && found++)
{
wl->data_device_manager = (struct wl_data_device_manager*)
wl_registry_bind(
reg, id, &wl_data_device_manager_interface, MIN(version, 3));
wl_setup_data_device(wl);
}
else if (string_is_equal(interface, zwp_idle_inhibit_manager_v1_interface.name))
else if (string_is_equal(interface, zwp_idle_inhibit_manager_v1_interface.name) && found++)
wl->idle_inhibit_manager = (struct zwp_idle_inhibit_manager_v1*)
wl_registry_bind(
reg, id, &zwp_idle_inhibit_manager_v1_interface, MIN(version, 1));
else if (string_is_equal(
interface, zxdg_decoration_manager_v1_interface.name))
wl->deco_manager = (struct zxdg_decoration_manager_v1*)wl_registry_bind(
else if (string_is_equal(interface, zxdg_decoration_manager_v1_interface.name) && found++)
wl->deco_manager = (struct zxdg_decoration_manager_v1*)
wl_registry_bind(
reg, id, &zxdg_decoration_manager_v1_interface, MIN(version, 1));
else if (string_is_equal(interface, zwp_pointer_constraints_v1_interface.name))
else if (string_is_equal(interface, zwp_pointer_constraints_v1_interface.name) && found++)
{
wl->pointer_constraints = (struct zwp_pointer_constraints_v1*)
wl_registry_bind(
reg, id, &zwp_pointer_constraints_v1_interface, MIN(version, 1));
wl->locked_pointer = NULL;
}
else if (string_is_equal(interface, zwp_relative_pointer_manager_v1_interface.name))
else if (string_is_equal(interface, zwp_relative_pointer_manager_v1_interface.name) && found++)
wl->relative_pointer_manager = (struct zwp_relative_pointer_manager_v1*)
wl_registry_bind(
reg, id, &zwp_relative_pointer_manager_v1_interface, MIN(version, 1));
else if (string_is_equal(interface, wp_cursor_shape_manager_v1_interface.name))
else if (string_is_equal(interface, wp_cursor_shape_manager_v1_interface.name) && found++)
wl->cursor_shape_manager = (struct wp_cursor_shape_manager_v1*)
wl_registry_bind(
reg, id, &wp_cursor_shape_manager_v1_interface, MIN(version, 1));
else if (string_is_equal(interface, wp_content_type_manager_v1_interface.name))
else if (string_is_equal(interface, wp_content_type_manager_v1_interface.name) && found++)
wl->content_type_manager = (struct wp_content_type_manager_v1*)
wl_registry_bind(
reg, id, &wp_content_type_manager_v1_interface, MIN(version, 1));
if (found > 1)
RARCH_LOG("[Wayland]: Registered interface %s at version %u\n",
interface, version);
}
static void wl_registry_handle_global_remove(void *data,