mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-10-31 22:25:21 -04:00
backend/drm: check format when scanning out DMA-BUF
This commit is contained in:
parent
96d6fde5dc
commit
e516ea4c79
6 changed files with 90 additions and 22 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue