diff options
author | Demi Marie Obenour <demi@invisiblethingslab.com> | 2021-11-15 09:44:12 -0500 |
---|---|---|
committer | Simon Zeni <simon@bl4ckb0ne.ca> | 2021-11-17 16:35:20 +0000 |
commit | b5d4bc3c62886f3e089165bd4d82bae781a6bda3 (patch) | |
tree | 7290aad52a11f6cffd95e06958b9bd2d4c641711 /include/wlr/render | |
parent | a04cfca4da42d1cc01047c1cd9e60ef504beae98 (diff) |
Improve wlr_drm_format documentation
A wlroots user can easily get confused and think that `cap` refers to
wlroots buffer capabilities, not array capacity.
Diffstat (limited to 'include/wlr/render')
-rw-r--r-- | include/wlr/render/drm_format_set.h | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/include/wlr/render/drm_format_set.h b/include/wlr/render/drm_format_set.h index 15d4eea3..cb367a63 100644 --- a/include/wlr/render/drm_format_set.h +++ b/include/wlr/render/drm_format_set.h @@ -5,19 +5,38 @@ #include <stddef.h> #include <stdint.h> +/** A single DRM format */ struct wlr_drm_format { + // The actual DRM format, from `drm_fourcc.h` uint32_t format; - size_t len, cap; + // The number of modifiers + size_t len; + // The capacity of the array; do not use. + size_t capacity; + // The actual modifiers uint64_t modifiers[]; }; +/** A set of DRM formats */ struct wlr_drm_format_set { - size_t len, cap; + // The number of formats + size_t len; + // The capacity of the array; private to wlroots + size_t capacity; + // A pointer to an array of `struct wlr_drm_format *` of length `len`. struct wlr_drm_format **formats; }; +/** + * Free all of the DRM formats in the set, making the set empty. Does not + * free the set itself. + */ void wlr_drm_format_set_finish(struct wlr_drm_format_set *set); +/** + * Return a pointer to a member of this `wlr_drm_format_set` of format + * `format`, or NULL if none exists. + */ const struct wlr_drm_format *wlr_drm_format_set_get( const struct wlr_drm_format_set *set, uint32_t format); |