[PATCH v4 0/4] Fix ycbcr_420_allowed inconsistency for HDMI bridges

Cristian Ciocaltea posted 4 patches 11 months, 4 weeks ago
drivers/gpu/drm/display/drm_bridge_connector.c |  8 +++-
drivers/gpu/drm/drm_bridge.c                   |  4 ++
drivers/gpu/drm/drm_connector.c                |  3 ++
drivers/gpu/drm/tests/drm_connector_test.c     | 60 ++++++++++++++++++++++++++
4 files changed, 73 insertions(+), 2 deletions(-)
[PATCH v4 0/4] Fix ycbcr_420_allowed inconsistency for HDMI bridges
Posted by Cristian Ciocaltea 11 months, 4 weeks ago
Bridges with DRM_BRIDGE_OP_HDMI set in drm_bridge->ops are expected to
rely on drm_bridge->supported_formats to advertise the supported
colorspaces, including HDMI_COLORSPACE_YUV420.

However, when drm_bridge_connector gets initialised, only
drm_bridge->ycbcr_420_allowed is considered in the process of adjusting
the drm_connector->ycbcr_420_allowed, which effectively discards the
formats advertised by the HDMI bridge.

This patchset tries to address the issue by prioritizing
supported_formats over ycbcr_420_allowed.

Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
---
Changes in v4:
- Moved the adjustment of bridge connector's supported_formats to a
  separate patch (Dmitry)
- Collected Dmitry's R-b tag for patch "drm/connector: hdmi: Validate
  supported_formats matches ycbcr_420_allowed"
- Rebased series onto drm-misc-next-2024-12-19
- Added new patch to extend HDMI connector output format tests (Maxime)
- Link to v3: https://lore.kernel.org/r/20241217-bridge-conn-fmt-prio-v3-0-3ecb3c8fc06f@collabora.com

Changes in v3:
- Simplified the inconsistency handling by overwriting ycbcr_420_allowed
  for HDMI bridges before adding them to the global bridge list
- Added a 2nd patch to check if supported_formats matches
  ycbcr_420_allowed on HDMI connector initialization (Dmitry)
- Link to v2: https://lore.kernel.org/r/20241206-bridge-conn-fmt-prio-v2-1-85c817529b88@collabora.com

Changes in v2:
- Wrapped HDMI_COLORSPACE_YUV420 flag in the BIT() macro to properly
  check its presence in supported_formats
- Ensured YUV420 gets removed from the bitmask passed to
  drmm_connector_hdmi_init() when ycbcr_420_allowed is not set
- Link to v1: https://lore.kernel.org/r/20241130-bridge-conn-fmt-prio-v1-1-146b663f17f3@collabora.com

---
Cristian Ciocaltea (4):
      drm/bridge: Prioritize supported_formats over ycbcr_420_allowed
      drm/bridge-connector: Sync supported_formats with computed ycbcr_420_allowed
      drm/connector: hdmi: Validate supported_formats matches ycbcr_420_allowed
      drm/tests: connector: Add ycbcr_420_allowed tests

 drivers/gpu/drm/display/drm_bridge_connector.c |  8 +++-
 drivers/gpu/drm/drm_bridge.c                   |  4 ++
 drivers/gpu/drm/drm_connector.c                |  3 ++
 drivers/gpu/drm/tests/drm_connector_test.c     | 60 ++++++++++++++++++++++++++
 4 files changed, 73 insertions(+), 2 deletions(-)
---
base-commit: 1e93f594285faef57651a0c89f61a7d976db7def
change-id: 20241130-bridge-conn-fmt-prio-c517c1407ed5
Re: [PATCH v4 0/4] Fix ycbcr_420_allowed inconsistency for HDMI bridges
Posted by Dmitry Baryshkov 11 months, 1 week ago
On Tue, 24 Dec 2024 20:22:40 +0200, Cristian Ciocaltea wrote:
> Bridges with DRM_BRIDGE_OP_HDMI set in drm_bridge->ops are expected to
> rely on drm_bridge->supported_formats to advertise the supported
> colorspaces, including HDMI_COLORSPACE_YUV420.
> 
> However, when drm_bridge_connector gets initialised, only
> drm_bridge->ycbcr_420_allowed is considered in the process of adjusting
> the drm_connector->ycbcr_420_allowed, which effectively discards the
> formats advertised by the HDMI bridge.
> 
> [...]

