All of lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t v8] igt/tests: kms_plane_stress: Add plane stress test
@ 2019-04-11 13:49 Stanislav Lisovskiy
  2019-04-11 16:55 ` [igt-dev] ✓ Fi.CI.BAT: success for igt/tests: kms_plane_stress: Add plane stress test (rev10) Patchwork
  2019-04-11 23:12 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
  0 siblings, 2 replies; 4+ messages in thread
From: Stanislav Lisovskiy @ 2019-04-11 13:49 UTC (permalink / raw)
  To: igt-dev
  Cc: stanislav.lisovskiy, ville.syrjala, martin.peres, juha-pekka.heikkila

This test attempts to utilize all connected
outputs at the same time, using maximum possible
resolution and amount of planes, to check whether
we are hiting any kind of bandwidth, watermark or
other limitations.

v2: Added cpu and gpu load threads, which consume
    additional bandwidth.

v3: Removed binary picture file, using pattern fb
    instead.

v4: Moved FB creation/removal to better place.

v5: Fixed rebase conflict and changed "fb->tiling"
    to "fb->modifier".

v6: Removed unnecessary new macro for iterating on
    pipes. Taken into use igt_gettime instead of
    clock_gettime.

v7: Put fb reinit into igt_fixture to avoid problems.
    Move stress function under igt_subtest. Release planes,
    remove redundant commit, assert if no planes can be used.

v8: - Add blitting also, to have more fun
    - Now using separate framebuffer per each plane.
    - Fixed magic number for bpp value(now based on format)
    - Some optimizations, like not applying same mode if it
      hasn't change, also don't do highest mode search on
      each iteration, just calculate once and use it.
    - Some code refactoring: extracted some lengthy code
      to separate functions.
    - Fixed wrong index for cursor FB(cursor FB is one per pipe)

Signed-off-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
---
 tests/Makefile.sources   |   1 +
 tests/kms_plane_stress.c | 677 +++++++++++++++++++++++++++++++++++++++
 tests/meson.build        |   1 +
 3 files changed, 679 insertions(+)
 create mode 100644 tests/kms_plane_stress.c

diff --git a/tests/Makefile.sources b/tests/Makefile.sources
index 71ccf00a..9d04d888 100644
--- a/tests/Makefile.sources
+++ b/tests/Makefile.sources
@@ -59,6 +59,7 @@ TESTS_progs = \
 	kms_plane_lowres \
 	kms_plane_multiple \
 	kms_plane_scaling \
+	kms_plane_stress \
 	kms_prop_blob \
 	kms_properties \
 	kms_psr \
diff --git a/tests/kms_plane_stress.c b/tests/kms_plane_stress.c
new file mode 100644
index 00000000..b61501ed
--- /dev/null
+++ b/tests/kms_plane_stress.c
@@ -0,0 +1,677 @@
+ /*
+ * Copyright © 2019 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#include "igt.h"
+#include "igt_rand.h"
+#include "drmtest.h"
+#include "sw_sync.h"
+#include <errno.h>
+#include <pthread.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <string.h>
+#include <time.h>
+#include <poll.h>
+#include <pthread.h>
+
+#ifndef DRM_CAP_CURSOR_WIDTH
+#define DRM_CAP_CURSOR_WIDTH 0x8
+#endif
+#ifndef DRM_CAP_CURSOR_HEIGHT
+#define DRM_CAP_CURSOR_HEIGHT 0x9
+#endif
+
+
+drmModeModeInfo uhd_mode_60hz = {
+	.name = "3840x2160@60hz",
+	.vrefresh = 60,
+	.clock = 142667*2,
+	.hdisplay = 3840,
+	.hsync_start = 1936*2,
+	.hsync_end = 1952*2,
+	.htotal = 2104*2,
+	.vdisplay = 2160,
+	.vsync_start = 1083*2,
+	.vsync_end = 1097*2,
+	.vtotal = 1128*2,
+	.flags = 0xa,
+};
+
+#define N_FORMATS 3
+static const uint32_t formats[N_FORMATS] = {
+	DRM_FORMAT_XRGB8888,
+	DRM_FORMAT_RGB565,
+	DRM_FORMAT_XRGB2101010,
+};
+
+#define N_TILING_METHODS 3
+static const uint64_t tilings[N_TILING_METHODS] = {
+	DRM_FORMAT_MOD_LINEAR,
+	I915_FORMAT_MOD_X_TILED,
+	I915_FORMAT_MOD_Y_TILED,
+};
+
+static const char *format_str(int format_index)
+{
+	switch (formats[format_index]) {
+	case DRM_FORMAT_RGB565:
+		return "rgb565";
+	case DRM_FORMAT_XRGB8888:
+		return "xrgb8888";
+	case DRM_FORMAT_XRGB2101010:
+		return "xrgb2101010";
+	default:
+		igt_assert(false);
+	}
+}
+
+static const char *tiling_str(int tiling_index)
+{
+	switch (tilings[tiling_index]) {
+	case DRM_FORMAT_MOD_LINEAR:
+		return "untiled";
+	case I915_FORMAT_MOD_X_TILED:
+		return "xtiled";
+	case I915_FORMAT_MOD_Y_TILED:
+		return "ytiled";
+	default:
+		igt_assert(false);
+	}
+}
+
+
+#define MAX_CORES 8
+#define MAX_PLANES 16
+
+struct data;
+
+struct thread_context {
+	struct data *data;
+	int id;
+	void *buf1;
+	void *buf2;
+};
+
+struct rect {
+	int x;
+	int y;
+	int w;
+	int h;
+};
+
+struct gpu_context {
+	struct data *data;
+	int pipe;
+	int color;
+	struct rect blt_rect;
+};
+
+struct data {
+	int drm_fd;
+	igt_display_t display;
+	int num_planes[IGT_MAX_PIPES];
+	uint32_t format;
+	uint64_t modifier;
+	uint32_t devid;
+	drm_intel_bufmgr *bufmgr;
+	drmModeModeInfo *last_mode[IGT_MAX_PIPES];
+	struct igt_fb fb[IGT_MAX_PIPES * MAX_PLANES];
+	struct igt_fb cursor_fb[IGT_MAX_PIPES];
+	pthread_t cpu_thread[MAX_CORES];
+	bool cpu_thread_stop[MAX_CORES];
+	struct thread_context cpu_context[MAX_CORES];
+	struct gpu_context gpu_context[IGT_MAX_PIPES];
+};
+
+
+struct base_crc {
+	bool set;
+	igt_crc_t crc;
+};
+
+igt_pipe_crc_t *pipe_crc;
+
+#define BUF_SIZE 128*1024*1024
+
+static void *cpu_load(void *d)
+{
+	char *buf1, *buf2;
+	struct thread_context *context = (struct thread_context *)d;
+	struct data *data = context->data;
+
+	buf1 = context->buf1;
+	buf2 = context->buf2;
+
+	data->cpu_thread_stop[context->id] = false;
+
+	while(!data->cpu_thread_stop[context->id]) {
+		memcpy(buf1, buf2, BUF_SIZE);
+		memcpy(buf2, buf1, BUF_SIZE);
+	}
+
+	return NULL;
+}
+
+
+static void scratch_buf_init(struct igt_buf *buf,
+			drm_intel_bo *bo, int width, int height, int stride, int tiling, int bpp)
+{
+	buf->bo = bo;
+	buf->stride = stride;
+	buf->tiling = tiling;
+	buf->size = width * height * bpp / 8;
+	buf->bpp = bpp;
+}
+
+
+static void gpu_load(struct gpu_context *gpu_context, int plane_index)
+{
+	struct intel_batchbuffer *batch = NULL;
+	struct igt_buf dst;
+	struct data *data = gpu_context->data;
+	int pipe = gpu_context->pipe;
+	igt_fillfunc_t gpgpu_fill = NULL;
+	drm_intel_bo *bo;
+	struct igt_fb *fb = &data->fb[pipe * MAX_PLANES + plane_index];
+	int rect_divisor;
+	int rect_width;
+	int rect_height;
+	int frame_width = fb->width;
+	int frame_height = fb->height / 2;
+	int bytes_per_pixel = fb->plane_bpp[0] / 8;
+
+	if (!data->devid) {
+		data->devid = intel_get_drm_devid(data->drm_fd);
+		igt_require_gem(data->drm_fd);
+
+		data->bufmgr = drm_intel_bufmgr_gem_init(data->drm_fd, 4096);
+		igt_assert(data->bufmgr);
+	}
+
+	gpgpu_fill = igt_get_gpgpu_fillfunc(data->devid);
+
+	igt_require_f(gpgpu_fill,
+	      "no gpgpu-fill function\n");
+
+	batch = intel_batchbuffer_alloc(data->bufmgr, data->devid);
+	igt_assert(batch);
+
+	bo = gem_handle_to_libdrm_bo(data->bufmgr, data->drm_fd, "", fb->gem_handle);
+
+	scratch_buf_init(&dst, bo, frame_width, frame_height, fb->strides[0], fb->modifier, fb->plane_bpp[0]);
+
+	gpgpu_fill(batch,
+	   &dst, 0, 0, (frame_width * bytes_per_pixel), frame_height,
+	   gpu_context->color);
+
+	gpu_context->color += 0x10;
+
+	intel_batchbuffer_flush(batch);
+	intel_batchbuffer_free(batch);
+	drm_intel_bo_unreference(bo);
+
+	/* divide at least by 2 and up to 8 */
+	rect_divisor = 1 << (hars_petruska_f54_1_random_unsafe_max(3) + 1);
+
+	rect_width = frame_width / rect_divisor;
+	rect_height = frame_height / rect_divisor;
+
+	gpu_context->blt_rect.x = (gpu_context->blt_rect.x + rect_width) % (frame_width - rect_width);
+	gpu_context->blt_rect.y = (gpu_context->blt_rect.y + rect_height) % (frame_height - rect_height);
+
+	igt_draw_rect(data->drm_fd, data->bufmgr, NULL,
+		   fb->gem_handle, frame_width * frame_height * bytes_per_pixel, fb->width * bytes_per_pixel,
+		   IGT_DRAW_BLT, gpu_context->blt_rect.x, gpu_context->blt_rect.y,
+		   rect_width, rect_height, 0xff, fb->plane_bpp[0]);
+}
+
+static inline uint32_t pipe_select(enum pipe pipe)
+{
+	if (pipe > 1)
+		return pipe << DRM_VBLANK_HIGH_CRTC_SHIFT;
+	else if (pipe > 0)
+		return DRM_VBLANK_SECONDARY;
+	else
+		return 0;
+}
+
+static unsigned get_vblank(int fd, enum pipe pipe, unsigned flags)
+{
+	union drm_wait_vblank vbl;
+
+	memset(&vbl, 0, sizeof(vbl));
+	vbl.request.type = DRM_VBLANK_RELATIVE | pipe_select(pipe) | flags;
+	if (drmIoctl(fd, DRM_IOCTL_WAIT_VBLANK, &vbl))
+		return 0;
+
+	return vbl.reply.sequence;
+}
+
+
+static int plane_stress(struct data *data, igt_output_t *output, enum pipe pipe, drmModeModeInfo *mode, bool gpu)
+{
+	igt_plane_t *plane;
+	uint64_t cursor_width, cursor_height;
+	int i;
+	int ret;
+	igt_crc_t crc, crc2;
+	bool new_mode = false;
+
+	if (data->last_mode[pipe] != mode) {
+		igt_output_override_mode(output, mode);
+		igt_output_set_pipe(output, pipe);
+
+		ret = igt_display_try_commit_atomic(&data->display,
+				DRM_MODE_ATOMIC_TEST_ONLY | DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);
+		if (ret) {
+			igt_warn("Could not commit mode: \n");
+			kmstest_dump_mode(mode);
+			return ret;
+		}
+
+		igt_display_commit2(&data->display, COMMIT_ATOMIC);
+		data->last_mode[pipe] = mode;
+		new_mode = true;
+	}
+
+	/*
+	 * Looks like we can't have planes on that pipe at all
+	 */
+	if (!data->num_planes[pipe])
+		return 0;
+
+	mode = igt_output_get_mode(output);
+
+	do_or_die(drmGetCap(data->drm_fd, DRM_CAP_CURSOR_WIDTH, &cursor_width));
+	do_or_die(drmGetCap(data->drm_fd, DRM_CAP_CURSOR_HEIGHT, &cursor_height));
+
+	if (!data->cursor_fb[pipe].fb_id) {
+		igt_create_color_fb(data->drm_fd, cursor_width, cursor_height,
+				DRM_FORMAT_ARGB8888,
+				LOCAL_DRM_FORMAT_MOD_NONE,
+					1.0,0.0,0.0,
+					&data->cursor_fb[pipe]);
+	}
+
+
+	for (i = 0;i < data->num_planes[pipe];i++) {
+		if (!data->fb[pipe * MAX_PLANES + i].fb_id) {
+			igt_create_color_pattern_fb(data->drm_fd, mode->hdisplay, mode->vdisplay,
+			    data->format,
+			    data->modifier,
+			    0.0, 1.0, 0.0, &data->fb[pipe * MAX_PLANES + i]);
+		}
+	}
+
+	if (new_mode) {
+		i = 0;
+		for_each_plane_on_pipe(&data->display, pipe, plane) {
+			int plane_width, plane_height;
+			if (plane->type == DRM_PLANE_TYPE_CURSOR) {
+				igt_plane_set_fb(plane, &data->cursor_fb[pipe]);
+				igt_fb_set_size(&data->cursor_fb[pipe], plane, cursor_width, cursor_height);
+				igt_plane_set_size(plane, cursor_width, cursor_height);
+				plane_width = cursor_width;
+				plane_height = cursor_height;
+			} else {
+				igt_plane_set_fb(plane, &data->fb[pipe * MAX_PLANES + i]);
+				igt_plane_set_position(plane, 0, 0);
+				igt_fb_set_size(&data->fb[pipe * MAX_PLANES + i], plane, mode->hdisplay, mode->vdisplay);
+				igt_plane_set_size(plane, mode->hdisplay, mode->vdisplay);
+				plane_width = mode->hdisplay;
+				plane_height = mode->vdisplay;
+			}
+
+			ret = igt_display_try_commit_atomic(&data->display, DRM_MODE_ATOMIC_TEST_ONLY | DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);
+			while (ret) {
+				if (plane_width <= cursor_width || plane_height <= cursor_height)
+					break;
+				plane_width /= 2;
+				plane_height /= 2;
+				igt_plane_set_size(plane, plane_width, plane_height);
+				igt_info("Reduced plane %d size to %dx%d\n", plane->index, plane_width, plane_height);
+				ret = igt_display_try_commit_atomic(&data->display, DRM_MODE_ATOMIC_TEST_ONLY | DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);
+			}
+			if (ret) {
+				igt_info("Plane %d pipe %d try commit failed, exiting\n", i, pipe);
+				data->num_planes[pipe] = i;
+				/*
+				 * We have now determined max amount of full sized planes, we will just
+				 * keep it in mind and be smarter next time. Also lets remove unneeded fbs.
+				 * Don't destroy cursor_fb as will take care about it at the end.
+				 */
+				igt_plane_set_fb(plane, NULL);
+				while (i < MAX_PLANES) {
+					igt_remove_fb(data->display.drm_fd, &data->fb[pipe * MAX_PLANES + i]);
+					data->fb[pipe * MAX_PLANES + i].fb_id = 0;
+					i++;
+				}
+				i = data->num_planes[pipe];
+			}
+
+			if (++i >= data->num_planes[pipe])
+				break;
+		}
+
+		igt_display_commit2(&data->display, COMMIT_ATOMIC);
+	}
+
+	for (i = 0; i < data->num_planes[pipe]; i++) {
+		if (gpu) {
+			gpu_load(&data->gpu_context[pipe], i);
+		}
+	}
+
+	get_vblank(data->display.drm_fd, pipe, DRM_VBLANK_NEXTONMISS);
+
+	igt_pipe_crc_collect_crc(pipe_crc, &crc);
+
+	get_vblank(data->display.drm_fd, pipe, DRM_VBLANK_NEXTONMISS);
+
+	igt_pipe_crc_collect_crc(pipe_crc, &crc2);
+	igt_assert_crc_equal(&crc, &crc2);
+
+	return 0;
+}
+
+
+static drmModeModeInfo * find_highest_mode(drmModeConnector *connector)
+{
+	drmModeModeInfo *highest_mode = NULL;
+	int j;
+
+	for (j = 0; j < connector->count_modes; j++) {
+		if (!highest_mode) {
+			highest_mode = &connector->modes[j];
+		}
+		else if (connector->modes[j].vdisplay && connector->modes[j].hdisplay) {
+			if (highest_mode->hdisplay < connector->modes[j].hdisplay)
+				highest_mode = &connector->modes[j];
+			}
+	}
+
+	return highest_mode;
+}
+
+typedef drmModeConnector * drmModeConnectorPtr;
+
+static void fill_connector_to_pipe_array(struct data *data, drmModeRes *mode_resources, drmModeConnectorPtr *connectors)
+{
+	int pipe = 0, crtc_id;
+	igt_output_t *output;
+	int i;
+
+	memset(connectors, 0, sizeof(drmModeConnectorPtr) * IGT_MAX_PIPES);
+
+	for_each_connected_output(&data->display, output) {
+		crtc_id = 0;
+		for (i = 0; i < mode_resources->count_connectors; i++) {
+			drmModeConnector *connector;
+
+			connector = drmModeGetConnectorCurrent(data->drm_fd,
+				       mode_resources->connectors[i]);
+
+			if (!connector) {
+				igt_warn("could not get connector %i: %s\n",
+					mode_resources->connectors[i], strerror(errno));
+				continue;
+			}
+
+			if (connector->connection == DRM_MODE_CONNECTED) {
+				if (crtc_id == pipe) {
+					connectors[pipe] = (drmModeConnectorPtr)connector;
+				}
+				crtc_id++;
+			}
+			else
+				drmModeFreeConnector(connector);
+		}
+		if ((++pipe) == IGT_MAX_PIPES)
+			break;
+	}
+}
+
+static void release_connectors(drmModeConnectorPtr *connectors)
+{
+	int i;
+	for (i = 0; i < IGT_MAX_PIPES; i++) {
+		if (connectors[i])
+			drmModeFreeConnector(connectors[i]);
+	}
+}
+
+#define MIN_DURATION_SEC 5.00
+#define MIN_ITERATIONS 20
+
+static void stress(struct data *data, bool override, bool gpu, int format_idx, int tiling_idx)
+{
+	struct timespec start, end;
+	igt_output_t *output;
+	int ret;
+	int pipe;
+	int iterations = 0;
+	bool need_continue;
+	drmModeModeInfo *highest_mode[IGT_MAX_PIPES];
+	drmModeConnectorPtr connectors[IGT_MAX_PIPES];
+	drmModeRes *mode_resources = drmModeGetResources(data->drm_fd);
+
+	if (!mode_resources) {
+		igt_warn("drmModeGetResources failed: %s\n", strerror(errno));
+		return;
+	}
+
+	memset(highest_mode, 0, sizeof(drmModeModeInfo *) * IGT_MAX_PIPES);
+
+	fill_connector_to_pipe_array(data, mode_resources, connectors);
+
+	igt_gettime(&start);
+
+	do {
+		/*
+		 * Increment pipe only for connected outputs,
+		 * for each connected output we should assign a
+		 * different pipe.
+		 */
+		pipe = 0;
+		for_each_connected_output(&data->display, output) {
+			drmModeConnector *connector = (drmModeConnector *)connectors[pipe];
+
+			if (!highest_mode[pipe]) {
+				if (!override && connector->count_modes) {
+					highest_mode[pipe] = find_highest_mode(connector);
+				}
+				else
+					highest_mode[pipe] = &uhd_mode_60hz;
+			}
+
+			data->format = formats[format_idx];
+			data->modifier = tilings[tiling_idx];
+
+			/*
+			 * Until we figure out maximum amount of planes,
+			 * use the one declared by kernel.
+			 */
+			if (data->num_planes[pipe] == -1)
+				data->num_planes[pipe] = data->display.pipes[pipe].n_planes;
+
+			igt_assert_f(data->display.pipes[pipe].n_planes < MAX_PLANES,
+				"Currently we don't support more than %d planes!", MAX_PLANES);
+
+			igt_info("Pipe %s %d planes, using mode:", kmstest_pipe_name(pipe),
+					data->num_planes[pipe]);
+
+			kmstest_dump_mode(highest_mode[pipe]);
+
+			pipe_crc = igt_pipe_crc_new(data->drm_fd, pipe,
+				INTEL_PIPE_CRC_SOURCE_AUTO);
+
+			ret = plane_stress(data, output, pipe, highest_mode[pipe], gpu);
+
+			igt_pipe_crc_free(pipe_crc);
+
+			if (++pipe == IGT_MAX_PIPES)
+				break;
+		}
+		igt_gettime(&end);
+		iterations++;
+		need_continue = igt_time_elapsed(&start, &end) < MIN_DURATION_SEC || iterations < MIN_ITERATIONS;
+	} while (need_continue && !ret);
+
+	release_connectors(connectors);
+
+	drmModeFreeResources(mode_resources);
+}
+
+
+static void test(struct data *data, bool override, bool cpu, bool gpu)
+{
+	int i, j;
+	int number_of_cores = min(sysconf(_SC_NPROCESSORS_ONLN), MAX_CORES);
+	int format_idx, tiling_idx;
+
+	igt_fixture {
+		for (i = 0; i < IGT_MAX_PIPES; i++) {
+			for (j = 0;j < MAX_PLANES; j++)
+				data->fb[i * MAX_PLANES + j].fb_id = 0;
+			data->cursor_fb[i].fb_id = 0;
+			data->num_planes[i] = -1;
+			data->last_mode[i] = NULL;
+		}
+		if (gpu) {
+			for (i = 0; i < IGT_MAX_PIPES; i++) {
+				data->gpu_context[i].data = data;
+				data->gpu_context[i].pipe = i;
+				data->gpu_context[i].blt_rect.x = 0;
+				data->gpu_context[i].blt_rect.y = 0;
+				data->gpu_context[i].blt_rect.w = 0;
+				data->gpu_context[i].blt_rect.h = 0;
+			}
+		}
+
+		if (cpu) {
+			for (i = 0; i < number_of_cores;i++) {
+				data->cpu_context[i].buf1 = malloc(BUF_SIZE);
+				data->cpu_context[i].buf2 = malloc(BUF_SIZE);
+				data->cpu_context[i].id = i;
+				data->cpu_context[i].data = data;
+				pthread_create(&data->cpu_thread[i], NULL, cpu_load, (void*)&data->cpu_context[i]);
+			}
+		}
+	}
+
+	for (format_idx = 0; format_idx < N_FORMATS; format_idx++) {
+		for (tiling_idx = 0; tiling_idx < N_TILING_METHODS; tiling_idx++) {
+			igt_subtest_f("stress%s%s%s-%s-%s",
+				      override == false ? "" : "-mode-override",
+				      cpu == false ? "" : "-cpu-load",
+				      gpu == false ? "" : "-gpu-load",
+				      format_str(format_idx),
+				      tiling_str(tiling_idx)) {
+
+				stress(data, override, gpu, format_idx, tiling_idx);
+
+			}
+
+			igt_fixture {
+				/*
+				 * As we change tiling/format we need a new FB
+				 */
+				for (i = 0; i < IGT_MAX_PIPES; i++) {
+					data->last_mode[i] = NULL;
+					for (j = 0;j < MAX_PLANES; j++) {
+						if (data->fb[i * MAX_PLANES + j].fb_id) {
+							igt_plane_set_fb(&data->display.pipes[i].planes[j], NULL);
+							igt_remove_fb(data->display.drm_fd, &data->fb[i * MAX_PLANES + j]);
+							data->fb[i * MAX_PLANES + j].fb_id = 0;
+						}
+					}
+					data->num_planes[i] = -1;
+					if (data->cursor_fb[i].fb_id) {
+						igt_remove_fb(data->display.drm_fd, &data->cursor_fb[i]);
+						data->cursor_fb[i].fb_id = 0;
+					}
+				}
+			}
+		}
+	}
+
+	igt_fixture {
+		if (cpu) {
+			for (i = 0; i < number_of_cores;i++) {
+				data->cpu_thread_stop[i] = true;
+				pthread_join(data->cpu_thread[i], NULL);
+			}
+			for (i = 0;i < number_of_cores; i++) {
+				free(data->cpu_context[i].buf1);
+				free(data->cpu_context[i].buf2);
+			}
+		}
+	}
+}
+
+
+struct data data = {
+	.format = DRM_FORMAT_XRGB8888,
+	.modifier = DRM_FORMAT_MOD_LINEAR,
+	.devid = 0,
+};
+
+
+igt_main
+{
+	bool mode_override = false;
+	bool cpu_load = false;
+	bool gpu_load = false;
+
+	igt_fixture {
+		data.drm_fd = data.display.drm_fd = drm_open_driver_master(DRIVER_ANY);
+
+		kmstest_set_vt_graphics_mode();
+
+		igt_display_require(&data.display, data.display.drm_fd);
+		igt_require(data.display.is_atomic);
+		igt_display_require_output(&data.display);
+	}
+
+	test(&data, mode_override, cpu_load, gpu_load);
+
+	cpu_load = true;
+	gpu_load = true;
+
+	test(&data, mode_override, cpu_load, gpu_load);
+
+	mode_override = true;
+	cpu_load = false;
+	gpu_load = false;
+
+	test(&data, mode_override, cpu_load, gpu_load);
+
+	cpu_load = true;
+	gpu_load = true;
+
+	test(&data, mode_override, cpu_load, gpu_load);
+
+	igt_fixture {
+		igt_display_fini(&data.display);
+	}
+}
\ No newline at end of file
diff --git a/tests/meson.build b/tests/meson.build
index 9015f809..c586642c 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -46,6 +46,7 @@ test_progs = [
 	'kms_plane_lowres',
 	'kms_plane_multiple',
 	'kms_plane_scaling',
+	'kms_plane_stress',
 	'kms_prop_blob',
 	'kms_properties',
 	'kms_psr',
-- 
2.17.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [igt-dev] ✓ Fi.CI.BAT: success for igt/tests: kms_plane_stress: Add plane stress test (rev10)
  2019-04-11 13:49 [igt-dev] [PATCH i-g-t v8] igt/tests: kms_plane_stress: Add plane stress test Stanislav Lisovskiy
@ 2019-04-11 16:55 ` Patchwork
  2019-04-11 23:12 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
  1 sibling, 0 replies; 4+ messages in thread
