2022-11-14 09:18:53

by Hsin-Yi Wang

[permalink] [raw]
Subject: [PATCH v4 1/3] drm_bridge: register content protect property

Some bridges are able to update HDCP status from userspace request if
they support HDCP.

HDCP property is the same as other connector properties that needs to be
created after the connecter is initialized and before the connector is
registered.

If there exists a bridge that supports HDCP, add the property to the
bridge connector.

Signed-off-by: Hsin-Yi Wang <[email protected]>
Reviewed-by: Sean Paul <[email protected]>
---
v3->v4: no change.
---
drivers/gpu/drm/drm_bridge_connector.c | 8 ++++++++
include/drm/drm_bridge.h | 4 ++++
2 files changed, 12 insertions(+)

diff --git a/drivers/gpu/drm/drm_bridge_connector.c b/drivers/gpu/drm/drm_bridge_connector.c
index 1c7d936523df..b4fb5da0b963 100644
--- a/drivers/gpu/drm/drm_bridge_connector.c
+++ b/drivers/gpu/drm/drm_bridge_connector.c
@@ -7,6 +7,7 @@
#include <linux/module.h>
#include <linux/slab.h>

+#include <drm/display/drm_hdcp_helper.h>
#include <drm/drm_atomic_state_helper.h>
#include <drm/drm_bridge.h>
#include <drm/drm_bridge_connector.h>
@@ -333,6 +334,7 @@ struct drm_connector *drm_bridge_connector_init(struct drm_device *drm,
struct i2c_adapter *ddc = NULL;
struct drm_bridge *bridge, *panel_bridge = NULL;
int connector_type;
+ bool support_hdcp = false;

bridge_connector = kzalloc(sizeof(*bridge_connector), GFP_KERNEL);
if (!bridge_connector)
@@ -376,6 +378,9 @@ struct drm_connector *drm_bridge_connector_init(struct drm_device *drm,

if (drm_bridge_is_panel(bridge))
panel_bridge = bridge;
+
+ if (bridge->support_hdcp)
+ support_hdcp = true;
}

if (connector_type == DRM_MODE_CONNECTOR_Unknown) {
@@ -398,6 +403,9 @@ struct drm_connector *drm_bridge_connector_init(struct drm_device *drm,
if (panel_bridge)
drm_panel_bridge_set_orientation(connector, panel_bridge);

+ if (support_hdcp && IS_ENABLED(CONFIG_DRM_DISPLAY_HDCP_HELPER))
+ drm_connector_attach_content_protection_property(connector, true);
+
return connector;
}
EXPORT_SYMBOL_GPL(drm_bridge_connector_init);
diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h
index 6b65b0dfb4fb..1d2ab70f3436 100644
--- a/include/drm/drm_bridge.h
+++ b/include/drm/drm_bridge.h
@@ -768,6 +768,10 @@ struct drm_bridge {
* modes.
*/
bool interlace_allowed;
+ /**
+ * @support_hdcp: Indicate that the bridge supports HDCP.
+ */
+ bool support_hdcp;
/**
* @ddc: Associated I2C adapter for DDC access, if any.
*/
--
2.38.1.431.g37b22c650d-goog



2022-11-14 20:37:52

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH v4 1/3] drm_bridge: register content protect property

Hi Hsin-Yi,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on drm-misc/drm-misc-next]
[also build test ERROR on linus/master v6.1-rc5 next-20221114]
[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#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Hsin-Yi-Wang/drm_bridge-register-content-protect-property/20221114-160627
base: git://anongit.freedesktop.org/drm/drm-misc drm-misc-next
patch link: https://lore.kernel.org/r/20221114080405.2426999-1-hsinyi%40chromium.org
patch subject: [PATCH v4 1/3] drm_bridge: register content protect property
config: i386-randconfig-m021-20221114
compiler: gcc-11 (Debian 11.3.0-8) 11.3.0
reproduce (this is a W=1 build):
# https://github.com/intel-lab-lkp/linux/commit/f6318b73e52e83f96d0f09275a836bee3f780cc6
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Hsin-Yi-Wang/drm_bridge-register-content-protect-property/20221114-160627
git checkout f6318b73e52e83f96d0f09275a836bee3f780cc6
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>

All errors (new ones prefixed by >>):

ld: drivers/gpu/drm/drm_bridge_connector.o: in function `drm_bridge_connector_init':
>> drivers/gpu/drm/drm_bridge_connector.c:407: undefined reference to `drm_connector_attach_content_protection_property'
pahole: .tmp_vmlinux.btf: No such file or directory
.btf.vmlinux.bin.o: file not recognized: file format not recognized


vim +407 drivers/gpu/drm/drm_bridge_connector.c

310
311 /* -----------------------------------------------------------------------------
312 * Bridge Connector Initialisation
313 */
314
315 /**
316 * drm_bridge_connector_init - Initialise a connector for a chain of bridges
317 * @drm: the DRM device
318 * @encoder: the encoder where the bridge chain starts
319 *
320 * Allocate, initialise and register a &drm_bridge_connector with the @drm
321 * device. The connector is associated with a chain of bridges that starts at
322 * the @encoder. All bridges in the chain shall report bridge operation flags
323 * (&drm_bridge->ops) and bridge output type (&drm_bridge->type), and none of
324 * them may create a DRM connector directly.
325 *
326 * Returns a pointer to the new connector on success, or a negative error
327 * pointer otherwise.
328 */
329 struct drm_connector *drm_bridge_connector_init(struct drm_device *drm,
330 struct drm_encoder *encoder)
331 {
332 struct drm_bridge_connector *bridge_connector;
333 struct drm_connector *connector;
334 struct i2c_adapter *ddc = NULL;
335 struct drm_bridge *bridge, *panel_bridge = NULL;
336 int connector_type;
337 bool support_hdcp = false;
338
339 bridge_connector = kzalloc(sizeof(*bridge_connector), GFP_KERNEL);
340 if (!bridge_connector)
341 return ERR_PTR(-ENOMEM);
342
343 bridge_connector->encoder = encoder;
344
345 /*
346 * TODO: Handle doublescan_allowed, stereo_allowed and
347 * ycbcr_420_allowed.
348 */
349 connector = &bridge_connector->base;
350 connector->interlace_allowed = true;
351
352 /*
353 * Initialise connector status handling. First locate the furthest
354 * bridges in the pipeline that support HPD and output detection. Then
355 * initialise the connector polling mode, using HPD if available and
356 * falling back to polling if supported. If neither HPD nor output
357 * detection are available, we don't support hotplug detection at all.
358 */
359 connector_type = DRM_MODE_CONNECTOR_Unknown;
360 drm_for_each_bridge_in_chain(encoder, bridge) {
361 if (!bridge->interlace_allowed)
362 connector->interlace_allowed = false;
363
364 if (bridge->ops & DRM_BRIDGE_OP_EDID)
365 bridge_connector->bridge_edid = bridge;
366 if (bridge->ops & DRM_BRIDGE_OP_HPD)
367 bridge_connector->bridge_hpd = bridge;
368 if (bridge->ops & DRM_BRIDGE_OP_DETECT)
369 bridge_connector->bridge_detect = bridge;
370 if (bridge->ops & DRM_BRIDGE_OP_MODES)
371 bridge_connector->bridge_modes = bridge;
372
373 if (!drm_bridge_get_next_bridge(bridge))
374 connector_type = bridge->type;
375
376 if (bridge->ddc)
377 ddc = bridge->ddc;
378
379 if (drm_bridge_is_panel(bridge))
380 panel_bridge = bridge;
381
382 if (bridge->support_hdcp)
383 support_hdcp = true;
384 }
385
386 if (connector_type == DRM_MODE_CONNECTOR_Unknown) {
387 kfree(bridge_connector);
388 return ERR_PTR(-EINVAL);
389 }
390
391 drm_connector_init_with_ddc(drm, connector, &drm_bridge_connector_funcs,
392 connector_type, ddc);
393 drm_connector_helper_add(connector, &drm_bridge_connector_helper_funcs);
394
395 if (bridge_connector->bridge_hpd) {
396 connector->polled = DRM_CONNECTOR_POLL_HPD;
397 drm_bridge_connector_enable_hpd(connector);
398 }
399 else if (bridge_connector->bridge_detect)
400 connector->polled = DRM_CONNECTOR_POLL_CONNECT
401 | DRM_CONNECTOR_POLL_DISCONNECT;
402
403 if (panel_bridge)
404 drm_panel_bridge_set_orientation(connector, panel_bridge);
405
406 if (support_hdcp && IS_ENABLED(CONFIG_DRM_DISPLAY_HDCP_HELPER))
> 407 drm_connector_attach_content_protection_property(connector, true);

--
0-DAY CI Kernel Test Service
https://01.org/lkp


Attachments:
(No filename) (5.89 kB)
config (152.56 kB)
Download all attachments