summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2013-08-29 15:11:47 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2013-08-29 16:19:41 +0100
commitd0ed91210795e75847b3a3da6b48b1179ff53ede (patch)
tree2a059a0579fed29630e9a3e9562ab54310ff6478
parent59f134450d25ba5a3cdf2dbf945e3fb06322874b (diff)
kms_flip: Exercise flip-vs-render
For machine with split BCS/RCS rings, we also need to test whether we correctly wait upon outstanding render work before flipping and changing modes. This should also serve to exercise the ring selection code for flips. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--lib/drmtest.c2
-rw-r--r--lib/drmtest.h6
-rw-r--r--lib/rendercopy.h5
-rw-r--r--tests/kms_flip.c122
4 files changed, 103 insertions, 32 deletions
diff --git a/lib/drmtest.c b/lib/drmtest.c
index e1522b70..70483eac 100644
--- a/lib/drmtest.c
+++ b/lib/drmtest.c
@@ -1304,6 +1304,7 @@ unsigned int kmstest_create_fb(int fd, int width, int height, int bpp,
fb->width = width;
fb->height = height;
+ fb->tiling = tiled;
fb->drm_format = bpp_depth_to_drm_format(bpp, depth);
return fb->fb_id;
@@ -1352,6 +1353,7 @@ unsigned int kmstest_create_fb2(int fd, int width, int height, uint32_t format,
fb->width = width;
fb->height = height;
+ fb->tiling = tiled;
fb->drm_format = format;
fb->fb_id = fb_id;
diff --git a/lib/drmtest.h b/lib/drmtest.h
index 5fecb2b0..ece478b1 100644
--- a/lib/drmtest.h
+++ b/lib/drmtest.h
@@ -25,6 +25,9 @@
*
*/
+#ifndef DRMTEST_H
+#define DRMTEST_H
+
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@@ -269,6 +272,7 @@ struct kmstest_fb {
int height;
int depth;
unsigned stride;
+ unsigned tiling;
unsigned size;
cairo_t *cairo_ctx;
};
@@ -326,3 +330,5 @@ int igt_enable_prefault(void);
/* suspend and auto-resume system */
void igt_system_suspend_autoresume(void);
+
+#endif /* DRMTEST_H */
diff --git a/lib/rendercopy.h b/lib/rendercopy.h
index b03c1472..8fd9222b 100644
--- a/lib/rendercopy.h
+++ b/lib/rendercopy.h
@@ -1,3 +1,6 @@
+#ifndef RENDERCOPY_H
+#define RENDERCOPY_H
+
#include <stdlib.h>
#include <sys/ioctl.h>
#include <stdio.h>
@@ -81,3 +84,5 @@ void gen2_render_copyfunc(struct intel_batchbuffer *batch,
struct scratch_buf *src, unsigned src_x, unsigned src_y,
unsigned width, unsigned height,
struct scratch_buf *dst, unsigned dst_x, unsigned dst_y);
+
+#endif /* RENDERCOPY_H */
diff --git a/tests/kms_flip.c b/tests/kms_flip.c
index cb9ccd1b..acd12ed1 100644
--- a/tests/kms_flip.c
+++ b/tests/kms_flip.c
@@ -40,29 +40,28 @@
#include "i915_drm.h"
#include "drmtest.h"
#include "testdisplay.h"
-#include "intel_bufmgr.h"
-#include "intel_batchbuffer.h"
-#include "intel_gpu_tools.h"
+#include "rendercopy.h"
#define TEST_DPMS (1 << 0)
-#define TEST_WITH_DUMMY_LOAD (1 << 1)
-#define TEST_PAN (1 << 2)
-#define TEST_MODESET (1 << 3)
-#define TEST_CHECK_TS (1 << 4)
-#define TEST_EBUSY (1 << 5)
-#define TEST_EINVAL (1 << 6)
-#define TEST_FLIP (1 << 7)
-#define TEST_VBLANK (1 << 8)
-#define TEST_VBLANK_BLOCK (1 << 9)
-#define TEST_VBLANK_ABSOLUTE (1 << 10)
-#define TEST_VBLANK_EXPIRED_SEQ (1 << 11)
-#define TEST_FB_RECREATE (1 << 12)
-#define TEST_RMFB (1 << 13)
-#define TEST_HANG (1 << 14)
-#define TEST_NOEVENT (1 << 15)
-#define TEST_FB_BAD_TILING (1 << 16)
-#define TEST_SINGLE_BUFFER (1 << 17)
-#define TEST_DPMS_OFF (1 << 18)
+#define TEST_WITH_DUMMY_BCS (1 << 1)
+#define TEST_WITH_DUMMY_RCS (1 << 2)
+#define TEST_PAN (1 << 3)
+#define TEST_MODESET (1 << 4)
+#define TEST_CHECK_TS (1 << 5)
+#define TEST_EBUSY (1 << 6)
+#define TEST_EINVAL (1 << 7)
+#define TEST_FLIP (1 << 8)
+#define TEST_VBLANK (1 << 9)
+#define TEST_VBLANK_BLOCK (1 << 10)
+#define TEST_VBLANK_ABSOLUTE (1 << 11)
+#define TEST_VBLANK_EXPIRED_SEQ (1 << 12)
+#define TEST_FB_RECREATE (1 << 13)
+#define TEST_RMFB (1 << 14)
+#define TEST_HANG (1 << 15)
+#define TEST_NOEVENT (1 << 16)
+#define TEST_FB_BAD_TILING (1 << 17)
+#define TEST_SINGLE_BUFFER (1 << 18)
+#define TEST_DPMS_OFF (1 << 19)
#define EVENT_FLIP (1 << 0)
#define EVENT_VBLANK (1 << 1)
@@ -144,7 +143,7 @@ static unsigned long gettime_us(void)
return ts.tv_sec * 1000000 + ts.tv_nsec / 1000;
}
-static void emit_dummy_load(struct test_output *o)
+static void emit_dummy_load__bcs(struct test_output *o)
{
int i, limit;
drm_intel_bo *dummy_bo, *target_bo, *tmp_bo;
@@ -192,6 +191,56 @@ static void emit_dummy_load(struct test_output *o)
drm_intel_bo_unreference(target_bo);
}
+static void emit_dummy_load__rcs(struct test_output *o)
+{
+ const struct kmstest_fb *fb_info = &o->fb_info[o->current_fb_id];
+ render_copyfunc_t copyfunc;
+ struct scratch_buf sb[2], *src, *dst;
+ int i, limit;
+
+ copyfunc = get_render_copyfunc(devid);
+ if (copyfunc == NULL)
+ return emit_dummy_load__bcs(o);
+
+ limit = intel_gen(devid) < 6 ? 500 : 5000;
+
+ sb[0].bo = drm_intel_bo_alloc(bufmgr, "dummy_bo", fb_info->size, 4096);
+ igt_assert(sb[0].bo);
+ sb[0].size = sb[0].bo->size;
+ sb[0].tiling = I915_TILING_NONE;
+ sb[0].data = NULL;
+ sb[0].num_tiles = sb[0].bo->size;
+ sb[0].stride = 4 * o->mode.hdisplay;
+
+ sb[1].bo = gem_handle_to_libdrm_bo(bufmgr, drm_fd, "imported", fb_info->gem_handle);
+ igt_assert(sb[1].bo);
+ sb[1].size = sb[1].bo->size;
+ sb[1].tiling = fb_info->tiling;
+ sb[1].data = NULL;
+ sb[1].num_tiles = sb[1].bo->size;
+ sb[1].stride = fb_info->stride;
+
+ src = &sb[0];
+ dst = &sb[1];
+
+ for (i = 0; i < limit; i++) {
+ struct scratch_buf *tmp;
+
+ copyfunc(batch,
+ src, 0, 0,
+ o->mode.hdisplay, o->mode.vdisplay,
+ dst, 0, 0);
+
+ tmp = src;
+ src = dst;
+ dst = tmp;
+ }
+ intel_batchbuffer_flush(batch);
+
+ drm_intel_bo_unreference(sb[0].bo);
+ drm_intel_bo_unreference(sb[1].bo);
+}
+
static int set_connector_dpms(drmModeConnector *connector, int mode)
{
int i, dpms = 0;
@@ -672,9 +721,11 @@ static unsigned int run_test_step(struct test_output *o)
do_vblank = (o->flags & TEST_VBLANK) &&
!(o->pending_events & EVENT_VBLANK);
- if (o->flags & TEST_WITH_DUMMY_LOAD)
- emit_dummy_load(o);
+ if (o->flags & TEST_WITH_DUMMY_BCS)
+ emit_dummy_load__bcs(o);
+ if (o->flags & TEST_WITH_DUMMY_RCS)
+ emit_dummy_load__rcs(o);
if (!(o->flags & TEST_SINGLE_BUFFER))
o->current_fb_id = !o->current_fb_id;
@@ -916,7 +967,7 @@ static unsigned int wait_for_events(struct test_output *o)
evctx.page_flip_handler = page_flip_handler;
/* make timeout lax with the dummy load */
- if (o->flags & TEST_WITH_DUMMY_LOAD)
+ if (o->flags & (TEST_WITH_DUMMY_BCS | TEST_WITH_DUMMY_RCS))
timeout.tv_sec *= 10;
FD_ZERO(&fds);
@@ -1128,11 +1179,15 @@ int main(int argc, char **argv)
{ 5, TEST_VBLANK | TEST_VBLANK_BLOCK | TEST_VBLANK_ABSOLUTE,
"blocking-absolute-wf_vblank" },
{ 30, TEST_VBLANK | TEST_DPMS | TEST_EINVAL, "wf_vblank-vs-dpms" },
- { 30, TEST_VBLANK | TEST_DPMS | TEST_WITH_DUMMY_LOAD,
- "delayed-wf_vblank-vs-dpms" },
+ { 30, TEST_VBLANK | TEST_DPMS | TEST_WITH_DUMMY_BCS,
+ "bcs-wf_vblank-vs-dpms" },
+ { 30, TEST_VBLANK | TEST_DPMS | TEST_WITH_DUMMY_RCS,
+ "rcs-wf_vblank-vs-dpms" },
{ 30, TEST_VBLANK | TEST_MODESET | TEST_EINVAL, "wf_vblank-vs-modeset" },
- { 30, TEST_VBLANK | TEST_MODESET | TEST_WITH_DUMMY_LOAD,
- "delayed-wf_vblank-vs-modeset" },
+ { 30, TEST_VBLANK | TEST_MODESET | TEST_WITH_DUMMY_BCS,
+ "bcs-wf_vblank-vs-modeset" },
+ { 30, TEST_VBLANK | TEST_MODESET | TEST_WITH_DUMMY_RCS,
+ "rcs-wf_vblank-vs-modeset" },
{ 15, TEST_FLIP | TEST_EBUSY , "plain-flip" },
{ 15, TEST_FLIP | TEST_CHECK_TS | TEST_EBUSY , "plain-flip-ts-check" },
@@ -1140,11 +1195,14 @@ int main(int argc, char **argv)
"plain-flip-fb-recreate" },
{ 15, TEST_FLIP | TEST_EBUSY | TEST_RMFB | TEST_MODESET , "flip-vs-rmfb" },
{ 30, TEST_FLIP | TEST_DPMS | TEST_EINVAL, "flip-vs-dpms" },
- { 30, TEST_FLIP | TEST_DPMS | TEST_WITH_DUMMY_LOAD, "delayed-flip-vs-dpms" },
+ { 30, TEST_FLIP | TEST_DPMS | TEST_WITH_DUMMY_BCS, "bcs-flip-vs-dpms" },
+ { 30, TEST_FLIP | TEST_DPMS | TEST_WITH_DUMMY_RCS, "rcs-flip-vs-dpms" },
{ 5, TEST_FLIP | TEST_PAN, "flip-vs-panning" },
- { 30, TEST_FLIP | TEST_PAN | TEST_WITH_DUMMY_LOAD, "delayed-flip-vs-panning" },
+ { 30, TEST_FLIP | TEST_PAN | TEST_WITH_DUMMY_BCS, "bcs-flip-vs-panning" },
+ { 30, TEST_FLIP | TEST_PAN | TEST_WITH_DUMMY_RCS, "rcs-flip-vs-panning" },
{ 30, TEST_FLIP | TEST_MODESET | TEST_EINVAL, "flip-vs-modeset" },
- { 30, TEST_FLIP | TEST_MODESET | TEST_WITH_DUMMY_LOAD, "delayed-flip-vs-modeset" },
+ { 30, TEST_FLIP | TEST_MODESET | TEST_WITH_DUMMY_BCS, "bcs-flip-vs-modeset" },
+ { 30, TEST_FLIP | TEST_MODESET | TEST_WITH_DUMMY_RCS, "rcs-flip-vs-modeset" },
{ 5, TEST_FLIP | TEST_VBLANK_EXPIRED_SEQ,
"flip-vs-expired-vblank" },