Skip to content

Commit a54adb6

Browse files
committed
general: remove code related to the legacy backends
Signed-off-by: Yuxuan Shui <[email protected]>
1 parent 2f917fd commit a54adb6

26 files changed

+256
-4522
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ libconfig-dev libdbus-1-dev libegl-dev libev-dev libgl-dev libepoxy-dev libpcre2
5353
On Fedora, the needed packages are
5454

5555
```
56-
dbus-devel gcc git libconfig-devel libdrm-devel libev-devel libX11-devel libX11-xcb libxcb-devel libGL-devel libEGL-devel libepoxy-devel meson pcre2-devel pixman-devel uthash-devel xcb-util-image-devel xcb-util-renderutil-devel xorg-x11-proto-devel xcb-util-devel
56+
dbus-devel gcc git libconfig-devel libev-devel libX11-devel libX11-xcb libxcb-devel libGL-devel libEGL-devel libepoxy-devel meson pcre2-devel pixman-devel uthash-devel xcb-util-image-devel xcb-util-renderutil-devel xorg-x11-proto-devel xcb-util-devel
5757
```
5858

5959
To build the documents, you need `asciidoctor`

meson_options.txt

-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
option('sanitize', type: 'boolean', value: false, description: 'Build with sanitizers enabled (deprecated)')
22
option('regex', type: 'boolean', value: true, description: 'Enable regex support in window conditions')
33

4-
option('vsync_drm', type: 'boolean', value: false, description: 'Enable support for using drm for vsync')
5-
64
option('opengl', type: 'boolean', value: true, description: 'Enable features that require opengl (opengl backend, and opengl vsync methods)')
75
option('dbus', type: 'boolean', value: true, description: 'Enable support for D-Bus remote control')
86

src/common.h

+2-123
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,6 @@
3434
#include <picom/backend.h>
3535
#include <picom/types.h>
3636

37-
#ifdef CONFIG_OPENGL
38-
#include "backend/gl/glx.h"
39-
#endif
40-
4137
// X resource checker
4238
#ifdef DEBUG_XRC
4339
#include "xrescheck.h"
@@ -47,7 +43,6 @@
4743
#include "backend/driver.h"
4844
#include "config.h"
4945
#include "region.h"
50-
#include "render.h"
5146
#include "utils/statistics.h"
5247
#include "wm/defs.h"
5348
#include "x.h"
@@ -64,47 +59,9 @@
6459
// Window flags
6560

6661
// === Types ===
67-
typedef struct glx_fbconfig glx_fbconfig_t;
68-
struct glx_session;
6962
struct atom;
7063
struct conv;
7164

