* [igt-dev] [PATCH i-g-t 01/12] lib/igt_fb: Make igt_remove_fb more robust
@ 2018-02-06 10:14 Maarten Lankhorst
2018-02-06 10:14 ` [igt-dev] [PATCH i-g-t 02/12] tests: Always call igt_remove_fb without checking Maarten Lankhorst
` (18 more replies)
0 siblings, 19 replies; 39+ messages in thread
From: Maarten Lankhorst @ 2018-02-06 10:14 UTC (permalink / raw)
To: igt-dev
This will make it easier for tests to unconditionally call
igt_remove_fb, without first checking whether the FB is allocated.
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
lib/igt_fb.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index 6fecdd6699a5..35a928b9281d 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -1623,9 +1623,13 @@ void igt_put_cairo_ctx(int fd, struct igt_fb *fb, cairo_t *cr)
*/
void igt_remove_fb(int fd, struct igt_fb *fb)
{
+ if (!fb || !fb->fb_id)
+ return;
+
cairo_surface_destroy(fb->cairo_surface);
do_or_die(drmModeRmFB(fd, fb->fb_id));
gem_close(fd, fb->gem_handle);
+ fb->fb_id = 0;
}
/**
--
2.16.1
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [igt-dev] [PATCH i-g-t 02/12] tests: Always call igt_remove_fb without checking.
2018-02-06 10:14 [igt-dev] [PATCH i-g-t 01/12] lib/igt_fb: Make igt_remove_fb more robust Maarten Lankhorst
@ 2018-02-06 10:14 ` Maarten Lankhorst
2018-02-07 13:42 ` Mika Kahola
2018-02-06 10:14 ` [igt-dev] [PATCH i-g-t 03/12] lib/igt_fb: Add igt_fb_supported_format() Maarten Lankhorst
` (17 subsequent siblings)
18 siblings, 1 reply; 39+ messages in thread
From: Maarten Lankhorst @ 2018-02-06 10:14 UTC (permalink / raw)
To: igt-dev
This cleans up the tests slightly.
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
tests/kms_flip.c | 3 +--
tests/kms_panel_fitting.c | 15 +++------------
tests/kms_plane_scaling.c | 7 +------
tests/kms_rotation_crc.c | 16 ++--------------
tests/kms_setmode.c | 12 +++---------
5 files changed, 10 insertions(+), 43 deletions(-)
diff --git a/tests/kms_flip.c b/tests/kms_flip.c
index b43e77123e7f..3d6fe948d3bb 100644
--- a/tests/kms_flip.c
+++ b/tests/kms_flip.c
@@ -1332,8 +1332,7 @@ static void run_test_on_crtc_set(struct test_output *o, int *crtc_idxs,
igt_info("\n%s: PASSED\n\n", test_name);
out:
- if (o->fb_ids[2])
- igt_remove_fb(drm_fd, &o->fb_info[2]);
+ igt_remove_fb(drm_fd, &o->fb_info[2]);
igt_remove_fb(drm_fd, &o->fb_info[1]);
igt_remove_fb(drm_fd, &o->fb_info[0]);
diff --git a/tests/kms_panel_fitting.c b/tests/kms_panel_fitting.c
index e0ca6cca8e6a..b3cee223a8e7 100644
--- a/tests/kms_panel_fitting.c
+++ b/tests/kms_panel_fitting.c
@@ -51,10 +51,7 @@ static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,
igt_output_set_pipe(output, pipe);
/* before allocating, free if any older fb */
- if (data->fb1.fb_id) {
- igt_remove_fb(data->drm_fd, &data->fb1);
- data->fb1.fb_id = 0;
- }
+ igt_remove_fb(data->drm_fd, &data->fb1);
/* allocate fb for plane 1 */
igt_create_pattern_fb(data->drm_fd,
@@ -83,14 +80,8 @@ static void cleanup_crtc(data_t *data, igt_output_t *output, igt_plane_t *plane)
{
igt_display_t *display = &data->display;
- if (data->fb1.fb_id) {
- igt_remove_fb(data->drm_fd, &data->fb1);
- data->fb1.fb_id = 0;
- }
- if (data->fb2.fb_id) {
- igt_remove_fb(data->drm_fd, &data->fb2);
- data->fb2.fb_id = 0;
- }
+ igt_remove_fb(data->drm_fd, &data->fb1);
+ igt_remove_fb(data->drm_fd, &data->fb2);
if (plane->type != DRM_PLANE_TYPE_PRIMARY) {
igt_plane_t *primary;
diff --git a/tests/kms_plane_scaling.c b/tests/kms_plane_scaling.c
index 208f9262f84b..3171331c96b8 100644
--- a/tests/kms_plane_scaling.c
+++ b/tests/kms_plane_scaling.c
@@ -62,13 +62,8 @@ static void cleanup_fbs(data_t *data)
{
int i;
- for (i = 0; i < ARRAY_SIZE(data->fb); i++) {
- if (!data->fb[i].fb_id)
- continue;
-
+ for (i = 0; i < ARRAY_SIZE(data->fb); i++)
igt_remove_fb(data->drm_fd, &data->fb[i]);
- data->fb[i].fb_id = 0;
- }
}
static void cleanup_crtc(data_t *data)
diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index f65562bae9eb..4f56d3d65db4 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -174,17 +174,10 @@ static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,
static void remove_fbs(data_t *data)
{
- if (!data->fb.fb_id)
- return;
-
igt_remove_fb(data->gfx_fd, &data->fb);
igt_remove_fb(data->gfx_fd, &data->fb_reference);
igt_remove_fb(data->gfx_fd, &data->fb_unrotated);
-
- if (data->fb_flip.fb_id)
- igt_remove_fb(data->gfx_fd, &data->fb_flip);
-
- data->fb_flip.fb_id = data->fb.fb_id = 0;
+ igt_remove_fb(data->gfx_fd, &data->fb_flip);
}
enum rectangle_type {
@@ -205,12 +198,7 @@ static void prepare_fbs(data_t *data, igt_output_t *output,
uint32_t pixel_format = data->override_fmt ?: DRM_FORMAT_XRGB8888;
const float flip_opacity = 0.75;
- if (data->fb.fb_id) {
- igt_plane_set_fb(plane, NULL);
- igt_display_commit2(display, display->is_atomic ? COMMIT_ATOMIC : COMMIT_UNIVERSAL);
-
- remove_fbs(data);
- }
+ remove_fbs(data);
igt_plane_set_rotation(plane, IGT_ROTATION_0);
diff --git a/tests/kms_setmode.c b/tests/kms_setmode.c
index 06241b191a0f..47d04fb5f7b1 100644
--- a/tests/kms_setmode.c
+++ b/tests/kms_setmode.c
@@ -361,6 +361,9 @@ static void cleanup_crtcs(struct crtc_config *crtcs, int crtc_count)
int i;
for (i = 0; i < crtc_count; i++) {
+ igt_remove_fb(drm_fd, &crtcs[i].fb_info);
+ drmModeSetCrtc(drm_fd, crtcs[i].crtc_id, 0, 0, 0, NULL, 0, NULL);
+
free(crtcs[i].cconfs);
}
}
@@ -577,15 +580,6 @@ static void test_crtc_config(const struct test_config *tconf,
if (ret == 0 && tconf->flags & TEST_TIMINGS)
check_timings(crtcs[0].crtc_idx, &crtcs[0].mode);
- for (i = 0; i < crtc_count; i++) {
- if (crtcs[i].fb_info.fb_id) {
- drmModeSetCrtc(drm_fd, crtcs[i].crtc_id, 0, 0, 0, NULL,
- 0, NULL);
- drmModeRmFB(drm_fd, crtcs[i].fb_info.fb_id);
- crtcs[i].fb_info.fb_id = 0;
- }
- }
-
return;
}
--
2.16.1
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [igt-dev] [PATCH i-g-t 03/12] lib/igt_fb: Add igt_fb_supported_format()
2018-02-06 10:14 [igt-dev] [PATCH i-g-t 01/12] lib/igt_fb: Make igt_remove_fb more robust Maarten Lankhorst
2018-02-06 10:14 ` [igt-dev] [PATCH i-g-t 02/12] tests: Always call igt_remove_fb without checking Maarten Lankhorst
@ 2018-02-06 10:14 ` Maarten Lankhorst
2018-02-08 8:08 ` Mika Kahola
2018-02-06 10:14 ` [igt-dev] [PATCH i-g-t 04/12] lib/igt_fb: Remove igt_get_all_cairo_formats() Maarten Lankhorst
` (16 subsequent siblings)
18 siblings, 1 reply; 39+ messages in thread
From: Maarten Lankhorst @ 2018-02-06 10:14 UTC (permalink / raw)
To: igt-dev
This makes it possible to iterate whether a format is supported or not,
without each driver having to open code it.
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
lib/igt_fb.c | 18 ++++++++++++++++++
lib/igt_fb.h | 1 +
tests/kms_atomic.c | 13 +++----------
tests/kms_plane.c | 16 +---------------
tests/kms_plane_scaling.c | 22 ++++------------------
5 files changed, 27 insertions(+), 43 deletions(-)
diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index 35a928b9281d..0389b1c1b159 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -1719,3 +1719,21 @@ void igt_get_all_cairo_formats(const uint32_t **formats, int *format_count)
*formats = drm_formats;
*format_count = n_formats;
}
+
+/**
+ * igt_fb_supported_format:
+ * @drm_format: drm fourcc to test.
+ *
+ * This functions returns whether @drm_format can be succesfully created by
+ * igt_create_fb() and drawn to by igt_get_cairo_ctx().
+ */
+bool igt_fb_supported_format(uint32_t drm_format)
+{
+ struct format_desc_struct *f;
+
+ for_each_format(f)
+ if (f->drm_id == drm_format)
+ return f->cairo_id != CAIRO_FORMAT_INVALID;
+
+ return false;
+}
diff --git a/lib/igt_fb.h b/lib/igt_fb.h
index 77fd88bb7aca..a6ce07898784 100644
--- a/lib/igt_fb.h
+++ b/lib/igt_fb.h
@@ -163,6 +163,7 @@ uint32_t igt_bpp_depth_to_drm_format(int bpp, int depth);
uint32_t igt_drm_format_to_bpp(uint32_t drm_format);
const char *igt_format_str(uint32_t drm_format);
void igt_get_all_cairo_formats(const uint32_t **formats, int *format_count);
+bool igt_fb_supported_format(uint32_t drm_format);
#endif /* __IGT_FB_H__ */
diff --git a/tests/kms_atomic.c b/tests/kms_atomic.c
index 2e21b53b8c87..ac02baf0170b 100644
--- a/tests/kms_atomic.c
+++ b/tests/kms_atomic.c
@@ -264,20 +264,13 @@ static void crtc_commit_atomic_flags_err(igt_pipe_t *pipe, igt_plane_t *plane,
static uint32_t plane_get_igt_format(igt_plane_t *plane)
{
drmModePlanePtr plane_kms;
- const uint32_t *igt_formats;
- int num_igt_formats;
int i;
plane_kms = plane->drm_plane;
- igt_get_all_cairo_formats(&igt_formats, &num_igt_formats);
- for (i = 0; i < num_igt_formats; i++) {
- int j;
-
- for (j = 0; j < plane_kms->count_formats; j++) {
- if (plane_kms->formats[j] == igt_formats[i])
- return plane_kms->formats[j];
- }
+ for (i = 0; i < plane_kms->count_formats; i++) {
+ if (igt_fb_supported_format(plane_kms->formats[i]))
+ return plane_kms->formats[i];
}
return 0;
diff --git a/tests/kms_plane.c b/tests/kms_plane.c
index 54bcffc16f4f..23173b966eab 100644
--- a/tests/kms_plane.c
+++ b/tests/kms_plane.c
@@ -366,20 +366,6 @@ test_plane_panning(data_t *data, enum pipe pipe, unsigned int flags)
igt_skip_on(connected_outs == 0);
}
-static bool can_draw(uint32_t drm_format)
-{
- const uint32_t *drm_formats;
- int format_count, i;
-
- igt_get_all_cairo_formats(&drm_formats, &format_count);
-
- for (i = 0; i < format_count; i++)
- if (drm_formats[i] == drm_format)
- return true;
-
- return false;
-}
-
static void test_format_plane(data_t *data, enum pipe pipe,
igt_output_t *output, igt_plane_t *plane)
{
@@ -420,7 +406,7 @@ static void test_format_plane(data_t *data, enum pipe pipe,
for (i = 0; i < plane->drm_plane->count_formats; i++) {
format = plane->drm_plane->formats[i];
- if (!can_draw(format))
+ if (!igt_fb_supported_format(format))
continue;
igt_debug("Testing format 0x%x on %s.%u\n",
diff --git a/tests/kms_plane_scaling.c b/tests/kms_plane_scaling.c
index 3171331c96b8..7a5470106cd5 100644
--- a/tests/kms_plane_scaling.c
+++ b/tests/kms_plane_scaling.c
@@ -173,20 +173,6 @@ static bool can_rotate(unsigned format)
return true;
}
-static bool can_draw(uint32_t drm_format)
-{
- const uint32_t *drm_formats;
- int format_count, i;
-
- igt_get_all_cairo_formats(&drm_formats, &format_count);
-
- for (i = 0; i < format_count; i++)
- if (drm_formats[i] == drm_format)
- return true;
-
- return false;
-}
-
static void test_scaler_with_rotation_pipe(data_t *d, enum pipe pipe,
igt_output_t *output)
{
@@ -202,7 +188,7 @@ static void test_scaler_with_rotation_pipe(data_t *d, enum pipe pipe,
igt_rotation_t rot = rotations[i];
for (int j = 0; j < plane->drm_plane->count_formats; j++) {
unsigned format = plane->drm_plane->formats[j];
- if (can_draw(format) && can_rotate(format))
+ if (igt_fb_supported_format(format) && can_rotate(format))
check_scaling_pipe_plane_rot(d, plane, format,
LOCAL_I915_FORMAT_MOD_Y_TILED,
pipe, output, rot);
@@ -235,7 +221,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];
- if (can_draw(format))
+ if (igt_fb_supported_format(format))
check_scaling_pipe_plane_rot(d, plane,
format, tiling,
pipe, output, IGT_ROTATION_0);
@@ -446,13 +432,13 @@ test_scaler_with_clipping_clamping_scenario(data_t *d, enum pipe pipe, igt_outpu
for (int i = 0; i < d->plane1->drm_plane->count_formats; i++) {
unsigned f1 = d->plane1->drm_plane->formats[i];
- if (!can_draw(f1))
+ if (!igt_fb_supported_format(f1))
continue;
for (int j = 0; j < d->plane2->drm_plane->count_formats; j++) {
unsigned f2 = d->plane2->drm_plane->formats[j];
- if (!can_draw(f2))
+ if (!igt_fb_supported_format(f2))
continue;
__test_scaler_with_clipping_clamping_scenario(d, mode, f1, f2);
--
2.16.1
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [igt-dev] [PATCH i-g-t 04/12] lib/igt_fb: Remove igt_get_all_cairo_formats()
2018-02-06 10:14 [igt-dev] [PATCH i-g-t 01/12] lib/igt_fb: Make igt_remove_fb more robust Maarten Lankhorst
2018-02-06 10:14 ` [igt-dev] [PATCH i-g-t 02/12] tests: Always call igt_remove_fb without checking Maarten Lankhorst
2018-02-06 10:14 ` [igt-dev] [PATCH i-g-t 03/12] lib/igt_fb: Add igt_fb_supported_format() Maarten Lankhorst
@ 2018-02-06 10:14 ` Maarten Lankhorst
2018-02-08 8:15 ` Mika Kahola
2018-02-06 10:14 ` [igt-dev] [PATCH i-g-t 05/12] lib/igt_debugfs: Add igt_pipe_crc_get_single and igt_pipe_crc_drain Maarten Lankhorst
` (15 subsequent siblings)
18 siblings, 1 reply; 39+ messages in thread
From: Maarten Lankhorst @ 2018-02-06 10:14 UTC (permalink / raw)
To: igt-dev
All users have been converted to igt_fb_supported_format(),
I don't think there's a valid use left for this.
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
lib/igt_fb.c | 33 ---------------------------------
lib/igt_fb.h | 1 -
2 files changed, 34 deletions(-)
diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index 0389b1c1b159..ecd73053f16f 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -1687,39 +1687,6 @@ const char *igt_format_str(uint32_t drm_format)
return f ? f->name : "invalid";
}
-/**
- * igt_get_all_cairo_formats:
- * @formats: pointer to pointer to store the allocated formats array
- * @format_count: pointer to integer to store the size of the allocated array
- *
- * This functions returns an array of all the drm fourcc codes supported by
- * cairo and this library.
- */
-void igt_get_all_cairo_formats(const uint32_t **formats, int *format_count)
-{
- static uint32_t *drm_formats;
- static int n_formats;
-
- if (!drm_formats) {
- struct format_desc_struct *f;
- uint32_t *format;
-
- n_formats = 0;
- for_each_format(f)
- if (f->cairo_id != CAIRO_FORMAT_INVALID)
- n_formats++;
-
- drm_formats = calloc(n_formats, sizeof(*drm_formats));
- format = &drm_formats[0];
- for_each_format(f)
- if (f->cairo_id != CAIRO_FORMAT_INVALID)
- *format++ = f->drm_id;
- }
-
- *formats = drm_formats;
- *format_count = n_formats;
-}
-
/**
* igt_fb_supported_format:
* @drm_format: drm fourcc to test.
diff --git a/lib/igt_fb.h b/lib/igt_fb.h
index a6ce07898784..023b069db592 100644
--- a/lib/igt_fb.h
+++ b/lib/igt_fb.h
@@ -162,7 +162,6 @@ int igt_cairo_printf_line(cairo_t *cr, enum igt_text_align align,
uint32_t igt_bpp_depth_to_drm_format(int bpp, int depth);
uint32_t igt_drm_format_to_bpp(uint32_t drm_format);
const char *igt_format_str(uint32_t drm_format);
-void igt_get_all_cairo_formats(const uint32_t **formats, int *format_count);
bool igt_fb_supported_format(uint32_t drm_format);
#endif /* __IGT_FB_H__ */
--
2.16.1
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [igt-dev] [PATCH i-g-t 05/12] lib/igt_debugfs: Add igt_pipe_crc_get_single and igt_pipe_crc_drain.
2018-02-06 10:14 [igt-dev] [PATCH i-g-t 01/12] lib/igt_fb: Make igt_remove_fb more robust Maarten Lankhorst
` (2 preceding siblings ...)
2018-02-06 10:14 ` [igt-dev] [PATCH i-g-t 04/12] lib/igt_fb: Remove igt_get_all_cairo_formats() Maarten Lankhorst
@ 2018-02-06 10:14 ` Maarten Lankhorst
2018-02-06 16:11 ` Ville Syrjälä
2018-02-06 10:14 ` [igt-dev] [PATCH i-g-t 06/12] tests/kms_rotation_crc: Fix bad-tiling testcase Maarten Lankhorst
` (14 subsequent siblings)
18 siblings, 1 reply; 39+ messages in thread
From: Maarten Lankhorst @ 2018-02-06 10:14 UTC (permalink / raw)
To: igt-dev
Collecting CRC may result in a modeset and extra vblank waits. On some
tests this will increase the runtime a lot, so it makes sense to
keep it enabled, and only collect the most recent CRC when needed.
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
lib/igt_debugfs.c | 73 ++++++++++++++++++++++++++++++++++++++++++++---
lib/igt_debugfs.h | 2 ++
tests/kms_cursor_legacy.c | 21 ++++----------
3 files changed, 76 insertions(+), 20 deletions(-)
diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
index 1aec079c52bb..ad3e7bcf38fa 100644
--- a/lib/igt_debugfs.c
+++ b/lib/igt_debugfs.c
@@ -33,6 +33,7 @@
#include <limits.h>
#include <string.h>
#include <fcntl.h>
+#include <poll.h>
#include <unistd.h>
#include <i915_drm.h>
@@ -697,7 +698,7 @@ static bool pipe_crc_init_from_string(igt_pipe_crc_t *pipe_crc, igt_crc_t *crc,
return true;
}
-static int read_crc(igt_pipe_crc_t *pipe_crc, igt_crc_t *out)
+static int read_crc(igt_pipe_crc_t *pipe_crc, igt_crc_t *out, bool override_nonblock)
{
ssize_t bytes_read;
char buf[MAX_LINE_LEN + 1];
@@ -706,7 +707,7 @@ static int read_crc(igt_pipe_crc_t *pipe_crc, igt_crc_t *out)
bytes_read = read(pipe_crc->crc_fd, &buf, MAX_LINE_LEN);
igt_reset_timeout();
- if (bytes_read < 0 && errno == EAGAIN)
+ if (bytes_read < 0 && errno == EAGAIN && !override_nonblock)
igt_assert(pipe_crc->flags & O_NONBLOCK);
if (bytes_read < 0)
@@ -722,7 +723,7 @@ static int read_crc(igt_pipe_crc_t *pipe_crc, igt_crc_t *out)
static void read_one_crc(igt_pipe_crc_t *pipe_crc, igt_crc_t *out)
{
- while (read_crc(pipe_crc, out) == 0)
+ while (read_crc(pipe_crc, out, false) == 0)
usleep(1000);
}
@@ -794,7 +795,7 @@ igt_pipe_crc_get_crcs(igt_pipe_crc_t *pipe_crc, int n_crcs,
igt_crc_t *crc = &crcs[n];
int ret;
- ret = read_crc(pipe_crc, crc);
+ ret = read_crc(pipe_crc, crc, false);
if (ret < 0)
continue;
if (ret == 0)
@@ -854,6 +855,70 @@ void igt_pipe_crc_collect_crc(igt_pipe_crc_t *pipe_crc, igt_crc_t *out_crc)
crc_sanity_checks(out_crc);
}
+/**
+ * igt_pipe_crc_drain:
+ * @pipe_crc: pipe CRC object
+ *
+ * Discards all currently queued CRC values from @pipe_crc. This function does
+ * not block, and is useful to flush @pipe_crc. Afterwards you can get a fresh
+ * CRC with igt_pipe_crc_get_single().
+ */
+void igt_pipe_crc_drain(igt_pipe_crc_t *pipe_crc)
+{
+ igt_crc_t crc;
+ int ret;
+
+ fcntl(pipe_crc->crc_fd, F_SETFL, pipe_crc->flags | O_NONBLOCK);
+ do {
+ ret = read_crc(pipe_crc, &crc, true);
+ } while (ret > 0 || errno == EINTR);
+ fcntl(pipe_crc->crc_fd, F_SETFL, pipe_crc->flags);
+}
+
+/**
+ * igt_pipe_crc_get_single:
+ * @pipe_crc: pipe CRC object
+ * @crc: buffer pointer for the captured CRC value
+ *
+ * Read a single @crc from @pipe_crc. This function does not block
+ * when nonblocking CRC is requested, and will return false if no CRC
+ * can be captured.
+ *
+ * If opened in blocking mode it will always block until a new CRC is read, like
+ * igt_pipe_crc_collect_crc().
+ *
+ * Callers must start and stop the capturing themselves by calling
+ * igt_pipe_crc_start() and igt_pipe_crc_stop(). For one-shot CRC collecting
+ * look at igt_pipe_crc_collect_crc().
+ *
+ * If capturing has been going on for a while and a fresh crc is required,
+ * you will need to call igt_pipe_crc_drain() first to remove stale entries.
+ *
+ * Returns:
+ * Whether a crc is captured, only false in non-blocking mode.
+ */
+bool
+igt_pipe_crc_get_single(igt_pipe_crc_t *pipe_crc, igt_crc_t *crc)
+{
+ bool found = true;
+
+ if (pipe_crc->flags & O_NONBLOCK) {
+ int ret;
+
+ do {
+ ret = read_crc(pipe_crc, crc, false);
+ } while (ret < 0);
+
+ found = ret;
+ } else
+ read_one_crc(pipe_crc, crc);
+
+ if (found)
+ crc_sanity_checks(crc);
+
+ return found;
+}
+
/*
* Drop caches
*/
diff --git a/lib/igt_debugfs.h b/lib/igt_debugfs.h
index d90dd7a68bb0..8d25abfe43c1 100644
--- a/lib/igt_debugfs.h
+++ b/lib/igt_debugfs.h
@@ -130,6 +130,8 @@ void igt_pipe_crc_stop(igt_pipe_crc_t *pipe_crc);
__attribute__((warn_unused_result))
int igt_pipe_crc_get_crcs(igt_pipe_crc_t *pipe_crc, int n_crcs,
igt_crc_t **out_crcs);
+void igt_pipe_crc_drain(igt_pipe_crc_t *pipe_crc);
+bool igt_pipe_crc_get_single(igt_pipe_crc_t *pipe_crc, igt_crc_t *out_crc);
void igt_pipe_crc_collect_crc(igt_pipe_crc_t *pipe_crc, igt_crc_t *out_crc);
void igt_hpd_storm_set_threshold(int fd, unsigned int threshold);
diff --git a/tests/kms_cursor_legacy.c b/tests/kms_cursor_legacy.c
index 5011e78e5c2f..d0a28b3c442c 100644
--- a/tests/kms_cursor_legacy.c
+++ b/tests/kms_cursor_legacy.c
@@ -1276,7 +1276,7 @@ static void flip_vs_cursor_busy_crc(igt_display_t *display, bool atomic)
enum pipe pipe = find_connected_pipe(display, false);
igt_pipe_t *pipe_connected = &display->pipes[pipe];
igt_plane_t *plane_primary = igt_pipe_get_plane_type(pipe_connected, DRM_PLANE_TYPE_PRIMARY);
- igt_crc_t crcs[2];
+ igt_crc_t crcs[2], test_crc;
if (atomic)
igt_require(display->is_atomic);
@@ -1290,7 +1290,7 @@ static void flip_vs_cursor_busy_crc(igt_display_t *display, bool atomic)
igt_display_commit2(display, display->is_atomic ? COMMIT_ATOMIC : COMMIT_LEGACY);
- pipe_crc = igt_pipe_crc_new_nonblock(display->drm_fd, pipe, INTEL_PIPE_CRC_SOURCE_AUTO);
+ pipe_crc = igt_pipe_crc_new(display->drm_fd, pipe, INTEL_PIPE_CRC_SOURCE_AUTO);
set_cursor_on_pipe(display, pipe, &cursor_fb);
igt_display_commit2(display, COMMIT_UNIVERSAL);
@@ -1322,9 +1322,6 @@ static void flip_vs_cursor_busy_crc(igt_display_t *display, bool atomic)
/* Disable cursor, and immediately queue a flip. Check if resulting crc is correct. */
for (int i = 1; i >= 0; i--) {
igt_spin_t *spin;
- igt_crc_t *received_crcs = NULL;
- int ncrcs;
- static const int max_crcs = 8;
spin = igt_spin_batch_new(display->drm_fd, 0, 0,
fb_info[1].gem_handle);
@@ -1336,7 +1333,8 @@ static void flip_vs_cursor_busy_crc(igt_display_t *display, bool atomic)
igt_assert_eq(get_vblank(display->drm_fd, pipe, 0), vblank_start);
- ncrcs = igt_pipe_crc_get_crcs(pipe_crc, max_crcs, &received_crcs);
+ igt_pipe_crc_drain(pipe_crc);
+ igt_pipe_crc_get_single(pipe_crc, &test_crc);
igt_spin_batch_free(display->drm_fd, spin);
@@ -1349,16 +1347,7 @@ static void flip_vs_cursor_busy_crc(igt_display_t *display, bool atomic)
igt_plane_set_fb(plane_primary, &fb_info[0]);
igt_display_commit2(display, COMMIT_UNIVERSAL);
- /*
- * We collect the crc nonblockingly, and should have at least 1
- * but not so many crcs that we overflow. Last CRC is the only
- * one we care about here. Other CRCs may have been from before
- * the cursor update and can contain garbage.
- */
- igt_assert(ncrcs > 0 && ncrcs < max_crcs);
-
- igt_assert_crc_equal(&crcs[i], &received_crcs[ncrcs - 1]);
- free(received_crcs);
+ igt_assert_crc_equal(&crcs[i], &test_crc);
}
igt_remove_fb(display->drm_fd, &fb_info[1]);
--
2.16.1
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [igt-dev] [PATCH i-g-t 06/12] tests/kms_rotation_crc: Fix bad-tiling testcase.
2018-02-06 10:14 [igt-dev] [PATCH i-g-t 01/12] lib/igt_fb: Make igt_remove_fb more robust Maarten Lankhorst
` (3 preceding siblings ...)
2018-02-06 10:14 ` [igt-dev] [PATCH i-g-t 05/12] lib/igt_debugfs: Add igt_pipe_crc_get_single and igt_pipe_crc_drain Maarten Lankhorst
@ 2018-02-06 10:14 ` Maarten Lankhorst
2018-02-08 12:08 ` Mika Kahola
2018-02-08 12:19 ` Mika Kahola
2018-02-06 10:14 ` [igt-dev] [PATCH i-g-t 07/12] tests/kms_rotation_crc: Move bad_format parameter to test_plane_rotation Maarten Lankhorst
` (13 subsequent siblings)
18 siblings, 2 replies; 39+ messages in thread
From: Maarten Lankhorst @ 2018-02-06 10:14 UTC (permalink / raw)
To: igt-dev
bad-tiling test didn't work, LOCAL_DRM_FORMAT_MODE_NONE == 0, so
the fb was created with tiling = Y, but because test_bad_format
was set but override_tiling wasn't, we fell through to the success
case. Always assume failure if test_bad_format is set, and pass X
tiled for fb, so the format override works.
Also clear variables after subtests in main, so if the next subtest
doesn't run we still clear the variables.
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
tests/kms_rotation_crc.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index 4f56d3d65db4..37e911846c88 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -411,7 +411,7 @@ static void __test_plane_rotation(data_t *data, int plane_type, bool test_bad_fo
igt_plane_set_size(plane, data->fb.height, data->fb.width);
ret = igt_display_try_commit2(display, commit);
- if (test_bad_format && (data->override_fmt || data->override_tiling)) {
+ if (test_bad_format) {
igt_assert_eq(ret, -EINVAL);
continue;
}
@@ -775,6 +775,7 @@ igt_main
test_plane_rotation(&data, subtest->plane);
}
}
+ data.flips = 0;
igt_subtest_f("sprite-rotation-90-pos-100-0") {
igt_require(gen >= 9);
@@ -783,23 +784,24 @@ igt_main
data.pos_y = 0;
test_plane_rotation(&data, DRM_PLANE_TYPE_OVERLAY);
}
+ data.pos_x = 0,
+ data.pos_y = 0;
igt_subtest_f("bad-pixel-format") {
igt_require(gen >= 9);
- data.pos_x = 0,
- data.pos_y = 0;
data.rotation = IGT_ROTATION_90;
data.override_fmt = DRM_FORMAT_RGB565;
test_bad_plane_rotation(&data, DRM_PLANE_TYPE_PRIMARY);
}
+ data.override_fmt = 0;
igt_subtest_f("bad-tiling") {
igt_require(gen >= 9);
- data.override_fmt = 0;
data.rotation = IGT_ROTATION_90;
- data.override_tiling = LOCAL_DRM_FORMAT_MOD_NONE;
+ data.override_tiling = LOCAL_I915_FORMAT_MOD_X_TILED;
test_bad_plane_rotation(&data, DRM_PLANE_TYPE_PRIMARY);
}
+ data.override_tiling = 0;
igt_subtest_f("primary-rotation-90-Y-tiled") {
enum pipe pipe;
--
2.16.1
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [igt-dev] [PATCH i-g-t 07/12] tests/kms_rotation_crc: Move bad_format parameter to test_plane_rotation
2018-02-06 10:14 [igt-dev] [PATCH i-g-t 01/12] lib/igt_fb: Make igt_remove_fb more robust Maarten Lankhorst
` (4 preceding siblings ...)
2018-02-06 10:14 ` [igt-dev] [PATCH i-g-t 06/12] tests/kms_rotation_crc: Fix bad-tiling testcase Maarten Lankhorst
@ 2018-02-06 10:14 ` Maarten Lankhorst
2018-02-08 13:07 ` Mika Kahola
2018-02-06 10:14 ` [igt-dev] [PATCH i-g-t 08/12] tests/kms_rotation_crc: Always run the flip tests when available Maarten Lankhorst
` (12 subsequent siblings)
18 siblings, 1 reply; 39+ messages in thread
From: Maarten Lankhorst @ 2018-02-06 10:14 UTC (permalink / raw)
To: igt-dev
Instead of 2 functions doing the same thing, consolidate to a single function.
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
tests/kms_rotation_crc.c | 22 ++++++----------------
1 file changed, 6 insertions(+), 16 deletions(-)
diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index 37e911846c88..e8cdbfccbe0a 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -356,7 +356,7 @@ static void wait_for_pageflip(int fd)
igt_assert(drmHandleEvent(fd, &evctx) == 0);
}
-static void __test_plane_rotation(data_t *data, int plane_type, bool test_bad_format)
+static void test_plane_rotation(data_t *data, int plane_type, bool test_bad_format)
{
igt_display_t *display = &data->display;
igt_output_t *output;
@@ -456,16 +456,6 @@ static void __test_plane_rotation(data_t *data, int plane_type, bool test_bad_fo
igt_require_f(valid_tests, "no valid crtc/connector combinations found\n");
}
-static inline void test_bad_plane_rotation(data_t *data, int plane_type)
-{
- __test_plane_rotation(data, plane_type, true);
-}
-
-static inline void test_plane_rotation(data_t *data, int plane_type)
-{
- __test_plane_rotation(data, plane_type, false);
-}
-
static void test_plane_rotation_ytiled_obj(data_t *data,
igt_output_t *output,
int plane_type)
@@ -772,7 +762,7 @@ igt_main
gen >= 9);
data.rotation = subtest->rot;
data.flips = subtest->flips;
- test_plane_rotation(&data, subtest->plane);
+ test_plane_rotation(&data, subtest->plane, false);
}
}
data.flips = 0;
@@ -782,7 +772,7 @@ igt_main
data.rotation = IGT_ROTATION_90;
data.pos_x = 100,
data.pos_y = 0;
- test_plane_rotation(&data, DRM_PLANE_TYPE_OVERLAY);
+ test_plane_rotation(&data, DRM_PLANE_TYPE_OVERLAY, false);
}
data.pos_x = 0,
data.pos_y = 0;
@@ -791,7 +781,7 @@ igt_main
igt_require(gen >= 9);
data.rotation = IGT_ROTATION_90;
data.override_fmt = DRM_FORMAT_RGB565;
- test_bad_plane_rotation(&data, DRM_PLANE_TYPE_PRIMARY);
+ test_plane_rotation(&data, DRM_PLANE_TYPE_PRIMARY, true);
}
data.override_fmt = 0;
@@ -799,7 +789,7 @@ igt_main
igt_require(gen >= 9);
data.rotation = IGT_ROTATION_90;
data.override_tiling = LOCAL_I915_FORMAT_MOD_X_TILED;
- test_bad_plane_rotation(&data, DRM_PLANE_TYPE_PRIMARY);
+ test_plane_rotation(&data, DRM_PLANE_TYPE_PRIMARY, true);
}
data.override_tiling = 0;
@@ -834,7 +824,7 @@ igt_main
data.rotation = (IGT_REFLECT_X | reflect_x->rot);
data.override_tiling = reflect_x->tiling;
data.flips = reflect_x->flips;
- test_plane_rotation(&data, DRM_PLANE_TYPE_PRIMARY);
+ test_plane_rotation(&data, DRM_PLANE_TYPE_PRIMARY, false);
}
}
--
2.16.1
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [igt-dev] [PATCH i-g-t 08/12] tests/kms_rotation_crc: Always run the flip tests when available.
2018-02-06 10:14 [igt-dev] [PATCH i-g-t 01/12] lib/igt_fb: Make igt_remove_fb more robust Maarten Lankhorst
` (5 preceding siblings ...)
2018-02-06 10:14 ` [igt-dev] [PATCH i-g-t 07/12] tests/kms_rotation_crc: Move bad_format parameter to test_plane_rotation Maarten Lankhorst
@ 2018-02-06 10:14 ` Maarten Lankhorst
2018-02-06 10:14 ` [igt-dev] [PATCH i-g-t 09/12] tests/kms_rotation_crc: Remove primary-rotation-90-Y-tiled Maarten Lankhorst
` (11 subsequent siblings)
18 siblings, 0 replies; 39+ messages in thread
From: Maarten Lankhorst @ 2018-02-06 10:14 UTC (permalink / raw)
To: igt-dev
The -flip tests are the same, but with a pageflip at the end,
since the test is otherwise the same, run the test once with flips
always enabled when possible.
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
tests/kms_rotation_crc.c | 106 +++++++++++++++--------------------------------
1 file changed, 34 insertions(+), 72 deletions(-)
diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index e8cdbfccbe0a..7f50624a7425 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -43,7 +43,6 @@ typedef struct {
int pos_y;
uint32_t override_fmt;
uint64_t override_tiling;
- bool flips;
int devid;
} data_t;
@@ -248,7 +247,7 @@ static void prepare_fbs(data_t *data, igt_output_t *output,
/*
* Create a reference software rotated flip framebuffer.
*/
- if (data->flips) {
+ if (plane->type == DRM_PLANE_TYPE_PRIMARY || display->is_atomic) {
igt_create_fb(data->gfx_fd, ref_w, ref_h, pixel_format, tiling,
&data->fb_flip);
paint_squares(data, data->rotation, &data->fb_flip,
@@ -260,6 +259,15 @@ static void prepare_fbs(data_t *data, igt_output_t *output,
display->is_atomic ?
COMMIT_ATOMIC : COMMIT_UNIVERSAL);
igt_pipe_crc_collect_crc(data->pipe_crc, &data->flip_crc);
+
+ /*
+ * Prepare the non-rotated flip fb.
+ */
+ igt_remove_fb(data->gfx_fd, &data->fb_flip);
+ 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);
}
/*
@@ -296,18 +304,6 @@ static void prepare_fbs(data_t *data, igt_output_t *output,
if (plane->type != DRM_PLANE_TYPE_CURSOR)
igt_plane_set_position(plane, data->pos_x, data->pos_y);
-
- /*
- * Prepare the non-rotated flip fb.
- */
- if (data->flips) {
- igt_remove_fb(data->gfx_fd, &data->fb_flip);
- 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);
- }
-
}
static void cleanup_crtc(data_t *data, igt_output_t *output, igt_plane_t *plane)
@@ -366,9 +362,6 @@ static void test_plane_rotation(data_t *data, int plane_type, bool test_bad_form
enum igt_commit_style commit = COMMIT_LEGACY;
int ret;
- if (data->flips && plane_type != DRM_PLANE_TYPE_PRIMARY)
- igt_require(data->display.is_atomic);
-
if (plane_type == DRM_PLANE_TYPE_PRIMARY || plane_type == DRM_PLANE_TYPE_CURSOR)
commit = COMMIT_UNIVERSAL;
@@ -427,7 +420,7 @@ static void test_plane_rotation(data_t *data, int plane_type, bool test_bad_form
* If flips are requested flip to a different fb and
* check CRC against that one as well.
*/
- if (data->flips) {
+ if (data->fb_flip.fb_id) {
igt_plane_set_fb(plane, &data->fb_flip);
if (data->rotation == IGT_ROTATION_90 || data->rotation == IGT_ROTATION_270)
igt_plane_set_size(plane, data->fb.height, data->fb.width);
@@ -676,63 +669,37 @@ static const char *tiling_test_str(uint64_t tiling)
}
}
-static const char *flip_test_str(unsigned flips)
-{
- if (flips)
- return "-flip";
- else
- return "";
-}
-
igt_main
{
struct rot_subtest {
unsigned plane;
igt_rotation_t rot;
- bool flips;
} *subtest, subtests[] = {
- { DRM_PLANE_TYPE_PRIMARY, IGT_ROTATION_90, 0 },
- { DRM_PLANE_TYPE_PRIMARY, IGT_ROTATION_180, 0 },
- { DRM_PLANE_TYPE_PRIMARY, IGT_ROTATION_270, 0 },
- { DRM_PLANE_TYPE_PRIMARY, IGT_ROTATION_90, 1 },
- { DRM_PLANE_TYPE_PRIMARY, IGT_ROTATION_180, 1 },
- { DRM_PLANE_TYPE_PRIMARY, IGT_ROTATION_270, 1 },
- { DRM_PLANE_TYPE_OVERLAY, IGT_ROTATION_90, 0 },
- { DRM_PLANE_TYPE_OVERLAY, IGT_ROTATION_180, 0 },
- { DRM_PLANE_TYPE_OVERLAY, IGT_ROTATION_270, 0 },
- { DRM_PLANE_TYPE_OVERLAY, IGT_ROTATION_90, 1 },
- { DRM_PLANE_TYPE_OVERLAY, IGT_ROTATION_180, 1 },
- { DRM_PLANE_TYPE_OVERLAY, IGT_ROTATION_270, 1 },
- { DRM_PLANE_TYPE_CURSOR, IGT_ROTATION_180, 0 },
- { 0, 0, 0}
+ { DRM_PLANE_TYPE_PRIMARY, IGT_ROTATION_90 },
+ { DRM_PLANE_TYPE_PRIMARY, IGT_ROTATION_180 },
+ { DRM_PLANE_TYPE_PRIMARY, IGT_ROTATION_270 },
+ { DRM_PLANE_TYPE_OVERLAY, IGT_ROTATION_90 },
+ { DRM_PLANE_TYPE_OVERLAY, IGT_ROTATION_180 },
+ { DRM_PLANE_TYPE_OVERLAY, IGT_ROTATION_270 },
+ { DRM_PLANE_TYPE_CURSOR, IGT_ROTATION_180 },
+ { 0, 0}
};
struct reflect_x {
uint64_t tiling;
igt_rotation_t rot;
- bool flips;
} *reflect_x, reflect_x_subtests[] = {
- { LOCAL_I915_FORMAT_MOD_X_TILED, IGT_ROTATION_0, 0 },
- { LOCAL_I915_FORMAT_MOD_X_TILED, IGT_ROTATION_180, 0 },
- { LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_0, 0 },
- { LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_90, 0 },
- { LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_180, 0 },
- { LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_270, 0 },
- { LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_0, 0 },
- { LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_90, 0 },
- { LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_180, 0 },
- { LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_270, 0 },
- { LOCAL_I915_FORMAT_MOD_X_TILED, IGT_ROTATION_0, 1 },
- { LOCAL_I915_FORMAT_MOD_X_TILED, IGT_ROTATION_180, 1 },
- { LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_0, 1 },
- { LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_90, 1 },
- { LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_180, 1 },
- { LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_270, 1 },
- { LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_0, 1 },
- { LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_90, 1 },
- { LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_180, 1 },
- { LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_270, 1 },
- { 0, 0, 0 }
+ { LOCAL_I915_FORMAT_MOD_X_TILED, IGT_ROTATION_0 },
+ { LOCAL_I915_FORMAT_MOD_X_TILED, IGT_ROTATION_180 },
+ { LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_0 },
+ { LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_90 },
+ { LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_180 },
+ { LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_270 },
+ { LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_0 },
+ { LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_90 },
+ { LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_180 },
+ { LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_270 },
+ { 0, 0 }
};
data_t data = {};
@@ -753,19 +720,16 @@ igt_main
}
for (subtest = subtests; subtest->rot; subtest++) {
- igt_subtest_f("%s-rotation-%s%s",
+ igt_subtest_f("%s-rotation-%s",
plane_test_str(subtest->plane),
- rot_test_str(subtest->rot),
- flip_test_str(subtest->flips)) {
+ rot_test_str(subtest->rot)) {
igt_require(!(subtest->rot &
(IGT_ROTATION_90 | IGT_ROTATION_270)) ||
gen >= 9);
data.rotation = subtest->rot;
- data.flips = subtest->flips;
test_plane_rotation(&data, subtest->plane, false);
}
}
- data.flips = 0;
igt_subtest_f("sprite-rotation-90-pos-100-0") {
igt_require(gen >= 9);
@@ -814,16 +778,14 @@ igt_main
}
for (reflect_x = reflect_x_subtests; reflect_x->tiling; reflect_x++) {
- igt_subtest_f("primary-%s-reflect-x-%s%s",
+ igt_subtest_f("primary-%s-reflect-x-%s",
tiling_test_str(reflect_x->tiling),
- rot_test_str(reflect_x->rot),
- flip_test_str(reflect_x->flips)) {
+ rot_test_str(reflect_x->rot)) {
igt_require(gen >= 10 ||
(IS_CHERRYVIEW(data.devid) && reflect_x->rot == IGT_ROTATION_0
&& reflect_x->tiling == LOCAL_I915_FORMAT_MOD_X_TILED));
data.rotation = (IGT_REFLECT_X | reflect_x->rot);
data.override_tiling = reflect_x->tiling;
- data.flips = reflect_x->flips;
test_plane_rotation(&data, DRM_PLANE_TYPE_PRIMARY, false);
}
}
--
2.16.1
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [igt-dev] [PATCH i-g-t 09/12] tests/kms_rotation_crc: Remove primary-rotation-90-Y-tiled.
2018-02-06 10:14 [igt-dev] [PATCH i-g-t 01/12] lib/igt_fb: Make igt_remove_fb more robust Maarten Lankhorst
` (6 preceding siblings ...)
2018-02-06 10:14 ` [igt-dev] [PATCH i-g-t 08/12] tests/kms_rotation_crc: Always run the flip tests when available Maarten Lankhorst
@ 2018-02-06 10:14 ` Maarten Lankhorst
2018-02-09 8:25 ` Kahola, Mika
2018-02-06 10:14 ` [igt-dev] [PATCH i-g-t 10/12] tests/kms_rotation_crc: Perform lazy cleanup and require atomic Maarten Lankhorst
` (10 subsequent siblings)
18 siblings, 1 reply; 39+ messages in thread
From: Maarten Lankhorst @ 2018-02-06 10:14 UTC (permalink / raw)
To: igt-dev
This is already tested by the rotation tests, which require Y-tiled
for 90° and 270° rotations.
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
tests/kms_rotation_crc.c | 84 ------------------------------------------------
1 file changed, 84 deletions(-)
diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index 7f50624a7425..74a611022d5a 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -449,70 +449,6 @@ static void test_plane_rotation(data_t *data, int plane_type, bool test_bad_form
igt_require_f(valid_tests, "no valid crtc/connector combinations found\n");
}
-static void test_plane_rotation_ytiled_obj(data_t *data,
- igt_output_t *output,
- int plane_type)
-{
- igt_display_t *display = &data->display;
- uint64_t tiling = LOCAL_I915_FORMAT_MOD_Y_TILED;
- uint32_t format = DRM_FORMAT_XRGB8888;
- int bpp = igt_drm_format_to_bpp(format);
- enum igt_commit_style commit = COMMIT_LEGACY;
- int fd = data->gfx_fd;
- igt_plane_t *plane;
- drmModeModeInfo *mode;
- unsigned int stride, size, w, h;
- uint32_t gem_handle;
- int ret;
-
- plane = igt_output_get_plane_type(output, plane_type);
- igt_require(igt_plane_has_prop(plane, IGT_PLANE_ROTATION));
-
- if (plane_type == DRM_PLANE_TYPE_PRIMARY || plane_type == DRM_PLANE_TYPE_CURSOR)
- commit = COMMIT_UNIVERSAL;
-
- if (plane_type == DRM_PLANE_TYPE_CURSOR)
- igt_require(display->has_cursor_plane);
-
- if (data->display.is_atomic)
- commit = COMMIT_ATOMIC;
-
- mode = igt_output_get_mode(output);
- w = mode->hdisplay;
- h = mode->vdisplay;
-
- for (stride = 512; stride < (w * bpp / 8); stride *= 2)
- ;
- for (size = 1024*1024; size < stride * h; size *= 2)
- ;
-
- gem_handle = gem_create(fd, size);
- ret = __gem_set_tiling(fd, gem_handle, I915_TILING_Y, stride);
- igt_assert_eq(ret, 0);
-
- do_or_die(__kms_addfb(fd, gem_handle, w, h, stride,
- format, tiling, NULL, LOCAL_DRM_MODE_FB_MODIFIERS,
- &data->fb.fb_id));
- data->fb.width = w;
- data->fb.height = h;
- data->fb.gem_handle = gem_handle;
-
- igt_plane_set_fb(plane, NULL);
- igt_display_commit(display);
-
- igt_plane_set_rotation(plane, data->rotation);
- igt_plane_set_fb(plane, &data->fb);
- igt_plane_set_size(plane, h, w);
-
- ret = igt_display_try_commit2(display, commit);
-
- igt_output_set_pipe(output, PIPE_NONE);
-
- kmstest_restore_vt_mode();
- igt_remove_fb(fd, &data->fb);
- igt_assert_eq(ret, 0);
-}
-
static void test_plane_rotation_exhaust_fences(data_t *data,
igt_output_t *output,
int plane_type)
@@ -757,26 +693,6 @@ igt_main
}
data.override_tiling = 0;
- igt_subtest_f("primary-rotation-90-Y-tiled") {
- enum pipe pipe;
- igt_output_t *output;
- int valid_tests = 0;
-
- igt_require(gen >= 9);
- data.rotation = IGT_ROTATION_90;
-
- for_each_pipe_with_valid_output(&data.display, pipe, output) {
- igt_output_set_pipe(output, pipe);
-
- test_plane_rotation_ytiled_obj(&data, output, DRM_PLANE_TYPE_PRIMARY);
-
- valid_tests++;
- break;
- }
-
- igt_require_f(valid_tests, "no valid crtc/connector combinations found\n");
- }
-
for (reflect_x = reflect_x_subtests; reflect_x->tiling; reflect_x++) {
igt_subtest_f("primary-%s-reflect-x-%s",
tiling_test_str(reflect_x->tiling),
--
2.16.1
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [igt-dev] [PATCH i-g-t 10/12] tests/kms_rotation_crc: Perform lazy cleanup and require atomic.
2018-02-06 10:14 [igt-dev] [PATCH i-g-t 01/12] lib/igt_fb: Make igt_remove_fb more robust Maarten Lankhorst
` (7 preceding siblings ...)
2018-02-06 10:14 ` [igt-dev] [PATCH i-g-t 09/12] tests/kms_rotation_crc: Remove primary-rotation-90-Y-tiled Maarten Lankhorst
@ 2018-02-06 10:14 ` Maarten Lankhorst
2018-02-09 9:39 ` Kahola, Mika
2018-02-06 10:14 ` [igt-dev] [PATCH i-g-t 11/12] tests/kms_rotation_crc: Clean up exhaust-fences subtest Maarten Lankhorst
` (9 subsequent siblings)
18 siblings, 1 reply; 39+ messages in thread
From: Maarten Lankhorst @ 2018-02-06 10:14 UTC (permalink / raw)
To: igt-dev
This won't clean up resources between subtests, so if subtests fail
the next subtest will clean up everything. This allows all subtests
even if one fails.
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
tests/kms_rotation_crc.c | 203 ++++++++++++++---------------------------------
1 file changed, 60 insertions(+), 143 deletions(-)
diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index 74a611022d5a..9242ddee5feb 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -33,7 +33,6 @@ typedef struct {
struct igt_fb fb;
struct igt_fb fb_reference;
struct igt_fb fb_unrotated;
- struct igt_fb fb_modeset;
struct igt_fb fb_flip;
igt_crc_t ref_crc;
igt_crc_t flip_crc;
@@ -122,61 +121,41 @@ paint_squares(data_t *data, igt_rotation_t rotation,
igt_put_cairo_ctx(data->gfx_fd, fb, cr);
}
-static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,
- igt_plane_t *plane, enum igt_commit_style commit)
+static void remove_fbs(data_t *data)
{
- drmModeModeInfo *mode;
- unsigned int w, h;
- uint64_t tiling = data->override_tiling ?: LOCAL_DRM_FORMAT_MOD_NONE;
- uint32_t pixel_format = data->override_fmt ?: DRM_FORMAT_XRGB8888;
- igt_display_t *display = &data->display;
- igt_plane_t *primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
+ igt_remove_fb(data->gfx_fd, &data->fb);
+ igt_remove_fb(data->gfx_fd, &data->fb_reference);
+ igt_remove_fb(data->gfx_fd, &data->fb_unrotated);
+ igt_remove_fb(data->gfx_fd, &data->fb_flip);
+}
- igt_output_set_pipe(output, pipe);
- igt_plane_set_rotation(plane, IGT_ROTATION_0);
+static void cleanup_crtc(data_t *data)
+{
+ igt_display_t *display = &data->display;
- /* create the pipe_crc object for this pipe */
igt_pipe_crc_free(data->pipe_crc);
- data->pipe_crc = igt_pipe_crc_new(data->gfx_fd, pipe, INTEL_PIPE_CRC_SOURCE_AUTO);
-
- mode = igt_output_get_mode(output);
+ data->pipe_crc = NULL;
- w = mode->hdisplay;
- h = mode->vdisplay;
+ remove_fbs(data);
- igt_create_fb(data->gfx_fd, w, h, pixel_format, tiling, &data->fb_modeset);
+ igt_display_reset(display);
+}
- /*
- * With igt_display_commit2 and COMMIT_UNIVERSAL, we call just the
- * setplane without a modeset. So, to be able to call
- * igt_display_commit and ultimately setcrtc to do the first modeset,
- * we create an fb covering the crtc and call commit
- *
- * It's also a good idea to set a primary fb on the primary plane
- * regardless, to force a underrun when watermarks are allocated
- * incorrectly for other planes.
- */
- igt_plane_set_fb(primary, &data->fb_modeset);
+static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,
+ igt_plane_t *plane)
+{
+ igt_display_t *display = &data->display;
- if (commit < COMMIT_ATOMIC) {
- igt_plane_clear_prop_changed(primary, IGT_PLANE_ROTATION);
- igt_display_commit(display);
+ cleanup_crtc(data);
- if (plane->type == DRM_PLANE_TYPE_PRIMARY)
- igt_plane_set_prop_changed(primary, IGT_PLANE_ROTATION);
- }
+ igt_output_set_pipe(output, pipe);
+ igt_plane_set_rotation(plane, IGT_ROTATION_0);
- igt_plane_set_fb(plane, NULL);
+ /* create the pipe_crc object for this pipe */
+ igt_pipe_crc_free(data->pipe_crc);
+ data->pipe_crc = igt_pipe_crc_new(data->gfx_fd, pipe, INTEL_PIPE_CRC_SOURCE_AUTO);
- igt_display_commit2(display, commit);
-}
-
-static void remove_fbs(data_t *data)
-{
- igt_remove_fb(data->gfx_fd, &data->fb);
- igt_remove_fb(data->gfx_fd, &data->fb_reference);
- igt_remove_fb(data->gfx_fd, &data->fb_unrotated);
- igt_remove_fb(data->gfx_fd, &data->fb_flip);
+ igt_display_commit2(display, COMMIT_ATOMIC);
}
enum rectangle_type {
@@ -247,28 +226,24 @@ static void prepare_fbs(data_t *data, igt_output_t *output,
/*
* Create a reference software rotated flip framebuffer.
*/
- if (plane->type == DRM_PLANE_TYPE_PRIMARY || display->is_atomic) {
- 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);
- 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);
- igt_display_commit2(display,
- display->is_atomic ?
- COMMIT_ATOMIC : COMMIT_UNIVERSAL);
- igt_pipe_crc_collect_crc(data->pipe_crc, &data->flip_crc);
-
- /*
- * Prepare the non-rotated flip fb.
- */
- igt_remove_fb(data->gfx_fd, &data->fb_flip);
- 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);
- }
+ 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);
+ 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);
+ igt_display_commit2(display, COMMIT_ATOMIC);
+ igt_pipe_crc_collect_crc(data->pipe_crc, &data->flip_crc);
+
+ /*
+ * Prepare the non-rotated flip fb.
+ */
+ igt_remove_fb(data->gfx_fd, &data->fb_flip);
+ 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);
/*
* Create a reference CRC for a software-rotated fb.
@@ -280,7 +255,7 @@ static void prepare_fbs(data_t *data, igt_output_t *output,
igt_plane_set_fb(plane, &data->fb_reference);
if (plane->type != DRM_PLANE_TYPE_CURSOR)
igt_plane_set_position(plane, data->pos_x, data->pos_y);
- igt_display_commit2(display, display->is_atomic ? COMMIT_ATOMIC : COMMIT_UNIVERSAL);
+ igt_display_commit2(display, COMMIT_ATOMIC);
igt_pipe_crc_collect_crc(data->pipe_crc, &data->ref_crc);
@@ -293,7 +268,7 @@ static void prepare_fbs(data_t *data, igt_output_t *output,
igt_plane_set_rotation(plane, IGT_ROTATION_0);
if (plane->type != DRM_PLANE_TYPE_CURSOR)
igt_plane_set_position(plane, data->pos_x, data->pos_y);
- igt_display_commit2(display, display->is_atomic ? COMMIT_ATOMIC : COMMIT_UNIVERSAL);
+ igt_display_commit2(display, COMMIT_ATOMIC);
/*
* Prepare the plane with an non-rotated fb let the hw rotate it.
@@ -306,35 +281,6 @@ static void prepare_fbs(data_t *data, igt_output_t *output,
igt_plane_set_position(plane, data->pos_x, data->pos_y);
}
-static void cleanup_crtc(data_t *data, igt_output_t *output, igt_plane_t *plane)
-{
- igt_display_t *display = &data->display;
-
- igt_pipe_crc_free(data->pipe_crc);
- data->pipe_crc = NULL;
-
- remove_fbs(data);
-
- igt_remove_fb(data->gfx_fd, &data->fb_modeset);
-
- /* XXX: see the note in prepare_crtc() */
- if (plane->type != DRM_PLANE_TYPE_PRIMARY) {
- igt_plane_t *primary;
-
- primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
- igt_plane_set_fb(primary, NULL);
- }
-
- igt_plane_set_fb(plane, NULL);
- igt_plane_set_rotation(plane, IGT_ROTATION_0);
-
- igt_display_commit2(display, COMMIT_UNIVERSAL);
-
- igt_output_set_pipe(output, PIPE_ANY);
-
- igt_display_commit(display);
-}
-
static void wait_for_pageflip(int fd)
{
drmEventContext evctx = { .version = 2 };
@@ -359,18 +305,11 @@ static void test_plane_rotation(data_t *data, int plane_type, bool test_bad_form
enum pipe pipe;
int valid_tests = 0;
igt_crc_t crc_output;
- enum igt_commit_style commit = COMMIT_LEGACY;
int ret;
- if (plane_type == DRM_PLANE_TYPE_PRIMARY || plane_type == DRM_PLANE_TYPE_CURSOR)
- commit = COMMIT_UNIVERSAL;
-
if (plane_type == DRM_PLANE_TYPE_CURSOR)
igt_require(display->has_cursor_plane);
- if (data->display.is_atomic)
- commit = COMMIT_ATOMIC;
-
for_each_pipe_with_valid_output(display, pipe, output) {
igt_plane_t *plane;
int i;
@@ -383,7 +322,7 @@ static void test_plane_rotation(data_t *data, int plane_type, bool test_bad_form
plane = igt_output_get_plane_type(output, plane_type);
igt_require(igt_plane_has_prop(plane, IGT_PLANE_ROTATION));
- prepare_crtc(data, output, pipe, plane, commit);
+ prepare_crtc(data, output, pipe, plane);
for (i = 0; i < num_rectangle_types; i++) {
/* Unsupported on i915 */
@@ -403,7 +342,7 @@ static void test_plane_rotation(data_t *data, int plane_type, bool test_bad_form
if (data->rotation & (IGT_ROTATION_90 | IGT_ROTATION_270))
igt_plane_set_size(plane, data->fb.height, data->fb.width);
- ret = igt_display_try_commit2(display, commit);
+ ret = igt_display_try_commit2(display, COMMIT_ATOMIC);
if (test_bad_format) {
igt_assert_eq(ret, -EINVAL);
continue;
@@ -444,41 +383,28 @@ static void test_plane_rotation(data_t *data, int plane_type, bool test_bad_form
}
valid_tests++;
- cleanup_crtc(data, output, plane);
}
igt_require_f(valid_tests, "no valid crtc/connector combinations found\n");
}
static void test_plane_rotation_exhaust_fences(data_t *data,
igt_output_t *output,
- int plane_type)
+ igt_plane_t *plane)
{
igt_display_t *display = &data->display;
uint64_t tiling = LOCAL_I915_FORMAT_MOD_Y_TILED;
uint32_t format = DRM_FORMAT_XRGB8888;
int bpp = igt_drm_format_to_bpp(format);
- enum igt_commit_style commit = COMMIT_LEGACY;
int fd = data->gfx_fd;
- igt_plane_t *plane;
drmModeModeInfo *mode;
- data_t data2[MAX_FENCES+1] = {};
+ struct igt_fb fb[MAX_FENCES+1] = {};
unsigned int stride, size, w, h;
uint32_t gem_handle;
uint64_t total_aperture_size, total_fbs_size;
int i, ret;
- plane = igt_output_get_plane_type(output, plane_type);
igt_require(igt_plane_has_prop(plane, IGT_PLANE_ROTATION));
- if (plane_type == DRM_PLANE_TYPE_PRIMARY || plane_type == DRM_PLANE_TYPE_CURSOR)
- commit = COMMIT_UNIVERSAL;
-
- if (plane_type == DRM_PLANE_TYPE_CURSOR)
- igt_require(display->has_cursor_plane);
-
- if (data->display.is_atomic)
- commit = COMMIT_ATOMIC;
-
mode = igt_output_get_mode(output);
w = mode->hdisplay;
h = mode->vdisplay;
@@ -497,7 +423,7 @@ static void test_plane_rotation_exhaust_fences(data_t *data,
igt_require(total_fbs_size < total_aperture_size * 0.9);
igt_plane_set_fb(plane, NULL);
- igt_display_commit(display);
+ igt_display_commit2(display, COMMIT_ATOMIC);
for (i = 0; i < MAX_FENCES + 1; i++) {
gem_handle = gem_create(fd, size);
@@ -510,20 +436,20 @@ static void test_plane_rotation_exhaust_fences(data_t *data,
ret = (__kms_addfb(fd, gem_handle, w, h, stride,
format, tiling, NULL,
LOCAL_DRM_MODE_FB_MODIFIERS,
- &data2[i].fb.fb_id));
+ &fb[i].fb_id));
if (ret) {
igt_warn("failed to create framebuffer\n");
goto err_alloc;
}
- data2[i].fb.width = w;
- data2[i].fb.height = h;
- data2[i].fb.gem_handle = gem_handle;
+ fb[i].width = w;
+ fb[i].height = h;
+ fb[i].gem_handle = gem_handle;
- igt_plane_set_fb(plane, &data2[i].fb);
+ igt_plane_set_fb(plane, &fb[i]);
igt_plane_set_rotation(plane, IGT_ROTATION_0);
- ret = igt_display_try_commit2(display, commit);
+ igt_display_commit2(display, COMMIT_ATOMIC);
if (ret) {
igt_warn("failed to commit unrotated fb\n");
goto err_commit;
@@ -532,7 +458,7 @@ static void test_plane_rotation_exhaust_fences(data_t *data,
igt_plane_set_rotation(plane, IGT_ROTATION_90);
igt_plane_set_size(plane, h, w);
- igt_display_commit2(display, commit);
+ igt_display_commit2(display, COMMIT_ATOMIC);
if (ret) {
igt_warn("failed to commit hardware rotated fb: %i\n", ret);
goto err_commit;
@@ -545,19 +471,9 @@ err_alloc:
i--;
err_commit:
- igt_plane_set_fb(plane, NULL);
- igt_plane_set_rotation(plane, IGT_ROTATION_0);
-
- if (commit < COMMIT_ATOMIC)
- igt_display_commit2(display, commit);
-
- igt_output_set_pipe(output, PIPE_NONE);
- igt_display_commit2(display, display->is_atomic ? COMMIT_ATOMIC : COMMIT_LEGACY);
-
for (; i >= 0; i--)
- igt_remove_fb(fd, &data2[i].fb);
+ igt_remove_fb(fd, &fb[i]);
- kmstest_restore_vt_mode();
igt_assert_eq(ret, 0);
}
@@ -714,9 +630,10 @@ igt_main
igt_require(gen >= 9);
for_each_pipe_with_valid_output(&data.display, pipe, output) {
- igt_output_set_pipe(output, pipe);
+ igt_plane_t *primary = &data.display.pipes[pipe].planes[0];
+ prepare_crtc(&data, output, pipe, primary);
- test_plane_rotation_exhaust_fences(&data, output, DRM_PLANE_TYPE_PRIMARY);
+ test_plane_rotation_exhaust_fences(&data, output, primary);
valid_tests++;
break;
--
2.16.1
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [igt-dev] [PATCH i-g-t 11/12] tests/kms_rotation_crc: Clean up exhaust-fences subtest
2018-02-06 10:14 [igt-dev] [PATCH i-g-t 01/12] lib/igt_fb: Make igt_remove_fb more robust Maarten Lankhorst
` (8 preceding siblings ...)
2018-02-06 10:14 ` [igt-dev] [PATCH i-g-t 10/12] tests/kms_rotation_crc: Perform lazy cleanup and require atomic Maarten Lankhorst
@ 2018-02-06 10:14 ` Maarten Lankhorst
2018-02-12 11:20 ` Mika Kahola
2018-02-06 10:14 ` [igt-dev] [PATCH i-g-t 12/12] tests/kms_rotation_crc: Test all pixel formats on all planes Maarten Lankhorst
` (8 subsequent siblings)
18 siblings, 1 reply; 39+ messages in thread
From: Maarten Lankhorst @ 2018-02-06 10:14 UTC (permalink / raw)
To: igt-dev
This seems to open code igt_calc_fb_size and igt_create_fb, just use both.
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
tests/kms_rotation_crc.c | 67 +++++++++---------------------------------------
1 file changed, 12 insertions(+), 55 deletions(-)
diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index 9242ddee5feb..18c3e13431db 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -388,31 +388,28 @@ static void test_plane_rotation(data_t *data, int plane_type, bool test_bad_form
}
static void test_plane_rotation_exhaust_fences(data_t *data,
+ enum pipe pipe,
igt_output_t *output,
igt_plane_t *plane)
{
igt_display_t *display = &data->display;
uint64_t tiling = LOCAL_I915_FORMAT_MOD_Y_TILED;
uint32_t format = DRM_FORMAT_XRGB8888;
- int bpp = igt_drm_format_to_bpp(format);
int fd = data->gfx_fd;
drmModeModeInfo *mode;
struct igt_fb fb[MAX_FENCES+1] = {};
unsigned int stride, size, w, h;
- uint32_t gem_handle;
uint64_t total_aperture_size, total_fbs_size;
- int i, ret;
+ int i;
igt_require(igt_plane_has_prop(plane, IGT_PLANE_ROTATION));
+ prepare_crtc(data, output, pipe, plane);
mode = igt_output_get_mode(output);
w = mode->hdisplay;
h = mode->vdisplay;
- for (stride = 512; stride < (w * bpp / 8); stride *= 2)
- ;
- for (size = 1024*1024; size < stride * h; size *= 2)
- ;
+ igt_calc_fb_size(fd, w, h, format, tiling, &size, &stride);
/*
* Make sure there is atleast 90% of the available GTT space left
@@ -422,59 +419,20 @@ static void test_plane_rotation_exhaust_fences(data_t *data,
total_aperture_size = gem_available_aperture_size(fd);
igt_require(total_fbs_size < total_aperture_size * 0.9);
- igt_plane_set_fb(plane, NULL);
- igt_display_commit2(display, COMMIT_ATOMIC);
-
for (i = 0; i < MAX_FENCES + 1; i++) {
- gem_handle = gem_create(fd, size);
- ret = __gem_set_tiling(fd, gem_handle, I915_TILING_Y, stride);
- if (ret) {
- igt_warn("failed to set tiling\n");
- goto err_alloc;
- }
-
- ret = (__kms_addfb(fd, gem_handle, w, h, stride,
- format, tiling, NULL,
- LOCAL_DRM_MODE_FB_MODIFIERS,
- &fb[i].fb_id));
- if (ret) {
- igt_warn("failed to create framebuffer\n");
- goto err_alloc;
- }
-
- fb[i].width = w;
- fb[i].height = h;
- fb[i].gem_handle = gem_handle;
+ igt_create_fb(fd, w, h, format, tiling, &fb[i]);
igt_plane_set_fb(plane, &fb[i]);
igt_plane_set_rotation(plane, IGT_ROTATION_0);
-
igt_display_commit2(display, COMMIT_ATOMIC);
- if (ret) {
- igt_warn("failed to commit unrotated fb\n");
- goto err_commit;
- }
igt_plane_set_rotation(plane, IGT_ROTATION_90);
igt_plane_set_size(plane, h, w);
-
igt_display_commit2(display, COMMIT_ATOMIC);
- if (ret) {
- igt_warn("failed to commit hardware rotated fb: %i\n", ret);
- goto err_commit;
- }
}
-err_alloc:
- if (ret)
- gem_close(fd, gem_handle);
-
- i--;
-err_commit:
- for (; i >= 0; i--)
+ for (i = 0; i < MAX_FENCES + 1; i++)
igt_remove_fb(fd, &fb[i]);
-
- igt_assert_eq(ret, 0);
}
static const char *plane_test_str(unsigned plane)
@@ -622,24 +580,23 @@ igt_main
}
}
+ /*
+ * exhaust-fences should be last test, if it fails we may OOM in
+ * the following subtests otherwise.
+ */
igt_subtest_f("exhaust-fences") {
enum pipe pipe;
igt_output_t *output;
- int valid_tests = 0;
igt_require(gen >= 9);
+ igt_display_require_output(&data.display);
for_each_pipe_with_valid_output(&data.display, pipe, output) {
igt_plane_t *primary = &data.display.pipes[pipe].planes[0];
- prepare_crtc(&data, output, pipe, primary);
- test_plane_rotation_exhaust_fences(&data, output, primary);
-
- valid_tests++;
+ test_plane_rotation_exhaust_fences(&data, pipe, output, primary);
break;
}
-
- igt_require_f(valid_tests, "no valid crtc/connector combinations found\n");
}
igt_fixture {
--
2.16.1
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [igt-dev] [PATCH i-g-t 12/12] tests/kms_rotation_crc: Test all pixel formats on all planes.
2018-02-06 10:14 [igt-dev] [PATCH i-g-t 01/12] lib/igt_fb: Make igt_remove_fb more robust Maarten Lankhorst
` (9 preceding siblings ...)
2018-02-06 10:14 ` [igt-dev] [PATCH i-g-t 11/12] tests/kms_rotation_crc: Clean up exhaust-fences subtest Maarten Lankhorst
@ 2018-02-06 10:14 ` Maarten Lankhorst
2018-02-08 3:33 ` Srinivas, Vidya
2018-02-12 13:09 ` Mika Kahola
2018-02-06 11:25 ` [igt-dev] ✗ Fi.CI.BAT: warning for series starting with [i-g-t,01/12] lib/igt_fb: Make igt_remove_fb more robust Patchwork
` (7 subsequent siblings)
18 siblings, 2 replies; 39+ messages in thread
From: Maarten Lankhorst @ 2018-02-06 10:14 UTC (permalink / raw)
To: igt-dev
The test is modified to test all pixel formats on a plane, unless
the pixel format is overridden by the subtest.
Attempting to test all pixel formats requires even more runtime and
the overhead of toggling crc collection to capture a single CRC
becomes significant, so keep the crc collection enabled during the entire test.
This reduces the runtime from ~24s to ~16s per subtest on SKL.
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
tests/kms_rotation_crc.c | 129 ++++++++++++++++++++++++++++-------------------
1 file changed, 77 insertions(+), 52 deletions(-)
diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index 18c3e13431db..0cd5c6e52b57 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -153,9 +153,10 @@ static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,
/* create the pipe_crc object for this pipe */
igt_pipe_crc_free(data->pipe_crc);
- data->pipe_crc = igt_pipe_crc_new(data->gfx_fd, pipe, INTEL_PIPE_CRC_SOURCE_AUTO);
igt_display_commit2(display, COMMIT_ATOMIC);
+ data->pipe_crc = igt_pipe_crc_new(data->gfx_fd, pipe, INTEL_PIPE_CRC_SOURCE_AUTO);
+ igt_pipe_crc_start(data->pipe_crc);
}
enum rectangle_type {
@@ -167,7 +168,7 @@ enum rectangle_type {
};
static void prepare_fbs(data_t *data, igt_output_t *output,
- igt_plane_t *plane, enum rectangle_type rect)
+ igt_plane_t *plane, enum rectangle_type rect, uint32_t format)
{
drmModeModeInfo *mode;
igt_display_t *display = &data->display;
@@ -234,7 +235,8 @@ static void prepare_fbs(data_t *data, igt_output_t *output,
if (plane->type != DRM_PLANE_TYPE_CURSOR)
igt_plane_set_position(plane, data->pos_x, data->pos_y);
igt_display_commit2(display, COMMIT_ATOMIC);
- igt_pipe_crc_collect_crc(data->pipe_crc, &data->flip_crc);
+ igt_pipe_crc_drain(data->pipe_crc);
+ igt_pipe_crc_get_single(data->pipe_crc, &data->flip_crc);
/*
* Prepare the non-rotated flip fb.
@@ -257,7 +259,8 @@ static void prepare_fbs(data_t *data, igt_output_t *output,
igt_plane_set_position(plane, data->pos_x, data->pos_y);
igt_display_commit2(display, COMMIT_ATOMIC);
- igt_pipe_crc_collect_crc(data->pipe_crc, &data->ref_crc);
+ igt_pipe_crc_drain(data->pipe_crc);
+ igt_pipe_crc_get_single(data->pipe_crc, &data->ref_crc);
/*
* Prepare the non-rotated reference fb.
@@ -298,21 +301,77 @@ static void wait_for_pageflip(int fd)
igt_assert(drmHandleEvent(fd, &evctx) == 0);
}
+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)
+{
+ 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);
+
+ igt_plane_set_rotation(plane, data->rotation);
+ if (data->rotation & (IGT_ROTATION_90 | IGT_ROTATION_270))
+ igt_plane_set_size(plane, data->fb.height, data->fb.width);
+
+ ret = igt_display_try_commit2(display, COMMIT_ATOMIC);
+ if (test_bad_format) {
+ igt_assert_eq(ret, -EINVAL);
+ return;
+ }
+
+ /* Verify commit was ok. */
+ igt_assert_eq(ret, 0);
+
+ /* Check CRC */
+ igt_pipe_crc_drain(data->pipe_crc);
+ igt_pipe_crc_get_single(data->pipe_crc, &crc_output);
+ igt_assert_crc_equal(&data->ref_crc, &crc_output);
+
+ /*
+ * If flips are requested flip to a different fb and
+ * check CRC against that one as well.
+ */
+ if (data->fb_flip.fb_id) {
+ igt_plane_set_fb(plane, &data->fb_flip);
+ if (data->rotation == IGT_ROTATION_90 || data->rotation == IGT_ROTATION_270)
+ igt_plane_set_size(plane, data->fb.height, data->fb.width);
+
+ if (plane->type != DRM_PLANE_TYPE_PRIMARY) {
+ igt_display_commit_atomic(display, DRM_MODE_PAGE_FLIP_EVENT | DRM_MODE_ATOMIC_NONBLOCK, NULL);
+ } else {
+ ret = drmModePageFlip(data->gfx_fd,
+ output->config.crtc->crtc_id,
+ data->fb_flip.fb_id,
+ DRM_MODE_PAGE_FLIP_EVENT,
+ NULL);
+ igt_assert_eq(ret, 0);
+ }
+ wait_for_pageflip(data->gfx_fd);
+ igt_pipe_crc_drain(data->pipe_crc);
+ igt_pipe_crc_get_single(data->pipe_crc, &crc_output);
+ igt_assert_crc_equal(&data->flip_crc,
+ &crc_output);
+ }
+}
+
static void test_plane_rotation(data_t *data, int plane_type, bool test_bad_format)
{
igt_display_t *display = &data->display;
igt_output_t *output;
enum pipe pipe;
- int valid_tests = 0;
- igt_crc_t crc_output;
- int ret;
if (plane_type == DRM_PLANE_TYPE_CURSOR)
igt_require(display->has_cursor_plane);
+ igt_display_require_output(display);
+
for_each_pipe_with_valid_output(display, pipe, output) {
igt_plane_t *plane;
- int i;
+ int i, j;
if (IS_CHERRYVIEW(data->devid) && pipe != PIPE_B)
continue;
@@ -335,56 +394,22 @@ static void test_plane_rotation(data_t *data, int plane_type, bool test_bad_form
i != rectangle && intel_gen(intel_get_drm_devid(data->gfx_fd)) < 9)
continue;
- igt_debug("Testing case %i on pipe %s\n", i, kmstest_pipe_name(pipe));
- prepare_fbs(data, output, plane, i);
-
- igt_plane_set_rotation(plane, data->rotation);
- if (data->rotation & (IGT_ROTATION_90 | IGT_ROTATION_270))
- igt_plane_set_size(plane, data->fb.height, data->fb.width);
+ if (!data->override_fmt) {
+ for (j = 0; j < plane->drm_plane->count_formats; j++) {
+ uint32_t format = plane->drm_plane->formats[j];
- ret = igt_display_try_commit2(display, COMMIT_ATOMIC);
- if (test_bad_format) {
- igt_assert_eq(ret, -EINVAL);
- continue;
- }
+ if (!igt_fb_supported_format(format))
+ continue;
- /* Verify commit was ok. */
- igt_assert_eq(ret, 0);
-
- /* Check CRC */
- igt_pipe_crc_collect_crc(data->pipe_crc, &crc_output);
- igt_assert_crc_equal(&data->ref_crc, &crc_output);
-
- /*
- * If flips are requested flip to a different fb and
- * check CRC against that one as well.
- */
- if (data->fb_flip.fb_id) {
- igt_plane_set_fb(plane, &data->fb_flip);
- if (data->rotation == IGT_ROTATION_90 || data->rotation == IGT_ROTATION_270)
- igt_plane_set_size(plane, data->fb.height, data->fb.width);
-
- if (plane_type != DRM_PLANE_TYPE_PRIMARY) {
- igt_display_commit_atomic(display, DRM_MODE_PAGE_FLIP_EVENT | DRM_MODE_ATOMIC_NONBLOCK, NULL);
- } else {
- ret = drmModePageFlip(data->gfx_fd,
- output->config.crtc->crtc_id,
- data->fb_flip.fb_id,
- DRM_MODE_PAGE_FLIP_EVENT,
- NULL);
- igt_assert_eq(ret, 0);
+ test_single_case(data, pipe, output, plane, i,
+ format, test_bad_format);
}
- wait_for_pageflip(data->gfx_fd);
- igt_pipe_crc_collect_crc(data->pipe_crc,
- &crc_output);
- igt_assert_crc_equal(&data->flip_crc,
- &crc_output);
+ } else {
+ test_single_case(data, pipe, output, plane, i,
+ data->override_fmt, test_bad_format);
}
}
-
- valid_tests++;
}
- igt_require_f(valid_tests, "no valid crtc/connector combinations found\n");
}
static void test_plane_rotation_exhaust_fences(data_t *data,
--
2.16.1
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [igt-dev] ✗ Fi.CI.BAT: warning for series starting with [i-g-t,01/12] lib/igt_fb: Make igt_remove_fb more robust
2018-02-06 10:14 [igt-dev] [PATCH i-g-t 01/12] lib/igt_fb: Make igt_remove_fb more robust Maarten Lankhorst
` (10 preceding siblings ...)
2018-02-06 10:14 ` [igt-dev] [PATCH i-g-t 12/12] tests/kms_rotation_crc: Test all pixel formats on all planes Maarten Lankhorst
@ 2018-02-06 11:25 ` Patchwork
2018-02-07 13:30 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,01/12] lib/igt_fb: Make igt_remove_fb more robust (rev2) Patchwork
` (6 subsequent siblings)
18 siblings, 0 replies; 39+ messages in thread
From: Patchwork @ 2018-02-06 11:25 UTC (permalink / raw)
To: Maarten Lankhorst; +Cc: igt-dev
== Series Details ==
Series: series starting with [i-g-t,01/12] lib/igt_fb: Make igt_remove_fb more robust
URL : https://patchwork.freedesktop.org/series/37726/
State : warning
== Summary ==
IGT patchset tested on top of latest successful build
3fd9b578b3138b04178b4ce8ee4a60e74a16ec91 tests/perf_pmu: Use short batches from hotplug test
with latest DRM-Tip kernel build CI_DRM_3727
5883e1383ed6 drm-tip: 2018y-02m-06d-09h-04m-49s UTC integration manifest
Testlist changes:
-igt@kms_rotation_crc@primary-rotation-90-flip
-igt@kms_rotation_crc@primary-rotation-90-y-tiled
-igt@kms_rotation_crc@primary-rotation-180-flip
-igt@kms_rotation_crc@primary-rotation-270-flip
-igt@kms_rotation_crc@primary-x-tiled-reflect-x-0-flip
-igt@kms_rotation_crc@primary-x-tiled-reflect-x-180-flip
-igt@kms_rotation_crc@primary-yf-tiled-reflect-x-0-flip
-igt@kms_rotation_crc@primary-yf-tiled-reflect-x-90-flip
-igt@kms_rotation_crc@primary-yf-tiled-reflect-x-180-flip
-igt@kms_rotation_crc@primary-yf-tiled-reflect-x-270-flip
-igt@kms_rotation_crc@primary-y-tiled-reflect-x-0-flip
-igt@kms_rotation_crc@primary-y-tiled-reflect-x-90-flip
-igt@kms_rotation_crc@primary-y-tiled-reflect-x-180-flip
-igt@kms_rotation_crc@primary-y-tiled-reflect-x-270-flip
-igt@kms_rotation_crc@sprite-rotation-90-flip
-igt@kms_rotation_crc@sprite-rotation-180-flip
-igt@kms_rotation_crc@sprite-rotation-270-flip
Test gem_ringfill:
Subgroup basic-default:
pass -> SKIP (fi-bsw-n3050)
Test kms_pipe_crc_basic:
Subgroup suspend-read-crc-pipe-a:
pass -> FAIL (fi-ivb-3520m) k.org#198519 +2
k.org#198519 https://bugzilla.kernel.org/show_bug.cgi?id=198519
fi-bdw-5557u total:288 pass:267 dwarn:0 dfail:0 fail:0 skip:21 time:427s
fi-bdw-gvtdvm total:288 pass:264 dwarn:0 dfail:0 fail:0 skip:24 time:426s
fi-blb-e6850 total:288 pass:223 dwarn:1 dfail:0 fail:0 skip:64 time:381s
fi-bsw-n3050 total:288 pass:241 dwarn:0 dfail:0 fail:0 skip:47 time:490s
fi-bwr-2160 total:288 pass:183 dwarn:0 dfail:0 fail:0 skip:105 time:286s
fi-bxt-dsi total:288 pass:258 dwarn:0 dfail:0 fail:0 skip:30 time:493s
fi-bxt-j4205 total:288 pass:259 dwarn:0 dfail:0 fail:0 skip:29 time:490s
fi-byt-j1900 total:288 pass:253 dwarn:0 dfail:0 fail:0 skip:35 time:471s
fi-byt-n2820 total:288 pass:249 dwarn:0 dfail:0 fail:0 skip:39 time:459s
fi-cfl-s2 total:288 pass:262 dwarn:0 dfail:0 fail:0 skip:26 time:566s
fi-cnl-y3 total:288 pass:262 dwarn:0 dfail:0 fail:0 skip:26 time:580s
fi-elk-e7500 total:288 pass:229 dwarn:0 dfail:0 fail:0 skip:59 time:421s
fi-gdg-551 total:288 pass:179 dwarn:0 dfail:0 fail:1 skip:108 time:284s
fi-glk-1 total:288 pass:260 dwarn:0 dfail:0 fail:0 skip:28 time:512s
fi-hsw-4770 total:288 pass:261 dwarn:0 dfail:0 fail:0 skip:27 time:390s
fi-hsw-4770r total:288 pass:261 dwarn:0 dfail:0 fail:0 skip:27 time:406s
fi-ilk-650 total:288 pass:228 dwarn:0 dfail:0 fail:0 skip:60 time:418s
fi-ivb-3520m total:288 pass:256 dwarn:0 dfail:0 fail:3 skip:29 time:412s
fi-ivb-3770 total:288 pass:255 dwarn:0 dfail:0 fail:0 skip:33 time:418s
fi-kbl-7500u total:288 pass:263 dwarn:1 dfail:0 fail:0 skip:24 time:459s
fi-kbl-7560u total:288 pass:269 dwarn:0 dfail:0 fail:0 skip:19 time:505s
fi-kbl-7567u total:288 pass:268 dwarn:0 dfail:0 fail:0 skip:20 time:453s
fi-kbl-r total:288 pass:261 dwarn:0 dfail:0 fail:0 skip:27 time:500s
fi-pnv-d510 total:288 pass:222 dwarn:1 dfail:0 fail:0 skip:65 time:595s
fi-skl-6260u total:288 pass:268 dwarn:0 dfail:0 fail:0 skip:20 time:434s
fi-skl-6600u total:288 pass:261 dwarn:0 dfail:0 fail:0 skip:27 time:505s
fi-skl-6700hq total:288 pass:262 dwarn:0 dfail:0 fail:0 skip:26 time:532s
fi-skl-6700k2 total:288 pass:264 dwarn:0 dfail:0 fail:0 skip:24 time:493s
fi-skl-6770hq total:288 pass:268 dwarn:0 dfail:0 fail:0 skip:20 time:485s
fi-skl-guc total:288 pass:260 dwarn:0 dfail:0 fail:0 skip:28 time:414s
fi-skl-gvtdvm total:288 pass:265 dwarn:0 dfail:0 fail:0 skip:23 time:429s
fi-snb-2520m total:288 pass:248 dwarn:0 dfail:0 fail:0 skip:40 time:514s
fi-snb-2600 total:288 pass:248 dwarn:0 dfail:0 fail:0 skip:40 time:401s
Blacklisted hosts:
fi-glk-dsi total:288 pass:258 dwarn:0 dfail:0 fail:0 skip:30 time:472s
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_868/issues.html
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [igt-dev] [PATCH i-g-t 05/12] lib/igt_debugfs: Add igt_pipe_crc_get_single and igt_pipe_crc_drain.
2018-02-06 10:14 ` [igt-dev] [PATCH i-g-t 05/12] lib/igt_debugfs: Add igt_pipe_crc_get_single and igt_pipe_crc_drain Maarten Lankhorst
@ 2018-02-06 16:11 ` Ville Syrjälä
2018-02-06 16:30 ` Maarten Lankhorst
2018-02-07 11:47 ` [igt-dev] [PATCH i-g-t] lib/igt_debugfs: Add igt_pipe_crc_get_single and igt_pipe_crc_drain, v2 Maarten Lankhorst
0 siblings, 2 replies; 39+ messages in thread
From: Ville Syrjälä @ 2018-02-06 16:11 UTC (permalink / raw)
To: Maarten Lankhorst; +Cc: igt-dev
On Tue, Feb 06, 2018 at 11:14:10AM +0100, Maarten Lankhorst wrote:
> Collecting CRC may result in a modeset and extra vblank waits. On some
> tests this will increase the runtime a lot, so it makes sense to
> keep it enabled, and only collect the most recent CRC when needed.
>
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> ---
> lib/igt_debugfs.c | 73 ++++++++++++++++++++++++++++++++++++++++++++---
> lib/igt_debugfs.h | 2 ++
> tests/kms_cursor_legacy.c | 21 ++++----------
> 3 files changed, 76 insertions(+), 20 deletions(-)
>
> diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
> index 1aec079c52bb..ad3e7bcf38fa 100644
> --- a/lib/igt_debugfs.c
> +++ b/lib/igt_debugfs.c
> @@ -33,6 +33,7 @@
> #include <limits.h>
> #include <string.h>
> #include <fcntl.h>
> +#include <poll.h>
> #include <unistd.h>
> #include <i915_drm.h>
>
> @@ -697,7 +698,7 @@ static bool pipe_crc_init_from_string(igt_pipe_crc_t *pipe_crc, igt_crc_t *crc,
> return true;
> }
>
> -static int read_crc(igt_pipe_crc_t *pipe_crc, igt_crc_t *out)
> +static int read_crc(igt_pipe_crc_t *pipe_crc, igt_crc_t *out, bool override_nonblock)
> {
> ssize_t bytes_read;
> char buf[MAX_LINE_LEN + 1];
> @@ -706,7 +707,7 @@ static int read_crc(igt_pipe_crc_t *pipe_crc, igt_crc_t *out)
> bytes_read = read(pipe_crc->crc_fd, &buf, MAX_LINE_LEN);
> igt_reset_timeout();
>
> - if (bytes_read < 0 && errno == EAGAIN)
> + if (bytes_read < 0 && errno == EAGAIN && !override_nonblock)
> igt_assert(pipe_crc->flags & O_NONBLOCK);
>
> if (bytes_read < 0)
> @@ -722,7 +723,7 @@ static int read_crc(igt_pipe_crc_t *pipe_crc, igt_crc_t *out)
>
> static void read_one_crc(igt_pipe_crc_t *pipe_crc, igt_crc_t *out)
> {
> - while (read_crc(pipe_crc, out) == 0)
> + while (read_crc(pipe_crc, out, false) == 0)
> usleep(1000);
> }
>
> @@ -794,7 +795,7 @@ igt_pipe_crc_get_crcs(igt_pipe_crc_t *pipe_crc, int n_crcs,
> igt_crc_t *crc = &crcs[n];
> int ret;
>
> - ret = read_crc(pipe_crc, crc);
> + ret = read_crc(pipe_crc, crc, false);
> if (ret < 0)
> continue;
> if (ret == 0)
> @@ -854,6 +855,70 @@ void igt_pipe_crc_collect_crc(igt_pipe_crc_t *pipe_crc, igt_crc_t *out_crc)
> crc_sanity_checks(out_crc);
> }
>
> +/**
> + * igt_pipe_crc_drain:
> + * @pipe_crc: pipe CRC object
> + *
> + * Discards all currently queued CRC values from @pipe_crc. This function does
> + * not block, and is useful to flush @pipe_crc. Afterwards you can get a fresh
> + * CRC with igt_pipe_crc_get_single().
> + */
> +void igt_pipe_crc_drain(igt_pipe_crc_t *pipe_crc)
> +{
> + igt_crc_t crc;
> + int ret;
> +
> + fcntl(pipe_crc->crc_fd, F_SETFL, pipe_crc->flags | O_NONBLOCK);
> + do {
> + ret = read_crc(pipe_crc, &crc, true);
> + } while (ret > 0 || errno == EINTR);
Is errno valid for ret==0?
> + fcntl(pipe_crc->crc_fd, F_SETFL, pipe_crc->flags);
> +}
> +
> +/**
> + * igt_pipe_crc_get_single:
> + * @pipe_crc: pipe CRC object
> + * @crc: buffer pointer for the captured CRC value
> + *
> + * Read a single @crc from @pipe_crc. This function does not block
> + * when nonblocking CRC is requested, and will return false if no CRC
> + * can be captured.
> + *
> + * If opened in blocking mode it will always block until a new CRC is read, like
> + * igt_pipe_crc_collect_crc().
> + *
> + * Callers must start and stop the capturing themselves by calling
> + * igt_pipe_crc_start() and igt_pipe_crc_stop(). For one-shot CRC collecting
> + * look at igt_pipe_crc_collect_crc().
> + *
> + * If capturing has been going on for a while and a fresh crc is required,
> + * you will need to call igt_pipe_crc_drain() first to remove stale entries.
> + *
> + * Returns:
> + * Whether a crc is captured, only false in non-blocking mode.
> + */
> +bool
> +igt_pipe_crc_get_single(igt_pipe_crc_t *pipe_crc, igt_crc_t *crc)
> +{
> + bool found = true;
> +
> + if (pipe_crc->flags & O_NONBLOCK) {
> + int ret;
> +
> + do {
> + ret = read_crc(pipe_crc, crc, false);
> + } while (ret < 0);
> +
> + found = ret;
> + } else
> + read_one_crc(pipe_crc, crc);
> +
> + if (found)
> + crc_sanity_checks(crc);
> +
> + return found;
> +}
> +
> /*
> * Drop caches
> */
> diff --git a/lib/igt_debugfs.h b/lib/igt_debugfs.h
> index d90dd7a68bb0..8d25abfe43c1 100644
> --- a/lib/igt_debugfs.h
> +++ b/lib/igt_debugfs.h
> @@ -130,6 +130,8 @@ void igt_pipe_crc_stop(igt_pipe_crc_t *pipe_crc);
> __attribute__((warn_unused_result))
> int igt_pipe_crc_get_crcs(igt_pipe_crc_t *pipe_crc, int n_crcs,
> igt_crc_t **out_crcs);
> +void igt_pipe_crc_drain(igt_pipe_crc_t *pipe_crc);
> +bool igt_pipe_crc_get_single(igt_pipe_crc_t *pipe_crc, igt_crc_t *out_crc);
> void igt_pipe_crc_collect_crc(igt_pipe_crc_t *pipe_crc, igt_crc_t *out_crc);
>
> void igt_hpd_storm_set_threshold(int fd, unsigned int threshold);
> diff --git a/tests/kms_cursor_legacy.c b/tests/kms_cursor_legacy.c
> index 5011e78e5c2f..d0a28b3c442c 100644
> --- a/tests/kms_cursor_legacy.c
> +++ b/tests/kms_cursor_legacy.c
> @@ -1276,7 +1276,7 @@ static void flip_vs_cursor_busy_crc(igt_display_t *display, bool atomic)
> enum pipe pipe = find_connected_pipe(display, false);
> igt_pipe_t *pipe_connected = &display->pipes[pipe];
> igt_plane_t *plane_primary = igt_pipe_get_plane_type(pipe_connected, DRM_PLANE_TYPE_PRIMARY);
> - igt_crc_t crcs[2];
> + igt_crc_t crcs[2], test_crc;
>
> if (atomic)
> igt_require(display->is_atomic);
> @@ -1290,7 +1290,7 @@ static void flip_vs_cursor_busy_crc(igt_display_t *display, bool atomic)
>
> igt_display_commit2(display, display->is_atomic ? COMMIT_ATOMIC : COMMIT_LEGACY);
>
> - pipe_crc = igt_pipe_crc_new_nonblock(display->drm_fd, pipe, INTEL_PIPE_CRC_SOURCE_AUTO);
> + pipe_crc = igt_pipe_crc_new(display->drm_fd, pipe, INTEL_PIPE_CRC_SOURCE_AUTO);
>
> set_cursor_on_pipe(display, pipe, &cursor_fb);
> igt_display_commit2(display, COMMIT_UNIVERSAL);
> @@ -1322,9 +1322,6 @@ static void flip_vs_cursor_busy_crc(igt_display_t *display, bool atomic)
> /* Disable cursor, and immediately queue a flip. Check if resulting crc is correct. */
> for (int i = 1; i >= 0; i--) {
> igt_spin_t *spin;
> - igt_crc_t *received_crcs = NULL;
> - int ncrcs;
> - static const int max_crcs = 8;
>
> spin = igt_spin_batch_new(display->drm_fd, 0, 0,
> fb_info[1].gem_handle);
> @@ -1336,7 +1333,8 @@ static void flip_vs_cursor_busy_crc(igt_display_t *display, bool atomic)
>
> igt_assert_eq(get_vblank(display->drm_fd, pipe, 0), vblank_start);
>
> - ncrcs = igt_pipe_crc_get_crcs(pipe_crc, max_crcs, &received_crcs);
> + igt_pipe_crc_drain(pipe_crc);
> + igt_pipe_crc_get_single(pipe_crc, &test_crc);
>
> igt_spin_batch_free(display->drm_fd, spin);
>
> @@ -1349,16 +1347,7 @@ static void flip_vs_cursor_busy_crc(igt_display_t *display, bool atomic)
> igt_plane_set_fb(plane_primary, &fb_info[0]);
> igt_display_commit2(display, COMMIT_UNIVERSAL);
>
> - /*
> - * We collect the crc nonblockingly, and should have at least 1
> - * but not so many crcs that we overflow. Last CRC is the only
> - * one we care about here. Other CRCs may have been from before
> - * the cursor update and can contain garbage.
> - */
> - igt_assert(ncrcs > 0 && ncrcs < max_crcs);
> -
> - igt_assert_crc_equal(&crcs[i], &received_crcs[ncrcs - 1]);
> - free(received_crcs);
> + igt_assert_crc_equal(&crcs[i], &test_crc);
> }
>
> igt_remove_fb(display->drm_fd, &fb_info[1]);
> --
> 2.16.1
>
> _______________________________________________
> igt-dev mailing list
> igt-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/igt-dev
--
Ville Syrjälä
Intel OTC
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [igt-dev] [PATCH i-g-t 05/12] lib/igt_debugfs: Add igt_pipe_crc_get_single and igt_pipe_crc_drain.
2018-02-06 16:11 ` Ville Syrjälä
@ 2018-02-06 16:30 ` Maarten Lankhorst
2018-02-07 11:47 ` [igt-dev] [PATCH i-g-t] lib/igt_debugfs: Add igt_pipe_crc_get_single and igt_pipe_crc_drain, v2 Maarten Lankhorst
1 sibling, 0 replies; 39+ messages in thread
From: Maarten Lankhorst @ 2018-02-06 16:30 UTC (permalink / raw)
To: Ville Syrjälä; +Cc: igt-dev
Op 06-02-18 om 17:11 schreef Ville Syrjälä:
> On Tue, Feb 06, 2018 at 11:14:10AM +0100, Maarten Lankhorst wrote:
>> Collecting CRC may result in a modeset and extra vblank waits. On some
>> tests this will increase the runtime a lot, so it makes sense to
>> keep it enabled, and only collect the most recent CRC when needed.
>>
>> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
>> ---
>> lib/igt_debugfs.c | 73 ++++++++++++++++++++++++++++++++++++++++++++---
>> lib/igt_debugfs.h | 2 ++
>> tests/kms_cursor_legacy.c | 21 ++++----------
>> 3 files changed, 76 insertions(+), 20 deletions(-)
>>
>> diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
>> index 1aec079c52bb..ad3e7bcf38fa 100644
>> --- a/lib/igt_debugfs.c
>> +++ b/lib/igt_debugfs.c
>> @@ -33,6 +33,7 @@
>> #include <limits.h>
>> #include <string.h>
>> #include <fcntl.h>
>> +#include <poll.h>
>> #include <unistd.h>
>> #include <i915_drm.h>
>>
>> @@ -697,7 +698,7 @@ static bool pipe_crc_init_from_string(igt_pipe_crc_t *pipe_crc, igt_crc_t *crc,
>> return true;
>> }
>>
>> -static int read_crc(igt_pipe_crc_t *pipe_crc, igt_crc_t *out)
>> +static int read_crc(igt_pipe_crc_t *pipe_crc, igt_crc_t *out, bool override_nonblock)
>> {
>> ssize_t bytes_read;
>> char buf[MAX_LINE_LEN + 1];
>> @@ -706,7 +707,7 @@ static int read_crc(igt_pipe_crc_t *pipe_crc, igt_crc_t *out)
>> bytes_read = read(pipe_crc->crc_fd, &buf, MAX_LINE_LEN);
>> igt_reset_timeout();
>>
>> - if (bytes_read < 0 && errno == EAGAIN)
>> + if (bytes_read < 0 && errno == EAGAIN && !override_nonblock)
>> igt_assert(pipe_crc->flags & O_NONBLOCK);
>>
>> if (bytes_read < 0)
>> @@ -722,7 +723,7 @@ static int read_crc(igt_pipe_crc_t *pipe_crc, igt_crc_t *out)
>>
>> static void read_one_crc(igt_pipe_crc_t *pipe_crc, igt_crc_t *out)
>> {
>> - while (read_crc(pipe_crc, out) == 0)
>> + while (read_crc(pipe_crc, out, false) == 0)
>> usleep(1000);
>> }
>>
>> @@ -794,7 +795,7 @@ igt_pipe_crc_get_crcs(igt_pipe_crc_t *pipe_crc, int n_crcs,
>> igt_crc_t *crc = &crcs[n];
>> int ret;
>>
>> - ret = read_crc(pipe_crc, crc);
>> + ret = read_crc(pipe_crc, crc, false);
>> if (ret < 0)
>> continue;
>> if (ret == 0)
>> @@ -854,6 +855,70 @@ void igt_pipe_crc_collect_crc(igt_pipe_crc_t *pipe_crc, igt_crc_t *out_crc)
>> crc_sanity_checks(out_crc);
>> }
>>
>> +/**
>> + * igt_pipe_crc_drain:
>> + * @pipe_crc: pipe CRC object
>> + *
>> + * Discards all currently queued CRC values from @pipe_crc. This function does
>> + * not block, and is useful to flush @pipe_crc. Afterwards you can get a fresh
>> + * CRC with igt_pipe_crc_get_single().
>> + */
>> +void igt_pipe_crc_drain(igt_pipe_crc_t *pipe_crc)
>> +{
>> + igt_crc_t crc;
>> + int ret;
>> +
>> + fcntl(pipe_crc->crc_fd, F_SETFL, pipe_crc->flags | O_NONBLOCK);
>> + do {
>> + ret = read_crc(pipe_crc, &crc, true);
>> + } while (ret > 0 || errno == EINTR);
> Is errno valid for ret==0?
Crap, whole read_crc has botched this part, -1 is never returned even for the -EINVAL branch, because it can never be triggered even with invalid CRC's...
I guess this patch needs more thought..
>
>> + fcntl(pipe_crc->crc_fd, F_SETFL, pipe_crc->flags);
>> +}
>> +
>> +/**
>> + * igt_pipe_crc_get_single:
>> + * @pipe_crc: pipe CRC object
>> + * @crc: buffer pointer for the captured CRC value
>> + *
>> + * Read a single @crc from @pipe_crc. This function does not block
>> + * when nonblocking CRC is requested, and will return false if no CRC
>> + * can be captured.
>> + *
>> + * If opened in blocking mode it will always block until a new CRC is read, like
>> + * igt_pipe_crc_collect_crc().
>> + *
>> + * Callers must start and stop the capturing themselves by calling
>> + * igt_pipe_crc_start() and igt_pipe_crc_stop(). For one-shot CRC collecting
>> + * look at igt_pipe_crc_collect_crc().
>> + *
>> + * If capturing has been going on for a while and a fresh crc is required,
>> + * you will need to call igt_pipe_crc_drain() first to remove stale entries.
>> + *
>> + * Returns:
>> + * Whether a crc is captured, only false in non-blocking mode.
>> + */
>> +bool
>> +igt_pipe_crc_get_single(igt_pipe_crc_t *pipe_crc, igt_crc_t *crc)
>> +{
>> + bool found = true;
>> +
>> + if (pipe_crc->flags & O_NONBLOCK) {
>> + int ret;
>> +
>> + do {
>> + ret = read_crc(pipe_crc, crc, false);
>> + } while (ret < 0);
>> +
>> + found = ret;
>> + } else
>> + read_one_crc(pipe_crc, crc);
>> +
>> + if (found)
>> + crc_sanity_checks(crc);
>> +
>> + return found;
>> +}
>> +
>> /*
>> * Drop caches
>> */
>> diff --git a/lib/igt_debugfs.h b/lib/igt_debugfs.h
>> index d90dd7a68bb0..8d25abfe43c1 100644
>> --- a/lib/igt_debugfs.h
>> +++ b/lib/igt_debugfs.h
>> @@ -130,6 +130,8 @@ void igt_pipe_crc_stop(igt_pipe_crc_t *pipe_crc);
>> __attribute__((warn_unused_result))
>> int igt_pipe_crc_get_crcs(igt_pipe_crc_t *pipe_crc, int n_crcs,
>> igt_crc_t **out_crcs);
>> +void igt_pipe_crc_drain(igt_pipe_crc_t *pipe_crc);
>> +bool igt_pipe_crc_get_single(igt_pipe_crc_t *pipe_crc, igt_crc_t *out_crc);
>> void igt_pipe_crc_collect_crc(igt_pipe_crc_t *pipe_crc, igt_crc_t *out_crc);
>>
>> void igt_hpd_storm_set_threshold(int fd, unsigned int threshold);
>> diff --git a/tests/kms_cursor_legacy.c b/tests/kms_cursor_legacy.c
>> index 5011e78e5c2f..d0a28b3c442c 100644
>> --- a/tests/kms_cursor_legacy.c
>> +++ b/tests/kms_cursor_legacy.c
>> @@ -1276,7 +1276,7 @@ static void flip_vs_cursor_busy_crc(igt_display_t *display, bool atomic)
>> enum pipe pipe = find_connected_pipe(display, false);
>> igt_pipe_t *pipe_connected = &display->pipes[pipe];
>> igt_plane_t *plane_primary = igt_pipe_get_plane_type(pipe_connected, DRM_PLANE_TYPE_PRIMARY);
>> - igt_crc_t crcs[2];
>> + igt_crc_t crcs[2], test_crc;
>>
>> if (atomic)
>> igt_require(display->is_atomic);
>> @@ -1290,7 +1290,7 @@ static void flip_vs_cursor_busy_crc(igt_display_t *display, bool atomic)
>>
>> igt_display_commit2(display, display->is_atomic ? COMMIT_ATOMIC : COMMIT_LEGACY);
>>
>> - pipe_crc = igt_pipe_crc_new_nonblock(display->drm_fd, pipe, INTEL_PIPE_CRC_SOURCE_AUTO);
>> + pipe_crc = igt_pipe_crc_new(display->drm_fd, pipe, INTEL_PIPE_CRC_SOURCE_AUTO);
>>
>> set_cursor_on_pipe(display, pipe, &cursor_fb);
>> igt_display_commit2(display, COMMIT_UNIVERSAL);
>> @@ -1322,9 +1322,6 @@ static void flip_vs_cursor_busy_crc(igt_display_t *display, bool atomic)
>> /* Disable cursor, and immediately queue a flip. Check if resulting crc is correct. */
>> for (int i = 1; i >= 0; i--) {
>> igt_spin_t *spin;
>> - igt_crc_t *received_crcs = NULL;
>> - int ncrcs;
>> - static const int max_crcs = 8;
>>
>> spin = igt_spin_batch_new(display->drm_fd, 0, 0,
>> fb_info[1].gem_handle);
>> @@ -1336,7 +1333,8 @@ static void flip_vs_cursor_busy_crc(igt_display_t *display, bool atomic)
>>
>> igt_assert_eq(get_vblank(display->drm_fd, pipe, 0), vblank_start);
>>
>> - ncrcs = igt_pipe_crc_get_crcs(pipe_crc, max_crcs, &received_crcs);
>> + igt_pipe_crc_drain(pipe_crc);
>> + igt_pipe_crc_get_single(pipe_crc, &test_crc);
>>
>> igt_spin_batch_free(display->drm_fd, spin);
>>
>> @@ -1349,16 +1347,7 @@ static void flip_vs_cursor_busy_crc(igt_display_t *display, bool atomic)
>> igt_plane_set_fb(plane_primary, &fb_info[0]);
>> igt_display_commit2(display, COMMIT_UNIVERSAL);
>>
>> - /*
>> - * We collect the crc nonblockingly, and should have at least 1
>> - * but not so many crcs that we overflow. Last CRC is the only
>> - * one we care about here. Other CRCs may have been from before
>> - * the cursor update and can contain garbage.
>> - */
>> - igt_assert(ncrcs > 0 && ncrcs < max_crcs);
>> -
>> - igt_assert_crc_equal(&crcs[i], &received_crcs[ncrcs - 1]);
>> - free(received_crcs);
>> + igt_assert_crc_equal(&crcs[i], &test_crc);
>> }
>>
>> igt_remove_fb(display->drm_fd, &fb_info[1]);
>> --
>> 2.16.1
>>
>> _______________________________________________
>> igt-dev mailing list
>> igt-dev@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/igt-dev
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 39+ messages in thread
* [igt-dev] [PATCH i-g-t] lib/igt_debugfs: Add igt_pipe_crc_get_single and igt_pipe_crc_drain, v2.
2018-02-06 16:11 ` Ville Syrjälä
2018-02-06 16:30 ` Maarten Lankhorst
@ 2018-02-07 11:47 ` Maarten Lankhorst
2018-02-08 11:15 ` Mika Kahola
1 sibling, 1 reply; 39+ messages in thread
From: Maarten Lankhorst @ 2018-02-07 11:47 UTC (permalink / raw)
To: igt-dev
Collecting CRC may result in a modeset and extra vblank waits. On some
tests this will increase the runtime a lot, so it makes sense to
keep it enabled, and only collect the most recent CRC when needed.
Changes since v1:
- Fix read_crc semantics. (Ville)
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
lib/igt_debugfs.c | 74 +++++++++++++++++++++++++++++++++++++++++++----
lib/igt_debugfs.h | 2 ++
tests/kms_cursor_legacy.c | 21 ++++----------
3 files changed, 76 insertions(+), 21 deletions(-)
diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
index 1aec079c52bb..dc75d6adbf09 100644
--- a/lib/igt_debugfs.c
+++ b/lib/igt_debugfs.c
@@ -710,11 +710,11 @@ static int read_crc(igt_pipe_crc_t *pipe_crc, igt_crc_t *out)
igt_assert(pipe_crc->flags & O_NONBLOCK);
if (bytes_read < 0)
- bytes_read = 0;
-
- buf[bytes_read] = '\0';
+ bytes_read = -errno;
+ else
+ buf[bytes_read] = '\0';
- if (bytes_read && !pipe_crc_init_from_string(pipe_crc, out, buf))
+ if (bytes_read > 0 && !pipe_crc_init_from_string(pipe_crc, out, buf))
return -EINVAL;
return bytes_read;
@@ -722,7 +722,9 @@ static int read_crc(igt_pipe_crc_t *pipe_crc, igt_crc_t *out)
static void read_one_crc(igt_pipe_crc_t *pipe_crc, igt_crc_t *out)
{
- while (read_crc(pipe_crc, out) == 0)
+ int ret;
+
+ while ((ret = read_crc(pipe_crc, out)) <= 0 && ret != -EINVAL)
usleep(1000);
}
@@ -854,6 +856,68 @@ void igt_pipe_crc_collect_crc(igt_pipe_crc_t *pipe_crc, igt_crc_t *out_crc)
crc_sanity_checks(out_crc);
}
+/**
+ * igt_pipe_crc_drain:
+ * @pipe_crc: pipe CRC object
+ *
+ * Discards all currently queued CRC values from @pipe_crc. This function does
+ * not block, and is useful to flush @pipe_crc. Afterwards you can get a fresh
+ * CRC with igt_pipe_crc_get_single().
+ */
+void igt_pipe_crc_drain(igt_pipe_crc_t *pipe_crc)
+{
+ int ret;
+ igt_crc_t crc;
+
+ fcntl(pipe_crc->crc_fd, F_SETFL, pipe_crc->flags | O_NONBLOCK);
+
+ do {
+ ret = read_crc(pipe_crc, &crc);
+ } while (ret != 0);
+
+ fcntl(pipe_crc->crc_fd, F_SETFL, pipe_crc->flags);
+}
+
+/**
+ * igt_pipe_crc_get_single:
+ * @pipe_crc: pipe CRC object
+ * @crc: buffer pointer for the captured CRC value
+ *
+ * Read a single @crc from @pipe_crc. This function does not block
+ * when nonblocking CRC is requested, and will return false if no CRC
+ * can be captured.
+ *
+ * If opened in blocking mode it will always block until a new CRC is read, like
+ * igt_pipe_crc_collect_crc().
+ *
+ * Callers must start and stop the capturing themselves by calling
+ * igt_pipe_crc_start() and igt_pipe_crc_stop(). For one-shot CRC collecting
+ * look at igt_pipe_crc_collect_crc().
+ *
+ * If capturing has been going on for a while and a fresh crc is required,
+ * you will need to call igt_pipe_crc_drain() first to remove stale entries.
+ *
+ * Returns:
+ * Whether a crc is captured, only false in non-blocking mode.
+ */
+bool
+igt_pipe_crc_get_single(igt_pipe_crc_t *pipe_crc, igt_crc_t *crc)
+{
+ bool found = true;
+
+ if (pipe_crc->flags & O_NONBLOCK) {
+ int ret = read_crc(pipe_crc, crc);
+
+ found = ret > 0;
+ } else
+ read_one_crc(pipe_crc, crc);
+
+ if (found)
+ crc_sanity_checks(crc);
+
+ return found;
+}
+
/*
* Drop caches
*/
diff --git a/lib/igt_debugfs.h b/lib/igt_debugfs.h
index d90dd7a68bb0..8d25abfe43c1 100644
--- a/lib/igt_debugfs.h
+++ b/lib/igt_debugfs.h
@@ -130,6 +130,8 @@ void igt_pipe_crc_stop(igt_pipe_crc_t *pipe_crc);
__attribute__((warn_unused_result))
int igt_pipe_crc_get_crcs(igt_pipe_crc_t *pipe_crc, int n_crcs,
igt_crc_t **out_crcs);
+void igt_pipe_crc_drain(igt_pipe_crc_t *pipe_crc);
+bool igt_pipe_crc_get_single(igt_pipe_crc_t *pipe_crc, igt_crc_t *out_crc);
void igt_pipe_crc_collect_crc(igt_pipe_crc_t *pipe_crc, igt_crc_t *out_crc);
void igt_hpd_storm_set_threshold(int fd, unsigned int threshold);
diff --git a/tests/kms_cursor_legacy.c b/tests/kms_cursor_legacy.c
index 5011e78e5c2f..d0a28b3c442c 100644
--- a/tests/kms_cursor_legacy.c
+++ b/tests/kms_cursor_legacy.c
@@ -1276,7 +1276,7 @@ static void flip_vs_cursor_busy_crc(igt_display_t *display, bool atomic)
enum pipe pipe = find_connected_pipe(display, false);
igt_pipe_t *pipe_connected = &display->pipes[pipe];
igt_plane_t *plane_primary = igt_pipe_get_plane_type(pipe_connected, DRM_PLANE_TYPE_PRIMARY);
- igt_crc_t crcs[2];
+ igt_crc_t crcs[2], test_crc;
if (atomic)
igt_require(display->is_atomic);
@@ -1290,7 +1290,7 @@ static void flip_vs_cursor_busy_crc(igt_display_t *display, bool atomic)
igt_display_commit2(display, display->is_atomic ? COMMIT_ATOMIC : COMMIT_LEGACY);
- pipe_crc = igt_pipe_crc_new_nonblock(display->drm_fd, pipe, INTEL_PIPE_CRC_SOURCE_AUTO);
+ pipe_crc = igt_pipe_crc_new(display->drm_fd, pipe, INTEL_PIPE_CRC_SOURCE_AUTO);
set_cursor_on_pipe(display, pipe, &cursor_fb);
igt_display_commit2(display, COMMIT_UNIVERSAL);
@@ -1322,9 +1322,6 @@ static void flip_vs_cursor_busy_crc(igt_display_t *display, bool atomic)
/* Disable cursor, and immediately queue a flip. Check if resulting crc is correct. */
for (int i = 1; i >= 0; i--) {
igt_spin_t *spin;
- igt_crc_t *received_crcs = NULL;
- int ncrcs;
- static const int max_crcs = 8;
spin = igt_spin_batch_new(display->drm_fd, 0, 0,
fb_info[1].gem_handle);
@@ -1336,7 +1333,8 @@ static void flip_vs_cursor_busy_crc(igt_display_t *display, bool atomic)
igt_assert_eq(get_vblank(display->drm_fd, pipe, 0), vblank_start);
- ncrcs = igt_pipe_crc_get_crcs(pipe_crc, max_crcs, &received_crcs);
+ igt_pipe_crc_drain(pipe_crc);
+ igt_pipe_crc_get_single(pipe_crc, &test_crc);
igt_spin_batch_free(display->drm_fd, spin);
@@ -1349,16 +1347,7 @@ static void flip_vs_cursor_busy_crc(igt_display_t *display, bool atomic)
igt_plane_set_fb(plane_primary, &fb_info[0]);
igt_display_commit2(display, COMMIT_UNIVERSAL);
- /*
- * We collect the crc nonblockingly, and should have at least 1
- * but not so many crcs that we overflow. Last CRC is the only
- * one we care about here. Other CRCs may have been from before
- * the cursor update and can contain garbage.
- */
- igt_assert(ncrcs > 0 && ncrcs < max_crcs);
-
- igt_assert_crc_equal(&crcs[i], &received_crcs[ncrcs - 1]);
- free(received_crcs);
+ igt_assert_crc_equal(&crcs[i], &test_crc);
}
igt_remove_fb(display->drm_fd, &fb_info[1]);
--
2.16.1
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,01/12] lib/igt_fb: Make igt_remove_fb more robust (rev2)
2018-02-06 10:14 [igt-dev] [PATCH i-g-t 01/12] lib/igt_fb: Make igt_remove_fb more robust Maarten Lankhorst
` (11 preceding siblings ...)
2018-02-06 11:25 ` [igt-dev] ✗ Fi.CI.BAT: warning for series starting with [i-g-t,01/12] lib/igt_fb: Make igt_remove_fb more robust Patchwork
@ 2018-02-07 13:30 ` Patchwork
2018-02-07 13:39 ` [igt-dev] [PATCH i-g-t 01/12] lib/igt_fb: Make igt_remove_fb more robust Mika Kahola
` (5 subsequent siblings)
18 siblings, 0 replies; 39+ messages in thread
From: Patchwork @ 2018-02-07 13:30 UTC (permalink / raw)
To: Maarten Lankhorst; +Cc: igt-dev
== Series Details ==
Series: series starting with [i-g-t,01/12] lib/igt_fb: Make igt_remove_fb more robust (rev2)
URL : https://patchwork.freedesktop.org/series/37726/
State : success
== Summary ==
IGT patchset tested on top of latest successful build
2baf7ece5b6d2faccedc56527ec91623f41a85e4 lib: Move __gem_context_create to common ioctl wrapper library.
with latest DRM-Tip kernel build CI_DRM_3733
ec960e17a65b drm-tip: 2018y-02m-07d-11h-43m-42s UTC integration manifest
Testlist changes:
-igt@kms_rotation_crc@primary-rotation-90-flip
-igt@kms_rotation_crc@primary-rotation-90-y-tiled
-igt@kms_rotation_crc@primary-rotation-180-flip
-igt@kms_rotation_crc@primary-rotation-270-flip
-igt@kms_rotation_crc@primary-x-tiled-reflect-x-0-flip
-igt@kms_rotation_crc@primary-x-tiled-reflect-x-180-flip
-igt@kms_rotation_crc@primary-yf-tiled-reflect-x-0-flip
-igt@kms_rotation_crc@primary-yf-tiled-reflect-x-90-flip
-igt@kms_rotation_crc@primary-yf-tiled-reflect-x-180-flip
-igt@kms_rotation_crc@primary-yf-tiled-reflect-x-270-flip
-igt@kms_rotation_crc@primary-y-tiled-reflect-x-0-flip
-igt@kms_rotation_crc@primary-y-tiled-reflect-x-90-flip
-igt@kms_rotation_crc@primary-y-tiled-reflect-x-180-flip
-igt@kms_rotation_crc@primary-y-tiled-reflect-x-270-flip
-igt@kms_rotation_crc@sprite-rotation-90-flip
-igt@kms_rotation_crc@sprite-rotation-180-flip
-igt@kms_rotation_crc@sprite-rotation-270-flip
Test gem_sync:
Subgroup basic-all:
skip -> PASS (fi-blb-e6850)
Subgroup basic-each:
skip -> PASS (fi-blb-e6850)
Subgroup basic-many-each:
skip -> PASS (fi-blb-e6850)
Subgroup basic-store-all:
skip -> PASS (fi-blb-e6850)
Subgroup basic-store-each:
skip -> PASS (fi-blb-e6850)
Test gem_tiled_blits:
Subgroup basic:
skip -> PASS (fi-blb-e6850)
Test gem_tiled_fence_blits:
Subgroup basic:
skip -> PASS (fi-blb-e6850)
Test gem_wait:
Subgroup basic-busy-all:
skip -> PASS (fi-blb-e6850)
Subgroup basic-wait-all:
skip -> PASS (fi-blb-e6850)
Subgroup basic-await-all:
skip -> PASS (fi-blb-e6850)
Test kms_busy:
Subgroup basic-flip-a:
skip -> PASS (fi-blb-e6850)
Subgroup basic-flip-b:
skip -> PASS (fi-blb-e6850)
Test kms_cursor_legacy:
Subgroup basic-busy-flip-before-cursor-legacy:
skip -> PASS (fi-blb-e6850)
Test kms_pipe_crc_basic:
Subgroup suspend-read-crc-pipe-c:
dmesg-fail -> PASS (fi-cnl-y3) fdo#104951
fdo#104951 https://bugs.freedesktop.org/show_bug.cgi?id=104951
fi-bdw-5557u total:288 pass:267 dwarn:0 dfail:0 fail:0 skip:21 time:419s
fi-bdw-gvtdvm total:288 pass:264 dwarn:0 dfail:0 fail:0 skip:24 time:428s
fi-blb-e6850 total:288 pass:223 dwarn:1 dfail:0 fail:0 skip:64 time:374s
fi-bsw-n3050 total:288 pass:242 dwarn:0 dfail:0 fail:0 skip:46 time:488s
fi-bwr-2160 total:288 pass:183 dwarn:0 dfail:0 fail:0 skip:105 time:288s
fi-bxt-dsi total:288 pass:258 dwarn:0 dfail:0 fail:0 skip:30 time:482s
fi-bxt-j4205 total:288 pass:259 dwarn:0 dfail:0 fail:0 skip:29 time:492s
fi-byt-j1900 total:288 pass:253 dwarn:0 dfail:0 fail:0 skip:35 time:472s
fi-byt-n2820 total:288 pass:249 dwarn:0 dfail:0 fail:0 skip:39 time:464s
fi-cfl-s2 total:288 pass:262 dwarn:0 dfail:0 fail:0 skip:26 time:570s
fi-cnl-y3 total:288 pass:262 dwarn:0 dfail:0 fail:0 skip:26 time:583s
fi-elk-e7500 total:288 pass:229 dwarn:0 dfail:0 fail:0 skip:59 time:419s
fi-gdg-551 total:288 pass:179 dwarn:0 dfail:0 fail:1 skip:108 time:288s
fi-glk-1 total:288 pass:260 dwarn:0 dfail:0 fail:0 skip:28 time:511s
fi-hsw-4770 total:288 pass:261 dwarn:0 dfail:0 fail:0 skip:27 time:393s
fi-ilk-650 total:288 pass:228 dwarn:0 dfail:0 fail:0 skip:60 time:416s
fi-ivb-3520m total:288 pass:259 dwarn:0 dfail:0 fail:0 skip:29 time:463s
fi-ivb-3770 total:288 pass:255 dwarn:0 dfail:0 fail:0 skip:33 time:420s
fi-kbl-7500u total:288 pass:263 dwarn:1 dfail:0 fail:0 skip:24 time:461s
fi-kbl-7560u total:288 pass:269 dwarn:0 dfail:0 fail:0 skip:19 time:498s
fi-kbl-7567u total:288 pass:268 dwarn:0 dfail:0 fail:0 skip:20 time:462s
fi-kbl-r total:288 pass:261 dwarn:0 dfail:0 fail:0 skip:27 time:499s
fi-pnv-d510 total:288 pass:222 dwarn:1 dfail:0 fail:0 skip:65 time:601s
fi-skl-6260u total:288 pass:268 dwarn:0 dfail:0 fail:0 skip:20 time:433s
fi-skl-6600u total:288 pass:261 dwarn:0 dfail:0 fail:0 skip:27 time:511s
fi-skl-6700hq total:288 pass:262 dwarn:0 dfail:0 fail:0 skip:26 time:532s
fi-skl-6700k2 total:288 pass:264 dwarn:0 dfail:0 fail:0 skip:24 time:487s
fi-skl-6770hq total:288 pass:268 dwarn:0 dfail:0 fail:0 skip:20 time:481s
fi-skl-guc total:288 pass:260 dwarn:0 dfail:0 fail:0 skip:28 time:422s
fi-skl-gvtdvm total:288 pass:265 dwarn:0 dfail:0 fail:0 skip:23 time:436s
fi-snb-2520m total:245 pass:211 dwarn:0 dfail:0 fail:0 skip:33
fi-snb-2600 total:288 pass:248 dwarn:0 dfail:0 fail:0 skip:40 time:403s
Blacklisted hosts:
fi-glk-dsi total:288 pass:258 dwarn:0 dfail:0 fail:0 skip:30 time:471s
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_881/issues.html
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [igt-dev] [PATCH i-g-t 01/12] lib/igt_fb: Make igt_remove_fb more robust
2018-02-06 10:14 [igt-dev] [PATCH i-g-t 01/12] lib/igt_fb: Make igt_remove_fb more robust Maarten Lankhorst
` (12 preceding siblings ...)
2018-02-07 13:30 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,01/12] lib/igt_fb: Make igt_remove_fb more robust (rev2) Patchwork
@ 2018-02-07 13:39 ` Mika Kahola
2018-02-07 16:36 ` [igt-dev] ✗ Fi.CI.IGT: failure for series starting with [i-g-t,01/12] lib/igt_fb: Make igt_remove_fb more robust (rev2) Patchwork
` (4 subsequent siblings)
18 siblings, 0 replies; 39+ messages in thread
From: Mika Kahola @ 2018-02-07 13:39 UTC (permalink / raw)
To: Maarten Lankhorst, igt-dev
On Tue, 2018-02-06 at 11:14 +0100, Maarten Lankhorst wrote:
> This will make it easier for tests to unconditionally call
> igt_remove_fb, without first checking whether the FB is allocated.
>
Reviewed-by: Mika Kahola <mika.kahola@intel.com>
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> ---
> lib/igt_fb.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/lib/igt_fb.c b/lib/igt_fb.c
> index 6fecdd6699a5..35a928b9281d 100644
> --- a/lib/igt_fb.c
> +++ b/lib/igt_fb.c
> @@ -1623,9 +1623,13 @@ void igt_put_cairo_ctx(int fd, struct igt_fb
> *fb, cairo_t *cr)
> */
> void igt_remove_fb(int fd, struct igt_fb *fb)
> {
> + if (!fb || !fb->fb_id)
> + return;
> +
> cairo_surface_destroy(fb->cairo_surface);
> do_or_die(drmModeRmFB(fd, fb->fb_id));
> gem_close(fd, fb->gem_handle);
> + fb->fb_id = 0;
> }
>
> /**
--
Mika Kahola - Intel OTC
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [igt-dev] [PATCH i-g-t 02/12] tests: Always call igt_remove_fb without checking.
2018-02-06 10:14 ` [igt-dev] [PATCH i-g-t 02/12] tests: Always call igt_remove_fb without checking Maarten Lankhorst
@ 2018-02-07 13:42 ` Mika Kahola
0 siblings, 0 replies; 39+ messages in thread
From: Mika Kahola @ 2018-02-07 13:42 UTC (permalink / raw)
To: Maarten Lankhorst, igt-dev
On Tue, 2018-02-06 at 11:14 +0100, Maarten Lankhorst wrote:
> This cleans up the tests slightly.
>
Reviewed-by: Mika Kahola <mika.kahola@intel.com>
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> ---
> tests/kms_flip.c | 3 +--
> tests/kms_panel_fitting.c | 15 +++------------
> tests/kms_plane_scaling.c | 7 +------
> tests/kms_rotation_crc.c | 16 ++--------------
> tests/kms_setmode.c | 12 +++---------
> 5 files changed, 10 insertions(+), 43 deletions(-)
>
> diff --git a/tests/kms_flip.c b/tests/kms_flip.c
> index b43e77123e7f..3d6fe948d3bb 100644
> --- a/tests/kms_flip.c
> +++ b/tests/kms_flip.c
> @@ -1332,8 +1332,7 @@ static void run_test_on_crtc_set(struct
> test_output *o, int *crtc_idxs,
> igt_info("\n%s: PASSED\n\n", test_name);
>
> out:
> - if (o->fb_ids[2])
> - igt_remove_fb(drm_fd, &o->fb_info[2]);
> + igt_remove_fb(drm_fd, &o->fb_info[2]);
> igt_remove_fb(drm_fd, &o->fb_info[1]);
> igt_remove_fb(drm_fd, &o->fb_info[0]);
>
> diff --git a/tests/kms_panel_fitting.c b/tests/kms_panel_fitting.c
> index e0ca6cca8e6a..b3cee223a8e7 100644
> --- a/tests/kms_panel_fitting.c
> +++ b/tests/kms_panel_fitting.c
> @@ -51,10 +51,7 @@ static void prepare_crtc(data_t *data,
> igt_output_t *output, enum pipe pipe,
> igt_output_set_pipe(output, pipe);
>
> /* before allocating, free if any older fb */
> - if (data->fb1.fb_id) {
> - igt_remove_fb(data->drm_fd, &data->fb1);
> - data->fb1.fb_id = 0;
> - }
> + igt_remove_fb(data->drm_fd, &data->fb1);
>
> /* allocate fb for plane 1 */
> igt_create_pattern_fb(data->drm_fd,
> @@ -83,14 +80,8 @@ static void cleanup_crtc(data_t *data,
> igt_output_t *output, igt_plane_t *plane)
> {
> igt_display_t *display = &data->display;
>
> - if (data->fb1.fb_id) {
> - igt_remove_fb(data->drm_fd, &data->fb1);
> - data->fb1.fb_id = 0;
> - }
> - if (data->fb2.fb_id) {
> - igt_remove_fb(data->drm_fd, &data->fb2);
> - data->fb2.fb_id = 0;
> - }
> + igt_remove_fb(data->drm_fd, &data->fb1);
> + igt_remove_fb(data->drm_fd, &data->fb2);
>
> if (plane->type != DRM_PLANE_TYPE_PRIMARY) {
> igt_plane_t *primary;
> diff --git a/tests/kms_plane_scaling.c b/tests/kms_plane_scaling.c
> index 208f9262f84b..3171331c96b8 100644
> --- a/tests/kms_plane_scaling.c
> +++ b/tests/kms_plane_scaling.c
> @@ -62,13 +62,8 @@ static void cleanup_fbs(data_t *data)
> {
> int i;
>
> - for (i = 0; i < ARRAY_SIZE(data->fb); i++) {
> - if (!data->fb[i].fb_id)
> - continue;
> -
> + for (i = 0; i < ARRAY_SIZE(data->fb); i++)
> igt_remove_fb(data->drm_fd, &data->fb[i]);
> - data->fb[i].fb_id = 0;
> - }
> }
>
> static void cleanup_crtc(data_t *data)
> diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
> index f65562bae9eb..4f56d3d65db4 100644
> --- a/tests/kms_rotation_crc.c
> +++ b/tests/kms_rotation_crc.c
> @@ -174,17 +174,10 @@ static void prepare_crtc(data_t *data,
> igt_output_t *output, enum pipe pipe,
>
> static void remove_fbs(data_t *data)
> {
> - if (!data->fb.fb_id)
> - return;
> -
> igt_remove_fb(data->gfx_fd, &data->fb);
> igt_remove_fb(data->gfx_fd, &data->fb_reference);
> igt_remove_fb(data->gfx_fd, &data->fb_unrotated);
> -
> - if (data->fb_flip.fb_id)
> - igt_remove_fb(data->gfx_fd, &data->fb_flip);
> -
> - data->fb_flip.fb_id = data->fb.fb_id = 0;
> + igt_remove_fb(data->gfx_fd, &data->fb_flip);
> }
>
> enum rectangle_type {
> @@ -205,12 +198,7 @@ static void prepare_fbs(data_t *data,
> igt_output_t *output,
> uint32_t pixel_format = data->override_fmt ?:
> DRM_FORMAT_XRGB8888;
> const float flip_opacity = 0.75;
>
> - if (data->fb.fb_id) {
> - igt_plane_set_fb(plane, NULL);
> - igt_display_commit2(display, display->is_atomic ?
> COMMIT_ATOMIC : COMMIT_UNIVERSAL);
> -
> - remove_fbs(data);
> - }
> + remove_fbs(data);
>
> igt_plane_set_rotation(plane, IGT_ROTATION_0);
>
> diff --git a/tests/kms_setmode.c b/tests/kms_setmode.c
> index 06241b191a0f..47d04fb5f7b1 100644
> --- a/tests/kms_setmode.c
> +++ b/tests/kms_setmode.c
> @@ -361,6 +361,9 @@ static void cleanup_crtcs(struct crtc_config
> *crtcs, int crtc_count)
> int i;
>
> for (i = 0; i < crtc_count; i++) {
> + igt_remove_fb(drm_fd, &crtcs[i].fb_info);
> + drmModeSetCrtc(drm_fd, crtcs[i].crtc_id, 0, 0, 0,
> NULL, 0, NULL);
> +
> free(crtcs[i].cconfs);
> }
> }
> @@ -577,15 +580,6 @@ static void test_crtc_config(const struct
> test_config *tconf,
> if (ret == 0 && tconf->flags & TEST_TIMINGS)
> check_timings(crtcs[0].crtc_idx, &crtcs[0].mode);
>
> - for (i = 0; i < crtc_count; i++) {
> - if (crtcs[i].fb_info.fb_id) {
> - drmModeSetCrtc(drm_fd, crtcs[i].crtc_id, 0,
> 0, 0, NULL,
> - 0, NULL);
> - drmModeRmFB(drm_fd, crtcs[i].fb_info.fb_id);
> - crtcs[i].fb_info.fb_id = 0;
> - }
> - }
> -
> return;
> }
>
--
Mika Kahola - Intel OTC
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 39+ messages in thread
* [igt-dev] ✗ Fi.CI.IGT: failure for series starting with [i-g-t,01/12] lib/igt_fb: Make igt_remove_fb more robust (rev2)
2018-02-06 10:14 [igt-dev] [PATCH i-g-t 01/12] lib/igt_fb: Make igt_remove_fb more robust Maarten Lankhorst
` (13 preceding siblings ...)
2018-02-07 13:39 ` [igt-dev] [PATCH i-g-t 01/12] lib/igt_fb: Make igt_remove_fb more robust Mika Kahola
@ 2018-02-07 16:36 ` Patchwork
2018-02-08 19:06 ` ✓ Fi.CI.BAT: success for lib/igt_debugfs: Add igt_pipe_crc_get_single and igt_pipe_crc_drain, v3 Patchwork
` (3 subsequent siblings)
18 siblings, 0 replies; 39+ messages in thread
From: Patchwork @ 2018-02-07 16:36 UTC (permalink / raw)
To: Maarten Lankhorst; +Cc: igt-dev
== Series Details ==
Series: series starting with [i-g-t,01/12] lib/igt_fb: Make igt_remove_fb more robust (rev2)
URL : https://patchwork.freedesktop.org/series/37726/
State : failure
== Summary ==
Test kms_rotation_crc:
Subgroup primary-rotation-270:
pass -> FAIL (shard-apl)
Subgroup cursor-rotation-180:
pass -> FAIL (shard-snb)
pass -> FAIL (shard-hsw) fdo#102614
pass -> FAIL (shard-apl)
Subgroup sprite-rotation-270:
pass -> FAIL (shard-apl) fdo#103356 +2
Subgroup primary-rotation-90:
pass -> FAIL (shard-apl) fdo#103925 +2
Subgroup sprite-rotation-180:
pass -> FAIL (shard-snb)
pass -> FAIL (shard-hsw)
pass -> FAIL (shard-apl)
Subgroup primary-rotation-180:
pass -> FAIL (shard-snb)
pass -> FAIL (shard-hsw)
Subgroup bad-pixel-format:
pass -> FAIL (shard-apl)
Test kms_flip:
Subgroup 2x-plain-flip-ts-check-interruptible:
fail -> PASS (shard-hsw) fdo#100368 +4
Subgroup flip-vs-modeset-vs-hang-interruptible:
pass -> SKIP (shard-apl)
Test kms_cursor_legacy:
Subgroup flip-vs-cursor-busy-crc-atomic:
pass -> FAIL (shard-snb)
pass -> FAIL (shard-hsw)
pass -> FAIL (shard-apl)
Subgroup flip-vs-cursor-busy-crc-legacy:
pass -> FAIL (shard-snb)
pass -> FAIL (shard-hsw)
pass -> FAIL (shard-apl)
Test kms_sysfs_edid_timing:
pass -> WARN (shard-apl) fdo#100047
Test kms_draw_crc:
Subgroup draw-method-rgb565-blt-xtiled:
skip -> PASS (shard-snb)
Subgroup draw-method-xrgb2101010-mmap-cpu-xtiled:
pass -> SKIP (shard-apl)
Subgroup fill-fb:
pass -> SKIP (shard-apl)
Test kms_setmode:
Subgroup basic:
fail -> PASS (shard-hsw) fdo#99912
Test kms_frontbuffer_tracking:
Subgroup fbc-1p-primscrn-pri-shrfb-draw-blt:
pass -> SKIP (shard-apl) fdo#101623
Test kms_cursor_crc:
Subgroup cursor-256x256-onscreen:
pass -> SKIP (shard-apl)
Subgroup cursor-128x128-suspend:
skip -> PASS (shard-snb) fdo#103880
Test kms_chv_cursor_fail:
Subgroup pipe-a-256x256-right-edge:
pass -> SKIP (shard-apl)
Test kms_color:
Subgroup pipe-c-ctm-green-to-red:
pass -> SKIP (shard-apl)
Subgroup pipe-c-ctm-max:
pass -> SKIP (shard-apl)
Test kms_plane_scaling:
Subgroup pipe-c-plane-scaling:
pass -> SKIP (shard-apl)
Test kms_pipe_crc_basic:
Subgroup nonblocking-crc-pipe-a:
pass -> SKIP (shard-apl)
Test kms_universal_plane:
Subgroup disable-primary-vs-flip-pipe-c:
pass -> SKIP (shard-apl)
Test drm_read:
Subgroup short-buffer-block:
pass -> SKIP (shard-apl)
Test kms_plane:
Subgroup plane-position-hole-dpms-pipe-a-planes:
fail -> PASS (shard-apl) fdo#103166
fdo#102614
fdo#103356
fdo#103925
fdo#100368
fdo#100047
fdo#99912
fdo#101623
fdo#103880
fdo#103166
shard-apl total:3422 pass:1747 dwarn:1 dfail:0 fail:34 skip:1638 time:13359s
shard-hsw total:3425 pass:1752 dwarn:1 dfail:0 fail:15 skip:1656 time:14333s
shard-snb total:3425 pass:1343 dwarn:1 dfail:0 fail:16 skip:2065 time:7590s
Blacklisted hosts:
shard-kbl total:3425 pass:1892 dwarn:1 dfail:0 fail:33 skip:1499 time:11127s
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_881/shards.html
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [igt-dev] [PATCH i-g-t 12/12] tests/kms_rotation_crc: Test all pixel formats on all planes.
2018-02-06 10:14 ` [igt-dev] [PATCH i-g-t 12/12] tests/kms_rotation_crc: Test all pixel formats on all planes Maarten Lankhorst
@ 2018-02-08 3:33 ` Srinivas, Vidya
2018-02-12 13:09 ` Mika Kahola
1 sibling, 0 replies; 39+ messages in thread
From: Srinivas, Vidya @ 2018-02-08 3:33 UTC (permalink / raw)
To: Maarten Lankhorst, igt-dev
Commenting on the last patch in this series to cover all the patches related to kms_rotation_crc:
Tested kms_rotation_crc to be working correctly on GLK system.
Please include my tested-by tag if required.
Regards
Vidya
> -----Original Message-----
> From: igt-dev [mailto:igt-dev-bounces@lists.freedesktop.org] On Behalf Of
> Maarten Lankhorst
> Sent: Tuesday, February 6, 2018 3:44 PM
> To: igt-dev@lists.freedesktop.org
> Subject: [igt-dev] [PATCH i-g-t 12/12] tests/kms_rotation_crc: Test all pixel
> formats on all planes.
>
> The test is modified to test all pixel formats on a plane, unless the pixel
> format is overridden by the subtest.
>
> Attempting to test all pixel formats requires even more runtime and the
> overhead of toggling crc collection to capture a single CRC becomes
> significant, so keep the crc collection enabled during the entire test.
>
> This reduces the runtime from ~24s to ~16s per subtest on SKL.
>
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> ---
> tests/kms_rotation_crc.c | 129 ++++++++++++++++++++++++++++------------
> -------
> 1 file changed, 77 insertions(+), 52 deletions(-)
>
> diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c index
> 18c3e13431db..0cd5c6e52b57 100644
> --- a/tests/kms_rotation_crc.c
> +++ b/tests/kms_rotation_crc.c
> @@ -153,9 +153,10 @@ static void prepare_crtc(data_t *data, igt_output_t
> *output, enum pipe pipe,
>
> /* create the pipe_crc object for this pipe */
> igt_pipe_crc_free(data->pipe_crc);
> - data->pipe_crc = igt_pipe_crc_new(data->gfx_fd, pipe,
> INTEL_PIPE_CRC_SOURCE_AUTO);
>
> igt_display_commit2(display, COMMIT_ATOMIC);
> + data->pipe_crc = igt_pipe_crc_new(data->gfx_fd, pipe,
> INTEL_PIPE_CRC_SOURCE_AUTO);
> + igt_pipe_crc_start(data->pipe_crc);
> }
>
> enum rectangle_type {
> @@ -167,7 +168,7 @@ enum rectangle_type { };
>
> static void prepare_fbs(data_t *data, igt_output_t *output,
> - igt_plane_t *plane, enum rectangle_type rect)
> + igt_plane_t *plane, enum rectangle_type rect,
> uint32_t format)
> {
> drmModeModeInfo *mode;
> igt_display_t *display = &data->display; @@ -234,7 +235,8 @@
> static void prepare_fbs(data_t *data, igt_output_t *output,
> if (plane->type != DRM_PLANE_TYPE_CURSOR)
> igt_plane_set_position(plane, data->pos_x, data->pos_y);
> igt_display_commit2(display, COMMIT_ATOMIC);
> - igt_pipe_crc_collect_crc(data->pipe_crc, &data->flip_crc);
> + igt_pipe_crc_drain(data->pipe_crc);
> + igt_pipe_crc_get_single(data->pipe_crc, &data->flip_crc);
>
> /*
> * Prepare the non-rotated flip fb.
> @@ -257,7 +259,8 @@ static void prepare_fbs(data_t *data, igt_output_t
> *output,
> igt_plane_set_position(plane, data->pos_x, data->pos_y);
> igt_display_commit2(display, COMMIT_ATOMIC);
>
> - igt_pipe_crc_collect_crc(data->pipe_crc, &data->ref_crc);
> + igt_pipe_crc_drain(data->pipe_crc);
> + igt_pipe_crc_get_single(data->pipe_crc, &data->ref_crc);
>
> /*
> * Prepare the non-rotated reference fb.
> @@ -298,21 +301,77 @@ static void wait_for_pageflip(int fd)
> igt_assert(drmHandleEvent(fd, &evctx) == 0); }
>
> +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) {
> + 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);
> +
> + igt_plane_set_rotation(plane, data->rotation);
> + if (data->rotation & (IGT_ROTATION_90 | IGT_ROTATION_270))
> + igt_plane_set_size(plane, data->fb.height, data->fb.width);
> +
> + ret = igt_display_try_commit2(display, COMMIT_ATOMIC);
> + if (test_bad_format) {
> + igt_assert_eq(ret, -EINVAL);
> + return;
> + }
> +
> + /* Verify commit was ok. */
> + igt_assert_eq(ret, 0);
> +
> + /* Check CRC */
> + igt_pipe_crc_drain(data->pipe_crc);
> + igt_pipe_crc_get_single(data->pipe_crc, &crc_output);
> + igt_assert_crc_equal(&data->ref_crc, &crc_output);
> +
> + /*
> + * If flips are requested flip to a different fb and
> + * check CRC against that one as well.
> + */
> + if (data->fb_flip.fb_id) {
> + igt_plane_set_fb(plane, &data->fb_flip);
> + if (data->rotation == IGT_ROTATION_90 || data->rotation
> == IGT_ROTATION_270)
> + igt_plane_set_size(plane, data->fb.height, data-
> >fb.width);
> +
> + if (plane->type != DRM_PLANE_TYPE_PRIMARY) {
> + igt_display_commit_atomic(display,
> DRM_MODE_PAGE_FLIP_EVENT | DRM_MODE_ATOMIC_NONBLOCK,
> NULL);
> + } else {
> + ret = drmModePageFlip(data->gfx_fd,
> + output->config.crtc->crtc_id,
> + data->fb_flip.fb_id,
> + DRM_MODE_PAGE_FLIP_EVENT,
> + NULL);
> + igt_assert_eq(ret, 0);
> + }
> + wait_for_pageflip(data->gfx_fd);
> + igt_pipe_crc_drain(data->pipe_crc);
> + igt_pipe_crc_get_single(data->pipe_crc, &crc_output);
> + igt_assert_crc_equal(&data->flip_crc,
> + &crc_output);
> + }
> +}
> +
> static void test_plane_rotation(data_t *data, int plane_type, bool
> test_bad_format) {
> igt_display_t *display = &data->display;
> igt_output_t *output;
> enum pipe pipe;
> - int valid_tests = 0;
> - igt_crc_t crc_output;
> - int ret;
>
> if (plane_type == DRM_PLANE_TYPE_CURSOR)
> igt_require(display->has_cursor_plane);
>
> + igt_display_require_output(display);
> +
> for_each_pipe_with_valid_output(display, pipe, output) {
> igt_plane_t *plane;
> - int i;
> + int i, j;
>
> if (IS_CHERRYVIEW(data->devid) && pipe != PIPE_B)
> continue;
> @@ -335,56 +394,22 @@ static void test_plane_rotation(data_t *data, int
> plane_type, bool test_bad_form
> i != rectangle &&
> intel_gen(intel_get_drm_devid(data->gfx_fd)) < 9)
> continue;
>
> - igt_debug("Testing case %i on pipe %s\n", i,
> kmstest_pipe_name(pipe));
> - prepare_fbs(data, output, plane, i);
> -
> - igt_plane_set_rotation(plane, data->rotation);
> - if (data->rotation & (IGT_ROTATION_90 |
> IGT_ROTATION_270))
> - igt_plane_set_size(plane, data->fb.height,
> data->fb.width);
> + if (!data->override_fmt) {
> + for (j = 0; j < plane->drm_plane-
> >count_formats; j++) {
> + uint32_t format = plane-
> >drm_plane->formats[j];
>
> - ret = igt_display_try_commit2(display,
> COMMIT_ATOMIC);
> - if (test_bad_format) {
> - igt_assert_eq(ret, -EINVAL);
> - continue;
> - }
> + if
> (!igt_fb_supported_format(format))
> + continue;
>
> - /* Verify commit was ok. */
> - igt_assert_eq(ret, 0);
> -
> - /* Check CRC */
> - igt_pipe_crc_collect_crc(data->pipe_crc,
> &crc_output);
> - igt_assert_crc_equal(&data->ref_crc, &crc_output);
> -
> - /*
> - * If flips are requested flip to a different fb and
> - * check CRC against that one as well.
> - */
> - if (data->fb_flip.fb_id) {
> - igt_plane_set_fb(plane, &data->fb_flip);
> - if (data->rotation == IGT_ROTATION_90 ||
> data->rotation == IGT_ROTATION_270)
> - igt_plane_set_size(plane, data-
> >fb.height, data->fb.width);
> -
> - if (plane_type !=
> DRM_PLANE_TYPE_PRIMARY) {
> - igt_display_commit_atomic(display,
> DRM_MODE_PAGE_FLIP_EVENT | DRM_MODE_ATOMIC_NONBLOCK,
> NULL);
> - } else {
> - ret = drmModePageFlip(data-
> >gfx_fd,
> - output->config.crtc-
> >crtc_id,
> - data->fb_flip.fb_id,
> -
> DRM_MODE_PAGE_FLIP_EVENT,
> - NULL);
> - igt_assert_eq(ret, 0);
> + test_single_case(data, pipe, output,
> plane, i,
> + format,
> test_bad_format);
> }
> - wait_for_pageflip(data->gfx_fd);
> - igt_pipe_crc_collect_crc(data->pipe_crc,
> - &crc_output);
> - igt_assert_crc_equal(&data->flip_crc,
> - &crc_output);
> + } else {
> + test_single_case(data, pipe, output, plane, i,
> + data->override_fmt,
> test_bad_format);
> }
> }
> -
> - valid_tests++;
> }
> - igt_require_f(valid_tests, "no valid crtc/connector combinations
> found\n");
> }
>
> static void test_plane_rotation_exhaust_fences(data_t *data,
> --
> 2.16.1
>
> _______________________________________________
> igt-dev mailing list
> igt-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/igt-dev
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [igt-dev] [PATCH i-g-t 03/12] lib/igt_fb: Add igt_fb_supported_format()
2018-02-06 10:14 ` [igt-dev] [PATCH i-g-t 03/12] lib/igt_fb: Add igt_fb_supported_format() Maarten Lankhorst
@ 2018-02-08 8:08 ` Mika Kahola
0 siblings, 0 replies; 39+ messages in thread
From: Mika Kahola @ 2018-02-08 8:08 UTC (permalink / raw)
To: Maarten Lankhorst, igt-dev
On Tue, 2018-02-06 at 11:14 +0100, Maarten Lankhorst wrote:
> This makes it possible to iterate whether a format is supported or
> not,
> without each driver having to open code it.
>
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> ---
> lib/igt_fb.c | 18 ++++++++++++++++++
> lib/igt_fb.h | 1 +
> tests/kms_atomic.c | 13 +++----------
> tests/kms_plane.c | 16 +---------------
> tests/kms_plane_scaling.c | 22 ++++------------------
> 5 files changed, 27 insertions(+), 43 deletions(-)
>
> diff --git a/lib/igt_fb.c b/lib/igt_fb.c
> index 35a928b9281d..0389b1c1b159 100644
> --- a/lib/igt_fb.c
> +++ b/lib/igt_fb.c
> @@ -1719,3 +1719,21 @@ void igt_get_all_cairo_formats(const uint32_t
> **formats, int *format_count)
> *formats = drm_formats;
> *format_count = n_formats;
> }
> +
> +/**
> + * igt_fb_supported_format:
> + * @drm_format: drm fourcc to test.
> + *
> + * This functions returns whether @drm_format can be succesfully
> created by
> + * igt_create_fb() and drawn to by igt_get_cairo_ctx().
> + */
> +bool igt_fb_supported_format(uint32_t drm_format)
> +{
> + struct format_desc_struct *f;
> +
> + for_each_format(f)
> + if (f->drm_id == drm_format)
> + return f->cairo_id != CAIRO_FORMAT_INVALID;
> +
Maybe we could utilize the existing lookup_drm_format() function but
even so we wouldn't save no more than couple of lines. I'm ok with this
approach.
Reviewed-by: Mika Kahola <mika.kahola@intel.com>
> + return false;
> +}
> diff --git a/lib/igt_fb.h b/lib/igt_fb.h
> index 77fd88bb7aca..a6ce07898784 100644
> --- a/lib/igt_fb.h
> +++ b/lib/igt_fb.h
> @@ -163,6 +163,7 @@ uint32_t igt_bpp_depth_to_drm_format(int bpp, int
> depth);
> uint32_t igt_drm_format_to_bpp(uint32_t drm_format);
> const char *igt_format_str(uint32_t drm_format);
> void igt_get_all_cairo_formats(const uint32_t **formats, int
> *format_count);
> +bool igt_fb_supported_format(uint32_t drm_format);
>
> #endif /* __IGT_FB_H__ */
>
> diff --git a/tests/kms_atomic.c b/tests/kms_atomic.c
> index 2e21b53b8c87..ac02baf0170b 100644
> --- a/tests/kms_atomic.c
> +++ b/tests/kms_atomic.c
> @@ -264,20 +264,13 @@ static void
> crtc_commit_atomic_flags_err(igt_pipe_t *pipe, igt_plane_t *plane,
> static uint32_t plane_get_igt_format(igt_plane_t *plane)
> {
> drmModePlanePtr plane_kms;
> - const uint32_t *igt_formats;
> - int num_igt_formats;
> int i;
>
> plane_kms = plane->drm_plane;
>
> - igt_get_all_cairo_formats(&igt_formats, &num_igt_formats);
> - for (i = 0; i < num_igt_formats; i++) {
> - int j;
> -
> - for (j = 0; j < plane_kms->count_formats; j++) {
> - if (plane_kms->formats[j] == igt_formats[i])
> - return plane_kms->formats[j];
> - }
> + for (i = 0; i < plane_kms->count_formats; i++) {
> + if (igt_fb_supported_format(plane_kms->formats[i]))
> + return plane_kms->formats[i];
> }
>
> return 0;
> diff --git a/tests/kms_plane.c b/tests/kms_plane.c
> index 54bcffc16f4f..23173b966eab 100644
> --- a/tests/kms_plane.c
> +++ b/tests/kms_plane.c
> @@ -366,20 +366,6 @@ test_plane_panning(data_t *data, enum pipe pipe,
> unsigned int flags)
> igt_skip_on(connected_outs == 0);
> }
>
> -static bool can_draw(uint32_t drm_format)
> -{
> - const uint32_t *drm_formats;
> - int format_count, i;
> -
> - igt_get_all_cairo_formats(&drm_formats, &format_count);
> -
> - for (i = 0; i < format_count; i++)
> - if (drm_formats[i] == drm_format)
> - return true;
> -
> - return false;
> -}
> -
> static void test_format_plane(data_t *data, enum pipe pipe,
> igt_output_t *output, igt_plane_t
> *plane)
> {
> @@ -420,7 +406,7 @@ static void test_format_plane(data_t *data, enum
> pipe pipe,
> for (i = 0; i < plane->drm_plane->count_formats; i++) {
> format = plane->drm_plane->formats[i];
>
> - if (!can_draw(format))
> + if (!igt_fb_supported_format(format))
> continue;
>
> igt_debug("Testing format 0x%x on %s.%u\n",
> diff --git a/tests/kms_plane_scaling.c b/tests/kms_plane_scaling.c
> index 3171331c96b8..7a5470106cd5 100644
> --- a/tests/kms_plane_scaling.c
> +++ b/tests/kms_plane_scaling.c
> @@ -173,20 +173,6 @@ static bool can_rotate(unsigned format)
> return true;
> }
>
> -static bool can_draw(uint32_t drm_format)
> -{
> - const uint32_t *drm_formats;
> - int format_count, i;
> -
> - igt_get_all_cairo_formats(&drm_formats, &format_count);
> -
> - for (i = 0; i < format_count; i++)
> - if (drm_formats[i] == drm_format)
> - return true;
> -
> - return false;
> -}
> -
> static void test_scaler_with_rotation_pipe(data_t *d, enum pipe
> pipe,
> igt_output_t *output)
> {
> @@ -202,7 +188,7 @@ static void test_scaler_with_rotation_pipe(data_t
> *d, enum pipe pipe,
> igt_rotation_t rot = rotations[i];
> for (int j = 0; j < plane->drm_plane-
> >count_formats; j++) {
> unsigned format = plane->drm_plane-
> >formats[j];
> - if (can_draw(format) &&
> can_rotate(format))
> + if (igt_fb_supported_format(format)
> && can_rotate(format))
> check_scaling_pipe_plane_rot
> (d, plane, format,
>
> LOCAL_I915_FORMAT_MOD_Y_TILED,
>
> pipe, output, rot);
> @@ -235,7 +221,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];
>
> - if (can_draw(format))
> + if (igt_fb_supported_format(format))
> check_scaling_pipe_plane_rot
> (d, plane,
>
> format, tiling,
>
> pipe, output, IGT_ROTATION_0);
> @@ -446,13 +432,13 @@
> test_scaler_with_clipping_clamping_scenario(data_t *d, enum pipe
> pipe, igt_outpu
>
> for (int i = 0; i < d->plane1->drm_plane->count_formats;
> i++) {
> unsigned f1 = d->plane1->drm_plane->formats[i];
> - if (!can_draw(f1))
> + if (!igt_fb_supported_format(f1))
> continue;
>
> for (int j = 0; j < d->plane2->drm_plane-
> >count_formats; j++) {
> unsigned f2 = d->plane2->drm_plane-
> >formats[j];
>
> - if (!can_draw(f2))
> + if (!igt_fb_supported_format(f2))
> continue;
>
> __test_scaler_with_clipping_clamping_scenari
> o(d, mode, f1, f2);
--
Mika Kahola - Intel OTC
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [igt-dev] [PATCH i-g-t 04/12] lib/igt_fb: Remove igt_get_all_cairo_formats()
2018-02-06 10:14 ` [igt-dev] [PATCH i-g-t 04/12] lib/igt_fb: Remove igt_get_all_cairo_formats() Maarten Lankhorst
@ 2018-02-08 8:15 ` Mika Kahola
0 siblings, 0 replies; 39+ messages in thread
From: Mika Kahola @ 2018-02-08 8:15 UTC (permalink / raw)
To: Maarten Lankhorst, igt-dev
On Tue, 2018-02-06 at 11:14 +0100, Maarten Lankhorst wrote:
> All users have been converted to igt_fb_supported_format(),
> I don't think there's a valid use left for this.
>
Reviewed-by: Mika Kahola <mika.kahola@intel.com>
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> ---
> lib/igt_fb.c | 33 ---------------------------------
> lib/igt_fb.h | 1 -
> 2 files changed, 34 deletions(-)
>
> diff --git a/lib/igt_fb.c b/lib/igt_fb.c
> index 0389b1c1b159..ecd73053f16f 100644
> --- a/lib/igt_fb.c
> +++ b/lib/igt_fb.c
> @@ -1687,39 +1687,6 @@ const char *igt_format_str(uint32_t
> drm_format)
> return f ? f->name : "invalid";
> }
>
> -/**
> - * igt_get_all_cairo_formats:
> - * @formats: pointer to pointer to store the allocated formats array
> - * @format_count: pointer to integer to store the size of the
> allocated array
> - *
> - * This functions returns an array of all the drm fourcc codes
> supported by
> - * cairo and this library.
> - */
> -void igt_get_all_cairo_formats(const uint32_t **formats, int
> *format_count)
> -{
> - static uint32_t *drm_formats;
> - static int n_formats;
> -
> - if (!drm_formats) {
> - struct format_desc_struct *f;
> - uint32_t *format;
> -
> - n_formats = 0;
> - for_each_format(f)
> - if (f->cairo_id != CAIRO_FORMAT_INVALID)
> - n_formats++;
> -
> - drm_formats = calloc(n_formats,
> sizeof(*drm_formats));
> - format = &drm_formats[0];
> - for_each_format(f)
> - if (f->cairo_id != CAIRO_FORMAT_INVALID)
> - *format++ = f->drm_id;
> - }
> -
> - *formats = drm_formats;
> - *format_count = n_formats;
> -}
> -
> /**
> * igt_fb_supported_format:
> * @drm_format: drm fourcc to test.
> diff --git a/lib/igt_fb.h b/lib/igt_fb.h
> index a6ce07898784..023b069db592 100644
> --- a/lib/igt_fb.h
> +++ b/lib/igt_fb.h
> @@ -162,7 +162,6 @@ int igt_cairo_printf_line(cairo_t *cr, enum
> igt_text_align align,
> uint32_t igt_bpp_depth_to_drm_format(int bpp, int depth);
> uint32_t igt_drm_format_to_bpp(uint32_t drm_format);
> const char *igt_format_str(uint32_t drm_format);
> -void igt_get_all_cairo_formats(const uint32_t **formats, int
> *format_count);
> bool igt_fb_supported_format(uint32_t drm_format);
>
> #endif /* __IGT_FB_H__ */
--
Mika Kahola - Intel OTC
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [igt-dev] [PATCH i-g-t] lib/igt_debugfs: Add igt_pipe_crc_get_single and igt_pipe_crc_drain, v2.
2018-02-07 11:47 ` [igt-dev] [PATCH i-g-t] lib/igt_debugfs: Add igt_pipe_crc_get_single and igt_pipe_crc_drain, v2 Maarten Lankhorst
@ 2018-02-08 11:15 ` Mika Kahola
2018-02-08 12:31 ` [PATCH i-g-t] lib/igt_debugfs: Add igt_pipe_crc_get_single and igt_pipe_crc_drain, v3 Maarten Lankhorst
0 siblings, 1 reply; 39+ messages in thread
From: Mika Kahola @ 2018-02-08 11:15 UTC (permalink / raw)
To: Maarten Lankhorst, igt-dev
On Wed, 2018-02-07 at 12:47 +0100, Maarten Lankhorst wrote:
> Collecting CRC may result in a modeset and extra vblank waits. On
> some
> tests this will increase the runtime a lot, so it makes sense to
> keep it enabled, and only collect the most recent CRC when needed.
>
> Changes since v1:
> - Fix read_crc semantics. (Ville)
>
Reviewed-by: Mika Kahola <mika.kahola@intel.com>
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> ---
> lib/igt_debugfs.c | 74
> +++++++++++++++++++++++++++++++++++++++++++----
> lib/igt_debugfs.h | 2 ++
> tests/kms_cursor_legacy.c | 21 ++++----------
> 3 files changed, 76 insertions(+), 21 deletions(-)
>
> diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
> index 1aec079c52bb..dc75d6adbf09 100644
> --- a/lib/igt_debugfs.c
> +++ b/lib/igt_debugfs.c
> @@ -710,11 +710,11 @@ static int read_crc(igt_pipe_crc_t *pipe_crc,
> igt_crc_t *out)
> igt_assert(pipe_crc->flags & O_NONBLOCK);
>
> if (bytes_read < 0)
> - bytes_read = 0;
> -
> - buf[bytes_read] = '\0';
> + bytes_read = -errno;
> + else
> + buf[bytes_read] = '\0';
>
> - if (bytes_read && !pipe_crc_init_from_string(pipe_crc, out,
> buf))
> + if (bytes_read > 0 && !pipe_crc_init_from_string(pipe_crc,
> out, buf))
> return -EINVAL;
>
> return bytes_read;
> @@ -722,7 +722,9 @@ static int read_crc(igt_pipe_crc_t *pipe_crc,
> igt_crc_t *out)
>
> static void read_one_crc(igt_pipe_crc_t *pipe_crc, igt_crc_t *out)
> {
> - while (read_crc(pipe_crc, out) == 0)
> + int ret;
> +
> + while ((ret = read_crc(pipe_crc, out)) <= 0 && ret !=
> -EINVAL)
> usleep(1000);
> }
>
> @@ -854,6 +856,68 @@ void igt_pipe_crc_collect_crc(igt_pipe_crc_t
> *pipe_crc, igt_crc_t *out_crc)
> crc_sanity_checks(out_crc);
> }
>
> +/**
> + * igt_pipe_crc_drain:
> + * @pipe_crc: pipe CRC object
> + *
> + * Discards all currently queued CRC values from @pipe_crc. This
> function does
> + * not block, and is useful to flush @pipe_crc. Afterwards you can
> get a fresh
> + * CRC with igt_pipe_crc_get_single().
> + */
> +void igt_pipe_crc_drain(igt_pipe_crc_t *pipe_crc)
> +{
> + int ret;
> + igt_crc_t crc;
> +
> + fcntl(pipe_crc->crc_fd, F_SETFL, pipe_crc->flags |
> O_NONBLOCK);
> +
> + do {
> + ret = read_crc(pipe_crc, &crc);
> + } while (ret != 0);
> +
> + fcntl(pipe_crc->crc_fd, F_SETFL, pipe_crc->flags);
> +}
> +
> +/**
> + * igt_pipe_crc_get_single:
> + * @pipe_crc: pipe CRC object
> + * @crc: buffer pointer for the captured CRC value
> + *
> + * Read a single @crc from @pipe_crc. This function does not block
> + * when nonblocking CRC is requested, and will return false if no
> CRC
> + * can be captured.
> + *
> + * If opened in blocking mode it will always block until a new CRC
> is read, like
> + * igt_pipe_crc_collect_crc().
> + *
> + * Callers must start and stop the capturing themselves by calling
> + * igt_pipe_crc_start() and igt_pipe_crc_stop(). For one-shot CRC
> collecting
> + * look at igt_pipe_crc_collect_crc().
> + *
> + * If capturing has been going on for a while and a fresh crc is
> required,
> + * you will need to call igt_pipe_crc_drain() first to remove stale
> entries.
> + *
> + * Returns:
> + * Whether a crc is captured, only false in non-blocking mode.
> + */
> +bool
> +igt_pipe_crc_get_single(igt_pipe_crc_t *pipe_crc, igt_crc_t *crc)
> +{
> + bool found = true;
> +
> + if (pipe_crc->flags & O_NONBLOCK) {
> + int ret = read_crc(pipe_crc, crc);
> +
> + found = ret > 0;
> + } else
> + read_one_crc(pipe_crc, crc);
> +
> + if (found)
> + crc_sanity_checks(crc);
> +
> + return found;
> +}
> +
> /*
> * Drop caches
> */
> diff --git a/lib/igt_debugfs.h b/lib/igt_debugfs.h
> index d90dd7a68bb0..8d25abfe43c1 100644
> --- a/lib/igt_debugfs.h
> +++ b/lib/igt_debugfs.h
> @@ -130,6 +130,8 @@ void igt_pipe_crc_stop(igt_pipe_crc_t *pipe_crc);
> __attribute__((warn_unused_result))
> int igt_pipe_crc_get_crcs(igt_pipe_crc_t *pipe_crc, int n_crcs,
> igt_crc_t **out_crcs);
> +void igt_pipe_crc_drain(igt_pipe_crc_t *pipe_crc);
> +bool igt_pipe_crc_get_single(igt_pipe_crc_t *pipe_crc, igt_crc_t
> *out_crc);
> void igt_pipe_crc_collect_crc(igt_pipe_crc_t *pipe_crc, igt_crc_t
> *out_crc);
>
> void igt_hpd_storm_set_threshold(int fd, unsigned int threshold);
> diff --git a/tests/kms_cursor_legacy.c b/tests/kms_cursor_legacy.c
> index 5011e78e5c2f..d0a28b3c442c 100644
> --- a/tests/kms_cursor_legacy.c
> +++ b/tests/kms_cursor_legacy.c
> @@ -1276,7 +1276,7 @@ static void
> flip_vs_cursor_busy_crc(igt_display_t *display, bool atomic)
> enum pipe pipe = find_connected_pipe(display, false);
> igt_pipe_t *pipe_connected = &display->pipes[pipe];
> igt_plane_t *plane_primary =
> igt_pipe_get_plane_type(pipe_connected, DRM_PLANE_TYPE_PRIMARY);
> - igt_crc_t crcs[2];
> + igt_crc_t crcs[2], test_crc;
>
> if (atomic)
> igt_require(display->is_atomic);
> @@ -1290,7 +1290,7 @@ static void
> flip_vs_cursor_busy_crc(igt_display_t *display, bool atomic)
>
> igt_display_commit2(display, display->is_atomic ?
> COMMIT_ATOMIC : COMMIT_LEGACY);
>
> - pipe_crc = igt_pipe_crc_new_nonblock(display->drm_fd, pipe,
> INTEL_PIPE_CRC_SOURCE_AUTO);
> + pipe_crc = igt_pipe_crc_new(display->drm_fd, pipe,
> INTEL_PIPE_CRC_SOURCE_AUTO);
>
> set_cursor_on_pipe(display, pipe, &cursor_fb);
> igt_display_commit2(display, COMMIT_UNIVERSAL);
> @@ -1322,9 +1322,6 @@ static void
> flip_vs_cursor_busy_crc(igt_display_t *display, bool atomic)
> /* Disable cursor, and immediately queue a flip. Check if
> resulting crc is correct. */
> for (int i = 1; i >= 0; i--) {
> igt_spin_t *spin;
> - igt_crc_t *received_crcs = NULL;
> - int ncrcs;
> - static const int max_crcs = 8;
>
> spin = igt_spin_batch_new(display->drm_fd, 0, 0,
> fb_info[1].gem_handle);
> @@ -1336,7 +1333,8 @@ static void
> flip_vs_cursor_busy_crc(igt_display_t *display, bool atomic)
>
> igt_assert_eq(get_vblank(display->drm_fd, pipe, 0),
> vblank_start);
>
> - ncrcs = igt_pipe_crc_get_crcs(pipe_crc, max_crcs,
> &received_crcs);
> + igt_pipe_crc_drain(pipe_crc);
> + igt_pipe_crc_get_single(pipe_crc, &test_crc);
>
> igt_spin_batch_free(display->drm_fd, spin);
>
> @@ -1349,16 +1347,7 @@ static void
> flip_vs_cursor_busy_crc(igt_display_t *display, bool atomic)
> igt_plane_set_fb(plane_primary, &fb_info[0]);
> igt_display_commit2(display, COMMIT_UNIVERSAL);
>
> - /*
> - * We collect the crc nonblockingly, and should have
> at least 1
> - * but not so many crcs that we overflow. Last CRC
> is the only
> - * one we care about here. Other CRCs may have been
> from before
> - * the cursor update and can contain garbage.
> - */
> - igt_assert(ncrcs > 0 && ncrcs < max_crcs);
> -
> - igt_assert_crc_equal(&crcs[i], &received_crcs[ncrcs
> - 1]);
> - free(received_crcs);
> + igt_assert_crc_equal(&crcs[i], &test_crc);
> }
>
> igt_remove_fb(display->drm_fd, &fb_info[1]);
--
Mika Kahola - Intel OTC
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [igt-dev] [PATCH i-g-t 06/12] tests/kms_rotation_crc: Fix bad-tiling testcase.
2018-02-06 10:14 ` [igt-dev] [PATCH i-g-t 06/12] tests/kms_rotation_crc: Fix bad-tiling testcase Maarten Lankhorst
@ 2018-02-08 12:08 ` Mika Kahola
2018-02-08 12:12 ` Maarten Lankhorst
2018-02-08 12:19 ` Mika Kahola
1 sibling, 1 reply; 39+ messages in thread
From: Mika Kahola @ 2018-02-08 12:08 UTC (permalink / raw)
To: Maarten Lankhorst, igt-dev
On Tue, 2018-02-06 at 11:14 +0100, Maarten Lankhorst wrote:
> bad-tiling test didn't work, LOCAL_DRM_FORMAT_MODE_NONE == 0, so
> the fb was created with tiling = Y, but because test_bad_format
> was set but override_tiling wasn't, we fell through to the success
> case. Always assume failure if test_bad_format is set, and pass X
> tiled for fb, so the format override works.
Is there a bug filed on this issue?
>
> Also clear variables after subtests in main, so if the next subtest
> doesn't run we still clear the variables.
>
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> ---
> tests/kms_rotation_crc.c | 12 +++++++-----
> 1 file changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
> index 4f56d3d65db4..37e911846c88 100644
> --- a/tests/kms_rotation_crc.c
> +++ b/tests/kms_rotation_crc.c
> @@ -411,7 +411,7 @@ static void __test_plane_rotation(data_t *data,
> int plane_type, bool test_bad_fo
> igt_plane_set_size(plane, data-
> >fb.height, data->fb.width);
>
> ret = igt_display_try_commit2(display,
> commit);
> - if (test_bad_format && (data->override_fmt
> || data->override_tiling)) {
> + if (test_bad_format) {
> igt_assert_eq(ret, -EINVAL);
> continue;
> }
> @@ -775,6 +775,7 @@ igt_main
> test_plane_rotation(&data, subtest->plane);
> }
> }
> + data.flips = 0;
>
> igt_subtest_f("sprite-rotation-90-pos-100-0") {
> igt_require(gen >= 9);
> @@ -783,23 +784,24 @@ igt_main
> data.pos_y = 0;
> test_plane_rotation(&data, DRM_PLANE_TYPE_OVERLAY);
> }
> + data.pos_x = 0,
> + data.pos_y = 0;
>
> igt_subtest_f("bad-pixel-format") {
> igt_require(gen >= 9);
> - data.pos_x = 0,
> - data.pos_y = 0;
> data.rotation = IGT_ROTATION_90;
> data.override_fmt = DRM_FORMAT_RGB565;
> test_bad_plane_rotation(&data,
> DRM_PLANE_TYPE_PRIMARY);
> }
> + data.override_fmt = 0;
>
> igt_subtest_f("bad-tiling") {
> igt_require(gen >= 9);
> - data.override_fmt = 0;
> data.rotation = IGT_ROTATION_90;
> - data.override_tiling = LOCAL_DRM_FORMAT_MOD_NONE;
> + data.override_tiling =
> LOCAL_I915_FORMAT_MOD_X_TILED;
> test_bad_plane_rotation(&data,
> DRM_PLANE_TYPE_PRIMARY);
> }
> + data.override_tiling = 0;
>
> igt_subtest_f("primary-rotation-90-Y-tiled") {
> enum pipe pipe;
--
Mika Kahola - Intel OTC
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [igt-dev] [PATCH i-g-t 06/12] tests/kms_rotation_crc: Fix bad-tiling testcase.
2018-02-08 12:08 ` Mika Kahola
@ 2018-02-08 12:12 ` Maarten Lankhorst
0 siblings, 0 replies; 39+ messages in thread
From: Maarten Lankhorst @ 2018-02-08 12:12 UTC (permalink / raw)
To: mika.kahola, igt-dev
Op 08-02-18 om 13:08 schreef Mika Kahola:
> On Tue, 2018-02-06 at 11:14 +0100, Maarten Lankhorst wrote:
>> bad-tiling test didn't work, LOCAL_DRM_FORMAT_MODE_NONE == 0, so
>> the fb was created with tiling = Y, but because test_bad_format
>> was set but override_tiling wasn't, we fell through to the success
>> case. Always assume failure if test_bad_format is set, and pass X
>> tiled for fb, so the format override works.
> Is there a bug filed on this issue?
No, just nobody noticed because the test still outputs pass. :)
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [igt-dev] [PATCH i-g-t 06/12] tests/kms_rotation_crc: Fix bad-tiling testcase.
2018-02-06 10:14 ` [igt-dev] [PATCH i-g-t 06/12] tests/kms_rotation_crc: Fix bad-tiling testcase Maarten Lankhorst
2018-02-08 12:08 ` Mika Kahola
@ 2018-02-08 12:19 ` Mika Kahola
1 sibling, 0 replies; 39+ messages in thread
From: Mika Kahola @ 2018-02-08 12:19 UTC (permalink / raw)
To: Maarten Lankhorst, igt-dev
On Tue, 2018-02-06 at 11:14 +0100, Maarten Lankhorst wrote:
> bad-tiling test didn't work, LOCAL_DRM_FORMAT_MODE_NONE == 0, so
> the fb was created with tiling = Y, but because test_bad_format
> was set but override_tiling wasn't, we fell through to the success
> case. Always assume failure if test_bad_format is set, and pass X
> tiled for fb, so the format override works.
>
> Also clear variables after subtests in main, so if the next subtest
> doesn't run we still clear the variables.
>
Reviewed-by: Mika Kahola <mika.kahola@intel.com>
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> ---
> tests/kms_rotation_crc.c | 12 +++++++-----
> 1 file changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
> index 4f56d3d65db4..37e911846c88 100644
> --- a/tests/kms_rotation_crc.c
> +++ b/tests/kms_rotation_crc.c
> @@ -411,7 +411,7 @@ static void __test_plane_rotation(data_t *data,
> int plane_type, bool test_bad_fo
> igt_plane_set_size(plane, data-
> >fb.height, data->fb.width);
>
> ret = igt_display_try_commit2(display,
> commit);
> - if (test_bad_format && (data->override_fmt
> || data->override_tiling)) {
> + if (test_bad_format) {
> igt_assert_eq(ret, -EINVAL);
> continue;
> }
> @@ -775,6 +775,7 @@ igt_main
> test_plane_rotation(&data, subtest->plane);
> }
> }
> + data.flips = 0;
>
> igt_subtest_f("sprite-rotation-90-pos-100-0") {
> igt_require(gen >= 9);
> @@ -783,23 +784,24 @@ igt_main
> data.pos_y = 0;
> test_plane_rotation(&data, DRM_PLANE_TYPE_OVERLAY);
> }
> + data.pos_x = 0,
> + data.pos_y = 0;
>
> igt_subtest_f("bad-pixel-format") {
> igt_require(gen >= 9);
> - data.pos_x = 0,
> - data.pos_y = 0;
> data.rotation = IGT_ROTATION_90;
> data.override_fmt = DRM_FORMAT_RGB565;
> test_bad_plane_rotation(&data,
> DRM_PLANE_TYPE_PRIMARY);
> }
> + data.override_fmt = 0;
>
> igt_subtest_f("bad-tiling") {
> igt_require(gen >= 9);
> - data.override_fmt = 0;
> data.rotation = IGT_ROTATION_90;
> - data.override_tiling = LOCAL_DRM_FORMAT_MOD_NONE;
> + data.override_tiling =
> LOCAL_I915_FORMAT_MOD_X_TILED;
> test_bad_plane_rotation(&data,
> DRM_PLANE_TYPE_PRIMARY);
> }
> + data.override_tiling = 0;
>
> igt_subtest_f("primary-rotation-90-Y-tiled") {
> enum pipe pipe;
--
Mika Kahola - Intel OTC
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 39+ messages in thread
* [PATCH i-g-t] lib/igt_debugfs: Add igt_pipe_crc_get_single and igt_pipe_crc_drain, v3.
2018-02-08 11:15 ` Mika Kahola
@ 2018-02-08 12:31 ` Maarten Lankhorst
2018-02-09 10:01 ` [igt-dev] [PATCH i-g-t] lib/igt_debugfs: Add igt_pipe_crc_get_single and igt_pipe_crc_drain, v4 Maarten Lankhorst
0 siblings, 1 reply; 39+ messages in thread
From: Maarten Lankhorst @ 2018-02-08 12:31 UTC (permalink / raw)
To: intel-gfx
Collecting CRC may result in a modeset and extra vblank waits. On some
tests this will increase the runtime a lot, so it makes sense to
keep it enabled, and only collect the most recent CRC when needed.
Changes since v1:
- Fix read_crc semantics. (Ville)
Changes since v2:
- Remove EAGAIN assert, can be reached from drain_crc.
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
lib/igt_debugfs.c | 77 ++++++++++++++++++++++++++++++++++++++++++-----
lib/igt_debugfs.h | 2 ++
tests/kms_cursor_legacy.c | 21 +++----------
3 files changed, 76 insertions(+), 24 deletions(-)
diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
index 1aec079c52bb..54d887a8ca62 100644
--- a/lib/igt_debugfs.c
+++ b/lib/igt_debugfs.c
@@ -706,15 +706,12 @@ static int read_crc(igt_pipe_crc_t *pipe_crc, igt_crc_t *out)
bytes_read = read(pipe_crc->crc_fd, &buf, MAX_LINE_LEN);
igt_reset_timeout();
- if (bytes_read < 0 && errno == EAGAIN)
- igt_assert(pipe_crc->flags & O_NONBLOCK);
-
if (bytes_read < 0)
- bytes_read = 0;
-
- buf[bytes_read] = '\0';
+ bytes_read = -errno;
+ else
+ buf[bytes_read] = '\0';
- if (bytes_read && !pipe_crc_init_from_string(pipe_crc, out, buf))
+ if (bytes_read > 0 && !pipe_crc_init_from_string(pipe_crc, out, buf))
return -EINVAL;
return bytes_read;
@@ -722,7 +719,9 @@ static int read_crc(igt_pipe_crc_t *pipe_crc, igt_crc_t *out)
static void read_one_crc(igt_pipe_crc_t *pipe_crc, igt_crc_t *out)
{
- while (read_crc(pipe_crc, out) == 0)
+ int ret;
+
+ while ((ret = read_crc(pipe_crc, out)) <= 0 && ret != -EINVAL)
usleep(1000);
}
@@ -854,6 +853,68 @@ void igt_pipe_crc_collect_crc(igt_pipe_crc_t *pipe_crc, igt_crc_t *out_crc)
crc_sanity_checks(out_crc);
}
+/**
+ * igt_pipe_crc_drain:
+ * @pipe_crc: pipe CRC object
+ *
+ * Discards all currently queued CRC values from @pipe_crc. This function does
+ * not block, and is useful to flush @pipe_crc. Afterwards you can get a fresh
+ * CRC with igt_pipe_crc_get_single().
+ */
+void igt_pipe_crc_drain(igt_pipe_crc_t *pipe_crc)
+{
+ int ret;
+ igt_crc_t crc;
+
+ fcntl(pipe_crc->crc_fd, F_SETFL, pipe_crc->flags | O_NONBLOCK);
+
+ do {
+ ret = read_crc(pipe_crc, &crc);
+ } while (ret != 0);
+
+ fcntl(pipe_crc->crc_fd, F_SETFL, pipe_crc->flags);
+}
+
+/**
+ * igt_pipe_crc_get_single:
+ * @pipe_crc: pipe CRC object
+ * @crc: buffer pointer for the captured CRC value
+ *
+ * Read a single @crc from @pipe_crc. This function does not block
+ * when nonblocking CRC is requested, and will return false if no CRC
+ * can be captured.
+ *
+ * If opened in blocking mode it will always block until a new CRC is read, like
+ * igt_pipe_crc_collect_crc().
+ *
+ * Callers must start and stop the capturing themselves by calling
+ * igt_pipe_crc_start() and igt_pipe_crc_stop(). For one-shot CRC collecting
+ * look at igt_pipe_crc_collect_crc().
+ *
+ * If capturing has been going on for a while and a fresh crc is required,
+ * you will need to call igt_pipe_crc_drain() first to remove stale entries.
+ *
+ * Returns:
+ * Whether a crc is captured, only false in non-blocking mode.
+ */
+bool
+igt_pipe_crc_get_single(igt_pipe_crc_t *pipe_crc, igt_crc_t *crc)
+{
+ bool found = true;
+
+ if (pipe_crc->flags & O_NONBLOCK) {
+ int ret = read_crc(pipe_crc, crc);
+
+ found = ret > 0;
+ } else
+ read_one_crc(pipe_crc, crc);
+
+ if (found)
+ crc_sanity_checks(crc);
+
+ return found;
+}
+
/*
* Drop caches
*/
diff --git a/lib/igt_debugfs.h b/lib/igt_debugfs.h
index d90dd7a68bb0..8d25abfe43c1 100644
--- a/lib/igt_debugfs.h
+++ b/lib/igt_debugfs.h
@@ -130,6 +130,8 @@ void igt_pipe_crc_stop(igt_pipe_crc_t *pipe_crc);
__attribute__((warn_unused_result))
int igt_pipe_crc_get_crcs(igt_pipe_crc_t *pipe_crc, int n_crcs,
igt_crc_t **out_crcs);
+void igt_pipe_crc_drain(igt_pipe_crc_t *pipe_crc);
+bool igt_pipe_crc_get_single(igt_pipe_crc_t *pipe_crc, igt_crc_t *out_crc);
void igt_pipe_crc_collect_crc(igt_pipe_crc_t *pipe_crc, igt_crc_t *out_crc);
void igt_hpd_storm_set_threshold(int fd, unsigned int threshold);
diff --git a/tests/kms_cursor_legacy.c b/tests/kms_cursor_legacy.c
index 5011e78e5c2f..d0a28b3c442c 100644
--- a/tests/kms_cursor_legacy.c
+++ b/tests/kms_cursor_legacy.c
@@ -1276,7 +1276,7 @@ static void flip_vs_cursor_busy_crc(igt_display_t *display, bool atomic)
enum pipe pipe = find_connected_pipe(display, false);
igt_pipe_t *pipe_connected = &display->pipes[pipe];
igt_plane_t *plane_primary = igt_pipe_get_plane_type(pipe_connected, DRM_PLANE_TYPE_PRIMARY);
- igt_crc_t crcs[2];
+ igt_crc_t crcs[2], test_crc;
if (atomic)
igt_require(display->is_atomic);
@@ -1290,7 +1290,7 @@ static void flip_vs_cursor_busy_crc(igt_display_t *display, bool atomic)
igt_display_commit2(display, display->is_atomic ? COMMIT_ATOMIC : COMMIT_LEGACY);
- pipe_crc = igt_pipe_crc_new_nonblock(display->drm_fd, pipe, INTEL_PIPE_CRC_SOURCE_AUTO);
+ pipe_crc = igt_pipe_crc_new(display->drm_fd, pipe, INTEL_PIPE_CRC_SOURCE_AUTO);
set_cursor_on_pipe(display, pipe, &cursor_fb);
igt_display_commit2(display, COMMIT_UNIVERSAL);
@@ -1322,9 +1322,6 @@ static void flip_vs_cursor_busy_crc(igt_display_t *display, bool atomic)
/* Disable cursor, and immediately queue a flip. Check if resulting crc is correct. */
for (int i = 1; i >= 0; i--) {
igt_spin_t *spin;
- igt_crc_t *received_crcs = NULL;
- int ncrcs;
- static const int max_crcs = 8;
spin = igt_spin_batch_new(display->drm_fd, 0, 0,
fb_info[1].gem_handle);
@@ -1336,7 +1333,8 @@ static void flip_vs_cursor_busy_crc(igt_display_t *display, bool atomic)
igt_assert_eq(get_vblank(display->drm_fd, pipe, 0), vblank_start);
- ncrcs = igt_pipe_crc_get_crcs(pipe_crc, max_crcs, &received_crcs);
+ igt_pipe_crc_drain(pipe_crc);
+ igt_pipe_crc_get_single(pipe_crc, &test_crc);
igt_spin_batch_free(display->drm_fd, spin);
@@ -1349,16 +1347,7 @@ static void flip_vs_cursor_busy_crc(igt_display_t *display, bool atomic)
igt_plane_set_fb(plane_primary, &fb_info[0]);
igt_display_commit2(display, COMMIT_UNIVERSAL);
- /*
- * We collect the crc nonblockingly, and should have at least 1
- * but not so many crcs that we overflow. Last CRC is the only
- * one we care about here. Other CRCs may have been from before
- * the cursor update and can contain garbage.
- */
- igt_assert(ncrcs > 0 && ncrcs < max_crcs);
-
- igt_assert_crc_equal(&crcs[i], &received_crcs[ncrcs - 1]);
- free(received_crcs);
+ igt_assert_crc_equal(&crcs[i], &test_crc);
}
igt_remove_fb(display->drm_fd, &fb_info[1]);
--
2.16.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 39+ messages in thread
* Re: [igt-dev] [PATCH i-g-t 07/12] tests/kms_rotation_crc: Move bad_format parameter to test_plane_rotation
2018-02-06 10:14 ` [igt-dev] [PATCH i-g-t 07/12] tests/kms_rotation_crc: Move bad_format parameter to test_plane_rotation Maarten Lankhorst
@ 2018-02-08 13:07 ` Mika Kahola
0 siblings, 0 replies; 39+ messages in thread
From: Mika Kahola @ 2018-02-08 13:07 UTC (permalink / raw)
To: Maarten Lankhorst, igt-dev
On Tue, 2018-02-06 at 11:14 +0100, Maarten Lankhorst wrote:
> Instead of 2 functions doing the same thing, consolidate to a single
> function.
>
Reviewed-by: Mika Kahola <mika.kahola@intel.com>
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> ---
> tests/kms_rotation_crc.c | 22 ++++++----------------
> 1 file changed, 6 insertions(+), 16 deletions(-)
>
> diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
> index 37e911846c88..e8cdbfccbe0a 100644
> --- a/tests/kms_rotation_crc.c
> +++ b/tests/kms_rotation_crc.c
> @@ -356,7 +356,7 @@ static void wait_for_pageflip(int fd)
> igt_assert(drmHandleEvent(fd, &evctx) == 0);
> }
>
> -static void __test_plane_rotation(data_t *data, int plane_type, bool
> test_bad_format)
> +static void test_plane_rotation(data_t *data, int plane_type, bool
> test_bad_format)
> {
> igt_display_t *display = &data->display;
> igt_output_t *output;
> @@ -456,16 +456,6 @@ static void __test_plane_rotation(data_t *data,
> int plane_type, bool test_bad_fo
> igt_require_f(valid_tests, "no valid crtc/connector
> combinations found\n");
> }
>
> -static inline void test_bad_plane_rotation(data_t *data, int
> plane_type)
> -{
> - __test_plane_rotation(data, plane_type, true);
> -}
> -
> -static inline void test_plane_rotation(data_t *data, int plane_type)
> -{
> - __test_plane_rotation(data, plane_type, false);
> -}
> -
> static void test_plane_rotation_ytiled_obj(data_t *data,
> igt_output_t *output,
> int plane_type)
> @@ -772,7 +762,7 @@ igt_main
> gen >= 9);
> data.rotation = subtest->rot;
> data.flips = subtest->flips;
> - test_plane_rotation(&data, subtest->plane);
> + test_plane_rotation(&data, subtest->plane,
> false);
> }
> }
> data.flips = 0;
> @@ -782,7 +772,7 @@ igt_main
> data.rotation = IGT_ROTATION_90;
> data.pos_x = 100,
> data.pos_y = 0;
> - test_plane_rotation(&data, DRM_PLANE_TYPE_OVERLAY);
> + test_plane_rotation(&data, DRM_PLANE_TYPE_OVERLAY,
> false);
> }
> data.pos_x = 0,
> data.pos_y = 0;
> @@ -791,7 +781,7 @@ igt_main
> igt_require(gen >= 9);
> data.rotation = IGT_ROTATION_90;
> data.override_fmt = DRM_FORMAT_RGB565;
> - test_bad_plane_rotation(&data,
> DRM_PLANE_TYPE_PRIMARY);
> + test_plane_rotation(&data, DRM_PLANE_TYPE_PRIMARY,
> true);
> }
> data.override_fmt = 0;
>
> @@ -799,7 +789,7 @@ igt_main
> igt_require(gen >= 9);
> data.rotation = IGT_ROTATION_90;
> data.override_tiling =
> LOCAL_I915_FORMAT_MOD_X_TILED;
> - test_bad_plane_rotation(&data,
> DRM_PLANE_TYPE_PRIMARY);
> + test_plane_rotation(&data, DRM_PLANE_TYPE_PRIMARY,
> true);
> }
> data.override_tiling = 0;
>
> @@ -834,7 +824,7 @@ igt_main
> data.rotation = (IGT_REFLECT_X | reflect_x-
> >rot);
> data.override_tiling = reflect_x->tiling;
> data.flips = reflect_x->flips;
> - test_plane_rotation(&data,
> DRM_PLANE_TYPE_PRIMARY);
> + test_plane_rotation(&data,
> DRM_PLANE_TYPE_PRIMARY, false);
> }
> }
>
--
Mika Kahola - Intel OTC
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 39+ messages in thread
* ✓ Fi.CI.BAT: success for lib/igt_debugfs: Add igt_pipe_crc_get_single and igt_pipe_crc_drain, v3.
2018-02-06 10:14 [igt-dev] [PATCH i-g-t 01/12] lib/igt_fb: Make igt_remove_fb more robust Maarten Lankhorst
` (14 preceding siblings ...)
2018-02-07 16:36 ` [igt-dev] ✗ Fi.CI.IGT: failure for series starting with [i-g-t,01/12] lib/igt_fb: Make igt_remove_fb more robust (rev2) Patchwork
@ 2018-02-08 19:06 ` Patchwork
2018-02-09 4:48 ` ✗ Fi.CI.IGT: failure " Patchwork
` (2 subsequent siblings)
18 siblings, 0 replies; 39+ messages in thread
From: Patchwork @ 2018-02-08 19:06 UTC (permalink / raw)
To: Maarten Lankhorst; +Cc: intel-gfx
== Series Details ==
Series: lib/igt_debugfs: Add igt_pipe_crc_get_single and igt_pipe_crc_drain, v3.
URL : https://patchwork.freedesktop.org/series/37910/
State : success
== Summary ==
IGT patchset tested on top of latest successful build
3af87d45da24015b7a6124b59b2c4b854381cab6 tools/intel_aubdump: Simulate "enhanced execlist" submission for gen11+
with latest DRM-Tip kernel build CI_DRM_3747
a326a34b0b8d drm-tip: 2018y-02m-08d-17h-29m-20s UTC integration manifest
No testlist changes.
Test kms_pipe_crc_basic:
Subgroup suspend-read-crc-pipe-a:
pass -> DMESG-WARN (fi-cnl-y3) fdo#103191
Subgroup suspend-read-crc-pipe-b:
incomplete -> PASS (fi-snb-2520m) fdo#103713
fdo#103191 https://bugs.freedesktop.org/show_bug.cgi?id=103191
fdo#103713 https://bugs.freedesktop.org/show_bug.cgi?id=103713
fi-bdw-5557u total:288 pass:267 dwarn:0 dfail:0 fail:0 skip:21 time:418s
fi-bdw-gvtdvm total:288 pass:264 dwarn:0 dfail:0 fail:0 skip:24 time:424s
fi-blb-e6850 total:288 pass:223 dwarn:1 dfail:0 fail:0 skip:64 time:380s
fi-bsw-n3050 total:288 pass:242 dwarn:0 dfail:0 fail:0 skip:46 time:489s
fi-bwr-2160 total:288 pass:183 dwarn:0 dfail:0 fail:0 skip:105 time:287s
fi-bxt-dsi total:288 pass:258 dwarn:0 dfail:0 fail:0 skip:30 time:484s
fi-bxt-j4205 total:288 pass:259 dwarn:0 dfail:0 fail:0 skip:29 time:488s
fi-byt-j1900 total:288 pass:253 dwarn:0 dfail:0 fail:0 skip:35 time:471s
fi-byt-n2820 total:288 pass:249 dwarn:0 dfail:0 fail:0 skip:39 time:458s
fi-cfl-s2 total:288 pass:262 dwarn:0 dfail:0 fail:0 skip:26 time:564s
fi-cnl-y3 total:288 pass:261 dwarn:1 dfail:0 fail:0 skip:26 time:581s
fi-elk-e7500 total:288 pass:229 dwarn:0 dfail:0 fail:0 skip:59 time:417s
fi-gdg-551 total:288 pass:179 dwarn:0 dfail:0 fail:1 skip:108 time:287s
fi-glk-1 total:288 pass:260 dwarn:0 dfail:0 fail:0 skip:28 time:516s
fi-hsw-4770 total:288 pass:261 dwarn:0 dfail:0 fail:0 skip:27 time:393s
fi-ilk-650 total:288 pass:228 dwarn:0 dfail:0 fail:0 skip:60 time:415s
fi-ivb-3520m total:288 pass:259 dwarn:0 dfail:0 fail:0 skip:29 time:470s
fi-ivb-3770 total:288 pass:255 dwarn:0 dfail:0 fail:0 skip:33 time:416s
fi-kbl-7500u total:288 pass:263 dwarn:1 dfail:0 fail:0 skip:24 time:461s
fi-kbl-7560u total:288 pass:269 dwarn:0 dfail:0 fail:0 skip:19 time:502s
fi-kbl-7567u total:288 pass:268 dwarn:0 dfail:0 fail:0 skip:20 time:457s
fi-kbl-r total:288 pass:261 dwarn:0 dfail:0 fail:0 skip:27 time:500s
fi-pnv-d510 total:288 pass:222 dwarn:1 dfail:0 fail:0 skip:65 time:599s
fi-skl-6260u total:288 pass:268 dwarn:0 dfail:0 fail:0 skip:20 time:440s
fi-skl-6600u total:288 pass:261 dwarn:0 dfail:0 fail:0 skip:27 time:510s
fi-skl-6700hq total:288 pass:262 dwarn:0 dfail:0 fail:0 skip:26 time:527s
fi-skl-6700k2 total:288 pass:264 dwarn:0 dfail:0 fail:0 skip:24 time:488s
fi-skl-6770hq total:288 pass:268 dwarn:0 dfail:0 fail:0 skip:20 time:494s
fi-skl-guc total:288 pass:260 dwarn:0 dfail:0 fail:0 skip:28 time:414s
fi-skl-gvtdvm total:288 pass:265 dwarn:0 dfail:0 fail:0 skip:23 time:435s
fi-snb-2520m total:288 pass:248 dwarn:0 dfail:0 fail:0 skip:40 time:523s
fi-snb-2600 total:288 pass:248 dwarn:0 dfail:0 fail:0 skip:40 time:396s
Blacklisted hosts:
fi-glk-dsi total:288 pass:258 dwarn:0 dfail:0 fail:0 skip:30 time:470s
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_889/issues.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 39+ messages in thread
* ✗ Fi.CI.IGT: failure for lib/igt_debugfs: Add igt_pipe_crc_get_single and igt_pipe_crc_drain, v3.
2018-02-06 10:14 [igt-dev] [PATCH i-g-t 01/12] lib/igt_fb: Make igt_remove_fb more robust Maarten Lankhorst
` (15 preceding siblings ...)
2018-02-08 19:06 ` ✓ Fi.CI.BAT: success for lib/igt_debugfs: Add igt_pipe_crc_get_single and igt_pipe_crc_drain, v3 Patchwork
@ 2018-02-09 4:48 ` Patchwork
2018-02-09 16:33 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,01/12] lib/igt_fb: Make igt_remove_fb more robust (rev3) Patchwork
2018-02-09 18:21 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
18 siblings, 0 replies; 39+ messages in thread
From: Patchwork @ 2018-02-09 4:48 UTC (permalink / raw)
To: Maarten Lankhorst; +Cc: intel-gfx
== Series Details ==
Series: lib/igt_debugfs: Add igt_pipe_crc_get_single and igt_pipe_crc_drain, v3.
URL : https://patchwork.freedesktop.org/series/37910/
State : failure
== Summary ==
Test kms_cursor_legacy:
Subgroup cursor-vs-flip-legacy:
fail -> PASS (shard-apl) fdo#103355
Subgroup flip-vs-cursor-busy-crc-legacy:
pass -> INCOMPLETE (shard-snb)
pass -> INCOMPLETE (shard-hsw)
pass -> INCOMPLETE (shard-apl)
Subgroup flip-vs-cursor-busy-crc-atomic:
pass -> INCOMPLETE (shard-snb)
pass -> INCOMPLETE (shard-hsw)
pass -> INCOMPLETE (shard-apl)
Test gem_exec_suspend:
Subgroup basic-s4:
skip -> FAIL (shard-snb) fdo#103375
Test kms_plane_lowres:
Subgroup pipe-c-tiling-yf:
pass -> FAIL (shard-apl) fdo#103166
Test drv_suspend:
Subgroup debugfs-reader:
skip -> PASS (shard-snb) fdo#102365 +1
Test perf_pmu:
Subgroup rc6:
pass -> SKIP (shard-hsw)
Test gem_eio:
Subgroup in-flight:
fail -> PASS (shard-hsw) fdo#104676
Test kms_flip:
Subgroup 2x-plain-flip-fb-recreate-interruptible:
fail -> PASS (shard-hsw)
Test perf:
Subgroup buffer-fill:
pass -> FAIL (shard-apl) fdo#103755
Test kms_sysfs_edid_timing:
warn -> PASS (shard-apl) fdo#100047
fdo#103355 https://bugs.freedesktop.org/show_bug.cgi?id=103355
fdo#103375 https://bugs.freedesktop.org/show_bug.cgi?id=103375
fdo#103166 https://bugs.freedesktop.org/show_bug.cgi?id=103166
fdo#102365 https://bugs.freedesktop.org/show_bug.cgi?id=102365
fdo#104676 https://bugs.freedesktop.org/show_bug.cgi?id=104676
fdo#103755 https://bugs.freedesktop.org/show_bug.cgi?id=103755
fdo#100047 https://bugs.freedesktop.org/show_bug.cgi?id=100047
shard-apl total:3304 pass:1696 dwarn:1 dfail:0 fail:22 skip:1582 time:13303s
shard-hsw total:3398 pass:1730 dwarn:1 dfail:0 fail:10 skip:1654 time:13772s
shard-snb total:3398 pass:1331 dwarn:1 dfail:0 fail:10 skip:2054 time:7244s
Blacklisted hosts:
shard-kbl total:3398 pass:1879 dwarn:1 dfail:0 fail:21 skip:1495 time:10670s
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_889/shards.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [igt-dev] [PATCH i-g-t 09/12] tests/kms_rotation_crc: Remove primary-rotation-90-Y-tiled.
2018-02-06 10:14 ` [igt-dev] [PATCH i-g-t 09/12] tests/kms_rotation_crc: Remove primary-rotation-90-Y-tiled Maarten Lankhorst
@ 2018-02-09 8:25 ` Kahola, Mika
0 siblings, 0 replies; 39+ messages in thread
From: Kahola, Mika @ 2018-02-09 8:25 UTC (permalink / raw)
To: Maarten Lankhorst, igt-dev
> -----Original Message-----
> From: igt-dev [mailto:igt-dev-bounces@lists.freedesktop.org] On Behalf Of
> Maarten Lankhorst
> Sent: Tuesday, February 6, 2018 12:14 PM
> To: igt-dev@lists.freedesktop.org
> Subject: [igt-dev] [PATCH i-g-t 09/12] tests/kms_rotation_crc: Remove primary-
> rotation-90-Y-tiled.
>
> This is already tested by the rotation tests, which require Y-tiled for 90° and 270°
> rotations.
>
Reviewed-by: Mika Kahola <mika.kahola@intel.com>
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> ---
> tests/kms_rotation_crc.c | 84 ------------------------------------------------
> 1 file changed, 84 deletions(-)
>
> diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c index
> 7f50624a7425..74a611022d5a 100644
> --- a/tests/kms_rotation_crc.c
> +++ b/tests/kms_rotation_crc.c
> @@ -449,70 +449,6 @@ static void test_plane_rotation(data_t *data, int
> plane_type, bool test_bad_form
> igt_require_f(valid_tests, "no valid crtc/connector combinations
> found\n"); }
>
> -static void test_plane_rotation_ytiled_obj(data_t *data,
> - igt_output_t *output,
> - int plane_type)
> -{
> - igt_display_t *display = &data->display;
> - uint64_t tiling = LOCAL_I915_FORMAT_MOD_Y_TILED;
> - uint32_t format = DRM_FORMAT_XRGB8888;
> - int bpp = igt_drm_format_to_bpp(format);
> - enum igt_commit_style commit = COMMIT_LEGACY;
> - int fd = data->gfx_fd;
> - igt_plane_t *plane;
> - drmModeModeInfo *mode;
> - unsigned int stride, size, w, h;
> - uint32_t gem_handle;
> - int ret;
> -
> - plane = igt_output_get_plane_type(output, plane_type);
> - igt_require(igt_plane_has_prop(plane, IGT_PLANE_ROTATION));
> -
> - if (plane_type == DRM_PLANE_TYPE_PRIMARY || plane_type ==
> DRM_PLANE_TYPE_CURSOR)
> - commit = COMMIT_UNIVERSAL;
> -
> - if (plane_type == DRM_PLANE_TYPE_CURSOR)
> - igt_require(display->has_cursor_plane);
> -
> - if (data->display.is_atomic)
> - commit = COMMIT_ATOMIC;
> -
> - mode = igt_output_get_mode(output);
> - w = mode->hdisplay;
> - h = mode->vdisplay;
> -
> - for (stride = 512; stride < (w * bpp / 8); stride *= 2)
> - ;
> - for (size = 1024*1024; size < stride * h; size *= 2)
> - ;
> -
> - gem_handle = gem_create(fd, size);
> - ret = __gem_set_tiling(fd, gem_handle, I915_TILING_Y, stride);
> - igt_assert_eq(ret, 0);
> -
> - do_or_die(__kms_addfb(fd, gem_handle, w, h, stride,
> - format, tiling, NULL, LOCAL_DRM_MODE_FB_MODIFIERS,
> - &data->fb.fb_id));
> - data->fb.width = w;
> - data->fb.height = h;
> - data->fb.gem_handle = gem_handle;
> -
> - igt_plane_set_fb(plane, NULL);
> - igt_display_commit(display);
> -
> - igt_plane_set_rotation(plane, data->rotation);
> - igt_plane_set_fb(plane, &data->fb);
> - igt_plane_set_size(plane, h, w);
> -
> - ret = igt_display_try_commit2(display, commit);
> -
> - igt_output_set_pipe(output, PIPE_NONE);
> -
> - kmstest_restore_vt_mode();
> - igt_remove_fb(fd, &data->fb);
> - igt_assert_eq(ret, 0);
> -}
> -
> static void test_plane_rotation_exhaust_fences(data_t *data,
> igt_output_t *output,
> int plane_type)
> @@ -757,26 +693,6 @@ igt_main
> }
> data.override_tiling = 0;
>
> - igt_subtest_f("primary-rotation-90-Y-tiled") {
> - enum pipe pipe;
> - igt_output_t *output;
> - int valid_tests = 0;
> -
> - igt_require(gen >= 9);
> - data.rotation = IGT_ROTATION_90;
> -
> - for_each_pipe_with_valid_output(&data.display, pipe, output) {
> - igt_output_set_pipe(output, pipe);
> -
> - test_plane_rotation_ytiled_obj(&data, output,
> DRM_PLANE_TYPE_PRIMARY);
> -
> - valid_tests++;
> - break;
> - }
> -
> - igt_require_f(valid_tests, "no valid crtc/connector combinations
> found\n");
> - }
> -
> for (reflect_x = reflect_x_subtests; reflect_x->tiling; reflect_x++) {
> igt_subtest_f("primary-%s-reflect-x-%s",
> tiling_test_str(reflect_x->tiling),
> --
> 2.16.1
>
> _______________________________________________
> igt-dev mailing list
> igt-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/igt-dev
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [igt-dev] [PATCH i-g-t 10/12] tests/kms_rotation_crc: Perform lazy cleanup and require atomic.
2018-02-06 10:14 ` [igt-dev] [PATCH i-g-t 10/12] tests/kms_rotation_crc: Perform lazy cleanup and require atomic Maarten Lankhorst
@ 2018-02-09 9:39 ` Kahola, Mika
0 siblings, 0 replies; 39+ messages in thread
From: Kahola, Mika @ 2018-02-09 9:39 UTC (permalink / raw)
To: Maarten Lankhorst, igt-dev
> -----Original Message-----
> From: igt-dev [mailto:igt-dev-bounces@lists.freedesktop.org] On Behalf Of
> Maarten Lankhorst
> Sent: Tuesday, February 6, 2018 12:14 PM
> To: igt-dev@lists.freedesktop.org
> Subject: [igt-dev] [PATCH i-g-t 10/12] tests/kms_rotation_crc: Perform lazy
> cleanup and require atomic.
>
> This won't clean up resources between subtests, so if subtests fail the next
> subtest will clean up everything. This allows all subtests even if one fails.
>
Reviewed-by: Mika Kahola <mika.kahola@intel.com>
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> ---
> tests/kms_rotation_crc.c | 203 ++++++++++++++---------------------------------
> 1 file changed, 60 insertions(+), 143 deletions(-)
>
> diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c index
> 74a611022d5a..9242ddee5feb 100644
> --- a/tests/kms_rotation_crc.c
> +++ b/tests/kms_rotation_crc.c
> @@ -33,7 +33,6 @@ typedef struct {
> struct igt_fb fb;
> struct igt_fb fb_reference;
> struct igt_fb fb_unrotated;
> - struct igt_fb fb_modeset;
> struct igt_fb fb_flip;
> igt_crc_t ref_crc;
> igt_crc_t flip_crc;
> @@ -122,61 +121,41 @@ paint_squares(data_t *data, igt_rotation_t rotation,
> igt_put_cairo_ctx(data->gfx_fd, fb, cr); }
>
> -static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,
> - igt_plane_t *plane, enum igt_commit_style commit)
> +static void remove_fbs(data_t *data)
> {
> - drmModeModeInfo *mode;
> - unsigned int w, h;
> - uint64_t tiling = data->override_tiling ?:
> LOCAL_DRM_FORMAT_MOD_NONE;
> - uint32_t pixel_format = data->override_fmt ?:
> DRM_FORMAT_XRGB8888;
> - igt_display_t *display = &data->display;
> - igt_plane_t *primary = igt_output_get_plane_type(output,
> DRM_PLANE_TYPE_PRIMARY);
> + igt_remove_fb(data->gfx_fd, &data->fb);
> + igt_remove_fb(data->gfx_fd, &data->fb_reference);
> + igt_remove_fb(data->gfx_fd, &data->fb_unrotated);
> + igt_remove_fb(data->gfx_fd, &data->fb_flip); }
>
> - igt_output_set_pipe(output, pipe);
> - igt_plane_set_rotation(plane, IGT_ROTATION_0);
> +static void cleanup_crtc(data_t *data)
> +{
> + igt_display_t *display = &data->display;
>
> - /* create the pipe_crc object for this pipe */
> igt_pipe_crc_free(data->pipe_crc);
> - data->pipe_crc = igt_pipe_crc_new(data->gfx_fd, pipe,
> INTEL_PIPE_CRC_SOURCE_AUTO);
> -
> - mode = igt_output_get_mode(output);
> + data->pipe_crc = NULL;
>
> - w = mode->hdisplay;
> - h = mode->vdisplay;
> + remove_fbs(data);
>
> - igt_create_fb(data->gfx_fd, w, h, pixel_format, tiling, &data-
> >fb_modeset);
> + igt_display_reset(display);
> +}
>
> - /*
> - * With igt_display_commit2 and COMMIT_UNIVERSAL, we call just the
> - * setplane without a modeset. So, to be able to call
> - * igt_display_commit and ultimately setcrtc to do the first modeset,
> - * we create an fb covering the crtc and call commit
> - *
> - * It's also a good idea to set a primary fb on the primary plane
> - * regardless, to force a underrun when watermarks are allocated
> - * incorrectly for other planes.
> - */
> - igt_plane_set_fb(primary, &data->fb_modeset);
> +static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,
> + igt_plane_t *plane)
> +{
> + igt_display_t *display = &data->display;
>
> - if (commit < COMMIT_ATOMIC) {
> - igt_plane_clear_prop_changed(primary,
> IGT_PLANE_ROTATION);
> - igt_display_commit(display);
> + cleanup_crtc(data);
>
> - if (plane->type == DRM_PLANE_TYPE_PRIMARY)
> - igt_plane_set_prop_changed(primary,
> IGT_PLANE_ROTATION);
> - }
> + igt_output_set_pipe(output, pipe);
> + igt_plane_set_rotation(plane, IGT_ROTATION_0);
>
> - igt_plane_set_fb(plane, NULL);
> + /* create the pipe_crc object for this pipe */
> + igt_pipe_crc_free(data->pipe_crc);
> + data->pipe_crc = igt_pipe_crc_new(data->gfx_fd, pipe,
> +INTEL_PIPE_CRC_SOURCE_AUTO);
>
> - igt_display_commit2(display, commit);
> -}
> -
> -static void remove_fbs(data_t *data)
> -{
> - igt_remove_fb(data->gfx_fd, &data->fb);
> - igt_remove_fb(data->gfx_fd, &data->fb_reference);
> - igt_remove_fb(data->gfx_fd, &data->fb_unrotated);
> - igt_remove_fb(data->gfx_fd, &data->fb_flip);
> + igt_display_commit2(display, COMMIT_ATOMIC);
> }
>
> enum rectangle_type {
> @@ -247,28 +226,24 @@ static void prepare_fbs(data_t *data, igt_output_t
> *output,
> /*
> * Create a reference software rotated flip framebuffer.
> */
> - if (plane->type == DRM_PLANE_TYPE_PRIMARY || display->is_atomic) {
> - 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);
> - 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);
> - igt_display_commit2(display,
> - display->is_atomic ?
> - COMMIT_ATOMIC : COMMIT_UNIVERSAL);
> - igt_pipe_crc_collect_crc(data->pipe_crc, &data->flip_crc);
> -
> - /*
> - * Prepare the non-rotated flip fb.
> - */
> - igt_remove_fb(data->gfx_fd, &data->fb_flip);
> - 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);
> - }
> + 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);
> + 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);
> + igt_display_commit2(display, COMMIT_ATOMIC);
> + igt_pipe_crc_collect_crc(data->pipe_crc, &data->flip_crc);
> +
> + /*
> + * Prepare the non-rotated flip fb.
> + */
> + igt_remove_fb(data->gfx_fd, &data->fb_flip);
> + 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);
>
> /*
> * Create a reference CRC for a software-rotated fb.
> @@ -280,7 +255,7 @@ static void prepare_fbs(data_t *data, igt_output_t
> *output,
> igt_plane_set_fb(plane, &data->fb_reference);
> if (plane->type != DRM_PLANE_TYPE_CURSOR)
> igt_plane_set_position(plane, data->pos_x, data->pos_y);
> - igt_display_commit2(display, display->is_atomic ? COMMIT_ATOMIC :
> COMMIT_UNIVERSAL);
> + igt_display_commit2(display, COMMIT_ATOMIC);
>
> igt_pipe_crc_collect_crc(data->pipe_crc, &data->ref_crc);
>
> @@ -293,7 +268,7 @@ static void prepare_fbs(data_t *data, igt_output_t
> *output,
> igt_plane_set_rotation(plane, IGT_ROTATION_0);
> if (plane->type != DRM_PLANE_TYPE_CURSOR)
> igt_plane_set_position(plane, data->pos_x, data->pos_y);
> - igt_display_commit2(display, display->is_atomic ? COMMIT_ATOMIC :
> COMMIT_UNIVERSAL);
> + igt_display_commit2(display, COMMIT_ATOMIC);
>
> /*
> * Prepare the plane with an non-rotated fb let the hw rotate it.
> @@ -306,35 +281,6 @@ static void prepare_fbs(data_t *data, igt_output_t
> *output,
> igt_plane_set_position(plane, data->pos_x, data->pos_y); }
>
> -static void cleanup_crtc(data_t *data, igt_output_t *output, igt_plane_t
> *plane) -{
> - igt_display_t *display = &data->display;
> -
> - igt_pipe_crc_free(data->pipe_crc);
> - data->pipe_crc = NULL;
> -
> - remove_fbs(data);
> -
> - igt_remove_fb(data->gfx_fd, &data->fb_modeset);
> -
> - /* XXX: see the note in prepare_crtc() */
> - if (plane->type != DRM_PLANE_TYPE_PRIMARY) {
> - igt_plane_t *primary;
> -
> - primary = igt_output_get_plane_type(output,
> DRM_PLANE_TYPE_PRIMARY);
> - igt_plane_set_fb(primary, NULL);
> - }
> -
> - igt_plane_set_fb(plane, NULL);
> - igt_plane_set_rotation(plane, IGT_ROTATION_0);
> -
> - igt_display_commit2(display, COMMIT_UNIVERSAL);
> -
> - igt_output_set_pipe(output, PIPE_ANY);
> -
> - igt_display_commit(display);
> -}
> -
> static void wait_for_pageflip(int fd)
> {
> drmEventContext evctx = { .version = 2 }; @@ -359,18 +305,11 @@
> static void test_plane_rotation(data_t *data, int plane_type, bool
> test_bad_form
> enum pipe pipe;
> int valid_tests = 0;
> igt_crc_t crc_output;
> - enum igt_commit_style commit = COMMIT_LEGACY;
> int ret;
>
> - if (plane_type == DRM_PLANE_TYPE_PRIMARY || plane_type ==
> DRM_PLANE_TYPE_CURSOR)
> - commit = COMMIT_UNIVERSAL;
> -
> if (plane_type == DRM_PLANE_TYPE_CURSOR)
> igt_require(display->has_cursor_plane);
>
> - if (data->display.is_atomic)
> - commit = COMMIT_ATOMIC;
> -
> for_each_pipe_with_valid_output(display, pipe, output) {
> igt_plane_t *plane;
> int i;
> @@ -383,7 +322,7 @@ static void test_plane_rotation(data_t *data, int
> plane_type, bool test_bad_form
> plane = igt_output_get_plane_type(output, plane_type);
> igt_require(igt_plane_has_prop(plane,
> IGT_PLANE_ROTATION));
>
> - prepare_crtc(data, output, pipe, plane, commit);
> + prepare_crtc(data, output, pipe, plane);
>
> for (i = 0; i < num_rectangle_types; i++) {
> /* Unsupported on i915 */
> @@ -403,7 +342,7 @@ static void test_plane_rotation(data_t *data, int
> plane_type, bool test_bad_form
> if (data->rotation & (IGT_ROTATION_90 |
> IGT_ROTATION_270))
> igt_plane_set_size(plane, data->fb.height,
> data->fb.width);
>
> - ret = igt_display_try_commit2(display, commit);
> + ret = igt_display_try_commit2(display,
> COMMIT_ATOMIC);
> if (test_bad_format) {
> igt_assert_eq(ret, -EINVAL);
> continue;
> @@ -444,41 +383,28 @@ static void test_plane_rotation(data_t *data, int
> plane_type, bool test_bad_form
> }
>
> valid_tests++;
> - cleanup_crtc(data, output, plane);
> }
> igt_require_f(valid_tests, "no valid crtc/connector combinations
> found\n"); }
>
> static void test_plane_rotation_exhaust_fences(data_t *data,
> igt_output_t *output,
> - int plane_type)
> + igt_plane_t *plane)
> {
> igt_display_t *display = &data->display;
> uint64_t tiling = LOCAL_I915_FORMAT_MOD_Y_TILED;
> uint32_t format = DRM_FORMAT_XRGB8888;
> int bpp = igt_drm_format_to_bpp(format);
> - enum igt_commit_style commit = COMMIT_LEGACY;
> int fd = data->gfx_fd;
> - igt_plane_t *plane;
> drmModeModeInfo *mode;
> - data_t data2[MAX_FENCES+1] = {};
> + struct igt_fb fb[MAX_FENCES+1] = {};
> unsigned int stride, size, w, h;
> uint32_t gem_handle;
> uint64_t total_aperture_size, total_fbs_size;
> int i, ret;
>
> - plane = igt_output_get_plane_type(output, plane_type);
> igt_require(igt_plane_has_prop(plane, IGT_PLANE_ROTATION));
>
> - if (plane_type == DRM_PLANE_TYPE_PRIMARY || plane_type ==
> DRM_PLANE_TYPE_CURSOR)
> - commit = COMMIT_UNIVERSAL;
> -
> - if (plane_type == DRM_PLANE_TYPE_CURSOR)
> - igt_require(display->has_cursor_plane);
> -
> - if (data->display.is_atomic)
> - commit = COMMIT_ATOMIC;
> -
> mode = igt_output_get_mode(output);
> w = mode->hdisplay;
> h = mode->vdisplay;
> @@ -497,7 +423,7 @@ static void test_plane_rotation_exhaust_fences(data_t
> *data,
> igt_require(total_fbs_size < total_aperture_size * 0.9);
>
> igt_plane_set_fb(plane, NULL);
> - igt_display_commit(display);
> + igt_display_commit2(display, COMMIT_ATOMIC);
>
> for (i = 0; i < MAX_FENCES + 1; i++) {
> gem_handle = gem_create(fd, size);
> @@ -510,20 +436,20 @@ static void
> test_plane_rotation_exhaust_fences(data_t *data,
> ret = (__kms_addfb(fd, gem_handle, w, h, stride,
> format, tiling, NULL,
> LOCAL_DRM_MODE_FB_MODIFIERS,
> - &data2[i].fb.fb_id));
> + &fb[i].fb_id));
> if (ret) {
> igt_warn("failed to create framebuffer\n");
> goto err_alloc;
> }
>
> - data2[i].fb.width = w;
> - data2[i].fb.height = h;
> - data2[i].fb.gem_handle = gem_handle;
> + fb[i].width = w;
> + fb[i].height = h;
> + fb[i].gem_handle = gem_handle;
>
> - igt_plane_set_fb(plane, &data2[i].fb);
> + igt_plane_set_fb(plane, &fb[i]);
> igt_plane_set_rotation(plane, IGT_ROTATION_0);
>
> - ret = igt_display_try_commit2(display, commit);
> + igt_display_commit2(display, COMMIT_ATOMIC);
> if (ret) {
> igt_warn("failed to commit unrotated fb\n");
> goto err_commit;
> @@ -532,7 +458,7 @@ static void test_plane_rotation_exhaust_fences(data_t
> *data,
> igt_plane_set_rotation(plane, IGT_ROTATION_90);
> igt_plane_set_size(plane, h, w);
>
> - igt_display_commit2(display, commit);
> + igt_display_commit2(display, COMMIT_ATOMIC);
> if (ret) {
> igt_warn("failed to commit hardware rotated fb: %i\n",
> ret);
> goto err_commit;
> @@ -545,19 +471,9 @@ err_alloc:
>
> i--;
> err_commit:
> - igt_plane_set_fb(plane, NULL);
> - igt_plane_set_rotation(plane, IGT_ROTATION_0);
> -
> - if (commit < COMMIT_ATOMIC)
> - igt_display_commit2(display, commit);
> -
> - igt_output_set_pipe(output, PIPE_NONE);
> - igt_display_commit2(display, display->is_atomic ? COMMIT_ATOMIC :
> COMMIT_LEGACY);
> -
> for (; i >= 0; i--)
> - igt_remove_fb(fd, &data2[i].fb);
> + igt_remove_fb(fd, &fb[i]);
>
> - kmstest_restore_vt_mode();
> igt_assert_eq(ret, 0);
> }
>
> @@ -714,9 +630,10 @@ igt_main
> igt_require(gen >= 9);
>
> for_each_pipe_with_valid_output(&data.display, pipe, output) {
> - igt_output_set_pipe(output, pipe);
> + igt_plane_t *primary =
> &data.display.pipes[pipe].planes[0];
> + prepare_crtc(&data, output, pipe, primary);
>
> - test_plane_rotation_exhaust_fences(&data, output,
> DRM_PLANE_TYPE_PRIMARY);
> + test_plane_rotation_exhaust_fences(&data, output,
> primary);
>
> valid_tests++;
> break;
> --
> 2.16.1
>
> _______________________________________________
> igt-dev mailing list
> igt-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/igt-dev
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 39+ messages in thread
* [igt-dev] [PATCH i-g-t] lib/igt_debugfs: Add igt_pipe_crc_get_single and igt_pipe_crc_drain, v4.
2018-02-08 12:31 ` [PATCH i-g-t] lib/igt_debugfs: Add igt_pipe_crc_get_single and igt_pipe_crc_drain, v3 Maarten Lankhorst
@ 2018-02-09 10:01 ` Maarten Lankhorst
0 siblings, 0 replies; 39+ messages in thread
From: Maarten Lankhorst @ 2018-02-09 10:01 UTC (permalink / raw)
To: igt-dev
Collecting CRC may result in a modeset and extra vblank waits. On some
tests this will increase the runtime a lot, so it makes sense to
keep it enabled, and only collect the most recent CRC when needed.
Changes since v1:
- Fix read_crc semantics. (Ville)
Changes since v2:
- Remove EAGAIN assert, can be reached from drain_crc.
Changes since v3:
- Do not infinitely loop in igt_pipe_crc_drain().
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
Oops, thank $deity for CI.
lib/igt_debugfs.c | 77 ++++++++++++++++++++++++++++++++++++++++++-----
lib/igt_debugfs.h | 2 ++
tests/kms_cursor_legacy.c | 21 +++----------
3 files changed, 76 insertions(+), 24 deletions(-)
diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
index 1aec079c52bb..e2b15f9bda0b 100644
--- a/lib/igt_debugfs.c
+++ b/lib/igt_debugfs.c
@@ -706,15 +706,12 @@ static int read_crc(igt_pipe_crc_t *pipe_crc, igt_crc_t *out)
bytes_read = read(pipe_crc->crc_fd, &buf, MAX_LINE_LEN);
igt_reset_timeout();
- if (bytes_read < 0 && errno == EAGAIN)
- igt_assert(pipe_crc->flags & O_NONBLOCK);
-
if (bytes_read < 0)
- bytes_read = 0;
-
- buf[bytes_read] = '\0';
+ bytes_read = -errno;
+ else
+ buf[bytes_read] = '\0';
- if (bytes_read && !pipe_crc_init_from_string(pipe_crc, out, buf))
+ if (bytes_read > 0 && !pipe_crc_init_from_string(pipe_crc, out, buf))
return -EINVAL;
return bytes_read;
@@ -722,7 +719,9 @@ static int read_crc(igt_pipe_crc_t *pipe_crc, igt_crc_t *out)
static void read_one_crc(igt_pipe_crc_t *pipe_crc, igt_crc_t *out)
{
- while (read_crc(pipe_crc, out) == 0)
+ int ret;
+
+ while ((ret = read_crc(pipe_crc, out)) <= 0 && ret != -EINVAL)
usleep(1000);
}
@@ -854,6 +853,68 @@ void igt_pipe_crc_collect_crc(igt_pipe_crc_t *pipe_crc, igt_crc_t *out_crc)
crc_sanity_checks(out_crc);
}
+/**
+ * igt_pipe_crc_drain:
+ * @pipe_crc: pipe CRC object
+ *
+ * Discards all currently queued CRC values from @pipe_crc. This function does
+ * not block, and is useful to flush @pipe_crc. Afterwards you can get a fresh
+ * CRC with igt_pipe_crc_get_single().
+ */
+void igt_pipe_crc_drain(igt_pipe_crc_t *pipe_crc)
+{
+ int ret;
+ igt_crc_t crc;
+
+ fcntl(pipe_crc->crc_fd, F_SETFL, pipe_crc->flags | O_NONBLOCK);
+
+ do {
+ ret = read_crc(pipe_crc, &crc);
+ } while (ret > 0 || ret == -EINVAL);
+
+ fcntl(pipe_crc->crc_fd, F_SETFL, pipe_crc->flags);
+}
+
+/**
+ * igt_pipe_crc_get_single:
+ * @pipe_crc: pipe CRC object
+ * @crc: buffer pointer for the captured CRC value
+ *
+ * Read a single @crc from @pipe_crc. This function does not block
+ * when nonblocking CRC is requested, and will return false if no CRC
+ * can be captured.
+ *
+ * If opened in blocking mode it will always block until a new CRC is read, like
+ * igt_pipe_crc_collect_crc().
+ *
+ * Callers must start and stop the capturing themselves by calling
+ * igt_pipe_crc_start() and igt_pipe_crc_stop(). For one-shot CRC collecting
+ * look at igt_pipe_crc_collect_crc().
+ *
+ * If capturing has been going on for a while and a fresh crc is required,
+ * you will need to call igt_pipe_crc_drain() first to remove stale entries.
+ *
+ * Returns:
+ * Whether a crc is captured, only false in non-blocking mode.
+ */
+bool
+igt_pipe_crc_get_single(igt_pipe_crc_t *pipe_crc, igt_crc_t *crc)
+{
+ bool found = true;
+
+ if (pipe_crc->flags & O_NONBLOCK) {
+ int ret = read_crc(pipe_crc, crc);
+
+ found = ret > 0;
+ } else
+ read_one_crc(pipe_crc, crc);
+
+ if (found)
+ crc_sanity_checks(crc);
+
+ return found;
+}
+
/*
* Drop caches
*/
diff --git a/lib/igt_debugfs.h b/lib/igt_debugfs.h
index d90dd7a68bb0..8d25abfe43c1 100644
--- a/lib/igt_debugfs.h
+++ b/lib/igt_debugfs.h
@@ -130,6 +130,8 @@ void igt_pipe_crc_stop(igt_pipe_crc_t *pipe_crc);
__attribute__((warn_unused_result))
int igt_pipe_crc_get_crcs(igt_pipe_crc_t *pipe_crc, int n_crcs,
igt_crc_t **out_crcs);
+void igt_pipe_crc_drain(igt_pipe_crc_t *pipe_crc);
+bool igt_pipe_crc_get_single(igt_pipe_crc_t *pipe_crc, igt_crc_t *out_crc);
void igt_pipe_crc_collect_crc(igt_pipe_crc_t *pipe_crc, igt_crc_t *out_crc);
void igt_hpd_storm_set_threshold(int fd, unsigned int threshold);
diff --git a/tests/kms_cursor_legacy.c b/tests/kms_cursor_legacy.c
index 5011e78e5c2f..d0a28b3c442c 100644
--- a/tests/kms_cursor_legacy.c
+++ b/tests/kms_cursor_legacy.c
@@ -1276,7 +1276,7 @@ static void flip_vs_cursor_busy_crc(igt_display_t *display, bool atomic)
enum pipe pipe = find_connected_pipe(display, false);
igt_pipe_t *pipe_connected = &display->pipes[pipe];
igt_plane_t *plane_primary = igt_pipe_get_plane_type(pipe_connected, DRM_PLANE_TYPE_PRIMARY);
- igt_crc_t crcs[2];
+ igt_crc_t crcs[2], test_crc;
if (atomic)
igt_require(display->is_atomic);
@@ -1290,7 +1290,7 @@ static void flip_vs_cursor_busy_crc(igt_display_t *display, bool atomic)
igt_display_commit2(display, display->is_atomic ? COMMIT_ATOMIC : COMMIT_LEGACY);
- pipe_crc = igt_pipe_crc_new_nonblock(display->drm_fd, pipe, INTEL_PIPE_CRC_SOURCE_AUTO);
+ pipe_crc = igt_pipe_crc_new(display->drm_fd, pipe, INTEL_PIPE_CRC_SOURCE_AUTO);
set_cursor_on_pipe(display, pipe, &cursor_fb);
igt_display_commit2(display, COMMIT_UNIVERSAL);
@@ -1322,9 +1322,6 @@ static void flip_vs_cursor_busy_crc(igt_display_t *display, bool atomic)
/* Disable cursor, and immediately queue a flip. Check if resulting crc is correct. */
for (int i = 1; i >= 0; i--) {
igt_spin_t *spin;
- igt_crc_t *received_crcs = NULL;
- int ncrcs;
- static const int max_crcs = 8;
spin = igt_spin_batch_new(display->drm_fd, 0, 0,
fb_info[1].gem_handle);
@@ -1336,7 +1333,8 @@ static void flip_vs_cursor_busy_crc(igt_display_t *display, bool atomic)
igt_assert_eq(get_vblank(display->drm_fd, pipe, 0), vblank_start);
- ncrcs = igt_pipe_crc_get_crcs(pipe_crc, max_crcs, &received_crcs);
+ igt_pipe_crc_drain(pipe_crc);
+ igt_pipe_crc_get_single(pipe_crc, &test_crc);
igt_spin_batch_free(display->drm_fd, spin);
@@ -1349,16 +1347,7 @@ static void flip_vs_cursor_busy_crc(igt_display_t *display, bool atomic)
igt_plane_set_fb(plane_primary, &fb_info[0]);
igt_display_commit2(display, COMMIT_UNIVERSAL);
- /*
- * We collect the crc nonblockingly, and should have at least 1
- * but not so many crcs that we overflow. Last CRC is the only
- * one we care about here. Other CRCs may have been from before
- * the cursor update and can contain garbage.
- */
- igt_assert(ncrcs > 0 && ncrcs < max_crcs);
-
- igt_assert_crc_equal(&crcs[i], &received_crcs[ncrcs - 1]);
- free(received_crcs);
+ igt_assert_crc_equal(&crcs[i], &test_crc);
}
igt_remove_fb(display->drm_fd, &fb_info[1]);
--
2.16.1
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,01/12] lib/igt_fb: Make igt_remove_fb more robust (rev3)
2018-02-06 10:14 [igt-dev] [PATCH i-g-t 01/12] lib/igt_fb: Make igt_remove_fb more robust Maarten Lankhorst
` (16 preceding siblings ...)
2018-02-09 4:48 ` ✗ Fi.CI.IGT: failure " Patchwork
@ 2018-02-09 16:33 ` Patchwork
2018-02-09 18:21 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
18 siblings, 0 replies; 39+ messages in thread
From: Patchwork @ 2018-02-09 16:33 UTC (permalink / raw)
To: Maarten Lankhorst; +Cc: igt-dev
== Series Details ==
Series: series starting with [i-g-t,01/12] lib/igt_fb: Make igt_remove_fb more robust (rev3)
URL : https://patchwork.freedesktop.org/series/37726/
State : success
== Summary ==
IGT patchset tested on top of latest successful build
3af87d45da24015b7a6124b59b2c4b854381cab6 tools/intel_aubdump: Simulate "enhanced execlist" submission for gen11+
with latest DRM-Tip kernel build CI_DRM_3749
da3b1ec8a65a drm-tip: 2018y-02m-09d-15h-38m-18s UTC integration manifest
Testlist changes:
-igt@kms_rotation_crc@primary-rotation-90-flip
-igt@kms_rotation_crc@primary-rotation-90-y-tiled
-igt@kms_rotation_crc@primary-rotation-180-flip
-igt@kms_rotation_crc@primary-rotation-270-flip
-igt@kms_rotation_crc@primary-x-tiled-reflect-x-0-flip
-igt@kms_rotation_crc@primary-x-tiled-reflect-x-180-flip
-igt@kms_rotation_crc@primary-yf-tiled-reflect-x-0-flip
-igt@kms_rotation_crc@primary-yf-tiled-reflect-x-90-flip
-igt@kms_rotation_crc@primary-yf-tiled-reflect-x-180-flip
-igt@kms_rotation_crc@primary-yf-tiled-reflect-x-270-flip
-igt@kms_rotation_crc@primary-y-tiled-reflect-x-0-flip
-igt@kms_rotation_crc@primary-y-tiled-reflect-x-90-flip
-igt@kms_rotation_crc@primary-y-tiled-reflect-x-180-flip
-igt@kms_rotation_crc@primary-y-tiled-reflect-x-270-flip
-igt@kms_rotation_crc@sprite-rotation-90-flip
-igt@kms_rotation_crc@sprite-rotation-180-flip
-igt@kms_rotation_crc@sprite-rotation-270-flip
Test debugfs_test:
Subgroup read_all_entries:
pass -> INCOMPLETE (fi-snb-2520m) fdo#103713
Test gem_mmap_gtt:
Subgroup basic-small-bo-tiledx:
pass -> FAIL (fi-gdg-551) fdo#102575
fdo#103713 https://bugs.freedesktop.org/show_bug.cgi?id=103713
fdo#102575 https://bugs.freedesktop.org/show_bug.cgi?id=102575
fi-bdw-5557u total:288 pass:267 dwarn:0 dfail:0 fail:0 skip:21 time:420s
fi-bdw-gvtdvm total:288 pass:264 dwarn:0 dfail:0 fail:0 skip:24 time:426s
fi-blb-e6850 total:288 pass:223 dwarn:1 dfail:0 fail:0 skip:64 time:378s
fi-bsw-n3050 total:288 pass:242 dwarn:0 dfail:0 fail:0 skip:46 time:498s
fi-bwr-2160 total:288 pass:183 dwarn:0 dfail:0 fail:0 skip:105 time:289s
fi-bxt-dsi total:288 pass:258 dwarn:0 dfail:0 fail:0 skip:30 time:488s
fi-bxt-j4205 total:288 pass:259 dwarn:0 dfail:0 fail:0 skip:29 time:484s
fi-byt-j1900 total:288 pass:253 dwarn:0 dfail:0 fail:0 skip:35 time:486s
fi-byt-n2820 total:288 pass:249 dwarn:0 dfail:0 fail:0 skip:39 time:463s
fi-cfl-s2 total:288 pass:262 dwarn:0 dfail:0 fail:0 skip:26 time:569s
fi-cnl-y3 total:288 pass:262 dwarn:0 dfail:0 fail:0 skip:26 time:583s
fi-elk-e7500 total:288 pass:229 dwarn:0 dfail:0 fail:0 skip:59 time:419s
fi-gdg-551 total:288 pass:179 dwarn:0 dfail:0 fail:1 skip:108 time:285s
fi-glk-1 total:288 pass:260 dwarn:0 dfail:0 fail:0 skip:28 time:511s
fi-hsw-4770 total:288 pass:261 dwarn:0 dfail:0 fail:0 skip:27 time:390s
fi-ilk-650 total:288 pass:228 dwarn:0 dfail:0 fail:0 skip:60 time:414s
fi-ivb-3520m total:288 pass:259 dwarn:0 dfail:0 fail:0 skip:29 time:460s
fi-ivb-3770 total:288 pass:255 dwarn:0 dfail:0 fail:0 skip:33 time:422s
fi-kbl-7500u total:288 pass:263 dwarn:1 dfail:0 fail:0 skip:24 time:458s
fi-kbl-7560u total:288 pass:269 dwarn:0 dfail:0 fail:0 skip:19 time:501s
fi-kbl-r total:288 pass:261 dwarn:0 dfail:0 fail:0 skip:27 time:498s
fi-pnv-d510 total:288 pass:222 dwarn:1 dfail:0 fail:0 skip:65 time:601s
fi-skl-6260u total:288 pass:268 dwarn:0 dfail:0 fail:0 skip:20 time:430s
fi-skl-6600u total:288 pass:261 dwarn:0 dfail:0 fail:0 skip:27 time:509s
fi-skl-6700hq total:288 pass:262 dwarn:0 dfail:0 fail:0 skip:26 time:528s
fi-skl-6700k2 total:288 pass:264 dwarn:0 dfail:0 fail:0 skip:24 time:488s
fi-skl-6770hq total:288 pass:268 dwarn:0 dfail:0 fail:0 skip:20 time:476s
fi-skl-guc total:288 pass:260 dwarn:0 dfail:0 fail:0 skip:28 time:414s
fi-skl-gvtdvm total:288 pass:265 dwarn:0 dfail:0 fail:0 skip:23 time:434s
fi-snb-2520m total:3 pass:2 dwarn:0 dfail:0 fail:0 skip:0
fi-snb-2600 total:288 pass:248 dwarn:0 dfail:0 fail:0 skip:40 time:397s
Blacklisted hosts:
fi-glk-dsi total:164 pass:87 dwarn:0 dfail:1 fail:1 skip:74
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_891/issues.html
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 39+ messages in thread
* [igt-dev] ✗ Fi.CI.IGT: failure for series starting with [i-g-t,01/12] lib/igt_fb: Make igt_remove_fb more robust (rev3)
2018-02-06 10:14 [igt-dev] [PATCH i-g-t 01/12] lib/igt_fb: Make igt_remove_fb more robust Maarten Lankhorst
` (17 preceding siblings ...)
2018-02-09 16:33 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,01/12] lib/igt_fb: Make igt_remove_fb more robust (rev3) Patchwork
@ 2018-02-09 18:21 ` Patchwork
18 siblings, 0 replies; 39+ messages in thread
From: Patchwork @ 2018-02-09 18:21 UTC (permalink / raw)
To: Maarten Lankhorst; +Cc: igt-dev
== Series Details ==
Series: series starting with [i-g-t,01/12] lib/igt_fb: Make igt_remove_fb more robust (rev3)
URL : https://patchwork.freedesktop.org/series/37726/
State : failure
== Summary ==
Test pm_rc6_residency:
Subgroup rc6-accuracy:
skip -> PASS (shard-snb)
Test kms_vblank:
Subgroup pipe-a-ts-continuation-dpms-suspend:
skip -> PASS (shard-snb)
Subgroup pipe-a-ts-continuation-idle-hang:
skip -> PASS (shard-snb)
Subgroup pipe-b-accuracy-idle:
pass -> FAIL (shard-hsw)
Test kms_plane_lowres:
Subgroup pipe-b-tiling-none:
pass -> FAIL (shard-apl) fdo#103166
Test kms_draw_crc:
Subgroup draw-method-xrgb2101010-render-xtiled:
skip -> PASS (shard-snb)
Test kms_sysfs_edid_timing:
pass -> WARN (shard-apl) fdo#100047
Test kms_flip:
Subgroup 2x-flip-vs-expired-vblank:
fail -> PASS (shard-hsw) fdo#102887
Subgroup plain-flip-ts-check:
pass -> FAIL (shard-hsw) fdo#100368
Test drv_suspend:
Subgroup fence-restore-tiled2untiled-hibernate:
fail -> DMESG-FAIL (shard-snb) fdo#103375 +1
Subgroup debugfs-reader:
skip -> PASS (shard-snb) fdo#102365 +1
Test kms_frontbuffer_tracking:
Subgroup fbc-1p-primscrn-cur-indfb-draw-mmap-wc:
skip -> PASS (shard-snb) fdo#103167
Test perf_pmu:
Subgroup semaphore-wait-idle-bcs0:
fail -> PASS (shard-apl) fdo#105011
Test kms_cursor_legacy:
Subgroup cursor-vs-flip-legacy:
fail -> PASS (shard-apl) fdo#103355
Test gem_eio:
Subgroup in-flight:
fail -> PASS (shard-hsw) fdo#104676
fdo#103166 https://bugs.freedesktop.org/show_bug.cgi?id=103166
fdo#100047 https://bugs.freedesktop.org/show_bug.cgi?id=100047
fdo#102887 https://bugs.freedesktop.org/show_bug.cgi?id=102887
fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
fdo#103375 https://bugs.freedesktop.org/show_bug.cgi?id=103375
fdo#102365 https://bugs.freedesktop.org/show_bug.cgi?id=102365
fdo#103167 https://bugs.freedesktop.org/show_bug.cgi?id=103167
fdo#105011 https://bugs.freedesktop.org/show_bug.cgi?id=105011
fdo#103355 https://bugs.freedesktop.org/show_bug.cgi?id=103355
fdo#104676 https://bugs.freedesktop.org/show_bug.cgi?id=104676
shard-apl total:3354 pass:1745 dwarn:1 dfail:0 fail:21 skip:1585 time:13792s
shard-hsw total:3427 pass:1757 dwarn:1 dfail:1 fail:11 skip:1656 time:14412s
shard-snb total:3427 pass:1350 dwarn:1 dfail:1 fail:9 skip:2066 time:7582s
Blacklisted hosts:
shard-kbl total:3427 pass:1904 dwarn:1 dfail:2 fail:20 skip:1500 time:10981s
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_891/shards.html
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [igt-dev] [PATCH i-g-t 11/12] tests/kms_rotation_crc: Clean up exhaust-fences subtest
2018-02-06 10:14 ` [igt-dev] [PATCH i-g-t 11/12] tests/kms_rotation_crc: Clean up exhaust-fences subtest Maarten Lankhorst
@ 2018-02-12 11:20 ` Mika Kahola
0 siblings, 0 replies; 39+ messages in thread
From: Mika Kahola @ 2018-02-12 11:20 UTC (permalink / raw)
To: Maarten Lankhorst, igt-dev
On Tue, 2018-02-06 at 11:14 +0100, Maarten Lankhorst wrote:
> This seems to open code igt_calc_fb_size and igt_create_fb, just use
> both.
>
Reviewed-by: Mika Kahola <mika.kahola@intel.com>
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> ---
> tests/kms_rotation_crc.c | 67 +++++++++-----------------------------
> ----------
> 1 file changed, 12 insertions(+), 55 deletions(-)
>
> diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
> index 9242ddee5feb..18c3e13431db 100644
> --- a/tests/kms_rotation_crc.c
> +++ b/tests/kms_rotation_crc.c
> @@ -388,31 +388,28 @@ static void test_plane_rotation(data_t *data,
> int plane_type, bool test_bad_form
> }
>
> static void test_plane_rotation_exhaust_fences(data_t *data,
> + enum pipe pipe,
> igt_output_t *output,
> igt_plane_t *plane)
> {
> igt_display_t *display = &data->display;
> uint64_t tiling = LOCAL_I915_FORMAT_MOD_Y_TILED;
> uint32_t format = DRM_FORMAT_XRGB8888;
> - int bpp = igt_drm_format_to_bpp(format);
> int fd = data->gfx_fd;
> drmModeModeInfo *mode;
> struct igt_fb fb[MAX_FENCES+1] = {};
> unsigned int stride, size, w, h;
> - uint32_t gem_handle;
> uint64_t total_aperture_size, total_fbs_size;
> - int i, ret;
> + int i;
>
> igt_require(igt_plane_has_prop(plane, IGT_PLANE_ROTATION));
>
> + prepare_crtc(data, output, pipe, plane);
> mode = igt_output_get_mode(output);
> w = mode->hdisplay;
> h = mode->vdisplay;
>
> - for (stride = 512; stride < (w * bpp / 8); stride *= 2)
> - ;
> - for (size = 1024*1024; size < stride * h; size *= 2)
> - ;
> + igt_calc_fb_size(fd, w, h, format, tiling, &size, &stride);
>
> /*
> * Make sure there is atleast 90% of the available GTT space
> left
> @@ -422,59 +419,20 @@ static void
> test_plane_rotation_exhaust_fences(data_t *data,
> total_aperture_size = gem_available_aperture_size(fd);
> igt_require(total_fbs_size < total_aperture_size * 0.9);
>
> - igt_plane_set_fb(plane, NULL);
> - igt_display_commit2(display, COMMIT_ATOMIC);
> -
> for (i = 0; i < MAX_FENCES + 1; i++) {
> - gem_handle = gem_create(fd, size);
> - ret = __gem_set_tiling(fd, gem_handle,
> I915_TILING_Y, stride);
> - if (ret) {
> - igt_warn("failed to set tiling\n");
> - goto err_alloc;
> - }
> -
> - ret = (__kms_addfb(fd, gem_handle, w, h, stride,
> - format, tiling, NULL,
> - LOCAL_DRM_MODE_FB_MODIFIERS,
> - &fb[i].fb_id));
> - if (ret) {
> - igt_warn("failed to create framebuffer\n");
> - goto err_alloc;
> - }
> -
> - fb[i].width = w;
> - fb[i].height = h;
> - fb[i].gem_handle = gem_handle;
> + igt_create_fb(fd, w, h, format, tiling, &fb[i]);
>
> igt_plane_set_fb(plane, &fb[i]);
> igt_plane_set_rotation(plane, IGT_ROTATION_0);
> -
> igt_display_commit2(display, COMMIT_ATOMIC);
> - if (ret) {
> - igt_warn("failed to commit unrotated fb\n");
> - goto err_commit;
> - }
>
> igt_plane_set_rotation(plane, IGT_ROTATION_90);
> igt_plane_set_size(plane, h, w);
> -
> igt_display_commit2(display, COMMIT_ATOMIC);
> - if (ret) {
> - igt_warn("failed to commit hardware rotated
> fb: %i\n", ret);
> - goto err_commit;
> - }
> }
>
> -err_alloc:
> - if (ret)
> - gem_close(fd, gem_handle);
> -
> - i--;
> -err_commit:
> - for (; i >= 0; i--)
> + for (i = 0; i < MAX_FENCES + 1; i++)
> igt_remove_fb(fd, &fb[i]);
> -
> - igt_assert_eq(ret, 0);
> }
>
> static const char *plane_test_str(unsigned plane)
> @@ -622,24 +580,23 @@ igt_main
> }
> }
>
> + /*
> + * exhaust-fences should be last test, if it fails we may
> OOM in
> + * the following subtests otherwise.
> + */
> igt_subtest_f("exhaust-fences") {
> enum pipe pipe;
> igt_output_t *output;
> - int valid_tests = 0;
>
> igt_require(gen >= 9);
> + igt_display_require_output(&data.display);
>
> for_each_pipe_with_valid_output(&data.display, pipe,
> output) {
> igt_plane_t *primary =
> &data.display.pipes[pipe].planes[0];
> - prepare_crtc(&data, output, pipe, primary);
>
> - test_plane_rotation_exhaust_fences(&data,
> output, primary);
> -
> - valid_tests++;
> + test_plane_rotation_exhaust_fences(&data,
> pipe, output, primary);
> break;
> }
> -
> - igt_require_f(valid_tests, "no valid crtc/connector
> combinations found\n");
> }
>
> igt_fixture {
--
Mika Kahola - Intel OTC
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [igt-dev] [PATCH i-g-t 12/12] tests/kms_rotation_crc: Test all pixel formats on all planes.
2018-02-06 10:14 ` [igt-dev] [PATCH i-g-t 12/12] tests/kms_rotation_crc: Test all pixel formats on all planes Maarten Lankhorst
2018-02-08 3:33 ` Srinivas, Vidya
@ 2018-02-12 13:09 ` Mika Kahola
2018-02-12 14:20 ` Maarten Lankhorst
1 sibling, 1 reply; 39+ messages in thread
From: Mika Kahola @ 2018-02-12 13:09 UTC (permalink / raw)
To: Maarten Lankhorst, igt-dev
On Tue, 2018-02-06 at 11:14 +0100, Maarten Lankhorst wrote:
> The test is modified to test all pixel formats on a plane, unless
> the pixel format is overridden by the subtest.
>
> Attempting to test all pixel formats requires even more runtime and
> the overhead of toggling crc collection to capture a single CRC
> becomes significant, so keep the crc collection enabled during the
> entire test.
>
> This reduces the runtime from ~24s to ~16s per subtest on SKL.
>
Reviewed-by: Mika Kahola <mika.kahola@intel.com>
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> ---
> tests/kms_rotation_crc.c | 129 ++++++++++++++++++++++++++++---------
> ----------
> 1 file changed, 77 insertions(+), 52 deletions(-)
>
> diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
> index 18c3e13431db..0cd5c6e52b57 100644
> --- a/tests/kms_rotation_crc.c
> +++ b/tests/kms_rotation_crc.c
> @@ -153,9 +153,10 @@ static void prepare_crtc(data_t *data,
> igt_output_t *output, enum pipe pipe,
>
> /* create the pipe_crc object for this pipe */
> igt_pipe_crc_free(data->pipe_crc);
> - data->pipe_crc = igt_pipe_crc_new(data->gfx_fd, pipe,
> INTEL_PIPE_CRC_SOURCE_AUTO);
>
> igt_display_commit2(display, COMMIT_ATOMIC);
> + data->pipe_crc = igt_pipe_crc_new(data->gfx_fd, pipe,
> INTEL_PIPE_CRC_SOURCE_AUTO);
> + igt_pipe_crc_start(data->pipe_crc);
> }
>
> enum rectangle_type {
> @@ -167,7 +168,7 @@ enum rectangle_type {
> };
>
> static void prepare_fbs(data_t *data, igt_output_t *output,
> - igt_plane_t *plane, enum rectangle_type
> rect)
> + igt_plane_t *plane, enum rectangle_type
> rect, uint32_t format)
> {
> drmModeModeInfo *mode;
> igt_display_t *display = &data->display;
> @@ -234,7 +235,8 @@ static void prepare_fbs(data_t *data,
> igt_output_t *output,
> if (plane->type != DRM_PLANE_TYPE_CURSOR)
> igt_plane_set_position(plane, data->pos_x, data-
> >pos_y);
> igt_display_commit2(display, COMMIT_ATOMIC);
> - igt_pipe_crc_collect_crc(data->pipe_crc, &data->flip_crc);
> + igt_pipe_crc_drain(data->pipe_crc);
> + igt_pipe_crc_get_single(data->pipe_crc, &data->flip_crc);
>
> /*
> * Prepare the non-rotated flip fb.
> @@ -257,7 +259,8 @@ static void prepare_fbs(data_t *data,
> igt_output_t *output,
> igt_plane_set_position(plane, data->pos_x, data-
> >pos_y);
> igt_display_commit2(display, COMMIT_ATOMIC);
>
> - igt_pipe_crc_collect_crc(data->pipe_crc, &data->ref_crc);
> + igt_pipe_crc_drain(data->pipe_crc);
> + igt_pipe_crc_get_single(data->pipe_crc, &data->ref_crc);
>
> /*
> * Prepare the non-rotated reference fb.
> @@ -298,21 +301,77 @@ static void wait_for_pageflip(int fd)
> igt_assert(drmHandleEvent(fd, &evctx) == 0);
> }
>
> +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)
> +{
> + 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);
> +
> + igt_plane_set_rotation(plane, data->rotation);
> + if (data->rotation & (IGT_ROTATION_90 | IGT_ROTATION_270))
> + igt_plane_set_size(plane, data->fb.height, data-
> >fb.width);
> +
> + ret = igt_display_try_commit2(display, COMMIT_ATOMIC);
> + if (test_bad_format) {
> + igt_assert_eq(ret, -EINVAL);
> + return;
> + }
> +
> + /* Verify commit was ok. */
> + igt_assert_eq(ret, 0);
> +
> + /* Check CRC */
> + igt_pipe_crc_drain(data->pipe_crc);
> + igt_pipe_crc_get_single(data->pipe_crc, &crc_output);
> + igt_assert_crc_equal(&data->ref_crc, &crc_output);
> +
> + /*
> + * If flips are requested flip to a different fb and
> + * check CRC against that one as well.
> + */
> + if (data->fb_flip.fb_id) {
> + igt_plane_set_fb(plane, &data->fb_flip);
> + if (data->rotation == IGT_ROTATION_90 || data-
> >rotation == IGT_ROTATION_270)
> + igt_plane_set_size(plane, data->fb.height,
> data->fb.width);
> +
> + if (plane->type != DRM_PLANE_TYPE_PRIMARY) {
> + igt_display_commit_atomic(display,
> DRM_MODE_PAGE_FLIP_EVENT | DRM_MODE_ATOMIC_NONBLOCK, NULL);
> + } else {
> + ret = drmModePageFlip(data->gfx_fd,
> + output->config.crtc-
> >crtc_id,
> + data->fb_flip.fb_id,
> + DRM_MODE_PAGE_FLIP_EVENT,
> + NULL);
> + igt_assert_eq(ret, 0);
> + }
> + wait_for_pageflip(data->gfx_fd);
> + igt_pipe_crc_drain(data->pipe_crc);
> + igt_pipe_crc_get_single(data->pipe_crc,
> &crc_output);
> + igt_assert_crc_equal(&data->flip_crc,
> + &crc_output);
> + }
> +}
> +
> static void test_plane_rotation(data_t *data, int plane_type, bool
> test_bad_format)
> {
> igt_display_t *display = &data->display;
> igt_output_t *output;
> enum pipe pipe;
> - int valid_tests = 0;
> - igt_crc_t crc_output;
> - int ret;
>
> if (plane_type == DRM_PLANE_TYPE_CURSOR)
> igt_require(display->has_cursor_plane);
>
> + igt_display_require_output(display);
> +
> for_each_pipe_with_valid_output(display, pipe, output) {
> igt_plane_t *plane;
> - int i;
> + int i, j;
>
> if (IS_CHERRYVIEW(data->devid) && pipe != PIPE_B)
> continue;
> @@ -335,56 +394,22 @@ static void test_plane_rotation(data_t *data,
> int plane_type, bool test_bad_form
> i != rectangle &&
> intel_gen(intel_get_drm_devid(data->gfx_fd)) < 9)
> continue;
>
> - igt_debug("Testing case %i on pipe %s\n", i,
> kmstest_pipe_name(pipe));
> - prepare_fbs(data, output, plane, i);
> -
> - igt_plane_set_rotation(plane, data-
> >rotation);
> - if (data->rotation & (IGT_ROTATION_90 |
> IGT_ROTATION_270))
> - igt_plane_set_size(plane, data-
> >fb.height, data->fb.width);
> + if (!data->override_fmt) {
> + for (j = 0; j < plane->drm_plane-
> >count_formats; j++) {
> + uint32_t format = plane-
> >drm_plane->formats[j];
>
> - ret = igt_display_try_commit2(display,
> COMMIT_ATOMIC);
> - if (test_bad_format) {
> - igt_assert_eq(ret, -EINVAL);
> - continue;
> - }
> + if
> (!igt_fb_supported_format(format))
> + continue;
>
> - /* Verify commit was ok. */
> - igt_assert_eq(ret, 0);
> -
> - /* Check CRC */
> - igt_pipe_crc_collect_crc(data->pipe_crc,
> &crc_output);
> - igt_assert_crc_equal(&data->ref_crc,
> &crc_output);
> -
> - /*
> - * If flips are requested flip to a
> different fb and
> - * check CRC against that one as well.
> - */
> - if (data->fb_flip.fb_id) {
> - igt_plane_set_fb(plane, &data-
> >fb_flip);
> - if (data->rotation ==
> IGT_ROTATION_90 || data->rotation == IGT_ROTATION_270)
> - igt_plane_set_size(plane,
> data->fb.height, data->fb.width);
> -
> - if (plane_type !=
> DRM_PLANE_TYPE_PRIMARY) {
> - igt_display_commit_atomic(di
> splay, DRM_MODE_PAGE_FLIP_EVENT | DRM_MODE_ATOMIC_NONBLOCK, NULL);
> - } else {
> - ret = drmModePageFlip(data-
> >gfx_fd,
> - output-
> >config.crtc->crtc_id,
> - data-
> >fb_flip.fb_id,
> - DRM_MODE_PAG
> E_FLIP_EVENT,
> - NULL);
> - igt_assert_eq(ret, 0);
> + test_single_case(data, pipe,
> output, plane, i,
> + format,
> test_bad_format);
> }
> - wait_for_pageflip(data->gfx_fd);
> - igt_pipe_crc_collect_crc(data-
> >pipe_crc,
> - &crc_output
> );
> - igt_assert_crc_equal(&data-
> >flip_crc,
> - &crc_output);
> + } else {
> + test_single_case(data, pipe, output,
> plane, i,
> + data->override_fmt,
> test_bad_format);
> }
> }
> -
> - valid_tests++;
> }
> - igt_require_f(valid_tests, "no valid crtc/connector
> combinations found\n");
> }
>
> static void test_plane_rotation_exhaust_fences(data_t *data,
--
Mika Kahola - Intel OTC
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [igt-dev] [PATCH i-g-t 12/12] tests/kms_rotation_crc: Test all pixel formats on all planes.
2018-02-12 13:09 ` Mika Kahola
@ 2018-02-12 14:20 ` Maarten Lankhorst
0 siblings, 0 replies; 39+ messages in thread
From: Maarten Lankhorst @ 2018-02-12 14:20 UTC (permalink / raw)
To: mika.kahola, igt-dev, Srinivas, Vidya
Op 12-02-18 om 14:09 schreef Mika Kahola:
> On Tue, 2018-02-06 at 11:14 +0100, Maarten Lankhorst wrote:
>> The test is modified to test all pixel formats on a plane, unless
>> the pixel format is overridden by the subtest.
>>
>> Attempting to test all pixel formats requires even more runtime and
>> the overhead of toggling crc collection to capture a single CRC
>> becomes significant, so keep the crc collection enabled during the
>> entire test.
>>
>> This reduces the runtime from ~24s to ~16s per subtest on SKL.
>>
> Reviewed-by: Mika Kahola <mika.kahola@intel.com>
Pushed with Vidya's t-b, thanks for reviewing. :)
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 39+ messages in thread
end of thread, other threads:[~2018-02-12 14:20 UTC | newest]
Thread overview: 39+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-06 10:14 [igt-dev] [PATCH i-g-t 01/12] lib/igt_fb: Make igt_remove_fb more robust Maarten Lankhorst
2018-02-06 10:14 ` [igt-dev] [PATCH i-g-t 02/12] tests: Always call igt_remove_fb without checking Maarten Lankhorst
2018-02-07 13:42 ` Mika Kahola
2018-02-06 10:14 ` [igt-dev] [PATCH i-g-t 03/12] lib/igt_fb: Add igt_fb_supported_format() Maarten Lankhorst
2018-02-08 8:08 ` Mika Kahola
2018-02-06 10:14 ` [igt-dev] [PATCH i-g-t 04/12] lib/igt_fb: Remove igt_get_all_cairo_formats() Maarten Lankhorst
2018-02-08 8:15 ` Mika Kahola
2018-02-06 10:14 ` [igt-dev] [PATCH i-g-t 05/12] lib/igt_debugfs: Add igt_pipe_crc_get_single and igt_pipe_crc_drain Maarten Lankhorst
2018-02-06 16:11 ` Ville Syrjälä
2018-02-06 16:30 ` Maarten Lankhorst
2018-02-07 11:47 ` [igt-dev] [PATCH i-g-t] lib/igt_debugfs: Add igt_pipe_crc_get_single and igt_pipe_crc_drain, v2 Maarten Lankhorst
2018-02-08 11:15 ` Mika Kahola
2018-02-08 12:31 ` [PATCH i-g-t] lib/igt_debugfs: Add igt_pipe_crc_get_single and igt_pipe_crc_drain, v3 Maarten Lankhorst
2018-02-09 10:01 ` [igt-dev] [PATCH i-g-t] lib/igt_debugfs: Add igt_pipe_crc_get_single and igt_pipe_crc_drain, v4 Maarten Lankhorst
2018-02-06 10:14 ` [igt-dev] [PATCH i-g-t 06/12] tests/kms_rotation_crc: Fix bad-tiling testcase Maarten Lankhorst
2018-02-08 12:08 ` Mika Kahola
2018-02-08 12:12 ` Maarten Lankhorst
2018-02-08 12:19 ` Mika Kahola
2018-02-06 10:14 ` [igt-dev] [PATCH i-g-t 07/12] tests/kms_rotation_crc: Move bad_format parameter to test_plane_rotation Maarten Lankhorst
2018-02-08 13:07 ` Mika Kahola
2018-02-06 10:14 ` [igt-dev] [PATCH i-g-t 08/12] tests/kms_rotation_crc: Always run the flip tests when available Maarten Lankhorst
2018-02-06 10:14 ` [igt-dev] [PATCH i-g-t 09/12] tests/kms_rotation_crc: Remove primary-rotation-90-Y-tiled Maarten Lankhorst
2018-02-09 8:25 ` Kahola, Mika
2018-02-06 10:14 ` [igt-dev] [PATCH i-g-t 10/12] tests/kms_rotation_crc: Perform lazy cleanup and require atomic Maarten Lankhorst
2018-02-09 9:39 ` Kahola, Mika
2018-02-06 10:14 ` [igt-dev] [PATCH i-g-t 11/12] tests/kms_rotation_crc: Clean up exhaust-fences subtest Maarten Lankhorst
2018-02-12 11:20 ` Mika Kahola
2018-02-06 10:14 ` [igt-dev] [PATCH i-g-t 12/12] tests/kms_rotation_crc: Test all pixel formats on all planes Maarten Lankhorst
2018-02-08 3:33 ` Srinivas, Vidya
2018-02-12 13:09 ` Mika Kahola
2018-02-12 14:20 ` Maarten Lankhorst
2018-02-06 11:25 ` [igt-dev] ✗ Fi.CI.BAT: warning for series starting with [i-g-t,01/12] lib/igt_fb: Make igt_remove_fb more robust Patchwork
2018-02-07 13:30 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,01/12] lib/igt_fb: Make igt_remove_fb more robust (rev2) Patchwork
2018-02-07 13:39 ` [igt-dev] [PATCH i-g-t 01/12] lib/igt_fb: Make igt_remove_fb more robust Mika Kahola
2018-02-07 16:36 ` [igt-dev] ✗ Fi.CI.IGT: failure for series starting with [i-g-t,01/12] lib/igt_fb: Make igt_remove_fb more robust (rev2) Patchwork
2018-02-08 19:06 ` ✓ Fi.CI.BAT: success for lib/igt_debugfs: Add igt_pipe_crc_get_single and igt_pipe_crc_drain, v3 Patchwork
2018-02-09 4:48 ` ✗ Fi.CI.IGT: failure " Patchwork
2018-02-09 16:33 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,01/12] lib/igt_fb: Make igt_remove_fb more robust (rev3) Patchwork
2018-02-09 18:21 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
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.