summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Kazlauskas <nicholas.kazlauskas@amd.com>2019-03-13 13:24:14 -0400
committerNicholas Kazlauskas <nicholas.kazlauskas@amd.com>2019-04-02 11:09:06 -0400
commite941e4a29438c7130554492e4daf52afbc99ffdf (patch)
treed846ee7fdba4d6f158978fb04190520d013f1297
parent995274436bcc9c14256027e0f136e16456b25ea3 (diff)
tests/kms_plane_scaling: Use IGT helpers for selecting planes to scale
These tests intend to test scaling on hardware with overlay planes. They will incorrectly try to scale the cursor plane or occasionally crash by trying to access planes that don't exist for hardware that doesn't expose any overlay planes. Make plane selection explicit by requesting the plane by type and index using the igt helper igt_pipe_get_plane_type_index. Signed-off-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com> Reviewed-by: Leo Li <sunpeng.li@amd.com>
-rw-r--r--tests/kms_plane_scaling.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/tests/kms_plane_scaling.c b/tests/kms_plane_scaling.c
index 10c852d5..3364073c 100644
--- a/tests/kms_plane_scaling.c
+++ b/tests/kms_plane_scaling.c
@@ -282,6 +282,7 @@ static void
test_plane_scaling_on_pipe(data_t *d, enum pipe pipe, igt_output_t *output)
{
igt_display_t *display = &d->display;
+ igt_pipe_t *pipe_obj = &display->pipes[pipe];
drmModeModeInfo *mode;
int primary_plane_scaling = 0; /* For now */
uint64_t tiling = is_i915_device(display->drm_fd) ?
@@ -293,7 +294,7 @@ test_plane_scaling_on_pipe(data_t *d, enum pipe pipe, igt_output_t *output)
mode = igt_output_get_mode(output);
/* Set up display with plane 1 */
- d->plane1 = &display->pipes[pipe].planes[0];
+ d->plane1 = igt_pipe_get_plane_type(pipe_obj, DRM_PLANE_TYPE_PRIMARY);
prepare_crtc(d, output, pipe, d->plane1, mode);
igt_create_color_pattern_fb(display->drm_fd, 600, 600,
@@ -324,7 +325,14 @@ test_plane_scaling_on_pipe(data_t *d, enum pipe pipe, igt_output_t *output)
}
/* Set up fb[1]->plane2 mapping. */
- d->plane2 = igt_output_get_plane(output, 1);
+ d->plane2 = igt_pipe_get_plane_type_index(pipe_obj,
+ DRM_PLANE_TYPE_OVERLAY, 0);
+
+ if (!d->plane2) {
+ igt_debug("Plane-2 doesnt exist on pipe %s\n", kmstest_pipe_name(pipe));
+ return;
+ }
+
igt_plane_set_fb(d->plane2, &d->fb[1]);
/* 2nd plane windowed */
@@ -362,14 +370,15 @@ test_plane_scaling_on_pipe(data_t *d, enum pipe pipe, igt_output_t *output)
}
/* Set up fb[2]->plane3 mapping. */
- d->plane3 = igt_output_get_plane(output, 2);
- igt_plane_set_fb(d->plane3, &d->fb[2]);
-
- if(d->plane3->type == DRM_PLANE_TYPE_CURSOR) {
+ d->plane3 = igt_pipe_get_plane_type_index(pipe_obj,
+ DRM_PLANE_TYPE_OVERLAY, 1);
+ if(!d->plane3) {
igt_debug("Plane-3 doesnt exist on pipe %s\n", kmstest_pipe_name(pipe));
return;
}
+ igt_plane_set_fb(d->plane3, &d->fb[2]);
+
/* 3rd plane windowed - no scaling */
igt_fb_set_position(&d->fb[2], d->plane3, 100, 100);
igt_fb_set_size(&d->fb[2], d->plane3, d->fb[2].width-300, d->fb[2].height-300);
@@ -448,13 +457,14 @@ __test_scaler_with_clipping_clamping_scenario(data_t *d, drmModeModeInfo *mode,
static void
test_scaler_with_clipping_clamping_scenario(data_t *d, enum pipe pipe, igt_output_t *output)
{
+ igt_pipe_t *pipe_obj = &d->display.pipes[pipe];
drmModeModeInfo *mode;
igt_require(get_num_scalers(d, pipe) >= 2);
mode = igt_output_get_mode(output);
- d->plane1 = &d->display.pipes[pipe].planes[0];
- d->plane2 = &d->display.pipes[pipe].planes[1];
+ d->plane1 = igt_pipe_get_plane_type(pipe_obj, DRM_PLANE_TYPE_PRIMARY);
+ d->plane2 = igt_pipe_get_plane_type(pipe_obj, DRM_PLANE_TYPE_OVERLAY);
prepare_crtc(d, output, pipe, d->plane1, mode);
for (int i = 0; i < d->plane1->drm_plane->count_formats; i++) {