test/alloc: replace test_layer.zpos with test_prop

This allows setting arbitrary props.
This commit is contained in:
Simon Ser 2022-01-31 13:39:47 +01:00
parent 32f97b1c51
commit addeaf6097

View file

@ -31,6 +31,11 @@ struct test_plane {
int type; int type;
}; };
struct test_prop {
const char *name;
uint64_t value;
};
/* This structure describes a layer in a test case. The first block of fields /* This structure describes a layer in a test case. The first block of fields
* describe the layer properties: geometry, vertical ordering, etc. The `compat` * describe the layer properties: geometry, vertical ordering, etc. The `compat`
* field describes which hardware planes the layer is compatible with. The * field describes which hardware planes the layer is compatible with. The
@ -38,9 +43,9 @@ struct test_plane {
*/ */
struct test_layer { struct test_layer {
int x, y, width, height; int x, y, width, height;
int zpos; /* zero means unset */
bool composition; bool composition;
bool force_composited; bool force_composited;
struct test_prop props[64];
struct test_plane *compat[64]; struct test_plane *compat[64];
struct test_plane *result; struct test_plane *result;
@ -129,14 +134,14 @@ static const struct test_case tests[] = {
{ {
.width = 100, .width = 100,
.height = 100, .height = 100,
.zpos = 1, .props = {{ "zpos", 1 }},
.compat = { CURSOR_PLANE }, .compat = { CURSOR_PLANE },
.result = NULL, .result = NULL,
}, },
{ {
.width = 1920, .width = 1920,
.height = 1080, .height = 1080,
.zpos = 2, .props = {{ "zpos", 2 }},
.compat = { PRIMARY_PLANE }, .compat = { PRIMARY_PLANE },
.result = PRIMARY_PLANE, .result = PRIMARY_PLANE,
}, },
@ -148,21 +153,21 @@ static const struct test_case tests[] = {
{ {
.width = 1920, .width = 1920,
.height = 1080, .height = 1080,
.zpos = 1, .props = {{ "zpos", 1 }},
.compat = { PRIMARY_PLANE }, .compat = { PRIMARY_PLANE },
.result = PRIMARY_PLANE, .result = PRIMARY_PLANE,
}, },
{ {
.width = 100, .width = 100,
.height = 100, .height = 100,
.zpos = 2, .props = {{ "zpos", 2 }},
.compat = FIRST_2_SECONDARY_PLANES, .compat = FIRST_2_SECONDARY_PLANES,
.result = OVERLAY_PLANE, .result = OVERLAY_PLANE,
}, },
{ {
.width = 100, .width = 100,
.height = 100, .height = 100,
.zpos = 3, .props = {{ "zpos", 3 }},
.compat = FIRST_2_SECONDARY_PLANES, .compat = FIRST_2_SECONDARY_PLANES,
.result = CURSOR_PLANE, .result = CURSOR_PLANE,
}, },
@ -176,21 +181,21 @@ static const struct test_case tests[] = {
{ {
.width = 1920, .width = 1920,
.height = 1080, .height = 1080,
.zpos = 1, .props = {{ "zpos", 1 }},
.compat = { PRIMARY_PLANE }, .compat = { PRIMARY_PLANE },
.result = PRIMARY_PLANE, .result = PRIMARY_PLANE,
}, },
{ {
.width = 100, .width = 100,
.height = 100, .height = 100,
.zpos = 3, .props = {{ "zpos", 3 }},
.compat = { NULL }, .compat = { NULL },
.result = NULL, .result = NULL,
}, },
{ {
.width = 100, .width = 100,
.height = 100, .height = 100,
.zpos = 2, .props = {{ "zpos", 2 }},
.compat = FIRST_2_SECONDARY_PLANES, .compat = FIRST_2_SECONDARY_PLANES,
.result = NULL, .result = NULL,
}, },
@ -207,21 +212,21 @@ static const struct test_case tests[] = {
{ {
.width = 1920, .width = 1920,
.height = 1080, .height = 1080,
.zpos = 1, .props = {{ "zpos", 1 }},
.compat = { PRIMARY_PLANE }, .compat = { PRIMARY_PLANE },
.result = PRIMARY_PLANE, .result = PRIMARY_PLANE,
}, },
{ {
.width = 100, .width = 100,
.height = 100, .height = 100,
.zpos = 2, .props = {{ "zpos", 2 }},
.compat = { CURSOR_PLANE }, .compat = { CURSOR_PLANE },
.result = NULL, .result = NULL,
}, },
{ {
.width = 100, .width = 100,
.height = 100, .height = 100,
.zpos = 3, .props = {{ "zpos", 3 }},
.compat = { OVERLAY_PLANE }, .compat = { OVERLAY_PLANE },
.result = OVERLAY_PLANE, .result = OVERLAY_PLANE,
}, },
@ -235,14 +240,14 @@ static const struct test_case tests[] = {
{ {
.width = 1920, .width = 1920,
.height = 1080, .height = 1080,
.zpos = 1, .props = {{ "zpos", 1 }},
.compat = { PRIMARY_PLANE }, .compat = { PRIMARY_PLANE },
.result = PRIMARY_PLANE, .result = PRIMARY_PLANE,
}, },
{ {
.width = 100, .width = 100,
.height = 100, .height = 100,
.zpos = 3, .props = {{ "zpos", 3 }},
.compat = { NULL }, .compat = { NULL },
.result = NULL, .result = NULL,
}, },
@ -251,7 +256,7 @@ static const struct test_case tests[] = {
.y = 100, .y = 100,
.width = 100, .width = 100,
.height = 100, .height = 100,
.zpos = 2, .props = {{ "zpos", 2 }},
.compat = { CURSOR_PLANE }, .compat = { CURSOR_PLANE },
.result = CURSOR_PLANE, .result = CURSOR_PLANE,
}, },
@ -268,14 +273,14 @@ static const struct test_case tests[] = {
{ {
.width = 1920, .width = 1920,
.height = 1080, .height = 1080,
.zpos = 1, .props = {{ "zpos", 1 }},
.compat = { PRIMARY_PLANE }, .compat = { PRIMARY_PLANE },
.result = PRIMARY_PLANE, .result = PRIMARY_PLANE,
}, },
{ {
.width = 100, .width = 100,
.height = 100, .height = 100,
.zpos = 2, .props = {{ "zpos", 2 }},
.compat = { CURSOR_PLANE }, .compat = { CURSOR_PLANE },
.result = CURSOR_PLANE, .result = CURSOR_PLANE,
}, },
@ -284,7 +289,7 @@ static const struct test_case tests[] = {
.y = 100, .y = 100,
.width = 100, .width = 100,
.height = 100, .height = 100,
.zpos = 3, .props = {{ "zpos", 3 }},
.compat = { OVERLAY_PLANE }, .compat = { OVERLAY_PLANE },
.result = OVERLAY_PLANE, .result = OVERLAY_PLANE,
}, },
@ -299,28 +304,28 @@ static const struct test_case tests[] = {
{ {
.width = 1920, .width = 1920,
.height = 1080, .height = 1080,
.zpos = 1, .props = {{ "zpos", 1 }},
.compat = { PRIMARY_PLANE }, .compat = { PRIMARY_PLANE },
.result = PRIMARY_PLANE, .result = PRIMARY_PLANE,
}, },
{ {
.width = 100, .width = 100,
.height = 100, .height = 100,
.zpos = 4, .props = {{ "zpos", 4 }},
.compat = FIRST_3_SECONDARY_PLANES, .compat = FIRST_3_SECONDARY_PLANES,
.result = CURSOR_PLANE, .result = CURSOR_PLANE,
}, },
{ {
.width = 100, .width = 100,
.height = 100, .height = 100,
.zpos = 2, .props = {{ "zpos", 2 }},
.compat = FIRST_3_SECONDARY_PLANES, .compat = FIRST_3_SECONDARY_PLANES,
.result = NULL, .result = NULL,
}, },
{ {
.width = 100, .width = 100,
.height = 100, .height = 100,
.zpos = 3, .props = {{ "zpos", 3 }},
.compat = FIRST_3_SECONDARY_PLANES, .compat = FIRST_3_SECONDARY_PLANES,
.result = &test_setup[3], .result = &test_setup[3],
}, },
@ -335,21 +340,21 @@ static const struct test_case tests[] = {
{ {
.width = 1920, .width = 1920,
.height = 1080, .height = 1080,
.zpos = 1, .props = {{ "zpos", 1 }},
.compat = { PRIMARY_PLANE }, .compat = { PRIMARY_PLANE },
.result = PRIMARY_PLANE, .result = PRIMARY_PLANE,
}, },
{ {
.width = 100, .width = 100,
.height = 100, .height = 100,
.zpos = 4, .props = {{ "zpos", 4 }},
.compat = FIRST_3_SECONDARY_PLANES, .compat = FIRST_3_SECONDARY_PLANES,
.result = CURSOR_PLANE, .result = CURSOR_PLANE,
}, },
{ {
.width = 100, .width = 100,
.height = 100, .height = 100,
.zpos = 2, .props = {{ "zpos", 2 }},
.compat = { &test_setup[3] }, .compat = { &test_setup[3] },
.result = &test_setup[3], .result = &test_setup[3],
}, },
@ -358,7 +363,7 @@ static const struct test_case tests[] = {
.y = 100, .y = 100,
.width = 100, .width = 100,
.height = 100, .height = 100,
.zpos = 3, .props = {{ "zpos", 3 }},
.compat = { OVERLAY_PLANE }, .compat = { OVERLAY_PLANE },
.result = OVERLAY_PLANE, .result = OVERLAY_PLANE,
}, },
@ -372,21 +377,21 @@ static const struct test_case tests[] = {
{ {
.width = 1920, .width = 1920,
.height = 1080, .height = 1080,
.zpos = 1, .props = {{ "zpos", 1 }},
.compat = { PRIMARY_PLANE }, .compat = { PRIMARY_PLANE },
.result = PRIMARY_PLANE, .result = PRIMARY_PLANE,
}, },
{ {
.width = 100, .width = 100,
.height = 100, .height = 100,
.zpos = 4, .props = {{ "zpos", 4 }},
.compat = FIRST_3_SECONDARY_PLANES, .compat = FIRST_3_SECONDARY_PLANES,
.result = CURSOR_PLANE, .result = CURSOR_PLANE,
}, },
{ {
.width = 100, .width = 100,
.height = 100, .height = 100,
.zpos = 2, .props = {{ "zpos", 2 }},
.compat = { OVERLAY_PLANE }, .compat = { OVERLAY_PLANE },
.result = OVERLAY_PLANE, .result = OVERLAY_PLANE,
}, },
@ -395,7 +400,7 @@ static const struct test_case tests[] = {
.y = 100, .y = 100,
.width = 100, .width = 100,
.height = 100, .height = 100,
.zpos = 3, .props = {{ "zpos", 3 }},
.compat = { &test_setup[3] }, .compat = { &test_setup[3] },
.result = &test_setup[3], .result = &test_setup[3],
}, },
@ -411,14 +416,14 @@ static const struct test_case tests[] = {
{ {
.width = 1920, .width = 1920,
.height = 1080, .height = 1080,
.zpos = 1, .props = {{ "zpos", 1 }},
.compat = { PRIMARY_PLANE }, .compat = { PRIMARY_PLANE },
.result = PRIMARY_PLANE, .result = PRIMARY_PLANE,
}, },
{ {
.width = 100, .width = 100,
.height = 100, .height = 100,
.zpos = 4, .props = {{ "zpos", 4 }},
.compat = { NULL }, .compat = { NULL },
.result = NULL, .result = NULL,
}, },
@ -427,7 +432,7 @@ static const struct test_case tests[] = {
.y = 100, .y = 100,
.width = 100, .width = 100,
.height = 100, .height = 100,
.zpos = 2, .props = {{ "zpos", 2 }},
.compat = FIRST_3_SECONDARY_PLANES, .compat = FIRST_3_SECONDARY_PLANES,
.result = NULL, .result = NULL,
}, },
@ -436,7 +441,7 @@ static const struct test_case tests[] = {
.y = 50, .y = 50,
.width = 100, .width = 100,
.height = 100, .height = 100,
.zpos = 3, .props = {{ "zpos", 3 }},
.compat = FIRST_3_SECONDARY_PLANES, .compat = FIRST_3_SECONDARY_PLANES,
.result = NULL, .result = NULL,
}, },
@ -452,14 +457,14 @@ static const struct test_case tests[] = {
{ {
.width = 1920, .width = 1920,
.height = 1080, .height = 1080,
.zpos = 1, .props = {{ "zpos", 1 }},
.compat = { PRIMARY_PLANE }, .compat = { PRIMARY_PLANE },
.result = PRIMARY_PLANE, .result = PRIMARY_PLANE,
}, },
{ {
.width = 100, .width = 100,
.height = 100, .height = 100,
.zpos = 4, .props = {{ "zpos", 4 }},
.compat = { NULL }, .compat = { NULL },
.result = NULL, .result = NULL,
}, },
@ -468,7 +473,7 @@ static const struct test_case tests[] = {
.y = 100, .y = 100,
.width = 100, .width = 100,
.height = 100, .height = 100,
.zpos = 3, .props = {{ "zpos", 3 }},
.compat = FIRST_3_SECONDARY_PLANES, .compat = FIRST_3_SECONDARY_PLANES,
.result = CURSOR_PLANE, .result = CURSOR_PLANE,
}, },
@ -477,7 +482,7 @@ static const struct test_case tests[] = {
.y = 50, .y = 50,
.width = 100, .width = 100,
.height = 100, .height = 100,
.zpos = 2, .props = {{ "zpos", 2 }},
.compat = FIRST_3_SECONDARY_PLANES, .compat = FIRST_3_SECONDARY_PLANES,
.result = NULL, .result = NULL,
}, },
@ -490,14 +495,14 @@ static const struct test_case tests[] = {
{ {
.width = 100, .width = 100,
.height = 100, .height = 100,
.zpos = 2, .props = {{ "zpos", 2 }},
.compat = { PRIMARY_PLANE, OVERLAY_PLANE }, .compat = { PRIMARY_PLANE, OVERLAY_PLANE },
.result = OVERLAY_PLANE, .result = OVERLAY_PLANE,
}, },
{ {
.width = 1920, .width = 1920,
.height = 1080, .height = 1080,
.zpos = 1, .props = {{ "zpos", 1 }},
.compat = { PRIMARY_PLANE, OVERLAY_PLANE }, .compat = { PRIMARY_PLANE, OVERLAY_PLANE },
.result = PRIMARY_PLANE, .result = PRIMARY_PLANE,
}, },
@ -509,7 +514,7 @@ static const struct test_case tests[] = {
{ {
.width = 1920, .width = 1920,
.height = 1080, .height = 1080,
.zpos = 1, .props = {{ "zpos", 1 }},
.composition = true, .composition = true,
.compat = { PRIMARY_PLANE }, .compat = { PRIMARY_PLANE },
.result = NULL, .result = NULL,
@ -517,21 +522,21 @@ static const struct test_case tests[] = {
{ {
.width = 1920, .width = 1920,
.height = 1080, .height = 1080,
.zpos = 1, .props = {{ "zpos", 1 }},
.compat = { PRIMARY_PLANE }, .compat = { PRIMARY_PLANE },
.result = PRIMARY_PLANE, .result = PRIMARY_PLANE,
}, },
{ {
.width = 100, .width = 100,
.height = 100, .height = 100,
.zpos = 2, .props = {{ "zpos", 2 }},
.compat = FIRST_2_SECONDARY_PLANES, .compat = FIRST_2_SECONDARY_PLANES,
.result = OVERLAY_PLANE, .result = OVERLAY_PLANE,
}, },
{ {
.width = 100, .width = 100,
.height = 100, .height = 100,
.zpos = 3, .props = {{ "zpos", 3 }},
.compat = FIRST_2_SECONDARY_PLANES, .compat = FIRST_2_SECONDARY_PLANES,
.result = CURSOR_PLANE, .result = CURSOR_PLANE,
}, },
@ -543,7 +548,7 @@ static const struct test_case tests[] = {
{ {
.width = 1920, .width = 1920,
.height = 1080, .height = 1080,
.zpos = 1, .props = {{ "zpos", 1 }},
.composition = true, .composition = true,
.compat = { PRIMARY_PLANE }, .compat = { PRIMARY_PLANE },
.result = PRIMARY_PLANE, .result = PRIMARY_PLANE,
@ -551,21 +556,21 @@ static const struct test_case tests[] = {
{ {
.width = 1920, .width = 1920,
.height = 1080, .height = 1080,
.zpos = 1, .props = {{ "zpos", 1 }},
.compat = { PRIMARY_PLANE }, .compat = { PRIMARY_PLANE },
.result = NULL, .result = NULL,
}, },
{ {
.width = 100, .width = 100,
.height = 100, .height = 100,
.zpos = 2, .props = {{ "zpos", 2 }},
.compat = FIRST_2_SECONDARY_PLANES, .compat = FIRST_2_SECONDARY_PLANES,
.result = NULL, .result = NULL,
}, },
{ {
.width = 100, .width = 100,
.height = 100, .height = 100,
.zpos = 3, .props = {{ "zpos", 3 }},
.compat = { 0 }, .compat = { 0 },
.result = NULL, .result = NULL,
}, },
@ -577,7 +582,7 @@ static const struct test_case tests[] = {
{ {
.width = 1920, .width = 1920,
.height = 1080, .height = 1080,
.zpos = 1, .props = {{ "zpos", 1 }},
.composition = true, .composition = true,
.compat = { PRIMARY_PLANE }, .compat = { PRIMARY_PLANE },
.result = PRIMARY_PLANE, .result = PRIMARY_PLANE,
@ -585,21 +590,21 @@ static const struct test_case tests[] = {
{ {
.width = 1920, .width = 1920,
.height = 1080, .height = 1080,
.zpos = 1, .props = {{ "zpos", 1 }},
.compat = { PRIMARY_PLANE }, .compat = { PRIMARY_PLANE },
.result = NULL, .result = NULL,
}, },
{ {
.width = 100, .width = 100,
.height = 100, .height = 100,
.zpos = 2, .props = {{ "zpos", 2 }},
.compat = { 0 }, .compat = { 0 },
.result = NULL, .result = NULL,
}, },
{ {
.width = 100, .width = 100,
.height = 100, .height = 100,
.zpos = 3, .props = {{ "zpos", 3 }},
.compat = { CURSOR_PLANE }, .compat = { CURSOR_PLANE },
.result = CURSOR_PLANE, .result = CURSOR_PLANE,
}, },
@ -614,7 +619,7 @@ static const struct test_case tests[] = {
{ {
.width = 1920, .width = 1920,
.height = 1080, .height = 1080,
.zpos = 1, .props = {{ "zpos", 1 }},
.composition = true, .composition = true,
.compat = { PRIMARY_PLANE }, .compat = { PRIMARY_PLANE },
.result = PRIMARY_PLANE, .result = PRIMARY_PLANE,
@ -622,14 +627,14 @@ static const struct test_case tests[] = {
{ {
.width = 1920, .width = 1920,
.height = 1080, .height = 1080,
.zpos = 1, .props = {{ "zpos", 1 }},
.compat = { PRIMARY_PLANE }, .compat = { PRIMARY_PLANE },
.result = NULL, .result = NULL,
}, },
{ {
.width = 100, .width = 100,
.height = 100, .height = 100,
.zpos = 2, .props = {{ "zpos", 2 }},
.force_composited = true, .force_composited = true,
.compat = FIRST_2_SECONDARY_PLANES, .compat = FIRST_2_SECONDARY_PLANES,
.result = NULL, .result = NULL,
@ -637,7 +642,7 @@ static const struct test_case tests[] = {
{ {
.width = 100, .width = 100,
.height = 100, .height = 100,
.zpos = 3, .props = {{ "zpos", 3 }},
.compat = { CURSOR_PLANE }, .compat = { CURSOR_PLANE },
.result = CURSOR_PLANE, .result = CURSOR_PLANE,
}, },
@ -696,9 +701,11 @@ run_test(const struct test_layer *test_layers)
layers[i] = add_layer(output, test_layer->x, test_layer->y, layers[i] = add_layer(output, test_layer->x, test_layer->y,
test_layer->width, test_layer->height); test_layer->width, test_layer->height);
if (test_layer->zpos != 0) { len = sizeof(test_layer->props) / sizeof(test_layer->props[0]);
liftoff_layer_set_property(layers[i], "zpos", for (j = 0; j < len && test_layer->props[j].name != NULL; j++) {
test_layer->zpos); liftoff_layer_set_property(layers[i],
test_layer->props[j].name,
test_layer->props[j].value);
} }
if (test_layer->composition) { if (test_layer->composition) {