linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rajat Jain <rajatja@google.com>
To: Jani Nikula <jani.nikula@linux.intel.com>
Cc: "Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
	"Maxime Ripard" <mripard@kernel.org>,
	"Sean Paul" <sean@poorly.run>, "David Airlie" <airlied@linux.ie>,
	"Daniel Vetter" <daniel@ffwll.ch>,
	"Joonas Lahtinen" <joonas.lahtinen@linux.intel.com>,
	"Rodrigo Vivi" <rodrigo.vivi@intel.com>,
	"Ville Syrjälä" <ville.syrjala@linux.intel.com>,
	"Chris Wilson" <chris@chris-wilson.co.uk>,
	"Imre Deak" <imre.deak@intel.com>,
	"José Roberto de Souza" <jose.souza@intel.com>,
	"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
	dri-devel <dri-devel@lists.freedesktop.org>,
	intel-gfx@lists.freedesktop.org,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Mat King" <mathewk@google.com>,
	"Daniel Thompson" <daniel.thompson@linaro.org>,
	"Jonathan Corbet" <corbet@lwn.net>,
	"Pavel Machek" <pavel@denx.de>, "Sean Paul" <seanpaul@google.com>,
	"Duncan Laurie" <dlaurie@google.com>,
	"Jesse Barnes" <jsbarnes@google.com>,
	"Thierry Reding" <thierry.reding@gmail.com>,
	"Mark Pearson" <mpearson@lenovo.com>,
	"Nitin Joshi1" <njoshi1@lenovo.com>,
	"Sugumaran Lacshiminarayanan" <slacshiminar@lenovo.com>,
	"Tomoki Maruichi" <maruichit@lenovo.com>,
	"Guenter Roeck" <groeck@google.com>,
	"Rajat Jain" <rajatxjain@gmail.com>
Subject: Re: [PATCH v6 3/3] drm/i915: Add support for integrated privacy screens
Date: Fri, 6 Mar 2020 17:27:21 -0800	[thread overview]
Message-ID: <CACK8Z6G1y+osmBeOFmGyFgC2SX=HoY=rogKxk=F6D2GPxoMt1w@mail.gmail.com> (raw)
In-Reply-To: <87pndpoklz.fsf@intel.com>

Thanks Jani so much for the detailed explanation.

I was able to write the code for this, but I am facing one problem, see below.

On Fri, Mar 6, 2020 at 2:15 AM Jani Nikula <jani.nikula@linux.intel.com> wrote:
>
> On Thu, 05 Mar 2020, Rajat Jain <rajatja@google.com> wrote:
> > OK, will do. In order to do that I may need to introduce driver level
> > hooks that i915 driver can populate and drm core can call (or may be
> > some functions to add privacy screen property that drm core exports
> > and i915 driver will call).
>
> The latter. Look at drm_connector_attach_*() functions in
> drm_connector.c. i915 (or any other driver) can create and attach the
> property as needed. drm_atomic_connector_{get,set}_property in
> drm_atomic_uapi.c need to handle the properties, but *only* to get/set
> the value in drm_connector_state, nothing more. How that value is
> actually used is up to the drivers, but the userspace interface will be
> the same instead of being driver specific.

Understood, done.

