All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915: set LVDS connector status to unknown if the lid is closed
@ 2010-08-10 23:16 Andrei Paskevich
  2010-08-11  0:22 ` Alex Deucher
  2010-08-11 13:32 ` Adam Jackson
  0 siblings, 2 replies; 5+ messages in thread
From: Andrei Paskevich @ 2010-08-10 23:16 UTC (permalink / raw)
  To: dri-devel

Currently, the LVDS connector on i915-equipped laptops
is always reported as connected, regardless of the lid 
state and presence of external monitors. This was done
because of too many BIOSes reporting lid status in 
an unreliable way. However, in a quite usual setup of
a laptop attached to an external monitor, the only way 
to obtain the monitor's resolution on boot is to disable 
the LVDS via the boot command line, which is unfortunate 
as one have to reboot to get the internal screen back.

The following patch implements the same scheme as in 
the Nouveau driver: if the lid is reported as closed,
the LVDS connector status is set to unknown, and the
internal screen will be turned on only if there are
no other connected monitors. The ACPI lid status is
not checked if the "i915.ignorelid" parameter is set 
to zero (to account for the buggy BIOSes), which is 
the default value, so that the current behavior does
not change. 

The patch applies to the 2.6.35 kernel.

Best regards,
Andrei

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 423dc90..5206136 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -45,6 +45,9 @@ module_param_named(fbpercrtc, i915_fbpercrtc, int, 0400);
 unsigned int i915_powersave = 1;
 module_param_named(powersave, i915_powersave, int, 0400);
 
+unsigned int i915_ignorelid = 1;
+module_param_named(ignorelid, i915_ignorelid, int, 0400);
+
 unsigned int i915_lvds_downclock = 0;
 module_param_named(lvds_downclock, i915_lvds_downclock, int, 0400);
 
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 2e1744d..a03d344 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -815,6 +815,7 @@ extern struct drm_ioctl_desc i915_ioctls[];
 extern int i915_max_ioctl;
 extern unsigned int i915_fbpercrtc;
 extern unsigned int i915_powersave;
+extern unsigned int i915_ignorelid;
 extern unsigned int i915_lvds_downclock;
 
 extern int i915_suspend(struct drm_device *dev, pm_message_t state);
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
index 0eab8df..85a09c9 100644
--- a/drivers/gpu/drm/i915/intel_lvds.c
+++ b/drivers/gpu/drm/i915/intel_lvds.c
@@ -551,11 +551,8 @@ static enum drm_connector_status intel_lvds_detect(struct drm_connector *connect
 	struct drm_device *dev = connector->dev;
 	enum drm_connector_status status = connector_status_connected;
 
-	/* ACPI lid methods were generally unreliable in this generation, so
-	 * don't even bother.
-	 */
-	if (IS_GEN2(dev) || IS_GEN3(dev))
-		return connector_status_connected;
+	if (!i915_ignorelid && !acpi_lid_open())
+		status = connector_status_unknown;
 
 	return status;
 }

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/i915: set LVDS connector status to unknown if the lid is closed
  2010-08-10 23:16 [PATCH] drm/i915: set LVDS connector status to unknown if the lid is closed Andrei Paskevich
