From patchwork Fri Jul 26 08:06:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lowry Li (Arm Technology China)" X-Patchwork-Id: 11060457 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8DFD2746 for ; Fri, 26 Jul 2019 08:06:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7FE5D28A37 for ; Fri, 26 Jul 2019 08:06:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7465A28A44; Fri, 26 Jul 2019 08:06:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 699A928A37 for ; Fri, 26 Jul 2019 08:06:39 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2A5FB6E89B; Fri, 26 Jul 2019 08:06:38 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from EUR03-AM5-obe.outbound.protection.outlook.com (mail-eopbgr30040.outbound.protection.outlook.com [40.107.3.40]) by gabe.freedesktop.org (Postfix) with ESMTPS id 765696E89B for ; Fri, 26 Jul 2019 08:06:36 +0000 (UTC) Received: from HE1PR08CA0054.eurprd08.prod.outlook.com (2603:10a6:7:2a::25) by AM6PR08MB4949.eurprd08.prod.outlook.com (2603:10a6:20b:e1::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2115.13; Fri, 26 Jul 2019 08:06:33 +0000 Received: from VE1EUR03FT061.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e09::208) by HE1PR08CA0054.outlook.office365.com (2603:10a6:7:2a::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2115.14 via Frontend Transport; Fri, 26 Jul 2019 08:06:32 +0000 Received-SPF: TempError (protection.outlook.com: error in processing during lookup of arm.com: DNS Timeout) Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT061.mail.protection.outlook.com (10.152.19.220) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2052.18 via Frontend Transport; Fri, 26 Jul 2019 08:06:30 +0000 Received: ("Tessian outbound 220137ab7b0b:v26"); Fri, 26 Jul 2019 08:06:25 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: d5257653352837db X-CR-MTA-TID: 64aa7808 Received: from 0336800e1fa2.1 (ip-172-16-0-2.eu-west-1.compute.internal [104.47.5.57]) by 64aa7808-outbound-1.mta.getcheckrecipient.com id 84EFA102-3C93-485C-87EA-D9EC5F7848F5.1; Fri, 26 Jul 2019 08:06:20 +0000 Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-he1eur02lp2057.outbound.protection.outlook.com [104.47.5.57]) by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 0336800e1fa2.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384); Fri, 26 Jul 2019 08:06:20 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=H6I1/C1u6d1vY19FQmYbaHXnaItPMWCDmyIqi6E9OU2f4/nPnERFo2a7gpZRRHW/YjUi0cRenNMHeT1dvYi+ekbYzFoMBTa9MQOA8RgYihLgItSVlKg8Gd44U25L+3ADDJQl6lUuwdYO3j7h7jdZ1CTJ9iwR9foHzBjV5zhrS0F7Gn8br/quQziPx5ujTeEjSEbWZNQqCJzaUt9AQ8kIuWr4CkpMIQEmghv9iS5Hwi/12kH4EktAq1NPvTfhuRtkJi4Pp/uScnOGeTQti9xa1C9D/aSly+MBfHouF2Yt6Pma+yKUwWUaf/ON7sz8GqJTxITcD23bs43ULc48i18QeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tUfoFgrtNmB/wYkagr+4myXoTJddbZcjxtK+yvMwbjY=; b=B8/FuAr99f8bA5RMw07NL2CKhMvz5hg0nH0/pFGojoNWso14QZVTwA+gWk2ndK3pjlmLjt/bBKtRjUEmUyfIvlVCFs7Hbepz3up/0tCZ9Ego7JoHTrXGYoUT+Vn6eih/yslgHsy7cNdVVLVrYS+xvIMFQ8oPrUAoR6ejRLsXJUgNWNKxzLQrGYsRVZyC0dDXarumrBvrY4RixyptFObCtMzCmMfXEE4CuWUqioGdG4YKJrZRv+mDY1Nwi0AOmQKie75OqTnaA3gMZ2VdRvSD4v49whKfLUd7lCsFyVjS7ebTkZePHXDimp7bnxZ28z+G+ZvpxiUN0dMG01+vcKcXBg== ARC-Authentication-Results: i=1; mx.microsoft.com 1;spf=pass smtp.mailfrom=arm.com;dmarc=pass action=none header.from=arm.com;dkim=pass header.d=arm.com;arc=none Received: from VI1PR08MB5488.eurprd08.prod.outlook.com (52.133.246.150) by VI1PR08MB2941.eurprd08.prod.outlook.com (10.170.238.161) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2115.13; Fri, 26 Jul 2019 08:06:16 +0000 Received: from VI1PR08MB5488.eurprd08.prod.outlook.com ([fe80::c091:c28c:bb1a:5236]) by VI1PR08MB5488.eurprd08.prod.outlook.com ([fe80::c091:c28c:bb1a:5236%2]) with mapi id 15.20.2115.005; Fri, 26 Jul 2019 08:06:16 +0000 From: "Lowry Li (Arm Technology China)" To: Liviu Dudau , "james qian wang (Arm Technology China)" , "maarten.lankhorst@linux.intel.com" , "seanpaul@chromium.org" , "airlied@linux.ie" , Brian Starkey Subject: [PATCH] drm/komeda: Adds more check in mode_valid Thread-Topic: [PATCH] drm/komeda: Adds more check in mode_valid Thread-Index: AQHVQ4j/fedIk6fUkkilpyBPPcwKlQ== Date: Fri, 26 Jul 2019 08:06:16 +0000 Message-ID: <1564128364-23055-1-git-send-email-lowry.li@arm.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [113.29.88.7] x-clientproxiedby: HK0PR03CA0062.apcprd03.prod.outlook.com (2603:1096:203:52::26) To VI1PR08MB5488.eurprd08.prod.outlook.com (2603:10a6:803:137::22) Authentication-Results-Original: spf=none (sender IP is ) smtp.mailfrom=Lowry.Li@arm.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 1.9.1 x-ms-publictraffictype: Email X-MS-Office365-Filtering-Correlation-Id: a6585219-f81e-474f-c943-08d711a02a91 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam-Untrusted: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(4618075)(2017052603328)(7193020); SRVR:VI1PR08MB2941; X-MS-TrafficTypeDiagnostic: VI1PR08MB2941:|AM6PR08MB4949: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true x-ms-oob-tlc-oobclassifiers: OLM:2449;OLM:2449; x-forefront-prvs: 01106E96F6 X-Forefront-Antispam-Report-Untrusted: SFV:NSPM; SFS:(10009020)(4636009)(346002)(376002)(366004)(396003)(39860400002)(136003)(199004)(189003)(50226002)(5660300002)(14454004)(486006)(476003)(54906003)(110136005)(256004)(2616005)(305945005)(6636002)(81166006)(14444005)(81156014)(186003)(68736007)(26005)(478600001)(2501003)(6436002)(71190400001)(52116002)(71200400001)(6486002)(66066001)(4326008)(36756003)(25786009)(53936002)(2906002)(316002)(6512007)(99286004)(3846002)(8936002)(102836004)(7736002)(55236004)(6116002)(2201001)(386003)(6506007)(86362001)(66946007)(66556008)(64756008)(66446008)(66476007)(8676002); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR08MB2941; H:VI1PR08MB5488.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info-Original: lswQ9Kg3RaILZGa9HKn06dhjVl0rXyobOsRSKiqTUGr4Lhsl6fTyVJTNE8Jmwh0tDX1Xl1KHKC7yEaE8XGq19fZ+DqLV3h/VlBt0uK2V0FxCf8IpjsUlhm9vdsFwIrtVse5jTGZdd7lTQrM45HQ1W0QUGJRYkzHFYgFan6UzkSG9GCfs+3ZZot+HXhPcYnZjxr5xnBdnPTZtqf3BELxNguPFe0JSayes9YX+gAe7OOMWULmu4aomHqEnaE4R1IHAy44+9a+H9/LXaYiJwyrrB59oNOxHs0Q91WRzBQ5Oxap/6HNIFgjA/0tN/d88uDZU1N2Cm3CUkFYadwdzNVbmwWxXLKHUOB6tjJJSWyppt5TdzFeQJrzlG7YwjsEFQCOSW/QsjGBNKx5JcTvr8Fm2S3UJwBuahBYPxiVjCRZTzW4= MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB2941 Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Lowry.Li@arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT061.eop-EUR03.prod.protection.outlook.com X-Forefront-Antispam-Report: CIP:63.35.35.123; IPV:CAL; SCL:-1; CTRY:IE; EFV:NLI; SFV:NSPM; SFS:(10009020)(4636009)(376002)(346002)(39860400002)(396003)(136003)(2980300002)(189003)(199004)(2616005)(476003)(126002)(336012)(63350400001)(63370400001)(356004)(386003)(6636002)(486006)(70206006)(2501003)(186003)(6486002)(36906005)(99286004)(26005)(316002)(70586007)(5660300002)(305945005)(6506007)(25786009)(2201001)(23756003)(86362001)(4326008)(14444005)(76130400001)(7736002)(8936002)(8746002)(102836004)(26826003)(6116002)(22756006)(6512007)(14454004)(50226002)(8676002)(81156014)(81166006)(2906002)(66066001)(47776003)(54906003)(110136005)(3846002)(36756003)(50466002)(478600001); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR08MB4949; H:64aa7808-outbound-1.mta.getcheckrecipient.com; FPR:; SPF:TempError; LANG:en; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; MX:1; A:1; X-MS-Office365-Filtering-Correlation-Id-Prvs: a1576bdc-ab5f-4370-c210-08d711a021f4 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(710020)(711020)(4605104)(1401327)(2017052603328)(7193020); SRVR:AM6PR08MB4949; NoDisclaimer: True X-Forefront-PRVS: 01106E96F6 X-Microsoft-Antispam-Message-Info: qls4uItwLnTFohjIxMLAx00DozB724Wk1kdyxI0R91hm8lbrFsQRf0n+7cQuMpTqI955DC3csQfUmhkhYs+lw9PUhiz4M6Aze6HkXfgfEabpKFV6ThpCXnL5usoeGmC1kVHyJxMMxUJCrAuJRpAxJ6W1lkigULNdBGkH4WMuA3U7LiJnyLg8As1HHP1mSD9hzbiXos/4XIkghgczmA5H9B641l/DyryRbdfAMMKKP7UqYNxLfJJ9GyeelqgJmD5fYLJqxDs3XMaxunhg1+def6BsS7tBXq9RN8+WZSrJi9b6LnJAnemcWeJPw+UFRNtZjbDW7zmqgGy5lJWkU+0LDksbpmt0XvUCBFRElvIkT+Qv5S0PupxBqeaIo1ba2kMZjWmstHhAB7J2v62q7xOBNEC9Wd0SqaYTmPwxKQgPlvo= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jul 2019 08:06:30.1580 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a6585219-f81e-474f-c943-08d711a02a91 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB4949 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tUfoFgrtNmB/wYkagr+4myXoTJddbZcjxtK+yvMwbjY=; b=QaZ0ARBZZDSzkjjyM4eWKs2XzgVijlSOySWmaU5tBeuGUeru06ZePsHjPiF6MtQfsznQmAV5uvCHHaEZvCIrs117emrzsWRGx23U8k584Pr4hiJIRgrWzEVjzd0pbHEpLslxV59Qfmw59Ncz7yr40BqzQ4GPYiRVbn9PFbwVKhU= X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tUfoFgrtNmB/wYkagr+4myXoTJddbZcjxtK+yvMwbjY=; b=QaZ0ARBZZDSzkjjyM4eWKs2XzgVijlSOySWmaU5tBeuGUeru06ZePsHjPiF6MtQfsznQmAV5uvCHHaEZvCIrs117emrzsWRGx23U8k584Pr4hiJIRgrWzEVjzd0pbHEpLslxV59Qfmw59Ncz7yr40BqzQ4GPYiRVbn9PFbwVKhU= X-Mailman-Original-Authentication-Results: spf=temperror (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; lists.freedesktop.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;lists.freedesktop.org; dmarc=temperror action=none header.from=arm.com; X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ayan Halder , "Jonathan Chai \(Arm Technology China\)" , "linux-kernel@vger.kernel.org" , "dri-devel@lists.freedesktop.org" , "Julien Yin \(Arm Technology China\)" , nd Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP This patch adds the checks for vrefresh, crtc_hdisplay and crtc_vdisplay. Signed-off-by: Lowry Li (Arm Technology China) Reviewed-by: Mihail Atanassov --- drivers/gpu/drm/arm/display/komeda/komeda_crtc.c | 28 +++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c b/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c index 2fed1f6..017f6b6 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c @@ -403,11 +403,37 @@ unsigned long komeda_crtc_get_aclk(struct komeda_crtc_state *kcrtc_st) struct komeda_dev *mdev = crtc->dev->dev_private; struct komeda_crtc *kcrtc = to_kcrtc(crtc); struct komeda_pipeline *master = kcrtc->master; - unsigned long min_pxlclk, min_aclk; + struct komeda_compiz *compiz = master->compiz; + unsigned long min_pxlclk, min_aclk, delta, full_frame; + int hdisplay = m->hdisplay; if (m->flags & DRM_MODE_FLAG_INTERLACE) return MODE_NO_INTERLACE; + full_frame = m->htotal * m->vtotal; + delta = abs(m->clock * 1000 - m->vrefresh * full_frame); + if (m->vrefresh && (delta > full_frame)) { + DRM_DEBUG_ATOMIC("mode clock check error!\n"); + return MODE_CLOCK_RANGE; + } + + if (kcrtc->side_by_side) + hdisplay /= 2; + + if (!in_range(&compiz->hsize, hdisplay)) { + DRM_DEBUG_ATOMIC("hdisplay[%u] is out of range[%u, %u]!\n", + hdisplay, compiz->hsize.start, + compiz->hsize.end); + return MODE_BAD_HVALUE; + } + + if (!in_range(&compiz->vsize, m->vdisplay)) { + DRM_DEBUG_ATOMIC("vdisplay[%u] is out of range[%u, %u]!\n", + m->vdisplay, compiz->vsize.start, + compiz->vsize.end); + return MODE_BAD_VVALUE; + } + min_pxlclk = m->clock * 1000; if (master->dual_link) min_pxlclk /= 2;