From nobody Mon Feb 9 04:03:46 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 2E5B523D7FC; Wed, 21 Jan 2026 14:48:11 +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=1769006893; cv=pass; b=fcYGji/NwoX3d1GLaP4szKTjSrzD0Lonhp006cems0eUaVxP/nxuW+vQL5dQlK+HgGB1DmBx/leFPgR+Ss8j4XpFsKBKUYn2W2MI2UanTuT7E4pv2GZV/IwauIE/Z0EyuN0IRmwBbNaRJJYxN+S1Xbnre1dUmxlbFvd92bQGZvs= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769006893; c=relaxed/simple; bh=2WGWemvggyAVHbh9yxw2EmLB0K45mP8wOfzhuqmWq7c=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=jeQ8zL9ECSJ9+XvudDY9ZlG9agdvGts/WSBsGw6KUb4Cy/H9lVvSQyLgI4ZswVVBdix8YKIB6O2NWwN03Q5g+XypIN/rV3uO33aFS79GYpn0WnFemUms06TUUC8fhV6kFkA4BPkn5zJBuuY8HHF2qJNd0nBUYVJPec2GcDmn5UI= 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=i3HCMZkb; 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="i3HCMZkb" ARC-Seal: i=1; a=rsa-sha256; t=1769006846; cv=none; d=zohomail.com; s=zohoarc; b=GZRS9/QrTSgn+sVd5CbvC/Xq7QwM0htUnu0Ze3x0KgJDyk8XloTanMlH7YMAK0L5wQd2bmKhVWCGS9tgdMkEy3WYPd+sRPBas0wiMv/zzx/m39eIUp/VrRLCtZ84aiMhUv87zvmoe1yd9JAoHIS1Y5Yv3/CbX6a1XQHUqG35TTE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769006846; 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=f/dPa8/XOYz7qB04z0dJYNU7dAB40hItd8+HxgRUc9uPUg7sitGII2FK0GPglzvqXgXyxNmOa3T5Nx0lO0F4kOTMc0H03GUrFAKfdV/+ue7jUf8gSWKihM/cgEMyctRSv65usRr8+Jr3Wis7F5hyA2ldt0VhRuWBtgWw4h6m74s= 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=1769006846; 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=i3HCMZkbL330SrwpU4V54aFa0GDEHtfardVjSqpSY/UA0cm16cNIRV1fqIdKYP6D 5yf30wL2W/9quG3tPIcii36FYrgBnGz39yfHe90qQBVcwZg/BLIE+eYA4/uh0C28jKu P+CWAHYg1Pi9X7MxLQX2IfvhBhYFgOsaCTuv3PGA= Received: by mx.zohomail.com with SMTPS id 1769006843539575.0690718277707; Wed, 21 Jan 2026 06:47:23 -0800 (PST) From: Nicolas Frattaroli Date: Wed, 21 Jan 2026 15:45:21 +0100 Subject: [PATCH v7 14/22] 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-v7-14-ef790dae780c@collabora.com> References: <20260121-color-format-v7-0-ef790dae780c@collabora.com> In-Reply-To: <20260121-color-format-v7-0-ef790dae780c@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