@ 2010-08-11  0:22 ` Alex Deucher
  2010-08-11 11:21   ` Andrei Paskevich
  2010-08-11 13:32 ` Adam Jackson
  1 sibling, 1 reply; 5+ messages in thread
From: Alex Deucher @ 2010-08-11  0:22 UTC (permalink / raw)
  To: Andrei Paskevich; +Cc: dri-devel

On Tue, Aug 10, 2010 at 7:16 PM, Andrei Paskevich <andrei@tertium.org> wrote:
> Currently, the LVDS connector on i915-equipped laptops
> is always reported as connected, regardless of the lid
> state and presence of external monitors. This was done
> because of too many BIOSes reporting lid status in
> an unreliable way. However, in a quite usual setup of
> a laptop attached to an external monitor, the only way
> to obtain the monitor's resolution on boot is to disable
> the LVDS via the boot command line, which is unfortunate
> as one have to reboot to get the internal screen back.
>

This sounds like policy that should be handled in userspace.  One
could argue that the LVDS panel is always connected so it should
always report as connected.  Your desktop manager or whatever can
decide what to light up based on what's connected and the current lid
status.

Alex

> The following patch implements the same scheme as in
> the Nouveau driver: if the lid is reported as closed,
> the LVDS connector status is set to unknown, and the
> internal screen will be turned on only if there are
> no other connected monitors. The ACPI lid status is
> not checked if the "i915.ignorelid" parameter is set
> to zero (to account for the buggy BIOSes), which is
> the default value, so that the current behavior does
> not change.
>
> The patch applies to the 2.6.35 kernel.
>
> Best regards,
> Andrei
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> index 423dc90..5206136 100644
> --- a/drivers/gpu/drm/i915/i915_drv.c
> +++ b/drivers/gpu/drm/i915/i915_drv.c
> @@ -45,6 +45,9 @@ module_param_named(fbpercrtc, i915_fbpercrtc, int, 0400);
>  unsigned int i915_powersave = 1;
>  module_param_named(powersave, i915_powersave, int, 0400);
>
> +unsigned int i915_ignorelid = 1;
> +module_param_named(ignorelid, i915_ignorelid, int, 0400);
> +
>  unsigned int i915_lvds_downclock = 0;
>  module_param_named(lvds_downclock, i915_lvds_downclock, int, 0400);
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 2e1744d..a03d344 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -815,6 +815,7 @@ extern struct drm_ioctl_desc i915_ioctls[];
>  extern int i915_max_ioctl;
>  extern unsigned int i915_fbpercrtc;
>  extern unsigned int i915_powersave;
> +extern unsigned int i915_ignorelid;
>  extern unsigned int i915_lvds_downclock;
>
>  extern int i915_suspend(struct drm_device *dev, pm_message_t state);
> diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
> index 0eab8df..85a09c9 100644
> --- a/drivers/gpu/drm/i915/intel_lvds.c
> +++ b/drivers/gpu/drm/i915/intel_lvds.c
> @@ -551,11 +551,8 @@ static enum drm_connector_status intel_lvds_detect(struct drm_connector *connect
>        struct drm_device *dev = connector->dev;
>        enum drm_connector_status status = connector_status_connected;
>
> -       /* ACPI lid methods were generally unreliable in this generation, so
> -        * don't even bother.
> -        */
> -       if (IS_GEN2(dev) || IS_GEN3(dev))
> -               return connector_status_connected;
> +       if (!i915_ignorelid && !acpi_lid_open())
> +               status = connector_status_unknown;
>
>        return status;
>  }
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/i915: set LVDS connector status to unknown if the lid is closed
  2010-08-11  0:22 ` Alex Deucher
@ 2010-08-11 11:21   ` Andrei Paskevich
  0 siblings, 0 replies; 5+ messages in thread
From: Andrei Paskevich @ 2010-08-11 11:21 UTC (permalink / raw)
  To: Alex Deucher; +Cc: dri-devel

On Wed, Aug 11, 2010 at 2:22 AM, Alex Deucher <alexdeucher@gmail.com> wrote:
> On Tue, Aug 10, 2010 at 7:16 PM, Andrei Paskevich <andrei@tertium.org> wrote:
>> Currently, the LVDS connector on i915-equipped laptops
>> is always reported as connected, regardless of the lid
>> state and presence of external monitors. This was done
>> because of too many BIOSes reporting lid status in
>> an unreliable way. However, in a quite usual setup of
>> a laptop attached to an external monitor, the only way
>> to obtain the monitor's resolution on boot is to disable
>> the LVDS via the boot command line, which is unfortunate
>> as one have to reboot to get the internal screen back.
>>
>
> This sounds like policy that should be handled in userspace.  One
> could argue that the LVDS panel is always connected so it should
> always report as connected.  Your desktop manager or whatever can
> decide what to light up based on what's connected and the current lid
> status.

This can certainly be handled in a desktop manager, as you propose.
The problem is that KMS code will choose the undesired resolution for
the console, well before a desktop manager is started.

I also agree that the LVDS panel is always connected in the proper
sense of the word. What I don't agree with is that every connected
output must be always turned on and configured for some common
resolution, which is almost never what I want (*). Yet the current DRM
implementation does exactly this, and Nouveau provides at least
a good workaround.

Andrei

(*) Except maybe for the case of laptop+beamer, but it is this case
that can and should be treated by one's desktop environment.

>
> Alex
>
>> The following patch implements the same scheme as in
>> the Nouveau driver: if the lid is reported as closed,
>> the LVDS connector status is set to unknown, and the
>> internal screen will be turned on only if there are
>> no other connected monitors. The ACPI lid status is
>> not checked if the "i915.ignorelid" parameter is set
>> to zero (to account for the buggy BIOSes), which is
>> the default value, so that the current behavior does
>> not change.
>>
>> The patch applies to the 2.6.35 kernel.
>>
>> Best regards,
>> Andrei
>>
>> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
>> index 423dc90..5206136 100644
>> --- a/drivers/gpu/drm/i915/i915_drv.c
>> +++ b/drivers/gpu/drm/i915/i915_drv.c
>> @@ -45,6 +45,9 @@ module_param_named(fbpercrtc, i915_fbpercrtc, int, 0400);
>>  unsigned int i915_powersave = 1;
>>  module_param_named(powersave, i915_powersave, int, 0400);
>>
>> +unsigned int i915_ignorelid = 1;
>> +module_param_named(ignorelid, i915_ignorelid, int, 0400);
>> +
>>  unsigned int i915_lvds_downclock = 0;
>>  module_param_named(lvds_downclock, i915_lvds_downclock, int, 0400);
>>
>> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
>> index 2e1744d..a03d344 100644
>> --- a/drivers/gpu/drm/i915/i915_drv.h
>> +++ b/drivers/gpu/drm/i915/i915_drv.h
>> @@ -815,6 +815,7 @@ extern struct drm_ioctl_desc i915_ioctls[];
>>  extern int i915_max_ioctl;
>>  extern unsigned int i915_fbpercrtc;
>>  extern unsigned int i915_powersave;
>> +extern unsigned int i915_ignorelid;
>>  extern unsigned int i915_lvds_downclock;
>>
>>  extern int i915_suspend(struct drm_device *dev, pm_message_t state);
>> diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
>> index 0eab8df..85a09c9 100644
>> --- a/drivers/gpu/drm/i915/intel_lvds.c
>> +++ b/drivers/gpu/drm/i915/intel_lvds.c
>> @@ -551,11 +551,8 @@ static enum drm_connector_status intel_lvds_detect(struct drm_connector *connect
>>        struct drm_device *dev = connector->dev;
>>        enum drm_connector_status status = connector_status_connected;
>>
>> -       /* ACPI lid methods were generally unreliable in this generation, so
>> -        * don't even bother.
>> -        */
>> -       if (IS_GEN2(dev) || IS_GEN3(dev))
>> -               return connector_status_connected;
>> +       if (!i915_ignorelid && !acpi_lid_open())
>> +               status = connector_status_unknown;
>>
>>        return status;
>>  }
>> _______________________________________________
>> dri-devel mailing list
>> dri-devel@lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/dri-devel
>>
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/i915: set LVDS connector status to unknown if the lid is closed
  2010-08-10 23:16 [PATCH] drm/i915: set LVDS connector status to unknown if the lid is closed Andrei Paskevich
  2010-08-11  0:22 ` Alex Deucher
