mirror of
https://gitlab.freedesktop.org/emersion/libliftoff.git
synced 2024-11-16 19:47:55 +01:00
Don't re-alloc on IN_FENCE_FD change
This commit is contained in:
parent
86d7bc9fd7
commit
eda317c25c
3 changed files with 24 additions and 0 deletions
5
alloc.c
5
alloc.c
|
@ -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;
|
||||
|
|
|
@ -54,6 +54,7 @@ tests = {
|
|||
'add-layer',
|
||||
'remove-layer',
|
||||
'change-composition-layer',
|
||||
'change-in-fence-fd',
|
||||
],
|
||||
'priority': [
|
||||
#'basic',
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue