aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorVille Syrjälä <ville.syrjala@linux.intel.com>2012-03-13 06:35:38 -0400
committerDave Airlie <airlied@redhat.com>2012-03-15 05:48:56 -0400
commit6653cc8d3b8d1c685fbf01cc8a536957045f4609 (patch)
tree7b42e3c557fff0dec3cc31e70ac91676be1b5f23 /drivers/gpu
parent09016a11fc738e82ca1303e2332473b517bbd660 (diff)
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: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/drm_crtc.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 6fdaf6fe94eb..bbcecdb4e0ad 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -1755,7 +1755,7 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
1755 struct drm_mode_config *config = &dev->mode_config; 1755 struct drm_mode_config *config = &dev->mode_config;
1756 struct drm_mode_crtc *crtc_req = data; 1756 struct drm_mode_crtc *crtc_req = data;
1757 struct drm_mode_object *obj; 1757 struct drm_mode_object *obj;
1758 struct drm_crtc *crtc, *crtcfb; 1758 struct drm_crtc *crtc;
1759 struct drm_connector **connector_set = NULL, *connector; 1759 struct drm_connector **connector_set = NULL, *connector;
1760 struct drm_framebuffer *fb = NULL; 1760 struct drm_framebuffer *fb = NULL;
1761 struct drm_display_mode *mode = NULL; 1761 struct drm_display_mode *mode = NULL;
@@ -1782,14 +1782,12 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
1782 /* If we have a mode we need a framebuffer. */ 1782 /* If we have a mode we need a framebuffer. */
1783 /* If we pass -1, set the mode with the currently bound fb */ 1783 /* If we pass -1, set the mode with the currently bound fb */
1784 if (crtc_req->fb_id == -1) { 1784 if (crtc_req->fb_id == -1) {
1785 list_for_each_entry(crtcfb, 1785 if (!crtc->fb) {
1786 &dev->mode_config.crtc_list, head) { 1786 DRM_DEBUG_KMS("CRTC doesn't have current FB\n");
1787 if (crtcfb == crtc) { 1787 ret = -EINVAL;
1788 DRM_DEBUG_KMS("Using current fb for " 1788 goto out;
1789 "setmode\n");
1790 fb = crtc->fb;
1791 }
1792 } 1789 }
1790 fb = crtc->fb;
1793 } else { 1791 } else {
1794 obj = drm_mode_object_find(dev, crtc_req->fb_id, 1792 obj = drm_mode_object_find(dev, crtc_req->fb_id,
1795 DRM_MODE_OBJECT_FB); 1793 DRM_MODE_OBJECT_FB);