From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E840537C927 for ; Sat, 8 Aug 2026 09:58:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786183106; cv=none; b=KDVcUmo8/coBsyvyxelF33YWCmLT0iAA1VNAC52Bn6aDW6VmtFXVeKtzskaDdJduCTP5VBHcZdWnWgDb6Wk1bEnezKMgXYGeNnoJjU3jz69vtCVRPg9UG+odL3T3Nlj6ymblSxR/jRpINeqUcN8190XU/GS3AIv01A3k5gncrLw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786183106; c=relaxed/simple; bh=DQ6b8XRFFKt9UMJcIHgpSIL79qneL725jiudg5+394A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tz4UPts2tp15QGm95XVOFI2ZPs3g4a6VdD2bNhkPxpCO6nK35DKZt82z030JCQQZ/wsx5/dOI9KowXCvN1BJV18VVSR1cZYkJcE1xEXbuAqas6OdHK64dKPEqQM8DSxXn9o0cSYXnatwODKuP4MU09bWm14Fu8lA9xNzh5K8NWw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ZgGQ/Rts; arc=none smtp.client-ip=209.85.221.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ZgGQ/Rts" Received: by mail-wr1-f42.google.com with SMTP id ffacd0b85a97d-47df6a5655aso40641f8f.1 for ; Sat, 08 Aug 2026 02:58:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1786183103; x=1786787903; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=bygF4+CGk1HszXnKQxQkJUMmXmQwnL2yRQrBPqNom6w=; b=ZgGQ/RtsO4lkNizRats3AC5PjhkBE5LfhZqd3snRXlzI2pVZtLb+KeXcHTASie+0sc r2aZmU2pZ54bhU97+22EFqIMEFoXuGWvJJn5dhlZoJteDArTtovWsykaE93HvR0Qwut0 IBTWctP84yQuhZoMQlGkYIqT7XKACYTsLwdiBDUbJWY3Cwy/8j7dzKk4dwUouTIXnkgg HH+NnKi6HOnQLb43CU3E5QU0Rqc+/IV5pMIUJdmS/my9XnT16akjFyPt9IEwbigCO0o0 Q1M3/STBSBosHQbRYbpO52Z7L6rZHnhYL//F4ifVWrYULYzrxQlTaCEFKWVuEcwExQkr dq4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786183103; x=1786787903; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=bygF4+CGk1HszXnKQxQkJUMmXmQwnL2yRQrBPqNom6w=; b=cFJZZAcCrOSvLQHT8jzPN+XeN4M2GtYSrcSQzhVelMhtBlnQQNqb8nbG30Sd2DwdDh 23EcvHj+A0+EXjDPy7FcpH3yvcrnQhnk/bKrkMiSL7M/fco9ANqLeuFH+KvmkoA3X7l7 BMdRTaMrf8M6ygNCN9WW8h7YnnSepMnoKhFi8ZVuKKw9qNyPg1OpWSoTGxZ1h2Sqy5bH 19YNOwSNQOv9gNSIit+dR5w/8UFQetE/nxxLxHZNQlfC7iFt5r1cah62wLY25d3YMdvJ SA1WUUuFGNEFTilpG7a4fDIVYLaT9Bf2U4Jg5giiMGQt8rP4jsFfXBHznau3K03qcMH8 /bSg== X-Forwarded-Encrypted: i=1; AHgh+Ro4HAMYx+UshKKNs3bu4zdQNZcjhS2/NUcZIfEmsqRyYmay029sx2WlwwivGeV7+CqXAAm5/4SgCwsUO7I=@vger.kernel.org X-Gm-Message-State: AOJu0YyAwfSVbiYG+nH04i9w0MeEVQemB75L+hV8DWCV2vDbGztj8yP2 J+VifXUj0tGJCHcJIZKl7eBSiwscf/uPK6iTlZZGwQYx8RPzjP+QRy+H X-Gm-Gg: AR+sD109xn9D1EIq3wKXy/e0B8scb7OYZfsp/2EpmH/U3rA89s82Lkn6+MSRmJOs2D3 ncdDKyZ26YE2hn1Mat+ROQgtwl9LQN42S66JaPzBdYsAukQUmafAEgv8ZaF0K9d3XCD++zux5sf wQCt5UWRgWhoiW3mUqEdvX1u6jAabOgaEpCCka+tVZoYPAUYbFrRXXbBsKlHtBhtoXzOOubAon+ WuDdnm4EVDCWlGh/QpS9Aeix3e1HB4ol7lEkXqE1HiDE3uRM4h5qPztyfD6aCbGuSjOtON2d8li 55GZtKEjhfF/u52oitQcjqEhpdVRggaW12Jt/egZwzVkkIREyAKVThdWWi/30KDdGTZUqEQRMDP Nz9IpOmX7pGIai9rxbV0rU3gTk8rXE2ieQt8eX94ind8CuIujQS/fqXUwrFT4/6V627eToF9rB0 N3w2ABhNy+YEJAxPvsXdCOT/abdX3BNaCpWV0mZTbJCViOkGkYaDUTeYdlCdNJk696+9/Eiyi4v HZGaYbP8SxolPwKfsLiU290KNqZuE7EBtQWDfrZoBxJYCk404NJqMr5sti9jPYLWL0+fQ== X-Received: by 2002:a05:6000:401f:b0:47f:7e91:3d55 with SMTP id ffacd0b85a97d-47fec520b24mr21741731f8f.2.1786183103128; Sat, 08 Aug 2026 02:58:23 -0700 (PDT) Received: from OrangePi5-Plus.BB-HOME (20014C4E1B8E20009911270F4BEC2300.dsl.pool.telekom.hu. [2001:4c4e:1b8e:2000:9911:270f:4bec:2300]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-480020be8f3sm13255725f8f.0.2026.08.08.02.58.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 08 Aug 2026 02:58:22 -0700 (PDT) From: Igor Paunovic To: dri-devel@lists.freedesktop.org Cc: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org, linux-rockchip@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Sebastian Reichel , Cristian Ciocaltea , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Luca Ceresoli , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Dmitry Baryshkov , Sandy Huang , =?UTF-8?q?Heiko=20St=C3=BCbner?= , Andy Yan , Jani Nikula , Rodrigo Vivi , =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= , Imre Deak , Ankit Nautiyal , Igor Paunovic Subject: [PATCH 3/5] drm/rockchip: dw_dp: Attach "max bpc" connector property Date: Sat, 8 Aug 2026 11:57:22 +0200 Message-ID: <20260808095749.9428-4-royalnet026@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260808095749.9428-1-royalnet026@gmail.com> References: <20260808095749.9428-1-royalnet026@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The dw-dp bridge already filters candidate output formats on conn_state->max_bpc in dw_dp_bridge_atomic_get_output_bus_fmts() and validates the result against the link bandwidth, but the connector never exposes the "max bpc" property, so userspace cannot limit the bit depth. Attach the property with a range of 6 to 10, matching dw_dp_output_formats[]: the smallest entry is 6 bpc RGB and the deepest entries are 10 bpc. drm_connector_attach_max_bpc_property() initializes connector->state->max_requested_bpc and therefore requires the connector to have a state. Rockchip binds its components before drm_mode_config_reset() runs, so the freshly created bridge connector does not have one yet - create the connector state before attaching the property, exactly like drmm_connector_hdmi_init() does for HDMI bridge connectors. The later drm_mode_config_reset() then re-creates the connector state, and the preceding patch makes drm_bridge_connector_create_state() restore max_requested_bpc from connector->max_bpc, so clients that never set the property (fbcon in particular) keep the full range instead of ending up with 0. With the property attached, compositors such as KWin write "max bpc" on every atomic modeset; any in-range value is handled by the existing format filter and bandwidth checks. Signed-off-by: Igor Paunovic --- drivers/gpu/drm/rockchip/dw_dp-rockchip.c | 26 +++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/drivers/gpu/drm/rockchip/dw_dp-rockchip.c b/drivers/gpu/drm/rockchip/dw_dp-rockchip.c index 770ab042a187..4dc29963b5d8 100644 --- a/drivers/gpu/drm/rockchip/dw_dp-rockchip.c +++ b/drivers/gpu/drm/rockchip/dw_dp-rockchip.c @@ -172,6 +172,32 @@ static int dw_dp_rockchip_bind(struct device *dev, struct device *master, void * "Failed to init bridge connector\n"); } + /* + * The components are bound before drm_mode_config_reset() runs, so + * the connector has no state yet, but + * drm_connector_attach_max_bpc_property() requires one. Create the + * connector state first, like drmm_connector_hdmi_init() does. + */ + if (connector->funcs->atomic_create_state) { + struct drm_connector_state *state; + + state = connector->funcs->atomic_create_state(connector); + if (IS_ERR(state)) { + dw_dp_unbind(dp->base); + return PTR_ERR(state); + } + + connector->state = state; + } else if (connector->funcs->reset) { + connector->funcs->reset(connector); + } + + ret = drm_connector_attach_max_bpc_property(connector, 6, 10); + if (ret) { + dw_dp_unbind(dp->base); + return ret; + } + return 0; } -- 2.43.0