mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-10-29 05:40:12 -04:00
backend: replace get_buffer_caps hook with a struct field
Do the same as wlr_renderer: the supported buffer capabilities are static for the lifetime of the backend.
This commit is contained in:
parent
9fdffba170
commit
b908d865b1
14 changed files with 44 additions and 87 deletions
|
|
@ -212,17 +212,10 @@ static int backend_get_drm_fd(struct wlr_backend *backend) {
|
|||
return x11->drm_fd;
|
||||
}
|
||||
|
||||
static uint32_t get_buffer_caps(struct wlr_backend *backend) {
|
||||
struct wlr_x11_backend *x11 = get_x11_backend_from_backend(backend);
|
||||
return (x11->have_dri3 ? WLR_BUFFER_CAP_DMABUF : 0)
|
||||
| (x11->have_shm ? WLR_BUFFER_CAP_SHM : 0);
|
||||
}
|
||||
|
||||
static const struct wlr_backend_impl backend_impl = {
|
||||
.start = backend_start,
|
||||
.destroy = backend_destroy,
|
||||
.get_drm_fd = backend_get_drm_fd,
|
||||
.get_buffer_caps = get_buffer_caps,
|
||||
};
|
||||
|
||||
bool wlr_backend_is_x11(struct wlr_backend *backend) {
|
||||
|
|
@ -573,6 +566,13 @@ struct wlr_backend *wlr_x11_backend_create(struct wl_event_loop *loop,
|
|||
}
|
||||
free(xi_reply);
|
||||
|
||||
if (x11->have_dri3) {
|
||||
x11->backend.buffer_caps |= WLR_BUFFER_CAP_DMABUF;
|
||||
}
|
||||
if (x11->have_shm) {
|
||||
x11->backend.buffer_caps |= WLR_BUFFER_CAP_SHM;
|
||||
}
|
||||
|
||||
int fd = xcb_get_file_descriptor(x11->xcb);
|
||||
uint32_t events = WL_EVENT_READABLE | WL_EVENT_ERROR | WL_EVENT_HANGUP;
|
||||
x11->event_source = wl_event_loop_add_fd(loop, fd, events, x11_event, x11);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue