summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaarten Maathuis <madman2003@gmail.com>2008-06-23 22:59:17 +0200
committerMaarten Maathuis <madman2003@gmail.com>2008-06-23 22:59:17 +0200
commit246b41fea462a3b1669c0e3f9fe7f6077a479832 (patch)
treecc3e47873db2b3be7b4636c55510d590975ac228
parentf9dad8cc22994e0e4671d14b3ee721e4b5777a68 (diff)
[modesetting-101] update mode count after fill_modes.
- This avoids returning with a mode count of 0, thus not allocating space for the 2nd ioctl.
-rw-r--r--linux-core/drm_crtc.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/linux-core/drm_crtc.c b/linux-core/drm_crtc.c
index c8cfaef4..aab936c2 100644
--- a/linux-core/drm_crtc.c
+++ b/linux-core/drm_crtc.c
@@ -1018,9 +1018,6 @@ int drm_mode_getconnector(struct drm_device *dev,
}
connector = obj_to_connector(obj);
- list_for_each_entry(mode, &connector->modes, head)
- mode_count++;
-
for (i = 0; i < DRM_CONNECTOR_MAX_PROPERTY; i++) {
if (connector->property_ids[i] != 0) {
props_count++;
@@ -1037,6 +1034,10 @@ int drm_mode_getconnector(struct drm_device *dev,
connector->funcs->fill_modes(connector, dev->mode_config.max_width, dev->mode_config.max_height);
}
+ /* delayed so we get modes regardless of pre-fill_modes state */
+ list_for_each_entry(mode, &connector->modes, head)
+ mode_count++;
+
out_resp->generation = dev->mode_config.current_generation;
out_resp->connector_type = connector->connector_type;
out_resp->connector_type_id = connector->connector_type_id;
@@ -1049,6 +1050,7 @@ int drm_mode_getconnector(struct drm_device *dev,
else
out_resp->encoder = 0;
+ /* this ioctl is called twice, once to determine how much space is needed, and the 2nd time to fill it */
if ((out_resp->count_modes >= mode_count) && mode_count) {
copied = 0;
mode_ptr = (struct drm_mode_modeinfo *)(unsigned long)out_resp->modes_ptr;
@@ -1060,7 +1062,6 @@ int drm_mode_getconnector(struct drm_device *dev,
goto out;
}
copied++;
-
}
}
out_resp->count_modes = mode_count;