AMD-GFX Archive mirror
 help / color / mirror / Atom feed
From: Harry Wentland <harry.wentland@amd.com>
To: Mario Limonciello <mario.limonciello@amd.com>,
	amd-gfx@lists.freedesktop.org
Cc: Gergo Koteles <soyer@irl.hu>
Subject: Re: [PATCH] drm/amd/display: Don't register panel_power_savings on OLED panels
Date: Mon, 13 May 2024 07:06:46 -0400	[thread overview]
Message-ID: <a45c7e08-2a8b-46fd-9be1-45079c72b70c@amd.com> (raw)
In-Reply-To: <20240509170524.34811-1-mario.limonciello@amd.com>

On 2024-05-09 13:05, Mario Limonciello wrote:
> OLED panels don't support the ABM, they shouldn't offer the
> panel_power_savings attribute to the user. Check whether aux BL
> control support was enabled to decide whether to offer it.
> 
> Reported-by: Gergo Koteles <soyer@irl.hu>
> Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/3359
> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>

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

Harry

> ---
>   .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 29 ++++++++++++++++---
>   1 file changed, 25 insertions(+), 4 deletions(-)
> 
> 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 3054bf79fc99..ce2ec857b8a6 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -6532,12 +6532,34 @@ static const struct attribute_group amdgpu_group = {
>   	.attrs = amdgpu_attrs
>   };
>   
> +static bool
> +amdgpu_dm_should_create_sysfs(struct amdgpu_dm_connector *amdgpu_dm_connector)
> +{
> +	if (amdgpu_dm_abm_level >= 0)
> +		return false;
> +
> +	if (amdgpu_dm_connector->base.connector_type != DRM_MODE_CONNECTOR_eDP)
> +		return false;
> +
> +	/* check for OLED panels */
> +	if (amdgpu_dm_connector->bl_idx >= 0) {
> +		struct drm_device *drm = amdgpu_dm_connector->base.dev;
> +		struct amdgpu_display_manager *dm = &drm_to_adev(drm)->dm;
> +		struct amdgpu_dm_backlight_caps *caps;
> +
> +		caps = &dm->backlight_caps[amdgpu_dm_connector->bl_idx];
> +		if (caps->aux_support)
> +			return false;
> +	}
> +
> +	return true;
> +}
> +
>   static void amdgpu_dm_connector_unregister(struct drm_connector *connector)
>   {
>   	struct amdgpu_dm_connector *amdgpu_dm_connector = to_amdgpu_dm_connector(connector);
>   
> -	if (connector->connector_type == DRM_MODE_CONNECTOR_eDP &&
> -	    amdgpu_dm_abm_level < 0)
> +	if (amdgpu_dm_should_create_sysfs(amdgpu_dm_connector))
>   		sysfs_remove_group(&connector->kdev->kobj, &amdgpu_group);
>   
>   	drm_dp_aux_unregister(&amdgpu_dm_connector->dm_dp_aux.aux);
> @@ -6644,8 +6666,7 @@ amdgpu_dm_connector_late_register(struct drm_connector *connector)
>   		to_amdgpu_dm_connector(connector);
>   	int r;
>   
> -	if (connector->connector_type == DRM_MODE_CONNECTOR_eDP &&
> -	    amdgpu_dm_abm_level < 0) {
> +	if (amdgpu_dm_should_create_sysfs(amdgpu_dm_connector)) {
>   		r = sysfs_create_group(&connector->kdev->kobj,
>   				       &amdgpu_group);
>   		if (r)

      parent reply	other threads:[~2024-05-13 11:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-09 17:05 [PATCH] drm/amd/display: Don't register panel_power_savings on OLED panels Mario Limonciello
2024-05-09 20:55 ` Gergo Koteles
2024-05-13 11:06 ` Harry Wentland [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a45c7e08-2a8b-46fd-9be1-45079c72b70c@amd.com \
    --to=harry.wentland@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=mario.limonciello@amd.com \
    --cc=soyer@irl.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).