From: Robert Foss <robert.foss@collabora.com>
To: intel-gfx@lists.freedesktop.org,
Tomeu Vizoso <tomeu.vizoso@collabora.com>,
Maarten Lankhorst <maarten.lankhorst@intel.com>,
Gustavo Padovan <gustavo.padovan@collabora.com>,
Daniel Stone <daniels@collabora.com>
Subject: [PATCH i-g-t rfc 19/29] tests/kms_plane_multiple: Add support for dynamic number of planes
Date: Wed, 11 Jan 2017 15:41:54 -0500 [thread overview]
Message-ID: <20170111204204.7727-20-robert.foss@collabora.com> (raw)
In-Reply-To: <20170111204204.7727-1-robert.foss@collabora.com>
Add changes reflecting the new support for dynamic number of planes per pipe.
Signed-off-by: Robert Foss <robert.foss@collabora.com>
---
tests/kms_plane_multiple.c | 203 ++++++++++++++++++++++++++++-----------------
1 file changed, 125 insertions(+), 78 deletions(-)
diff --git a/tests/kms_plane_multiple.c b/tests/kms_plane_multiple.c
index 5e12be45..dec5488d 100644
--- a/tests/kms_plane_multiple.c
+++ b/tests/kms_plane_multiple.c
@@ -47,8 +47,8 @@ typedef struct {
int drm_fd;
igt_display_t display;
igt_pipe_crc_t *pipe_crc;
- igt_plane_t *plane[IGT_MAX_PLANES];
- struct igt_fb fb[IGT_MAX_PLANES];
+ igt_plane_t **plane;
+ struct igt_fb *fb;
} data_t;
typedef struct {
@@ -92,20 +92,32 @@ static unsigned int get_vblank(int fd, int pipe, unsigned int flags)
/*
* Common code across all tests, acting on data_t
*/
-static void test_init(data_t *data, enum pipe pipe)
+static void test_init(data_t *data, enum pipe pipe, int max_planes)
{
data->pipe_crc = igt_pipe_crc_new(pipe, INTEL_PIPE_CRC_SOURCE_AUTO);
+
+ data->plane = malloc(max_planes * sizeof(data->plane));
+ igt_assert_f(data->plane != NULL, "Failed to allocate memory for planes\n");
+
+ data->fb = malloc(max_planes * sizeof(struct igt_fb));
+ igt_assert_f(data->fb != NULL, "Failed to allocate memory for FBs\n");
}
static void test_fini(data_t *data, igt_output_t *output, int max_planes)
{
- for (int i = IGT_PLANE_PRIMARY; i <= max_planes; i++)
- igt_plane_set_fb(data->plane[i], NULL);
+ for (int i = 0; i <= max_planes; i++) {
+ igt_plane_t *plane = data->plane[i];
+ if (plane->type == DRM_PLANE_TYPE_PRIMARY)
+ continue;
+ igt_plane_set_fb(plane, NULL);
+ }
/* reset the constraint on the pipe */
igt_output_set_pipe(output, PIPE_ANY);
igt_pipe_crc_free(data->pipe_crc);
+ free(data->plane);
+ free(data->fb);
}
static void
@@ -113,11 +125,13 @@ test_grab_crc(data_t *data, igt_output_t *output, enum pipe pipe, bool atomic,
color_t *color, uint64_t tiling, igt_crc_t *crc /* out */)
{
drmModeModeInfo *mode;
+ igt_plane_t *primary;
int ret, n;
igt_output_set_pipe(output, pipe);
- data->plane[IGT_PLANE_PRIMARY] = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
+ primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
+ data->plane[primary->index] = primary;
mode = igt_output_get_mode(output);
@@ -125,9 +139,9 @@ test_grab_crc(data_t *data, igt_output_t *output, enum pipe pipe, bool atomic,
DRM_FORMAT_XRGB8888,
LOCAL_DRM_FORMAT_MOD_NONE,
color->red, color->green, color->blue,
- &data->fb[IGT_PLANE_PRIMARY]);
+ &data->fb[primary->index]);
- igt_plane_set_fb(data->plane[IGT_PLANE_PRIMARY], &data->fb[IGT_PLANE_PRIMARY]);
+ igt_plane_set_fb(data->plane[primary->index], &data->fb[primary->index]);
ret = igt_display_try_commit2(&data->display,
atomic ? COMMIT_ATOMIC : COMMIT_LEGACY);
@@ -150,29 +164,35 @@ test_grab_crc(data_t *data, igt_output_t *output, enum pipe pipe, bool atomic,
*/
static void
-create_fb_for_mode_position(data_t *data, drmModeModeInfo *mode,
+create_fb_for_mode_position(data_t *data, igt_output_t *output, drmModeModeInfo *mode,
color_t *color, int *rect_x, int *rect_y,
int *rect_w, int *rect_h, uint64_t tiling,
int max_planes)
{
unsigned int fb_id;
cairo_t *cr;
+ igt_plane_t *primary;
+
+ primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
fb_id = igt_create_fb(data->drm_fd,
mode->hdisplay, mode->vdisplay,
DRM_FORMAT_XRGB8888,
tiling,
- &data->fb[IGT_PLANE_PRIMARY]);
+ &data->fb[primary->index]);
igt_assert(fb_id);
- cr = igt_get_cairo_ctx(data->drm_fd, &data->fb[IGT_PLANE_PRIMARY]);
+ cr = igt_get_cairo_ctx(data->drm_fd, &data->fb[primary->index]);
igt_paint_color(cr, rect_x[0], rect_y[0],
mode->hdisplay, mode->vdisplay,
color->red, color->green, color->blue);
- for (int i = IGT_PLANE_2; i <= max_planes; i++)
+ for (int i = 0; i <= max_planes; i++) {
+ if (data->plane[i]->type == DRM_PLANE_TYPE_PRIMARY)
+ continue;
igt_paint_color(cr, rect_x[i], rect_y[i],
rect_w[i], rect_h[i], 0.0, 0.0, 0.0);
+ }
igt_assert(cairo_status(cr) == 0);
cairo_destroy(cr);
@@ -180,37 +200,49 @@ create_fb_for_mode_position(data_t *data, drmModeModeInfo *mode,
static void
-prepare_planes(data_t *data, enum pipe pipe, color_t *color,
+prepare_planes(data_t *data, enum pipe pipe_id, color_t *color,
uint64_t tiling, int max_planes, igt_output_t *output)
{
drmModeModeInfo *mode;
- int x[IGT_MAX_PLANES];
- int y[IGT_MAX_PLANES];
- int size[IGT_MAX_PLANES];
+ igt_pipe_t *pipe;
+ igt_plane_t *primary;
+ int *x;
+ int *y;
+ int *size;
int i;
- igt_output_set_pipe(output, pipe);
+ igt_output_set_pipe(output, pipe_id);
+ primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
+ pipe = primary->pipe;
+
+ x = malloc(pipe->n_planes * sizeof(*x));
+ y = malloc(pipe->n_planes * sizeof(*y));
+ size = malloc(pipe->n_planes * sizeof(*size));
mode = igt_output_get_mode(output);
/* planes with random positions */
- x[IGT_PLANE_PRIMARY] = 0;
- y[IGT_PLANE_PRIMARY] = 0;
- for (i = IGT_PLANE_2; i <= max_planes; i++) {
- if (i == IGT_PLANE_CURSOR)
+ x[primary->index] = 0;
+ y[primary->index] = 0;
+ for (i = 1; i <= max_planes; i++) {
+ igt_plane_t *plane = igt_output_get_plane(output, i);
+
+ if (plane->type == DRM_PLANE_TYPE_CURSOR)
size[i] = SIZE_CURSOR;
+ else if (plane->type == DRM_PLANE_TYPE_PRIMARY)
+ continue;
else
size[i] = SIZE_PLANE;
x[i] = rand() % (mode->hdisplay - size[i]);
y[i] = rand() % (mode->vdisplay - size[i]);
- data->plane[i] = igt_output_get_plane(output, i);
+ data->plane[i] = plane;
igt_create_color_fb(data->drm_fd,
size[i], size[i],
- data->plane[i]->is_cursor ? DRM_FORMAT_ARGB8888 : DRM_FORMAT_XRGB8888,
- data->plane[i]->is_cursor ? LOCAL_DRM_FORMAT_MOD_NONE : tiling,
+ data->plane[i]->type == DRM_PLANE_TYPE_CURSOR ? DRM_FORMAT_ARGB8888 : DRM_FORMAT_XRGB8888,
+ data->plane[i]->type == DRM_PLANE_TYPE_CURSOR ? LOCAL_DRM_FORMAT_MOD_NONE : tiling,
color->red, color->green, color->blue,
&data->fb[i]);
@@ -219,10 +251,10 @@ prepare_planes(data_t *data, enum pipe pipe, color_t *color,
}
/* primary plane */
- data->plane[IGT_PLANE_PRIMARY] = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
- create_fb_for_mode_position(data, mode, color, x, y,
+ data->plane[primary->index] = primary;
+ create_fb_for_mode_position(data, output, mode, color, x, y,
size, size, tiling, max_planes);
- igt_plane_set_fb(data->plane[IGT_PLANE_PRIMARY], &data->fb[IGT_PLANE_PRIMARY]);
+ igt_plane_set_fb(data->plane[primary->index], &data->fb[primary->index]);
}
static void
@@ -254,7 +286,7 @@ test_atomic_plane_position_with_output(data_t *data, enum pipe pipe,
igt_output_name(output), kmstest_pipe_name(pipe), max_planes,
info, opt.seed);
- test_init(data, pipe);
+ test_init(data, pipe, max_planes);
test_grab_crc(data, output, pipe, true, &blue, tiling,
&test.reference_crc);
@@ -318,7 +350,7 @@ test_legacy_plane_position_with_output(data_t *data, enum pipe pipe,
igt_output_name(output), kmstest_pipe_name(pipe), max_planes,
info, opt.seed);
- test_init(data, pipe);
+ test_init(data, pipe, max_planes);
test_grab_crc(data, output, pipe, false, &blue, tiling,
&test.reference_crc);
@@ -387,54 +419,71 @@ test_plane_position(data_t *data, enum pipe pipe, bool atomic, int max_planes,
}
static void
-run_tests_for_pipe_plane(data_t *data, enum pipe pipe, int max_planes)
+run_tests_for_pipe_plane(data_t *data, enum pipe pipe)
{
- igt_subtest_f("legacy-pipe-%s-tiling-none-planes-%d",
- kmstest_pipe_name(pipe), max_planes)
- test_plane_position(data, pipe, false, max_planes,
- LOCAL_DRM_FORMAT_MOD_NONE);
-
- igt_subtest_f("atomic-pipe-%s-tiling-none-planes-%d",
- kmstest_pipe_name(pipe), max_planes)
- test_plane_position(data, pipe, true, max_planes,
- LOCAL_I915_FORMAT_MOD_X_TILED);
-
- igt_subtest_f("legacy-pipe-%s-tiling-x-planes-%d",
- kmstest_pipe_name(pipe), max_planes)
- test_plane_position(data, pipe, false, max_planes,
- LOCAL_I915_FORMAT_MOD_X_TILED);
-
- igt_subtest_f("atomic-pipe-%s-tiling-x-planes-%d",
- kmstest_pipe_name(pipe), max_planes)
- test_plane_position(data, pipe, true, max_planes,
- LOCAL_I915_FORMAT_MOD_X_TILED);
-
- igt_subtest_f("legacy-pipe-%s-tiling-y-planes-%d",
- kmstest_pipe_name(pipe), max_planes)
- test_plane_position(data, pipe, false, max_planes,
- LOCAL_I915_FORMAT_MOD_Y_TILED);
-
- igt_subtest_f("atomic-pipe-%s-tiling-y-planes-%d",
- kmstest_pipe_name(pipe), max_planes)
- test_plane_position(data, pipe, true, max_planes,
- LOCAL_I915_FORMAT_MOD_Y_TILED);
-
- igt_subtest_f("legacy-pipe-%s-tiling-yf-planes-%d",
- kmstest_pipe_name(pipe), max_planes)
- test_plane_position(data, pipe, false, max_planes,
- LOCAL_I915_FORMAT_MOD_Yf_TILED);
-
- igt_subtest_f("atomic-pipe-%s-tiling-yf-planes-%d",
- kmstest_pipe_name(pipe), max_planes)
- test_plane_position(data, pipe, true, max_planes,
- LOCAL_I915_FORMAT_MOD_Yf_TILED);
-}
+ igt_subtest_f("legacy-pipe-%s-tiling-none-planes",
+ kmstest_pipe_name(pipe)) {
+ int n_planes = data->display.pipes[pipe].n_planes;
+ for (int planes = 0; planes < n_planes; planes++)
+ test_plane_position(data, pipe, false, planes,
+ LOCAL_DRM_FORMAT_MOD_NONE);
+ }
-static void
-run_tests_for_pipe(data_t *data, enum pipe pipe)
-{
- for (int planes = IGT_PLANE_PRIMARY; planes < IGT_MAX_PLANES; planes++)
- run_tests_for_pipe_plane(data, pipe, planes);
+ igt_subtest_f("atomic-pipe-%s-tiling-none-planes",
+ kmstest_pipe_name(pipe)) {
+ int n_planes = data->display.pipes[pipe].n_planes;
+ for (int planes = 0; planes < n_planes; planes++)
+ test_plane_position(data, pipe, true, planes,
+ LOCAL_I915_FORMAT_MOD_X_TILED);
+ }
+
+ igt_subtest_f("legacy-pipe-%s-tiling-x-planes",
+ kmstest_pipe_name(pipe)) {
+ int n_planes = data->display.pipes[pipe].n_planes;
+ for (int planes = 0; planes < n_planes; planes++)
+ test_plane_position(data, pipe, false, planes,
+ LOCAL_I915_FORMAT_MOD_X_TILED);
+ }
+
+ igt_subtest_f("atomic-pipe-%s-tiling-x-planes",
+ kmstest_pipe_name(pipe)) {
+ int n_planes = data->display.pipes[pipe].n_planes;
+ for (int planes = 0; planes < n_planes; planes++)
+ test_plane_position(data, pipe, true, planes,
+ LOCAL_I915_FORMAT_MOD_X_TILED);
+ }
+
+ igt_subtest_f("legacy-pipe-%s-tiling-y-planes",
+ kmstest_pipe_name(pipe)) {
+ int n_planes = data->display.pipes[pipe].n_planes;
+ for (int planes = 0; planes < n_planes; planes++)
+ test_plane_position(data, pipe, false, planes,
+ LOCAL_I915_FORMAT_MOD_Y_TILED);
+ }
+
+ igt_subtest_f("atomic-pipe-%s-tiling-y-planes",
+ kmstest_pipe_name(pipe)) {
+ int n_planes = data->display.pipes[pipe].n_planes;
+ for (int planes = 0; planes < n_planes; planes++)
+ test_plane_position(data, pipe, true, planes,
+ LOCAL_I915_FORMAT_MOD_Y_TILED);
+ }
+
+ igt_subtest_f("legacy-pipe-%s-tiling-yf-planes",
+ kmstest_pipe_name(pipe)) {
+ int n_planes = data->display.pipes[pipe].n_planes;
+ for (int planes = 0; planes < n_planes; planes++)
+ test_plane_position(data, pipe, false, planes,
+ LOCAL_I915_FORMAT_MOD_Yf_TILED);
+ }
+
+ igt_subtest_f("atomic-pipe-%s-tiling-yf-planes",
+ kmstest_pipe_name(pipe)) {
+ int n_planes = data->display.pipes[pipe].n_planes;
+ for (int planes = 0; planes < n_planes; planes++)
+ test_plane_position(data, pipe, true, planes,
+ LOCAL_I915_FORMAT_MOD_Yf_TILED);
+ }
}
static data_t data;
@@ -481,15 +530,13 @@ int main(int argc, char *argv[])
igt_fixture {
data.drm_fd = drm_open_driver_master(DRIVER_INTEL);
-
kmstest_set_vt_graphics_mode();
-
igt_require_pipe_crc();
igt_display_init(&data.display, data.drm_fd);
}
for (int pipe = 0; pipe < I915_MAX_PIPES; pipe++)
- run_tests_for_pipe(&data, pipe);
+ run_tests_for_pipe_plane(&data, pipe);
igt_fixture {
igt_display_fini(&data.display);
--
2.11.0
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2017-01-11 20:42 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-11 20:41 [PATCH i-g-t rfc 00/29] lib/igt_kms: Implement dynamic plane count support Robert Foss
2017-01-11 20:41 ` [PATCH i-g-t rfc 01/29] lib/igt_debugfs: Prevent buffer overflow Robert Foss
2017-01-12 9:14 ` Lankhorst, Maarten
2017-01-12 16:30 ` Robert Foss
2017-01-12 18:28 ` Lankhorst, Maarten
2017-01-11 20:41 ` [PATCH i-g-t rfc 02/29] lib/igt_kms: Fixed typo Robert Foss
2017-01-11 20:41 ` [PATCH i-g-t rfc 03/29] lib/igt_kms: Implement dynamic plane count support Robert Foss
2017-01-11 20:41 ` [PATCH i-g-t rfc 04/29] tests/kms_atomic_transition: Add support for dynamic number of planes Robert Foss
2017-01-11 20:41 ` [PATCH i-g-t rfc 05/29] tests/kms_busy: " Robert Foss
2017-01-11 20:41 ` [PATCH i-g-t rfc 06/29] tests/kms_chv_cursor_fail: " Robert Foss
2017-01-11 20:41 ` [PATCH i-g-t rfc 07/29] tests/kms_crtc_background_color: " Robert Foss
2017-01-11 20:41 ` [PATCH i-g-t rfc 08/29] tests/kms_cursor_crc: " Robert Foss
2017-01-11 20:41 ` [PATCH i-g-t rfc 09/29] tests/kms_cursor_legacy: " Robert Foss
2017-01-11 20:41 ` [PATCH i-g-t rfc 10/29] tests/kms_fbc_crc: " Robert Foss
2017-01-11 20:41 ` [PATCH i-g-t rfc 11/29] tests/kms_fence_pin_leak: " Robert Foss
2017-01-11 20:41 ` [PATCH i-g-t rfc 12/29] tests/kms_flip_event_leak: " Robert Foss
2017-01-11 20:41 ` [PATCH i-g-t rfc 13/29] tests/kms_legacy_colorkey: " Robert Foss
2017-01-11 20:41 ` [PATCH i-g-t rfc 14/29] tests/kms_mmap_write_crc: " Robert Foss
2017-01-11 20:41 ` [PATCH i-g-t rfc 15/29] tests/kms_mmio_vs_cs_flip: " Robert Foss
2017-01-11 20:41 ` [PATCH i-g-t rfc 16/29] tests/kms_panel_fitting: " Robert Foss
2017-01-11 20:41 ` [PATCH i-g-t rfc 17/29] tests/kms_pipe_color: " Robert Foss
2017-01-11 20:41 ` [PATCH i-g-t rfc 18/29] tests/kms_plane: " Robert Foss
2017-01-11 20:41 ` Robert Foss [this message]
2017-01-11 20:41 ` [PATCH i-g-t rfc 20/29] tests/kms_plane_scaling: " Robert Foss
2017-01-11 20:41 ` [PATCH i-g-t rfc 21/29] tests/kms_properties: " Robert Foss
2017-01-11 20:41 ` [PATCH i-g-t rfc 22/29] tests/kms_psr_sink_crc: " Robert Foss
2017-01-11 20:41 ` [PATCH i-g-t rfc 23/29] tests/kms_pwrite_crc: " Robert Foss
2017-01-11 20:41 ` [PATCH i-g-t rfc 24/29] tests/kms_rmfb: " Robert Foss
2017-01-11 20:42 ` [PATCH i-g-t rfc 25/29] tests/kms_rotation_crc: " Robert Foss
2017-01-11 20:42 ` [PATCH i-g-t rfc 26/29] tests/kms_sink_crc_basic: " Robert Foss
2017-01-11 20:42 ` [PATCH i-g-t rfc 27/29] tests/kms_universal_plane: " Robert Foss
2017-01-11 20:42 ` [PATCH i-g-t rfc 28/29] tests/kms_vblank: " Robert Foss
2017-01-11 20:42 ` [PATCH i-g-t rfc 29/29] tests/prime_mmap_kms: " Robert Foss
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170111204204.7727-20-robert.foss@collabora.com \
--to=robert.foss@collabora.com \
--cc=daniels@collabora.com \
--cc=gustavo.padovan@collabora.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=maarten.lankhorst@intel.com \
--cc=tomeu.vizoso@collabora.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.