Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp122900ybh; Fri, 6 Mar 2020 17:28:39 -0800 (PST) X-Google-Smtp-Source: ADFU+vvFKF0Usq9jQvr3PlFTHtZ9bVqHJjfQUkucA4PPLhqGY03JNuyI/pqSa1zKkg+uQNkY9LoF X-Received: by 2002:aca:4f0f:: with SMTP id d15mr4472705oib.78.1583544518905; Fri, 06 Mar 2020 17:28:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583544518; cv=none; d=google.com; s=arc-20160816; b=AZNFoANaTWhfeKzSmprerwXQPCofwqBfGg1PjeCeYOUIkT9s0oHbFp2zm8lFniXHne iX6ksqkq8f1g46T4WGF1SErI97D+8fdV0NsP7y+xQnYWbVEUHXypvI3jrLg3TSfqMOsb Kl0llr2Sy5/Ej8XMx/qGJkYhlA4mugbUMwf+11V4j+yB+JN6EPuiUGywtqASHa+CtFjo uIkBpvzsFFmRZZVKLddrVxtB5OBu7JkOk0VSiM19xZyGudGDeEBmsDFqgS9EVju2NY1C XkfMsJBFm+lOOQyW8oNSUQq9T6fuxNRLX0SJr5dkIAf7EHJ6LW7tDHzYLGX2DftvDqi+ VnYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=tM5rNBDzDBfUzH8FigDCfHhd1rXYSHwTeF/Tvps25Ao=; b=K0/FT0+m/Slm9R2KHsIdSpaWMLZkWSdFgy14I7FN1OACrVEgaBIs3CQcljhs+1/laH gbm9mE4g+ShO6wQ/RzFOMwlfgv92FAud+5iwJGLuJQmvrvSjaYIu+8fCfHDGAXaHDEjN ye1w475aqZswhc6cbw43Qn9IF5LhP5jeBlAAiZZhjNz/yi3Ac/bUugDn/f6niRipZINt vMVnl2WyiBOHVHcHehlvhmG0hp/ZppoSpPo7pSlKWaBh2uZsj0MELuKRluZDEYeNhSVj Yo2UFMF4bYB5vxPDEq8TivuC4fzAhCMgN7pODXhix8dbz35fW2AsDE+hkqFhPbG+rwf/ ynLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=HpWAYO0L; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c21si1273937otm.45.2020.03.06.17.28.25; Fri, 06 Mar 2020 17:28:38 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=HpWAYO0L; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726314AbgCGB2B (ORCPT + 99 others); Fri, 6 Mar 2020 20:28:01 -0500 Received: from mail-lj1-f196.google.com ([209.85.208.196]:35318 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726231AbgCGB2B (ORCPT ); Fri, 6 Mar 2020 20:28:01 -0500 Received: by mail-lj1-f196.google.com with SMTP id a12so4147508ljj.2 for ; Fri, 06 Mar 2020 17:27:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=tM5rNBDzDBfUzH8FigDCfHhd1rXYSHwTeF/Tvps25Ao=; b=HpWAYO0LOjmlNMsNvaoN+lgWUHGKA8P4Sdwn1m2ycN0+57X7bxCNbb4H/jMrbdlkFG O+tISKs7zkNKeaL26enQ0oB+/d1pULikT52MHYmfhd/C+qFMjwppkxxHiwwOgoLtO49n OIFjOgVCPylgn+ZSTR/4wEnhsRFMXOTd3FBSDy+a2A+Bbk0uEww0vtON8gfJMNvMmrOz mm9+lyc7fLEYhWUT0UxiVLifqQClK0Bj3Ese/LbI0Po2RpPpEtEx7AI5CIcKCLBkBBx9 pQYXoRJ2Eu63G0SPdGTbc5Y6ygn1lRPtwhCC1MQk4h00NyIOehUvSzO4UXnAZDUT4KDv c35Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=tM5rNBDzDBfUzH8FigDCfHhd1rXYSHwTeF/Tvps25Ao=; b=oDDbhZtWk4ivZUWGJMan2UxII5A6HDj+JL2J0zmqTCL2zUl9n50nr+AMKx+nh8jjUn cpf79WWZ52FanuqEEQZWNdX9VGv0Esj3enc/H4UQkINffPu4sMYo0HMlNzPjJAwN9J6T jS2VnWiVtTMAx9x2X+KGYce9dX1Bc4VdRJIaeO4qW5LBSoP2RAT+aN6gC+8WAXKTZOxI Fnp/POs5QGxT3lx9IuVAmiHfMRLd8NgemEpNp//d6o4YiIoUkBkiYX4pwj6f+orE/w6b 07UNiSUOwM3sMvZyhBoX1BYs2id1T/DbRbHxNvj+zkjPsE0n7GjalE3JwlwIx7O4D3mg t7QQ== X-Gm-Message-State: ANhLgQ16O5jgPhvTpzKqJTFnUerzDglFuQB9pCogNY3rgs8OzsWrt0QX xH6eJkSPybK3xoxMWrdJNBobxSwjoMV76E+39L76gg== X-Received: by 2002:a2e:b88d:: with SMTP id r13mr3340787ljp.66.1583544477713; Fri, 06 Mar 2020 17:27:57 -0800 (PST) MIME-Version: 1.0 References: <20200305012338.219746-1-rajatja@google.com> <20200305012338.219746-4-rajatja@google.com> <87k13znmrc.fsf@intel.com> <87pndpoklz.fsf@intel.com> In-Reply-To: <87pndpoklz.fsf@intel.com> From: Rajat Jain Date: Fri, 6 Mar 2020 17:27:21 -0800 Message-ID: Subject: Re: [PATCH v6 3/3] drm/i915: Add support for integrated privacy screens To: Jani Nikula Cc: Maarten Lankhorst , Maxime Ripard , Sean Paul , David Airlie , Daniel Vetter , Joonas Lahtinen , Rodrigo Vivi , =?UTF-8?B?VmlsbGUgU3lyasOkbMOk?= , Chris Wilson , Imre Deak , =?UTF-8?Q?Jos=C3=A9_Roberto_de_Souza?= , Linux Kernel Mailing List , dri-devel , intel-gfx@lists.freedesktop.org, Greg Kroah-Hartman , Mat King , Daniel Thompson , Jonathan Corbet , Pavel Machek , Sean Paul , Duncan Laurie , Jesse Barnes , Thierry Reding , Mark Pearson , Nitin Joshi1 , Sugumaran Lacshiminarayanan , Tomoki Maruichi , Guenter Roeck , Rajat Jain Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 wrote: > > On Thu, 05 Mar 2020, Rajat Jain 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