drm-formats: add weston_drm_format_array_count_pairs()
It simply returns the number of format/modifier pairs in the array. This will be useful for the next commits, in which we add support for dma-buf feedback. Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com> Reviewed-by: Daniel Stone <daniels@collabora.com>
This commit is contained in:
@@ -81,6 +81,8 @@ TEST(basic_operations)
|
||||
|
||||
weston_drm_format_array_init(&format_array);
|
||||
|
||||
assert(weston_drm_format_array_count_pairs(&format_array) == 0);
|
||||
|
||||
ADD_FORMATS_AND_MODS(&format_array, formats, modifiers);
|
||||
|
||||
for (i = 0; i < ARRAY_LENGTH(formats); i++) {
|
||||
@@ -90,6 +92,9 @@ TEST(basic_operations)
|
||||
assert(weston_drm_format_has_modifier(fmt, modifiers[j]));
|
||||
}
|
||||
|
||||
assert(weston_drm_format_array_count_pairs(&format_array) ==
|
||||
ARRAY_LENGTH(formats) * ARRAY_LENGTH(modifiers));
|
||||
|
||||
weston_drm_format_array_fini(&format_array);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user