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: <8ea03441-b835-f5db-5cc3-85e5330dfe3f@quicinc.com>
Date:   Fri, 6 May 2022 09:33:02 -0700
From:   Abhinav Kumar <quic_abhinavk@...cinc.com>
To:     Jani Nikula <jani.nikula@...ux.intel.com>,
        Doug Anderson <dianders@...omium.org>,
        dri-devel <dri-devel@...ts.freedesktop.org>,
        Ville Syrjälä <ville.syrjala@...ux.intel.com>
CC:     Sankeerth Billakanti <quic_sbillaka@...cinc.com>,
        Thomas Zimmermann <tzimmermann@...e.de>,
        David Airlie <airlied@...ux.ie>,
        linux-arm-msm <linux-arm-msm@...r.kernel.org>,
        Stephen Boyd <swboyd@...omium.org>,
        "Dmitry Baryshkov" <dmitry.baryshkov@...aro.org>,
        "Aravind Venkateswaran (QUIC)" <quic_aravindh@...cinc.com>,
        "Kuogee Hsieh (QUIC)" <quic_khsieh@...cinc.com>,
        LKML <linux-kernel@...r.kernel.org>
Subject: Re: [RFC PATCH] drm/edid: drm_add_modes_noedid() should set lowest
 resolution as preferred

Hi Jani

On 5/6/2022 4:16 AM, Jani Nikula wrote:
> On Thu, 05 May 2022, Doug Anderson <dianders@...omium.org> wrote:
>> Ville,
>>
>> On Tue, Apr 26, 2022 at 1:21 PM Douglas Anderson <dianders@...omium.org> wrote:
>>>
>>> If we're unable to read the EDID for a display because it's corrupt /
>>> bogus / invalid then we'll add a set of standard modes for the
>>> display. When userspace looks at these modes it doesn't really have a
>>> good concept for which mode to pick and it'll likely pick the highest
>>> resolution one by default. That's probably not ideal because the modes
>>> were purely guesses on the part of the Linux kernel.
>>>
>>> Let's instead set 640x480 as the "preferred" mode when we have no EDID.
>>>
>>> Signed-off-by: Douglas Anderson <dianders@...omium.org>
>>> ---
>>>
>>>   drivers/gpu/drm/drm_edid.c | 9 +++++++++
>>>   1 file changed, 9 insertions(+)
>>
>> Someone suggested that you might have an opinion on this patch and
>> another one I posted recently [1]. Do you have any thoughts on it?
>> Just to be clear: I'm hoping to land _both_ this patch and [1]. If you
>> don't have an opinion, that's OK too.
>>
>> [1] https://lore.kernel.org/r/20220426114627.2.I4ac7f55aa446699f8c200a23c10463256f6f439f@changeid
> 
> There are a number of drivers with combos:
> 
> 	drm_add_modes_noedid()
> 	drm_set_preferred_mode()
> 
> which I think would be affected by the change. Perhaps you should just
> call drm_set_preferred_mode() in your referenced patch?
> So it seems like many drivers handle the !edid case within their 
respective get_modes() call which probably is because they know the max 
capability of their connector and because they know which mode should be 
set as preferred. But at the same time, perhaps the code below which 
handles the count == 0 case should be changed like below to make sure we 
are within the max_width/height of the connector (to handle the first 
condition)?

diff --git a/drivers/gpu/drm/drm_probe_helper.c 
b/drivers/gpu/drm/drm_probe_helper.c
index 682359512996..6eb89d90777b 100644
--- a/drivers/gpu/drm/drm_probe_helper.c
+++ b/drivers/gpu/drm/drm_probe_helper.c
@@ -517,7 +517,8 @@ int drm_helper_probe_single_connector_modes(struct 
drm_connector *connector,

         if (count == 0 && (connector->status == 
connector_status_connected ||
                            connector->status == connector_status_unknown))
-               count = drm_add_modes_noedid(connector, 1024, 768);
+               count = drm_add_modes_noedid(connector, 
connector->dev->mode_config.max_width,
+                               connector->dev->mode_config.max_height);
         count += drm_helper_probe_add_cmdline_mode(connector);
         if (count == 0)
                 goto prune;


> Alternatively, perhaps drm_set_preferred_mode() should erase the
> previous preferred mode(s) if it finds a matching new preferred mode.
> 

But still yes, even if we change it like above perhaps for other non-DP 
cases its still better to allow individual drivers to pick their 
preferred modes.

If we call drm_set_preferred_mode() in the referenced patch, it will not 
address the no EDID cases because the patch comes into picture when 
there was a EDID with some modes but not with 640x480.

So i think the second proposal is a good one. It will cover existing 
users of drm_set_preferred_mode() as typically its called after 
drm_add_modes_noedid() which means the existing users want to "override" 
their preferred mode.

> 
> BR,
> Jani.
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