mirror of
https://gitlab.freedesktop.org/emersion/libliftoff.git
synced 2024-12-26 21:59:18 +01:00
test: add dynamic@change-fb-modifier
This commit is contained in:
parent
ab72b0d5c6
commit
62cd0aad09
2 changed files with 55 additions and 2 deletions
|
@ -54,6 +54,7 @@ tests = {
|
||||||
'dynamic': [
|
'dynamic': [
|
||||||
'same',
|
'same',
|
||||||
'change-fb',
|
'change-fb',
|
||||||
|
'change-fb-modifier',
|
||||||
'unset-fb',
|
'unset-fb',
|
||||||
'set-fb',
|
'set-fb',
|
||||||
'add-layer',
|
'add-layer',
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <drm_fourcc.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <libliftoff.h>
|
#include <libliftoff.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
@ -100,16 +101,66 @@ run_same(struct context *ctx)
|
||||||
static void
|
static void
|
||||||
run_change_fb(struct context *ctx)
|
run_change_fb(struct context *ctx)
|
||||||
{
|
{
|
||||||
|
uint32_t fb_id;
|
||||||
|
drmModeFB2 fb_info;
|
||||||
|
|
||||||
|
fb_id = liftoff_mock_drm_create_fb(ctx->layer);
|
||||||
|
fb_info = (drmModeFB2) {
|
||||||
|
.fb_id = fb_id,
|
||||||
|
.width = 1920,
|
||||||
|
.height = 1080,
|
||||||
|
.flags = DRM_MODE_FB_MODIFIERS,
|
||||||
|
.pixel_format = DRM_FORMAT_ARGB8888,
|
||||||
|
.modifier = DRM_FORMAT_MOD_LINEAR,
|
||||||
|
};
|
||||||
|
liftoff_mock_drm_set_fb_info(&fb_info);
|
||||||
|
liftoff_layer_set_property(ctx->layer, "FB_ID", fb_id);
|
||||||
|
|
||||||
first_commit(ctx);
|
first_commit(ctx);
|
||||||
assert(liftoff_mock_plane_get_layer(ctx->mock_plane) == ctx->layer);
|
assert(liftoff_mock_plane_get_layer(ctx->mock_plane) == ctx->layer);
|
||||||
|
|
||||||
liftoff_layer_set_property(ctx->layer, "FB_ID",
|
/* Create a new FB with the exact same FB info as the first one. */
|
||||||
liftoff_mock_drm_create_fb(ctx->layer));
|
fb_id = liftoff_mock_drm_create_fb(ctx->layer);
|
||||||
|
fb_info.fb_id = fb_id;
|
||||||
|
liftoff_mock_drm_set_fb_info(&fb_info);
|
||||||
|
liftoff_layer_set_property(ctx->layer, "FB_ID", fb_id);
|
||||||
|
|
||||||
second_commit(ctx, true);
|
second_commit(ctx, true);
|
||||||
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_modifier(struct context *ctx)
|
||||||
|
{
|
||||||
|
uint32_t fb_id;
|
||||||
|
drmModeFB2 fb_info;
|
||||||
|
|
||||||
|
fb_id = liftoff_mock_drm_create_fb(ctx->layer);
|
||||||
|
fb_info = (drmModeFB2) {
|
||||||
|
.fb_id = fb_id,
|
||||||
|
.width = 1920,
|
||||||
|
.height = 1080,
|
||||||
|
.flags = DRM_MODE_FB_MODIFIERS,
|
||||||
|
.pixel_format = DRM_FORMAT_ARGB8888,
|
||||||
|
.modifier = I915_FORMAT_MOD_Y_TILED,
|
||||||
|
};
|
||||||
|
liftoff_mock_drm_set_fb_info(&fb_info);
|
||||||
|
liftoff_layer_set_property(ctx->layer, "FB_ID", fb_id);
|
||||||
|
|
||||||
|
first_commit(ctx);
|
||||||
|
assert(liftoff_mock_plane_get_layer(ctx->mock_plane) == ctx->layer);
|
||||||
|
|
||||||
|
/* Simulate the situation where the previous FB gets removed, and a new
|
||||||
|
* one gets re-created with the same FB ID but a different modifier.
|
||||||
|
* This should prevent the first configuration from being re-used. */
|
||||||
|
fb_info.modifier = I915_FORMAT_MOD_X_TILED;
|
||||||
|
liftoff_mock_drm_set_fb_info(&fb_info);
|
||||||
|
liftoff_layer_set_property(ctx->layer, "FB_ID", fb_id);
|
||||||
|
|
||||||
|
second_commit(ctx, false);
|
||||||
|
assert(liftoff_mock_plane_get_layer(ctx->mock_plane) == ctx->layer);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
run_unset_fb(struct context *ctx)
|
run_unset_fb(struct context *ctx)
|
||||||
{
|
{
|
||||||
|
@ -274,6 +325,7 @@ run_change_fb_damage_clips(struct context *ctx)
|
||||||
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 },
|
||||||
|
{ .name = "change-fb-modifier", .run = run_change_fb_modifier },
|
||||||
{ .name = "unset-fb", .run = run_unset_fb },
|
{ .name = "unset-fb", .run = run_unset_fb },
|
||||||
{ .name = "set-fb", .run = run_set_fb },
|
{ .name = "set-fb", .run = run_set_fb },
|
||||||
{ .name = "add-layer", .run = run_add_layer },
|
{ .name = "add-layer", .run = run_add_layer },
|
||||||
|
|
Loading…
Reference in a new issue