mirror of
https://github.com/labwc/labwc.git
synced 2026-04-03 07:15:34 -04:00
make wlroots DRM backend optional
This commit is contained in:
parent
fe1955fb27
commit
046d055ac0
3 changed files with 27 additions and 13 deletions
|
|
@ -8,8 +8,8 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
#include <wlr/backend/drm.h>
|
||||
#include <wlr/backend/multi.h>
|
||||
#include <wlr/config.h>
|
||||
#include <wlr/util/log.h>
|
||||
#include "common/buf.h"
|
||||
#include "common/dir.h"
|
||||
|
|
@ -20,6 +20,12 @@
|
|||
#include "config/rcxml.h"
|
||||
#include "labwc.h"
|
||||
|
||||
#if WLR_HAS_DRM_BACKEND
|
||||
#include <wlr/backend/drm.h>
|
||||
#else
|
||||
#define wlr_backend_is_drm(backend) (false)
|
||||
#endif
|
||||
|
||||
static const char *const env_vars[] = {
|
||||
"WAYLAND_DISPLAY",
|
||||
"XDG_CURRENT_DESKTOP",
|
||||
|
|
|
|||
20
src/output.c
20
src/output.c
|
|
@ -10,11 +10,10 @@
|
|||
#include "output.h"
|
||||
#include <assert.h>
|
||||
#include <strings.h>
|
||||
#include <wlr/backend/drm.h>
|
||||
#include <wlr/backend/session.h>
|
||||
#include <wlr/backend/wayland.h>
|
||||
#include <wlr/config.h>
|
||||
#include <wlr/types/wlr_cursor.h>
|
||||
#include <wlr/types/wlr_drm_lease_v1.h>
|
||||
#include <wlr/types/wlr_ext_workspace_v1.h>
|
||||
#include <wlr/types/wlr_gamma_control_v1.h>
|
||||
#include <wlr/types/wlr_output.h>
|
||||
|
|
@ -39,7 +38,14 @@
|
|||
#include "xwayland.h"
|
||||
|
||||
#if WLR_HAS_X11_BACKEND
|
||||
#include <wlr/backend/x11.h>
|
||||
#include <wlr/backend/x11.h>
|
||||
#endif
|
||||
|
||||
#if WLR_HAS_DRM_BACKEND
|
||||
#include <wlr/backend/drm.h>
|
||||
#include <wlr/types/wlr_drm_lease_v1.h>
|
||||
#else
|
||||
#define wlr_output_is_drm(output) (false)
|
||||
#endif
|
||||
|
||||
bool
|
||||
|
|
@ -452,14 +458,8 @@ handle_new_output(struct wl_listener *listener, void *data)
|
|||
* This is also useful for debugging the DRM parts of
|
||||
* another compositor.
|
||||
*
|
||||
* All drm leasing is disabled due to a UAF bug in wlroots.
|
||||
* We assume that the fix will be backported to 0.19.1 and thus
|
||||
* check for a version >= 0.19.1. See following link for the fix status:
|
||||
* https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/5104
|
||||
*
|
||||
* 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
|
||||
if (server.drm_lease_manager && wlr_output_is_drm(wlr_output)) {
|
||||
wlr_drm_lease_v1_manager_offer_output(
|
||||
server.drm_lease_manager, wlr_output);
|
||||
|
|
|
|||
12
src/server.c
12
src/server.c
|
|
@ -6,12 +6,12 @@
|
|||
#include <sys/wait.h>
|
||||
#include <wlr/backend/headless.h>
|
||||
#include <wlr/backend/multi.h>
|
||||
#include <wlr/config.h>
|
||||
#include <wlr/render/allocator.h>
|
||||
#include <wlr/types/wlr_alpha_modifier_v1.h>
|
||||
#include <wlr/types/wlr_data_control_v1.h>
|
||||
#include <wlr/types/wlr_data_device.h>
|
||||
#include <wlr/types/wlr_drm.h>
|
||||
#include <wlr/types/wlr_drm_lease_v1.h>
|
||||
#include <wlr/types/wlr_export_dmabuf_v1.h>
|
||||
#include <wlr/types/wlr_ext_data_control_v1.h>
|
||||
#include <wlr/types/wlr_ext_foreign_toplevel_list_v1.h>
|
||||
|
|
@ -41,7 +41,11 @@
|
|||
#include <wlr/types/wlr_xdg_foreign_v2.h>
|
||||
|
||||
#if HAVE_XWAYLAND
|
||||
#include <wlr/xwayland.h>
|
||||
#include <wlr/xwayland.h>
|
||||
#endif
|
||||
|
||||
#if WLR_HAS_DRM_BACKEND
|
||||
#include <wlr/types/wlr_drm_lease_v1.h>
|
||||
#endif
|
||||
|
||||
#include "action.h"
|
||||
|
|
@ -192,6 +196,7 @@ handle_sigchld(int signal, void *data)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#if WLR_HAS_DRM_BACKEND
|
||||
static void
|
||||
handle_drm_lease_request(struct wl_listener *listener, void *data)
|
||||
{
|
||||
|
|
@ -203,6 +208,7 @@ handle_drm_lease_request(struct wl_listener *listener, void *data)
|
|||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static bool
|
||||
protocol_is_privileged(const struct wl_interface *iface)
|
||||
|
|
@ -692,6 +698,7 @@ server_init(void)
|
|||
|
||||
session_lock_init();
|
||||
|
||||
#if WLR_HAS_DRM_BACKEND
|
||||
server.drm_lease_manager = wlr_drm_lease_v1_manager_create(
|
||||
server.wl_display, server.backend);
|
||||
if (server.drm_lease_manager) {
|
||||
|
|
@ -702,6 +709,7 @@ server_init(void)
|
|||
wlr_log(WLR_DEBUG, "Failed to create wlr_drm_lease_device_v1");
|
||||
wlr_log(WLR_INFO, "VR will not be available");
|
||||
}
|
||||
#endif
|
||||
|
||||
server.output_power_manager_v1 =
|
||||
wlr_output_power_manager_v1_create(server.wl_display);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue