diff options
author | Simon Ser <contact@emersion.fr> | 2019-04-09 23:36:35 +0300 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2019-06-07 09:06:11 -0400 |
commit | e516ea4c798d4c02e77836d5e8196decb90a8774 (patch) | |
tree | 3fa5a19fdf2b79084a4c02a393794efe1ca0635e /render/drm_format_set.c | |
parent | 96d6fde5dc7ed2e9897297ed459246cb4133a30f (diff) |
backend/drm: check format when scanning out DMA-BUF
Diffstat (limited to 'render/drm_format_set.c')
-rw-r--r-- | render/drm_format_set.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/render/drm_format_set.c b/render/drm_format_set.c index df683b6d..b09a68a4 100644 --- a/render/drm_format_set.c +++ b/render/drm_format_set.c @@ -35,6 +35,26 @@ const struct wlr_drm_format *wlr_drm_format_set_get( return ptr ? *ptr : NULL; } +bool wlr_drm_format_set_has(const struct wlr_drm_format_set *set, + uint32_t format, uint64_t modifier) { + const struct wlr_drm_format *fmt = wlr_drm_format_set_get(set, format); + if (!fmt) { + return false; + } + + if (modifier == DRM_FORMAT_MOD_INVALID) { + return true; + } + + for (size_t i = 0; i < fmt->len; ++i) { + if (fmt->modifiers[i] == modifier) { + return true; + } + } + + return false; +} + bool wlr_drm_format_set_add(struct wlr_drm_format_set *set, uint32_t format, uint64_t modifier) { struct wlr_drm_format **ptr = format_set_get_ref(set, format); |