34
34
#include <picom/backend.h>
35
35
#include <picom/types.h>
36
36
37
- #ifdef CONFIG_OPENGL
38
- #include "backend/gl/glx.h"
39
- #endif
40
-
41
37
// X resource checker
42
38
#ifdef DEBUG_XRC
43
39
#include "xrescheck.h"
47
43
#include "backend/driver.h"
48
44
#include "config.h"
49
45
#include "region.h"
50
- #include "render.h"
51
46
#include "utils/statistics.h"
52
47
#include "wm/defs.h"
53
48
#include "x.h"
64
59
// Window flags
65
60
66
61
// === Types ===
67
- typedef struct glx_fbconfig glx_fbconfig_t ;
68
- struct glx_session ;
69
62
struct atom ;
70
63
struct conv ;
71
64
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
-
108
65
/// Linked list type of atoms.
109
66
typedef struct _latom {
110
67
xcb_atom_t atom ;
@@ -119,18 +76,6 @@ struct shader_info {
119
76
UT_hash_handle hh ;
120
77
};
121
78
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
-
134
79
/// Structure containing all necessary data for a session.
135
80
typedef struct session {
136
81
// === Event handlers ===
@@ -174,34 +119,15 @@ typedef struct session {
174
119
xcb_window_t overlay ;
175
120
/// The target window for debug mode
176
121
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 ;
181
122
/// The backend data the root pixmap bound to
182
123
image_handle root_image ;
183
124
/// The root pixmap generation, incremented everytime
184
125
/// the root pixmap changes
185
126
uint64_t root_image_generation ;
186
127
/// A region of the size of the screen.
187
128
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 ;
195
129
/// Window ID of the window we register as a symbol.
196
130
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
205
131
/// Sync fence to sync draw operations
206
132
xcb_sync_fence_t sync_fence ;
207
133
/// Whether we are rendering the first frame after screen is redirected
@@ -246,9 +172,8 @@ typedef struct session {
246
172
/// to the screen that's neither included in the current render, nor on the
247
173
/// screen.
248
174
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 ;
252
177
// TODO(yshui) move render related fields into separate struct
253
178
/// Render planner
254
179
struct layout_manager * layout_manager ;
@@ -261,21 +186,13 @@ typedef struct session {
261
186
xcb_render_picture_t * alpha_picts ;
262
187
/// Time of last fading. In milliseconds.
263
188
long long fade_time ;
264
- // Cached blur convolution kernels.
265
- struct x_convolution_kernel * * blur_kerns_cache ;
266
189
/// If we should quit
267
190
bool quit : 1 ;
268
191
// TODO(yshui) use separate flags for different kinds of updates so we don't
269
192
// waste our time.
270
193
/// Whether there are pending updates, like window creation, etc.
271
194
bool pending_updates : 1 ;
272
195
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
-
279
196
struct wm * wm ;
280
197
281
198
struct window_options window_options_default ;
@@ -295,12 +212,6 @@ typedef struct session {
295
212
/// Nanosecond offset of the first painting.
296
213
long paint_tm_offset ;
297
214
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
-
304
215
// === X extension related ===
305
216
/// Event base number for X Fixes extension.
306
217
int xfixes_event ;
@@ -348,8 +259,6 @@ typedef struct session {
348
259
int xsync_event ;
349
260
/// Error base number for X Sync extension.
350
261
int xsync_error ;
351
- /// Whether X Render convolution filter exists.
352
- bool xrfilter_convolution_exists ;
353
262
354
263
// === Atoms ===
355
264
struct atom * atoms ;
@@ -358,8 +267,6 @@ typedef struct session {
358
267
// === DBus related ===
359
268
struct cdbus_data * dbus_data ;
360
269
#endif
361
-
362
- int (* vsync_wait )(session_t * );
363
270
} session_t ;
364
271
365
272
/// Enumeration for window event hints.
@@ -441,13 +348,6 @@ static inline xcb_window_t get_tgt_window(session_t *ps) {
441
348
return ps -> overlay != XCB_NONE ? ps -> overlay : ps -> c .screen_info -> root ;
442
349
}
443
350
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
-
451
351
/**
452
352
* Determine if a window has a specific property.
453
353
*
@@ -484,24 +384,3 @@ static inline void wintype_arr_enable(bool arr[]) {
484
384
arr [i ] = true;
485
385
}
486
386
}
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
- }
0 commit comments