[Freedreno] [Intel-gfx] [PATCH v2 03/13] drm/hdcp: Update property value on content type and user changes

kernel test robot lkp at intel.com
Thu Sep 16 22:48:22 UTC 2021


Hi Sean,

I love your patch! Perhaps something to improve:

[auto build test WARNING on drm-intel/for-linux-next]
[also build test WARNING on drm-tip/drm-tip robh/for-next linus/master v5.15-rc1 next-20210916]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Sean-Paul/drm-hdcp-Pull-HDCP-auth-exchange-check-into-helpers/20210916-044145
base:   git://anongit.freedesktop.org/drm-intel for-linux-next
config: x86_64-randconfig-m001-20210916 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp at intel.com>

smatch warnings:
drivers/gpu/drm/drm_hdcp.c:509 drm_hdcp_atomic_check() warn: inconsistent indenting

vim +509 drivers/gpu/drm/drm_hdcp.c

a46c52c65fdbf76 Sean Paul 2021-09-15  425  
a46c52c65fdbf76 Sean Paul 2021-09-15  426  /**
a46c52c65fdbf76 Sean Paul 2021-09-15  427   * drm_hdcp_atomic_check - Helper for drivers to call during connector->atomic_check
a46c52c65fdbf76 Sean Paul 2021-09-15  428   *
a46c52c65fdbf76 Sean Paul 2021-09-15  429   * @state: pointer to the atomic state being checked
a46c52c65fdbf76 Sean Paul 2021-09-15  430   * @connector: drm_connector on which content protection state needs an update
a46c52c65fdbf76 Sean Paul 2021-09-15  431   *
a46c52c65fdbf76 Sean Paul 2021-09-15  432   * This function can be used by display drivers to perform an atomic check on the
d0cdceca77739a6 Sean Paul 2021-09-15  433   * hdcp state elements. If hdcp state has changed in a manner which requires the
d0cdceca77739a6 Sean Paul 2021-09-15  434   * driver to enable or disable content protection, this function will return
d0cdceca77739a6 Sean Paul 2021-09-15  435   * true.
d0cdceca77739a6 Sean Paul 2021-09-15  436   *
d0cdceca77739a6 Sean Paul 2021-09-15  437   * Returns:
d0cdceca77739a6 Sean Paul 2021-09-15  438   * true if the driver must enable/disable hdcp, false otherwise
a46c52c65fdbf76 Sean Paul 2021-09-15  439   */
d0cdceca77739a6 Sean Paul 2021-09-15  440  bool drm_hdcp_atomic_check(struct drm_connector *connector,
a46c52c65fdbf76 Sean Paul 2021-09-15  441  			   struct drm_atomic_state *state)
a46c52c65fdbf76 Sean Paul 2021-09-15  442  {
a46c52c65fdbf76 Sean Paul 2021-09-15  443  	struct drm_connector_state *new_conn_state, *old_conn_state;
a46c52c65fdbf76 Sean Paul 2021-09-15  444  	struct drm_crtc_state *new_crtc_state;
a46c52c65fdbf76 Sean Paul 2021-09-15  445  	u64 old_hdcp, new_hdcp;
a46c52c65fdbf76 Sean Paul 2021-09-15  446  
a46c52c65fdbf76 Sean Paul 2021-09-15  447  	old_conn_state = drm_atomic_get_old_connector_state(state, connector);
a46c52c65fdbf76 Sean Paul 2021-09-15  448  	old_hdcp = old_conn_state->content_protection;
a46c52c65fdbf76 Sean Paul 2021-09-15  449  
a46c52c65fdbf76 Sean Paul 2021-09-15  450  	new_conn_state = drm_atomic_get_new_connector_state(state, connector);
a46c52c65fdbf76 Sean Paul 2021-09-15  451  	new_hdcp = new_conn_state->content_protection;
a46c52c65fdbf76 Sean Paul 2021-09-15  452  
a46c52c65fdbf76 Sean Paul 2021-09-15  453  	if (!new_conn_state->crtc) {
a46c52c65fdbf76 Sean Paul 2021-09-15  454  		/*
a46c52c65fdbf76 Sean Paul 2021-09-15  455  		 * If the connector is being disabled with CP enabled, mark it
a46c52c65fdbf76 Sean Paul 2021-09-15  456  		 * desired so it's re-enabled when the connector is brought back
a46c52c65fdbf76 Sean Paul 2021-09-15  457  		 */
d0cdceca77739a6 Sean Paul 2021-09-15  458  		if (old_hdcp == DRM_MODE_CONTENT_PROTECTION_ENABLED) {
a46c52c65fdbf76 Sean Paul 2021-09-15  459  			new_conn_state->content_protection =
a46c52c65fdbf76 Sean Paul 2021-09-15  460  				DRM_MODE_CONTENT_PROTECTION_DESIRED;
d0cdceca77739a6 Sean Paul 2021-09-15  461  			return true;
d0cdceca77739a6 Sean Paul 2021-09-15  462  		}
d0cdceca77739a6 Sean Paul 2021-09-15  463  		return false;
a46c52c65fdbf76 Sean Paul 2021-09-15  464  	}
a46c52c65fdbf76 Sean Paul 2021-09-15  465  
a46c52c65fdbf76 Sean Paul 2021-09-15  466  	new_crtc_state = drm_atomic_get_new_crtc_state(state,
a46c52c65fdbf76 Sean Paul 2021-09-15  467  						       new_conn_state->crtc);
a46c52c65fdbf76 Sean Paul 2021-09-15  468  	/*
a46c52c65fdbf76 Sean Paul 2021-09-15  469  	* Fix the HDCP uapi content protection state in case of modeset.
a46c52c65fdbf76 Sean Paul 2021-09-15  470  	* FIXME: As per HDCP content protection property uapi doc, an uevent()
a46c52c65fdbf76 Sean Paul 2021-09-15  471  	* need to be sent if there is transition from ENABLED->DESIRED.
a46c52c65fdbf76 Sean Paul 2021-09-15  472  	*/
a46c52c65fdbf76 Sean Paul 2021-09-15  473  	if (drm_atomic_crtc_needs_modeset(new_crtc_state) &&
a46c52c65fdbf76 Sean Paul 2021-09-15  474  	    (old_hdcp == DRM_MODE_CONTENT_PROTECTION_ENABLED &&
d0cdceca77739a6 Sean Paul 2021-09-15  475  	     new_hdcp != DRM_MODE_CONTENT_PROTECTION_UNDESIRED)) {
a46c52c65fdbf76 Sean Paul 2021-09-15  476  		new_conn_state->content_protection =
a46c52c65fdbf76 Sean Paul 2021-09-15  477  			DRM_MODE_CONTENT_PROTECTION_DESIRED;
d0cdceca77739a6 Sean Paul 2021-09-15  478  		return true;
d0cdceca77739a6 Sean Paul 2021-09-15  479  	}
d0cdceca77739a6 Sean Paul 2021-09-15  480  
d0cdceca77739a6 Sean Paul 2021-09-15  481  	/*
d0cdceca77739a6 Sean Paul 2021-09-15  482  	 * Coming back from disable or changing CRTC with DESIRED state requires
d0cdceca77739a6 Sean Paul 2021-09-15  483  	 * that the driver try CP enable.
d0cdceca77739a6 Sean Paul 2021-09-15  484  	 */
d0cdceca77739a6 Sean Paul 2021-09-15  485  	if (new_hdcp == DRM_MODE_CONTENT_PROTECTION_DESIRED &&
d0cdceca77739a6 Sean Paul 2021-09-15  486  	    new_conn_state->crtc != old_conn_state->crtc)
d0cdceca77739a6 Sean Paul 2021-09-15  487  		return true;
a46c52c65fdbf76 Sean Paul 2021-09-15  488  
a46c52c65fdbf76 Sean Paul 2021-09-15  489  	/*
6c538fd0f0a55b2 Sean Paul 2021-09-15  490  	 * Content type changes require an HDCP disable/enable cycle.
6c538fd0f0a55b2 Sean Paul 2021-09-15  491  	 */
6c538fd0f0a55b2 Sean Paul 2021-09-15  492  	if (new_conn_state->hdcp_content_type != old_conn_state->hdcp_content_type) {
6c538fd0f0a55b2 Sean Paul 2021-09-15  493  		new_conn_state->content_protection =
6c538fd0f0a55b2 Sean Paul 2021-09-15  494  			DRM_MODE_CONTENT_PROTECTION_DESIRED;
6c538fd0f0a55b2 Sean Paul 2021-09-15  495  		return true;
6c538fd0f0a55b2 Sean Paul 2021-09-15  496  	}
6c538fd0f0a55b2 Sean Paul 2021-09-15  497  
6c538fd0f0a55b2 Sean Paul 2021-09-15  498  	/*
6c538fd0f0a55b2 Sean Paul 2021-09-15  499  	 * Ignore meaningless state changes:
a46c52c65fdbf76 Sean Paul 2021-09-15  500  	 *  - HDCP was activated since the last commit
6c538fd0f0a55b2 Sean Paul 2021-09-15  501  	 *  - Attempting to set to desired while already enabled
a46c52c65fdbf76 Sean Paul 2021-09-15  502  	 */
6c538fd0f0a55b2 Sean Paul 2021-09-15  503  	if ((old_hdcp == DRM_MODE_CONTENT_PROTECTION_DESIRED &&
a46c52c65fdbf76 Sean Paul 2021-09-15  504  	     new_hdcp == DRM_MODE_CONTENT_PROTECTION_ENABLED) ||
a46c52c65fdbf76 Sean Paul 2021-09-15  505  	    (old_hdcp == DRM_MODE_CONTENT_PROTECTION_ENABLED &&
a46c52c65fdbf76 Sean Paul 2021-09-15  506  	     new_hdcp == DRM_MODE_CONTENT_PROTECTION_DESIRED)) {
6c538fd0f0a55b2 Sean Paul 2021-09-15  507  		new_conn_state->content_protection =
6c538fd0f0a55b2 Sean Paul 2021-09-15  508  			DRM_MODE_CONTENT_PROTECTION_ENABLED;
d0cdceca77739a6 Sean Paul 2021-09-15 @509  	     return false;

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 35196 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/freedreno/attachments/20210917/841f1c82/attachment-0001.gz>


More information about the Freedreno mailing list