Skip to content

Commit

Permalink
backend: xrender: don't use root picture format in backend_xrender_init
Browse files Browse the repository at this point in the history
use root visual and depth directly instead
  • Loading branch information
absolutelynothelix committed Aug 2, 2023
1 parent 6f868e5 commit 7713432
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions src/backend/xrender/xrender.c
Original file line number Diff line number Diff line change
Expand Up @@ -896,12 +896,6 @@ static backend_t *backend_xrender_init(session_t *ps) {
&ps->c, ps->c.screen_info->root_visual, xd->target_win,
XCB_RENDER_CP_SUBWINDOW_MODE, &pa);

auto pictfmt = x_get_pictform_for_visual(&ps->c, ps->c.screen_info->root_visual);
if (!pictfmt) {
log_fatal("Default visual is invalid");
abort();
}

xd->vsync = ps->o.vsync;
if (ps->present_exists) {
auto eid = x_new_id(&ps->c);
Expand Down Expand Up @@ -930,14 +924,15 @@ static backend_t *backend_xrender_init(session_t *ps) {
// double buffering.
int first_buffer_index = xd->vsync ? 0 : 2;
for (int i = first_buffer_index; i < 3; i++) {
xd->back_pixmap[i] =
x_create_pixmap(&ps->c, pictfmt->depth, to_u16_checked(ps->root_width),
to_u16_checked(ps->root_height));
xd->back_pixmap[i] = x_create_pixmap(&ps->c, ps->c.screen_info->root_depth,
to_u16_checked(ps->root_width),
to_u16_checked(ps->root_height));

Check warning on line 929 in src/backend/xrender/xrender.c

View check run for this annotation

Codecov / codecov/patch

src/backend/xrender/xrender.c#L927-L929

Added lines #L927 - L929 were not covered by tests
const uint32_t pic_attrs_mask = XCB_RENDER_CP_REPEAT;
const xcb_render_create_picture_value_list_t pic_attrs = {
.repeat = XCB_RENDER_REPEAT_PAD};
xd->back[i] = x_create_picture_with_pictfmt_and_pixmap(
&ps->c, pictfmt, xd->back_pixmap[i], pic_attrs_mask, &pic_attrs);
xd->back[i] = x_create_picture_with_visual_and_pixmap(
&ps->c, ps->c.screen_info->root_visual, xd->back_pixmap[i],

Check warning on line 934 in src/backend/xrender/xrender.c

View check run for this annotation

Codecov / codecov/patch

src/backend/xrender/xrender.c#L933-L934

Added lines #L933 - L934 were not covered by tests
pic_attrs_mask, &pic_attrs);
xd->buffer_age[i] = -1;
if (xd->back_pixmap[i] == XCB_NONE || xd->back[i] == XCB_NONE) {
log_error("Cannot create pixmap for rendering");
Expand Down

0 comments on commit 7713432

Please sign in to comment.