72-
#ifdef CONFIG_OPENGL
73-
#ifdef DEBUG_GLX_DEBUG_CONTEXT
74-
typedef GLXContext (*f_glXCreateContextAttribsARB)(Display *dpy, GLXFBConfig config,
75-
GLXContext share_context, Bool direct,
76-
const int *attrib_list);
77-
typedef void (*GLDEBUGPROC)(GLenum source, GLenum type, GLuint id, GLenum severity,
78-
GLsizei length, const GLchar *message, GLvoid *userParam);
79-
typedef void (*f_DebugMessageCallback)(GLDEBUGPROC, void *userParam);
80-
#endif
81-
82-
typedef struct glx_prog_main {
83-
/// GLSL program.
84-
GLuint prog;
85-
/// Location of uniform "opacity" in window GLSL program.
86-
GLint unifm_opacity;
87-
/// Location of uniform "invert_color" in blur GLSL program.
88-
GLint unifm_invert_color;
89-
/// Location of uniform "tex" in window GLSL program.
90-
GLint unifm_tex;
91-
/// Location of uniform "time" in window GLSL program.
92-
GLint unifm_time;
93-
} glx_prog_main_t;
94-
95-
#define GLX_PROG_MAIN_INIT \
96-
{ \
97-
.prog = 0, .unifm_opacity = -1, .unifm_invert_color = -1, \
98-
.unifm_tex = -1, .unifm_time = -1 \
99-
}
100-
101-
#else
102-
struct glx_prog_main {};
103-
#endif
104-
105-
#define PAINT_INIT \
106-
{ .pixmap = XCB_NONE, .pict = XCB_NONE }
107-
10865
/// Linked list type of atoms.
10966
typedef struct _latom {
11067
xcb_atom_t atom;
@@ -119,18 +76,6 @@ struct shader_info {
11976
UT_hash_handle hh;
12077
};
12178

122-
struct damage_ring {
123-
/// Cache a xfixes region so we don't need to allocate it every time.
124-
/// A workaround for yshui/picom#301
125-
xcb_xfixes_region_t x_region;
126-
/// The region needs to painted on next paint.
127-
int cursor;
128-
/// The region damaged on the last paint.
129-
region_t *damages;
130-
/// Number of damage regions we track
131-
int count;
132-
};
133-
13479
/// Structure containing all necessary data for a session.
13580
typedef struct session {
13681
// === Event handlers ===
@@ -174,34 +119,15 @@ typedef struct session {
174119
xcb_window_t overlay;
175120
/// The target window for debug mode
176121
xcb_window_t debug_window;
177-
/// Whether the root tile is filled by us.
178-
bool root_tile_fill;
179-
/// Picture of the root window background.
180-
paint_t root_tile_paint;
181122
/// The backend data the root pixmap bound to
182123
image_handle root_image;
183124
/// The root pixmap generation, incremented everytime
184125
/// the root pixmap changes
185126
uint64_t root_image_generation;
186127
/// A region of the size of the screen.
187128
region_t screen_reg;
188-
/// Picture of root window. Destination of painting in no-DBE painting
189-
/// mode.
190-
xcb_render_picture_t root_picture;
191-
/// A Picture acting as the painting target.
192-
xcb_render_picture_t tgt_picture;
193-
/// Temporary buffer to paint to before sending to display.
194-
paint_t tgt_buffer;
195129
/// Window ID of the window we register as a symbol.
196130
xcb_window_t reg_win;
197-
#ifdef CONFIG_OPENGL
198-
/// Pointer to GLX data.
199-
struct glx_session *psglx;
200-
/// Custom GLX program used for painting window.
201-
// XXX should be in struct glx_session
202-
glx_prog_main_t glx_prog_win;
203-
struct glx_fbconfig_info argb_fbconfig;
204-
#endif
205131
/// Sync fence to sync draw operations
206132
xcb_sync_fence_t sync_fence;
207133
/// Whether we are rendering the first frame after screen is redirected
@@ -246,9 +172,8 @@ typedef struct session {
246172
/// to the screen that's neither included in the current render, nor on the
247173
/// screen.
248174
bool render_queued;
249-
// TODO(yshui) remove this after we remove the legacy backends
250-
/// For tracking damage regions
251-
struct damage_ring damage_ring;
175+
/// A X region used for various operations. Kept to avoid repeated allocation.
176+
xcb_xfixes_region_t x_region;
252177
// TODO(yshui) move render related fields into separate struct
253178
/// Render planner
254179
struct layout_manager *layout_manager;
@@ -261,21 +186,13 @@ typedef struct session {
261186
xcb_render_picture_t *alpha_picts;
262187
/// Time of last fading. In milliseconds.
263188
long long fade_time;
264-
// Cached blur convolution kernels.
265-
struct x_convolution_kernel **blur_kerns_cache;
266189
/// If we should quit
267190
bool quit : 1;
268191
// TODO(yshui) use separate flags for different kinds of updates so we don't
269192
// waste our time.
270193
/// Whether there are pending updates, like window creation, etc.
271194
bool pending_updates : 1;
272195

273-
// === Expose event related ===
274-
/// Pointer to an array of <code>XRectangle</code>-s of exposed region.
275-
/// This is a reuse temporary buffer for handling root expose events.
276-
/// This is a dynarr.
277-
rect_t *expose_rects;
278-
279196
struct wm *wm;
280197

281198
struct window_options window_options_default;
@@ -295,12 +212,6 @@ typedef struct session {
295212
/// Nanosecond offset of the first painting.
296213
long paint_tm_offset;
297214

298-
#ifdef CONFIG_VSYNC_DRM
299-
// === DRM VSync related ===
300-
/// File descriptor of DRI device file. Used for DRM VSync.
301-
int drm_fd;
302-
#endif
303-
304215
// === X extension related ===
305216
/// Event base number for X Fixes extension.
306217
int xfixes_event;
@@ -348,8 +259,6 @@ typedef struct session {
348259
int xsync_event;
349260
/// Error base number for X Sync extension.
350261
int xsync_error;
351-
/// Whether X Render convolution filter exists.
352-
bool xrfilter_convolution_exists;
353262

354263
// === Atoms ===
355264
struct atom *atoms;
@@ -358,8 +267,6 @@ typedef struct session {
358267
// === DBus related ===
359268
struct cdbus_data *dbus_data;
360269
#endif
361-
362-
int (*vsync_wait)(session_t *);
363270
} session_t;
364271

365272
/// Enumeration for window event hints.
@@ -441,13 +348,6 @@ static inline xcb_window_t get_tgt_window(session_t *ps) {
441348
return ps->overlay != XCB_NONE ? ps->overlay : ps->c.screen_info->root;
442349
}
443350

444-
/**
445-
* Check if current backend uses GLX.
446-
*/
447-
static inline bool bkend_use_glx(session_t *ps) {
448-
return BKEND_GLX == ps->o.legacy_backend || BKEND_XR_GLX_HYBRID == ps->o.legacy_backend;
449-
}
450-
451351
/**
452352
* Determine if a window has a specific property.
453353
*
@@ -484,24 +384,3 @@ static inline void wintype_arr_enable(bool arr[]) {
484384
arr[i] = true;
485385
}
486386
}
487-
488-
static inline void damage_ring_advance(struct damage_ring *ring) {
489-
ring->cursor--;
490-
if (ring->cursor < 0) {
491-
ring->cursor += ring->count;
492-
}
493-
pixman_region32_clear(&ring->damages[ring->cursor]);
494-
}
495-
496-
static inline void damage_ring_collect(struct damage_ring *ring, region_t *all_region,
497-
region_t *region, int buffer_age) {
498-
if (buffer_age == -1 || buffer_age > ring->count) {
499-
pixman_region32_copy(region, all_region);
500-
} else {
501-
for (int i = 0; i < buffer_age; i++) {
502-
auto curr = (ring->cursor + i) % ring->count;
503-
pixman_region32_union(region, region, &ring->damages[curr]);
504-
}
505-
pixman_region32_intersect(region, region, all_region);
506-
}
507-
}

src/config.c

-2
Original file line numberDiff line numberDiff line change
@@ -642,8 +642,6 @@ bool load_plugin(const char *name, const char *include_dir) {
642642
bool parse_config(options_t *opt, const char *config_file) {
643643
// clang-format off
644644
*opt = (struct options){
645-
.legacy_backend = BKEND_XRENDER,
646-
.use_legacy_backends = false,
647645
.glx_no_stencil = false,
648646
.mark_wmwin_focused = false,
649647
.mark_ovredir_focused = false,

src/config.h

-2
Original file line numberDiff line numberDiff line change
@@ -251,8 +251,6 @@ typedef struct options {
251251
char *write_pid_path;
252252
/// Name of the backend
253253
struct backend_info *backend;
254-
/// The backend in use (for legacy backends).
255-
int legacy_backend;
256254
/// Log level.
257255
int log_level;
258256
/// Whether to sync X drawing with X Sync fence to avoid certain delay

src/config_libconfig.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -929,9 +929,8 @@ bool parse_config_libconfig(options_t *opt, const char *config_file) {
929929
lcfg_lookup_bool(&cfg, "vsync", &opt->vsync);
930930
// --backend
931931
if (config_lookup_string(&cfg, "backend", &sval)) {
932-
opt->legacy_backend = parse_backend(sval);
933932
opt->backend = backend_find(sval);
934-
if (opt->legacy_backend >= NUM_BKEND && opt->backend == NULL) {
933+
if (opt->backend == NULL) {
935934
log_fatal("Invalid backend: %s", sval);
936935
goto out;
937936
}

src/dbus.c

+1-7
Original file line numberDiff line numberDiff line change
@@ -826,7 +826,6 @@ cdbus_process_win_set(session_t *ps, DBusMessage *msg, DBusMessage *reply, DBusE
826826
return DBUS_HANDLER_RESULT_HANDLED;
827827
}
828828
if (changed) {
829-
add_damage_from_win(ps, w);
830829
queue_redraw(ps);
831830
}
832831

@@ -908,11 +907,7 @@ cdbus_process_opts_get(session_t *ps, DBusMessage *msg, DBusMessage *reply, DBus
908907
#define append_session_option(tgt, type) append(tgt, type, ps->o.tgt)
909908

910909
if (strcmp("backend", target) == 0) {
911-
assert(!ps->o.use_legacy_backends ||
912-
(size_t)ps->o.legacy_backend < ARR_SIZE(BACKEND_STRS));
913-
const char *name = ps->o.use_legacy_backends
914-
? BACKEND_STRS[ps->o.legacy_backend]
915-
: backend_name(ps->o.backend);
910+
const char *name = backend_name(ps->o.backend);
916911
if (reply != NULL && !cdbus_append_string(reply, name)) {
917912
return DBUS_HANDLER_RESULT_NEED_MEMORY;
918913
}
@@ -930,7 +925,6 @@ cdbus_process_opts_get(session_t *ps, DBusMessage *msg, DBusMessage *reply, DBus
930925
append(unredir_if_possible_delay, int32, (int32_t)ps->o.unredir_if_possible_delay);
931926
append(refresh_rate, int32, 0);
932927
append(sw_opti, boolean, false);
933-
append(backend, string, BACKEND_STRS[ps->o.legacy_backend]);
934928

935929
append_session_option(unredir_if_possible, boolean);
936930
append_session_option(write_pid_path, string);

0 commit comments

Comments
 (0)