AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/3] Adjust ACPI video detection fallback path
@ 2022-12-08 16:42 Mario Limonciello
  2022-12-08 16:42 ` [PATCH v3 1/3] ACPI: video: Allow GPU drivers to report no panels Mario Limonciello
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Mario Limonciello @ 2022-12-08 16:42 UTC (permalink / raw)
  To: Rafael J . Wysocki, Alexander Deucher, Hans de Goede
  Cc: linux-acpi, Mario Limonciello, amd-gfx, Daniel Dadap

In kernel 6.1 the backlight registration code was overhauled so that
at most one backlight device got registered. As part of this change
there was code added to still allow making an acpi_video0 device if the
BIOS contained backlight control methods but no native or vendor drivers
registered.

Even after the overhaul this fallback logic is failing on the BIOS from
a number of motherboard manufacturers supporting Ryzen APUs.
What happens is the amdgpu driver finishes registration and as expected
doesn't create a backlight control device since no eDP panels are connected
to a desktop.

Then 8 seconds later the ACPI video detection code creates an
acpi_video0 device that is non-operational. GNOME then creates a
backlight slider.

To avoid this situation from happening make two sets of changes:

Prevent desktop problems w/ fallback logic
------------------------------------------
1) Add support for the video detect code to let native drivers cancel the
fallback logic if they didn't find a panel.

This is done this way so that if another driver decides that the ACPI
mechanism is still needed it can instead directly call the registration
function.

2) Add code to amdgpu to notify the ACPI video detection code that no panel
was detected on an APU.

Disable fallback logic by default
---------------------------------
This fallback logic was introduced to prevent regressions in the backlight
overhaul.  As it has been deemed unnecessary by Hans explicitly disable the
timeout.  If this turns out to be mistake and this part is reverted, the
other patches for preventing desktop problems will avoid regressions on
desktops.

Mario Limonciello (3):
  ACPI: video: Allow GPU drivers to report no panels
  drm/amd/display: Report to ACPI video if no panels were found
  ACPI: video: Don't enable fallback path for creating ACPI backlight by
    default

 drivers/acpi/acpi_video.c                       | 17 ++++++++++++-----
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c   |  4 ++++
 include/acpi/video.h                            |  2 ++
 3 files changed, 18 insertions(+), 5 deletions(-)

-- 
2.34.1


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

* [PATCH v3 1/3] ACPI: video: Allow GPU drivers to report no panels
  2022-12-08 16:42 [PATCH v3 0/3] Adjust ACPI video detection fallback path Mario Limonciello
@ 2022-12-08 16:42 ` Mario Limonciello
  2022-12-08 17:49   ` Daniel Dadap
  2022-12-08 16:42 ` [PATCH v3 2/3] drm/amd/display: Report to ACPI video if no panels were found Mario Limonciello
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 10+ messages in thread
From: Mario Limonciello @ 2022-12-08 16:42 UTC (permalink / raw)
  To: Rafael J . Wysocki, Alexander Deucher, Hans de Goede
  Cc: linux-acpi, Mario Limonciello, amd-gfx, Daniel Dadap

The current logic for the ACPI backlight detection will create
a backlight device if no native or vendor drivers have created
8 seconds after the system has booted if the ACPI tables
included backlight control methods.

If the GPU drivers have loaded, they may be able to report whether
any LCD panels were found.  Allow using this information to factor
in whether to enable the fallback logic for making an acpi_video0
backlight device.

Suggested-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
---
v2->v3:
 * Add Hans' R-b
 * Add missing declaration for non CONFIG_ACPI_VIDEO case
v1->v2:
 * Cancel registration for backlight device instead (Hans)
 * drop desktop check (Dan)
---
 drivers/acpi/acpi_video.c | 11 +++++++++++
 include/acpi/video.h      |  2 ++
 2 files changed, 13 insertions(+)

diff --git a/drivers/acpi/acpi_video.c b/drivers/acpi/acpi_video.c
index 32953646caeb..f64fdb029090 100644
--- a/drivers/acpi/acpi_video.c
+++ b/drivers/acpi/acpi_video.c
@@ -2178,6 +2178,17 @@ static bool should_check_lcd_flag(void)
 	return false;
 }
 
