From 40411f6d3ed6698387bcfb3aaeb1742e7a183e65 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Sat, 5 Dec 2020 14:36:47 +0100 Subject: [PATCH] Don't re-alloc when FB_DAMAGE_CLIPS changes This is updated at each atomic commit. --- alloc.c | 6 ++++-- test/meson.build | 1 + test/test_dynamic.c | 18 ++++++++++++++++++ 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/alloc.c b/alloc.c index 2743b85..3d4a853 100644 --- a/alloc.c +++ b/alloc.c @@ -526,8 +526,10 @@ 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) { + /* We should never need a re-alloc when IN_FENCE_FD or + * FB_DAMAGE_CLIPS changes. */ + if (strcmp(prop->name, "IN_FENCE_FD") == 0 || + strcmp(prop->name, "FB_DAMAGE_CLIPS") == 0) { continue; } diff --git a/test/meson.build b/test/meson.build index a3e0553..9dfead7 100644 --- a/test/meson.build +++ b/test/meson.build @@ -60,6 +60,7 @@ tests = { 'unset-alpha-to-opaque', 'unset-alpha-to-transparent', 'change-in-fence-fd', + 'change-fb-damage-clips', ], 'priority': [ #'basic', diff --git a/test/test_dynamic.c b/test/test_dynamic.c index 6e54053..15d74f0 100644 --- a/test/test_dynamic.c +++ b/test/test_dynamic.c @@ -228,6 +228,18 @@ static void run_change_in_fence_fd(struct context *ctx) { assert(liftoff_mock_plane_get_layer(ctx->mock_plane) == ctx->layer); } +static void run_change_fb_damage_clips(struct context *ctx) { + liftoff_layer_set_property(ctx->layer, "FB_DAMAGE_CLIPS", 42); + + first_commit(ctx); + assert(liftoff_mock_plane_get_layer(ctx->mock_plane) == ctx->layer); + + liftoff_layer_set_property(ctx->layer, "FB_DAMAGE_CLIPS", 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 }, @@ -242,6 +254,7 @@ static const struct test_case tests[] = { { .name = "unset-alpha-to-opaque", .run = run_unset_alpha_to_opaque }, { .name = "unset-alpha-to-transparent", .run = run_unset_alpha_to_transparent }, { .name = "change-in-fence-fd", .run = run_change_in_fence_fd }, + { .name = "change-fb-damage-clips", .run = run_change_fb_damage_clips }, }; static void run(const struct test_case *test) { @@ -269,6 +282,11 @@ static void run(const struct test_case *test) { strncpy(prop.name, prop_name, sizeof(prop.name) - 1); liftoff_mock_plane_add_property(ctx.mock_plane, &prop); + prop_name = "FB_DAMAGE_CLIPS"; + prop = (drmModePropertyRes){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);