[RFT i-g-t] tests/prime_vgem/basic-fence-flip: Probe display resolution

Tvrtko Ursulin
2019-04-10T11:43:22Z

From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Some displays might not support hardcoded 1024x768.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=109294
---
tests/prime_vgem.c | 20 +++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/tests/prime_vgem.c b/tests/prime_vgem.c
index 60bb951c8cbe..458846add9ee 100644
--- a/tests/prime_vgem.c
+++ b/tests/prime_vgem.c
@@ -744,8 +744,22 @@ static void flip_to_vgem(int i915, int vgem,

static void test_flip(int i915, int vgem, unsigned hang)
{
- struct vgem_bo bo[2];
+ drmModeModeInfo *mode = NULL;
uint32_t fb_id[2], handle[2], crtc_id;
+ igt_display_t display;
+ igt_output_t *output;
+ struct vgem_bo bo[2];
+ enum pipe pipe;
+
+ igt_display_require(&display, i915);
+ igt_display_require_output(&display);
+
+ for_each_pipe_with_valid_output(&display, pipe, output) {
+ mode = igt_output_get_mode(output);
+ break;
+ }
+
+ igt_assert(mode);

signal(SIGHUP, sighandler);

@@ -754,8 +768,8 @@ static void test_flip(int i915, int vgem, unsigned hang)
uint32_t offsets[4] = {};
int fd;

- bo[i].width = 1024;
- bo[i].height = 768;
+ bo[i].width = mode->hdisplay;
+ bo[i].height = mode->vdisplay;
bo[i].bpp = 32;
vgem_create(vgem, &bo[i]);

--
2.19.1