Commit 31c946e8 authored by Daniel Vetter's avatar Daniel Vetter

drm: If available use atomic state in getcrtc ioctl

This way drivers fully converted to atomic don't need to update these
legacy state variables in their modeset code any more.
Reviewed-by: default avatarRob Clark <robdclark@gmail.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@intel.com>
parent 17a38d9c
...@@ -2009,22 +2009,33 @@ int drm_mode_getcrtc(struct drm_device *dev, ...@@ -2009,22 +2009,33 @@ int drm_mode_getcrtc(struct drm_device *dev,
return -ENOENT; return -ENOENT;
drm_modeset_lock_crtc(crtc, crtc->primary); drm_modeset_lock_crtc(crtc, crtc->primary);
crtc_resp->x = crtc->x;
crtc_resp->y = crtc->y;
crtc_resp->gamma_size = crtc->gamma_size; crtc_resp->gamma_size = crtc->gamma_size;
if (crtc->primary->fb) if (crtc->primary->fb)
crtc_resp->fb_id = crtc->primary->fb->base.id; crtc_resp->fb_id = crtc->primary->fb->base.id;
else else
crtc_resp->fb_id = 0; crtc_resp->fb_id = 0;
if (crtc->enabled) { if (crtc->state) {
crtc_resp->x = crtc->primary->state->src_x >> 16;
crtc_resp->y = crtc->primary->state->src_y >> 16;
if (crtc->state->enable) {
drm_crtc_convert_to_umode(&crtc_resp->mode, &crtc->state->mode);
crtc_resp->mode_valid = 1;
} else {
crtc_resp->mode_valid = 0;
}
} else {
crtc_resp->x = crtc->x;
crtc_resp->y = crtc->y;
if (crtc->enabled) {
drm_crtc_convert_to_umode(&crtc_resp->mode, &crtc->mode); drm_crtc_convert_to_umode(&crtc_resp->mode, &crtc->mode);
crtc_resp->mode_valid = 1; crtc_resp->mode_valid = 1;
} else { } else {
crtc_resp->mode_valid = 0; crtc_resp->mode_valid = 0;
} }
}
drm_modeset_unlock_crtc(crtc); drm_modeset_unlock_crtc(crtc);
return 0; 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