[PATCH i-g-t 6/7] kms_flip: Rework set_mode()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch removes the duplicate code inside the function set_mode().

Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@xxxxxxxxx>
---
 tests/kms_flip.c | 26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/tests/kms_flip.c b/tests/kms_flip.c
index 42ae3ebc..de3ab600 100755
--- a/tests/kms_flip.c
+++ b/tests/kms_flip.c
@@ -609,22 +609,24 @@ static bool is_wedged(int fd)
 
 static int set_mode(struct test_output *o, uint32_t fb, int x, int y)
 {
-	int n;
+	int n, ret;
 
 	for (n = o->count - 1; n >= 0; n--) {
+		uint32_t buffer_id = fb, x_crtc = x, y_crtc = y;
+		uint32_t *conn = &o->_connector[n];
+		int count = 1;
+		drmModeModeInfoPtr mode = &o->kmode[n];
+
 		if (fb == 0) {
-			int ret = drmModeSetCrtc(drm_fd, o->_crtc[n],
-						 0, 0, 0,
-						 0, 0, 0);
-			if (ret)
-				return ret;
-		} else {
-			int ret = drmModeSetCrtc(drm_fd, o->_crtc[n],
-						 fb, x, y,
-						 &o->_connector[n], 1, &o->kmode[n]);
-			if (ret)
-				return ret;
+			buffer_id = x_crtc = y_crtc = count = 0;
+			conn = NULL; mode = NULL;
 		}
+
+		ret = drmModeSetCrtc(drm_fd, o->_crtc[n],
+				     buffer_id, x_crtc, y_crtc,
+				     conn, count, mode);
+		if (ret)
+			return ret;
 	}
 
 	return 0;
-- 
2.21.0

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux