Skip to content

Commit

Permalink
general: remove code related to the legacy backends
Browse files Browse the repository at this point in the history
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
  • Loading branch information
yshui committed Oct 14, 2024
1 parent 2f917fd commit a54adb6
Show file tree
Hide file tree
Showing 26 changed files with 256 additions and 4,522 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ libconfig-dev libdbus-1-dev libegl-dev libev-dev libgl-dev libepoxy-dev libpcre2
On Fedora, the needed packages are

```
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
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
```

To build the documents, you need `asciidoctor`
Expand Down
2 changes: 0 additions & 2 deletions meson_options.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
option('sanitize', type: 'boolean', value: false, description: 'Build with sanitizers enabled (deprecated)')
option('regex', type: 'boolean', value: true, description: 'Enable regex support in window conditions')

option('vsync_drm', type: 'boolean', value: false, description: 'Enable support for using drm for vsync')

option('opengl', type: 'boolean', value: true, description: 'Enable features that require opengl (opengl backend, and opengl vsync methods)')
option('dbus', type: 'boolean', value: true, description: 'Enable support for D-Bus remote control')

Expand Down
125 changes: 2 additions & 123 deletions src/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@
#include <picom/backend.h>
#include <picom/types.h>

#ifdef CONFIG_OPENGL
#include "backend/gl/glx.h"
#endif

// X resource checker
#ifdef DEBUG_XRC
#include "xrescheck.h"
Expand All @@ -47,7 +43,6 @@
#include "backend/driver.h"
#include "config.h"
#include "region.h"
#include "render.h"
#include "utils/statistics.h"
#include "wm/defs.h"
#include "x.h"
Expand All @@ -64,47 +59,9 @@
// Window flags

// === Types ===
typedef struct glx_fbconfig glx_fbconfig_t;
struct glx_session;
struct atom;
struct conv;

#ifdef CONFIG_OPENGL
#ifdef DEBUG_GLX_DEBUG_CONTEXT
typedef GLXContext (*f_glXCreateContextAttribsARB)(Display *dpy, GLXFBConfig config,
GLXContext share_context, Bool direct,
const int *attrib_list);
typedef void (*GLDEBUGPROC)(GLenum source, GLenum type, GLuint id, GLenum severity,
GLsizei length, const GLchar *message, GLvoid *userParam);
typedef void (*f_DebugMessageCallback)(GLDEBUGPROC, void *userParam);
#endif

typedef struct glx_prog_main {
/// GLSL program.
GLuint prog;
/// Location of uniform "opacity" in window GLSL program.
GLint unifm_opacity;
/// Location of uniform "invert_color" in blur GLSL program.
GLint unifm_invert_color;
/// Location of uniform "tex" in window GLSL program.
GLint unifm_tex;
/// Location of uniform "time" in window GLSL program.
GLint unifm_time;
} glx_prog_main_t;

#define GLX_PROG_MAIN_INIT \
{ \
.prog = 0, .unifm_opacity = -1, .unifm_invert_color = -1, \
.unifm_tex = -1, .unifm_time = -1 \
}

#else
struct glx_prog_main {};
#endif

#define PAINT_INIT \
{ .pixmap = XCB_NONE, .pict = XCB_NONE }