+/*
+ * At least one graphics driver has reported that no LCD is connected
+ * via the native interface. cancel the registration for fallback acpi_video0.
+ * If another driver still deems this necessary, it can explicitly register it.
+ */
+void acpi_video_report_nolcd(void)
+{
+	cancel_delayed_work(&video_bus_register_backlight_work);
+}
+EXPORT_SYMBOL(acpi_video_report_nolcd);
+
 int acpi_video_register(void)
 {
 	int ret = 0;
diff --git a/include/acpi/video.h b/include/acpi/video.h
index a275c35e5249..a56c8d45e9f8 100644
--- a/include/acpi/video.h
+++ b/include/acpi/video.h
@@ -53,6 +53,7 @@ enum acpi_backlight_type {
 };
 
 #if IS_ENABLED(CONFIG_ACPI_VIDEO)
+extern void acpi_video_report_nolcd(void);
 extern int acpi_video_register(void);
 extern void acpi_video_unregister(void);
 extern void acpi_video_register_backlight(void);
@@ -69,6 +70,7 @@ extern int acpi_video_get_levels(struct acpi_device *device,
 				 struct acpi_video_device_brightness **dev_br,
 				 int *pmax_level);
 #else
+static inline void acpi_video_report_nolcd(void) { return; };
 static inline int acpi_video_register(void) { return -ENODEV; }
 static inline void acpi_video_unregister(void) { return; }
 static inline void acpi_video_register_backlight(void) { return; }
-- 
2.34.1


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

* [PATCH v3 2/3] drm/amd/display: Report to ACPI video if no panels were found
  2022-12-08 16:42 [PATCH v3 0/3] Adjust ACPI video detection fallback path Mario Limonciello
  2022-12-08 16:42 ` [PATCH v3 1/3] ACPI: video: Allow GPU drivers to report no panels Mario Limonciello
@ 2022-12-08 16:42 ` Mario Limonciello
  2023-01-03 20:14   ` Harry Wentland
  2022-12-08 16:42 ` [PATCH v3 3/3] ACPI: video: Don't enable fallback path for creating ACPI backlight by default Mario Limonciello
  2022-12-15 19:20 ` [PATCH v3 0/3] Adjust ACPI video detection fallback path Limonciello, Mario
  3 siblings, 1 reply; 10+ messages in thread
From: Mario Limonciello @ 2022-12-08 16:42 UTC (permalink / raw)
  To: Rafael J . Wysocki, Alexander Deucher, Hans de Goede
  Cc: linux-acpi, Mario Limonciello, amd-gfx, Daniel Dadap

On desktop APUs amdgpu doesn't create a native backlight device
as no eDP panels are found.  However if the BIOS has reported
backlight control methods in the ACPI tables then an acpi_video0
backlight device will be made 8 seconds after boot.

This has manifested in a power slider on a number of desktop APUs
ranging from Ryzen 5000 through Ryzen 7000 on various motherboard
manufacturers. To avoid this, report to the acpi video detection
that the system does not have any panel connected in the native
driver.

Link: https://bugzilla.redhat.com/show_bug.cgi?id=1783786
Reported-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
---
v2->v3:
 * Add Hans' R-b
v1->v2:
 * No changes
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 512c32327eb1..b73f61ac5dd5 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -4371,6 +4371,10 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev)
 		amdgpu_set_panel_orientation(&aconnector->base);
 	}
 
+	/* If we didn't find a panel, notify the acpi video detection */
+	if (dm->adev->flags & AMD_IS_APU && dm->num_of_edps == 0)
+		acpi_video_report_nolcd();
+
 	/* Software is initialized. Now we can register interrupt handlers. */
 	switch (adev->asic_type) {
 #if defined(CONFIG_DRM_AMD_DC_SI)
-- 
2.34.1


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

* [PATCH v3 3/3] ACPI: video: Don't enable fallback path for creating ACPI backlight by default
  2022-12-08 16:42 [PATCH v3 0/3] Adjust ACPI video detection fallback path Mario Limonciello
  2022-12-08 16:42 ` [PATCH v3 1/3] ACPI: video: Allow GPU drivers to report no panels Mario Limonciello
  2022-12-08 16:42 ` [PATCH v3 2/3] drm/amd/display: Report to ACPI video if no panels were found Mario Limonciello
@ 2022-12-08 16:42 ` Mario Limonciello
  2022-12-15 19:20 ` [PATCH v3 0/3] Adjust ACPI video detection fallback path Limonciello, Mario
  3 siblings, 0 replies; 10+ messages in thread
From: Mario Limonciello @ 2022-12-08 16:42 UTC (permalink / raw)
  To: Rafael J . Wysocki, Alexander Deucher, Hans de Goede
  Cc: linux-acpi, Mario Limonciello, amd-gfx, Daniel Dadap

The ACPI video detection code has a module parameter
`register_backlight_delay` which is currently configured to 8 seconds.
This means that if after 8 seconds of booting no native driver has created
a backlight device then the code will attempt to make an ACPI video
backlight device.

This was intended as a safety mechanism with the backlight overhaul that
occurred in kernel 6.1, but as it doesn't appear necesssary set it to be
disabled by default.

Suggested-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
---
v2->v3:
 * Add Hans' R-b
v1->v2:
 * New patch
---
 drivers/acpi/acpi_video.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/acpi/acpi_video.c b/drivers/acpi/acpi_video.c
index f64fdb029090..0c79f463fbfd 100644
--- a/drivers/acpi/acpi_video.c
+++ b/drivers/acpi/acpi_video.c
@@ -70,11 +70,7 @@ module_param(device_id_scheme, bool, 0444);
 static int only_lcd = -1;
 module_param(only_lcd, int, 0444);
 
-/*
- * Display probing is known to take up to 5 seconds, so delay the fallback
- * backlight registration by 5 seconds + 3 seconds for some extra margin.
- */
-static int register_backlight_delay = 8;
+static int register_backlight_delay;
 module_param(register_backlight_delay, int, 0444);
 MODULE_PARM_DESC(register_backlight_delay,
 	"Delay in seconds before doing fallback (non GPU driver triggered) "
-- 
2.34.1


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

* Re: [PATCH v3 1/3] ACPI: video: Allow GPU drivers to report no panels
  2022-12-08 16:42 ` [PATCH v3 1/3] ACPI: video: Allow GPU drivers to report no panels Mario Limonciello
@ 2022-12-08 17:49   ` Daniel Dadap
  2022-12-08 17:56     ` Limonciello, Mario
  0 siblings, 1 reply; 10+ messages in thread
From: Daniel Dadap @ 2022-12-08 17:49 UTC (permalink / raw)
  To: Mario Limonciello
  Cc: Alexander Deucher, Hans de Goede, linux-acpi, amd-gfx,
	Rafael J . Wysocki

On Thu, Dec 08, 2022 at 10:42:05AM -0600, Mario Limonciello wrote:
> The current logic for the ACPI backlight detection will create
> a backlight device if no native or vendor drivers have created
> 8 seconds after the system has booted if the ACPI tables
> included backlight control methods.
> 
> If the GPU drivers have loaded, they may be able to report whether
> any LCD panels were found.  Allow using this information to factor
> in whether to enable the fallback logic for making an acpi_video0
> backlight device.
> 
> Suggested-by: Hans de Goede <hdegoede@redhat.com>
> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
> ---
> v2->v3:
>  * Add Hans' R-b
>  * Add missing declaration for non CONFIG_ACPI_VIDEO case
> v1->v2:
>  * Cancel registration for backlight device instead (Hans)
>  * drop desktop check (Dan)
> ---
>  drivers/acpi/acpi_video.c | 11 +++++++++++
>  include/acpi/video.h      |  2 ++
>  2 files changed, 13 insertions(+)
> 
> diff --git a/drivers/acpi/acpi_video.c b/drivers/acpi/acpi_video.c
> index 32953646caeb..f64fdb029090 100644
> --- a/drivers/acpi/acpi_video.c
> +++ b/drivers/acpi/acpi_video.c
> @@ -2178,6 +2178,17 @@ static bool should_check_lcd_flag(void)
>  	return false;
>  }
>  
> +/*
> + * At least one graphics driver has reported that no LCD is connected
> + * via the native interface. cancel the registration for fallback acpi_video0.
> + * If another driver still deems this necessary, it can explicitly register it.
> + */
> +void acpi_video_report_nolcd(void)
> +{
> +	cancel_delayed_work(&video_bus_register_backlight_work);
> +}
> +EXPORT_SYMBOL(acpi_video_report_nolcd);
> +

