aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_modes.c
diff options
context:
space:
mode:
authorVille Syrjälä <ville.syrjala@linux.intel.com>2015-12-04 08:13:01 -0500
committerDaniel Vetter <daniel.vetter@ffwll.ch>2015-12-11 03:27:07 -0500
commitfc245f88039cc52859841bde9b81a7d3b7cd8b5a (patch)
treec08f197e0a09ba3fced1cb000f9418d262b04f91 /drivers/gpu/drm/drm_modes.c
parent2f8c19e771dcb3af974e46ffb512b592d70fb444 (diff)
drm: Only merge mode type bits between new probed modes
Currently most drivers request that any mode appearing on both the old mode list and the new probed_modes list get their type bits ORed together if the modes are deemed to otherwise match each other. I don't know why anyone would want to merge in the mode type bits from any mode left over from a previous probe. For instance, you could never get rid of ther preferred bit if a matching non-preferred mode is returned by the new probe. So let's not merge anything from the stale old modes, and just replace them outright with matching new modes. If multiple matching modes are produced by the same probe, merging the type bits between them would seem like a sensible thing to do. For a bit of extra finesse if two modes are considered equal we can pick the actual timings from the one marked as preferrred. And if multiple preferred modes are produced by the same probe somehow, we can just favor the first one added to the probed_modes list. You may be asking yourself why we bother with the merging at all if nothing from the old list survives in practice. The only answer I have is "debug output". That is we want to print out a list of pruned modes, which is why we still want to look for duplicates with the old modes. There was a previous attempt to get rid of the mode type merging entirely, but it caused some kind of regression on Daniels's G33 machine. Apparently the sdvo transcoder on said machine started to die at around the same time and has since rotted away totally, so it may have been a red herring. So we don't have to worry about it anymore. The relevant commits are: commit 3fbd6439e463 ("drm: copy mode type in drm_mode_connector_list_update()") commit abce1ec9b08a ("Revert "drm: copy mode type in drm_mode_connector_list_update()"") It was then decided in commit b87577b7c768 ("drm: try harder to avoid regression when merging mode bits") that just qxl virtio are excluded from the merging, while everyone else does it. That is not changed, although now even qxl and virtio will be subject to the previously mentioned logic to choose which actual timings are picked for the new mode. v2: Fix typos in commit message, and clarify the details on the G33 regression from the previous attempt (Daniel) Cc: Marc-André Lureau <marcandre.lureau@redhat.com> Cc: Dave Airlie <airlied@redhat.com> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: Adam Jackson <ajax@redhat.com> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/1449234781-22332-1-git-send-email-ville.syrjala@linux.intel.com
Diffstat (limited to 'drivers/gpu/drm/drm_modes.c')
-rw-r--r--drivers/gpu/drm/drm_modes.c34
1 files changed, 27 insertions, 7 deletions
diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
index 59c97ae0c68a..1888e3cbdeaf 100644
--- a/drivers/gpu/drm/drm_modes.c
+++ b/drivers/gpu/drm/drm_modes.c
@@ -1198,13 +1198,33 @@ void drm_mode_connector_list_update(struct drm_connector *connector,
1198 continue; 1198 continue;
1199 1199
1200 found_it = true; 1200 found_it = true;
1201 /* if equal delete the probed mode */ 1201
1202 mode->status = pmode->status; 1202 /*
1203 /* Merge type bits together */ 1203 * If the old matching mode is stale (ie. left over
1204 if (merge_type_bits) 1204 * from a previous probe) just replace it outright.
1205 mode->type |= pmode->type; 1205 * Otherwise just merge the type bits between all
1206 else 1206 * equal probed modes.
1207 mode->type = pmode->type; 1207 *
1208 * If two probed modes are considered equal, pick the
1209 * actual timings from the one that's marked as
1210 * preferred (in case the match isn't 100%). If
1211 * multiple or zero preferred modes are present, favor
1212 * the mode added to the probed_modes list first.
1213 */
1214 if (mode->status == MODE_STALE) {
1215 drm_mode_copy(mode, pmode);
1216 } else if ((mode->type & DRM_MODE_TYPE_PREFERRED) == 0 &&
1217 (pmode->type & DRM_MODE_TYPE_PREFERRED) != 0) {
1218 if (merge_type_bits)
1219 pmode->type |= mode->type;
1220 drm_mode_copy(mode, pmode);
1221 } else {
1222 if (merge_type_bits)
1223 mode->type |= pmode->type;
1224 else
1225 mode->type = pmode->type;
1226 }
1227
1208 list_del(&pmode->head); 1228 list_del(&pmode->head);
1209 drm_mode_destroy(connector->dev, pmode); 1229 drm_mode_destroy(connector->dev, pmode);
1210 break; 1230 break;