summaryrefslogtreecommitdiff
path: root/linux-core/drm_crtc.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2008-02-26 17:11:03 +1100
committerDave Airlie <airlied@redhat.com>2008-02-26 17:11:03 +1100
commit879fb12e289e8997ef325dd5b0068d0d4d6c26df (patch)
treeb3c88c3be4e189d27d0771d6ca91d8e5d546b8a4 /linux-core/drm_crtc.c
parenta72399da2a89aecdcf293bc262d76d8c6e10d0ef (diff)
drm: fix pick crtcs mode selection code
Diffstat (limited to 'linux-core/drm_crtc.c')
-rw-r--r--linux-core/drm_crtc.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/linux-core/drm_crtc.c b/linux-core/drm_crtc.c
index bf37730b..73ab10ec 100644
--- a/linux-core/drm_crtc.c
+++ b/linux-core/drm_crtc.c
@@ -870,6 +870,7 @@ static void drm_pick_crtcs (struct drm_device *dev)
struct drm_output *output, *output_equal;
struct drm_crtc *crtc;
struct drm_display_mode *des_mode = NULL, *modes, *modes_equal;
+ int found;
list_for_each_entry(output, &dev->mode_config.output_list, head) {
output->crtc = NULL;
@@ -890,17 +891,23 @@ static void drm_pick_crtcs (struct drm_device *dev)
if (output->status != output_status_connected)
continue;
+ if (list_empty(&output->modes))
+ continue;
+
des_mode = NULL;
+ found = 0;
list_for_each_entry(des_mode, &output->modes, head) {
- if (des_mode->type & DRM_MODE_TYPE_PREFERRED)
+ if (des_mode->type & DRM_MODE_TYPE_PREFERRED) {
+ found = 1;
break;
+ }
}
/* No preferred mode, let's just select the first available */
- if (!des_mode || !(des_mode->type & DRM_MODE_TYPE_PREFERRED)) {
+ if (!found) {
+ des_mode = NULL;
list_for_each_entry(des_mode, &output->modes, head) {
- if (des_mode)
- break;
+ break;
}
}