Thanks for removing the desktop check.

It's not entirely clear to me what happens if you try to cancel a
delayed work that was never scheduled. I got as far as determining that
del_timer() in kernel/time/timer.c will probably return 0, but I didn't
really feel like walking through the rest of try_to_grab_pending() to
figure out what happens next. You've probably already tested this with
the default disabled timer, so as long as nothing bad happened there,
this seems fine.

This is probably overly complicated, so if you think it's worth doing, I
would definitely add it later, but I wonder if it might make sense to
pass an acpi_handle to a _BC[LM] method or one of its parents, so that
this could be scoped to a particular device. Looking at the ACPI table
dump from a random multi-GPU laptop, it looks like there are two
instances of _BCL, one under _SB.GP<number>.VGA.LCD for the iGPU, and
the other under _SB.PCI<num>.GPP<num>.PEGP.EDP<num> for the dGPU. The
caller would pass in handles for methods/devices that it will handle,
and then the fallback, if it runs at all, would skip any handles that
were registered with it when it crawls for _BC[LM]. Or the equivalent
inverse logic, or something else like that. I think it's probably fine
to keep the current unscoped design and just assert that any other GPU
drivers that want the ACPI video driver to handle panel backlight should
register it explicitly; if for some reason that ends up not working out,
we could revisit scoping it then.

