From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2059.outbound.protection.outlook.com [40.107.93.59]) (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 A36E18493 for ; Tue, 14 Jan 2025 02:10:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.93.59 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736820660; cv=fail; b=KyZ8xyLtHXu70Dwk1WyexPJnEYM8PoGxopl+lF55kAZ6OgIRDPfvhfeo+c10L9Dxu81DGTeYCTAxtBh1rHafd8F9a9UQ7LxyEKV9PuXWxSJOq7ib7bAAtJTros7XfZJcWP4fNe6TdPe1AennHI3ZW+e0odbmXlnILC+8dWZLpJg= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736820660; c=relaxed/simple; bh=ChyTbVxUR8DSJYLaR/YYbZ3p0/It9JtCOMCGNWe06EY=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=R6VsMtIE5HtU8Yb1d7qbXj2TrarGm6F7q+6kn7gMgiwbKhRxc1AqWjNv7mp/dzIDzzqG9YtoHn5y7vH30U+r+b2i7Bu+Q5u6iCBHCud0VB+For9UaTrPjmmZ1JZA9on34rVRJLmdrFOkOR8YfJsVoxsiL2eXElAxdrv7B2MwEZo= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=eIydOx+m; arc=fail smtp.client-ip=40.107.93.59 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="eIydOx+m" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=cabSpD4bgDjBZ7FV7QBGwGqcc44aKe5Ei5fT0IHyKLfMVQeYUTCE4aZsZgMGO+jE4ItiMCyhURRtmXpa0bMiYbihOi91p6eaZgV5wF9WnVDZTnALw//6amKXNCMX7fJ5Qqkp/M5WtI+BY10GAAv8uw33kQqB+Fjrr3u58/quEwOR1WHEHEJ6dTpFLkuDY/J3KDeXwdQflMwPl6cKzWtWtiJ7OZziRHM7htZwMubLXU+xQkKqj66f4a8CWlVXd8NkqGAEpp+yTBLLVTgXZxw6/1Bc+E15g1nPa0+9XWsi4AbdlVfrQmT3zQikCXfUPG1hcBRObuWeMiT0m7cVDpRIsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=4WKmo2T4GO2JAG5PXoHWMC3MqejFR/mvo1aMUWM9bok=; b=gfMHD2oUkQ8HSkGLNsDHPX/PklvbtNVpCdKIvj2Lk1XUxUxvBbs7GGjFcfHHLzcohqIPR8OgHm/wdUjzSLIP/kgmhdzi7wthDtuMeUjbAevKqZSpLtgaHNSiXIQbfKAUNzRJ5SnNTjt+sbEullwmPe6KFHdYSjcoFTbjThQUM5phN0Dkitm2wVsCoeLOYCuEUyitaQNg/dUE9GCVwMML+fSLOzkp0U1KFroZvnFIWYFD8sTVFoCgU99a9PmbOfpVFDF5kUtKn8My6F05LaiQHWGGoX1HVljhswmJzH+5+GBNDmw2ZQLwDsf4Ui/iLmQvUQE9SzIi0s6oSrlCfwpA5w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.freedesktop.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4WKmo2T4GO2JAG5PXoHWMC3MqejFR/mvo1aMUWM9bok=; b=eIydOx+m85wUiiaiD3t5GJMVqUTCI0pTN+boodUJe3GLFSeMS+juhydhsFh3Npo71ihNDKDt6cM5ss4YyJzKO2GzgHPBIVJWVwr+6vqCz+GZilElIR43k+nVrjO7hspsotUUcfRDA/c4gUSd/IA5o1oEUQVpXQMkZ8bf36Uf08o= Received: from BN0PR10CA0008.namprd10.prod.outlook.com (2603:10b6:408:143::27) by SA1PR12MB6798.namprd12.prod.outlook.com (2603:10b6:806:25a::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8335.17; Tue, 14 Jan 2025 02:10:54 +0000 Received: from MN1PEPF0000F0E2.namprd04.prod.outlook.com (2603:10b6:408:143:cafe::a7) by BN0PR10CA0008.outlook.office365.com (2603:10b6:408:143::27) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8335.18 via Frontend Transport; Tue, 14 Jan 2025 02:10:54 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; pr=C Received: from SATLEXMB03.amd.com (165.204.84.17) by MN1PEPF0000F0E2.mail.protection.outlook.com (10.167.242.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8356.11 via Frontend Transport; Tue, 14 Jan 2025 02:10:53 +0000 Received: from SATLEXMB06.amd.com (10.181.40.147) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 13 Jan 2025 20:10:53 -0600 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB06.amd.com (10.181.40.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 13 Jan 2025 20:10:52 -0600 Received: from localhost.localdomain (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2507.39 via Frontend Transport; Mon, 13 Jan 2025 20:10:47 -0600 From: Wayne Lin To: CC: Harry Wentland , Leo Li , Rodrigo Siqueira , Aurabindo Pillai , Roman Li , Wayne Lin , Tom Chung , Fangzhi Zuo , Zaeem Mohamed , Solomon Chiu , Daniel Wheeler , Aric Cyr , Mario Limonciello , "Alex Deucher" , , Sung Lee Subject: [PATCH 07/11] drm/amd/display: Optimize cursor position updates Date: Tue, 14 Jan 2025 10:08:56 +0800 Message-ID: <20250114020900.3804152-8-Wayne.Lin@amd.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20250114020900.3804152-1-Wayne.Lin@amd.com> References: <20250114020900.3804152-1-Wayne.Lin@amd.com> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN1PEPF0000F0E2:EE_|SA1PR12MB6798:EE_ X-MS-Office365-Filtering-Correlation-Id: 64d71a54-3569-454a-27b9-08dd3440ace7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|1800799024|82310400026|376014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?jiEEWLTwlYxK+EJCvCgQUynB3fzCMsruvOI6zJXF+gfHYkmFyh0D/CKkY8Pd?= =?us-ascii?Q?obwl5dV6DYoQZ8kclAR7+SGOLzQdSekP66CJJuc5UtZCwUM02r3EOfQbm2es?= =?us-ascii?Q?Jx+6/f7ug4x12PxBA+eWOJ5GexBxzGFZ/Rj4JFk8zbVExTlp9Fgddezp/JcE?= =?us-ascii?Q?rJigDozhbQPA7Sb2d1CUS1CWyZALiFkzys8aOx84NmT+l0v3F6g8l1I7bxSp?= =?us-ascii?Q?mvEQbdVasDpbmEm+Dbe6Ttnp0NtXYG0N3OUpC1/zfE/4IcG4roYu9Bzs7fye?= =?us-ascii?Q?YNTSyPQX+nwFojOxBqivljG/1rxSVQuC0yY0EHB7uNejf3b8JE/M59KfCaEV?= =?us-ascii?Q?d+o6NOGbBwkOiusuQnwmxmiehLLmYWoc4broYqvzR9HpZ/DkWdFEeYLurVlA?= =?us-ascii?Q?G8/IospZ9K4kYSI75xK6qUfaIRl9bCFmlDqStH40pAcy3s3IbVdXMJpWYQGR?= =?us-ascii?Q?exYBMQ7UaToy12xCm/1zo6YyfObQdrqmOOYAU/+PdP+PlmTSoFRAsIGPqBH/?= =?us-ascii?Q?fyooI5IUBYEfNnPNo4QweFIoEq9Tg78OI4Pu3YARPO3uid2tVcVR4ULFgqyh?= =?us-ascii?Q?vwBxhULcMju55GT+LuyWeUOvh897YZPqjOULbZTaYwYH6uCwpCcuwPyDbLbe?= =?us-ascii?Q?RDZqrvAtPyTPpiDDMydh0h9ry24rxek9KBzp59jyIYysIib8Dbi65H6Qo8pP?= =?us-ascii?Q?sLJUhLfGs1NWpCvZmhjS87CMRDUMpM9V1AmJiHcrp0YGd4k25mAE85C5V0Kr?= =?us-ascii?Q?dlK3jTg1/7yFVGyo52DjpjwILd07pTkayjucZEk8gE2lqQZKzG0lyOMtwiHc?= =?us-ascii?Q?0MCWvYexmb53ydgPeGxK2i9Jc8CEWE3EGyEbWP1Nla3N+injhtAOZTQNX2bq?= =?us-ascii?Q?TAd5WiAnE+2V+shs36LzZLoDvfIgDms9N3PGmP3M7j8omp9/uRqHBYt2Rw3D?= =?us-ascii?Q?e0w+duLInp4QMSXtApZlfJrE5YwX6SM/6jCse2ugqQpRM15Ronfag6OMdfPy?= =?us-ascii?Q?5Pu+1K04WkfBlJMms1Ud09+9K3zYgBxc5L8hWAYjmkQ0G70VJzh5NcEOEg/6?= =?us-ascii?Q?bLLuj95S7nqXHvgKbdymlfqjPD0Ky+b3iOU6xBoDmYxjY+xsEz/ZKAnQkkYm?= =?us-ascii?Q?v2DFS18845tZML8oLyVsxk3H5OJzAbbG5BRrsVKS/92gjPSIfHOnt185uAJi?= =?us-ascii?Q?OWUb7/J1ESRgWbqkjRwQAVtxEvHAMwIdxRp6nbKEHtXRQVk4AQXrOpni19mh?= =?us-ascii?Q?AvdXs8P1dCrDuBHytq+XPyPMqJfKpXfbjYfi+kSlEnhqkXlLlDIYCcdmihKl?= =?us-ascii?Q?Kim6Cj2F51zFlzdn+nSpiDu4eFfOrCssEB+cNGvcYD3aAdjQGro0udt5Fjt2?= =?us-ascii?Q?I6fTBTwJ7yjmQ8bd5MHu2vWGpsu2Tf8WRh6BibXgVjYjl91fCPcgta7CS5zN?= =?us-ascii?Q?aMNQqv72qMC4xM51IJ15nnfXXfvWOqI3XrBDCnQNYcc+Is5ni715pQ=3D=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB03.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700013)(1800799024)(82310400026)(376014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jan 2025 02:10:53.9078 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 64d71a54-3569-454a-27b9-08dd3440ace7 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: MN1PEPF0000F0E2.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB6798 From: Aric Cyr [why] Updating the cursor enablement register can be a slow operation and accumulates when high polling rate cursors cause frequent updates asynchronously to the cursor position. [how] Since the cursor enable bit is cached there is no need to update the enablement register if there is no change to it. This removes the read-modify-write from the cursor position programming path in HUBP and DPP, leaving only the register writes. Cc: Mario Limonciello Cc: Alex Deucher Cc: stable@vger.kernel.org Reviewed-by: Sung Lee Signed-off-by: Aric Cyr Signed-off-by: Wayne Lin --- drivers/gpu/drm/amd/display/dc/dpp/dcn10/dcn10_dpp.c | 7 ++++--- .../gpu/drm/amd/display/dc/dpp/dcn401/dcn401_dpp_cm.c | 6 ++++-- drivers/gpu/drm/amd/display/dc/hubp/dcn20/dcn20_hubp.c | 8 +++++--- .../gpu/drm/amd/display/dc/hubp/dcn401/dcn401_hubp.c | 10 ++++++---- 4 files changed, 19 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/amd/display/dc/dpp/dcn10/dcn10_dpp.c b/drivers/gpu/drm/amd/display/dc/dpp/dcn10/dcn10_dpp.c index e1da48b05d00..8f6529a98f31 100644 --- a/drivers/gpu/drm/amd/display/dc/dpp/dcn10/dcn10_dpp.c +++ b/drivers/gpu/drm/amd/display/dc/dpp/dcn10/dcn10_dpp.c @@ -480,10 +480,11 @@ void dpp1_set_cursor_position( if (src_y_offset + cursor_height <= 0) cur_en = 0; /* not visible beyond top edge*/ - REG_UPDATE(CURSOR0_CONTROL, - CUR0_ENABLE, cur_en); + if (dpp_base->pos.cur0_ctl.bits.cur0_enable != cur_en) { + REG_UPDATE(CURSOR0_CONTROL, CUR0_ENABLE, cur_en); - dpp_base->pos.cur0_ctl.bits.cur0_enable = cur_en; + dpp_base->pos.cur0_ctl.bits.cur0_enable = cur_en; + } } void dpp1_cnv_set_optional_cursor_attributes( diff --git a/drivers/gpu/drm/amd/display/dc/dpp/dcn401/dcn401_dpp_cm.c b/drivers/gpu/drm/amd/display/dc/dpp/dcn401/dcn401_dpp_cm.c index 3b6ca7974e18..1236e0f9a256 100644 --- a/drivers/gpu/drm/amd/display/dc/dpp/dcn401/dcn401_dpp_cm.c +++ b/drivers/gpu/drm/amd/display/dc/dpp/dcn401/dcn401_dpp_cm.c @@ -154,9 +154,11 @@ void dpp401_set_cursor_position( struct dcn401_dpp *dpp = TO_DCN401_DPP(dpp_base); uint32_t cur_en = pos->enable ? 1 : 0; - REG_UPDATE(CURSOR0_CONTROL, CUR0_ENABLE, cur_en); + if (dpp_base->pos.cur0_ctl.bits.cur0_enable != cur_en) { + REG_UPDATE(CURSOR0_CONTROL, CUR0_ENABLE, cur_en); - dpp_base->pos.cur0_ctl.bits.cur0_enable = cur_en; + dpp_base->pos.cur0_ctl.bits.cur0_enable = cur_en; + } } void dpp401_set_optional_cursor_attributes( diff --git a/drivers/gpu/drm/amd/display/dc/hubp/dcn20/dcn20_hubp.c b/drivers/gpu/drm/amd/display/dc/hubp/dcn20/dcn20_hubp.c index c74f6a3313a2..d537d0c53cf0 100644 --- a/drivers/gpu/drm/amd/display/dc/hubp/dcn20/dcn20_hubp.c +++ b/drivers/gpu/drm/amd/display/dc/hubp/dcn20/dcn20_hubp.c @@ -1058,11 +1058,13 @@ void hubp2_cursor_set_position( if (src_y_offset + cursor_height <= 0) cur_en = 0; /* not visible beyond top edge*/ - if (cur_en && REG_READ(CURSOR_SURFACE_ADDRESS) == 0) - hubp->funcs->set_cursor_attributes(hubp, &hubp->curs_attr); + if (hubp->pos.cur_ctl.bits.cur_enable != cur_en) { + if (cur_en && REG_READ(CURSOR_SURFACE_ADDRESS) == 0) + hubp->funcs->set_cursor_attributes(hubp, &hubp->curs_attr); - REG_UPDATE(CURSOR_CONTROL, + REG_UPDATE(CURSOR_CONTROL, CURSOR_ENABLE, cur_en); + } REG_SET_2(CURSOR_POSITION, 0, CURSOR_X_POSITION, pos->x, diff --git a/drivers/gpu/drm/amd/display/dc/hubp/dcn401/dcn401_hubp.c b/drivers/gpu/drm/amd/display/dc/hubp/dcn401/dcn401_hubp.c index 28ceceaf9e31..03bfa902dc01 100644 --- a/drivers/gpu/drm/amd/display/dc/hubp/dcn401/dcn401_hubp.c +++ b/drivers/gpu/drm/amd/display/dc/hubp/dcn401/dcn401_hubp.c @@ -742,11 +742,13 @@ void hubp401_cursor_set_position( dc_fixpt_from_int(dst_x_offset), param->h_scale_ratio)); - if (cur_en && REG_READ(CURSOR_SURFACE_ADDRESS) == 0) - hubp->funcs->set_cursor_attributes(hubp, &hubp->curs_attr); + if (hubp->pos.cur_ctl.bits.cur_enable != cur_en) { + if (cur_en && REG_READ(CURSOR_SURFACE_ADDRESS) == 0) + hubp->funcs->set_cursor_attributes(hubp, &hubp->curs_attr); - REG_UPDATE(CURSOR_CONTROL, - CURSOR_ENABLE, cur_en); + REG_UPDATE(CURSOR_CONTROL, + CURSOR_ENABLE, cur_en); + } REG_SET_2(CURSOR_POSITION, 0, CURSOR_X_POSITION, x_pos, -- 2.37.3