Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754476AbbDTJ60 (ORCPT ); Mon, 20 Apr 2015 05:58:26 -0400 Received: from mail.fireflyinternet.com ([87.106.93.118]:54532 "EHLO fireflyinternet.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753921AbbDTJ6Z (ORCPT ); Mon, 20 Apr 2015 05:58:25 -0400 X-Default-Received-SPF: pass (skip=forwardok (res=PASS)) x-ip-name=78.156.65.138; Date: Mon, 20 Apr 2015 10:58:18 +0100 From: Chris Wilson To: Radek =?iso-8859-1?Q?Dost=E1l?= , airlied@linux.ie, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: Re: [PATCHv2] drm: fb_helper: prefer to use mode, which is not DRM_MODE_TYPE_USERDEF Message-ID: <20150420095818.GE25451@nuc-i3427.alporthouse.com> Mail-Followup-To: Chris Wilson , Radek =?iso-8859-1?Q?Dost=E1l?= , airlied@linux.ie, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org References: <1429477553-10294-1-git-send-email-rd@radekdostal.com> <1429507593-21172-1-git-send-email-rd@radekdostal.com> <20150420090929.GC25451@nuc-i3427.alporthouse.com> <5534C884.8080101@radekdostal.com> <20150420094608.GD25451@nuc-i3427.alporthouse.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20150420094608.GD25451@nuc-i3427.alporthouse.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2427 Lines: 58 On Mon, Apr 20, 2015 at 10:46:08AM +0100, Chris Wilson wrote: > 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; Hmm, so that should be before the clock comparison as well to fix your example. Not as neat. The other idea I was considering was not adding the GTF cmdline mode if the probed modes already contain one of a matching resolution. The goal here is to also not present a mode to userspace that is invalid. -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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/