>  int acpi_video_register(void)
>  {
>  	int ret = 0;
> diff --git a/include/acpi/video.h b/include/acpi/video.h
> index a275c35e5249..a56c8d45e9f8 100644
> --- a/include/acpi/video.h
> +++ b/include/acpi/video.h
> @@ -53,6 +53,7 @@ enum acpi_backlight_type {
>  };
>  
>  #if IS_ENABLED(CONFIG_ACPI_VIDEO)
> +extern void acpi_video_report_nolcd(void);
>  extern int acpi_video_register(void);
>  extern void acpi_video_unregister(void);
>  extern void acpi_video_register_backlight(void);
> @@ -69,6 +70,7 @@ extern int acpi_video_get_levels(struct acpi_device *device,
>  				 struct acpi_video_device_brightness **dev_br,
>  				 int *pmax_level);
>  #else
> +static inline void acpi_video_report_nolcd(void) { return; };
>  static inline int acpi_video_register(void) { return -ENODEV; }
>  static inline void acpi_video_unregister(void) { return; }
>  static inline void acpi_video_register_backlight(void) { return; }
> -- 
> 2.34.1
> 

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

* Re: [PATCH v3 1/3] ACPI: video: Allow GPU drivers to report no panels
  2022-12-08 17:49   ` Daniel Dadap
@ 2022-12-08 17:56     ` Limonciello, Mario
  0 siblings, 0 replies; 10+ messages in thread
From: Limonciello, Mario @ 2022-12-08 17:56 UTC (permalink / raw)
  To: Daniel Dadap
  Cc: Alexander Deucher, Hans de Goede, linux-acpi, amd-gfx,
	Rafael J . Wysocki

On 12/8/2022 11:49, Daniel Dadap wrote:
> On Thu, Dec 08, 2022 at 10:42:05AM -0600, Mario Limonciello wrote:
>> The current logic for the ACPI backlight detection will create
>> a backlight device if no native or vendor drivers have created
>> 8 seconds after the system has booted if the ACPI tables
>> included backlight control methods.
>>
>> If the GPU drivers have loaded, they may be able to report whether
>> any LCD panels were found.  Allow using this information to factor
>> in whether to enable the fallback logic for making an acpi_video0
>> backlight device.
>>
>> Suggested-by: Hans de Goede <hdegoede@redhat.com>
>> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
>> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
>> ---
>> v2->v3:
>>   * Add Hans' R-b
>>   * Add missing declaration for non CONFIG_ACPI_VIDEO case
>> v1->v2:
>>   * Cancel registration for backlight device instead (Hans)
>>   * drop desktop check (Dan)
>> ---
>>   drivers/acpi/acpi_video.c | 11 +++++++++++
>>   include/acpi/video.h      |  2 ++
>>   2 files changed, 13 insertions(+)
>>
>> diff --git a/drivers/acpi/acpi_video.c b/drivers/acpi/acpi_video.c
>> index 32953646caeb..f64fdb029090 100644
>> --- a/drivers/acpi/acpi_video.c
>> +++ b/drivers/acpi/acpi_video.c
>> @@ -2178,6 +2178,17 @@ static bool should_check_lcd_flag(void)
>>   	return false;
>>   }
>>   
>> +/*
>> + * At least one graphics driver has reported that no LCD is connected
>> + * via the native interface. cancel the registration for fallback acpi_video0.
>> + * If another driver still deems this necessary, it can explicitly register it.
>> + */
>> +void acpi_video_report_nolcd(void)
>> +{
>> +	cancel_delayed_work(&video_bus_register_backlight_work);
>> +}
>> +EXPORT_SYMBOL(acpi_video_report_nolcd);
>> +
> 
> Thanks for removing the desktop check.