From: Patchwork @ 2019-04-11 16:55 UTC (permalink / raw)
  To: Lisovskiy, Stanislav; +Cc: igt-dev

== Series Details ==

Series: igt/tests: kms_plane_stress: Add plane stress test (rev10)
URL   : https://patchwork.freedesktop.org/series/58524/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_5911 -> IGTPW_2849
====================================================

Summary
-------

  **SUCCESS**

  No regressions found.

  External URL: https://patchwork.freedesktop.org/api/1.0/series/58524/revisions/10/mbox/

Known issues
------------

  Here are the changes found in IGTPW_2849 that come from known issues:

### IGT changes ###

#### Issues hit ####

  * igt@gem_exec_suspend@basic-s4-devices:
    - fi-blb-e6850:       PASS -> INCOMPLETE [fdo#107718]

  * igt@i915_selftest@live_execlists:
    - fi-apl-guc:         PASS -> INCOMPLETE [fdo#103927] / [fdo#109720]

  * igt@kms_pipe_crc_basic@read-crc-pipe-a-frame-sequence:
    - fi-byt-clapper:     PASS -> FAIL [fdo#103191]

  * igt@runner@aborted:
    - fi-apl-guc:         NOTRUN -> FAIL [fdo#108622] / [fdo#109720]

  
#### Possible fixes ####

  * igt@kms_frontbuffer_tracking@basic:
    - fi-byt-clapper:     FAIL [fdo#103167] -> PASS

  * igt@kms_pipe_crc_basic@read-crc-pipe-a:
    - fi-byt-clapper:     FAIL [fdo#103191] -> PASS

  
  [fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
  [fdo#103191]: https://bugs.freedesktop.org/show_bug.cgi?id=103191
  [fdo#103927]: https://bugs.freedesktop.org/show_bug.cgi?id=103927
  [fdo#107718]: https://bugs.freedesktop.org/show_bug.cgi?id=107718
  [fdo#108622]: https://bugs.freedesktop.org/show_bug.cgi?id=108622
  [fdo#109720]: https://bugs.freedesktop.org/show_bug.cgi?id=109720


Participating hosts (51 -> 45)
------------------------------

  Missing    (6): fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-ctg-p8600 fi-bdw-samus 


Build changes
-------------

    * IGT: IGT_4943 -> IGTPW_2849

  CI_DRM_5911: b11c9dc17f8b821e3f1ffc3df17f401c12a22669 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_2849: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2849/
  IGT_4943: 5941f371b0fe25084d4b1c49882faa8d41d44c9f @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools



== Testlist changes ==

+igt@kms_plane_stress@stress-cpu-load-gpu-load-rgb565-untiled
+igt@kms_plane_stress@stress-cpu-load-gpu-load-rgb565-xtiled
+igt@kms_plane_stress@stress-cpu-load-gpu-load-rgb565-ytiled
+igt@kms_plane_stress@stress-cpu-load-gpu-load-xrgb8888-untiled
+igt@kms_plane_stress@stress-cpu-load-gpu-load-xrgb8888-xtiled
+igt@kms_plane_stress@stress-cpu-load-gpu-load-xrgb8888-ytiled
+igt@kms_plane_stress@stress-cpu-load-gpu-load-xrgb2101010-untiled
+igt@kms_plane_stress@stress-cpu-load-gpu-load-xrgb2101010-xtiled
+igt@kms_plane_stress@stress-cpu-load-gpu-load-xrgb2101010-ytiled
+igt@kms_plane_stress@stress-mode-override-cpu-load-gpu-load-rgb565-untiled
+igt@kms_plane_stress@stress-mode-override-cpu-load-gpu-load-rgb565-xtiled
+igt@kms_plane_stress@stress-mode-override-cpu-load-gpu-load-rgb565-ytiled
+igt@kms_plane_stress@stress-mode-override-cpu-load-gpu-load-xrgb8888-untiled
+igt@kms_plane_stress@stress-mode-override-cpu-load-gpu-load-xrgb8888-xtiled
+igt@kms_plane_stress@stress-mode-override-cpu-load-gpu-load-xrgb8888-ytiled
+igt@kms_plane_stress@stress-mode-override-cpu-load-gpu-load-xrgb2101010-untiled
+igt@kms_plane_stress@stress-mode-override-cpu-load-gpu-load-xrgb2101010-xtiled
+igt@kms_plane_stress@stress-mode-override-cpu-load-gpu-load-xrgb2101010-ytiled
+igt@kms_plane_stress@stress-mode-override-rgb565-untiled
+igt@kms_plane_stress@stress-mode-override-rgb565-xtiled
+igt@kms_plane_stress@stress-mode-override-rgb565-ytiled
+igt@kms_plane_stress@stress-mode-override-xrgb8888-untiled
+igt@kms_plane_stress@stress-mode-override-xrgb8888-xtiled
+igt@kms_plane_stress@stress-mode-override-xrgb8888-ytiled
+igt@kms_plane_stress@stress-mode-override-xrgb2101010-untiled
+igt@kms_plane_stress@stress-mode-override-xrgb2101010-xtiled
+igt@kms_plane_stress@stress-mode-override-xrgb2101010-ytiled
+igt@kms_plane_stress@stress-rgb565-untiled
+igt@kms_plane_stress@stress-rgb565-xtiled
+igt@kms_plane_stress@stress-rgb565-ytiled
+igt@kms_plane_stress@stress-xrgb8888-untiled
+igt@kms_plane_stress@stress-xrgb8888-xtiled
+igt@kms_plane_stress@stress-xrgb8888-ytiled
+igt@kms_plane_stress@stress-xrgb2101010-untiled
+igt@kms_plane_stress@stress-xrgb2101010-xtiled
+igt@kms_plane_stress@stress-xrgb2101010-ytiled

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2849/
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [igt-dev] ✓ Fi.CI.IGT: success for igt/tests: kms_plane_stress: Add plane stress test (rev10)
  2019-04-11 13:49 [igt-dev] [PATCH i-g-t v8] igt/tests: kms_plane_stress: Add plane stress test Stanislav Lisovskiy
  2019-04-11 16:55 ` [igt-dev] ✓ Fi.CI.BAT: success for igt/tests: kms_plane_stress: Add plane stress test (rev10) Patchwork
@ 2019-04-11 23:12 ` Patchwork
  1 sibling, 0 replies; 4+ messages in thread
From: Patchwork @ 2019-04-11 23:12 UTC (permalink / raw)
  To: Lisovskiy, Stanislav; +Cc: igt-dev

== Series Details ==

Series: igt/tests: kms_plane_stress: Add plane stress test (rev10)
URL   : https://patchwork.freedesktop.org/series/58524/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_5911_full -> IGTPW_2849_full
====================================================

Summary
-------

  **SUCCESS**

  No regressions found.

  External URL: https://patchwork.freedesktop.org/api/1.0/series/58524/revisions/10/mbox/

Possible new issues
-------------------

  Here are the unknown changes that may have been introduced in IGTPW_2849_full:

### IGT changes ###

#### Possible regressions ####

  * {igt@kms_plane_stress@stress-cpu-load-gpu-load-rgb565-untiled} (NEW):
    - shard-apl:          NOTRUN -> FAIL +7
    - shard-glk:          NOTRUN -> FAIL +1

  * {igt@kms_plane_stress@stress-cpu-load-gpu-load-xrgb8888-untiled} (NEW):
    - shard-hsw:          NOTRUN -> FAIL +9

  * {igt@kms_plane_stress@stress-cpu-load-gpu-load-xrgb8888-ytiled} (NEW):
    - shard-glk:          NOTRUN -> DMESG-WARN

  * {igt@kms_plane_stress@stress-mode-override-cpu-load-gpu-load-rgb565-xtiled} (NEW):
    - shard-kbl:          NOTRUN -> FAIL +9
    - shard-iclb:         NOTRUN -> WARN +2

  * {igt@kms_plane_stress@stress-mode-override-cpu-load-gpu-load-rgb565-ytiled} (NEW):
    - shard-snb:          NOTRUN -> FAIL +11

  * {igt@kms_plane_stress@stress-mode-override-cpu-load-gpu-load-xrgb2101010-xtiled} (NEW):
    - shard-apl:          NOTRUN -> TIMEOUT +1

  * {igt@kms_plane_stress@stress-mode-override-cpu-load-gpu-load-xrgb2101010-ytiled} (NEW):
    - shard-hsw:          NOTRUN -> WARN +16

  * {igt@kms_plane_stress@stress-mode-override-cpu-load-gpu-load-xrgb8888-ytiled} (NEW):
    - shard-kbl:          NOTRUN -> TIMEOUT

  * {igt@kms_plane_stress@stress-mode-override-xrgb8888-xtiled} (NEW):
    - shard-glk:          NOTRUN -> TIMEOUT +13

  
New tests
---------

  New tests have been introduced between CI_DRM_5911_full and IGTPW_2849_full:

### New IGT tests (36) ###

  * igt@kms_plane_stress@stress-cpu-load-gpu-load-rgb565-untiled:
    - Statuses : 3 fail(s) 2 pass(s) 1 skip(s)
    - Exec time: [0.27, 13.51] s

  * igt@kms_plane_stress@stress-cpu-load-gpu-load-rgb565-xtiled:
    - Statuses : 2 fail(s) 2 pass(s) 1 skip(s)
    - Exec time: [0.34, 17.56] s

  * igt@kms_plane_stress@stress-cpu-load-gpu-load-rgb565-ytiled:
    - Statuses : 3 fail(s) 2 pass(s) 1 timeout(s)
    - Exec time: [0.17, 485.07] s

  * igt@kms_plane_stress@stress-cpu-load-gpu-load-xrgb2101010-untiled:
    - Statuses : 1 dmesg-fail(s) 2 fail(s) 2 pass(s) 1 skip(s)
    - Exec time: [1.58, 84.80] s

  * igt@kms_plane_stress@stress-cpu-load-gpu-load-xrgb2101010-xtiled:
    - Statuses : 1 fail(s) 3 pass(s) 1 skip(s) 1 timeout(s)
    - Exec time: [2.33, 495.00] s

  * igt@kms_plane_stress@stress-cpu-load-gpu-load-xrgb2101010-ytiled:
    - Statuses : 2 fail(s) 3 pass(s)
    - Exec time: [0.20, 13.13] s

  * igt@kms_plane_stress@stress-cpu-load-gpu-load-xrgb8888-untiled:
    - Statuses : 2 fail(s) 2 pass(s) 1 skip(s) 1 timeout(s)
    - Exec time: [0.45, 561.34] s

  * igt@kms_plane_stress@stress-cpu-load-gpu-load-xrgb8888-xtiled:
    - Statuses : 1 fail(s) 3 pass(s) 1 skip(s) 1 timeout(s)
    - Exec time: [0.23, 367.93] s

  * igt@kms_plane_stress@stress-cpu-load-gpu-load-xrgb8888-ytiled:
    - Statuses : 1 dmesg-warn(s) 2 fail(s) 3 pass(s)
    - Exec time: [0.16, 25.77] s

  * igt@kms_plane_stress@stress-mode-override-cpu-load-gpu-load-rgb565-untiled:
    - Statuses : 2 fail(s) 1 pass(s) 1 skip(s) 1 timeout(s) 1 warn(s)
    - Exec time: [0.0, 19.41] s

  * igt@kms_plane_stress@stress-mode-override-cpu-load-gpu-load-rgb565-xtiled:
    - Statuses : 2 fail(s) 1 incomplete(s) 1 skip(s) 2 warn(s)
    - Exec time: [0.0, 3.96] s

  * igt@kms_plane_stress@stress-mode-override-cpu-load-gpu-load-rgb565-ytiled:
    - Statuses : 2 fail(s) 2 pass(s) 1 timeout(s) 1 warn(s)
    - Exec time: [0.0, 14.77] s

  * igt@kms_plane_stress@stress-mode-override-cpu-load-gpu-load-xrgb2101010-untiled:
    - Statuses : 1 dmesg-fail(s) 2 fail(s) 1 skip(s) 1 warn(s)
    - Exec time: [0.01, 88.83] s

  * igt@kms_plane_stress@stress-mode-override-cpu-load-gpu-load-xrgb2101010-xtiled:
    - Statuses : 1 dmesg-fail(s) 1 fail(s) 1 skip(s) 2 timeout(s) 1 warn(s)
    - Exec time: [0.0, 85.58] s

  * igt@kms_plane_stress@stress-mode-override-cpu-load-gpu-load-xrgb2101010-ytiled:
    - Statuses : 1 fail(s) 3 pass(s) 1 timeout(s) 1 warn(s)
    - Exec time: [0.0, 15.60] s

  * igt@kms_plane_stress@stress-mode-override-cpu-load-gpu-load-xrgb8888-untiled:
    - Statuses : 1 dmesg-fail(s) 2 fail(s) 1 incomplete(s) 1 skip(s) 1 warn(s)
    - Exec time: [0.0, 2.53] s

  * igt@kms_plane_stress@stress-mode-override-cpu-load-gpu-load-xrgb8888-xtiled:
    - Statuses : 1 dmesg-fail(s) 2 fail(s) 1 skip(s) 1 timeout(s) 1 warn(s)
    - Exec time: [0.0, 2.44] s

  * igt@kms_plane_stress@stress-mode-override-cpu-load-gpu-load-xrgb8888-ytiled:
    - Statuses : 1 fail(s) 1 incomplete(s) 2 pass(s) 1 timeout(s) 1 warn(s)
    - Exec time: [0.0, 15.31] s

  * igt@kms_plane_stress@stress-mode-override-rgb565-untiled:
    - Statuses : 4 pass(s) 1 warn(s)
    - Exec time: [0.00, 9.89] s

  * igt@kms_plane_stress@stress-mode-override-rgb565-xtiled:
    - Statuses : 4 pass(s) 1 warn(s)
    - Exec time: [0.00, 9.60] s

  * igt@kms_plane_stress@stress-mode-override-rgb565-ytiled:
    - Statuses : 1 fail(s) 3 pass(s) 1 timeout(s) 1 warn(s)
    - Exec time: [0.0, 8.54] s

  * igt@kms_plane_stress@stress-mode-override-xrgb2101010-untiled:
    - Statuses : 1 incomplete(s) 2 pass(s) 2 warn(s)
    - Exec time: [0.0, 23.27] s

  * igt@kms_plane_stress@stress-mode-override-xrgb2101010-xtiled:
    - Statuses : 1 dmesg-fail(s) 1 incomplete(s) 3 pass(s)
    - Exec time: [0.0, 46.89] s

  * igt@kms_plane_stress@stress-mode-override-xrgb2101010-ytiled:
    - Statuses : 1 fail(s) 1 incomplete(s) 2 pass(s) 2 warn(s)
    - Exec time: [0.0, 10.80] s

  * igt@kms_plane_stress@stress-mode-override-xrgb8888-untiled:
    - Statuses : 1 dmesg-fail(s) 3 pass(s) 1 warn(s)
    - Exec time: [0.00, 8.36] s

  * igt@kms_plane_stress@stress-mode-override-xrgb8888-xtiled:
    - Statuses : 1 dmesg-fail(s) 3 pass(s) 1 timeout(s) 1 warn(s)
    - Exec time: [0.00, 703.99] s

  * igt@kms_plane_stress@stress-mode-override-xrgb8888-ytiled:
    - Statuses : 1 fail(s) 2 pass(s) 1 timeout(s) 1 warn(s)
    - Exec time: [0.0, 8.17] s

  * igt@kms_plane_stress@stress-rgb565-untiled:
    - Statuses : 5 pass(s)
    - Exec time: [5.07, 11.56] s

  * igt@kms_plane_stress@stress-rgb565-xtiled:
    - Statuses : 6 pass(s)
    - Exec time: [5.02, 12.71] s

  * igt@kms_plane_stress@stress-rgb565-ytiled:
    - Statuses : 1 dmesg-warn(s) 2 fail(s) 3 pass(s)
    - Exec time: [0.09, 9.56] s

  * igt@kms_plane_stress@stress-xrgb2101010-untiled:
    - Statuses : 1 dmesg-warn(s) 5 pass(s)
    - Exec time: [5.15, 34.36] s

  * igt@kms_plane_stress@stress-xrgb2101010-xtiled:
    - Statuses : 4 pass(s) 2 timeout(s)
    - Exec time: [5.17, 949.15] s

  * igt@kms_plane_stress@stress-xrgb2101010-ytiled:
    - Statuses : 2 fail(s) 3 pass(s) 1 timeout(s)
    - Exec time: [0.14, 364.68] s

  * igt@kms_plane_stress@stress-xrgb8888-untiled:
    - Statuses : 1 dmesg-fail(s) 5 pass(s)
    - Exec time: [2.03, 11.19] s

  * igt@kms_plane_stress@stress-xrgb8888-xtiled:
    - Statuses : 1 dmesg-fail(s) 5 pass(s)
    - Exec time: [2.37, 11.14] s

  * igt@kms_plane_stress@stress-xrgb8888-ytiled:
    - Statuses : 2 fail(s) 1 pass(s)
    - Exec time: [0.02, 5.15] s

  

Known issues
------------

  Here are the changes found in IGTPW_2849_full that come from known issues:

### IGT changes ###

#### Issues hit ####

  * igt@gem_bad_reloc@negative-reloc-bsd2:
    - shard-iclb:         NOTRUN -> SKIP [fdo#109276] +8

  * igt@gem_mocs_settings@mocs-rc6-render:
    - shard-snb:          NOTRUN -> SKIP [fdo#109271] +47

  * igt@gem_mocs_settings@mocs-reset-dirty-render:
    - shard-iclb:         NOTRUN -> SKIP [fdo#110206]

  * igt@gem_pwrite@huge-gtt-random:
    - shard-iclb:         NOTRUN -> SKIP [fdo#109290] +1

  * igt@gem_stolen@stolen-pread:
    - shard-iclb:         NOTRUN -> SKIP [fdo#109277] +1

  * igt@i915_pm_lpsp@screens-disabled:
    - shard-iclb:         NOTRUN -> SKIP [fdo#109301]

  * igt@i915_pm_rc6_residency@rc6-accuracy:
    - shard-snb:          PASS -> SKIP [fdo#109271]

  * igt@i915_suspend@debugfs-reader:
    - shard-kbl:          PASS -> DMESG-WARN [fdo#108566] +5

  * igt@i915_suspend@sysfs-reader:
    - shard-apl:          NOTRUN -> DMESG-WARN [fdo#108566]

  * igt@kms_atomic_transition@5x-modeset-transitions-nonblocking-fencing:
    - shard-hsw:          NOTRUN -> SKIP [fdo#109271] / [fdo#109278] +2

  * igt@kms_atomic_transition@6x-modeset-transitions-nonblocking:
    - shard-apl:          NOTRUN -> SKIP [fdo#109271] / [fdo#109278] +7

  * igt@kms_atomic_transition@6x-modeset-transitions-nonblocking-fencing:
    - shard-glk:          NOTRUN -> SKIP [fdo#109271] / [fdo#109278] +1

  * igt@kms_available_modes_crc@available_mode_test_crc:
    - shard-iclb:         NOTRUN -> FAIL [fdo#106641]

  * igt@kms_busy@extended-modeset-hang-oldfb-render-d:
    - shard-kbl:          NOTRUN -> SKIP [fdo#109271] / [fdo#109278]

  * igt@kms_busy@extended-pageflip-hang-oldfb-render-e:
    - shard-iclb:         NOTRUN -> SKIP [fdo#109278] +1

  * igt@kms_busy@extended-pageflip-modeset-hang-oldfb-render-c:
    - shard-snb:          NOTRUN -> SKIP [fdo#109271] / [fdo#109278] +3

  * igt@kms_chamelium@dp-crc-fast:
    - shard-apl:          NOTRUN -> SKIP [fdo#109271] +92

  * igt@kms_chamelium@hdmi-cmp-yu12:
    - shard-iclb:         NOTRUN -> SKIP [fdo#109284]

  * igt@kms_content_protection@legacy:
    - shard-apl:          NOTRUN -> FAIL [fdo#110321] / [fdo#110336]

  * igt@kms_cursor_crc@cursor-256x85-onscreen:
    - shard-apl:          PASS -> FAIL [fdo#103232] +1

  * igt@kms_cursor_crc@cursor-512x170-random:
    - shard-iclb:         NOTRUN -> SKIP [fdo#109279] +1

  * igt@kms_cursor_crc@cursor-64x21-onscreen:
    - shard-kbl:          PASS -> FAIL [fdo#103232] +1

  * igt@kms_cursor_legacy@2x-long-cursor-vs-flip-legacy:
    - shard-hsw:          PASS -> FAIL [fdo#105767]

  * igt@kms_cursor_legacy@cursora-vs-flipb-varying-size:
    - shard-iclb:         NOTRUN -> SKIP [fdo#109274] +2

  * igt@kms_dp_dsc@basic-dsc-enable-edp:
    - shard-iclb:         PASS -> SKIP [fdo#109349]

  * igt@kms_fbcon_fbt@psr:
    - shard-iclb:         NOTRUN -> FAIL [fdo#103833]

  * igt@kms_frontbuffer_tracking@fbcpsr-1p-offscren-pri-indfb-draw-mmap-wc:
    - shard-iclb:         NOTRUN -> FAIL [fdo#109247] +2

  * igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-cur-indfb-draw-pwrite:
    - shard-iclb:         PASS -> FAIL [fdo#103167] +3

  * igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-pri-indfb-draw-blt:
    - shard-iclb:         PASS -> FAIL [fdo#109247] +8

  * igt@kms_frontbuffer_tracking@fbcpsr-2p-primscrn-pri-shrfb-draw-pwrite:
    - shard-iclb:         NOTRUN -> SKIP [fdo#109280] +8

  * igt@kms_frontbuffer_tracking@fbcpsr-farfromfence:
    - shard-glk:          NOTRUN -> SKIP [fdo#109271] +9

  * igt@kms_lease@atomic_implicit_crtc:
    - shard-snb:          NOTRUN -> FAIL [fdo#110279]

  * igt@kms_lease@setcrtc_implicit_plane:
    - shard-apl:          NOTRUN -> FAIL [fdo#110281]

  * igt@kms_pipe_crc_basic@suspend-read-crc-pipe-a:
    - shard-apl:          PASS -> DMESG-WARN [fdo#108566]

  * igt@kms_plane@pixel-format-pipe-c-planes:
    - shard-glk:          PASS -> SKIP [fdo#109271]

  * igt@kms_plane_alpha_blend@pipe-a-alpha-opaque-fb:
    - shard-glk:          NOTRUN -> FAIL [fdo#108145]

  * igt@kms_plane_alpha_blend@pipe-b-alpha-basic:
    - shard-apl:          NOTRUN -> FAIL [fdo#108145] +2

  * igt@kms_plane_alpha_blend@pipe-c-alpha-opaque-fb:
    - shard-kbl:          NOTRUN -> FAIL [fdo#108145]

  * igt@kms_plane_lowres@pipe-a-tiling-y:
    - shard-iclb:         PASS -> FAIL [fdo#103166]

  * igt@kms_plane_lowres@pipe-a-tiling-yf:
    - shard-hsw:          NOTRUN -> SKIP [fdo#109271] +21

  * igt@kms_plane_scaling@pipe-a-scaler-with-pixel-format:
    - shard-glk:          PASS -> SKIP [fdo#109271] / [fdo#109278]

  * {igt@kms_plane_stress@stress-cpu-load-gpu-load-xrgb2101010-untiled} (NEW):
    - shard-glk:          NOTRUN -> DMESG-FAIL [fdo#105763] / [fdo#106538] +2

  * {igt@kms_plane_stress@stress-mode-override-cpu-load-gpu-load-xrgb8888-untiled} (NEW):
    - shard-iclb:         NOTRUN -> DMESG-FAIL [fdo#107724] +6

  * {igt@kms_plane_stress@stress-mode-override-xrgb2101010-ytiled} (NEW):
    - shard-glk:          NOTRUN -> INCOMPLETE [fdo#103359] / [k.org#198133] +5

  * {igt@kms_plane_stress@stress-rgb565-ytiled} (NEW):
    - shard-kbl:          NOTRUN -> DMESG-WARN [fdo#105604] / [fdo#105763]

  * {igt@kms_plane_stress@stress-xrgb2101010-untiled} (NEW):
    - shard-glk:          NOTRUN -> DMESG-WARN [fdo#105763] / [fdo#106538]

  * igt@kms_psr@cursor_plane_onoff:
    - shard-kbl:          NOTRUN -> SKIP [fdo#109271] +21

  * igt@kms_psr@primary_render:
    - shard-iclb:         PASS -> FAIL [fdo#107383] / [fdo#110215] +1

  * igt@kms_psr@psr2_dpms:
    - shard-iclb:         NOTRUN -> SKIP [fdo#109441]

  * igt@kms_psr@psr2_sprite_plane_move:
    - shard-iclb:         PASS -> SKIP [fdo#109441] +3

  * igt@kms_rotation_crc@multiplane-rotation-cropping-top:
    - shard-kbl:          PASS -> FAIL [fdo#109016]

  * igt@kms_setmode@basic:
    - shard-kbl:          PASS -> FAIL [fdo#99912]
    - shard-snb:          NOTRUN -> FAIL [fdo#99912]

  * igt@kms_vblank@pipe-a-ts-continuation-idle-hang:
    - shard-glk:          PASS -> INCOMPLETE [fdo#103359] / [k.org#198133] +1

  * igt@kms_vblank@pipe-b-ts-continuation-suspend:
    - shard-kbl:          PASS -> INCOMPLETE [fdo#103665]

  * igt@prime_nv_test@nv_write_i915_cpu_mmap_read:
    - shard-iclb:         NOTRUN -> SKIP [fdo#109291]

  * igt@v3d_get_bo_offset@create-get-offsets:
    - shard-iclb:         NOTRUN -> SKIP [fdo#109315]

  
#### Possible fixes ####

  * igt@gem_eio@in-flight-suspend:
    - shard-apl:          DMESG-WARN [fdo#108566] -> PASS +2

  * igt@gem_ppgtt@blt-vs-render-ctxn:
    - shard-hsw:          INCOMPLETE [fdo#103540] -> PASS

  * igt@gem_tiled_swapping@non-threaded:
    - shard-iclb:         FAIL [fdo#108686] -> PASS

  * igt@i915_selftest@live_workarounds:
    - shard-iclb:         DMESG-FAIL [fdo#108954] -> PASS

  * igt@kms_frontbuffer_tracking@fbc-rgb565-draw-blt:
    - shard-iclb:         FAIL [fdo#103167] -> PASS +4

  * igt@kms_frontbuffer_tracking@fbcpsr-1p-offscren-pri-indfb-draw-pwrite:
    - shard-iclb:         FAIL [fdo#109247] -> PASS +13

  * igt@kms_plane@pixel-format-pipe-a-planes-source-clamping:
    - shard-glk:          SKIP [fdo#109271] -> PASS

  * igt@kms_psr@cursor_mmap_gtt:
    - shard-iclb:         FAIL [fdo#107383] / [fdo#110215] -> PASS +3

  * igt@kms_psr@psr2_primary_mmap_gtt:
    - shard-iclb:         SKIP [fdo#109441] -> PASS +3

  * igt@kms_rotation_crc@primary-yf-tiled-reflect-x-0:
    - shard-iclb:         INCOMPLETE [fdo#110026] / [fdo#110040 ] -> PASS

  * igt@kms_universal_plane@universal-plane-pipe-b-functional:
    - shard-glk:          FAIL [fdo#110037] -> PASS
    - shard-kbl:          FAIL [fdo#110037] -> PASS

  
#### Warnings ####

  * igt@i915_selftest@live_contexts:
    - shard-iclb:         INCOMPLETE [fdo#108569] -> DMESG-FAIL [fdo#108569]

  
  {name}: This element is suppressed. This means it is ignored when computing
          the status of the difference (SUCCESS, WARNING, or FAILURE).

  [fdo#103166]: https://bugs.freedesktop.org/show_bug.cgi?id=103166
  [fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
  [fdo#103232]: https://bugs.freedesktop.org/show_bug.cgi?id=103232
  [fdo#103359]: https://bugs.freedesktop.org/show_bug.cgi?id=103359
  [fdo#103540]: https://bugs.freedesktop.org/show_bug.cgi?id=103540
  [fdo#103665]: https://bugs.freedesktop.org/show_bug.cgi?id=103665
  [fdo#103833]: https://bugs.freedesktop.org/show_bug.cgi?id=103833
  [fdo#105604]: https://bugs.freedesktop.org/show_bug.cgi?id=105604
  [fdo#105763]: https://bugs.freedesktop.org/show_bug.cgi?id=105763
  [fdo#105767]: https://bugs.freedesktop.org/show_bug.cgi?id=105767
  [fdo#106538]: https://bugs.freedesktop.org/show_bug.cgi?id=106538
  [fdo#106641]: https://bugs.freedesktop.org/show_bug.cgi?id=106641
  [fdo#107383]: https://bugs.freedesktop.org/show_bug.cgi?id=107383
  [fdo#107724]: https://bugs.freedesktop.org/show_bug.cgi?id=107724
  [fdo#108145]: https://bugs.freedesktop.org/show_bug.cgi?id=108145
  [fdo#108566]: https://bugs.freedesktop.org/show_bug.cgi?id=108566
  [fdo#108569]: https://bugs.freedesktop.org/show_bug.cgi?id=108569
  [fdo#108686]: https://bugs.freedesktop.org/show_bug.cgi?id=108686
  [fdo#108954]: https://bugs.freedesktop.org/show_bug.cgi?id=108954
  [fdo#109016]: https://bugs.freedesktop.org/show_bug.cgi?id=109016
  [fdo#109247]: https://bugs.freedesktop.org/show_bug.cgi?id=109247
  [fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
  [fdo#109274]: https://bugs.freedesktop.org/show_bug.cgi?id=109274
  [fdo#109276]: https://bugs.freedesktop.org/show_bug.cgi?id=109276
  [fdo#109277]: https://bugs.freedesktop.org/show_bug.cgi?id=109277
  [fdo#109278]: https://bugs.freedesktop.org/show_bug.cgi?id=109278
  [fdo#109279]: https://bugs.freedesktop.org/show_bug.cgi?id=109279
  [fdo#109280]: https://bugs.freedesktop.org/show_bug.cgi?id=109280
  [fdo#109284]: https://bugs.freedesktop.org/show_bug.cgi?id=109284
  [fdo#109290]: https://bugs.freedesktop.org/show_bug.cgi?id=109290
  [fdo#109291]: https://bugs.freedesktop.org/show_bug.cgi?id=109291
  [fdo#109301]: https://bugs.freedesktop.org/show_bug.cgi?id=109301
  [fdo#109315]: https://bugs.freedesktop.org/show_bug.cgi?id=109315
  [fdo#109349]: https://bugs.freedesktop.org/show_bug.cgi?id=109349
  [fdo#109441]: https://bugs.freedesktop.org/show_bug.cgi?id=109441
  [fdo#110026]: https://bugs.freedesktop.org/show_bug.cgi?id=110026
  [fdo#110037]: https://bugs.freedesktop.org/show_bug.cgi?id=110037
  [fdo#110040 ]: https://bugs.freedesktop.org/show_bug.cgi?id=110040 
  [fdo#110206]: https://bugs.freedesktop.org/show_bug.cgi?id=110206
  [fdo#110215]: https://bugs.freedesktop.org/show_bug.cgi?id=110215
  [fdo#110279]: https://bugs.freedesktop.org/show_bug.cgi?id=110279
  [fdo#110281]: https://bugs.freedesktop.org/show_bug.cgi?id=110281
  [fdo#110321]: https://bugs.freedesktop.org/show_bug.cgi?id=110321
  [fdo#110336]: https://bugs.freedesktop.org/show_bug.cgi?id=110336
  [fdo#99912]: https://bugs.freedesktop.org/show_bug.cgi?id=99912
  [k.org#198133]: https://bugzilla.kernel.org/show_bug.cgi?id=198133


Participating hosts (10 -> 6)
------------------------------

  Missing    (4): pig-skl-6260u shard-skl pig-hsw-4770r pig-glk-j5005 


Build changes
-------------

    * IGT: IGT_4943 -> IGTPW_2849
    * Piglit: piglit_4509 -> None

  CI_DRM_5911: b11c9dc17f8b821e3f1ffc3df17f401c12a22669 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_2849: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2849/
  IGT_4943: 5941f371b0fe25084d4b1c49882faa8d41d44c9f @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
  piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2849/
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [igt-dev] [PATCH i-g-t v8] igt/tests: kms_plane_stress: Add plane stress test
@ 2019-04-11  9:40 Stanislav Lisovskiy
  0 siblings, 0 replies; 4+ messages in thread
From: Stanislav Lisovskiy @ 2019-04-11  9:40 UTC (permalink / raw)
  To: igt-dev
  Cc: stanislav.lisovskiy, ville.syrjala, martin.peres, juha-pekka.heikkila

This test attempts to utilize all connected
outputs at the same time, using maximum possible
resolution and amount of planes, to check whether
we are hiting any kind of bandwidth, watermark or
other limitations.

v2: Added cpu and gpu load threads, which consume
    additional bandwidth.

v3: Removed binary picture file, using pattern fb
    instead.

v4: Moved FB creation/removal to better place.

v5: Fixed rebase conflict and changed "fb->tiling"
    to "fb->modifier".

v6: Removed unnecessary new macro for iterating on
    pipes. Taken into use igt_gettime instead of
    clock_gettime.

v7: Put fb reinit into igt_fixture to avoid problems.
    Move stress function under igt_subtest. Release planes,
    remove redundant commit, assert if no planes can be used.

v8: - Add blitting also, to have more fun
    - Now using separate framebuffer per each plane.
    - Fixed magic number for bpp value(now based on format)
    - Some optimizations, like not applying same mode if it
      hasn't change, also don't do highest mode search on
      each iteration, just calculate once and use it.
    - Some code refactoring: extracted some lengthy code
      to separate functions.

Signed-off-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
---
 tests/Makefile.sources   |   1 +
 tests/kms_plane_stress.c | 676 +++++++++++++++++++++++++++++++++++++++
 tests/meson.build        |   1 +
 3 files changed, 678 insertions(+)
 create mode 100644 tests/kms_plane_stress.c

diff --git a/tests/Makefile.sources b/tests/Makefile.sources
index 71ccf00a..9d04d888 100644
--- a/tests/Makefile.sources
+++ b/tests/Makefile.sources
@@ -59,6 +59,7 @@ TESTS_progs = \
 	kms_plane_lowres \
 	kms_plane_multiple \
 	kms_plane_scaling \
+	kms_plane_stress \
 	kms_prop_blob \
 	kms_properties \
 	kms_psr \
diff --git a/tests/kms_plane_stress.c b/tests/kms_plane_stress.c
new file mode 100644
index 00000000..55d22da0
--- /dev/null
+++ b/tests/kms_plane_stress.c
@@ -0,0 +1,676 @@
+ /*
+ * Copyright © 2019 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#include "igt.h"
+#include "igt_rand.h"
+#include "drmtest.h"
+#include "sw_sync.h"
+#include <errno.h>
+#include <pthread.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <string.h>
+#include <time.h>
+#include <poll.h>
+#include <pthread.h>
+
+#ifndef DRM_CAP_CURSOR_WIDTH
+#define DRM_CAP_CURSOR_WIDTH 0x8
+#endif
+#ifndef DRM_CAP_CURSOR_HEIGHT
+#define DRM_CAP_CURSOR_HEIGHT 0x9
+#endif
+
+
+drmModeModeInfo uhd_mode_60hz = {
+	.name = "3840x2160@60hz",
+	.vrefresh = 60,
+	.clock = 142667*2,
+	.hdisplay = 3840,
+	.hsync_start = 1936*2,
+	.hsync_end = 1952*2,
+	.htotal = 2104*2,
+	.vdisplay = 2160,
+	.vsync_start = 1083*2,
+	.vsync_end = 1097*2,
+	.vtotal = 1128*2,
+	.flags = 0xa,
+};
+
+#define N_FORMATS 3
+static const uint32_t formats[N_FORMATS] = {
+	DRM_FORMAT_XRGB8888,
+	DRM_FORMAT_RGB565,
+	DRM_FORMAT_XRGB2101010,
+};
+
+#define N_TILING_METHODS 3
+static const uint64_t tilings[N_TILING_METHODS] = {
+	DRM_FORMAT_MOD_LINEAR,
+	I915_FORMAT_MOD_X_TILED,
+	I915_FORMAT_MOD_Y_TILED,
+};
+
+static const char *format_str(int format_index)
+{
+	switch (formats[format_index]) {
+	case DRM_FORMAT_RGB565:
+		return "rgb565";
+	case DRM_FORMAT_XRGB8888:
+		return "xrgb8888";
+	case DRM_FORMAT_XRGB2101010:
+		return "xrgb2101010";
+	default:
+		igt_assert(false);
+	}
+}
+
+static const char *tiling_str(int tiling_index)
+{
+	switch (tilings[tiling_index]) {
+	case DRM_FORMAT_MOD_LINEAR:
+		return "untiled";
+	case I915_FORMAT_MOD_X_TILED:
+		return "xtiled";
+	case I915_FORMAT_MOD_Y_TILED:
+		return "ytiled";
+	default:
+		igt_assert(false);
+	}
+}
+
+
+#define MAX_CORES 8
+#define MAX_PLANES 16
+
+struct data;
+
+struct thread_context {
+	struct data *data;
+	int id;
+	void *buf1;
+	void *buf2;
+};
+
+struct rect {
+	int x;
+	int y;
+	int w;
+	int h;
+};
+
+struct gpu_context {
+	struct data *data;
+	int pipe;
+	int color;
+	struct rect blt_rect;
+};
+
+struct data {
+	int drm_fd;
+	igt_display_t display;
+	int num_planes[IGT_MAX_PIPES];
+	uint32_t format;
+	uint64_t modifier;
+	uint32_t devid;
+	drm_intel_bufmgr *bufmgr;
+	drmModeModeInfo *last_mode[IGT_MAX_PIPES];
+	struct igt_fb fb[IGT_MAX_PIPES * MAX_PLANES];
+	struct igt_fb cursor_fb[IGT_MAX_PIPES];
+	pthread_t cpu_thread[MAX_CORES];
+	bool cpu_thread_stop[MAX_CORES];
+	struct thread_context cpu_context[MAX_CORES];
+	struct gpu_context gpu_context[IGT_MAX_PIPES];
+};
+
+
+struct base_crc {
+	bool set;
+	igt_crc_t crc;
+};
+
+igt_pipe_crc_t *pipe_crc;
+
+#define BUF_SIZE 128*1024*1024
+
+static void *cpu_load(void *d)
+{
+	char *buf1, *buf2;
+	struct thread_context *context = (struct thread_context *)d;
+	struct data *data = context->data;
+
+	buf1 = context->buf1;
+	buf2 = context->buf2;
+
+	data->cpu_thread_stop[context->id] = false;
+
+	while(!data->cpu_thread_stop[context->id]) {
+		memcpy(buf1, buf2, BUF_SIZE);
+		memcpy(buf2, buf1, BUF_SIZE);
+	}
+
+	return NULL;
+}
+
+
+static void scratch_buf_init(struct igt_buf *buf,
+			drm_intel_bo *bo, int width, int height, int stride, int tiling, int bpp)
+{
+	buf->bo = bo;
+	buf->stride = stride;
+	buf->tiling = tiling;
+	buf->size = width * height * bpp / 8;
+	buf->bpp = bpp;
+}
+
+
+static void gpu_load(struct gpu_context *gpu_context, int plane_index)
+{
+	struct intel_batchbuffer *batch = NULL;
+	struct igt_buf dst;
+	struct data *data = gpu_context->data;
+	int pipe = gpu_context->pipe;
+	igt_fillfunc_t gpgpu_fill = NULL;
+	drm_intel_bo *bo;
+	struct igt_fb *fb = &data->fb[pipe * MAX_PLANES + plane_index];
+	int rect_divisor;
+	int rect_width;
+	int rect_height;
+	int frame_width = fb->width;
+	int frame_height = fb->height / 2;
+	int bytes_per_pixel = fb->plane_bpp[0] / 8;
+
+	if (!data->devid) {
+		data->devid = intel_get_drm_devid(data->drm_fd);
+		igt_require_gem(data->drm_fd);
+
+		data->bufmgr = drm_intel_bufmgr_gem_init(data->drm_fd, 4096);
+		igt_assert(data->bufmgr);
+	}
+
+	gpgpu_fill = igt_get_gpgpu_fillfunc(data->devid);
+
+	igt_require_f(gpgpu_fill,
+	      "no gpgpu-fill function\n");
+
+	batch = intel_batchbuffer_alloc(data->bufmgr, data->devid);
+	igt_assert(batch);
+
+	bo = gem_handle_to_libdrm_bo(data->bufmgr, data->drm_fd, "", fb->gem_handle);
+
+	scratch_buf_init(&dst, bo, frame_width, frame_height, fb->strides[0], fb->modifier, fb->plane_bpp[0]);
+
+	gpgpu_fill(batch,
+	   &dst, 0, 0, (frame_width * bytes_per_pixel), frame_height,
+	   gpu_context->color);
+
+	gpu_context->color += 0x10;
+
+	intel_batchbuffer_flush(batch);
+	intel_batchbuffer_free(batch);
+	drm_intel_bo_unreference(bo);
+
+	/* divide at least by 2 and up to 8 */
+	rect_divisor = 1 << (hars_petruska_f54_1_random_unsafe_max(3) + 1);
+
+	rect_width = frame_width / rect_divisor;
+	rect_height = frame_height / rect_divisor;
+
+	gpu_context->blt_rect.x = (gpu_context->blt_rect.x + rect_width) % (frame_width - rect_width);
+	gpu_context->blt_rect.y = (gpu_context->blt_rect.y + rect_height) % (frame_height - rect_height);
+
+	igt_draw_rect(data->drm_fd, data->bufmgr, NULL,
+		   fb->gem_handle, frame_width * frame_height * bytes_per_pixel, fb->width * bytes_per_pixel,
+		   IGT_DRAW_BLT, gpu_context->blt_rect.x, gpu_context->blt_rect.y,
+		   rect_width, rect_height, 0xff, fb->plane_bpp[0]);
+}
+
+static inline uint32_t pipe_select(enum pipe pipe)
+{
+	if (pipe > 1)
+		return pipe << DRM_VBLANK_HIGH_CRTC_SHIFT;
+	else if (pipe > 0)
+		return DRM_VBLANK_SECONDARY;
+	else
+		return 0;
+}
+
+static unsigned get_vblank(int fd, enum pipe pipe, unsigned flags)
+{
+	union drm_wait_vblank vbl;
+
+	memset(&vbl, 0, sizeof(vbl));
+	vbl.request.type = DRM_VBLANK_RELATIVE | pipe_select(pipe) | flags;
+	if (drmIoctl(fd, DRM_IOCTL_WAIT_VBLANK, &vbl))
+		return 0;
+
+	return vbl.reply.sequence;
+}
+
+
+static int plane_stress(struct data *data, igt_output_t *output, enum pipe pipe, drmModeModeInfo *mode, bool gpu)
+{
+	igt_plane_t *plane;
+	uint64_t cursor_width, cursor_height;
+	int i;
+	int ret;
+	igt_crc_t crc, crc2;
+	bool new_mode = false;
+
+	if (data->last_mode[pipe] != mode) {
+		igt_output_override_mode(output, mode);
+		igt_output_set_pipe(output, pipe);
+
+		ret = igt_display_try_commit_atomic(&data->display,
+				DRM_MODE_ATOMIC_TEST_ONLY | DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);
+		if (ret) {
+			igt_warn("Could not commit mode: \n");
+			kmstest_dump_mode(mode);
+			return ret;
+		}
+
+		igt_display_commit2(&data->display, COMMIT_ATOMIC);
+		data->last_mode[pipe] = mode;
+		new_mode = true;
+	}
+
+	/*
+	 * Looks like we can't have planes on that pipe at all
+	 */
+	if (!data->num_planes[pipe])
+		return 0;
+
+	mode = igt_output_get_mode(output);
+
+	do_or_die(drmGetCap(data->drm_fd, DRM_CAP_CURSOR_WIDTH, &cursor_width));
+	do_or_die(drmGetCap(data->drm_fd, DRM_CAP_CURSOR_HEIGHT, &cursor_height));
+
+	if (!data->cursor_fb[pipe * MAX_PLANES].fb_id) {
+		igt_create_color_fb(data->drm_fd, cursor_width, cursor_height,
+				DRM_FORMAT_ARGB8888,
+				LOCAL_DRM_FORMAT_MOD_NONE,
+					1.0,0.0,0.0,
+					&data->cursor_fb[pipe]);
+	}
+
+
+	for (i = 0;i < data->num_planes[pipe];i++) {
+		if (!data->fb[pipe * MAX_PLANES + i].fb_id) {
+			igt_create_color_pattern_fb(data->drm_fd, mode->hdisplay, mode->vdisplay,
+			    data->format,
+			    data->modifier,
+			    0.0, 1.0, 0.0, &data->fb[pipe * MAX_PLANES + i]);
+		}
+	}
+
+	if (new_mode) {
+		i = 0;
+		for_each_plane_on_pipe(&data->display, pipe, plane) {
+			int plane_width, plane_height;
+			if (plane->type == DRM_PLANE_TYPE_CURSOR) {
+				igt_plane_set_fb(plane, &data->cursor_fb[pipe]);
+				igt_fb_set_size(&data->cursor_fb[pipe], plane, cursor_width, cursor_height);
+				igt_plane_set_size(plane, cursor_width, cursor_height);
+				plane_width = cursor_width;
+				plane_height = cursor_height;
+			} else {
+				igt_plane_set_fb(plane, &data->fb[pipe * MAX_PLANES + i]);
+				igt_plane_set_position(plane, 0, 0);
+				igt_fb_set_size(&data->fb[pipe * MAX_PLANES + i], plane, mode->hdisplay, mode->vdisplay);
+				igt_plane_set_size(plane, mode->hdisplay, mode->vdisplay);
+				plane_width = mode->hdisplay;
+				plane_height = mode->vdisplay;
+			}
+
+			ret = igt_display_try_commit_atomic(&data->display, DRM_MODE_ATOMIC_TEST_ONLY | DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);
+			while (ret) {
+				if (plane_width <= cursor_width || plane_height <= cursor_height)
+					break;
+				plane_width /= 2;
+				plane_height /= 2;
+				igt_plane_set_size(plane, plane_width, plane_height);
+				igt_info("Reduced plane %d size to %dx%d\n", plane->index, plane_width, plane_height);
+				ret = igt_display_try_commit_atomic(&data->display, DRM_MODE_ATOMIC_TEST_ONLY | DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);
+			}
+			if (ret) {
+				igt_info("Plane %d pipe %d try commit failed, exiting\n", i, pipe);
+				data->num_planes[pipe] = i;
+				/*
+				 * We have now determined max amount of full sized planes, we will just
+				 * keep it in mind and be smarter next time. Also lets remove unneeded fbs.
+				 */
+				igt_plane_set_fb(plane, NULL);
+				while (i < MAX_PLANES) {
+					igt_remove_fb(data->display.drm_fd, &data->fb[pipe * MAX_PLANES + i]);
+					data->fb[pipe * MAX_PLANES + i].fb_id = 0;
+					i++;
+				}
+				i = data->num_planes[pipe];
+			}
+
+			if (++i >= data->num_planes[pipe])
+				break;
+		}
+
+		igt_display_commit2(&data->display, COMMIT_ATOMIC);
+	}
+
+	for (i = 0; i < data->num_planes[pipe]; i++) {
+		if (gpu) {
+			gpu_load(&data->gpu_context[pipe], i);
+		}
+	}
+
+	get_vblank(data->display.drm_fd, pipe, DRM_VBLANK_NEXTONMISS);
+
+	igt_pipe_crc_collect_crc(pipe_crc, &crc);
+
+	get_vblank(data->display.drm_fd, pipe, DRM_VBLANK_NEXTONMISS);
+
+	igt_pipe_crc_collect_crc(pipe_crc, &crc2);
+	igt_assert_crc_equal(&crc, &crc2);
+
+	return 0;
+}
+
+
+static drmModeModeInfo * find_highest_mode(drmModeConnector *connector)
+{
+	drmModeModeInfo *highest_mode = NULL;
+	int j;
+
+	for (j = 0; j < connector->count_modes; j++) {
+		if (!highest_mode) {
+			highest_mode = &connector->modes[j];
+		}
+		else if (connector->modes[j].vdisplay && connector->modes[j].hdisplay) {
+			if (highest_mode->hdisplay < connector->modes[j].hdisplay)
+				highest_mode = &connector->modes[j];
+			}
+	}
+
+	return highest_mode;
+}
+
+typedef drmModeConnector * drmModeConnectorPtr;
+
+static void fill_connector_to_pipe_array(struct data *data, drmModeRes *mode_resources, drmModeConnectorPtr *connectors)
+{
+	int pipe = 0, crtc_id;
+	igt_output_t *output;
+	int i;
+
+	memset(connectors, 0, sizeof(drmModeConnectorPtr) * IGT_MAX_PIPES);
+
+	for_each_connected_output(&data->display, output) {
+		crtc_id = 0;
+		for (i = 0; i < mode_resources->count_connectors; i++) {
+			drmModeConnector *connector;
+
+			connector = drmModeGetConnectorCurrent(data->drm_fd,
+				       mode_resources->connectors[i]);
+
+			if (!connector) {
+				igt_warn("could not get connector %i: %s\n",
+					mode_resources->connectors[i], strerror(errno));
+				continue;
+			}
+
+			if (connector->connection == DRM_MODE_CONNECTED) {
+				if (crtc_id == pipe) {
+					connectors[pipe] = (drmModeConnectorPtr)connector;
+				}
+				crtc_id++;
+			}
+			else
+				drmModeFreeConnector(connector);
+		}
+		if ((++pipe) == IGT_MAX_PIPES)
+			break;
+	}
+}
+
+static void release_connectors(drmModeConnectorPtr *connectors)
+{
+	int i;
+	for (i = 0; i < IGT_MAX_PIPES; i++) {
+		if (connectors[i])
+			drmModeFreeConnector(connectors[i]);
+	}
+}
+
+#define MIN_DURATION_SEC 5.00
+#define MIN_ITERATIONS 20
+
+static void stress(struct data *data, bool override, bool gpu, int format_idx, int tiling_idx)
+{
+	struct timespec start, end;
+	igt_output_t *output;
+	int ret;
+	int pipe;
+	int iterations = 0;
+	bool need_continue;
+	drmModeModeInfo *highest_mode[IGT_MAX_PIPES];
+	drmModeConnectorPtr connectors[IGT_MAX_PIPES];
+	drmModeRes *mode_resources = drmModeGetResources(data->drm_fd);
+
+	if (!mode_resources) {
+		igt_warn("drmModeGetResources failed: %s\n", strerror(errno));
+		return;
+	}
+
+	memset(highest_mode, 0, sizeof(drmModeModeInfo *) * IGT_MAX_PIPES);
+
+	fill_connector_to_pipe_array(data, mode_resources, connectors);
+
+	igt_gettime(&start);
+
+	do {
+		/*
+		 * Increment pipe only for connected outputs,
+		 * for each connected output we should assign a
+		 * different pipe.
+		 */
+		pipe = 0;
+		for_each_connected_output(&data->display, output) {
+			drmModeConnector *connector = (drmModeConnector *)connectors[pipe];
+
+			if (!highest_mode[pipe]) {
+				if (!override && connector->count_modes) {
+					highest_mode[pipe] = find_highest_mode(connector);
+				}
+				else
+					highest_mode[pipe] = &uhd_mode_60hz;
+			}
+
+			data->format = formats[format_idx];
+			data->modifier = tilings[tiling_idx];
+
+			/*
+			 * Until we figure out maximum amount of planes,
+			 * use the one declared by kernel.
+			 */
+			if (data->num_planes[pipe] == -1)
+				data->num_planes[pipe] = data->display.pipes[pipe].n_planes;
+
+			igt_assert_f(data->display.pipes[pipe].n_planes < MAX_PLANES,
+				"Currently we don't support more than %d planes!", MAX_PLANES);
+
+			igt_info("Pipe %s %d planes, using mode:", kmstest_pipe_name(pipe),
+					data->num_planes[pipe]);
+
+			kmstest_dump_mode(highest_mode[pipe]);
+
+			pipe_crc = igt_pipe_crc_new(data->drm_fd, pipe,
+				INTEL_PIPE_CRC_SOURCE_AUTO);
+
+			ret = plane_stress(data, output, pipe, highest_mode[pipe], gpu);
+
+			igt_pipe_crc_free(pipe_crc);
+
+			if (++pipe == IGT_MAX_PIPES)
+				break;
+		}
+		igt_gettime(&end);
+		iterations++;
+		need_continue = igt_time_elapsed(&start, &end) < MIN_DURATION_SEC || iterations < MIN_ITERATIONS;
+	} while (need_continue && !ret);
+
+	release_connectors(connectors);
+
+	drmModeFreeResources(mode_resources);
+}
+
+
+static void test(struct data *data, bool override, bool cpu, bool gpu)
+{
+	int i, j;
+	int number_of_cores = min(sysconf(_SC_NPROCESSORS_ONLN), MAX_CORES);
+	int format_idx, tiling_idx;
+
+	igt_fixture {
+		for (i = 0; i < IGT_MAX_PIPES; i++) {
+			for (j = 0;j < MAX_PLANES; j++)
+				data->fb[i * MAX_PLANES + j].fb_id = 0;
+			data->cursor_fb[i].fb_id = 0;
+			data->num_planes[i] = -1;
+			data->last_mode[i] = NULL;
+		}
+		if (gpu) {
+			for (i = 0; i < IGT_MAX_PIPES; i++) {
+				data->gpu_context[i].data = data;
+				data->gpu_context[i].pipe = i;
+				data->gpu_context[i].blt_rect.x = 0;
+				data->gpu_context[i].blt_rect.y = 0;
+				data->gpu_context[i].blt_rect.w = 0;
+				data->gpu_context[i].blt_rect.h = 0;
+			}
+		}
+
+		if (cpu) {
+			for (i = 0; i < number_of_cores;i++) {
+				data->cpu_context[i].buf1 = malloc(BUF_SIZE);
+				data->cpu_context[i].buf2 = malloc(BUF_SIZE);
+				data->cpu_context[i].id = i;
+				data->cpu_context[i].data = data;
+				pthread_create(&data->cpu_thread[i], NULL, cpu_load, (void*)&data->cpu_context[i]);
+			}
+		}
+	}
+
+	for (format_idx = 0; format_idx < N_FORMATS; format_idx++) {
+		for (tiling_idx = 0; tiling_idx < N_TILING_METHODS; tiling_idx++) {
+			igt_subtest_f("stress%s%s%s-%s-%s",
+				      override == false ? "" : "-mode-override",
+				      cpu == false ? "" : "-cpu-load",
+				      gpu == false ? "" : "-gpu-load",
+				      format_str(format_idx),
+				      tiling_str(tiling_idx)) {
+
+				stress(data, override, gpu, format_idx, tiling_idx);
+
+			}
+
+			igt_fixture {
+				/*
+				 * As we change tiling/format we need a new FB
+				 */
+				for (i = 0; i < IGT_MAX_PIPES; i++) {
+					data->last_mode[i] = NULL;
+					for (j = 0;j < MAX_PLANES; j++) {
+						if (data->fb[i * MAX_PLANES + j].fb_id) {
+							igt_plane_set_fb(&data->display.pipes[i].planes[j], NULL);
+							igt_remove_fb(data->display.drm_fd, &data->fb[i * MAX_PLANES + j]);
+							data->fb[i * MAX_PLANES + j].fb_id = 0;
+						}
+					}
+					data->num_planes[i] = -1;
+					if (data->cursor_fb[i].fb_id) {
+						igt_remove_fb(data->display.drm_fd, &data->cursor_fb[i]);
+						data->cursor_fb[i].fb_id = 0;
+					}
+				}
+			}
+		}
+	}
+
+	igt_fixture {
+		if (cpu) {
+			for (i = 0; i < number_of_cores;i++) {
+				data->cpu_thread_stop[i] = true;
+				pthread_join(data->cpu_thread[i], NULL);
+			}
+			for (i = 0;i < number_of_cores; i++) {
+				free(data->cpu_context[i].buf1);
+				free(data->cpu_context[i].buf2);
+			}
+		}
+	}
+}
+
+
+struct data data = {
+	.format = DRM_FORMAT_XRGB8888,
+	.modifier = DRM_FORMAT_MOD_LINEAR,
+	.devid = 0,
+};
+
+
+igt_main
+{
+	bool mode_override = false;
+	bool cpu_load = false;
+	bool gpu_load = false;
+
+	igt_fixture {
+		data.drm_fd = data.display.drm_fd = drm_open_driver_master(DRIVER_ANY);
+
+		kmstest_set_vt_graphics_mode();
+
+		igt_display_require(&data.display, data.display.drm_fd);
+		igt_require(data.display.is_atomic);
+		igt_display_require_output(&data.display);
+	}
+
+	test(&data, mode_override, cpu_load, gpu_load);
+
+	cpu_load = true;
+	gpu_load = true;
+
+	test(&data, mode_override, cpu_load, gpu_load);
+
+	mode_override = true;
+	cpu_load = false;
+	gpu_load = false;
+
+	test(&data, mode_override, cpu_load, gpu_load);
+
+	cpu_load = true;
+	gpu_load = true;
+
+	test(&data, mode_override, cpu_load, gpu_load);
+
+	igt_fixture {
+		igt_display_fini(&data.display);
+	}
+}
\ No newline at end of file
diff --git a/tests/meson.build b/tests/meson.build
index 9015f809..c586642c 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -46,6 +46,7 @@ test_progs = [
 	'kms_plane_lowres',
 	'kms_plane_multiple',
 	'kms_plane_scaling',
+	'kms_plane_stress',
 	'kms_prop_blob',
 	'kms_properties',
 	'kms_psr',
-- 
2.17.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-04-11 23:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-11 13:49 [igt-dev] [PATCH i-g-t v8] igt/tests: kms_plane_stress: Add plane stress test Stanislav Lisovskiy
2019-04-11 16:55 ` [igt-dev] ✓ Fi.CI.BAT: success for igt/tests: kms_plane_stress: Add plane stress test (rev10) Patchwork
2019-04-11 23:12 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2019-04-11  9:40 [igt-dev] [PATCH i-g-t v8] igt/tests: kms_plane_stress: Add plane stress test Stanislav Lisovskiy

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.