clients/weston-info: print unknown formats better
Don't just dump the raw 32-bit values, try to interpret it as a DRM fourcc too. This prints properly the formats YUYV, NV12 and YU12 supported by Weston. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
This commit is contained in:
+28
-1
@@ -30,6 +30,8 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
#include <assert.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
#include <wayland-client.h>
|
#include <wayland-client.h>
|
||||||
|
|
||||||
@@ -240,9 +242,33 @@ print_output_info(void *data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static char
|
||||||
|
bits2graph(uint32_t value, unsigned bitoffset)
|
||||||
|
{
|
||||||
|
int c = (value >> bitoffset) & 0xff;
|
||||||
|
|
||||||
|
if (isgraph(c) || isspace(c))
|
||||||
|
return c;
|
||||||
|
|
||||||
|
return '?';
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
fourcc2str(uint32_t format, char *str, int len)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
assert(len >= 5);
|
||||||
|
|
||||||
|
for (i = 0; i < 4; i++)
|
||||||
|
str[i] = bits2graph(format, i * 8);
|
||||||
|
str[i] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
print_shm_info(void *data)
|
print_shm_info(void *data)
|
||||||
{
|
{
|
||||||
|
char str[5];
|
||||||
struct shm_info *shm = data;
|
struct shm_info *shm = data;
|
||||||
struct shm_format *format;
|
struct shm_format *format;
|
||||||
|
|
||||||
@@ -262,7 +288,8 @@ print_shm_info(void *data)
|
|||||||
printf(" RGB565");
|
printf(" RGB565");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
printf(" unknown(%08x)", format->format);
|
fourcc2str(format->format, str, sizeof(str));
|
||||||
|
printf(" '%s'(0x%08x)", str, format->format);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user