mirror of
https://github.com/swaywm/sway.git
synced 2024-11-14 06:24:20 +01:00
Make DRM backend optional
This commit is contained in:
parent
5b64e2fc31
commit
e795ea6a0c
@ -6,10 +6,10 @@
|
|||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <wlr/config.h>
|
||||||
#include <wlr/types/wlr_cursor.h>
|
#include <wlr/types/wlr_cursor.h>
|
||||||
#include <wlr/types/wlr_output_layout.h>
|
#include <wlr/types/wlr_output_layout.h>
|
||||||
#include <wlr/types/wlr_output.h>
|
#include <wlr/types/wlr_output.h>
|
||||||
#include <wlr/backend/drm.h>
|
|
||||||
#include "sway/config.h"
|
#include "sway/config.h"
|
||||||
#include "sway/input/cursor.h"
|
#include "sway/input/cursor.h"
|
||||||
#include "sway/output.h"
|
#include "sway/output.h"
|
||||||
@ -17,6 +17,10 @@
|
|||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
|
#if WLR_HAS_DRM_BACKEND
|
||||||
|
#include <wlr/backend/drm.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
int output_name_cmp(const void *item, const void *data) {
|
int output_name_cmp(const void *item, const void *data) {
|
||||||
const struct output_config *output = item;
|
const struct output_config *output = item;
|
||||||
const char *name = data;
|
const char *name = data;
|
||||||
@ -286,6 +290,7 @@ static void set_mode(struct wlr_output *output, struct wlr_output_state *pending
|
|||||||
|
|
||||||
static void set_modeline(struct wlr_output *output,
|
static void set_modeline(struct wlr_output *output,
|
||||||
struct wlr_output_state *pending, drmModeModeInfo *drm_mode) {
|
struct wlr_output_state *pending, drmModeModeInfo *drm_mode) {
|
||||||
|
#if WLR_HAS_DRM_BACKEND
|
||||||
if (!wlr_output_is_drm(output)) {
|
if (!wlr_output_is_drm(output)) {
|
||||||
sway_log(SWAY_ERROR, "Modeline can only be set to DRM output");
|
sway_log(SWAY_ERROR, "Modeline can only be set to DRM output");
|
||||||
return;
|
return;
|
||||||
@ -295,6 +300,9 @@ static void set_modeline(struct wlr_output *output,
|
|||||||
if (mode) {
|
if (mode) {
|
||||||
wlr_output_state_set_mode(pending, mode);
|
wlr_output_state_set_mode(pending, mode);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
sway_log(SWAY_ERROR, "Modeline can only be set to DRM output");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Some manufacturers hardcode the aspect-ratio of the output in the physical
|
/* Some manufacturers hardcode the aspect-ratio of the output in the physical
|
||||||
@ -436,9 +444,11 @@ static void queue_output_config(struct output_config *oc,
|
|||||||
enum wl_output_transform tr = WL_OUTPUT_TRANSFORM_NORMAL;
|
enum wl_output_transform tr = WL_OUTPUT_TRANSFORM_NORMAL;
|
||||||
if (oc && oc->transform >= 0) {
|
if (oc && oc->transform >= 0) {
|
||||||
tr = oc->transform;
|
tr = oc->transform;
|
||||||
|
#if WLR_HAS_DRM_BACKEND
|
||||||
} else if (wlr_output_is_drm(wlr_output)) {
|
} else if (wlr_output_is_drm(wlr_output)) {
|
||||||
tr = wlr_drm_connector_get_panel_orientation(wlr_output);
|
tr = wlr_drm_connector_get_panel_orientation(wlr_output);
|
||||||
sway_log(SWAY_DEBUG, "Auto-detected output transform: %d", tr);
|
sway_log(SWAY_DEBUG, "Auto-detected output transform: %d", tr);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
if (wlr_output->transform != tr) {
|
if (wlr_output->transform != tr) {
|
||||||
sway_log(SWAY_DEBUG, "Set %s transform to %d", oc->name, tr);
|
sway_log(SWAY_DEBUG, "Set %s transform to %d", oc->name, tr);
|
||||||
|
@ -4,11 +4,10 @@
|
|||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <wayland-server-core.h>
|
#include <wayland-server-core.h>
|
||||||
#include <wlr/backend/drm.h>
|
#include <wlr/config.h>
|
||||||
#include <wlr/backend/headless.h>
|
#include <wlr/backend/headless.h>
|
||||||
#include <wlr/render/wlr_renderer.h>
|
#include <wlr/render/wlr_renderer.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_matrix.h>
|
#include <wlr/types/wlr_matrix.h>
|
||||||
#include <wlr/types/wlr_output_layout.h>
|
#include <wlr/types/wlr_output_layout.h>
|
||||||
#include <wlr/types/wlr_output.h>
|
#include <wlr/types/wlr_output.h>
|
||||||
@ -31,6 +30,11 @@
|
|||||||
#include "sway/tree/view.h"
|
#include "sway/tree/view.h"
|
||||||
#include "sway/tree/workspace.h"
|
#include "sway/tree/workspace.h"
|
||||||
|
|
||||||
|
#if WLR_HAS_DRM_BACKEND
|
||||||
|
#include <wlr/backend/drm.h>
|
||||||
|
#include <wlr/types/wlr_drm_lease_v1.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
struct sway_output *output_by_name_or_id(const char *name_or_id) {
|
struct sway_output *output_by_name_or_id(const char *name_or_id) {
|
||||||
for (int i = 0; i < root->outputs->length; ++i) {
|
for (int i = 0; i < root->outputs->length; ++i) {
|
||||||
struct sway_output *output = root->outputs->items[i];
|
struct sway_output *output = root->outputs->items[i];
|
||||||
@ -923,10 +927,12 @@ void handle_new_output(struct wl_listener *listener, void *data) {
|
|||||||
if (wlr_output->non_desktop) {
|
if (wlr_output->non_desktop) {
|
||||||
sway_log(SWAY_DEBUG, "Not configuring non-desktop output");
|
sway_log(SWAY_DEBUG, "Not configuring non-desktop output");
|
||||||
struct sway_output_non_desktop *non_desktop = output_non_desktop_create(wlr_output);
|
struct sway_output_non_desktop *non_desktop = output_non_desktop_create(wlr_output);
|
||||||
|
#if WLR_HAS_DRM_BACKEND
|
||||||
if (server->drm_lease_manager) {
|
if (server->drm_lease_manager) {
|
||||||
wlr_drm_lease_v1_manager_offer_output(server->drm_lease_manager,
|
wlr_drm_lease_v1_manager_offer_output(server->drm_lease_manager,
|
||||||
wlr_output);
|
wlr_output);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
list_add(root->non_desktop_outputs, non_desktop);
|
list_add(root->non_desktop_outputs, non_desktop);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -7,13 +7,11 @@
|
|||||||
#include <wlr/backend.h>
|
#include <wlr/backend.h>
|
||||||
#include <wlr/backend/headless.h>
|
#include <wlr/backend/headless.h>
|
||||||
#include <wlr/backend/multi.h>
|
#include <wlr/backend/multi.h>
|
||||||
#include <wlr/backend/session.h>
|
|
||||||
#include <wlr/config.h>
|
#include <wlr/config.h>
|
||||||
#include <wlr/render/wlr_renderer.h>
|
#include <wlr/render/wlr_renderer.h>
|
||||||
#include <wlr/types/wlr_compositor.h>
|
#include <wlr/types/wlr_compositor.h>
|
||||||
#include <wlr/types/wlr_content_type_v1.h>
|
#include <wlr/types/wlr_content_type_v1.h>
|
||||||
#include <wlr/types/wlr_data_control_v1.h>
|
#include <wlr/types/wlr_data_control_v1.h>
|
||||||
#include <wlr/types/wlr_drm_lease_v1.h>
|
|
||||||
#include <wlr/types/wlr_drm.h>
|
#include <wlr/types/wlr_drm.h>
|
||||||
#include <wlr/types/wlr_export_dmabuf_v1.h>
|
#include <wlr/types/wlr_export_dmabuf_v1.h>
|
||||||
#include <wlr/types/wlr_gamma_control_v1.h>
|
#include <wlr/types/wlr_gamma_control_v1.h>
|
||||||
@ -46,13 +44,19 @@
|
|||||||
#include "sway/output.h"
|
#include "sway/output.h"
|
||||||
#include "sway/server.h"
|
#include "sway/server.h"
|
||||||
#include "sway/tree/root.h"
|
#include "sway/tree/root.h"
|
||||||
|
|
||||||
#if HAVE_XWAYLAND
|
#if HAVE_XWAYLAND
|
||||||
#include "sway/xwayland.h"
|
#include "sway/xwayland.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if WLR_HAS_DRM_BACKEND
|
||||||
|
#include <wlr/types/wlr_drm_lease_v1.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#define SWAY_XDG_SHELL_VERSION 2
|
#define SWAY_XDG_SHELL_VERSION 2
|
||||||
#define SWAY_LAYER_SHELL_VERSION 3
|
#define SWAY_LAYER_SHELL_VERSION 3
|
||||||
|
|
||||||
|
#if WLR_HAS_DRM_BACKEND
|
||||||
static void handle_drm_lease_request(struct wl_listener *listener, void *data) {
|
static void handle_drm_lease_request(struct wl_listener *listener, void *data) {
|
||||||
/* We only offer non-desktop outputs, but in the future we might want to do
|
/* We only offer non-desktop outputs, but in the future we might want to do
|
||||||
* more logic here. */
|
* more logic here. */
|
||||||
@ -64,6 +68,7 @@ static void handle_drm_lease_request(struct wl_listener *listener, void *data) {
|
|||||||
wlr_drm_lease_request_v1_reject(req);
|
wlr_drm_lease_request_v1_reject(req);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
bool server_init(struct sway_server *server) {
|
bool server_init(struct sway_server *server) {
|
||||||
sway_log(SWAY_DEBUG, "Initializing Wayland server");
|
sway_log(SWAY_DEBUG, "Initializing Wayland server");
|
||||||
@ -189,6 +194,7 @@ bool server_init(struct sway_server *server) {
|
|||||||
|
|
||||||
sway_session_lock_init();
|
sway_session_lock_init();
|
||||||
|
|
||||||
|
#if WLR_HAS_DRM_BACKEND
|
||||||
server->drm_lease_manager=
|
server->drm_lease_manager=
|
||||||
wlr_drm_lease_v1_manager_create(server->wl_display, server->backend);
|
wlr_drm_lease_v1_manager_create(server->wl_display, server->backend);
|
||||||
if (server->drm_lease_manager) {
|
if (server->drm_lease_manager) {
|
||||||
@ -199,6 +205,7 @@ bool server_init(struct sway_server *server) {
|
|||||||
sway_log(SWAY_DEBUG, "Failed to create wlr_drm_lease_device_v1");
|
sway_log(SWAY_DEBUG, "Failed to create wlr_drm_lease_device_v1");
|
||||||
sway_log(SWAY_INFO, "VR will not be available");
|
sway_log(SWAY_INFO, "VR will not be available");
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
wlr_export_dmabuf_manager_v1_create(server->wl_display);
|
wlr_export_dmabuf_manager_v1_create(server->wl_display);
|
||||||
wlr_screencopy_manager_v1_create(server->wl_display);
|
wlr_screencopy_manager_v1_create(server->wl_display);
|
||||||
|
Loading…
Reference in New Issue
Block a user