2019-04-01 18:15:56 +02:00
|
|
|
#ifndef WLR_RENDER_DRM_FORMAT_SET_H
|
|
|
|
#define WLR_RENDER_DRM_FORMAT_SET_H
|
|
|
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
|
2021-11-15 15:44:12 +01:00
|
|
|
/** A single DRM format */
|
2019-04-01 18:15:56 +02:00
|
|
|
struct wlr_drm_format {
|
2021-11-15 15:44:12 +01:00
|
|
|
// The actual DRM format, from `drm_fourcc.h`
|
2019-04-01 18:15:56 +02:00
|
|
|
uint32_t format;
|
2021-11-15 15:44:12 +01:00
|
|
|
// The number of modifiers
|
|
|
|
size_t len;
|
|
|
|
// The capacity of the array; do not use.
|
|
|
|
size_t capacity;
|
|
|
|
// The actual modifiers
|
2019-04-01 18:15:56 +02:00
|
|
|
uint64_t modifiers[];
|
|
|
|
};
|
|
|
|
|
2021-11-15 15:44:12 +01:00
|
|
|
/** A set of DRM formats */
|
2019-04-01 18:15:56 +02:00
|
|
|
struct wlr_drm_format_set {
|
2021-11-15 15:44:12 +01:00
|
|
|
// 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`.
|
2019-04-01 18:15:56 +02:00
|
|
|
struct wlr_drm_format **formats;
|
|
|
|
};
|
|
|
|
|
2021-11-15 15:44:12 +01:00
|
|
|
/**
|
|
|
|
* Free all of the DRM formats in the set, making the set empty. Does not
|
|
|
|
* free the set itself.
|
|
|
|
*/
|
2019-04-01 18:15:56 +02:00
|
|
|
void wlr_drm_format_set_finish(struct wlr_drm_format_set *set);
|
|
|
|
|
2021-11-15 15:44:12 +01:00
|
|
|
/**
|
|
|
|
* Return a pointer to a member of this `wlr_drm_format_set` of format
|
|
|
|
* `format`, or NULL if none exists.
|
|
|
|
*/
|
2019-04-01 18:15:56 +02:00
|
|
|
const struct wlr_drm_format *wlr_drm_format_set_get(
|
|
|
|
const struct wlr_drm_format_set *set, uint32_t format);
|
|
|
|
|
2019-04-09 22:36:35 +02:00
|
|
|
bool wlr_drm_format_set_has(const struct wlr_drm_format_set *set,
|
|
|
|
uint32_t format, uint64_t modifier);
|
|
|
|
|
2019-04-01 18:15:56 +02:00
|
|
|
bool wlr_drm_format_set_add(struct wlr_drm_format_set *set, uint32_t format,
|
|
|
|
uint64_t modifier);
|
|
|
|
|
|
|
|
#endif
|