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: 13908489 Received: from mail-lj1-f179.google.com (mail-lj1-f179.google.com [209.85.208.179]) (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 79B35194C85 for ; Sat, 14 Dec 2024 13:37:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734183441; cv=none; b=GvfSEHs3pPocmh2aEmcn7rePnNPJmlpJ4IUCAwL7j6kAWHeja/kpydAsZ0uaXE3mXNhQi15l56RPa2KvulTfO44ReuTdf2W8FCCod0T0ZmoTh3/eLxcUrViJH5AauYUYoO+KqUyFs2hwtsNNbMhVsFjjc6cNp2m6CvK6y/G1w5Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734183441; c=relaxed/simple; bh=ZBQ31V6liiRq6vidYEbRih6I4hmj1n9WetjDV7X3pNY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=qqjp0IuTjkIdcXv0KabL0DZhig5gyfcXym1scGGPj5dE7gMYFLoJWQFgmbMlSy4EjCAt+hEv2Lcde19lsaLaPSXO8n9o08ud4N/TeBvhCxB2TuHTggDcwuFaJcQfq15rncFAWsQsG0VNm4VoadbUNSs6O3emwuGz0zirHvYz3JY= 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.179 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-f179.google.com with SMTP id 38308e7fff4ca-30225b2586cso38407341fa.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=tm/CvpER7R3gxUVMP7cFxRQ7QO7qqTuTt6jJppq5A9r7KIHfUbwQwTV2rhW2H9AMCj pRa5/G1N8Vj2DRQH4nqb/CEeLQKCumxfeWOElsTndbCO0F737F0Pe54lnoZX8/6JSWdk O2t3HBsmZNHve7kHw0wAyl7Uq9fT0ydt1lFobK9W2LwbmqPXzjtQKn+ud4I2snC21LuJ +R4gyvpzvWBT9kwkht+sI9GG0tT7jqoJV7TefLgWUH9x9flbUAMI/01j7hHFIL1RdXK4 +7JyUHMpAjycWxYJmIKdcywy6HmGH2BpvvB7MLrSKUcSjTg2jfzQLBuorYe4LSiirISh oOEQ== X-Forwarded-Encrypted: i=1; AJvYcCWO2TakSqtFuuhJSKkXYXXcz5KpqBlOfr5EdS1Emsvw02GdVAtK1oNwDtgEHWL9i5mIEJYGqpRVdy9Yq0tRNv/Lxg==@vger.kernel.org X-Gm-Message-State: AOJu0YwlRTbqjG7jUEeYp3lMucI1GY5rJPm9vG6MKYmBludNrD7lR/0H 3qBBfnCXJcwJmLkkx2IQcy9P/sqHH/q9OQbZBqCOBs4NyFaISL1vRtYIVkL1ub4= X-Gm-Gg: ASbGncvNlXJLZk8ExxhaWvr2O+wkj0XEDmaVmBNJWGN2uhQ/vAMiql0A78zFg1kFFOJ PIQpj3jo4R4eu6DnB90hCXuobRYTwG77WeKoLj+R3i/7OcUQ26J0BFvXHnuiKguE5cUjrtUpCb7 6oORrSRJ8y4xKEL8AhfXipYMT2pgVibgCxoVu9EVEUi77fblyL8A+VRUGfZYFbfda/bke3ClBsn b/jO8LhbtviIn31X9J0q8+D1qoSjSQX8N09ll71g0eysoViAKl0uKG+aV1wR5Rg 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-samsung-soc@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;