From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
To: Jani Nikula <jani.nikula@intel.com>, intel-gfx@lists.freedesktop.org
Cc: "Rainer Koenig" <Rainer.Koenig@ts.fujitsu.com>,
"Jan-Marek Glogowski" <glogow@fbihome.de>,
"Jonathan Woithe" <jwoithe@just42.net>,
"Michał Kępień" <kernel@kempniu.pl>
Subject: Re: [PATCH v4 2/2] drm/i915/opregion: update cadl based on actually active outputs
Date: Mon, 4 Jul 2016 07:13:15 +0200 [thread overview]
Message-ID: <d427a760-be47-0f83-6234-7c739007f1ea@linux.intel.com> (raw)
In-Reply-To: <2f9a317013fab8b4027250fa005c0247f2a8baf2.1467214151.git.jani.nikula@intel.com>
Op 29-06-16 om 17:36 schreef Jani Nikula:
> Previously we've just shoved the first eight devices in DIDL to CADL
> (list of active outputs). Some of the active outputs may have been left
> outside of CADL. The problem is, some BIOS implementations prevent
> laptop brightness hotkey propagation if the flat panel is not active.
>
> Now that we have connector to acpi device id mapping covered, we can
> update CADL based on which outputs are actually active.
>
> v3: actually git add the dev->dev_priv change.
>
> v4: update cadl in intel_shared_dpll_commit() if intel_state->modeset
> (Maarten)
>
> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Reviewed-and-tested-by: Peter Wu <peter@lekensteyn.nl>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> ---
> drivers/gpu/drm/i915/i915_drv.h | 2 +
> drivers/gpu/drm/i915/intel_display.c | 4 ++
> drivers/gpu/drm/i915/intel_opregion.c | 70 ++++++++++++++++++-----------------
> 3 files changed, 43 insertions(+), 33 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 724d34b00196..64ab52529be8 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -3692,6 +3692,7 @@ extern int intel_opregion_notify_encoder(struct intel_encoder *intel_encoder,
> extern int intel_opregion_notify_adapter(struct drm_i915_private *dev_priv,
> pci_power_t state);
> extern int intel_opregion_get_panel_type(struct drm_i915_private *dev_priv);
> +extern void intel_opregion_update_cadl(struct drm_i915_private *dev_priv);
> #else
> static inline int intel_opregion_setup(struct drm_i915_private *dev) { return 0; }
> static inline void intel_opregion_register(struct drm_i915_private *dev_priv) { }
> @@ -3713,6 +3714,7 @@ static inline int intel_opregion_get_panel_type(struct drm_i915_private *dev)
> {
> return -ENODEV;
> }
> +static inline void intel_opregion_update_cadl(struct drm_i915_private *dev_priv) { }
> #endif
>
> /* intel_acpi.c */
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index d902a70edb84..4f404900f610 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -13953,6 +13953,10 @@ static int intel_atomic_commit(struct drm_device *dev,
> dev_priv->wm.distrust_bios_wm = false;
> dev_priv->wm.skl_results = intel_state->wm_results;
> intel_shared_dpll_commit(state);
> +
> + if (intel_state->modeset)
> + intel_opregion_update_cadl(dev_priv);
> +
> intel_atomic_track_fbs(state);
>
> if (nonblock)
> diff --git a/drivers/gpu/drm/i915/intel_opregion.c b/drivers/gpu/drm/i915/intel_opregion.c
> index 632f0178c2b0..8b3f7e6ae4bb 100644
> --- a/drivers/gpu/drm/i915/intel_opregion.c
> +++ b/drivers/gpu/drm/i915/intel_opregion.c
> @@ -642,24 +642,6 @@ static struct notifier_block intel_opregion_notifier = {
> * (version 3)
> */
>
> -static u32 get_did(struct intel_opregion *opregion, int i)
> -{
> - u32 did;
> -
> - if (i < ARRAY_SIZE(opregion->acpi->didl)) {
> - did = opregion->acpi->didl[i];
> - } else {
> - i -= ARRAY_SIZE(opregion->acpi->didl);
> -
> - if (WARN_ON(i >= ARRAY_SIZE(opregion->acpi->did2)))
> - return 0;
> -
> - did = opregion->acpi->did2[i];
> - }
> -
> - return did;
> -}
> -
> static void set_did(struct intel_opregion *opregion, int i, u32 val)
> {
> if (i < ARRAY_SIZE(opregion->acpi->didl)) {
> @@ -674,6 +656,14 @@ static void set_did(struct intel_opregion *opregion, int i, u32 val)
> }
> }
>
> +static void set_cad(struct intel_opregion *opregion, int i, u32 val)
> +{
> + if (WARN_ON(i >= ARRAY_SIZE(opregion->acpi->cadl)))
> + return;
> +
> + opregion->acpi->cadl[i] = val;
> +}
> +
> static u32 acpi_display_type(struct intel_connector *connector)
> {
> u32 display_type;
> @@ -759,22 +749,36 @@ static void intel_didl_outputs(struct drm_i915_private *dev_priv)
> set_did(opregion, i, 0);
> }
>
> -static void intel_setup_cadls(struct drm_i915_private *dev_priv)
> +/* Update CADL to reflect active outputs. */
> +void intel_opregion_update_cadl(struct drm_i915_private *dev_priv)
> {
> struct intel_opregion *opregion = &dev_priv->opregion;
> - int i = 0;
> - u32 disp_id;
> -
> - /* Initialize the CADL field by duplicating the DIDL values.
> - * Technically, this is not always correct as display outputs may exist,
> - * but not active. This initialization is necessary for some Clevo
> - * laptops that check this field before processing the brightness and
> - * display switching hotkeys. Just like DIDL, CADL is NULL-terminated if
> - * there are less than eight devices. */
> - do {
> - disp_id = get_did(opregion, i);
> - opregion->acpi->cadl[i] = disp_id;
> - } while (++i < 8 && disp_id != 0);
> + struct intel_crtc *crtc;
> + int i = 0, max_active = ARRAY_SIZE(opregion->acpi->cadl);
> +
> + for_each_intel_crtc(dev_priv->dev, crtc) {
> + struct intel_encoder *encoder;
> +
> + if (!crtc->active)
> + continue;
Argh, don't use crtc->active!
We have intel_state->active_crtcs + for_each_intel_crtc_mask for this, it should fix the issue Koenig mentioned.
If fixed,
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2016-07-04 5:13 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-29 15:36 [PATCH v4 0/2] drm/i915/opregion: proper handling of DIDL and CADL Jani Nikula
2016-06-29 15:36 ` [PATCH v4 1/2] drm/i915: make i915 the source of acpi device ids for _DOD Jani Nikula
2016-06-29 15:36 ` [PATCH v4 2/2] drm/i915/opregion: update cadl based on actually active outputs Jani Nikula
2016-07-04 5:13 ` Maarten Lankhorst [this message]
2016-06-29 16:23 ` ✗ Ro.CI.BAT: failure for drm/i915/opregion: proper handling of DIDL and CADL (rev4) Patchwork
2016-06-29 17:01 ` [PATCH v4 0/2] drm/i915/opregion: proper handling of DIDL and CADL Peter Wu
2016-06-30 9:19 ` Rainer Koenig
2016-07-01 12:12 ` Rainer Koenig
2016-07-01 13:51 ` Jani Nikula
2016-07-12 10:23 ` Maarten Lankhorst
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=d427a760-be47-0f83-6234-7c739007f1ea@linux.intel.com \
--to=maarten.lankhorst@linux.intel.com \
--cc=Rainer.Koenig@ts.fujitsu.com \
--cc=glogow@fbihome.de \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jani.nikula@intel.com \
--cc=jwoithe@just42.net \
--cc=kernel@kempniu.pl \
/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