Applied to drm-misc-fixes, thanks!

[1/4] drm/bridge: Prioritize supported_formats over ycbcr_420_allowed
      commit: d102ac39fbe181a6f0c9e98bc26bd94018657808
[2/4] drm/bridge-connector: Sync supported_formats with computed ycbcr_420_allowed
      commit: 1bd1562d3522f7a846dad795359c31b371e6303b
[3/4] drm/connector: hdmi: Validate supported_formats matches ycbcr_420_allowed
      commit: f2f96619590f944f74f3c2b0b57a6dcc5d13cd9f
[4/4] drm/tests: connector: Add ycbcr_420_allowed tests
      commit: 93801b8c2d18546fdf807c8e3075e6df93960446

Best regards,
-- 
With best wishes
Dmitry
Re: [PATCH v4 0/4] Fix ycbcr_420_allowed inconsistency for HDMI bridges
Posted by Maxime Ripard 11 months, 2 weeks ago
On Tue, 24 Dec 2024 20:22:40 +0200, Cristian Ciocaltea wrote:
> Bridges with DRM_BRIDGE_OP_HDMI set in drm_bridge->ops are expected to
> rely on drm_bridge->supported_formats to advertise the supported
> colorspaces, including HDMI_COLORSPACE_YUV420.
> 
> However, when drm_bridge_connector gets initialised, only
> 
> [ ... ]

Reviewed-by: Maxime Ripard <mripard@kernel.org>

Thanks!
Maxime
Re: [PATCH v4 0/4] Fix ycbcr_420_allowed inconsistency for HDMI bridges
Posted by Dmitry Baryshkov 11 months, 2 weeks ago
On Mon, Jan 06, 2025 at 02:55:52PM +0000, Maxime Ripard wrote:
> On Tue, 24 Dec 2024 20:22:40 +0200, Cristian Ciocaltea wrote:
> > Bridges with DRM_BRIDGE_OP_HDMI set in drm_bridge->ops are expected to
> > rely on drm_bridge->supported_formats to advertise the supported
> > colorspaces, including HDMI_COLORSPACE_YUV420.
> > 
> > However, when drm_bridge_connector gets initialised, only
> > 
> > [ ... ]
> 
> Reviewed-by: Maxime Ripard <mripard@kernel.org>

Thanks!

I thought about picking up those patches, but then I deciced to ask you
first. I think first two patches should go to drm-next-fixes? Or just
drm-fixes? While the last two patches look kike a drm-next material.

-- 
With best wishes
Dmitry
Re: [PATCH v4 0/4] Fix ycbcr_420_allowed inconsistency for HDMI bridges
Posted by Maxime Ripard 11 months, 1 week ago
On Tue, Jan 07, 2025 at 01:36:59PM +0200, Dmitry Baryshkov wrote:
> On Mon, Jan 06, 2025 at 02:55:52PM +0000, Maxime Ripard wrote:
> > On Tue, 24 Dec 2024 20:22:40 +0200, Cristian Ciocaltea wrote:
> > > Bridges with DRM_BRIDGE_OP_HDMI set in drm_bridge->ops are expected to
> > > rely on drm_bridge->supported_formats to advertise the supported
> > > colorspaces, including HDMI_COLORSPACE_YUV420.
> > > 
> > > However, when drm_bridge_connector gets initialised, only
> > > 
> > > [ ... ]
> > 
> > Reviewed-by: Maxime Ripard <mripard@kernel.org>
> 
> Thanks!
> 
> I thought about picking up those patches, but then I deciced to ask you
> first. I think first two patches should go to drm-next-fixes? Or just
> drm-fixes? While the last two patches look kike a drm-next material.

Everything can go in drm-misc-fixes imo.

Maxime