Sure.

> 
> It's not entirely clear to me what happens if you try to cancel a
> delayed work that was never scheduled. I got as far as determining that
> del_timer() in kernel/time/timer.c will probably return 0, but I didn't
> really feel like walking through the rest of try_to_grab_pending() to
> figure out what happens next. You've probably already tested this with
> the default disabled timer, so as long as nothing bad happened there,
> this seems fine.
> 

Yeah; I did test it and nothing blew up during my test.

> This is probably overly complicated, so if you think it's worth doing, I
> would definitely add it later, but I wonder if it might make sense to
> pass an acpi_handle to a _BC[LM] method or one of its parents, so that
> this could be scoped to a particular device. Looking at the ACPI table
> dump from a random multi-GPU laptop, it looks like there are two
> instances of _BCL, one under _SB.GP<number>.VGA.LCD for the iGPU, and
> the other under _SB.PCI<num>.GPP<num>.PEGP.EDP<num> for the dGPU. The
> caller would pass in handles for methods/devices that it will handle,
> and then the fallback, if it runs at all, would skip any handles that
> were registered with it when it crawls for _BC[LM]. Or the equivalent
> inverse logic, or something else like that. I think it's probably fine
> to keep the current unscoped design and just assert that any other GPU
> drivers that want the ACPI video driver to handle panel backlight should
> register it explicitly; if for some reason that ends up not working out,
> we could revisit scoping it then.

Yeah that is a lot more complex but complete setup.  I think if we end 
up having to revert the 3rd patch and having GPU drivers call the 
registration explicitly isn't a good idea for some reason it's worth 
considering.

> 
>>   int acpi_video_register(void)
>>   {
>>   	int ret = 0;
>> diff --git a/include/acpi/video.h b/include/acpi/video.h
>> index a275c35e5249..a56c8d45e9f8 100644
>> --- a/include/acpi/video.h
>> +++ b/include/acpi/video.h
>> @@ -53,6 +53,7 @@ enum acpi_backlight_type {
>>   };
>>   
>>   #if IS_ENABLED(CONFIG_ACPI_VIDEO)
>> +extern void acpi_video_report_nolcd(void);
>>   extern int acpi_video_register(void);
>>   extern void acpi_video_unregister(void);
>>   extern void acpi_video_register_backlight(void);
>> @@ -69,6 +70,7 @@ extern int acpi_video_get_levels(struct acpi_device *device,
>>   				 struct acpi_video_device_brightness **dev_br,
>>   				 int *pmax_level);
>>   #else
>> +static inline void acpi_video_report_nolcd(void) { return; };
>>   static inline int acpi_video_register(void) { return -ENODEV; }
>>   static inline void acpi_video_unregister(void) { return; }
>>   static inline void acpi_video_register_backlight(void) { return; }
>> -- 
>> 2.34.1
>>


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

* RE: [PATCH v3 0/3] Adjust ACPI video detection fallback path
  2022-12-08 16:42 [PATCH v3 0/3] Adjust ACPI video detection fallback path Mario Limonciello
                   ` (2 preceding siblings ...)
  2022-12-08 16:42 ` [PATCH v3 3/3] ACPI: video: Don't enable fallback path for creating ACPI backlight by default Mario Limonciello
@ 2022-12-15 19:20 ` Limonciello, Mario
  2022-12-15 19:38   ` Rafael J. Wysocki
  3 siblings, 1 reply; 10+ messages in thread
From: Limonciello, Mario @ 2022-12-15 19:20 UTC (permalink / raw)
  To: Rafael J . Wysocki, Deucher, Alexander, Hans de Goede
  Cc: linux-acpi@vger.kernel.org, amd-gfx@lists.freedesktop.org,
	Daniel Dadap

[Public]

> -----Original Message-----
> From: Limonciello, Mario <Mario.Limonciello@amd.com>
> Sent: Thursday, December 8, 2022 10:42
> To: Rafael J . Wysocki <rafael@kernel.org>; Deucher, Alexander
> <Alexander.Deucher@amd.com>; Hans de Goede
> <hdegoede@redhat.com>
> Cc: amd-gfx@lists.freedesktop.org; linux-acpi@vger.kernel.org; Daniel
> Dadap <ddadap@nvidia.com>; Limonciello, Mario
> <Mario.Limonciello@amd.com>
> Subject: [PATCH v3 0/3] Adjust ACPI video detection fallback path
> 
> In kernel 6.1 the backlight registration code was overhauled so that
> at most one backlight device got registered. As part of this change
> there was code added to still allow making an acpi_video0 device if the
> BIOS contained backlight control methods but no native or vendor drivers
> registered.
> 
> Even after the overhaul this fallback logic is failing on the BIOS from
> a number of motherboard manufacturers supporting Ryzen APUs.
> What happens is the amdgpu driver finishes registration and as expected
> doesn't create a backlight control device since no eDP panels are connected
> to a desktop.
> 
> Then 8 seconds later the ACPI video detection code creates an
> acpi_video0 device that is non-operational. GNOME then creates a
> backlight slider.
> 
> To avoid this situation from happening make two sets of changes:
> 
> Prevent desktop problems w/ fallback logic
> ------------------------------------------
> 1) Add support for the video detect code to let native drivers cancel the
> fallback logic if they didn't find a panel.
> 
> This is done this way so that if another driver decides that the ACPI
> mechanism is still needed it can instead directly call the registration
> function.
> 
> 2) Add code to amdgpu to notify the ACPI video detection code that no panel
> was detected on an APU.
> 
> Disable fallback logic by default
> ---------------------------------
> This fallback logic was introduced to prevent regressions in the backlight
> overhaul.  As it has been deemed unnecessary by Hans explicitly disable the
> timeout.  If this turns out to be mistake and this part is reverted, the
> other patches for preventing desktop problems will avoid regressions on
> desktops.
> 
> Mario Limonciello (3):
>   ACPI: video: Allow GPU drivers to report no panels
>   drm/amd/display: Report to ACPI video if no panels were found
>   ACPI: video: Don't enable fallback path for creating ACPI backlight by
>     default
> 
>  drivers/acpi/acpi_video.c                       | 17 ++++++++++++-----
>  .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c   |  4 ++++
>  include/acpi/video.h                            |  2 ++
>  3 files changed, 18 insertions(+), 5 deletions(-)
> 
> --
> 2.34.1

