From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 9A2D6227EBB; Mon, 2 Jun 2025 14:56:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748876170; cv=none; b=bHOOq+V2LG6xkAuaDJd9XL4cmmN6yzKUuAaV+9o0KGV6usGxLa1Jhr/7t176LuDyeh+6YCUPEhQNx2e5T6ZTXgpTTkeFfA8dQZ3KiGnE/fvnjg9D1Vx/fLjW2VdrPXj5PeKoHMw6D+lMNK3MKijN6RPhX0VvNP7KbjXxdP34St0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748876170; c=relaxed/simple; bh=gYH48MTMQ895llNpciwbE33g0PyBEQ1PV+wLTwhTwOs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=aYf9vzJVDzbaIVRdjiWyDKh9AjWIyefezRi2jBTeyLau3qS3NnloW1Sdf833UIcYYlnyQ+Coex9VG0/rl6rwOxJHz3z9B4/XavM8m1JAdd9+HLzAJ5FIgxGo9/w22l9eU0WrgFe6Y1WZmGM3ChR1NH0xmHIiJGIg5CRPvDddfdE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=iqVvNabP; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="iqVvNabP" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2CAB8C4CEEB; Mon, 2 Jun 2025 14:56:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1748876170; bh=gYH48MTMQ895llNpciwbE33g0PyBEQ1PV+wLTwhTwOs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iqVvNabPKsSz1ssOzN0od9f0dAhUd7XghVtnqERr0BDgG8h3ZjLkH0V8QLvx0Zw/K 1fm4Jn4zPgHCmps/kLLhyysuI0/yTRbHDIpvM9OqwX3OD4NnKQcPlBoDs/0Z9x1/a/ I2csgFkhOdiqmvQTPokdcqAusPifDKdQMj7bsUsU= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Samson Tam , Yihan Zhu , Zaeem Mohamed , Daniel Wheeler , Alex Deucher , Sasha Levin Subject: [PATCH 5.15 094/207] drm/amd/display: handle max_downscale_src_width fail check Date: Mon, 2 Jun 2025 15:47:46 +0200 Message-ID: <20250602134302.421731902@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250602134258.769974467@linuxfoundation.org> References: <20250602134258.769974467@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Yihan Zhu [ Upstream commit 02a940da2ccc0cc0299811379580852b405a0ea2 ] [WHY] If max_downscale_src_width check fails, we exit early from TAP calculation and left a NULL value to the scaling data structure to cause the zero divide in the DML validation. [HOW] Call set default TAP calculation before early exit in get_optimal_number_of_taps due to max downscale limit exceed. Reviewed-by: Samson Tam Signed-off-by: Yihan Zhu Signed-off-by: Zaeem Mohamed Tested-by: Daniel Wheeler Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/display/dc/dcn30/dcn30_dpp.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_dpp.c b/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_dpp.c index 0601c17426af2..27932a32057e3 100644 --- a/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_dpp.c +++ b/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_dpp.c @@ -386,11 +386,6 @@ bool dpp3_get_optimal_number_of_taps( int min_taps_y, min_taps_c; enum lb_memory_config lb_config; - if (scl_data->viewport.width > scl_data->h_active && - dpp->ctx->dc->debug.max_downscale_src_width != 0 && - scl_data->viewport.width > dpp->ctx->dc->debug.max_downscale_src_width) - return false; - /* * Set default taps if none are provided * From programming guide: taps = min{ ceil(2*H_RATIO,1), 8} for downscaling @@ -428,6 +423,12 @@ bool dpp3_get_optimal_number_of_taps( else scl_data->taps.h_taps_c = in_taps->h_taps_c; + // Avoid null data in the scl data with this early return, proceed non-adaptive calcualtion first + if (scl_data->viewport.width > scl_data->h_active && + dpp->ctx->dc->debug.max_downscale_src_width != 0 && + scl_data->viewport.width > dpp->ctx->dc->debug.max_downscale_src_width) + return false; + /*Ensure we can support the requested number of vtaps*/ min_taps_y = dc_fixpt_ceil(scl_data->ratios.vert); min_taps_c = dc_fixpt_ceil(scl_data->ratios.vert_c); -- 2.39.5