diff --git a/backend/backend.c b/backend/backend.c index 125ed4112..8b101f86b 100644 --- a/backend/backend.c +++ b/backend/backend.c @@ -13,7 +13,6 @@ #include #include #include -#include "backend/backend.h" #include "backend/multi.h" #include "render/allocator/allocator.h" #include "util/env.h" @@ -116,7 +115,12 @@ static struct wlr_session *session_create_and_wait(struct wl_display *disp) { #endif } +const struct wlr_backend_props *wlr_backend_get_props(struct wlr_backend *backend) { + return backend->impl->get_props(backend); +} + clockid_t wlr_backend_get_presentation_clock(struct wlr_backend *backend) { + return wlr_backend_get_props(backend)->presentation_clock; if (backend->impl->get_presentation_clock) { return backend->impl->get_presentation_clock(backend); } @@ -130,14 +134,6 @@ int wlr_backend_get_drm_fd(struct wlr_backend *backend) { return backend->impl->get_drm_fd(backend); } -uint32_t backend_get_buffer_caps(struct wlr_backend *backend) { - if (!backend->impl->get_buffer_caps) { - return 0; - } - - return backend->impl->get_buffer_caps(backend); -} - static size_t parse_outputs_env(const char *name) { const char *outputs_str = getenv(name); if (outputs_str == NULL) { diff --git a/include/backend/backend.h b/include/backend/backend.h deleted file mode 100644 index 8c7440c3d..000000000 --- a/include/backend/backend.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef BACKEND_WLR_BACKEND_H -#define BACKEND_WLR_BACKEND_H - -#include - -/** - * Get the supported buffer capabilities. - * - * This functions returns a bitfield of supported wlr_buffer_cap. - */ -uint32_t backend_get_buffer_caps(struct wlr_backend *backend); - -#endif diff --git a/include/wlr/backend.h b/include/wlr/backend.h index fac49f061..21e0534b1 100644 --- a/include/wlr/backend.h +++ b/include/wlr/backend.h @@ -30,6 +30,16 @@ struct wlr_backend { } events; }; +/** + * Backend properties. + */ +struct wlr_backend_props { + /* Supported buffer capabilities, bitfield of enum wlr_buffer_cap */ + uint32_t buffer_caps; + /* Clock used for presentation feedback */ + clockid_t presentation_clock; +}; + /** * Automatically initializes the most suitable backend given the environment. * Will always return a multi-backend. The backend is created but not started. @@ -51,6 +61,10 @@ bool wlr_backend_start(struct wlr_backend *backend); * automatically when the struct wl_display is destroyed. */ void wlr_backend_destroy(struct wlr_backend *backend); +/** + * Get backend properties. + */ +const struct wlr_backend_props *wlr_backend_get_props(struct wlr_backend *backend); /** * Returns the clock used by the backend for presentation feedback. */ diff --git a/include/wlr/backend/interface.h b/include/wlr/backend/interface.h index 8b922f1d7..f9d4c7d00 100644 --- a/include/wlr/backend/interface.h +++ b/include/wlr/backend/interface.h @@ -16,7 +16,7 @@ struct wlr_backend_impl { bool (*start)(struct wlr_backend *backend); void (*destroy)(struct wlr_backend *backend); - clockid_t (*get_presentation_clock)(struct wlr_backend *backend); + const struct wlr_backend_props *(*get_props)(struct wlr_backend *backend); int (*get_drm_fd)(struct wlr_backend *backend); uint32_t (*get_buffer_caps)(struct wlr_backend *backend); }; diff --git a/render/allocator/allocator.c b/render/allocator/allocator.c index 2b7da4f1b..457932c07 100644 --- a/render/allocator/allocator.c +++ b/render/allocator/allocator.c @@ -9,7 +9,6 @@ #include #include #include -#include "backend/backend.h" #include "render/allocator/allocator.h" #include "render/allocator/drm_dumb.h" #include "render/allocator/shm.h"