]> rtime.felk.cvut.cz Git - linux-imx.git/blobdiff - drivers/gpu/drm/drm_modes.c
drm: Sort connector modes based on vrefresh
[linux-imx.git] / drivers / gpu / drm / drm_modes.c
index a371ff865a887755b81de57663a819429a34ed4c..a6729bfe6860e06a3d2ac0f0da721caada4238d8 100644 (file)
@@ -535,6 +535,8 @@ int drm_display_mode_from_videomode(const struct videomode *vm,
                dmode->flags |= DRM_MODE_FLAG_INTERLACE;
        if (vm->flags & DISPLAY_FLAGS_DOUBLESCAN)
                dmode->flags |= DRM_MODE_FLAG_DBLSCAN;
+       if (vm->flags & DISPLAY_FLAGS_DOUBLECLK)
+               dmode->flags |= DRM_MODE_FLAG_DBLCLK;
        drm_mode_set_name(dmode);
 
        return 0;
@@ -787,16 +789,17 @@ EXPORT_SYMBOL(drm_mode_set_crtcinfo);
  * LOCKING:
  * None.
  *
- * Copy an existing mode into another mode, preserving the object id
- * of the destination mode.
+ * Copy an existing mode into another mode, preserving the object id and
+ * list head of the destination mode.
  */
 void drm_mode_copy(struct drm_display_mode *dst, const struct drm_display_mode *src)
 {
        int id = dst->base.id;
+       struct list_head head = dst->head;
 
        *dst = *src;
        dst->base.id = id;
-       INIT_LIST_HEAD(&dst->head);
+       dst->head = head;
 }
 EXPORT_SYMBOL(drm_mode_copy);
 
@@ -1017,6 +1020,11 @@ static int drm_mode_compare(void *priv, struct list_head *lh_a, struct list_head
        diff = b->hdisplay * b->vdisplay - a->hdisplay * a->vdisplay;
        if (diff)
                return diff;
+
+       diff = b->vrefresh - a->vrefresh;
+       if (diff)
+               return diff;
+
        diff = b->clock - a->clock;
        return diff;
 }