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: <197d195f-9206-41dd-8ff1-f4bb4988fb9b@amd.com>
Date: Wed, 29 May 2024 09:45:55 -0500
From: Mario Limonciello <mario.limonciello@....com>
To: Ville Syrjälä <ville.syrjala@...ux.intel.com>
Cc: dri-devel@...ts.freedesktop.org, amd-gfx@...ts.freedesktop.org,
 Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
 Maxime Ripard <mripard@...nel.org>, Thomas Zimmermann <tzimmermann@...e.de>,
 David Airlie <airlied@...il.com>, Daniel Vetter <daniel@...ll.ch>,
 linux-kernel@...r.kernel.org, Chris Bainbridge <chris.bainbridge@...il.com>,
 hughsient@...il.com
Subject: Re: [PATCH v2] drm/client: Detect when ACPI lid is closed during
 initialization

On 5/29/2024 09:14, Ville Syrjälä wrote:
> On Tue, May 28, 2024 at 04:03:19PM -0500, Mario Limonciello wrote:
>> If the lid on a laptop is closed when eDP connectors are populated
>> then it remains enabled when the initial framebuffer configuration
>> is built.
>>
>> When creating the initial framebuffer configuration detect the ACPI
>> lid status and if it's closed disable any eDP connectors.
>>
>> Reported-by: Chris Bainbridge <chris.bainbridge@...il.com>
>> Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/3349
>> Signed-off-by: Mario Limonciello <mario.limonciello@....com>
>> ---
>> Cc: hughsient@...il.com
>> v1->v2:
>>   * Match LVDS as well
>> ---
>>   drivers/gpu/drm/drm_client_modeset.c | 30 ++++++++++++++++++++++++++++
>>   1 file changed, 30 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/drm_client_modeset.c b/drivers/gpu/drm/drm_client_modeset.c
>> index 31af5cf37a09..0b0411086e76 100644
>> --- a/drivers/gpu/drm/drm_client_modeset.c
>> +++ b/drivers/gpu/drm/drm_client_modeset.c
>> @@ -8,6 +8,7 @@
>>    */
>>   
>>   #include "drm/drm_modeset_lock.h"
>> +#include <acpi/button.h>
>>   #include <linux/module.h>
>>   #include <linux/mutex.h>
>>   #include <linux/slab.h>
>> @@ -257,6 +258,34 @@ static void drm_client_connectors_enabled(struct drm_connector **connectors,
>>   		enabled[i] = drm_connector_enabled(connectors[i], false);
>>   }
>>   
>> +static void drm_client_match_edp_lid(struct drm_device *dev,
>> +				     struct drm_connector **connectors,
>> +				     unsigned int connector_count,
>> +				     bool *enabled)
>> +{
>> +	int i;
>> +
>> +	for (i = 0; i < connector_count; i++) {
>> +		struct drm_connector *connector = connectors[i];
>> +
>> +		switch (connector->connector_type) {
>> +		case DRM_MODE_CONNECTOR_LVDS:
>> +		case DRM_MODE_CONNECTOR_eDP:
>> +			if (!enabled[i])
>> +				continue;
>> +			break;
>> +		default:
>> +			continue;
>> +		}
>> +
>> +		if (!acpi_lid_open()) {
>> +			drm_dbg_kms(dev, "[CONNECTOR:%d:%s] lid is closed, disabling\n",
>> +				    connector->base.id, connector->name);
>> +			enabled[i] = false;
>> +		}
>> +	}
>> +}
> 
> If you don't hook into some lid notify event how is one supposed to get
> the display back to life after opening the lid?

I guess in my mind it's a tangential to the "initial modeset".  The DRM 
master can issue a modeset to enable the combination as desired.

When I tested I did confirm that with mutter such an event is received 
and it does the modeset to enable the eDP when lid is opened.

Let me ask this - what happens if no DRM master running and you hotplug 
a DP cable?  Does a "new" clone configuration get done?
> 
>> +
>>   static bool drm_client_target_cloned(struct drm_device *dev,
>>   				     struct drm_connector **connectors,
>>   				     unsigned int connector_count,
>> @@ -844,6 +873,7 @@ int drm_client_modeset_probe(struct drm_client_dev *client, unsigned int width,
>>   		memset(crtcs, 0, connector_count * sizeof(*crtcs));
>>   		memset(offsets, 0, connector_count * sizeof(*offsets));
>>   
>> +		drm_client_match_edp_lid(dev, connectors, connector_count, enabled);
>>   		if (!drm_client_target_cloned(dev, connectors, connector_count, modes,
>>   					      offsets, enabled, width, height) &&
>>   		    !drm_client_target_preferred(dev, connectors, connector_count, modes,
>> -- 
>> 2.43.0
> 


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