diff --git a/include/picom/backend.h b/include/picom/backend.h index f408410e..38db1013 100644 --- a/include/picom/backend.h +++ b/include/picom/backend.h @@ -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) diff --git a/src/backend/dummy/dummy.c b/src/backend/dummy/dummy.c index a3ac1dc7..773dac59 100644 --- a/src/backend/dummy/dummy.c +++ b/src/backend/dummy/dummy.c @@ -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, diff --git a/src/backend/gl/egl.c b/src/backend/gl/egl.c index 2d2fcec5..4548eeb5 100644 --- a/src/backend/gl/egl.c +++ b/src/backend/gl/egl.c @@ -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, diff --git a/src/backend/gl/glx.c b/src/backend/gl/glx.c index 7272a35c..7fee1e24 100644 --- a/src/backend/gl/glx.c +++ b/src/backend/gl/glx.c @@ -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, diff --git a/src/backend/xrender/xrender.c b/src/backend/xrender/xrender.c index 9732cc3c..4ffb6fae 100644 --- a/src/backend/xrender/xrender.c +++ b/src/backend/xrender/xrender.c @@ -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,