Commit 6653cc8d authored by Ville Syrjälä's avatar Ville Syrjälä Committed by Dave Airlie

drm: Reject mode set with current fb if no current fb is bound

When doing a mode set with the special fb id -1, reject the mode set if
no fb is currently bound to the crtc.

Also remove the pointless list traversal to find the current crtc based
on the current crtc :)
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent 09016a11
...@@ -1755,7 +1755,7 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data, ...@@ -1755,7 +1755,7 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
struct drm_mode_config *config = &dev->mode_config; struct drm_mode_config *config = &dev->mode_config;
struct drm_mode_crtc *crtc_req = data; struct drm_mode_crtc *crtc_req = data;
struct drm_mode_object *obj; struct drm_mode_object *obj;
struct drm_crtc *crtc, *crtcfb; struct drm_crtc *crtc;
struct drm_connector **connector_set = NULL, *connector; struct drm_connector **connector_set = NULL, *connector;
struct drm_framebuffer *fb = NULL; struct drm_framebuffer *fb = NULL;
struct drm_display_mode *mode = NULL; struct drm_display_mode *mode = NULL;
...@@ -1782,14 +1782,12 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data, ...@@ -1782,14 +1782,12 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
/* If we have a mode we need a framebuffer. */ /* If we have a mode we need a framebuffer. */
/* If we pass -1, set the mode with the currently bound fb */ /* If we pass -1, set the mode with the currently bound fb */
if (crtc_req->fb_id == -1) { if (crtc_req->fb_id == -1) {
list_for_each_entry(crtcfb, if (!crtc->fb) {
&dev->mode_config.crtc_list, head) { DRM_DEBUG_KMS("CRTC doesn't have current FB\n");
if (crtcfb == crtc) { ret = -EINVAL;
DRM_DEBUG_KMS("Using current fb for " goto out;
"setmode\n");
fb = crtc->fb;
}
} }
fb = crtc->fb;
} else { } else {
obj = drm_mode_object_find(dev, crtc_req->fb_id, obj = drm_mode_object_find(dev, crtc_req->fb_id,
DRM_MODE_OBJECT_FB); DRM_MODE_OBJECT_FB);
......
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