@ 2010-08-11 13:32 ` Adam Jackson
  2010-08-11 14:06   ` Andrei Paskevich
  1 sibling, 1 reply; 5+ messages in thread
From: Adam Jackson @ 2010-08-11 13:32 UTC (permalink / raw)
  To: Andrei Paskevich; +Cc: dri-devel


[-- Attachment #1.1: Type: text/plain, Size: 694 bytes --]

On Wed, 2010-08-11 at 01:16 +0200, Andrei Paskevich wrote:
> Currently, the LVDS connector on i915-equipped laptops
> is always reported as connected, regardless of the lid 
> state and presence of external monitors. This was done
> because of too many BIOSes reporting lid status in 
> an unreliable way. However, in a quite usual setup of
> a laptop attached to an external monitor, the only way 
> to obtain the monitor's resolution on boot is to disable 
> the LVDS via the boot command line, which is unfortunate 
> as one have to reboot to get the internal screen back.

If ACPI lid status were even remotely reliable for Intel machines, this
might be a good idea.

- ajax

[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

[-- Attachment #2: Type: text/plain, Size: 159 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/i915: set LVDS connector status to unknown if the lid is closed
  2010-08-11 13:32 ` Adam Jackson
@ 2010-08-11 14:06   ` Andrei Paskevich
  0 siblings, 0 replies; 5+ messages in thread
From: Andrei Paskevich @ 2010-08-11 14:06 UTC (permalink / raw)
  To: Adam Jackson; +Cc: dri-devel

On Wed, Aug 11, 2010 at 3:32 PM, Adam Jackson <ajax@redhat.com> wrote:
> On Wed, 2010-08-11 at 01:16 +0200, Andrei Paskevich wrote:
>> Currently, the LVDS connector on i915-equipped laptops
>> is always reported as connected, regardless of the lid
>> state and presence of external monitors. This was done
>> because of too many BIOSes reporting lid status in
>> an unreliable way. However, in a quite usual setup of
>> a laptop attached to an external monitor, the only way
>> to obtain the monitor's resolution on boot is to disable
>> the LVDS via the boot command line, which is unfortunate
>> as one have to reboot to get the internal screen back.
>
> If ACPI lid status were even remotely reliable for Intel machines, this
> might be a good idea.

I don't agree: if lid status were reliable, there would be no need for this,
as we could just report a lid-closed LVDS disconnected (as it was done
in intel_lvds.c before). The trick with the "unknown" status is really useful
when ACPI erroneously reports the lid as closed and there are no other
connected monitors.

The purpose of the proposed patch is to provide a correct screen mode
on boot for those Intel laptops which have correct ACPI lid status handling
(and such laptops do exist) without changing the existing behaviour in
the default case.

Andrei

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-08-11 14:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-10 23:16 [PATCH] drm/i915: set LVDS connector status to unknown if the lid is closed Andrei Paskevich
2010-08-11  0:22 ` Alex Deucher
2010-08-11 11:21   ` Andrei Paskevich
2010-08-11 13:32 ` Adam Jackson
2010-08-11 14:06   ` Andrei Paskevich

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.