>
> >> > @@ -93,15 +97,18 @@ int intel_digital_connector_atomic_set_property(struct drm_connector *connector,
> >> >       struct drm_i915_private *dev_priv = to_i915(dev);
> >> >       struct intel_digital_connector_state *intel_conn_state =
> >> >               to_intel_digital_connector_state(state);
> >> > +     struct intel_connector *intel_connector = to_intel_connector(connector);
> >> >
> >> >       if (property == dev_priv->force_audio_property) {
> >> >               intel_conn_state->force_audio = val;
> >> >               return 0;
> >> > -     }
> >> > -
> >> > -     if (property == dev_priv->broadcast_rgb_property) {
> >> > +     } else if (property == dev_priv->broadcast_rgb_property) {
> >> >               intel_conn_state->broadcast_rgb = val;
> >> >               return 0;
> >> > +     } else if (property == intel_connector->privacy_screen_property) {
> >> > +             intel_privacy_screen_set_val(intel_connector, val);
> >>
> >> I think this part should only change the connector state. The driver
> >> would then do the magic at commit stage according to the property value.
>
> Also, this would be the part that's done in drm core level.
>

Yup.

> > Can you please point me to some code reference as to where in code
> > does the "commit stage" apply the changes?
>
> Look at, say, drm_connector_attach_scaling_mode_property(). In the
> getter/setter code it'll just read/change state->scaling_mode. You can
> use the value in encoder ->enable, ->disable, and ->update_pipe
> hooks. Enable should enable the privacy screen if desired, disable
> should probably unconditionally disable the privacy screen while
> disabling the display, and update should just change the state according
> to the value. Update is called if there isn't a full modeset. (Scaling
> mode is a bit more indirect than that, affecting other things in the
> encoder ->compute_config hook, leading to similar effects.)

For my testing purposes, I'm testing this using the proptest utility
in our distribution (I think from
https://github.com/CPFL/drm/blob/master/tests/proptest/proptest.c). I
notice that when I change the value of the property from userspace,
even though the drm_connector_state->privacy_screen_status gets
updated and reflects the change, the encoder->update_pipe() is not
getting called. Just wanted to ask if this is expected since you seem
to imply this update_pipe() might *not* get called if there *is* a
full modeset? (What is the hook that gets called for a full modeset
where i915 driver should commit this property change to the hardware?)

Thanks & Best Regards,

Rajat


>
> Ville, anything I missed?
>
> BR,
> Jani.
>
>
> --
> Jani Nikula, Intel Open Source Graphics Center

  reply	other threads:[~2020-03-07  1:28 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20200305012338.219746-1-rajatja@google.com>
2020-03-05  1:23 ` [PATCH v6 1/3] intel_acpi: Rename drm_dev local variable to dev Rajat Jain
2020-03-05  9:14   ` Jani Nikula
2020-03-05  1:23 ` [PATCH v6 2/3] drm/i915: Lookup and attach ACPI device node for connectors Rajat Jain
2020-03-05  9:40   ` Jani Nikula
2020-03-06  3:27     ` Rajat Jain
2020-03-06  9:42       ` Jani Nikula
2020-03-07  1:38         ` Rajat Jain
2020-03-10  0:09           ` Rajat Jain
2020-03-05  1:23 ` [PATCH v6 3/3] drm/i915: Add support for integrated privacy screens Rajat Jain
2020-03-05 10:01   ` Jani Nikula
2020-03-06  3:35     ` Rajat Jain
2020-03-06 10:15       ` Jani Nikula
2020-03-07  1:27         ` Rajat Jain [this message]
2020-03-05  1:19 [PATCH v6 1/3] intel_acpi: Rename drm_dev local variable to dev Rajat Jain
2020-03-05  1:19 ` [PATCH v6 3/3] drm/i915: Add support for integrated privacy screens Rajat Jain

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='CACK8Z6G1y+osmBeOFmGyFgC2SX=HoY=rogKxk=F6D2GPxoMt1w@mail.gmail.com' \
    --to=rajatja@google.com \
    --cc=airlied@linux.ie \
    --cc=chris@chris-wilson.co.uk \
    --cc=corbet@lwn.net \
    --cc=daniel.thompson@linaro.org \
    --cc=daniel@ffwll.ch \
    --cc=dlaurie@google.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=groeck@google.com \
    --cc=imre.deak@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=joonas.lahtinen@linux.intel.com \
    --cc=jose.souza@intel.com \
    --cc=jsbarnes@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=maruichit@lenovo.com \
    --cc=mathewk@google.com \
    --cc=mpearson@lenovo.com \
    --cc=mripard@kernel.org \
    --cc=njoshi1@lenovo.com \
    --cc=pavel@denx.de \
    --cc=rajatxjain@gmail.com \
    --cc=rodrigo.vivi@intel.com \
    --cc=sean@poorly.run \
    --cc=seanpaul@google.com \
    --cc=slacshiminar@lenovo.com \
    --cc=thierry.reding@gmail.com \
    --cc=ville.syrjala@linux.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;
as well as URLs for NNTP newsgroup(s).