FYI, besides me, this series also tested successfully by one of the
reporters to the Red Hat bugzilla.

https://bugzilla.redhat.com/show_bug.cgi?id=1783786#c8

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

* Re: [PATCH v3 0/3] Adjust ACPI video detection fallback path
  2022-12-15 19:20 ` [PATCH v3 0/3] Adjust ACPI video detection fallback path Limonciello, Mario
@ 2022-12-15 19:38   ` Rafael J. Wysocki
  2022-12-22 16:42     ` Rafael J. Wysocki
  0 siblings, 1 reply; 10+ messages in thread
From: Rafael J. Wysocki @ 2022-12-15 19:38 UTC (permalink / raw)
  To: Limonciello, Mario
  Cc: Daniel Dadap, linux-acpi@vger.kernel.org, Rafael J . Wysocki,
	amd-gfx@lists.freedesktop.org, Hans de Goede, Deucher, Alexander

On Thu, Dec 15, 2022 at 8:20 PM Limonciello, Mario
<Mario.Limonciello@amd.com> wrote:
>
> [Public]
>
> > -----Original Message-----
> > From: Limonciello, Mario <Mario.Limonciello@amd.com>
> > Sent: Thursday, December 8, 2022 10:42
> > To: Rafael J . Wysocki <rafael@kernel.org>; Deucher, Alexander
> > <Alexander.Deucher@amd.com>; Hans de Goede
> > <hdegoede@redhat.com>
> > Cc: amd-gfx@lists.freedesktop.org; linux-acpi@vger.kernel.org; Daniel
> > Dadap <ddadap@nvidia.com>; Limonciello, Mario
> > <Mario.Limonciello@amd.com>
> > Subject: [PATCH v3 0/3] Adjust ACPI video detection fallback path
> >
> > In kernel 6.1 the backlight registration code was overhauled so that
> > at most one backlight device got registered. As part of this change
> > there was code added to still allow making an acpi_video0 device if the
> > BIOS contained backlight control methods but no native or vendor drivers
> > registered.
> >
> > Even after the overhaul this fallback logic is failing on the BIOS from
> > a number of motherboard manufacturers supporting Ryzen APUs.
> > What happens is the amdgpu driver finishes registration and as expected
> > doesn't create a backlight control device since no eDP panels are connected
> > to a desktop.
> >
> > Then 8 seconds later the ACPI video detection code creates an
> > acpi_video0 device that is non-operational. GNOME then creates a
> > backlight slider.
> >
> > To avoid this situation from happening make two sets of changes:
> >
> > Prevent desktop problems w/ fallback logic
> > ------------------------------------------
> > 1) Add support for the video detect code to let native drivers cancel the
> > fallback logic if they didn't find a panel.
> >
> > This is done this way so that if another driver decides that the ACPI
> > mechanism is still needed it can instead directly call the registration
> > function.
> >
> > 2) Add code to amdgpu to notify the ACPI video detection code that no panel
> > was detected on an APU.
> >
> > Disable fallback logic by default
> > ---------------------------------
> > This fallback logic was introduced to prevent regressions in the backlight
> > overhaul.  As it has been deemed unnecessary by Hans explicitly disable the
> > timeout.  If this turns out to be mistake and this part is reverted, the
> > other patches for preventing desktop problems will avoid regressions on
> > desktops.
> >
> > Mario Limonciello (3):
> >   ACPI: video: Allow GPU drivers to report no panels
> >   drm/amd/display: Report to ACPI video if no panels were found
> >   ACPI: video: Don't enable fallback path for creating ACPI backlight by
> >     default
> >
> >  drivers/acpi/acpi_video.c                       | 17 ++++++++++++-----
> >  .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c   |  4 ++++
> >  include/acpi/video.h                            |  2 ++
> >  3 files changed, 18 insertions(+), 5 deletions(-)
> >
> > --
> > 2.34.1
>
> FYI, besides me, this series also tested successfully by one of the
> reporters to the Red Hat bugzilla.
>
> https://bugzilla.redhat.com/show_bug.cgi?id=1783786#c8

Thanks for letting me know!

I'll queue it up for 6.2-rc next week.

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

* Re: [PATCH v3 0/3] Adjust ACPI video detection fallback path
  2022-12-15 19:38   ` Rafael J. Wysocki
