From patchwork Sat Dec 14 13:37:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13908465 Received: from mail-lj1-f171.google.com (mail-lj1-f171.google.com [209.85.208.171]) (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 655BC194096 for ; Sat, 14 Dec 2024 13:37:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734183440; cv=none; b=sU3Q4+XICos0bAzJseaIhCFcxWrS+kjHElM3/lfthyOoqrniWHzvY+wsy1BN98i9Hn+HMmRf9KKzbhTrrxrz2KqdZmZDhYJx+RZwOA8oeDO7dPGNhRdyFIql/dXaYGCbJxCqWLxeFSP/f4kR4Y5HZMY8DKQyx7lvDLApJ6qW5q8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734183440; c=relaxed/simple; bh=ZBQ31V6liiRq6vidYEbRih6I4hmj1n9WetjDV7X3pNY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=KZQELmp0EhhZwKYb2/vDIrzNrnjKFyKN5zW9U1Qzt6+0+20BONDGAXT3xemuKqUZU1SQ5kS0pfA28uED4OevvyPbk3JQIGUixZ/nppgySD7AemZ7+Tg1hgz/QS9FAYBG4SSN0lgRvJwjUqN+LndRssJPEbvBiFLxZv4hBB7vQiA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=OY3pCGyS; arc=none smtp.client-ip=209.85.208.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="OY3pCGyS" Received: by mail-lj1-f171.google.com with SMTP id 38308e7fff4ca-30225b2586cso38407191fa.0 for ; Sat, 14 Dec 2024 05:37:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734183437; x=1734788237; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=wdwpibg0RRPk6EpwAQK84EDSpk8VUe5onS1+M5umUds=; b=OY3pCGySGBDFuNifo0BULnr0GzMejSUdm/FBcMmIdw/uG2dlkc7SURt/+OKNGx63h7 JZZpwcWk+LXdH3Q2WcpHJ9tEfWknaONzAE0b9ScB93urBzZRLqaVKbiVv1EqOwRyIeBA 4e5TM/x5alXlU8VLdUNTOMIVBOWUcp6zGhSPEQe/XjCgsd4lxah011X2Yryqcrshl8RS u4xM6IeKCZ91KnLGrOJmYJRQVnltdJ4aDTLc/gROeclDOYohJgncP+Oh0AHCDyTCjgp1 1r/1xctOToXcYn8aBYNCB7LJDuooeNIQpSEyM95OgqoEg8cqlK9+xwT4p5QV2HBGXYBj PT1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734183437; x=1734788237; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wdwpibg0RRPk6EpwAQK84EDSpk8VUe5onS1+M5umUds=; b=BPOxlOL2SXYtImH4Ykn3E2KddCmPAQOB6lObpQzPAVmm6cyM30Tv8mdnPNkrlfYTjO UpQcrCoEltFJfJzr5tiZrwrCDLtNSJxYZIapYeLguv7Ftrs8cTXDjixIG2tbDVg5NWd9 3ftEQWB6geGliJrp/ztiYoUgUoadlnKHgCbCPehP9BIMGjyTzCgBz5Z31I+a7EK9n+zK EC8O+Td5wTO+jhDZi1IogUXxxT6A9ve5Q9HYlZ+yq1Zd7MH9D9qDJgtZxsotV0anuFY3 1MjohWormqAi4LZU56+pX+afpRAbcv6BzWAO5aI7B30jg6VGJYVcDGNziGYd08r8jBDf L/6A== X-Forwarded-Encrypted: i=1; AJvYcCVxxt0yM7wqcidTnW9PBgzPWHhVB0fJrMQ3laGECJtiUrHmhrIlvxF3nDIHh48HVEd92/iQUCnuKmRC6OJ7@vger.kernel.org X-Gm-Message-State: AOJu0YwzsG6+gf6Q4h1rVt2r1uL41tXfnM7sAJY+wLdCzHcO/1ro3zUJ IWqCIqJxuZpjPb5LbAOFtHmqgI/GRQcUZSA5WsYoKhYLZSetLLuO6HFP4HqwvFw= X-Gm-Gg: ASbGncv/LQTT/LXjcV7VokCT8yYawXWPvh7CcntGITu1UOE/V5KtSJHC4IQBSF1z6fU YcFFEV2tNWK66sF//H8VVBSiHdFOgNEwVFqifAD+aEER5IoLzq6+n/fvFHPdmosuvXmTryXO6/d Y5yZeLeblcnu0N8Mu9NjzHzZzt+2MdGK6uuu+r6eCk+yWTlywM1WDca3n0V8x9oTSFPvLUkOhqm DZDc7eOylVi5a9cJMSb2yCn3XtT8vPCf8Jh5hqEPB2jzPkDiww+d++4GcY9cCBN X-Google-Smtp-Source: AGHT+IFDFHsf0YSq3F9U24ZzRaZqLHjwAZuUnskSeXvaHoyC4Tfjr1H/Oi+lGDIZJQoDaEfr8W2dtQ== X-Received: by 2002:a05:6512:1591:b0:540:20c5:f847 with SMTP id 2adb3069b0e04-5408ad76276mr1606863e87.22.1734183436550; Sat, 14 Dec 2024 05:37:16 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-54120baa474sm220131e87.90.2024.12.14.05.37.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 14 Dec 2024 05:37:16 -0800 (PST) From: Dmitry Baryshkov Date: Sat, 14 Dec 2024 15:37:06 +0200 Subject: [PATCH v2 2/5] drm/amdgpu: don't change mode in amdgpu_dm_connector_mode_valid() Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241214-drm-connector-mode-valid-const-v2-2-4f9498a4c822@linaro.org> References: <20241214-drm-connector-mode-valid-const-v2-0-4f9498a4c822@linaro.org> In-Reply-To: <20241214-drm-connector-mode-valid-const-v2-0-4f9498a4c822@linaro.org> To: Jani Nikula , Rodrigo Vivi , Joonas Lahtinen , Tvrtko Ursulin , David Airlie , Simona Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Karol Herbst , Lyude Paul , Danilo Krummrich , Harry Wentland , Leo Li , Rodrigo Siqueira , Alex Deucher , =?utf-8?q?Christian_K=C3=B6nig?= , Xinhui Pan , Alain Volmat , Raphael Gallais-Pou , Liviu Dudau , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Peter Senna Tschudin , Ian Ray , Martyn Welch , Inki Dae , Seung-Woo Kim , Kyungmin Park , Krzysztof Kozlowski , Alim Akhtar , Stefan Agner , Alison Wang , Patrik Jakobsson , Philipp Zabel , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Rob Clark , Abhinav Kumar , Sean Paul , Marijn Suijten , Dave Airlie , Gerd Hoffmann , Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Andy Yan , Chen-Yu Tsai , Samuel Holland , Thierry Reding , Mikko Perttunen , Jonathan Hunter , Dave Stevenson , =?utf-8?q?Ma=C3=ADra_Cana?= =?utf-8?q?l?= , Raspberry Pi Kernel Maintenance , Gurchetan Singh , Chia-I Wu , Zack Rusin , Broadcom internal kernel review list Cc: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, nouveau@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, imx@lists.linux.dev, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, virtualization@lists.linux.dev, spice-devel@lists.freedesktop.org, linux-rockchip@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-tegra@vger.kernel.org, Laurent Pinchart X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1822; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=ZBQ31V6liiRq6vidYEbRih6I4hmj1n9WetjDV7X3pNY=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnXYoEN8DdEbQT15+majQu+ePNp1xNEKgZhouhG e8cSSkRWPuJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZ12KBAAKCRCLPIo+Aiko 1bo9CACKI34mpGW7I5SEIWTnqccfI1E5Dtim4SK/n6/h7bhcZ4fIdi1jPZNDeFfoInJlcQC8kND J2yGE2Waz+dJVLeD9HrrAIss+FWiq5KGvzYWgYBmjLuJJCE3PKkqoV+6+sFD44LUIBLxdTRdh6F 1T4gKfvqmlDPQFnUhlG3DwphgtSkVOEHHExB8YC0ysIBaeNXz7rClOEu0mGlIZuDjJS/sjgrall atWiYOaDofYW+7dTZ9u0SDpxMVllsbKKomyCy6kf/BSVOIp9veKIrgbybIWQXyNIZgk95KFTa4/ BfCF2//Diwl9V4b6EJ2CMV1tWTpGoVbvzyIZV/xfq0Bc89tB X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A Make amdgpu_dm_connector_mode_valid() duplicate the mode during the test rather than modifying the passed mode. This is a preparation to converting the mode_valid() callback of drm_connector to take a const struct drm_display_mode argument. Reviewed-by: Laurent Pinchart Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c index 5a503104e38d1514103914a4d012969105877e52..0d9d2e1c4b4fd48baa19f16fb832a9ce5ed09108 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -7420,6 +7420,7 @@ enum drm_mode_status amdgpu_dm_connector_mode_valid(struct drm_connector *connec { int result = MODE_ERROR; struct dc_sink *dc_sink; + struct drm_display_mode *test_mode; /* TODO: Unhardcode stream count */ struct dc_stream_state *stream; struct amdgpu_dm_connector *aconnector = to_amdgpu_dm_connector(connector); @@ -7444,11 +7445,16 @@ enum drm_mode_status amdgpu_dm_connector_mode_valid(struct drm_connector *connec goto fail; } - drm_mode_set_crtcinfo(mode, 0); + test_mode = drm_mode_duplicate(connector->dev, mode); + if (!test_mode) + goto fail; + + drm_mode_set_crtcinfo(test_mode, 0); - stream = create_validate_stream_for_sink(aconnector, mode, + stream = create_validate_stream_for_sink(aconnector, test_mode, to_dm_connector_state(connector->state), NULL); + drm_mode_destroy(connector->dev, test_mode); if (stream) { dc_stream_release(stream); result = MODE_OK;