mirror of
https://gitlab.freedesktop.org/emersion/libliftoff.git
synced 2025-02-09 08:45:48 +01:00
bench: Add options for composition and debug logs
The -c option adds a composition layer. The -d option enables debug logging, without this the library log-level is set to silent.
This commit is contained in:
parent
c157adb452
commit
98ef9e52d4
1 changed files with 30 additions and 5 deletions
35
test/bench.c
35
test/bench.c
|
@ -13,7 +13,8 @@
|
|||
#define MAX_LAYERS 128
|
||||
|
||||
static struct liftoff_layer *
|
||||
add_layer(struct liftoff_output *output, int x, int y, uint32_t width, uint32_t height)
|
||||
add_layer(struct liftoff_output *output, int x, int y, uint32_t width,
|
||||
uint32_t height, bool composition)
|
||||
{
|
||||
uint32_t fb_id;
|
||||
struct liftoff_layer *layer;
|
||||
|
@ -30,6 +31,10 @@ add_layer(struct liftoff_output *output, int x, int y, uint32_t width, uint32_t
|
|||
liftoff_layer_set_property(layer, "SRC_W", (uint64_t)width << 16);
|
||||
liftoff_layer_set_property(layer, "SRC_H", (uint64_t)height << 16);
|
||||
|
||||
if (composition) {
|
||||
liftoff_output_set_composition_layer(output, layer);
|
||||
}
|
||||
|
||||
return layer;
|
||||
}
|
||||
|
||||
|
@ -38,6 +43,7 @@ main(int argc, char *argv[])
|
|||
{
|
||||
int opt;
|
||||
size_t planes_len, layers_len;
|
||||
bool composition, debug;
|
||||
struct timespec start, end;
|
||||
struct liftoff_mock_plane *mock_planes[MAX_PLANES];
|
||||
size_t i, j;
|
||||
|
@ -52,7 +58,9 @@ main(int argc, char *argv[])
|
|||
|
||||
planes_len = 5;
|
||||
layers_len = 10;
|
||||
while ((opt = getopt(argc, argv, "p:l:")) != -1) {
|
||||
debug = false;
|
||||
composition = false;
|
||||
while ((opt = getopt(argc, argv, "p:l:cd")) != -1) {
|
||||
switch (opt) {
|
||||
case 'p':
|
||||
planes_len = (size_t)atoi(optarg);
|
||||
|
@ -60,14 +68,29 @@ main(int argc, char *argv[])
|
|||
case 'l':
|
||||
layers_len = (size_t)atoi(optarg);
|
||||
break;
|
||||
case 'c':
|
||||
composition = true;
|
||||
break;
|
||||
case 'd':
|
||||
debug = true;
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "usage: %s [-p planes] [-l layers]\n",
|
||||
fprintf(stderr,
|
||||
"usage: %s [-p planes] [-l layers] [-c] [-d]\n",
|
||||
argv[0]);
|
||||
fprintf(stderr, "-c adds a composition layer\n");
|
||||
fprintf(stderr, "-d enables libliftoff debug logging\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
liftoff_log_set_priority(LIFTOFF_SILENT);
|
||||
/* -c should add a new composition layer rather than replacing one of
|
||||
* the existing layers with a composition layer. */
|
||||
if (composition) {
|
||||
layers_len++;
|
||||
}
|
||||
|
||||
liftoff_log_set_priority(debug ? LIFTOFF_DEBUG : LIFTOFF_SILENT);
|
||||
liftoff_mock_verbose = false;
|
||||
|
||||
for (i = 0; i < planes_len; i++) {
|
||||
|
@ -87,7 +110,9 @@ main(int argc, char *argv[])
|
|||
for (i = 0; i < layers_len; i++) {
|
||||
/* Planes don't intersect, so the library can arrange them in
|
||||
* any order. Testing all combinations takes more time. */
|
||||
layers[i] = add_layer(output, (int)i * 100, (int)i * 100, 100, 100);
|
||||
layers[i] = add_layer(output, (int)i * 100, (int)i * 100, 100,
|
||||
100, composition && i == 0);
|
||||
|
||||
for (j = 0; j < planes_len; j++) {
|
||||
if (j == 1) {
|
||||
/* Make the lowest plane above the primary plane
|
||||
|
|
Loading…
Add table
Reference in a new issue