aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/wlr/render/swapchain.h6
-rw-r--r--render/swapchain.c4
2 files changed, 8 insertions, 2 deletions
diff --git a/include/wlr/render/swapchain.h b/include/wlr/render/swapchain.h
index 8bb8afc9..cb3aee9d 100644
--- a/include/wlr/render/swapchain.h
+++ b/include/wlr/render/swapchain.h
@@ -39,6 +39,12 @@ void wlr_swapchain_destroy(struct wlr_swapchain *swapchain);
struct wlr_buffer *wlr_swapchain_acquire(struct wlr_swapchain *swapchain,
int *age);
/**
+ * Returns true if this buffer has been created by this swapchain, and false
+ * otherwise.
+ */
+bool wlr_swapchain_has_buffer(struct wlr_swapchain *swapchain,
+ struct wlr_buffer *buffer);
+/**
* Mark the buffer as submitted for presentation. This needs to be called by
* swap chain users on frame boundaries.
*
diff --git a/render/swapchain.c b/render/swapchain.c
index a2b6373b..a50dae5c 100644
--- a/render/swapchain.c
+++ b/render/swapchain.c
@@ -113,7 +113,7 @@ struct wlr_buffer *wlr_swapchain_acquire(struct wlr_swapchain *swapchain,
return slot_acquire(swapchain, free_slot, age);
}
-static bool swapchain_has_buffer(struct wlr_swapchain *swapchain,
+bool wlr_swapchain_has_buffer(struct wlr_swapchain *swapchain,
struct wlr_buffer *buffer) {
for (size_t i = 0; i < WLR_SWAPCHAIN_CAP; i++) {
struct wlr_swapchain_slot *slot = &swapchain->slots[i];
@@ -128,7 +128,7 @@ void wlr_swapchain_set_buffer_submitted(struct wlr_swapchain *swapchain,
struct wlr_buffer *buffer) {
assert(buffer != NULL);
- if (!swapchain_has_buffer(swapchain, buffer)) {
+ if (!wlr_swapchain_has_buffer(swapchain, buffer)) {
return;
}