clients/simple-dmabuf-feedback: pretty print format/modifier pairs

As [1] has already landed, use it to pretty print format/modifier pairs
of each dma-buf feedback tranche.

[1] https://gitlab.freedesktop.org/mesa/drm/-/merge_requests/108

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
dev
Leandro Ribeiro 3 years ago
parent 3569de7cd1
commit a272604c00
  1. 21
      clients/simple-dmabuf-feedback.c

@ -1046,6 +1046,21 @@ dmabuf_feedback_tranche_formats(void *data,
} }
} }
static void
print_tranche_format_modifier(uint32_t format, uint64_t modifier)
{
const struct pixel_format_info *fmt_info;
char *mod_name;
fmt_info = pixel_format_get_info(format);
mod_name = pixel_format_get_modifier(modifier);
fprintf(stderr, "│ ├────────tranche format/modifier pair - format %s, modifier %s\n",
fmt_info ? fmt_info->drm_format_name : "UNKNOWN", mod_name);
free(mod_name);
}
static void static void
print_dmabuf_feedback_tranche(struct dmabuf_feedback_tranche *tranche) print_dmabuf_feedback_tranche(struct dmabuf_feedback_tranche *tranche)
{ {
@ -1059,13 +1074,9 @@ print_dmabuf_feedback_tranche(struct dmabuf_feedback_tranche *tranche)
fprintf(stderr, "├──────target_device for tranche - %s\n", drm_node); fprintf(stderr, "├──────target_device for tranche - %s\n", drm_node);
fprintf(stderr, "│ └scanout tranche? %s\n", tranche->is_scanout_tranche ? "yes" : "no"); fprintf(stderr, "│ └scanout tranche? %s\n", tranche->is_scanout_tranche ? "yes" : "no");
/* TODO: pretty print formats/modifiers when the following series lands:
* https://gitlab.freedesktop.org/mesa/drm/-/merge_requests/108
*/
wl_array_for_each(fmt, &tranche->formats.arr) wl_array_for_each(fmt, &tranche->formats.arr)
wl_array_for_each(mod, &fmt->modifiers) wl_array_for_each(mod, &fmt->modifiers)
fprintf(stderr, "│ ├────────tranche format/modifier pair - " \ print_tranche_format_modifier(fmt->format, *mod);
"format %u, modifier %lu\n", fmt->format, *mod);
fprintf(stderr, "│ └end of tranche\n"); fprintf(stderr, "│ └end of tranche\n");
} }

Loading…
Cancel
Save