From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Suraj Kandpal <suraj.kandpal@intel.com>
Cc: intel-gfx@lists.freedesktop.org, ville.syrjala@intel.com
Subject: Re: [Intel-gfx] [PATCH v2] drm/i915/hdcp: Remove drm_modeset_lock in intel_conn_to_vcpi
Date: Mon, 3 Apr 2023 17:09:24 +0300 [thread overview]
Message-ID: <ZCreFMId3fKGjOYx@intel.com> (raw)
In-Reply-To: <20230403070125.1127830-1-suraj.kandpal@intel.com>
On Mon, Apr 03, 2023 at 12:31:25PM +0530, Suraj Kandpal wrote:
> Remove drm_modeset_lock in intel_conn_to_vcpi as we don't need it
> anymore since all the required locks are taken in atomic check and
> prepare phases.
>
> --v2
> -take lock if hdcp function is called from legacy path [Ville]
>
> Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com>
> ---
> drivers/gpu/drm/i915/display/intel_hdcp.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_hdcp.c b/drivers/gpu/drm/i915/display/intel_hdcp.c
> index 650232c4892b..65cfc4afbcaa 100644
> --- a/drivers/gpu/drm/i915/display/intel_hdcp.c
> +++ b/drivers/gpu/drm/i915/display/intel_hdcp.c
> @@ -36,13 +36,16 @@ static int intel_conn_to_vcpi(struct intel_connector *connector)
> struct drm_dp_mst_atomic_payload *payload;
> struct drm_dp_mst_topology_state *mst_state;
> int vcpi = 0;
> + bool is_locked;
>
> /* For HDMI this is forced to be 0x0. For DP SST also this is 0x0. */
> if (!connector->port)
> return 0;
> mgr = connector->port->mgr;
> + is_locked = drm_modeset_is_locked(&mgr->base.lock);
The fact that *someone* is holding the lock doesn't mean you
can just skip taking it yourself.
> + if (!is_locked)
> + drm_modeset_lock(&mgr->base.lock, NULL);
>
> - drm_modeset_lock(&mgr->base.lock, NULL);
> mst_state = to_drm_dp_mst_topology_state(mgr->base.state);
> payload = drm_atomic_get_mst_payload_state(mst_state, connector->port);
> if (drm_WARN_ON(mgr->dev, !payload))
> @@ -54,7 +57,9 @@ static int intel_conn_to_vcpi(struct intel_connector *connector)
> goto out;
> }
> out:
> - drm_modeset_unlock(&mgr->base.lock);
> + if (!is_locked)
> + drm_modeset_unlock(&mgr->base.lock);
> +
> return vcpi;
> }
>
> --
> 2.25.1
--
Ville Syrjälä
Intel
next prev parent reply other threads:[~2023-04-03 14:09 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-03 7:01 [Intel-gfx] [PATCH v2] drm/i915/hdcp: Remove drm_modeset_lock in intel_conn_to_vcpi Suraj Kandpal
2023-04-03 14:09 ` Ville Syrjälä [this message]
2023-04-04 5:19 ` Kandpal, Suraj
2023-04-03 14:27 ` [Intel-gfx] ✓ Fi.CI.BAT: success for drm/i915/hdcp: Remove drm_modeset_lock in intel_conn_to_vcpi (rev2) Patchwork
2023-04-03 19:25 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork
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=ZCreFMId3fKGjOYx@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=suraj.kandpal@intel.com \
--cc=ville.syrjala@intel.com \
/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