@ 2022-12-22 16:42     ` Rafael J. Wysocki
  0 siblings, 0 replies; 10+ messages in thread
From: Rafael J. Wysocki @ 2022-12-22 16:42 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Daniel Dadap, linux-acpi@vger.kernel.org,
	amd-gfx@lists.freedesktop.org, Hans de Goede, Limonciello, Mario,
	Deucher, Alexander

On Thu, Dec 15, 2022 at 8:38 PM Rafael J. Wysocki <rafael@kernel.org> wrote:
>
> On Thu, Dec 15, 2022 at 8:20 PM Limonciello, Mario
> <Mario.Limonciello@amd.com> wrote:
> >
> > [Public]
> >
> > > -----Original Message-----
> > > From: Limonciello, Mario <Mario.Limonciello@amd.com>
> > > Sent: Thursday, December 8, 2022 10:42
> > > To: Rafael J . Wysocki <rafael@kernel.org>; Deucher, Alexander
> > > <Alexander.Deucher@amd.com>; Hans de Goede
> > > <hdegoede@redhat.com>
> > > Cc: amd-gfx@lists.freedesktop.org; linux-acpi@vger.kernel.org; Daniel
> > > Dadap <ddadap@nvidia.com>; Limonciello, Mario
> > > <Mario.Limonciello@amd.com>
> > > Subject: [PATCH v3 0/3] Adjust ACPI video detection fallback path
> > >
> > > In kernel 6.1 the backlight registration code was overhauled so that
> > > at most one backlight device got registered. As part of this change
> > > there was code added to still allow making an acpi_video0 device if the
> > > BIOS contained backlight control methods but no native or vendor drivers
> > > registered.
> > >
> > > Even after the overhaul this fallback logic is failing on the BIOS from
> > > a number of motherboard manufacturers supporting Ryzen APUs.
> > > What happens is the amdgpu driver finishes registration and as expected
> > > doesn't create a backlight control device since no eDP panels are connected
> > > to a desktop.
> > >
> > > Then 8 seconds later the ACPI video detection code creates an
> > > acpi_video0 device that is non-operational. GNOME then creates a
> > > backlight slider.
> > >
> > > To avoid this situation from happening make two sets of changes:
> > >
> > > Prevent desktop problems w/ fallback logic
> > > ------------------------------------------
> > > 1) Add support for the video detect code to let native drivers cancel the
> > > fallback logic if they didn't find a panel.
> > >
> > > This is done this way so that if another driver decides that the ACPI
> > > mechanism is still needed it can instead directly call the registration
> > > function.
> > >
> > > 2) Add code to amdgpu to notify the ACPI video detection code that no panel
> > > was detected on an APU.
> > >
> > > Disable fallback logic by default
> > > ---------------------------------
> > > This fallback logic was introduced to prevent regressions in the backlight
> > > overhaul.  As it has been deemed unnecessary by Hans explicitly disable the
> > > timeout.  If this turns out to be mistake and this part is reverted, the
> > > other patches for preventing desktop problems will avoid regressions on
> > > desktops.
> > >
> > > Mario Limonciello (3):
> > >   ACPI: video: Allow GPU drivers to report no panels
> > >   drm/amd/display: Report to ACPI video if no panels were found
> > >   ACPI: video: Don't enable fallback path for creating ACPI backlight by
> > >     default
> > >
> > >  drivers/acpi/acpi_video.c                       | 17 ++++++++++++-----
> > >  .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c   |  4 ++++
> > >  include/acpi/video.h                            |  2 ++
> > >  3 files changed, 18 insertions(+), 5 deletions(-)
> > >
> > > --
> > > 2.34.1
> >
> > FYI, besides me, this series also tested successfully by one of the
> > reporters to the Red Hat bugzilla.
> >
> > https://bugzilla.redhat.com/show_bug.cgi?id=1783786#c8
>
> Thanks for letting me know!
>
> I'll queue it up for 6.2-rc next week.

Done now, thanks!

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

* Re: [PATCH v3 2/3] drm/amd/display: Report to ACPI video if no panels were found
  2022-12-08 16:42 ` [PATCH v3 2/3] drm/amd/display: Report to ACPI video if no panels were found Mario Limonciello
