By default, drmModeGetFB2() behaves as-if the kernel didn't support
the IOCTL. That way we don't need to update all tests to set sensible
FB info.
If a test is specifically interested in testing drmModeGetFB2()
behavior, it can call liftoff_mock_drm_set_fb_info().
This was fine for simple test cases, but would need to become
more complicated for cases where e.g. zero FB_ID or alpha is
involved. Let's just hardcode the expected value in the test data
instead.
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.
Right now, compositors are expected to query liftoff_layer_get_plane_id to
decide whether a layer needs to be composited.
However there are cases where a layer has no plane, but still doesn't need
composition (e.g. when FB_ID is zero or when alpha is zero, in the future when
the layer is out of CRTC bounds etc).
Add a new API to make users' life simpler.
Closes: https://github.com/emersion/libliftoff/issues/54
When the caller wants to perform a modeset, they will need to pass
DRM_MODE_ATOMIC_ALLOW_MODESET in the atomic commit flags, otherwise the driver
will fail the commit. libliftoff also needs to provide these flags in its
test-only commits.
In file included from ../log.c:4:
In file included from ../include/log.h:4:
In file included from ../include/libliftoff.h:8:
/usr/local/include/xf86drmMode.h:551:19: error: zero size arrays are an extension [-Werror,-Wzero-length-array]
uint32_t lessees[0];
^
/usr/local/include/xf86drmMode.h:558:19: error: zero size arrays are an extension [-Werror,-Wzero-length-array]
uint32_t objects[0];
^
test/bench.c:99:16: error: use of undeclared identifier 'CLOCK_MONOTONIC'
clock_gettime(CLOCK_MONOTONIC, &start);
^
test/bench.c:106:16: error: use of undeclared identifier 'CLOCK_MONOTONIC'
clock_gettime(CLOCK_MONOTONIC, &end);
^
This fixes a misunderstanding of the DRM API. Only a regular commit applies
properties.
Fixes: b16078769e ("test/libdrm_mock: a test-only commit applies properties")
The previous mock library assumed the DRM client would always set all
properties in the atomic request. However, if a previous test-only commit
has set a property, there's no need to set it again.
Accomodate for this in libdrm_mock. This will be useful when we'll skip
setting properties that haven't changed in libliftoff.
References: https://github.com/emersion/libliftoff/issues/37
Makes sure libliftoff doesn't allocate a plane for the layer and doesn't crash.
References: 799f694587 ("Fix segfault when FB_ID isn't set")
References: 53a7bfebc9 ("Don't allocate planes for layers without a FB")