Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp451324pxb; Thu, 9 Sep 2021 04:54:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyk6k+eOVZ88a/tBjNIZhYKI7klgq2Xh5JFDo/MhjBaeLQ5br2HiPCV4F4K2b0NseX+Lru7 X-Received: by 2002:aa7:cb07:: with SMTP id s7mr2778606edt.207.1631188499662; Thu, 09 Sep 2021 04:54:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631188499; cv=none; d=google.com; s=arc-20160816; b=ZkkZfmhNCj6vsEZzDBOM+oXQoVsCmwFUesPl3VCcnJj5LqiILFWsBjH+Qagc2/EJbE 8q3lWtXYg2Q6ldrGl6lEJjsxsRESsh/BWN0SNnUCFWHRjBJFaRBu6xDNF75wbxGGJpVr uKj1xMhaPsPtpChsarOOIf/DRwjiN8DV51M92++gigdHJo5/R5xb/O6LT4tP+eyOrQ+9 BfBZNqBnjEmtokqGONhrcS1otXKWibjJtu6/fn2PgEGmw4IZOBMzsAM3DMpvuk1YRzKk zdOOpDJH0uPeYooGcey5FKyX0CgkR7riB8UAJKQUktlhEWj0tnlSI4NTrp9/A725FESy YGIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=oWE+x1lu/2terWVZz7lDCCsxn8bZSPhDh6Zvc1LilRw=; b=lQ3mfomXinjPhmXH+PlzQaK3UxsPt6RCSdFtCsJJx4cljThUT9cjIr9ZiKRNHYfpWU kUgWhh97sSjk5T2E6TZ9ivtN9U/e3fPWHFHeKLN+JnNnWO5VzZihI7sIo6XW5n+gU9x3 JLd8nnQCdM+ZVghiGSBQq1h+tqfHLEz7GLYbbw6NReunhgd7/VftydNXiBsrDH84sLy4 lZlc7YFOtrKM9mtl8fG4e4+zTNAJlWa/552yVnsbVb1Jew3ulv0sPiVBpeaedYT/Oin+ Scb/nZ4KOu8wpjpdB7PPpw2YKTI3fUmqP3gt60dzkwxRHiVWmdSqLf0Em6iNe+FC8AAJ LeEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=bGntK3lC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id mp19si1672960ejc.630.2021.09.09.04.54.33; Thu, 09 Sep 2021 04:54:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=bGntK3lC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236055AbhIILx4 (ORCPT + 99 others); Thu, 9 Sep 2021 07:53:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:55124 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241446AbhIILu7 (ORCPT ); Thu, 9 Sep 2021 07:50:59 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 966DB6127A; Thu, 9 Sep 2021 11:44:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1631187841; bh=qMBC1L/AVg6yHH1DMtljl6zFQJ6blv5t5dZtGJ+J2Zk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bGntK3lCHqz1nJ7ZzSgHOTMMKbEgJ4ZcuSP4iXMk3EFW9dMcfGbhvJNwTt6kazig3 9Jqwohl5DrEn3ctm8S/US3XPfXPCw5Rj2Ilf2ct83YRtEbNewm/A3e/Du+E/riAooa 513+PprW0KwPBXS/twWEIZxunP8OLxm3oraz7gHpA8Ruo5MDp1HJHNRgA7grBKPimx rsCgg+JgSlvtvLOB2+JS82cyZTJiEVr9w+4CbUBsDuOnhNNhREfRAz2ZZMBVP0CjTZ UFnddSvV9Tvjhy46t9VmySIznIRaDGb4uXXX8z5DvFAce/86bFY7AZbIWsTtQUhbGR KyuqMHLgMPwoQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Roy Chan , Anson Jacob , Daniel Wheeler , Alex Deucher , Sasha Levin , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Subject: [PATCH AUTOSEL 5.14 135/252] drm/amd/display: fix missing writeback disablement if plane is removed Date: Thu, 9 Sep 2021 07:39:09 -0400 Message-Id: <20210909114106.141462-135-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210909114106.141462-1-sashal@kernel.org> References: <20210909114106.141462-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Roy Chan [ Upstream commit 82367e7f22d085092728f45fd5fbb15e3fb997c0 ] [Why] If the plane has been removed, the writeback disablement logic doesn't run [How] fix the logic order Acked-by: Anson Jacob Signed-off-by: Roy Chan Tested-by: Daniel Wheeler Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c | 14 ++++++++------ drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.c | 12 +++++++++++- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c index 5c2853654cca..a47ba1d45be9 100644 --- a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c +++ b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c @@ -1723,13 +1723,15 @@ void dcn20_program_front_end_for_ctx( pipe = pipe->bottom_pipe; } - /* Program secondary blending tree and writeback pipes */ - pipe = &context->res_ctx.pipe_ctx[i]; - if (!pipe->prev_odm_pipe && pipe->stream->num_wb_info > 0 - && (pipe->update_flags.raw || pipe->plane_state->update_flags.raw || pipe->stream->update_flags.raw) - && hws->funcs.program_all_writeback_pipes_in_tree) - hws->funcs.program_all_writeback_pipes_in_tree(dc, pipe->stream, context); } + /* Program secondary blending tree and writeback pipes */ + pipe = &context->res_ctx.pipe_ctx[i]; + if (!pipe->top_pipe && !pipe->prev_odm_pipe + && pipe->stream && pipe->stream->num_wb_info > 0 + && (pipe->update_flags.raw || (pipe->plane_state && pipe->plane_state->update_flags.raw) + || pipe->stream->update_flags.raw) + && hws->funcs.program_all_writeback_pipes_in_tree) + hws->funcs.program_all_writeback_pipes_in_tree(dc, pipe->stream, context); } } diff --git a/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.c b/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.c index 2e8ab9775fa3..fafed1e4a998 100644 --- a/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.c +++ b/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.c @@ -398,12 +398,22 @@ void dcn30_program_all_writeback_pipes_in_tree( for (i_pipe = 0; i_pipe < dc->res_pool->pipe_count; i_pipe++) { struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[i_pipe]; + if (!pipe_ctx->plane_state) + continue; + if (pipe_ctx->plane_state == wb_info.writeback_source_plane) { wb_info.mpcc_inst = pipe_ctx->plane_res.mpcc_inst; break; } } - ASSERT(wb_info.mpcc_inst != -1); + + if (wb_info.mpcc_inst == -1) { + /* Disable writeback pipe and disconnect from MPCC + * if source plane has been removed + */ + dc->hwss.disable_writeback(dc, wb_info.dwb_pipe_inst); + continue; + } ASSERT(wb_info.dwb_pipe_inst < dc->res_pool->res_cap->num_dwb); dwb = dc->res_pool->dwbc[wb_info.dwb_pipe_inst]; -- 2.30.2