@ 2023-01-03 20:14   ` Harry Wentland
  0 siblings, 0 replies; 10+ messages in thread
From: Harry Wentland @ 2023-01-03 20:14 UTC (permalink / raw)
  To: Mario Limonciello, Rafael J . Wysocki, Alexander Deucher,
	Hans de Goede
  Cc: linux-acpi, amd-gfx, Daniel Dadap

On 12/8/22 11:42, Mario Limonciello wrote:
> On desktop APUs amdgpu doesn't create a native backlight device
> as no eDP panels are found.  However if the BIOS has reported
> backlight control methods in the ACPI tables then an acpi_video0
> backlight device will be made 8 seconds after boot.
> 
> This has manifested in a power slider on a number of desktop APUs
> ranging from Ryzen 5000 through Ryzen 7000 on various motherboard
> manufacturers. To avoid this, report to the acpi video detection
> that the system does not have any panel connected in the native
> driver.
> 
> Link: https://bugzilla.redhat.com/show_bug.cgi?id=1783786
> Reported-by: Hans de Goede <hdegoede@redhat.com>
> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
> Reviewed-by: Hans de Goede <hdegoede@redhat.com>

Reviewed-by: Harry Wentland <harry.wentland@amd.com>

Harry

> ---
> v2->v3:
>  * Add Hans' R-b
> v1->v2:
>  * No changes
> ---
>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index 512c32327eb1..b73f61ac5dd5 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -4371,6 +4371,10 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev)
>  		amdgpu_set_panel_orientation(&aconnector->base);
>  	}
>  
> +	/* If we didn't find a panel, notify the acpi video detection */
> +	if (dm->adev->flags & AMD_IS_APU && dm->num_of_edps == 0)
> +		acpi_video_report_nolcd();
> +
>  	/* Software is initialized. Now we can register interrupt handlers. */
>  	switch (adev->asic_type) {
>  #if defined(CONFIG_DRM_AMD_DC_SI)


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

end of thread, other threads:[~2023-01-03 20:15 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-08 16:42 [PATCH v3 0/3] Adjust ACPI video detection fallback path Mario Limonciello
2022-12-08 16:42 ` [PATCH v3 1/3] ACPI: video: Allow GPU drivers to report no panels Mario Limonciello
2022-12-08 17:49   ` Daniel Dadap
2022-12-08 17:56     ` Limonciello, Mario
2022-12-08 16:42 ` [PATCH v3 2/3] drm/amd/display: Report to ACPI video if no panels were found Mario Limonciello
2023-01-03 20:14   ` Harry Wentland
2022-12-08 16:42 ` [PATCH v3 3/3] ACPI: video: Don't enable fallback path for creating ACPI backlight by default Mario Limonciello
2022-12-15 19:20 ` [PATCH v3 0/3] Adjust ACPI video detection fallback path Limonciello, Mario
2022-12-15 19:38   ` Rafael J. Wysocki
2022-12-22 16:42     ` Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox