Commit e94044d6 authored by Rodrigo Siqueira's avatar Rodrigo Siqueira

kms_flip: Rework set_mode()

This patch removes the duplicate code inside the function set_mode().
Signed-off-by: Rodrigo Siqueira's avatarRodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
Reviewed-by: 's avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
parent 312fd6e1
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment