aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/wlr/render/drm_format_set.h3
-rw-r--r--render/drm_format_set.c3
-rw-r--r--types/wlr_linux_dmabuf_v1.c5
3 files changed, 4 insertions, 7 deletions
diff --git a/include/wlr/render/drm_format_set.h b/include/wlr/render/drm_format_set.h
index c0192d63..0a6254e2 100644
--- a/include/wlr/render/drm_format_set.h
+++ b/include/wlr/render/drm_format_set.h
@@ -82,7 +82,8 @@ bool wlr_drm_format_set_intersect(struct wlr_drm_format_set *dst,
/**
* Unions DRM format set `a` and `b`, storing in the destination set
- * `dst`.
+ * `dst`. The `dst` must either be zeroed or initialized with other state
+ * to be replaced.
*
* Returns false on failure.
*/
diff --git a/render/drm_format_set.c b/render/drm_format_set.c
index c8611755..464c0fb4 100644
--- a/render/drm_format_set.c
+++ b/render/drm_format_set.c
@@ -258,8 +258,6 @@ static bool drm_format_set_extend(struct wlr_drm_format_set *dst,
bool wlr_drm_format_set_union(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;
out.formats = calloc(out.capacity, sizeof(struct wlr_drm_format *));
@@ -276,6 +274,7 @@ bool wlr_drm_format_set_union(struct wlr_drm_format_set *dst,
return false;
}
+ wlr_drm_format_set_finish(dst);
*dst = out;
return true;
diff --git a/types/wlr_linux_dmabuf_v1.c b/types/wlr_linux_dmabuf_v1.c
index 6eaff98c..7967d609 100644
--- a/types/wlr_linux_dmabuf_v1.c
+++ b/types/wlr_linux_dmabuf_v1.c
@@ -917,12 +917,9 @@ static bool set_default_feedback(struct wlr_linux_dmabuf_v1 *linux_dmabuf,
for (size_t i = 0; i < tranches_len; i++) {
const struct wlr_linux_dmabuf_feedback_v1_tranche *tranche = &tranches[i];
- struct wlr_drm_format_set uni;
- if (!wlr_drm_format_set_union(&uni, &formats, &tranche->formats)) {
+ if (!wlr_drm_format_set_union(&formats, &formats, &tranche->formats)) {
goto error_formats;
}
- wlr_drm_format_set_finish(&formats);
- formats = uni;
}
compiled_feedback_destroy(linux_dmabuf->default_feedback);