From nobody Mon Feb 9 08:55:13 2026 Received: from sender4-pp-f112.zoho.com (sender4-pp-f112.zoho.com [136.143.188.112]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BD1F6425CED; Wed, 21 Jan 2026 13:48:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.188.112 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769003314; cv=pass; b=EGJoYYvR4FLCgLpW88MpbGLlceCjCkzScBGGnfsMzMv62yprqmFw8WYtPAAnsQP9YJVcYWQQwg/uUNZIgufkyckY4dtpTUx2C4qV/QgOD9n+0QMOocA/KpTRUOw3CEFz+h/2BrWyGTgh8Dxa0Tb6TWlioUW4jo+hO40OmtFBEgw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769003314; c=relaxed/simple; bh=2WGWemvggyAVHbh9yxw2EmLB0K45mP8wOfzhuqmWq7c=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=K9kxHxfYIW4TIyOjnIQUZgb9z15378UsBmXP8LPOrnERRMdSPHYq065kDwd+tJ5fTUhXmpHLDAmBCNE7GZZjTQNuKM5t6lctsbZxlm6TGO6jHyh5rQIdvdpQraTYA7oGJKQyzanNONIY1C1Vzhsp1hExLYgVESWLAjeOHPMR+No= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (1024-bit key) header.d=collabora.com header.i=nicolas.frattaroli@collabora.com header.b=N3OyL3JI; arc=pass smtp.client-ip=136.143.188.112 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=collabora.com header.i=nicolas.frattaroli@collabora.com header.b="N3OyL3JI" ARC-Seal: i=1; a=rsa-sha256; t=1769003267; cv=none; d=zohomail.com; s=zohoarc; b=bg6117jJr729sFxLoNVNtJ12kdLxqQkhl/AU94N9fu+G1X+JuTVkAm4ypLGaSa+G3OIILcDXmU88OKNe+EKCkwUXeDL0skOaIXihXyVArcKUMbrljA0a/QXJx1p45jJNY98LaLkrdpbegz5pFJJuO/24sOhp2fncN+Ozjy2VvvU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769003267; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=7Yjl7AEz7PGojFt2JYw9FMo7Abi02d/7TPFmWTuR52w=; b=RiUkyeA6EfJUZi0X7Lyose5BGL2wZveCPKK5gVkX+xg5oi5p/MIdMGwdyb5ey0wEpIDl5x1uZlr/rK9YsyhCRa3WiJBnLC04hZs6JUjrt//s4aBeBMMGyDlANzXCXHNZ7nE7fu0roh6WzMgp8CsXGW8ueFn9KP5DS0ynESFJxpM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=collabora.com; spf=pass smtp.mailfrom=nicolas.frattaroli@collabora.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1769003267; s=zohomail; d=collabora.com; i=nicolas.frattaroli@collabora.com; h=From:From:Date:Date:Subject:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Message-Id:References:In-Reply-To:To:To:Cc:Cc:Reply-To; bh=7Yjl7AEz7PGojFt2JYw9FMo7Abi02d/7TPFmWTuR52w=; b=N3OyL3JIgoj3a8y4KBnjXINcQU2lSMmGaFe9fNLwZBeu3AgIQHpu9mt7dYmOCHKU NsXDwIIIjRT5D/dQtlww9YUXSZU17CoCcRN1tzPSHMytCaTXJAm1/GIxT2Lla6KcmMZ Nx9mkxBWvAe4AFcJ5QncVeIQbrKHXYUFr1AdlbmM= Received: by mx.zohomail.com with SMTPS id 176900326583051.079850612094674; Wed, 21 Jan 2026 05:47:45 -0800 (PST) From: Nicolas Frattaroli Date: Wed, 21 Jan 2026 14:45:40 +0100 Subject: [PATCH v6 14/21] drm/bridge: dw-hdmi-qp: Implement atomic_get_output_bus_fmts Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260121-color-format-v6-14-7b81a771cd0b@collabora.com> References: <20260121-color-format-v6-0-7b81a771cd0b@collabora.com> In-Reply-To: <20260121-color-format-v6-0-7b81a771cd0b@collabora.com> To: Harry Wentland , Leo Li , Rodrigo Siqueira , Alex Deucher , =?utf-8?q?Christian_K=C3=B6nig?= , David Airlie , Simona Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Andy Yan , Jani Nikula , Rodrigo Vivi , Joonas Lahtinen , Tvrtko Ursulin , Dmitry Baryshkov , Sascha Hauer , Rob Herring , Jonathan Corbet Cc: kernel@collabora.com, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org, linux-doc@vger.kernel.org, Nicolas Frattaroli X-Mailer: b4 0.14.3 The atomic_get_output_bus_fmts callback is used by the DRM bridge layer to recursively select a suitable output format in a bridge chain. As a bridge that outputs to HDMI, dw-hdmi-qp will have its output formats determined by which formats the platform-specific integration of the hardware supports, and the chosen HDMI output bit depth. Implement this callback. The returned u32* buffer is supposed to be freed by the caller of this callback, as specified by the callback's documentation. Signed-off-by: Nicolas Frattaroli --- drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c | 64 ++++++++++++++++++++++++= ++++ 1 file changed, 64 insertions(+) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c b/drivers/gpu/drm= /bridge/synopsys/dw-hdmi-qp.c index ab7fed6214e0..82a63964f7f7 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -862,6 +863,68 @@ static int dw_hdmi_qp_config_audio_infoframe(struct dw= _hdmi_qp *hdmi, return 0; } =20 +static u32* +dw_hdmi_qp_bridge_get_output_bus_fmts(struct drm_bridge *bridge, + struct drm_bridge_state *bridge_state, + struct drm_crtc_state *crtc_state, + struct drm_connector_state *conn_state, + unsigned int *num_output_fmts) +{ + unsigned int num_fmts =3D 0; + u32 *out_fmts; + + /* + * bridge->supported_formats is a bit field of the HDMI_COLORSPACE_* enum= s. + * These enums are defined by the HDMI standard, and currently top out at + * 7. Consequently, BIT(7) is the highest bit that will be set here, unle= ss + * the standard runs out of reserved pixel formats. Therefore, hweight8() + * will give an accurate count of how many bus formats we'll output. + */ + out_fmts =3D kmalloc_array(hweight8(bridge->supported_formats), sizeof(u3= 2), + GFP_KERNEL); + if (!out_fmts) { + *num_output_fmts =3D 0; + return NULL; + } + + switch (conn_state->hdmi.output_bpc) { + case 12: + if (bridge->supported_formats & BIT(HDMI_COLORSPACE_RGB)) + out_fmts[num_fmts++] =3D MEDIA_BUS_FMT_RGB121212_1X36; + if (bridge->supported_formats & BIT(HDMI_COLORSPACE_YUV444)) + out_fmts[num_fmts++] =3D MEDIA_BUS_FMT_YUV12_1X36; + if (bridge->supported_formats & BIT(HDMI_COLORSPACE_YUV422)) + out_fmts[num_fmts++] =3D MEDIA_BUS_FMT_UYVY12_1X24; + if (bridge->supported_formats & BIT(HDMI_COLORSPACE_YUV420)) + out_fmts[num_fmts++] =3D MEDIA_BUS_FMT_UYYVYY12_0_5X36; + break; + case 10: + if (bridge->supported_formats & BIT(HDMI_COLORSPACE_RGB)) + out_fmts[num_fmts++] =3D MEDIA_BUS_FMT_RGB101010_1X30; + if (bridge->supported_formats & BIT(HDMI_COLORSPACE_YUV444)) + out_fmts[num_fmts++] =3D MEDIA_BUS_FMT_YUV10_1X30; + if (bridge->supported_formats & BIT(HDMI_COLORSPACE_YUV422)) + out_fmts[num_fmts++] =3D MEDIA_BUS_FMT_UYVY10_1X20; + if (bridge->supported_formats & BIT(HDMI_COLORSPACE_YUV420)) + out_fmts[num_fmts++] =3D MEDIA_BUS_FMT_UYYVYY10_0_5X30; + break; + default: + if (bridge->supported_formats & BIT(HDMI_COLORSPACE_RGB)) + out_fmts[num_fmts++] =3D MEDIA_BUS_FMT_RGB888_1X24; + if (bridge->supported_formats & BIT(HDMI_COLORSPACE_YUV444)) + out_fmts[num_fmts++] =3D MEDIA_BUS_FMT_YUV8_1X24; + if (bridge->supported_formats & BIT(HDMI_COLORSPACE_YUV422)) + out_fmts[num_fmts++] =3D MEDIA_BUS_FMT_UYVY8_1X16; + if (bridge->supported_formats & BIT(HDMI_COLORSPACE_YUV420)) + out_fmts[num_fmts++] =3D MEDIA_BUS_FMT_UYYVYY8_0_5X24; + break; + } + + *num_output_fmts =3D num_fmts; + + return out_fmts; +} + static void dw_hdmi_qp_bridge_atomic_enable(struct drm_bridge *bridge, struct drm_atomic_state *state) { @@ -1213,6 +1276,7 @@ static int dw_hdmi_qp_cec_transmit(struct drm_bridge = *bridge, u8 attempts, #endif /* CONFIG_DRM_DW_HDMI_QP_CEC */ =20 static const struct drm_bridge_funcs dw_hdmi_qp_bridge_funcs =3D { + .atomic_get_output_bus_fmts =3D dw_hdmi_qp_bridge_get_output_bus_fmts, .atomic_duplicate_state =3D drm_atomic_helper_bridge_duplicate_state, .atomic_destroy_state =3D drm_atomic_helper_bridge_destroy_state, .atomic_reset =3D drm_atomic_helper_bridge_reset, --=20 2.52.0