[igt-dev] [PATCH i-g-t 6/7] kms_flip: Rework set_mode()
Rodrigo Siqueira
rodrigosiqueiramelo at gmail.com
Mon Mar 4 15:31:46 UTC 2019
This patch removes the duplicate code inside the function set_mode().
Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo at gmail.com>
---
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/igt-dev/attachments/20190304/16a02fbb/attachment-0001.sig>
More information about the igt-dev
mailing list