[igt-dev] [PATCH i-g-t v1 3/3] igt/tests: Tolerate if kernel can't have all planes

Stanislav Lisovskiy
2019-03-29T11:29:16Z

With some upcoming changes i915 might not allow
all sprite planes enabled, depending on available
bandwidth limitation. Thus the test need to decrement
amount of planes and try again, instead of panicking.

Signed-off-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
---
tests/kms_atomic_transition.c | 25 ++++++++++++++++++-------
1 file changed, 18 insertions(+), 7 deletions(-)

diff --git a/tests/kms_atomic_transition.c b/tests/kms_atomic_transition.c
index ed271532..657a7d1c 100644
--- a/tests/kms_atomic_transition.c
+++ b/tests/kms_atomic_transition.c
@@ -215,6 +215,7 @@ static void setup_parms(igt_display_t *display, enum pipe pipe,
uint32_t n_overlays;
igt_plane_t *plane;
uint32_t iter_mask;
+ int retries = n_planes - 1;

do_or_die(drmGetCap(display->drm_fd, DRM_CAP_CURSOR_WIDTH, &cursor_width));
if (cursor_width >= mode->hdisplay)
@@ -224,6 +225,7 @@ static void setup_parms(igt_display_t *display, enum pipe pipe,
if (cursor_height >= mode->vdisplay)
cursor_height = mode->vdisplay;

+retry:
n_overlays = 0;
iter_mask = 0;

@@ -266,7 +268,6 @@ static void setup_parms(igt_display_t *display, enum pipe pipe,
* Pre gen9 not all sizes are supported, find the biggest possible
* size that can be enabled on all sprite planes.
*/
-retry:
prev_w = sprite_width = cursor_width;
prev_h = sprite_height = cursor_height;

@@ -286,12 +287,22 @@ retry:
if (is_atomic_check_plane_size_errno(ret)) {
if (cursor_width == sprite_width &&
cursor_height == sprite_height) {
- igt_assert_f(alpha,
- "Cannot configure the test with all sprite planes enabled\n");
-
- /* retry once with XRGB format. */
- alpha = false;
- goto retry;
+ if (--retries >= 0) {
+ /* retry once with XRGB format. */
+ if (alpha) {
+ alpha = false;
+ }
+ else if (display->pipes[pipe].n_planes > 0) {
+ display->pipes[pipe].n_planes--;
+ igt_info("Reduced available planes to %d\n",
+ display->pipes[pipe].n_planes);
+ }
+ n_planes = display->pipes[pipe].n_planes;
+ igt_assert_f(n_planes > 0, "No planes left to proceed with!");
+ goto retry;
+ }
+ igt_assert_f(retries > 0,
+ "Cannot configure the test with all sprite planes enabled\n");
}

sprite_width = prev_w;
--
2.17.1