aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/wlr/render/drm_format_set.h3
-rw-r--r--render/drm_format_set.c3
2 files changed, 3 insertions, 3 deletions
diff --git a/include/wlr/render/drm_format_set.h b/include/wlr/render/drm_format_set.h
index 0a6254e2..c8f3c309 100644
--- a/include/wlr/render/drm_format_set.h
+++ b/include/wlr/render/drm_format_set.h
@@ -73,7 +73,8 @@ bool wlr_drm_format_set_add(struct wlr_drm_format_set *set, uint32_t format,
/**
* Intersect two DRM format sets `a` and `b`, storing in the destination set
- * `dst` the format + modifier pairs which are in both source sets.
+ * `dst` the format + modifier pairs which are in both source sets. The `dst`
+ * must either be zeroed or initialized with other state to be replaced.
*
* Returns false on failure or when the intersection is empty.
*/
diff --git a/render/drm_format_set.c b/render/drm_format_set.c
index 464c0fb4..8f3aea99 100644
--- a/render/drm_format_set.c
+++ b/render/drm_format_set.c
@@ -205,8 +205,6 @@ struct wlr_drm_format *wlr_drm_format_intersect(
bool wlr_drm_format_set_intersect(struct wlr_drm_format_set *dst,
const struct wlr_drm_format_set *a, const struct wlr_drm_format_set *b) {
- assert(dst != a && dst != b);
-
struct wlr_drm_format_set out = {0};
out.capacity = a->len < b->len ? a->len : b->len;
out.formats = calloc(out.capacity, sizeof(struct wlr_drm_format *));
@@ -237,6 +235,7 @@ bool wlr_drm_format_set_intersect(struct wlr_drm_format_set *dst,
return false;
}
+ wlr_drm_format_set_finish(dst);
*dst = out;
return true;
}