scene-graph: Use weston_buffer's format/modifier info to print

Now that we have this generically available, use it rather than calling
into per-buffer getters.

Signed-off-by: Daniel Stone <daniels@collabora.com>
This commit is contained in:
Daniel Stone 2022-01-14 02:01:24 +00:00
parent 7506cf5240
commit 0a8802404c
1 changed files with 13 additions and 21 deletions

View File

@ -7487,11 +7487,6 @@ static void
debug_scene_view_print_buffer(FILE *fp, struct weston_view *view)
{
struct weston_buffer *buffer = view->surface->buffer_ref.buffer;
struct wl_shm_buffer *shm = buffer->shm_buffer;
struct linux_dmabuf_buffer *dmabuf = buffer->dmabuf;
const struct pixel_format_info *pixel_info = NULL;
uint32_t _format;
uint64_t modifier;
char *modifier_name;
if (!buffer) {
@ -7501,30 +7496,27 @@ debug_scene_view_print_buffer(FILE *fp, struct weston_view *view)
switch (buffer->type) {
case WESTON_BUFFER_SHM:
_format = wl_shm_buffer_get_format(shm);
pixel_info = pixel_format_get_info_shm(_format);
fprintf(fp, "\t\tSHM buffer\n");
fprintf(fp, "\t\t\tformat: 0x%lx %s\n",
(unsigned long) _format,
pixel_info ? pixel_info->drm_format_name : "UNKNOWN");
break;
case WESTON_BUFFER_DMABUF:
modifier = dmabuf->attributes.modifier[0];
modifier_name = pixel_format_get_modifier(modifier);
pixel_info = pixel_format_get_info(dmabuf->attributes.format);
fprintf(fp, "\t\tdmabuf buffer\n");
fprintf(fp, "\t\t\tformat: 0x%lx %s\n",
(unsigned long) dmabuf->attributes.format,
pixel_info ? pixel_info->drm_format_name : "UNKNOWN");
fprintf(fp, "\t\t\tmodifier: %s\n", modifier_name ? modifier_name :
"Failed to convert to a modifier name");
free(modifier_name);
break;
default:
fprintf(fp, "\t\tEGL buffer\n");
fprintf(fp, "\t\tEGL buffer:\n");
fprintf(fp, "\t\t\t[format may be inaccurate]\n");
break;
}
fprintf(fp, "\t\t\tformat: 0x%lx %s\n",
(unsigned long) buffer->pixel_format,
buffer->pixel_format ?
buffer->pixel_format->drm_format_name : "UNKNOWN");
modifier_name = pixel_format_get_modifier(buffer->format_modifier);
fprintf(fp, "\t\t\tmodifier: %s\n",
modifier_name ?
modifier_name : "Failed to convert to a modifier name");
free(modifier_name);
}
static void