mirror of
https://gitlab.freedesktop.org/emersion/libliftoff.git
synced 2024-12-25 21:59:11 +01:00
test: introduce liftoff_mock_require_primary_plane
This allows to mimick i915's requirement of failing all commits which don't have the primary plane enabled. We could expand our test matrix to test with the param *and* without it, but since enabling the param just makes the atomic check more strict there's no real benefit of doing that. Enabling the param can only make tests fail more often, not the other way around.
This commit is contained in:
parent
149e149643
commit
8a971695bd
3 changed files with 26 additions and 1 deletions
|
@ -8,6 +8,12 @@
|
|||
extern uint32_t liftoff_mock_drm_crtc_id;
|
||||
extern size_t liftoff_mock_commit_count;
|
||||
|
||||
/**
|
||||
* Some drivers require the primary plane to be enabled in order to light up a
|
||||
* CRTC (e.g. i915). If this variable is set to true, this behavior is mimicked.
|
||||
*/
|
||||
extern bool liftoff_mock_require_primary_plane;
|
||||
|
||||
struct liftoff_layer;
|
||||
|
||||
int liftoff_mock_drm_open(void);
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
uint32_t liftoff_mock_drm_crtc_id = 0xCC000000;
|
||||
size_t liftoff_mock_commit_count = 0;
|
||||
bool liftoff_mock_require_primary_plane = false;
|
||||
|
||||
struct liftoff_mock_plane {
|
||||
uint32_t id;
|
||||
|
@ -277,8 +278,9 @@ int drmModeAtomicCommit(int fd, drmModeAtomicReq *req, uint32_t flags,
|
|||
{
|
||||
size_t i, j;
|
||||
struct liftoff_mock_plane *plane;
|
||||
uint64_t fb_id, crtc_id;
|
||||
uint64_t type, fb_id, crtc_id;
|
||||
bool has_fb, has_crtc, found;
|
||||
bool any_plane_enabled, primary_plane_enabled;
|
||||
struct liftoff_layer *layer;
|
||||
|
||||
assert_drm_fd(fd);
|
||||
|
@ -286,12 +288,15 @@ int drmModeAtomicCommit(int fd, drmModeAtomicReq *req, uint32_t flags,
|
|||
|
||||
liftoff_mock_commit_count++;
|
||||
|
||||
any_plane_enabled = false;
|
||||
primary_plane_enabled = false;
|
||||
for (i = 0; i < MAX_PLANES; i++) {
|
||||
plane = &mock_planes[i];
|
||||
if (plane->id == 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
type = plane->prop_values[PLANE_TYPE];
|
||||
fb_id = plane->prop_values[PLANE_FB_ID];
|
||||
crtc_id = plane->prop_values[PLANE_CRTC_ID];
|
||||
mock_atomic_req_get_property(req, plane->id, PLANE_FB_ID,
|
||||
|
@ -335,8 +340,20 @@ int drmModeAtomicCommit(int fd, drmModeAtomicReq *req, uint32_t flags,
|
|||
plane->id, (void *)layer);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
any_plane_enabled = true;
|
||||
if (type == DRM_PLANE_TYPE_PRIMARY) {
|
||||
primary_plane_enabled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (liftoff_mock_require_primary_plane && any_plane_enabled &&
|
||||
!primary_plane_enabled) {
|
||||
fprintf(stderr, "libdrm_mock: cannot light up CRTC without "
|
||||
"enabling the primary plane\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (!(flags & DRM_MODE_ATOMIC_TEST_ONLY)) {
|
||||
apply_atomic_req(req);
|
||||
|
|
|
@ -636,6 +636,8 @@ static void run_test(struct test_layer *test_layers)
|
|||
int ret;
|
||||
uint32_t plane_id;
|
||||
|
||||
liftoff_mock_require_primary_plane = true;
|
||||
|
||||
for (i = 0; i < test_setup_len; i++) {
|
||||
mock_planes[i] = liftoff_mock_drm_create_plane(test_setup[i].type);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue