Don't re-alloc when FB_DAMAGE_CLIPS changes

This is updated at each atomic commit.
This commit is contained in:
Simon Ser 2020-12-05 14:36:47 +01:00
parent 9bfe58b7d2
commit 40411f6d3e
No known key found for this signature in database
GPG key ID: 0FDE7BE0E88F5E48
3 changed files with 23 additions and 2 deletions

View file

@ -526,8 +526,10 @@ static bool layer_needs_realloc(struct liftoff_layer *layer)
continue; continue;
} }
/* We should never need a re-alloc when IN_FENCE_FD changes. */ /* We should never need a re-alloc when IN_FENCE_FD or
if (strcmp(prop->name, "IN_FENCE_FD") == 0) { * FB_DAMAGE_CLIPS changes. */
if (strcmp(prop->name, "IN_FENCE_FD") == 0 ||
strcmp(prop->name, "FB_DAMAGE_CLIPS") == 0) {
continue; continue;
} }

View file

@ -60,6 +60,7 @@ tests = {
'unset-alpha-to-opaque', 'unset-alpha-to-opaque',
'unset-alpha-to-transparent', 'unset-alpha-to-transparent',
'change-in-fence-fd', 'change-in-fence-fd',
'change-fb-damage-clips',
], ],
'priority': [ 'priority': [
#'basic', #'basic',

View file

@ -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); 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[] = { static const struct test_case tests[] = {
{ .name = "same", .run = run_same }, { .name = "same", .run = run_same },
{ .name = "change-fb", .run = run_change_fb }, { .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-opaque", .run = run_unset_alpha_to_opaque },
{ .name = "unset-alpha-to-transparent", .run = run_unset_alpha_to_transparent }, { .name = "unset-alpha-to-transparent", .run = run_unset_alpha_to_transparent },
{ .name = "change-in-fence-fd", .run = run_change_in_fence_fd }, { .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) { 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); strncpy(prop.name, prop_name, sizeof(prop.name) - 1);
liftoff_mock_plane_add_property(ctx.mock_plane, &prop); 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(); ctx.drm_fd = liftoff_mock_drm_open();
device = liftoff_device_create(ctx.drm_fd); device = liftoff_device_create(ctx.drm_fd);
assert(device != NULL); assert(device != NULL);