From patchwork Thu Aug 22 06:29:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yu Jiaoliang X-Patchwork-Id: 13772699 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 16864C3DA4A for ; Thu, 22 Aug 2024 06:31:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8C56E10E749; Thu, 22 Aug 2024 06:31:05 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=vivo.com header.i=@vivo.com header.b="YoPRiOYY"; dkim-atps=neutral Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2088.outbound.protection.outlook.com [40.107.215.88]) by gabe.freedesktop.org (Postfix) with ESMTPS id C39D210E749; Thu, 22 Aug 2024 06:31:04 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=vv/ttxtk2di8k0Ry+wHbOIvS5W+kPhdiD6aCPOWP+4C2KbiNyWzo7GpHOuZ7YEr0Pizzxvfi/l5RAHK1R12qd0XDRXOvu1ku7sfaWws9GyUadJCdvt3MhW1cbjBjPJV0jX6izcZgvZNtIPx/H9cetU0pbHt1dPbqR5vAxO40+k5gmO21m/uz+GeFb3U1G0PMSEr/nnFfAcCkd7LkQRT82SIr7SWgQBc/KqUEIOQBblWHqqlqRwRhJAHiT9PvavnLjptD2k2iyRFgD+19LdXKAIn4+FRfQdtfO5qban2HLkdVxG3VokU8Iq9WyjqcHer3YyBXEj139dx3Ui5IBsFdJQ== 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=u6D0vxGZ9HzkNFejbPwfM1VLXCItNLtXrek97h+eMoQadWEEgrYjpuJihHlYx1eIpq3OGN8NNSlskmdzHml2kfWNvyBD6GBCgZ/pe7wnNFSHqYfSgQAVPDd77WlRXgTs4nBSn/ahHiJ5RSLyr3wVKwbtSNHMpRkrzcxIA8TgGOS5lhWhH/Z7jaNR8PwZapN7WRhIfbTJ2eLh2QIiYASr8Ccyst4aERxwP07azvdWzYYpJ3nYBz17xNiiH3h0CnoMKiJ/AktUv/v9WBOQKLXh/JgKVeiC8ohDo2phUB9LAYNfcfgTwY889SAK+HkauaPbYwz9h1nbdzff9R84Pvhj3Q== 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=YoPRiOYYE3tnaYYrd6yRHqIiSOqV/rvzzqhGOEGKfOznqXL4mj4jzxCSThnTjPZzVlP/i/RqJSK/DKuBVLDCZcTKsn424x6Xu+MiuGxDpfmDpOVRRB23Oc51ZamQHkSaYHO0Z8urg5NfQ1lR0zWI25Zd/qP4AuZ3El1FNBbFuVCY5nErawFEfWQxOk0Orpo8MVEUySouvOmGfP/0qW+WaoPxh5NR5PbInht1s9T6WDbineBYUtaM4sF8CwQT7Smi6i2GSHsAv35cwUMswP3aRkw4MEscxVS8nSBVl8W9T7Xcp6Ot2rwLnZxKYow+xKUB3RZtM2sDeUSbE/NnHAcmDA== 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 JH0PR06MB6344.apcprd06.prod.outlook.com (2603:1096:990:17::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.21; Thu, 22 Aug 2024 06:31:01 +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:31:00 +0000 From: Yu Jiaoliang To: Harry Wentland , Leo Li , Rodrigo Siqueira , Alex Deucher , =?utf-8?q?Christian_K=C3=B6nig?= , Xinhui Pan , David Airlie , Daniel Vetter , Alex Hung , Hamza Mahfooz , Hersen Wu , Dillon Varone , Wenjing Liu , Alvin Lee , George Shen , 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:29:29 +0800 Message-Id: <20240822062947.1318340-4-yujiaoliang@vivo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240822062947.1318340-1-yujiaoliang@vivo.com> References: <20240822062947.1318340-1-yujiaoliang@vivo.com> X-ClientProxiedBy: SI1PR02CA0040.apcprd02.prod.outlook.com (2603:1096:4:1f6::7) To TYZPR06MB4461.apcprd06.prod.outlook.com (2603:1096:400:82::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYZPR06MB4461:EE_|JH0PR06MB6344:EE_ X-MS-Office365-Filtering-Correlation-Id: 69a8ccc7-9cde-4a90-1426-08dcc273fd59 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|52116014|7416014|1800799024|376014|366016|38350700014|921020; X-Microsoft-Antispam-Message-Info: AeXGn4tS0gACzgjnWtBzHiB7Kf1TYk07OhDkR/kTgM5FWSRewPlQupoBRXfTTbRrEvXIE8SNEIt/1W90UT+F7EC77B8TBGqwMpJxgakBASrC3Gut06x/O8yBRJBGGtwdued3lWxms1tws+vb87wjgjbbX9Ms8kt6zMtbzPSG37+zSHhgfZJqoUWzh3+aVtJmUQHUpMb2gv3n3kkQfktknfyxhJVA252/mZlzED8yGXKy0Z+wzx3c5Mw0m6YUJ7IFIWwaQTQlIBA7qbyilc3nqFJHk7cVfKQI/Amaq/Ya4wK+vG7BwHEBzUYJ3aWViK9VGt1C1/yyW4Oew4OB0y8t2oWU40AB0syGfAT57UL0Pa8E7n3XEZpo0Bnx5fTIb/ecAal1sMWaUZVrgLBRym8D2/YKNBfey4zfaOwjVIJfp+ed9qk5p+u0gOmVmrAmNC159Baho7e0ofikcobtt1JYTUMQgqBr44kB7SsVkyHgH1hdrcdagVs73EoMM9H3wCjoXCyitUWUnZTQcatMgwM6Zep3pd5aXCQ3KyR663YhwIRRof43PUM4sS2Trs3QFCUc8VdEtsMOsbXsLDWY3IGbb5l1rH5jRTJEkD6AUi98R9k7uiiH9Ag927omTwWEZj/QqIIkvQV2fUkdWIJw6dxe8FVNYjh+6YmBOmdKlyINxLmxgyn5mWDMpCcSByWPptajrdVbeIvFGEPfbhinbE7G7hdGRi4zremlg1sl+iybKQTWR1e64HUSqLD+LuDZELD+YQ+Wi+Nh5HAQpMusQMSQ9h3xIq1HxCqEyy6KZwgU+IVR+FggjQT+O9NXBD9KL7vt9hEanmLITe6cHoaUWJp+kjNqru5XBe1kxYdxN0/1EIqmr4KBfqYpk8eBYd8NNuHLQuo7AjW2qymGAY17rYESPDkEtcm4n6lL2PBBb3xvqC5gVJFNPblTArSODI/c4xIOGWFbnKzuCaqP+jV44iu8w0UMFgcU4dk5UwMZJYhXueZSNJua1FKhnLglyduHXIs/E5lOtHxZgDiKr0XKbzRGjaB2O4QbbdXsBbLZ8j3KOdA1kgPM2VC4o8PBwchCGvPiRUuIkuOh83jBcyrz8RfJgtfg7q5BilnV4LIEGt8mYyCiNANahXp+Y/MstRx1jOi50F9n6GzHxsDfdj3yGvYS9Y7Ki6QXdEhKTbJC3t2CKK8pIVr+rSlerGaeBs4VWze7w5Q0XyG1CsP1d/d/K9+nPsQHeSr0tyDprGGAx/Aa3ciUr1MB4xGNoEudEAROhd/Xi3OEh66ymcy9OJotIJAxHtM5C4rTBipIV4IpNbcC87rTVkZHGjuPd889SaKeIOSOUIYg5xcRMnGjv3DczHEGQ/59jqzhjvTjYDV5JsvxuvOGtVnVeic6NZ6MO4IYdPRup316akmyhVFTxqhCdoIcnRqUwqAcx3fJa8h/ZXAqEHU= 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)(52116014)(7416014)(1800799024)(376014)(366016)(38350700014)(921020); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: w8PAf/KI2X2m6e8IF/syfTJroZUMVhDAY6bZYjdcVxfSpaO8XEopxVjxaZ+LiFhmlLF4KVoocIRFZvmveW1NZc86r4Tv+B+EMtaPnr0LK+cauHvW+mlQEHEdKZZ3z68vfamU/V+52b1D4K9gK0jz4MSW5m2O8WvDXcngEQu++ic1ohA4sNUbHOJgMjvR2HeBqeSZgX45BKkHICc9ij3iGi7PpZ9HnGwOYgm3YrnyNizovDTM6kI/mCTcMhFZJoZRmQHYk3CooiVhjn528oJlZMUqHlEMjEsKfCwtEmNFb782d5YKCwRoJtWsoUBJ2gja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LeQtUhR/HKKZm1ISbEbutHzY4DQRVtzF03kTAS7Kyb/Qq7UspyTwY92J15rPKPk9yJcl9ZpFTt2Ksm5Hd04JHuHTUTz8LUpReIaFx6T+sMPJ+sQ7b9y0ShOO9WF2uTn34+Fbox1Lxn+uJJ/8EmJiqCzx0sT0zb6DBDM2qOaxLuqFOco4LWU/sPzux8zN0qfaku X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 69a8ccc7-9cde-4a90-1426-08dcc273fd59 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:31:00.9032 (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: loXKKdR14urBzbqbEwGaMEAWVsGRI30OPya7keNca40ktnwH5l0lS9IKnZA/x4Z67rhti3erYxNfRzyCCMciAA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: JH0PR06MB6344 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 */