Cairo defaults to using a blended fill, so when IGT tries to paint on
top of a framebuffer in these tests with an alpha less than 1.0 the
previous framebuffer contents will still be present underneath.
On amdgpu this is an issue because the framebuffer is created in
an unitialized state and can have contents from previous tests
still within memory.
This patch explicitly sets the cairo filling operator to SOURCE to
overwrite the contents when performing fills with alpha < 1.0 in
this test.
It also fixes the creation of the transparent FB. My guess as for why
this test previously passed on i915 is because the primary FB was
also black, so the CRC would match even if the black overlay plane
was partially transparent.
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Newer platforms don't support this format, but the tests don't check
if the format is supported on the primary plane.
After enabling an output we also don't refresh the output connection,
calling igt_output_set_pipe(output, PIPE_NONE) will do so, and prevent
skips because no connected output is detected.
Changes since v1:
- Use igt_plane_has_format_mod (Ville).
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Not all engines are created equal, and our weighting ends up favouring
the many faster xCS rings at the expense of RCS. Our qlen estimation
also failed to factor in the context switch overhead, which is a
significant factor for nop batches. So we oversubscribe the number of
batches submitted to RCS and end up waiting for those to complete at the
end of our subtest timeslice.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Caz Yokoyama <caz.yokoyama@intel.com>
Reviewed-by: Caz Yokoyama <caz.yokoyama@intel.com>

With recent changes to the igt_fb code, VC4 support is now integrated
in common helpers. As a result, VC4 helpers have to be built as part
of the library.
This is already the case with meson, but VC4 support was removed from
autotools. Bring it back unconditionally to match meson behaviour.
This fixes a build error with autotools.
Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>

This introduces a new test for the Chamelium, that sets up planes
with randomized properties such as the format, dimensions, position,
in-framebuffer offsets and stride. The Chamelium capture is checked
against the reference generated by cairo with either a CRC or the
checkerboard-specific comparison method.
This test also includes testing of the VC4-specific T-tiled and
SAND-tiled modes, in all formats supported by the hardware.
Since this test does not share much with previous Chamelium display
tests (especially regarding KMS configuration), most of the code is
not shared with other tests.
This test can be derived with reproducible properties for regression
testing in the future. For now, it serves as a fuzzing test
Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Reviewed-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>

This introduces a new frame comparison method that was designed for
patterns that follow a checkerboard style. These patterns are made of
consecutive rectangular shapes with alternating solid colors. They are
currently used for some Chamelium-based tests.
The method is particularly adapted for cases where the edges of the
shapes might be blurred (e.g. due to scaling), which makes it impossible
to use pixel-perfect or CRC-based comparisons to decide whether the
captured frame matches the reference.
Overall, this test will first detect the edges of the pattern and later
exclude them from comparison. Colors are compared between the reference
and capture with a low threshold for error. A percentage of the faulty
pixels is calculated and the captured frame is considered invalid if
more than one percent of the pixels are erroneous.
Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Reviewed-by: Maxime Ripard <maxime.ripard@bootlin.com>

The current implementation of igt_fb_convert does not allow passing
the destination stride, which is something we want to change for tests.
Add a new fashion of this function that allocates the desintation buffer
with a given stride. Since the current function does the same thing with
an unspecified stride (set to zero, which will be filled later), make it
call our new fashion with the stride set to zero to avoid duplication.
Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Reviewed-by: Maxime Ripard <maxime.ripard@bootlin.com>

The VC4 SAND tiling modes are disposed in columns that follow each
other in memory. The column height defines the number of fixed-width
lines from the beginning of one column to the other, which may be
greater than the display height. In this case, the extra lines are
used as padding and the column height becomes a height-based stride
equivalent.
Support this when calculating the plane size by using the tile height
directly if it is greater than the plane height. This works better than
alignment for non-power-of-two cases (no space is wasted) and it is
equivalent to alignment for power-of-two tile heights.
Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Reviewed-by: Maxime Ripard <maxime.ripard@bootlin.com>

The current create_bo_for_fb uses a device-specific BO instead of dumb
allocation when dumb allocation is not appropriate and the driver is
Intel. Then, it will assert that the parameters are appropriate for
dumb allocation.
The conditions related to tiling, size and stride are sufficient for
needing a device-specific BO and they are not specific to Intel.
However, a device-specific BO for YUV is only needed for Intel.
Change the conditions accordingly and set a device_bo variable. This
variable allows making fb->size calculation common between the
device-specific and dumb paths. Use the variable after that and
distinguish between the device types for allocating and error out if
it's not supported.
This makes the extra checks that dumb allocation is valid redundant,
since these cases will always fall under device-specific allocation
and potentially error out then.
Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Reviewed-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>

And make sure we get the LEASE=1 value, indicating a lessee change.
v2: Apparently netlink reading can leak EAGAIN out through
udev_monitor_receive_device. No idea what's going on there, so let's
wrap some duct tape around it.
v3: Lyude reported that we might get a few udev events on startup of
the test. Drain those first.
v4: Use the igt hotplug library functions, they already take care of
all the uevent special cases.
Cc: Lyude Paul <lyude@redhat.com>
Cc: Keith Packard <keithp@keithp.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>

Without universal planes the kernel should auto-add the (in that case
hidden) primary and cursor planes. Check this works and all the error
handling is there for evil userspace.
Cc: Keith Packard <keithp@keithp.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>

Check that the 2nd master can only create leases while being active
master, and that leases on the first master don't prevent lease
creation for the 2nd master.
Also check that a disappearing master does also invalidate all its
leases.
Cc: Keith Packard <keithp@keithp.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>