lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150420094608.GD25451@nuc-i3427.alporthouse.com>
Date:	Mon, 20 Apr 2015 10:46:08 +0100
From:	Chris Wilson <chris@...is-wilson.co.uk>
To:	Radek Dostál <rd@...ekdostal.com>
Cc:	airlied@...ux.ie, dri-devel@...ts.freedesktop.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCHv2] drm: fb_helper: prefer to use mode, which is not
 DRM_MODE_TYPE_USERDEF

On Mon, Apr 20, 2015 at 11:36:04AM +0200, Radek Dostál wrote:
> Hi Chris,
> 
> On 04/20/2015 11:09 AM, Chris Wilson wrote:
> > The EDID modes should be earlier in the list, and so higher priority
> > than the cmdline mode. The only instance I see that breaking down is if
> > the mode gets created by drm_pick_cmdline_mode, i.e.
> 
> indeed at the beginning the command line mode is added to the end of the
> list, but later on it seems to me that all modes are reordered based on
> the resolution and clock and than mode generated by
> drm_helper_probe_add_cmdline_mode gets upper in the list as it has
> higher clock value. Please see attached output of dmesg.

Ah thanks, drm_mode_sort()!

diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
index 213b11e..9c8357f 100644
--- a/drivers/gpu/drm/drm_modes.c
+++ b/drivers/gpu/drm/drm_modes.c
@@ -1127,6 +1127,7 @@ static int drm_mode_compare(void *priv, struct list_head *lh_a, struct list_head
                ((a->type & DRM_MODE_TYPE_PREFERRED) != 0);
        if (diff)
                return diff;
+
        diff = b->hdisplay * b->vdisplay - a->hdisplay * a->vdisplay;
        if (diff)
                return diff;
@@ -1136,7 +1137,16 @@ static int drm_mode_compare(void *priv, struct list_head *lh_a, struct list_head
                return diff;
 
        diff = b->clock - a->clock;
-       return diff;
+       if (diff)
+              return diff;
+
+       /* sort user-defined modes after reported modes of same resolution */
+       diff = ((a->type & DRM_MODE_TYPE_USERDEF) != 0) -
+               ((b->type & DRM_MODE_TYPE_USERDEF) != 0);
+       if (diff)
+               return diff;
+
+       return 0;
 }

Perhaps?
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