mirror of
https://github.com/labwc/labwc.git
synced 2026-04-10 08:21:07 -04:00
Make wlroots DRM backend optional
This commit is contained in:
parent
4beee3851f
commit
7f6984d317
4 changed files with 28 additions and 8 deletions
|
|
@ -34,7 +34,6 @@
|
||||||
#include <wlr/types/wlr_xcursor_manager.h>
|
#include <wlr/types/wlr_xcursor_manager.h>
|
||||||
#include <wlr/types/wlr_xdg_activation_v1.h>
|
#include <wlr/types/wlr_xdg_activation_v1.h>
|
||||||
#include <wlr/types/wlr_xdg_shell.h>
|
#include <wlr/types/wlr_xdg_shell.h>
|
||||||
#include <wlr/types/wlr_drm_lease_v1.h>
|
|
||||||
#include <wlr/types/wlr_virtual_pointer_v1.h>
|
#include <wlr/types/wlr_virtual_pointer_v1.h>
|
||||||
#include <wlr/types/wlr_virtual_keyboard_v1.h>
|
#include <wlr/types/wlr_virtual_keyboard_v1.h>
|
||||||
#include <wlr/types/wlr_tearing_control_v1.h>
|
#include <wlr/types/wlr_tearing_control_v1.h>
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,8 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <wlr/backend/drm.h>
|
|
||||||
#include <wlr/backend/multi.h>
|
#include <wlr/backend/multi.h>
|
||||||
|
#include <wlr/config.h>
|
||||||
#include <wlr/util/log.h>
|
#include <wlr/util/log.h>
|
||||||
#include "common/buf.h"
|
#include "common/buf.h"
|
||||||
#include "common/dir.h"
|
#include "common/dir.h"
|
||||||
|
|
@ -21,6 +21,10 @@
|
||||||
#include "config/session.h"
|
#include "config/session.h"
|
||||||
#include "labwc.h"
|
#include "labwc.h"
|
||||||
|
|
||||||
|
#if WLR_HAS_DRM_BACKEND
|
||||||
|
#include <wlr/backend/drm.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
static const char *const env_vars[] = {
|
static const char *const env_vars[] = {
|
||||||
"DISPLAY",
|
"DISPLAY",
|
||||||
"WAYLAND_DISPLAY",
|
"WAYLAND_DISPLAY",
|
||||||
|
|
@ -177,6 +181,7 @@ env_dir_cleanup:
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if WLR_HAS_DRM_BACKEND
|
||||||
static void
|
static void
|
||||||
backend_check_drm(struct wlr_backend *backend, void *is_drm)
|
backend_check_drm(struct wlr_backend *backend, void *is_drm)
|
||||||
{
|
{
|
||||||
|
|
@ -184,6 +189,7 @@ backend_check_drm(struct wlr_backend *backend, void *is_drm)
|
||||||
*(bool *)is_drm = true;
|
*(bool *)is_drm = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
should_update_activation(struct server *server)
|
should_update_activation(struct server *server)
|
||||||
|
|
@ -207,7 +213,9 @@ should_update_activation(struct server *server)
|
||||||
|
|
||||||
/* With no valid preference, update when a DRM backend is in use */
|
/* With no valid preference, update when a DRM backend is in use */
|
||||||
bool have_drm = false;
|
bool have_drm = false;
|
||||||
|
#if WLR_HAS_DRM_BACKEND
|
||||||
wlr_multi_for_each_backend(server->backend, backend_check_drm, &have_drm);
|
wlr_multi_for_each_backend(server->backend, backend_check_drm, &have_drm);
|
||||||
|
#endif
|
||||||
return have_drm;
|
return have_drm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
11
src/output.c
11
src/output.c
|
|
@ -9,10 +9,10 @@
|
||||||
#define _POSIX_C_SOURCE 200809L
|
#define _POSIX_C_SOURCE 200809L
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
#include <wlr/backend/drm.h>
|
#include <wlr/backend/session.h>
|
||||||
#include <wlr/backend/wayland.h>
|
#include <wlr/backend/wayland.h>
|
||||||
|
#include <wlr/config.h>
|
||||||
#include <wlr/types/wlr_buffer.h>
|
#include <wlr/types/wlr_buffer.h>
|
||||||
#include <wlr/types/wlr_drm_lease_v1.h>
|
|
||||||
#include <wlr/types/wlr_output.h>
|
#include <wlr/types/wlr_output.h>
|
||||||
#include <wlr/types/wlr_xdg_output_v1.h>
|
#include <wlr/types/wlr_xdg_output_v1.h>
|
||||||
#include <wlr/types/wlr_scene.h>
|
#include <wlr/types/wlr_scene.h>
|
||||||
|
|
@ -33,6 +33,11 @@
|
||||||
#include "view.h"
|
#include "view.h"
|
||||||
#include "xwayland.h"
|
#include "xwayland.h"
|
||||||
|
|
||||||
|
#if WLR_HAS_DRM_BACKEND
|
||||||
|
#include <wlr/backend/drm.h>
|
||||||
|
#include <wlr/types/wlr_drm_lease_v1.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
bool
|
bool
|
||||||
output_get_tearing_allowance(struct output *output)
|
output_get_tearing_allowance(struct output *output)
|
||||||
{
|
{
|
||||||
|
|
@ -453,7 +458,7 @@ handle_new_output(struct wl_listener *listener, void *data)
|
||||||
*
|
*
|
||||||
* TODO: remove once labwc starts tracking 0.20.x and the fix has been merged.
|
* TODO: remove once labwc starts tracking 0.20.x and the fix has been merged.
|
||||||
*/
|
*/
|
||||||
#if LAB_WLR_VERSION_AT_LEAST(0, 19, 1)
|
#if WLR_HAS_DRM_BACKEND && LAB_WLR_VERSION_AT_LEAST(0, 19, 1)
|
||||||
if (server->drm_lease_manager && wlr_output_is_drm(wlr_output)) {
|
if (server->drm_lease_manager && wlr_output_is_drm(wlr_output)) {
|
||||||
wlr_drm_lease_v1_manager_offer_output(
|
wlr_drm_lease_v1_manager_offer_output(
|
||||||
server->drm_lease_manager, wlr_output);
|
server->drm_lease_manager, wlr_output);
|
||||||
|
|
|
||||||
10
src/server.c
10
src/server.c
|
|
@ -6,6 +6,7 @@
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <wlr/backend/headless.h>
|
#include <wlr/backend/headless.h>
|
||||||
#include <wlr/backend/multi.h>
|
#include <wlr/backend/multi.h>
|
||||||
|
#include <wlr/config.h>
|
||||||
#include <wlr/types/wlr_alpha_modifier_v1.h>
|
#include <wlr/types/wlr_alpha_modifier_v1.h>
|
||||||
#include <wlr/types/wlr_data_control_v1.h>
|
#include <wlr/types/wlr_data_control_v1.h>
|
||||||
#include <wlr/types/wlr_ext_data_control_v1.h>
|
#include <wlr/types/wlr_ext_data_control_v1.h>
|
||||||
|
|
@ -34,7 +35,10 @@
|
||||||
#include "xwayland-shell-v1-protocol.h"
|
#include "xwayland-shell-v1-protocol.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "drm-lease-v1-protocol.h"
|
#if WLR_HAS_DRM_BACKEND
|
||||||
|
#include <wlr/types/wlr_drm_lease_v1.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "common/macros.h"
|
#include "common/macros.h"
|
||||||
#include "common/scaled-scene-buffer.h"
|
#include "common/scaled-scene-buffer.h"
|
||||||
#include "config/rcxml.h"
|
#include "config/rcxml.h"
|
||||||
|
|
@ -173,6 +177,7 @@ handle_sigchld(int signal, void *data)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if WLR_HAS_DRM_BACKEND
|
||||||
static void
|
static void
|
||||||
handle_drm_lease_request(struct wl_listener *listener, void *data)
|
handle_drm_lease_request(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
|
|
@ -184,6 +189,7 @@ handle_drm_lease_request(struct wl_listener *listener, void *data)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
protocol_is_privileged(const struct wl_interface *iface)
|
protocol_is_privileged(const struct wl_interface *iface)
|
||||||
|
|
@ -666,6 +672,7 @@ server_init(struct server *server)
|
||||||
|
|
||||||
session_lock_init(server);
|
session_lock_init(server);
|
||||||
|
|
||||||
|
#if WLR_HAS_DRM_BACKEND
|
||||||
server->drm_lease_manager = wlr_drm_lease_v1_manager_create(
|
server->drm_lease_manager = wlr_drm_lease_v1_manager_create(
|
||||||
server->wl_display, server->backend);
|
server->wl_display, server->backend);
|
||||||
if (server->drm_lease_manager) {
|
if (server->drm_lease_manager) {
|
||||||
|
|
@ -676,6 +683,7 @@ server_init(struct server *server)
|
||||||
wlr_log(WLR_DEBUG, "Failed to create wlr_drm_lease_device_v1");
|
wlr_log(WLR_DEBUG, "Failed to create wlr_drm_lease_device_v1");
|
||||||
wlr_log(WLR_INFO, "VR will not be available");
|
wlr_log(WLR_INFO, "VR will not be available");
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
server->output_power_manager_v1 =
|
server->output_power_manager_v1 =
|
||||||
wlr_output_power_manager_v1_create(server->wl_display);
|
wlr_output_power_manager_v1_create(server->wl_display);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue