diff options
author | Simon Ser <contact@emersion.fr> | 2022-11-26 20:13:31 +0100 |
---|---|---|
committer | Simon Zeni <simon@bl4ckb0ne.ca> | 2022-11-28 13:28:15 -0500 |
commit | 5b64e2fc31ede4777343e06087d7b921b28be674 (patch) | |
tree | ba41e4c743f21799bbbccaf9a4dffabe86ff2828 | |
parent | Translate README to Czech (diff) | |
download | sway-5b64e2fc31ede4777343e06087d7b921b28be674.tar.gz sway-5b64e2fc31ede4777343e06087d7b921b28be674.tar.zst sway-5b64e2fc31ede4777343e06087d7b921b28be674.zip |
Make GLES2 optional
-rw-r--r-- | meson.build | 33 | ||||
-rw-r--r-- | sway/desktop/render.c | 9 |
2 files changed, 26 insertions, 16 deletions
diff --git a/meson.build b/meson.build index 7e26ae2a..5468064f 100644 --- a/meson.build +++ b/meson.build | |||
@@ -43,6 +43,24 @@ subproject( | |||
43 | required: false, | 43 | required: false, |
44 | version: wlroots_version, | 44 | version: wlroots_version, |
45 | ) | 45 | ) |
46 | wlroots = dependency('wlroots', version: wlroots_version) | ||
47 | wlroots_features = { | ||
48 | 'xwayland': false, | ||
49 | 'libinput_backend': false, | ||
50 | 'gles2_renderer': false, | ||
51 | 'session': false, | ||
52 | } | ||
53 | foreach name, _ : wlroots_features | ||
54 | var_name = 'have_' + name.underscorify() | ||
55 | have = wlroots.get_variable(pkgconfig: var_name, internal: var_name) == 'true' | ||
56 | wlroots_features += { name: have } | ||
57 | endforeach | ||
58 | |||
59 | if get_option('xwayland').enabled() and not wlroots_features['xwayland'] | ||
60 | error('Cannot enable Xwayland in sway: wlroots has been built without Xwayland support') | ||
61 | endif | ||
62 | |||
63 | null_dep = dependency('', required: false) | ||
46 | 64 | ||
47 | jsonc = dependency('json-c', version: '>=0.13') | 65 | jsonc = dependency('json-c', version: '>=0.13') |
48 | pcre2 = dependency('libpcre2-8') | 66 | pcre2 = dependency('libpcre2-8') |
@@ -50,14 +68,13 @@ wayland_server = dependency('wayland-server', version: '>=1.21.0') | |||
50 | wayland_client = dependency('wayland-client') | 68 | wayland_client = dependency('wayland-client') |
51 | wayland_cursor = dependency('wayland-cursor') | 69 | wayland_cursor = dependency('wayland-cursor') |
52 | wayland_protos = dependency('wayland-protocols', version: '>=1.24') | 70 | wayland_protos = dependency('wayland-protocols', version: '>=1.24') |
53 | wlroots = dependency('wlroots', version: wlroots_version) | ||
54 | xkbcommon = dependency('xkbcommon') | 71 | xkbcommon = dependency('xkbcommon') |
55 | cairo = dependency('cairo') | 72 | cairo = dependency('cairo') |
56 | pango = dependency('pango') | 73 | pango = dependency('pango') |
57 | pangocairo = dependency('pangocairo') | 74 | pangocairo = dependency('pangocairo') |
58 | gdk_pixbuf = dependency('gdk-pixbuf-2.0', required: get_option('gdk-pixbuf')) | 75 | gdk_pixbuf = dependency('gdk-pixbuf-2.0', required: get_option('gdk-pixbuf')) |
59 | pixman = dependency('pixman-1') | 76 | pixman = dependency('pixman-1') |
60 | glesv2 = dependency('glesv2') | 77 | glesv2 = wlroots_features['gles2_renderer'] ? dependency('glesv2') : null_dep |
61 | libevdev = dependency('libevdev') | 78 | libevdev = dependency('libevdev') |
62 | libinput = dependency('libinput', version: '>=1.21.0') | 79 | libinput = dependency('libinput', version: '>=1.21.0') |
63 | xcb = dependency('xcb', required: get_option('xwayland')) | 80 | xcb = dependency('xcb', required: get_option('xwayland')) |
@@ -71,18 +88,6 @@ rt = cc.find_library('rt') | |||
71 | xcb_icccm = dependency('xcb-icccm', required: get_option('xwayland')) | 88 | xcb_icccm = dependency('xcb-icccm', required: get_option('xwayland')) |
72 | threads = dependency('threads') # for pthread_setschedparam | 89 | threads = dependency('threads') # for pthread_setschedparam |
73 | 90 | ||
74 | wlroots_features = { | ||
75 | 'xwayland': false, | ||
76 | } | ||
77 | foreach name, _ : wlroots_features | ||
78 | var_name = 'have_' + name.underscorify() | ||
79 | have = wlroots.get_variable(pkgconfig: var_name, internal: var_name) == 'true' | ||
80 | wlroots_features += { name: have } | ||
81 | endforeach | ||
82 | |||
83 | if get_option('xwayland').enabled() and not wlroots_features['xwayland'] | ||
84 | error('Cannot enable Xwayland in sway: wlroots has been built without Xwayland support') | ||
85 | endif | ||
86 | have_xwayland = xcb.found() and wlroots_features['xwayland'] | 91 | have_xwayland = xcb.found() and wlroots_features['xwayland'] |
87 | 92 | ||
88 | if get_option('sd-bus-provider') == 'auto' | 93 | if get_option('sd-bus-provider') == 'auto' |
diff --git a/sway/desktop/render.c b/sway/desktop/render.c index efa3a0d9..ea9c37d9 100644 --- a/sway/desktop/render.c +++ b/sway/desktop/render.c | |||
@@ -1,11 +1,10 @@ | |||
1 | #define _POSIX_C_SOURCE 200809L | 1 | #define _POSIX_C_SOURCE 200809L |
2 | #include <assert.h> | 2 | #include <assert.h> |
3 | #include <GLES2/gl2.h> | ||
4 | #include <stdlib.h> | 3 | #include <stdlib.h> |
5 | #include <strings.h> | 4 | #include <strings.h> |
6 | #include <time.h> | 5 | #include <time.h> |
7 | #include <wayland-server-core.h> | 6 | #include <wayland-server-core.h> |
8 | #include <wlr/render/gles2.h> | 7 | #include <wlr/config.h> |
9 | #include <wlr/render/wlr_renderer.h> | 8 | #include <wlr/render/wlr_renderer.h> |
10 | #include <wlr/types/wlr_buffer.h> | 9 | #include <wlr/types/wlr_buffer.h> |
11 | #include <wlr/types/wlr_damage_ring.h> | 10 | #include <wlr/types/wlr_damage_ring.h> |
@@ -28,6 +27,10 @@ | |||
28 | #include "sway/tree/view.h" | 27 | #include "sway/tree/view.h" |
29 | #include "sway/tree/workspace.h" | 28 | #include "sway/tree/workspace.h" |
30 | 29 | ||
30 | #if WLR_HAS_GLES2_RENDERER | ||
31 | #include <wlr/render/gles2.h> | ||
32 | #endif | ||
33 | |||
31 | struct render_data { | 34 | struct render_data { |
32 | pixman_region32_t *damage; | 35 | pixman_region32_t *damage; |
33 | float alpha; | 36 | float alpha; |
@@ -74,6 +77,7 @@ static void scissor_output(struct wlr_output *wlr_output, | |||
74 | 77 | ||
75 | static void set_scale_filter(struct wlr_output *wlr_output, | 78 | static void set_scale_filter(struct wlr_output *wlr_output, |
76 | struct wlr_texture *texture, enum scale_filter_mode scale_filter) { | 79 | struct wlr_texture *texture, enum scale_filter_mode scale_filter) { |
80 | #if WLR_HAS_GLES2_RENDERER | ||
77 | if (!wlr_texture_is_gles2(texture)) { | 81 | if (!wlr_texture_is_gles2(texture)) { |
78 | return; | 82 | return; |
79 | } | 83 | } |
@@ -94,6 +98,7 @@ static void set_scale_filter(struct wlr_output *wlr_output, | |||
94 | case SCALE_FILTER_SMART: | 98 | case SCALE_FILTER_SMART: |
95 | assert(false); // unreachable | 99 | assert(false); // unreachable |
96 | } | 100 | } |
101 | #endif | ||
97 | } | 102 | } |
98 | 103 | ||
99 | static void render_texture(struct wlr_output *wlr_output, | 104 | static void render_texture(struct wlr_output *wlr_output, |