From patchwork Thu Aug 22 06:57:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yu Jiaoliang X-Patchwork-Id: 13772771 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 06E0FC531DF for ; Thu, 22 Aug 2024 06:58:12 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8266410E78A; Thu, 22 Aug 2024 06:58:11 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=vivo.com header.i=@vivo.com header.b="OIaJfNVV"; dkim-atps=neutral Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2042.outbound.protection.outlook.com [40.107.215.42]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2919610E78A; Thu, 22 Aug 2024 06:58:10 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=PEyAiAKVnisnRvdOLjH+LetB3QR/4FKoy3LrcHAmRn6t15myFc3+ppJHxIAdpJyS+9MS8DaZ2Q6+yz/BvT4hPBAp1xsbtalVqtGfscQSiZibgy6JVsckCSwLGEgJ3LezP+5M/LZnRludGJYW7SG/Cj29qZGADvFl1PzJujMMK088WhsJ1hkUpI8KI8H27DXxJ5DnECKH98zcOhPy76wug7Ih3oRmSTd65LCfJZQAi1Uc2eieJjJ5JBLTaJRq8npiwhGpcMTwf1tGCHbUGNoL0gAh3Vpbz63FYaRe6Pki2OvjcTQgd8TAWLqJmZiO6T7QOGhpyCCvFe0I7If0KHpGEw== 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=WPHFiCX2D8HefJU2ksWv8ccMuI1S9KxOQ2E/bdwcOTg=; b=IbazQVhYa4afpmtpBgr/mRsBhC10v/UUKVhJu4HHTcJypkDSNDDHidRnLv0kH1TA4e+YzzLtV95g7aqvgJ5GjofRXH45Ws5fRAplX3FlQyZo+4dueK1RP8FstGdcRIe2zksE2d76Pe8tS5Dp/6UGt2siPd4sOGFmbWxrj2VI+QNr2v6Z3AkOKzK1Zg9PdWSIpxZuiq6ybnQQY1HETNEptA5hnqv/vVBgLkyLFpxIgcDEhkwbNQ28WE2B3acncMMMAEZqrq855G4byYrllmAb1lIkeXzx1WGz5SR2QGP34AKenaXuJKQ4TqI8F8uhkW+3JDWXjGkm3t+kvtpco7vF1w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vivo.com; dmarc=pass action=none header.from=vivo.com; dkim=pass header.d=vivo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vivo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WPHFiCX2D8HefJU2ksWv8ccMuI1S9KxOQ2E/bdwcOTg=; b=OIaJfNVVFIDpxp1xSNNJ79b0qW7fXNsItkqm3S4BcwXWGLGjmjMSYd9vjm78s/d8xsQGyPe7Si5Sm0FCZFdWAm3D5v2wq4kh1qQoq7DTFTu9zQJO/5n5XHiUxYXuTD4jsV4sELaO/usOgv25+CFyVErJnEBihGmeHe4T34N+Ir/zxPyt3CYd2cO7vjO1RoA2gHba+p6noS1tbG0q8Eqf1FcI8r4CVu/u7dtkUl333UoagL8XC/nEpdl1pcLfGeP+MhQk4gXpwEr10RY+yubAZeiseojKbctVM6KrCj9KoMt7YxSDfIVFMoGUhSCDk6yNI+DF5w6mPa1Rr46Dd2CGiw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from TYZPR06MB4461.apcprd06.prod.outlook.com (2603:1096:400:82::8) by PUZPR06MB5982.apcprd06.prod.outlook.com (2603:1096:301:112::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.19; Thu, 22 Aug 2024 06:58:06 +0000 Received: from TYZPR06MB4461.apcprd06.prod.outlook.com ([fe80::9c62:d1f5:ede3:1b70]) by TYZPR06MB4461.apcprd06.prod.outlook.com ([fe80::9c62:d1f5:ede3:1b70%7]) with mapi id 15.20.7897.014; Thu, 22 Aug 2024 06:58:06 +0000 From: Yu Jiaoliang To: Harry Wentland , Leo Li , Rodrigo Siqueira , Xinhui Pan , David Airlie , Daniel Vetter , Hamza Mahfooz , Alex Hung , Dillon Varone , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Cc: opensource.kernel@vivo.com Subject: [PATCH v1 3/6] drm/amd/display: Use max/min macro Date: Thu, 22 Aug 2024 14:57:20 +0800 Message-Id: <20240822065723.1336181-4-yujiaoliang@vivo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240822065723.1336181-1-yujiaoliang@vivo.com> References: <20240822065723.1336181-1-yujiaoliang@vivo.com> X-ClientProxiedBy: SI1PR02CA0049.apcprd02.prod.outlook.com (2603:1096:4:1f5::18) To TYZPR06MB4461.apcprd06.prod.outlook.com (2603:1096:400:82::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYZPR06MB4461:EE_|PUZPR06MB5982:EE_ X-MS-Office365-Filtering-Correlation-Id: f2e01031-52a6-40d1-2581-08dcc277c62b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|366016|1800799024|376014|52116014|7416014|921020|38350700014; X-Microsoft-Antispam-Message-Info: 26aEPKw2VQsGPqlZyaAH6jxoMgIqtjZozWAbm5AfGiQLgRWJJGPcM0zG4XjEo3+5JCI2KcXSNaJ8VXo9/kliw/epjengwHl5DG/qrlfVsd+pJU60UzE8BXvpT9LissiagM4bLjtNO3BVanRyc8+Yj5/ucPF9YD3ai4/DR/7iLCh2+Bp9yN4NPxoyVeicqDKuNJIzSyFyaXtQNa5Ifh/OpUUNUdJD7sG9v5T7xc+O8XfaPYJwuY4nltdfYM8P3hOoLtMnwuAgo4rG+9dTOE2TZpudR931gEbzP0LpdzLNtGtf0M3dTG+xQVbfC1EGP1pZuo/PNBMr3EVnXHFGzbCrieBAJPZSZTN9lzWwAwai7JpZ3vbbwd6IfzjuLOhuImZOGHWK2QaCiA4PFAu+kvn7Foz8+msVuMSawz53NXrivVpMWL7KSUknd2fnzHT0KF1g9m5bVyJxjs/YBcRmwL1g6IgtlAC1zCNAkvKRDkDklzPLFa79g8zMyMKimnGvazbE+S/NLWOUn5LcPp5TVsFm2gavh6FjUCR6FchnL0203ujWCLu5TH2yWLTb10erkeKSO6sPEPWqXyFUNvYNKHgxeSHnQ/ksNWGftwOKFcwDyY31uP2wa996Vum5wn3FfOT5352nn9mAoFDjRe/i04jGWzY55Zl++5Z7A7ja3MHwSg4nGQabwrISdtyd4r5GnZwk7eU3pgBV8uyiHZ2fy3AcGDQ9Z3eu1TSdyZZp5/4TOJha7TMY5ompGsOVvvv4HVBm6gIz44mXR7M25a67g/w0AdXwmhakUPy4+sc08H1XA+TmNRRbsQ1y/zjvqerRlOHP4YJagw1s29jViB6M6fsqzBU0OQyJvI3dSN8j+3OSxgQg5UBUVoY4S17eI7RS1coLX6JHDT71MUVxj9LrUwIk5l8drJXuZ/kL2aufjW/a6ynn1qdoSo7L3IZg+NVQCC97uG35RsKDgfrE0RusBWKohLzQjpTISnPqTkJIfPyo2kmjei3jKbSk0o2j18H/CQRgoGSnbEc8ilhC8fM5oT0x08Rjq2HcbVMza71x046fYgrPXnkiv9tELLi/gPun3/Tf+k31Rx+UivBR8SrhbASncVzcapc3Wcn/mxD5I+lWcUQYrr5oZwGMMQKAaScmT9peQu1Ehz5DclBd3nac+kilo0ZPff6XHCDR79YLSdQ8J2dYyPamywqa1wSND9XbUrXPTYOsWVkJ+SXN8ixV975l6m5+eBWyTfnM7DnzGpd1fYlRiMn0JMBGcImQ1TZ7BPHWGsU4HrZ7iEkuceeSEDGbC2kMislCa32E7Mhkm/6NAdvjf9OgjNHUhLie3OsH7N2sHp8GFV5I0UErGXYJg0HDjBKn6CA24zZs6LtIbYMl5UEhWRYx1vZc4/PhTvaP0K58EMoWw+FLE++X8ZbDtqHC14Nv28Bb2eSO1cA9G1b260g= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:TYZPR06MB4461.apcprd06.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(1800799024)(376014)(52116014)(7416014)(921020)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 3UNe0DLxZDdM7Aa9Aa84GOPiiO4yB0sA26n9hRCDgLG9pE/tNx7qlVL+Z7e+5tpsS7F00fNdWpK14UAHugsKrPerhDXqJsrYD9a70L2xOrK6gUC39qo6dEmxozZTlUFZ20SJjbIfnSkU+r7nAipGoH24fkWHugXdzY189clV+c6ZstYjdglWQOcrS9J4B0LADakfunXUsFjnb5S1ZjV6bm9Z6mTBIFcQNDH8DTT0q0LrmmB2tB/WLMyxJBJQ1RQ4ODtHYzwcwSF+bNj3RO+vzSnIt+YGaZwnDNKDyOTsGLebrWBraHjM1ih3QTscOMuRPzi/4pjwmlmcRnssLPKQWmfmIQ0Tcj2l3NITOlZexlZjyzvzQiccYlbH55SfdVZG3LeZg3fB0axrla6vKo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33EcAOJFYkgBYqKQj5HI9ZNkAW+U4JJykekq73hGyuKraeJXQgKgIRbysNZi9RMQyh6kGJXamLlMgYr7Wu6tdruvAx9fu7ntK9G6ECnCpcvily/Gw5hytGgb4 X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: f2e01031-52a6-40d1-2581-08dcc277c62b X-MS-Exchange-CrossTenant-AuthSource: TYZPR06MB4461.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Aug 2024 06:58:06.2919 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 923e42dc-48d5-4cbe-b582-1a797a6412ed X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: qwSD6oG6wAKy4eibIN3hysK9n+P5yr9Z6qMQmnlYS6Ufpvf9uxeVqRsR3UsYnGo2GhAJnqMWfuLCG9N9dDrCnw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PUZPR06MB5982 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Use the macro instead of ternary operator. Signed-off-by: Yu Jiaoliang --- drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c index b38340c690c6..5d40f61261ad 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c @@ -797,9 +797,9 @@ static struct rect intersect_rec(const struct rect *r0, const struct rect *r1) int r0_y_end = r0->y + r0->height; int r1_y_end = r1->y + r1->height; - rec.x = r0->x > r1->x ? r0->x : r1->x; + rec.x = max(r0->x, r1->x); rec.width = r0_x_end > r1_x_end ? r1_x_end - rec.x : r0_x_end - rec.x; - rec.y = r0->y > r1->y ? r0->y : r1->y; + rec.y = max(r0->y, r1->y); rec.height = r0_y_end > r1_y_end ? r1_y_end - rec.y : r0_y_end - rec.y; /* in case that there is no intersection */