diff options
author | Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com> | 2019-03-04 12:31:46 -0300 |
---|---|---|
committer | Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com> | 2019-03-12 09:01:16 -0300 |
commit | e94044d67f3a8a02785caeb07111ef982f5a6bc6 (patch) | |
tree | e8bec12fafbc31399cae7cea1780ca1e4a81c761 /tests/kms_flip.c | |
parent | 312fd6e178bc289c99675849bd1e78eee4afd539 (diff) |
kms_flip: Rework set_mode()
This patch removes the duplicate code inside the function set_mode().
Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Diffstat (limited to 'tests/kms_flip.c')
-rwxr-xr-x | tests/kms_flip.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/tests/kms_flip.c b/tests/kms_flip.c index 373f29a59..c9fb6762a 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; |