[PATCH i-g-t 20/22] tests/kms_rotation_crc: Adopt to use allocator
Bhanuprakash Modem
bhanuprakash.modem at intel.com
Fri Jun 25 12:54:14 UTC 2021
Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem at intel.com>
---
tests/kms_rotation_crc.c | 61 ++++++++++++++++++++++++++++++++++------
1 file changed, 53 insertions(+), 8 deletions(-)
diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index 20556c825a..6842c73549 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -215,7 +215,8 @@ static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,
}
static void prepare_fbs(data_t *data, igt_output_t *output,
- igt_plane_t *plane, enum rectangle_type rect, uint32_t format)
+ igt_plane_t *plane, enum rectangle_type rect,
+ uint32_t format, uint64_t ahnd)
{
drmModeModeInfo *mode;
igt_display_t *display = &data->display;
@@ -286,10 +287,15 @@ static void prepare_fbs(data_t *data, igt_output_t *output,
/*
* Create a reference software rotated flip framebuffer.
*/
+ if (is_i915_device(data->gfx_fd))
+ data->fb_flip.ahnd = ahnd;
igt_create_fb(data->gfx_fd, ref_w, ref_h, pixel_format, tiling,
&data->fb_flip);
paint_squares(data, data->rotation, &data->fb_flip,
flip_opacity);
+ if (is_i915_device(data->gfx_fd))
+ put_offset(data->fb_flip.ahnd, data->fb_flip.gem_handle);
+
igt_plane_set_fb(plane, &data->fb_flip);
if (plane->type != DRM_PLANE_TYPE_CURSOR)
igt_plane_set_position(plane, data->pos_x, data->pos_y);
@@ -309,9 +315,13 @@ static void prepare_fbs(data_t *data, igt_output_t *output,
/*
* Create a reference CRC for a software-rotated fb.
*/
+ if (is_i915_device(data->gfx_fd))
+ data->fb_reference.ahnd = ahnd;
igt_create_fb(data->gfx_fd, ref_w, ref_h, pixel_format,
data->override_tiling ?: LOCAL_DRM_FORMAT_MOD_NONE, &data->fb_reference);
paint_squares(data, data->rotation, &data->fb_reference, 1.0);
+ if (is_i915_device(data->gfx_fd))
+ put_offset(data->fb_reference.ahnd, data->fb_reference.gem_handle);
igt_plane_set_fb(plane, &data->fb_reference);
if (plane->type != DRM_PLANE_TYPE_CURSOR)
@@ -333,16 +343,25 @@ static void prepare_fbs(data_t *data, igt_output_t *output,
/*
* Prepare the non-rotated flip fb.
*/
+ if (is_i915_device(data->gfx_fd))
+ data->fb_flip.ahnd = ahnd;
igt_create_fb(data->gfx_fd, w, h, pixel_format, tiling,
&data->fb_flip);
paint_squares(data, IGT_ROTATION_0, &data->fb_flip,
flip_opacity);
+ if (is_i915_device(data->gfx_fd))
+ put_offset(data->fb_flip.ahnd, data->fb_flip.gem_handle);
/*
* Prepare the plane with an non-rotated fb let the hw rotate it.
*/
+ if (is_i915_device(data->gfx_fd))
+ data->fb.ahnd = ahnd;
igt_create_fb(data->gfx_fd, w, h, pixel_format, tiling, &data->fb);
paint_squares(data, IGT_ROTATION_0, &data->fb, 1.0);
+ if (is_i915_device(data->gfx_fd))
+ put_offset(data->fb.ahnd, data->fb.gem_handle);
+
igt_plane_set_fb(plane, &data->fb);
if (plane->type != DRM_PLANE_TYPE_CURSOR)
@@ -352,14 +371,15 @@ static void prepare_fbs(data_t *data, igt_output_t *output,
static void test_single_case(data_t *data, enum pipe pipe,
igt_output_t *output, igt_plane_t *plane,
enum rectangle_type rect,
- uint32_t format, bool test_bad_format)
+ uint32_t format, bool test_bad_format,
+ uint64_t ahnd)
{
igt_display_t *display = &data->display;
igt_crc_t crc_output;
int ret;
igt_debug("Testing case %i on pipe %s, format %s\n", rect, kmstest_pipe_name(pipe), igt_format_str(format));
- prepare_fbs(data, output, plane, rect, format);
+ prepare_fbs(data, output, plane, rect, format, ahnd);
igt_plane_set_rotation(plane, data->rotation);
if (data->rotation & (IGT_ROTATION_90 | IGT_ROTATION_270))
@@ -448,6 +468,7 @@ static void test_plane_rotation(data_t *data, int plane_type, bool test_bad_form
igt_output_t *output;
enum pipe pipe;
int pipe_count = 0, connected_outputs = 0;
+ uint64_t ahnd = 0;
if (is_amdgpu_device(data->gfx_fd))
igt_require(plane_type != DRM_PLANE_TYPE_OVERLAY &&
@@ -461,6 +482,9 @@ static void test_plane_rotation(data_t *data, int plane_type, bool test_bad_form
for_each_connected_output(&data->display, output)
connected_outputs++;
+ if (is_i915_device(data->gfx_fd))
+ ahnd = get_reloc_ahnd(data->gfx_fd, 0);
+
for_each_pipe_with_valid_output(display, pipe, output) {
igt_plane_t *plane;
int i, j, c;
@@ -538,19 +562,24 @@ static void test_plane_rotation(data_t *data, int plane_type, bool test_bad_form
continue;
test_single_case(data, pipe, output, plane, i,
- format, test_bad_format);
+ format, test_bad_format,
+ ahnd);
}
igt_vec_fini(&tested_formats);
} else {
test_single_case(data, pipe, output, plane, i,
- data->override_fmt, test_bad_format);
+ data->override_fmt, test_bad_format,
+ ahnd);
}
}
if (is_i915_device(data->gfx_fd)) {
igt_pipe_crc_stop(data->pipe_crc);
}
}
+
+ if (is_i915_device(data->gfx_fd))
+ put_ahnd(ahnd);
}
typedef struct {
@@ -561,13 +590,16 @@ typedef struct {
} planeinfos;
static bool setup_multiplane(data_t *data, planeinfos *planeinfo,
- struct igt_fb *fbleft, struct igt_fb *fbright)
+ struct igt_fb *fbleft, struct igt_fb *fbright,
+ uint64_t ahnd)
{
uint32_t w, h;
struct igt_fb *planes[2] = {fbleft, fbright};
int c;
for (c = 0; c < ARRAY_SIZE(planes); c++) {
+ planes[c]->ahnd = ahnd;
+
/*
* make plane and fb width and height always divisible by 4
* due to NV12 support and Intel hw workarounds.
@@ -593,6 +625,9 @@ static bool setup_multiplane(data_t *data, planeinfos *planeinfo,
paint_squares(data, planeinfo[c].rotation_sw,
planes[c], 1.0f);
+
+ if (is_i915_device(data->gfx_fd))
+ put_offset(planes[c]->ahnd, planes[c]->gem_handle);
}
igt_plane_set_fb(planeinfo[c].plane, planes[c]);
@@ -688,6 +723,10 @@ static void test_multi_plane_rotation(data_t *data, enum pipe pipe)
{IGT_ROTATION_270, .2f, .4f, LOCAL_I915_FORMAT_MOD_Y_TILED },
{IGT_ROTATION_270, .2f, .4f, LOCAL_I915_FORMAT_MOD_Yf_TILED },
};
+ uint64_t ahnd = 0;
+
+ if (is_i915_device(data->gfx_fd))
+ ahnd = get_reloc_ahnd(data->gfx_fd, 0);
for_each_valid_output_on_pipe(display, pipe, output) {
int i, j, k, l, flipsw, fliphw;
@@ -779,7 +818,8 @@ static void test_multi_plane_rotation(data_t *data, enum pipe pipe)
if (!setup_multiplane(data,
(planeinfos *)&p,
&planeconfigs[i].fbs[k][MULTIPLANE_REFERENCE],
- &planeconfigs[j].fbs[l][MULTIPLANE_REFERENCE]))
+ &planeconfigs[j].fbs[l][MULTIPLANE_REFERENCE],
+ ahnd))
continue;
igt_display_commit_atomic(display, DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);
flipsw = kmstest_get_vblank(data->gfx_fd, pipe, 0) + 1;
@@ -799,7 +839,8 @@ static void test_multi_plane_rotation(data_t *data, enum pipe pipe)
if (!setup_multiplane(data,
(planeinfos *)&p,
&planeconfigs[i].fbs[k][MULTIPLANE_ROTATED],
- &planeconfigs[j].fbs[l][MULTIPLANE_ROTATED]))
+ &planeconfigs[j].fbs[l][MULTIPLANE_ROTATED],
+ ahnd))
continue;
igt_display_commit_atomic(display, DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);
@@ -857,6 +898,10 @@ static void test_multi_plane_rotation(data_t *data, enum pipe pipe)
igt_output_set_pipe(output, PIPE_NONE);
}
+
+ if (is_i915_device(data->gfx_fd))
+ put_ahnd(ahnd);
+
data->pipe_crc = NULL;
for (c = 0; c < ARRAY_SIZE(planeconfigs); c++) {
--
2.20.1
More information about the Intel-gfx-trybot
mailing list