mirror of
https://github.com/yshui/picom.git
synced 2024-11-11 13:51:02 -05:00
Move some deinitialization to render.c
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
parent
e7a15ba846
commit
50ea3617ef
4 changed files with 48 additions and 44 deletions
|
@ -186,21 +186,6 @@ free_win_res(session_t *ps, win *w) {
|
||||||
free(w->role);
|
free(w->role);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Free root tile related things.
|
|
||||||
*/
|
|
||||||
static inline void
|
|
||||||
free_root_tile(session_t *ps) {
|
|
||||||
free_picture(ps->c, &ps->root_tile_paint.pict);
|
|
||||||
free_texture(ps, &ps->root_tile_paint.ptex);
|
|
||||||
if (ps->root_tile_fill) {
|
|
||||||
xcb_free_pixmap(ps->c, ps->root_tile_paint.pixmap);
|
|
||||||
ps->root_tile_paint.pixmap = XCB_NONE;
|
|
||||||
}
|
|
||||||
ps->root_tile_paint.pixmap = None;
|
|
||||||
ps->root_tile_fill = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get current system clock in milliseconds.
|
* Get current system clock in milliseconds.
|
||||||
*/
|
*/
|
||||||
|
@ -3959,14 +3944,6 @@ session_destroy(session_t *ps) {
|
||||||
ps->list = NULL;
|
ps->list = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Free alpha_picts
|
|
||||||
{
|
|
||||||
for (int i = 0; i <= MAX_ALPHA; ++i)
|
|
||||||
free_picture(ps->c, &ps->alpha_picts[i]);
|
|
||||||
free(ps->alpha_picts);
|
|
||||||
ps->alpha_picts = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Free blacklists
|
// Free blacklists
|
||||||
free_wincondlst(&ps->o.shadow_blacklist);
|
free_wincondlst(&ps->o.shadow_blacklist);
|
||||||
free_wincondlst(&ps->o.fade_blacklist);
|
free_wincondlst(&ps->o.fade_blacklist);
|
||||||
|
@ -4002,15 +3979,6 @@ session_destroy(session_t *ps) {
|
||||||
ps->ignore_tail = &ps->ignore_head;
|
ps->ignore_tail = &ps->ignore_head;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Free cshadow_picture and black_picture
|
|
||||||
if (ps->cshadow_picture == ps->black_picture)
|
|
||||||
ps->cshadow_picture = None;
|
|
||||||
else
|
|
||||||
free_picture(ps->c, &ps->cshadow_picture);
|
|
||||||
|
|
||||||
free_picture(ps->c, &ps->black_picture);
|
|
||||||
free_picture(ps->c, &ps->white_picture);
|
|
||||||
|
|
||||||
// Free tgt_{buffer,picture} and root_picture
|
// Free tgt_{buffer,picture} and root_picture
|
||||||
if (ps->tgt_buffer.pict == ps->tgt_picture)
|
if (ps->tgt_buffer.pict == ps->tgt_picture)
|
||||||
ps->tgt_buffer.pict = None;
|
ps->tgt_buffer.pict = None;
|
||||||
|
@ -4024,16 +3992,11 @@ session_destroy(session_t *ps) {
|
||||||
free_picture(ps->c, &ps->root_picture);
|
free_picture(ps->c, &ps->root_picture);
|
||||||
free_paint(ps, &ps->tgt_buffer);
|
free_paint(ps, &ps->tgt_buffer);
|
||||||
|
|
||||||
// Free other X resources
|
|
||||||
free_root_tile(ps);
|
|
||||||
pixman_region32_fini(&ps->screen_reg);
|
pixman_region32_fini(&ps->screen_reg);
|
||||||
pixman_region32_fini(&ps->all_damage);
|
pixman_region32_fini(&ps->all_damage);
|
||||||
for (int i = 0; i < CGLX_MAX_BUFFER_AGE; ++i)
|
for (int i = 0; i < CGLX_MAX_BUFFER_AGE; ++i)
|
||||||
pixman_region32_fini(&ps->all_damage_last[i]);
|
pixman_region32_fini(&ps->all_damage_last[i]);
|
||||||
free(ps->expose_rects);
|
free(ps->expose_rects);
|
||||||
free(ps->shadow_corner);
|
|
||||||
free(ps->shadow_top);
|
|
||||||
free(ps->gaussian_map);
|
|
||||||
|
|
||||||
free(ps->o.config_file);
|
free(ps->o.config_file);
|
||||||
free(ps->o.write_pid_path);
|
free(ps->o.write_pid_path);
|
||||||
|
@ -4048,9 +4011,7 @@ session_destroy(session_t *ps) {
|
||||||
free_xinerama_info(ps);
|
free_xinerama_info(ps);
|
||||||
free(ps->pictfmts);
|
free(ps->pictfmts);
|
||||||
|
|
||||||
#ifdef CONFIG_OPENGL
|
deinit_render(ps);
|
||||||
glx_destroy(ps);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef CONFIG_VSYNC_DRM
|
#ifdef CONFIG_VSYNC_DRM
|
||||||
// Close file opened for DRM VSync
|
// Close file opened for DRM VSync
|
||||||
|
|
|
@ -108,10 +108,6 @@ static inline void
|
||||||
free_paint_glx(session_t *ps, paint_t *p) {}
|
free_paint_glx(session_t *ps, paint_t *p) {}
|
||||||
static inline void
|
static inline void
|
||||||
free_win_res_glx(session_t *ps, win *w) {}
|
free_win_res_glx(session_t *ps, win *w) {}
|
||||||
static inline void
|
|
||||||
free_texture(session_t *ps, glx_texture_t **t) {
|
|
||||||
assert(!*t);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
45
src/render.c
45
src/render.c
|
@ -1285,4 +1285,49 @@ bool init_render(session_t *ps) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Free root tile related things.
|
||||||
|
*/
|
||||||
|
void free_root_tile(session_t *ps) {
|
||||||
|
free_picture(ps->c, &ps->root_tile_paint.pict);
|
||||||
|
#ifdef CONFIG_OPENGL
|
||||||
|
free_texture(ps, &ps->root_tile_paint.ptex);
|
||||||
|
#else
|
||||||
|
assert(!ps->root_tile_paint.ptex);
|
||||||
|
#endif
|
||||||
|
if (ps->root_tile_fill) {
|
||||||
|
xcb_free_pixmap(ps->c, ps->root_tile_paint.pixmap);
|
||||||
|
ps->root_tile_paint.pixmap = XCB_NONE;
|
||||||
|
}
|
||||||
|
ps->root_tile_paint.pixmap = None;
|
||||||
|
ps->root_tile_fill = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void deinit_render(session_t *ps) {
|
||||||
|
// Free alpha_picts
|
||||||
|
for (int i = 0; i <= MAX_ALPHA; ++i)
|
||||||
|
free_picture(ps->c, &ps->alpha_picts[i]);
|
||||||
|
free(ps->alpha_picts);
|
||||||
|
ps->alpha_picts = NULL;
|
||||||
|
|
||||||
|
// Free cshadow_picture and black_picture
|
||||||
|
if (ps->cshadow_picture == ps->black_picture)
|
||||||
|
ps->cshadow_picture = XCB_NONE;
|
||||||
|
else
|
||||||
|
free_picture(ps->c, &ps->cshadow_picture);
|
||||||
|
|
||||||
|
free_picture(ps->c, &ps->black_picture);
|
||||||
|
free_picture(ps->c, &ps->white_picture);
|
||||||
|
free(ps->shadow_corner);
|
||||||
|
free(ps->shadow_top);
|
||||||
|
free(ps->gaussian_map);
|
||||||
|
|
||||||
|
// Free other X resources
|
||||||
|
free_root_tile(ps);
|
||||||
|
|
||||||
|
#ifdef CONFIG_OPENGL
|
||||||
|
glx_destroy(ps);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
// vim: set ts=8 sw=8 noet :
|
// vim: set ts=8 sw=8 noet :
|
||||||
|
|
|
@ -30,5 +30,7 @@ paint_all(session_t *ps, region_t *region, const region_t *region_real, win * co
|
||||||
void free_picture(xcb_connection_t *c, xcb_render_picture_t *p);
|
void free_picture(xcb_connection_t *c, xcb_render_picture_t *p);
|
||||||
|
|
||||||
void free_paint(session_t *ps, paint_t *ppaint);
|
void free_paint(session_t *ps, paint_t *ppaint);
|
||||||
|
void free_root_tile(session_t *ps);
|
||||||
|
|
||||||
bool init_render(session_t *ps);
|
bool init_render(session_t *ps);
|
||||||
|
void deinit_render(session_t *ps);
|
||||||
|
|
Loading…
Reference in a new issue