/// Linked list type of atoms.
typedef struct _latom {
xcb_atom_t atom;
Expand All @@ -119,18 +76,6 @@ struct shader_info {
UT_hash_handle hh;
};

struct damage_ring {
/// Cache a xfixes region so we don't need to allocate it every time.
/// A workaround for yshui/picom#301
xcb_xfixes_region_t x_region;
/// The region needs to painted on next paint.
int cursor;
/// The region damaged on the last paint.
region_t *damages;
/// Number of damage regions we track
int count;
};

/// Structure containing all necessary data for a session.
typedef struct session {
// === Event handlers ===
Expand Down Expand Up @@ -174,34 +119,15 @@ typedef struct session {
xcb_window_t overlay;
/// The target window for debug mode
xcb_window_t debug_window;
/// Whether the root tile is filled by us.
bool root_tile_fill;
/// Picture of the root window background.
paint_t root_tile_paint;
/// The backend data the root pixmap bound to
image_handle root_image;
/// The root pixmap generation, incremented everytime
/// the root pixmap changes
uint64_t root_image_generation;
/// A region of the size of the screen.
region_t screen_reg;
/// Picture of root window. Destination of painting in no-DBE painting
/// mode.
xcb_render_picture_t root_picture;
/// A Picture acting as the painting target.
xcb_render_picture_t tgt_picture;
/// Temporary buffer to paint to before sending to display.
paint_t tgt_buffer;
/// Window ID of the window we register as a symbol.
xcb_window_t reg_win;
#ifdef CONFIG_OPENGL
/// Pointer to GLX data.
struct glx_session *psglx;
/// Custom GLX program used for painting window.
// XXX should be in struct glx_session
glx_prog_main_t glx_prog_win;
struct glx_fbconfig_info argb_fbconfig;
#endif
/// Sync fence to sync draw operations
xcb_sync_fence_t sync_fence;
/// Whether we are rendering the first frame after screen is redirected
Expand Down Expand Up @@ -246,9 +172,8 @@ typedef struct session {
/// to the screen that's neither included in the current render, nor on the
/// screen.
bool render_queued;
// TODO(yshui) remove this after we remove the legacy backends
/// For tracking damage regions
struct damage_ring damage_ring;
/// A X region used for various operations. Kept to avoid repeated allocation.
xcb_xfixes_region_t x_region;
// TODO(yshui) move render related fields into separate struct
/// Render planner
struct layout_manager *layout_manager;
Expand All @@ -261,21 +186,13 @@ typedef struct session {
xcb_render_picture_t *alpha_picts;
/// Time of last fading. In milliseconds.
long long fade_time;
// Cached blur convolution kernels.
struct x_convolution_kernel **blur_kerns_cache;
/// If we should quit
bool quit : 1;
// TODO(yshui) use separate flags for different kinds of updates so we don't
// waste our time.
/// Whether there are pending updates, like window creation, etc.
bool pending_updates : 1;

// === Expose event related ===
/// Pointer to an array of <code>XRectangle</code>-s of exposed region.
/// This is a reuse temporary buffer for handling root expose events.
/// This is a dynarr.
rect_t *expose_rects;

struct wm *wm;

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

#ifdef CONFIG_VSYNC_DRM
// === DRM VSync related ===
/// File descriptor of DRI device file. Used for DRM VSync.
int drm_fd;
#endif

// === X extension related ===
/// Event base number for X Fixes extension.
int xfixes_event;
Expand Down Expand Up @@ -348,8 +259,6 @@ typedef struct session {
int xsync_event;
/// Error base number for X Sync extension.
int xsync_error;
/// Whether X Render convolution filter exists.
bool xrfilter_convolution_exists;

// === Atoms ===
struct atom *atoms;
Expand All @@ -358,8 +267,6 @@ typedef struct session {
// === DBus related ===
struct cdbus_data *dbus_data;
#endif

int (*vsync_wait)(session_t *);
} session_t;

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

/**
* Check if current backend uses GLX.
*/
static inline bool bkend_use_glx(session_t *ps) {
return BKEND_GLX == ps->o.legacy_backend || BKEND_XR_GLX_HYBRID == ps->o.legacy_backend;
}

/**
* Determine if a window has a specific property.
*
Expand Down Expand Up @@ -484,24 +384,3 @@ static inline void wintype_arr_enable(bool arr[]) {
arr[i] = true;
}
}

static inline void damage_ring_advance(struct damage_ring *ring) {
ring->cursor--;
if (ring->cursor < 0) {
ring->cursor += ring->count;
}
pixman_region32_clear(&ring->damages[ring->cursor]);
}

static inline void damage_ring_collect(struct damage_ring *ring, region_t *all_region,
region_t *region, int buffer_age) {
if (buffer_age == -1 || buffer_age > ring->count) {
pixman_region32_copy(region, all_region);
} else {
for (int i = 0; i < buffer_age; i++) {
auto curr = (ring->cursor + i) % ring->count;
pixman_region32_union(region, region, &ring->damages[curr]);
}
pixman_region32_intersect(region, region, all_region);
}
}
2 changes: 0 additions & 2 deletions src/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -642,8 +642,6 @@ bool load_plugin(const char *name, const char *include_dir) {
bool parse_config(options_t *opt, const char *config_file) {
// clang-format off
*opt = (struct options){
.legacy_backend = BKEND_XRENDER,
.use_legacy_backends = false,
.glx_no_stencil = false,
.mark_wmwin_focused = false,
.mark_ovredir_focused = false,
Expand Down
2 changes: 0 additions & 2 deletions src/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,6 @@ typedef struct options {
char *write_pid_path;
/// Name of the backend
struct backend_info *backend;
/// The backend in use (for legacy backends).
int legacy_backend;
/// Log level.
int log_level;
/// Whether to sync X drawing with X Sync fence to avoid certain delay
Expand Down
3 changes: 1 addition & 2 deletions src/config_libconfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -929,9 +929,8 @@ bool parse_config_libconfig(options_t *opt, const char *config_file) {
lcfg_lookup_bool(&cfg, "vsync", &opt->vsync);
// --backend
if (config_lookup_string(&cfg, "backend", &sval)) {
opt->legacy_backend = parse_backend(sval);
opt->backend = backend_find(sval);
if (opt->legacy_backend >= NUM_BKEND && opt->backend == NULL) {
if (opt->backend == NULL) {
log_fatal("Invalid backend: %s", sval);
goto out;
}
Expand Down
8 changes: 1 addition & 7 deletions src/dbus.c
Original file line number Diff line number Diff line change
Expand Up @@ -826,7 +826,6 @@ cdbus_process_win_set(session_t *ps, DBusMessage *msg, DBusMessage *reply, DBusE
return DBUS_HANDLER_RESULT_HANDLED;
}
if (changed) {
add_damage_from_win(ps, w);
queue_redraw(ps);
}

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

if (strcmp("backend", target) == 0) {
assert(!ps->o.use_legacy_backends ||
(size_t)ps->o.legacy_backend < ARR_SIZE(BACKEND_STRS));
const char *name = ps->o.use_legacy_backends
? BACKEND_STRS[ps->o.legacy_backend]
: backend_name(ps->o.backend);
const char *name = backend_name(ps->o.backend);
if (reply != NULL && !cdbus_append_string(reply, name)) {
return DBUS_HANDLER_RESULT_NEED_MEMORY;
}
Expand All @@ -930,7 +925,6 @@ cdbus_process_opts_get(session_t *ps, DBusMessage *msg, DBusMessage *reply, DBus
append(unredir_if_possible_delay, int32, (int32_t)ps->o.unredir_if_possible_delay);
append(refresh_rate, int32, 0);
append(sw_opti, boolean, false);
append(backend, string, BACKEND_STRS[ps->o.legacy_backend]);

append_session_option(unredir_if_possible, boolean);
append_session_option(write_pid_path, string);
Expand Down
Loading

0 comments on commit a54adb6

Please sign in to comment.