diff options
Diffstat (limited to 'backend/x11/output.c')
-rw-r--r-- | backend/x11/output.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/backend/x11/output.c b/backend/x11/output.c index 4f91a55f..63dfb110 100644 --- a/backend/x11/output.c +++ b/backend/x11/output.c @@ -164,11 +164,23 @@ static struct wlr_x11_buffer *create_x11_buffer(struct wlr_x11_output *output, const struct wlr_x11_format *x11_fmt = x11->x11_format; xcb_pixmap_t pixmap = xcb_generate_id(x11->xcb); - xcb_dri3_pixmap_from_buffers(x11->xcb, pixmap, output->win, - attrs.n_planes, attrs.width, attrs.height, attrs.stride[0], - attrs.offset[0], attrs.stride[1], attrs.offset[1], attrs.stride[2], - attrs.offset[2], attrs.stride[3], attrs.offset[3], x11_fmt->depth, - x11_fmt->bpp, attrs.modifier, dup_attrs.fd); + + if (x11->dri3_major_version > 1 || x11->dri3_minor_version >= 2) { + xcb_dri3_pixmap_from_buffers(x11->xcb, pixmap, output->win, + attrs.n_planes, attrs.width, attrs.height, attrs.stride[0], + attrs.offset[0], attrs.stride[1], attrs.offset[1], attrs.stride[2], + attrs.offset[2], attrs.stride[3], attrs.offset[3], x11_fmt->depth, + x11_fmt->bpp, attrs.modifier, dup_attrs.fd); + } else { + // PixmapFromBuffers requires DRI3 1.2 + if (attrs.n_planes != 1 || attrs.modifier != DRM_FORMAT_MOD_INVALID) { + wlr_dmabuf_attributes_finish(&dup_attrs); + return NULL; + } + xcb_dri3_pixmap_from_buffer(x11->xcb, pixmap, output->win, + attrs.height * attrs.stride[0], attrs.width, attrs.height, + attrs.stride[0], x11_fmt->depth, x11_fmt->bpp, dup_attrs.fd[0]); + } struct wlr_x11_buffer *buffer = calloc(1, sizeof(struct wlr_x11_buffer)); if (!buffer) { |