[PATCH i-g-t 19/22] tests/kms_plane_scaling: Adopt to use allocator
Bhanuprakash Modem
bhanuprakash.modem at intel.com
Fri Jun 25 12:54:13 UTC 2021
Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem at intel.com>
---
tests/kms_plane_scaling.c | 43 +++++++++++++++++++++++++++++++++++----
1 file changed, 39 insertions(+), 4 deletions(-)
diff --git a/tests/kms_plane_scaling.c b/tests/kms_plane_scaling.c
index 2aa46ac8ac..01814e84e9 100644
--- a/tests/kms_plane_scaling.c
+++ b/tests/kms_plane_scaling.c
@@ -128,8 +128,6 @@ static void check_scaling_pipe_plane_rot(data_t *d, igt_plane_t *plane,
int width, height;
drmModeModeInfo *mode;
- cleanup_crtc(d);
-
igt_output_set_pipe(output, pipe);
mode = igt_output_get_mode(output);
@@ -148,6 +146,7 @@ static void check_scaling_pipe_plane_rot(data_t *d, igt_plane_t *plane,
igt_display_commit2(display, COMMIT_ATOMIC);
igt_plane_set_fb(plane, NULL);
+ igt_remove_fb(d->drm_fd, &d->fb[0]);
igt_plane_set_position(plane, 0, 0);
}
@@ -249,10 +248,15 @@ static void test_scaler_with_rotation_pipe(data_t *d, enum pipe pipe,
igt_plane_t *plane;
uint64_t tiling = is_i915_device(d->drm_fd) ?
LOCAL_I915_FORMAT_MOD_Y_TILED : LOCAL_DRM_FORMAT_MOD_NONE;
+ uint64_t ahnd = 0;
igt_require(get_num_scalers(d, pipe) > 0);
- igt_output_set_pipe(output, pipe);
+ cleanup_crtc(d);
+
+ if (is_i915_device(d->drm_fd))
+ ahnd = get_reloc_ahnd(d->drm_fd, 0);
+
for_each_plane_on_pipe(display, pipe, plane) {
if (plane->type == DRM_PLANE_TYPE_CURSOR)
continue;
@@ -265,6 +269,7 @@ static void test_scaler_with_rotation_pipe(data_t *d, enum pipe pipe,
for (int j = 0; j < plane->drm_plane->count_formats; j++) {
unsigned format = plane->drm_plane->formats[j];
+ d->fb[0].ahnd = ahnd;
if (test_format(d, &tested_formats, format) &&
igt_plane_has_format_mod(plane, format, tiling) &&
@@ -278,6 +283,9 @@ static void test_scaler_with_rotation_pipe(data_t *d, enum pipe pipe,
igt_vec_fini(&tested_formats);
}
}
+
+ if (is_i915_device(d->drm_fd))
+ put_ahnd(ahnd);
}
static const uint64_t tilings[] = {
@@ -291,10 +299,14 @@ static void test_scaler_with_pixel_format_pipe(data_t *d, enum pipe pipe, igt_ou
{
igt_display_t *display = &d->display;
igt_plane_t *plane;
+ uint64_t ahnd = 0;
igt_require(get_num_scalers(d, pipe) > 0);
- igt_output_set_pipe(output, pipe);
+ cleanup_crtc(d);
+
+ if (is_i915_device(d->drm_fd))
+ ahnd = get_reloc_ahnd(d->drm_fd, 0);
for_each_plane_on_pipe(display, pipe, plane) {
if (plane->type == DRM_PLANE_TYPE_CURSOR)
@@ -308,6 +320,7 @@ static void test_scaler_with_pixel_format_pipe(data_t *d, enum pipe pipe, igt_ou
for (int j = 0; j < plane->drm_plane->count_formats; j++) {
uint32_t format = plane->drm_plane->formats[j];
+ d->fb[0].ahnd = ahnd;
if (test_format(d, &tested_formats, format) &&
igt_plane_has_format_mod(plane, format, tiling) &&
@@ -320,6 +333,8 @@ static void test_scaler_with_pixel_format_pipe(data_t *d, enum pipe pipe, igt_ou
igt_vec_fini(&tested_formats);
}
}
+ if (is_i915_device(d->drm_fd))
+ put_ahnd(ahnd);
}
/* does iterative scaling on plane2 */
@@ -530,6 +545,7 @@ test_scaler_with_clipping_clamping_scenario(data_t *d, enum pipe pipe, igt_outpu
igt_pipe_t *pipe_obj = &d->display.pipes[pipe];
drmModeModeInfo *mode;
struct igt_vec tested_formats1;
+ uint64_t ahnd = 0;
igt_require(get_num_scalers(d, pipe) >= 2);
@@ -540,9 +556,13 @@ test_scaler_with_clipping_clamping_scenario(data_t *d, enum pipe pipe, igt_outpu
igt_vec_init(&tested_formats1, sizeof(uint32_t));
+ if (is_i915_device(d->drm_fd))
+ ahnd = get_reloc_ahnd(d->drm_fd, 0);
+
for (int i = 0; i < d->plane1->drm_plane->count_formats; i++) {
unsigned f1 = d->plane1->drm_plane->formats[i];
struct igt_vec tested_formats2;
+ d->fb[1].ahnd = ahnd;
if (!test_pipe_iteration(d, pipe, i))
continue;
@@ -559,6 +579,7 @@ test_scaler_with_clipping_clamping_scenario(data_t *d, enum pipe pipe, igt_outpu
for (int j = 0; j < d->plane2->drm_plane->count_formats; j++) {
unsigned f2 = d->plane2->drm_plane->formats[j];
+ d->fb[2].ahnd = ahnd;
if (!test_format(d, &tested_formats2, f2) ||
!can_scale(d, f2))
@@ -577,6 +598,9 @@ test_scaler_with_clipping_clamping_scenario(data_t *d, enum pipe pipe, igt_outpu
igt_vec_fini(&tested_formats2);
}
+ if (is_i915_device(d->drm_fd))
+ put_ahnd(ahnd);
+
igt_vec_fini(&tested_formats1);
}
@@ -614,6 +638,7 @@ static void test_scaler_with_multi_pipe_plane(data_t *d)
enum pipe pipe1, pipe2;
uint64_t tiling = is_i915_device(display->drm_fd) ?
LOCAL_I915_FORMAT_MOD_Y_TILED : LOCAL_DRM_FORMAT_MOD_NONE;
+ uint64_t ahnd = 0;
cleanup_crtc(d);
@@ -633,6 +658,11 @@ static void test_scaler_with_multi_pipe_plane(data_t *d)
igt_skip_on(!igt_display_has_format_mod(display, DRM_FORMAT_XRGB8888,
tiling));
+ if (is_i915_device(display->drm_fd)) {
+ ahnd = get_reloc_ahnd(d->drm_fd, 0);
+ d->fb[0].ahnd = d->fb[1].ahnd = d->fb[2].ahnd = d->fb[3].ahnd = ahnd;
+ }
+
igt_create_pattern_fb(d->drm_fd, 600, 600,
DRM_FORMAT_XRGB8888,
tiling, &d->fb[0]);
@@ -649,6 +679,11 @@ static void test_scaler_with_multi_pipe_plane(data_t *d)
DRM_FORMAT_XRGB8888,
tiling, &d->fb[3]);
+ if (is_i915_device(display->drm_fd)) {
+ put_ahnd(ahnd);
+ d->fb[0].ahnd = d->fb[1].ahnd = d->fb[2].ahnd = d->fb[3].ahnd = 0;
+ }
+
igt_plane_set_fb(d->plane1, &d->fb[0]);
if (d->plane2)
igt_plane_set_fb(d->plane2, &d->fb[1]);
--
2.20.1
More information about the Intel-gfx-trybot
mailing list