1
0
Fork 0
mirror of https://github.com/yshui/picom.git synced 2025-02-17 15:56:21 -05:00

backend: add version for querying the backend's version

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2024-05-23 15:19:19 +01:00
parent 5c1b0ba7a1
commit 21fe5983e0
No known key found for this signature in database
GPG key ID: D3A4405BE6CC17F4
5 changed files with 40 additions and 0 deletions

View file

@ -418,6 +418,10 @@ struct backend_operations {
/// @return a bitmask of `enum backend_quirk`.
uint32_t (*quirks)(struct backend_base *backend_data) __attribute__((nonnull(1)));
/// Get the version of the backend
void (*version)(struct backend_base *backend_data, uint64_t *major, uint64_t *minor)
__attribute__((nonnull(1, 2, 3)));
/// Check if an optional image format is supported by the backend.
bool (*is_format_supported)(struct backend_base *backend_data,
enum backend_image_format format)

View file

@ -208,6 +208,14 @@ static int dummy_max_buffer_age(struct backend_base *base attr_unused) {
return 5;
}
#define PICOM_BACKEND_DUMMY_MAJOR (0UL)
#define PICOM_BACKEND_DUMMY_MINOR (1UL)
static void dummy_version(struct backend_base * /*base*/, uint64_t *major, uint64_t *minor) {
*major = PICOM_BACKEND_DUMMY_MAJOR;
*minor = PICOM_BACKEND_DUMMY_MINOR;
}
struct backend_operations dummy_ops = {
.apply_alpha = dummy_apply_alpha,
.back_buffer = dummy_back_buffer,
@ -221,6 +229,7 @@ struct backend_operations dummy_ops = {
.new_image = dummy_new_image,
.bind_pixmap = dummy_bind_pixmap,
.quirks = backend_no_quirks,
.version = dummy_version,
.release_image = dummy_release_image,
.init = dummy_init,

View file

@ -347,6 +347,14 @@ static int egl_max_buffer_age(backend_t *base attr_unused) {
return 5; // Why?
}
#define PICOM_BACKEND_EGL_MAJOR (0UL)
#define PICOM_BACKEND_EGL_MINOR (1UL)
static void egl_version(struct backend_base * /*base*/, uint64_t *major, uint64_t *minor) {
*major = PICOM_BACKEND_EGL_MAJOR;
*minor = PICOM_BACKEND_EGL_MINOR;
}
struct backend_operations egl_ops = {
.apply_alpha = gl_apply_alpha,
.back_buffer = gl_back_buffer,
@ -361,6 +369,7 @@ struct backend_operations egl_ops = {
.new_image = gl_new_image,
.present = egl_present,
.quirks = backend_no_quirks,
.version = egl_version,
.release_image = gl_release_image,
.init = egl_init,

View file

@ -521,6 +521,14 @@ static int glx_max_buffer_age(struct backend_base *base attr_unused) {
return 5; // Why?
}
#define PICOM_BACKEND_GLX_MAJOR (0UL)
#define PICOM_BACKEND_GLX_MINOR (1UL)
static void glx_version(struct backend_base * /*base*/, uint64_t *major, uint64_t *minor) {
*major = PICOM_BACKEND_GLX_MAJOR;
*minor = PICOM_BACKEND_GLX_MINOR;
}
struct backend_operations glx_ops = {
.apply_alpha = gl_apply_alpha,
.back_buffer = gl_back_buffer,
@ -535,6 +543,7 @@ struct backend_operations glx_ops = {
.new_image = gl_new_image,
.present = glx_present,
.quirks = backend_no_quirks,
.version = glx_version,
.release_image = gl_release_image,
.init = glx_init,

View file

@ -1024,6 +1024,14 @@ static int xrender_max_buffer_age(struct backend_base *base) {
return ((struct xrender_data *)base)->vsync ? 2 : 1;
}
#define PICOM_BACKEND_XRENDER_MAJOR (0UL)
#define PICOM_BACKEND_XRENDER_MINOR (1UL)
static void xrender_version(struct backend_base * /*base*/, uint64_t *major, uint64_t *minor) {
*major = PICOM_BACKEND_XRENDER_MAJOR;
*minor = PICOM_BACKEND_XRENDER_MINOR;
}
struct backend_operations xrender_ops = {
.apply_alpha = xrender_apply_alpha,
.back_buffer = xrender_back_buffer,
@ -1038,6 +1046,7 @@ struct backend_operations xrender_ops = {
.new_image = xrender_new_image,
.present = xrender_present,
.quirks = xrender_quirks,
.version = xrender_version,
.release_image = xrender_release_image,
.init = xrender_init,