[Intel-gfx] [PATCH 06/22] flip_test: store fb width, height in test context object

Imre Deak imre.deak at intel.com
Tue Oct 16 16:34:40 CEST 2012


We will need these in event handlers, so store them where the handlers
have access to them.

No functional change.

Signed-off-by: Imre Deak <imre.deak at intel.com>
---
 tests/flip_test.c |   23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/tests/flip_test.c b/tests/flip_test.c
index ed8c12b..aa611f5 100644
--- a/tests/flip_test.c
+++ b/tests/flip_test.c
@@ -73,6 +73,8 @@ struct test_output {
 	int flags;
 	int count;
 	unsigned int current_fb_id;
+	unsigned int fb_width;
+	unsigned int fb_height;
 	unsigned int fb_ids[2];
 	struct kmstest_fb fb_info[2];
 	struct timeval last_flip_received;
@@ -391,7 +393,6 @@ static void flip_mode(struct test_output *o, int crtc, int duration)
 	int ret;
 	int bpp = 32, depth = 24;
 	drmEventContext evctx;
-	int width, height;
 	struct timeval end;
 
 	connector_find_preferred_mode(o, crtc);
@@ -401,17 +402,17 @@ static void flip_mode(struct test_output *o, int crtc, int duration)
 	fprintf(stdout, "Beginning page flipping on crtc %d, connector %d\n",
 		crtc, o->id);
 
-	width = o->mode.hdisplay;
-	height = o->mode.vdisplay;
+	o->fb_width = o->mode.hdisplay;
+	o->fb_height = o->mode.vdisplay;
 
 	if (o->flags & TEST_PAN)
-		width *= 2;
+		o->fb_width *= 2;
 
-	o->fb_ids[0] = kmstest_create_fb(drm_fd, width, height, bpp, depth,
-					 false, &o->fb_info[0],
+	o->fb_ids[0] = kmstest_create_fb(drm_fd, o->fb_width, o->fb_height, bpp,
+					 depth, false, &o->fb_info[0],
 					 paint_flip_mode, (void *)false);
-	o->fb_ids[1] = kmstest_create_fb(drm_fd, width, height, bpp, depth,
-					 false, &o->fb_info[1],
+	o->fb_ids[1] = kmstest_create_fb(drm_fd, o->fb_width, o->fb_height, bpp,
+					 depth, false, &o->fb_info[1],
 					 paint_flip_mode, (void *)true);
 
 	if (!o->fb_ids[0] || !o->fb_ids[1]) {
@@ -423,7 +424,7 @@ static void flip_mode(struct test_output *o, int crtc, int duration)
 	if (drmModeSetCrtc(drm_fd, o->crtc, o->fb_ids[0], 0, 0,
 			   &o->id, 1, &o->mode)) {
 		fprintf(stderr, "failed to set mode (%dx%d@%dHz): %s\n",
-			width, height, o->mode.vrefresh,
+			o->fb_width, o->fb_height, o->mode.vrefresh,
 			strerror(errno));
 		exit(3);
 	}
@@ -488,8 +489,8 @@ static void flip_mode(struct test_output *o, int crtc, int duration)
 					   x_ofs, 0,
 					   &o->id, 1, &o->mode)) {
 				fprintf(stderr, "failed to pan (%dx%d@%dHz): %s\n",
-					width, height, o->mode.vrefresh,
-					strerror(errno));
+					o->fb_width, o->fb_height,
+					o->mode.vrefresh, strerror(errno));
 				exit(7);
 			}
 		}
-- 
1.7.9.5




More information about the Intel-gfx mailing list