Don't re-alloc on IN_FENCE_FD change

This commit is contained in:
Simon Ser 2020-12-05 12:44:08 +01:00
parent 86d7bc9fd7
commit eda317c25c
No known key found for this signature in database
GPG key ID: 0FDE7BE0E88F5E48
3 changed files with 24 additions and 0 deletions

View file

@ -515,6 +515,11 @@ static bool layer_needs_realloc(struct liftoff_layer *layer)
continue;
}
/* We should never need a re-alloc when IN_FENCE_FD changes. */
if (strcmp(prop->name, "IN_FENCE_FD") == 0) {
continue;
}
/* TODO: if CRTC_{X,Y,W,H} changed but intersection with other
* layers hasn't changed, don't realloc */
return true;

View file

@ -54,6 +54,7 @@ tests = {
'add-layer',
'remove-layer',
'change-composition-layer',
'change-in-fence-fd',
],
'priority': [
#'basic',

View file

@ -156,6 +156,18 @@ static void run_change_composition_layer(struct context *ctx) {
assert(liftoff_mock_plane_get_layer(ctx->mock_plane) == ctx->layer);
}
static void run_change_in_fence_fd(struct context *ctx) {
liftoff_layer_set_property(ctx->layer, "IN_FENCE_FD", 42);
first_commit(ctx);
assert(liftoff_mock_plane_get_layer(ctx->mock_plane) == ctx->layer);
liftoff_layer_set_property(ctx->layer, "IN_FENCE_FD", 43);
second_commit(ctx, true);
assert(liftoff_mock_plane_get_layer(ctx->mock_plane) == ctx->layer);
}
static const struct test_case tests[] = {
{ .name = "same", .run = run_same },
{ .name = "change-fb", .run = run_change_fb },
@ -164,6 +176,7 @@ static const struct test_case tests[] = {
{ .name = "add-layer", .run = run_add_layer },
{ .name = "remove-layer", .run = run_remove_layer },
{ .name = "change-composition-layer", .run = run_change_composition_layer },
{ .name = "change-in-fence-fd", .run = run_change_in_fence_fd },
};
static void run(const struct test_case *test) {
@ -179,6 +192,11 @@ static void run(const struct test_case *test) {
/* Plane incompatible with all layers */
liftoff_mock_drm_create_plane(DRM_PLANE_TYPE_CURSOR);
const char *prop_name = "IN_FENCE_FD";
drmModePropertyRes prop = {0};
strncpy(prop.name, prop_name, sizeof(prop.name) - 1);
liftoff_mock_plane_add_property(ctx.mock_plane, &prop);
ctx.drm_fd = liftoff_mock_drm_open();
device = liftoff_device_create(ctx.drm_fd);
assert(device != NULL);