From patchwork Thu Jan 10 15:10:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Rosin X-Patchwork-Id: 10757497 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 6A1DD13B5 for ; Fri, 11 Jan 2019 08:18:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5B15F2995E for ; Fri, 11 Jan 2019 08:18:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4F68C29965; Fri, 11 Jan 2019 08:18:35 +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 033912995E for ; Fri, 11 Jan 2019 08:18:35 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BAB176F582; Fri, 11 Jan 2019 08:18:28 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on0719.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe0d::719]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8D5D66F368 for ; Thu, 10 Jan 2019 15:10:37 +0000 (UTC) Received: from AM6PR02MB4470.eurprd02.prod.outlook.com (20.177.191.218) by AM6PR02MB4037.eurprd02.prod.outlook.com (20.177.112.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1516.14; Thu, 10 Jan 2019 15:10:34 +0000 Received: from AM6PR02MB4470.eurprd02.prod.outlook.com ([fe80::e5f3:a239:2ec4:4453]) by AM6PR02MB4470.eurprd02.prod.outlook.com ([fe80::e5f3:a239:2ec4:4453%6]) with mapi id 15.20.1516.015; Thu, 10 Jan 2019 15:10:34 +0000 From: Peter Rosin To: "linux-kernel@vger.kernel.org" Subject: [PATCH 1/4] drm/atmel-hlcdc: rotate planes counterclockwise Thread-Topic: [PATCH 1/4] drm/atmel-hlcdc: rotate planes counterclockwise Thread-Index: AQHUqPaiL7m+2adSdUCQzjfoCW/2Iw== Date: Thu, 10 Jan 2019 15:10:34 +0000 Message-ID: <20190110151020.30468-2-peda@axentia.se> References: <20190110151020.30468-1-peda@axentia.se> In-Reply-To: <20190110151020.30468-1-peda@axentia.se> Accept-Language: en-US, sv-SE Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.11.0 x-originating-ip: [85.226.244.23] x-clientproxiedby: HE1PR05CA0257.eurprd05.prod.outlook.com (2603:10a6:3:fb::33) To AM6PR02MB4470.eurprd02.prod.outlook.com (2603:10a6:20b:60::26) x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM6PR02MB4037; 6:2Xh8ocU8hq74UnJQI+/u/oXxTu1L84X2SRxf1AVaUX7Qj/hp6rsmrzxjv4/QnbPkYXf/uon8HXvnr6QqfI2+CkR33PFW42PezcuW7zu/PVDE8AOVc8BHr7iBJCuaagfSxLP6k8TxwFM7KKjtuGzm6rcd7J3mQ50mTdDdV+xs7txCe8biS2BIR4ct9fK0Rn72+W5hWOsT0vmy/GRt8eCgFH9UhmH90UR6g7fP/3WywVvSTVMvrkrhY4haZXtX/RCwjG4yCo+Vq6wETFRWGiustPBG1wPdeeKFHDbDsMqwtjDCcyrnRd62uaEAPPoBNzEuJNhid/LSvqq4oNh8KP1PfhahIl2L+bxlIpLOMrjgp9jaS7yCdMjtGq2NatoDGffd0IY7EvQpwuqbpU+UiIbW5fKNuPYdRNBKNUB1vyjH7yRiLJjjheqeizy8gWeuh/VmziQYWT1chWfAfOprQr0Hhg==; 5:7lUZ57Srx8wPHx7f9iz/nyXEtodaSuoxsKDQhpeEQI55A+wDbWaFxCN/7Fi6RSvzMw5mMWrPxUv4Vz6ll2qyXqMEUWo7tqmbK8sZuY12y/xQ9u7E+sKEeshEeJs/G6zCykB1pTFz6cUIGbWRAdH+t2pT5lD6MSru8TMmpmI7uJWQK2R5ArklrZasPigFUBWRPb5yc6226i4B4P8heWuteQ==; 7:1yWWUaGNYTgUaMVGqR2OIC4f81xmvQXIEhgp+qObBZerGMfdsONCq1qw7inQ0h8LTdRGarfD3BhWLMPH/UOVN4h24J8JP0bzBYCMC1LirkZIs1nYVK1OMBE6KDEpeqL/LMvfC1YFLqWNWbXHSL0Yrw== x-ms-office365-filtering-correlation-id: 14efde95-ab2a-4925-919d-08d6770dc4be x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(7021145)(8989299)(5600109)(711020)(4534185)(7022145)(4603075)(4627221)(201702281549075)(8990200)(7048125)(7024125)(7027125)(7023125)(2017052603328)(7153060)(7193020); SRVR:AM6PR02MB4037; x-ms-traffictypediagnostic: AM6PR02MB4037: x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(3230021)(908002)(999002)(5005026)(6040522)(8220060)(2401047)(8121501046)(3231475)(944501520)(52105112)(93006095)(93001095)(10201501046)(3002001)(6041310)(20161123558120)(2016111802025)(20161123562045)(20161123560045)(20161123564045)(6043046)(201708071742011)(7699051)(76991095); SRVR:AM6PR02MB4037; BCL:0; PCL:0; RULEID:; SRVR:AM6PR02MB4037; x-forefront-prvs: 0913EA1D60 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(39830400003)(136003)(366004)(396003)(346002)(376002)(199004)(189003)(53936002)(316002)(36756003)(6512007)(97736004)(50226002)(5660300001)(66066001)(186003)(386003)(4326008)(6506007)(446003)(25786009)(26005)(256004)(11346002)(2501003)(476003)(102836004)(2616005)(6916009)(14454004)(71190400001)(71200400001)(106356001)(105586002)(2906002)(68736007)(7736002)(486006)(5640700003)(1076003)(6436002)(6486002)(508600001)(2351001)(81156014)(99286004)(81166006)(3846002)(8936002)(305945005)(575784001)(6116002)(8676002)(86362001)(54906003)(74482002)(76176011)(52116002); DIR:OUT; SFP:1102; SCL:1; SRVR:AM6PR02MB4037; H:AM6PR02MB4470.eurprd02.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: axentia.se does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: qJ2Q/8/QthtF9E8duURiypdCxu2wV0p/Fb987Ipu4/e/oEjJUalwSgU9NdlfkAch63rK178NC/pp1bgLDzXKThhsGKBDeuE4m5f6k6UU0t0STfHSG5TmD0MigDxqSrx8jUGkotxC6KpoGiqATlkuAzRECsSFzEj7utPnxulMrbkxqIb/RhE+Z9O61h6Wf3c11xdIG4TZZmviqDACSFMZiZxVPBegiTESP+UDs2r/fFYAbzzZC4EIIxp8iPuYbC3ZCw8vShHRbbFXCcuUeKOpmcdYh3IU9zg+VUoMCHhQYHFCKUun5/jXy+cfdZZOHfVz spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: axentia.se X-MS-Exchange-CrossTenant-Network-Message-Id: 14efde95-ab2a-4925-919d-08d6770dc4be X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Jan 2019 15:10:33.3554 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 4ee68585-03e1-4785-942a-df9c1871a234 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR02MB4037 X-Mailman-Approved-At: Fri, 11 Jan 2019 08:18:04 +0000 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: Alexandre Belloni , David Airlie , Nicolas Ferre , "dri-devel@lists.freedesktop.org" , Boris Brezillon , Peter Rosin , "linux-arm-kernel@lists.infradead.org" Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Ouch, the driver rotates planes clockwise, which is simply not correct. Signed-off-by: Peter Rosin --- drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c | 30 ++++++++++++------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c index 47e0992f3908..ea8fc0deb814 100644 --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c @@ -691,13 +691,14 @@ static int atmel_hlcdc_plane_atomic_check(struct drm_plane *p, switch (state->base.rotation & DRM_MODE_ROTATE_MASK) { case DRM_MODE_ROTATE_90: - offset = ((y_offset + state->src_y + patched_src_w - 1) / - ydiv) * fb->pitches[i]; - offset += ((x_offset + state->src_x) / xdiv) * - state->bpp[i]; - state->xstride[i] = ((patched_src_w - 1) / ydiv) * - fb->pitches[i]; - state->pstride[i] = -fb->pitches[i] - state->bpp[i]; + offset = ((y_offset + state->src_y) / ydiv) * + fb->pitches[i]; + offset += ((x_offset + state->src_x + patched_src_h - 1) / + xdiv) * state->bpp[i]; + state->xstride[i] = -(((patched_src_w - 1) / ydiv) * + fb->pitches[i]) - + (2 * state->bpp[i]); + state->pstride[i] = fb->pitches[i] - state->bpp[i]; break; case DRM_MODE_ROTATE_180: offset = ((y_offset + state->src_y + patched_src_h - 1) / @@ -709,14 +710,13 @@ static int atmel_hlcdc_plane_atomic_check(struct drm_plane *p, state->pstride[i] = -2 * state->bpp[i]; break; case DRM_MODE_ROTATE_270: - offset = ((y_offset + state->src_y) / ydiv) * - fb->pitches[i]; - offset += ((x_offset + state->src_x + patched_src_h - 1) / - xdiv) * state->bpp[i]; - state->xstride[i] = -(((patched_src_w - 1) / ydiv) * - fb->pitches[i]) - - (2 * state->bpp[i]); - state->pstride[i] = fb->pitches[i] - state->bpp[i]; + offset = ((y_offset + state->src_y + patched_src_w - 1) / + ydiv) * fb->pitches[i]; + offset += ((x_offset + state->src_x) / xdiv) * + state->bpp[i]; + state->xstride[i] = ((patched_src_w - 1) / ydiv) * + fb->pitches[i]; + state->pstride[i] = -fb->pitches[i] - state->bpp[i]; break; case DRM_MODE_ROTATE_0: default: From patchwork Thu Jan 10 15:10:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Rosin X-Patchwork-Id: 10757493 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 BD948159A for ; Fri, 11 Jan 2019 08:18:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ADDB82995E for ; Fri, 11 Jan 2019 08:18:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A263529965; Fri, 11 Jan 2019 08:18:26 +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 A68752995E for ; Fri, 11 Jan 2019 08:18:25 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4846E6F583; Fri, 11 Jan 2019 08:18:24 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80102.outbound.protection.outlook.com [40.107.8.102]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3B3B76F369 for ; Thu, 10 Jan 2019 15:10:41 +0000 (UTC) Received: from AM6PR02MB4470.eurprd02.prod.outlook.com (20.177.191.218) by AM6PR02MB4037.eurprd02.prod.outlook.com (20.177.112.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1516.14; Thu, 10 Jan 2019 15:10:39 +0000 Received: from AM6PR02MB4470.eurprd02.prod.outlook.com ([fe80::e5f3:a239:2ec4:4453]) by AM6PR02MB4470.eurprd02.prod.outlook.com ([fe80::e5f3:a239:2ec4:4453%6]) with mapi id 15.20.1516.015; Thu, 10 Jan 2019 15:10:39 +0000 From: Peter Rosin To: "linux-kernel@vger.kernel.org" Subject: [PATCH 2/4] drm/atmel-hlcdc: do not swap w/h of the crtc when a plane is rotated Thread-Topic: [PATCH 2/4] drm/atmel-hlcdc: do not swap w/h of the crtc when a plane is rotated Thread-Index: AQHUqPal2z9iTYzgb0+a4YlOuMR4jQ== Date: Thu, 10 Jan 2019 15:10:39 +0000 Message-ID: <20190110151020.30468-3-peda@axentia.se> References: <20190110151020.30468-1-peda@axentia.se> In-Reply-To: <20190110151020.30468-1-peda@axentia.se> Accept-Language: en-US, sv-SE Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.11.0 x-originating-ip: [85.226.244.23] x-clientproxiedby: HE1PR05CA0257.eurprd05.prod.outlook.com (2603:10a6:3:fb::33) To AM6PR02MB4470.eurprd02.prod.outlook.com (2603:10a6:20b:60::26) x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM6PR02MB4037; 6:arwSSsVJDO4D30SFKsbe2Y9ZC4sW5T5+T4JgSsKt+v0Abo+baQ4T3oP57UWSPaXlJ8/rfiieUdDMGrrZRMJSATMck94+/VMa/dSXBa89o8jVc70Q68Hvj6RQLnk5mWbsVmt/VOhivaq9PX5jBLmW0ItPDWQ2MZPNWgDp4kP0kNvkFCvEoAPcbrunE6Fia39CMC33ZHzQ3CNyvIWJ530JpW/Tqk3w3aJFV5LO5q8NrXUrKPm32U45T0JDsfktYWTc8qN30KST9m77VL92boxBuV5CO7jU6rTrp1mBSAQcBD/6a0zXkUlBQ0j+vmmqe8Gyeo3ZgAEzTfUQQgwUgktq+yNzl1q9pxTFPRmPtt+B8+Cx8EBmsKl7hJ2M9gaOsXSyzfoxIXPNtBa48elWU2bgg5Pmd5QUWVrx/yTaA1HogLsKkjbZpkuSeuHjgXssvAweXx9m9baCm/HYKdKPK7015A==; 5:yB9RRPl/+WJ8VpUNMdf8DwLWMA41wC/hdpK6N9WNayTJtH5N89D+0Twm7NMBkFn3zfqN1KAZ72HkdfNb/vDJZqGsaiFzoLOdFHn6p0euQCajMfOB9nn0MVOOb5AHaL73h6DKBCpCH4Pc5BcApVYM9uUpUat/FkuvuDoniSiaacZy/Q/bsRrAFs+4Bx0vf2TfqNtKZCxvebv7LbK26EDvLA==; 7:lQG8cfzOIuoXgTpEzF7iOGVttWsQZfzNHMGLJxpH/PVCxIzsQsDwaufhlk8Q6Sfy5NJggeE335auAy+DUGLAMDyfomULWOIOHe6ZduBvPpQ8ND7cu4J7YwzbOr4kogYSRC/YE+PcKeWJ1V04lCqb2A== x-ms-office365-filtering-correlation-id: f6ad3eb1-575e-400b-208d-08d6770dc7ae x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(7021145)(8989299)(5600109)(711020)(4534185)(7022145)(4603075)(4627221)(201702281549075)(8990200)(7048125)(7024125)(7027125)(7023125)(2017052603328)(7153060)(7193020); SRVR:AM6PR02MB4037; x-ms-traffictypediagnostic: AM6PR02MB4037: x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(3230021)(908002)(999002)(5005026)(6040522)(8220060)(2401047)(8121501046)(3231475)(944501520)(52105112)(93006095)(93001095)(10201501046)(3002001)(6041310)(20161123558120)(2016111802025)(20161123562045)(20161123560045)(20161123564045)(6043046)(201708071742011)(7699051)(76991095); SRVR:AM6PR02MB4037; BCL:0; PCL:0; RULEID:; SRVR:AM6PR02MB4037; x-forefront-prvs: 0913EA1D60 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(39830400003)(136003)(366004)(396003)(346002)(376002)(199004)(189003)(53936002)(316002)(36756003)(6512007)(97736004)(50226002)(5660300001)(66066001)(186003)(386003)(4326008)(6506007)(446003)(25786009)(26005)(256004)(11346002)(2501003)(476003)(102836004)(2616005)(6916009)(14454004)(71190400001)(71200400001)(106356001)(105586002)(2906002)(68736007)(7736002)(486006)(5640700003)(4744005)(1076003)(6436002)(6486002)(508600001)(2351001)(81156014)(99286004)(81166006)(3846002)(8936002)(305945005)(575784001)(6116002)(8676002)(86362001)(54906003)(74482002)(76176011)(52116002); DIR:OUT; SFP:1102; SCL:1; SRVR:AM6PR02MB4037; H:AM6PR02MB4470.eurprd02.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: axentia.se does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: e6MbwdfETt/ygnp79dhOdG7HmbTYYF5zr4ejqJbHC/0d+7JQM7H9jeh+3vGqMXCUzF2n41HRmjyjw8rt1rO+3NSJw9szKG1yfch3IztRFz6w5cDKKnIVr0/JfmKlDepvlaWUGZSdtwqxtkkbVvwm8r4lMAc47hZvKQmhAJYX8LEhdoixvc75A1BhqGQDdkQS8ba6+lWUn04aXR7DG9vKsDHZCWVwYDq4i7FGFRLtct9/Tnss9PwvjHpCovjVsDdvLkEMSJVhO+ot1v7m5gUDHZbx5veeiKt8jyC10hdZaN8BNiYiRb9HW9ipSINs8KjD spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: axentia.se X-MS-Exchange-CrossTenant-Network-Message-Id: f6ad3eb1-575e-400b-208d-08d6770dc7ae X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Jan 2019 15:10:38.2808 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 4ee68585-03e1-4785-942a-df9c1871a234 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR02MB4037 X-Mailman-Approved-At: Fri, 11 Jan 2019 08:18:04 +0000 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: Alexandre Belloni , David Airlie , Nicolas Ferre , "dri-devel@lists.freedesktop.org" , Boris Brezillon , Peter Rosin , "linux-arm-kernel@lists.infradead.org" Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP The destination crtc rectangle is independent of source plane rotation. Signed-off-by: Peter Rosin --- drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c index ea8fc0deb814..d6f93f029020 100644 --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c @@ -642,9 +642,6 @@ static int atmel_hlcdc_plane_atomic_check(struct drm_plane *p, * Swap width and size in case of 90 or 270 degrees rotation */ if (drm_rotation_90_or_270(state->base.rotation)) { - tmp = state->crtc_w; - state->crtc_w = state->crtc_h; - state->crtc_h = tmp; tmp = state->src_w; state->src_w = state->src_h; state->src_h = tmp; From patchwork Thu Jan 10 15:10:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Rosin X-Patchwork-Id: 10757491 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 7BC1A13B5 for ; Fri, 11 Jan 2019 08:18:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6BBD02995E for ; Fri, 11 Jan 2019 08:18:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5F8432996A; Fri, 11 Jan 2019 08:18:20 +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 5EAFC2995E for ; Fri, 11 Jan 2019 08:18:15 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0882D6F578; Fri, 11 Jan 2019 08:18:06 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80091.outbound.protection.outlook.com [40.107.8.91]) by gabe.freedesktop.org (Postfix) with ESMTPS id DA8C96F36A for ; Thu, 10 Jan 2019 15:10:46 +0000 (UTC) Received: from AM6PR02MB4470.eurprd02.prod.outlook.com (20.177.191.218) by AM6PR02MB4037.eurprd02.prod.outlook.com (20.177.112.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1516.14; Thu, 10 Jan 2019 15:10:44 +0000 Received: from AM6PR02MB4470.eurprd02.prod.outlook.com ([fe80::e5f3:a239:2ec4:4453]) by AM6PR02MB4470.eurprd02.prod.outlook.com ([fe80::e5f3:a239:2ec4:4453%6]) with mapi id 15.20.1516.015; Thu, 10 Jan 2019 15:10:44 +0000 From: Peter Rosin To: "linux-kernel@vger.kernel.org" Subject: [PATCH 3/4] drm/atmel-hlcdc: fix clipping of planes Thread-Topic: [PATCH 3/4] drm/atmel-hlcdc: fix clipping of planes Thread-Index: AQHUqPaocSFXgGMYMU6PnOiTgpGAbg== Date: Thu, 10 Jan 2019 15:10:44 +0000 Message-ID: <20190110151020.30468-4-peda@axentia.se> References: <20190110151020.30468-1-peda@axentia.se> In-Reply-To: <20190110151020.30468-1-peda@axentia.se> Accept-Language: en-US, sv-SE Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.11.0 x-originating-ip: [85.226.244.23] x-clientproxiedby: HE1PR05CA0257.eurprd05.prod.outlook.com (2603:10a6:3:fb::33) To AM6PR02MB4470.eurprd02.prod.outlook.com (2603:10a6:20b:60::26) x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM6PR02MB4037; 6:oirXdou7kvlpoi6F9sLXz3oFqK5xxNU+t3CANdlyoyTy56hKq2iCrF3tbBkAUZselSegOJhB1/reL4V4w5t7McLXDng4HykjCF6EX3mE9WS3j0UhiRNuV3hAj117n4MuHTNt5miW6OMyIFqbBFmz1VJ2rVv8XW/uldjzi+IDfeeGq41zeAKRBOqJdFZc02EwSTzfWy1A3AMkriccKMPtXwXdw6W5LM2UMxx8/9OBT6F4J3cxGHRSzPerLZqfuglA2ZQLv9QqRvORmNdv3BQb1X2MVEitJcvhwHvIF6JJRdtamlRDK+bk3/C49Om2VpPSbg8yuvVPEPEFLmxk8s4zMNEfQQPgtH7UqeTHquYVrhxWoMeUOTQcsJJBMpPeNsGWNQKMJgL2F1L4x2PvbyTzjuoAX9siBhh4Q/uCwX4oHDrhOKkqwphcOq87DHs6s7Sy54+jil8aM8auLlG0z5RyLA==; 5:MFJFEupqkPmYr9iGQKhOmnzRO0kKVDYSg6MOA07KM3OZRTdCLQgcCIw777FbsUE9HeSKhUXwhcd9yh5xJche5Kr1GDhviB2TfM1BhGAqxJJOKwDlA32vUIpJHMr4id9yNigN+Ojf3DM1RZFNBGhOPmsMsg4Ma2NW3aBPnQu7Cu9fN5BlKFIxqtK60vh7Et9z9lL2xkMny+29monGXX+Bwg==; 7:2udaZEXPxmrQTRIuOxi6elOxPlwNhsWQ+4MF2vFXqrAEWz2bRXFS+ZcsMM4BDocfEwxxd/RVhOq/JMt5C4cbPGe4KKLUHBS5BS//V/eCbtSKuMOUjm6LQ4RvK2vTUE79BQM6B4cmLBc8SMppQIZnWg== x-ms-office365-filtering-correlation-id: f524e922-b1c8-47e5-13e3-08d6770dcab1 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(7021145)(8989299)(5600109)(711020)(4534185)(7022145)(4603075)(4627221)(201702281549075)(8990200)(7048125)(7024125)(7027125)(7023125)(2017052603328)(7153060)(7193020); SRVR:AM6PR02MB4037; x-ms-traffictypediagnostic: AM6PR02MB4037: x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(3230021)(908002)(999002)(5005026)(6040522)(8220060)(2401047)(8121501046)(3231475)(944501520)(52105112)(93006095)(93001095)(10201501046)(3002001)(6041310)(20161123558120)(2016111802025)(20161123562045)(20161123560045)(20161123564045)(6043046)(201708071742011)(7699051)(76991095); SRVR:AM6PR02MB4037; BCL:0; PCL:0; RULEID:; SRVR:AM6PR02MB4037; x-forefront-prvs: 0913EA1D60 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(39830400003)(136003)(366004)(396003)(346002)(376002)(199004)(189003)(53936002)(316002)(36756003)(6512007)(97736004)(50226002)(5660300001)(66066001)(186003)(14444005)(386003)(4326008)(6506007)(446003)(25786009)(26005)(256004)(11346002)(2501003)(476003)(102836004)(2616005)(6916009)(14454004)(71190400001)(71200400001)(106356001)(105586002)(2906002)(68736007)(7736002)(486006)(5640700003)(1076003)(6436002)(6486002)(508600001)(2351001)(81156014)(99286004)(81166006)(3846002)(8936002)(305945005)(6116002)(8676002)(86362001)(54906003)(74482002)(76176011)(52116002); DIR:OUT; SFP:1102; SCL:1; SRVR:AM6PR02MB4037; H:AM6PR02MB4470.eurprd02.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: axentia.se does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: R299qUmThCMJjh3OtLJRggcN5xQM1VKyD5UqJvrvNT1z4MMfTDyRd8u75Q1eD0C0kFfVK+XDySm7xgrB6lZqIiX56g94c0KvMUvwSKRxXYwDMlbh2beViDIcGhyhWlfn3VIscMbS05LxePZ1FGSMBcHgJbLm6AuJSffjoCh5tLcZSxHFj4upFzNNtWKqSP0GaKV5jhYH7WNZE9H9n24Ja2RJISCNZHHzycQ+JsEX18JzwR8ZvIMsjAecYE639Zw4h04iB7IbwxoeKFb1pdloN9/e/jhalvTEd2RfAWQr8LB1tF1JAwPd5les/EsLgagj spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: axentia.se X-MS-Exchange-CrossTenant-Network-Message-Id: f524e922-b1c8-47e5-13e3-08d6770dcab1 X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Jan 2019 15:10:43.3333 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 4ee68585-03e1-4785-942a-df9c1871a234 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR02MB4037 X-Mailman-Approved-At: Fri, 11 Jan 2019 08:18:04 +0000 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: Alexandre Belloni , David Airlie , Nicolas Ferre , "dri-devel@lists.freedesktop.org" , Boris Brezillon , Peter Rosin , "linux-arm-kernel@lists.infradead.org" Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP With the help from drm_atomic_helper_check_plane_state function, clipping now handles planes to be partially or totally off-screen. The plane is disabled if it is not visible. Signed-off-by: Peter Rosin --- drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c | 162 +++++++++--------------- 1 file changed, 61 insertions(+), 101 deletions(-) diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c index d6f93f029020..05519e8c6586 100644 --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c @@ -548,7 +548,8 @@ atmel_hlcdc_plane_prepare_disc_area(struct drm_crtc_state *c_state) ovl_state = drm_plane_state_to_atmel_hlcdc_plane_state(ovl_s); - if (!ovl_s->fb || + if (!ovl_s->visible || + !ovl_s->fb || ovl_s->fb->format->has_alpha || ovl_s->alpha != DRM_BLEND_ALPHA_OPAQUE) continue; @@ -600,15 +601,10 @@ static int atmel_hlcdc_plane_atomic_check(struct drm_plane *p, struct drm_framebuffer *fb = state->base.fb; const struct drm_display_mode *mode; struct drm_crtc_state *crtc_state; - unsigned int patched_crtc_w; - unsigned int patched_crtc_h; - unsigned int patched_src_w; - unsigned int patched_src_h; unsigned int tmp; - int x_offset = 0; - int y_offset = 0; int hsub = 1; int vsub = 1; + int ret; int i; if (!state->base.crtc || !fb) @@ -617,14 +613,21 @@ static int atmel_hlcdc_plane_atomic_check(struct drm_plane *p, crtc_state = drm_atomic_get_existing_crtc_state(s->state, s->crtc); mode = &crtc_state->adjusted_mode; - state->src_x = s->src_x; - state->src_y = s->src_y; - state->src_h = s->src_h; - state->src_w = s->src_w; - state->crtc_x = s->crtc_x; - state->crtc_y = s->crtc_y; - state->crtc_h = s->crtc_h; - state->crtc_w = s->crtc_w; + ret = drm_atomic_helper_check_plane_state(s, crtc_state, + (1 << 16) / 2048, + INT_MAX, true, true); + if (ret || !s->visible) + return ret; + + state->src_x = s->src.x1; + state->src_y = s->src.y1; + state->src_w = drm_rect_width(&s->src); + state->src_h = drm_rect_height(&s->src); + state->crtc_x = s->dst.x1; + state->crtc_y = s->dst.y1; + state->crtc_w = drm_rect_width(&s->dst); + state->crtc_h = drm_rect_height(&s->dst); + if ((state->src_x | state->src_y | state->src_w | state->src_h) & SUBPIXEL_MASK) return -EINVAL; @@ -638,42 +641,6 @@ static int atmel_hlcdc_plane_atomic_check(struct drm_plane *p, if (state->nplanes > ATMEL_HLCDC_LAYER_MAX_PLANES) return -EINVAL; - /* - * Swap width and size in case of 90 or 270 degrees rotation - */ - if (drm_rotation_90_or_270(state->base.rotation)) { - tmp = state->src_w; - state->src_w = state->src_h; - state->src_h = tmp; - } - - if (state->crtc_x + state->crtc_w > mode->hdisplay) - patched_crtc_w = mode->hdisplay - state->crtc_x; - else - patched_crtc_w = state->crtc_w; - - if (state->crtc_x < 0) { - patched_crtc_w += state->crtc_x; - x_offset = -state->crtc_x; - state->crtc_x = 0; - } - - if (state->crtc_y + state->crtc_h > mode->vdisplay) - patched_crtc_h = mode->vdisplay - state->crtc_y; - else - patched_crtc_h = state->crtc_h; - - if (state->crtc_y < 0) { - patched_crtc_h += state->crtc_y; - y_offset = -state->crtc_y; - state->crtc_y = 0; - } - - patched_src_w = DIV_ROUND_CLOSEST(patched_crtc_w * state->src_w, - state->crtc_w); - patched_src_h = DIV_ROUND_CLOSEST(patched_crtc_h * state->src_h, - state->crtc_h); - hsub = drm_format_horz_chroma_subsampling(fb->format->format); vsub = drm_format_vert_chroma_subsampling(fb->format->format); @@ -688,41 +655,38 @@ static int atmel_hlcdc_plane_atomic_check(struct drm_plane *p, switch (state->base.rotation & DRM_MODE_ROTATE_MASK) { case DRM_MODE_ROTATE_90: - offset = ((y_offset + state->src_y) / ydiv) * + offset = (state->src_y / ydiv) * fb->pitches[i]; - offset += ((x_offset + state->src_x + patched_src_h - 1) / + offset += ((state->src_x + state->src_w - 1) / xdiv) * state->bpp[i]; - state->xstride[i] = -(((patched_src_w - 1) / ydiv) * + state->xstride[i] = -(((state->src_h - 1) / ydiv) * fb->pitches[i]) - (2 * state->bpp[i]); state->pstride[i] = fb->pitches[i] - state->bpp[i]; break; case DRM_MODE_ROTATE_180: - offset = ((y_offset + state->src_y + patched_src_h - 1) / + offset = ((state->src_y + state->src_h - 1) / ydiv) * fb->pitches[i]; - offset += ((x_offset + state->src_x + patched_src_w - 1) / + offset += ((state->src_x + state->src_w - 1) / xdiv) * state->bpp[i]; - state->xstride[i] = ((((patched_src_w - 1) / xdiv) - 1) * + state->xstride[i] = ((((state->src_w - 1) / xdiv) - 1) * state->bpp[i]) - fb->pitches[i]; state->pstride[i] = -2 * state->bpp[i]; break; case DRM_MODE_ROTATE_270: - offset = ((y_offset + state->src_y + patched_src_w - 1) / + offset = ((state->src_y + state->src_h - 1) / ydiv) * fb->pitches[i]; - offset += ((x_offset + state->src_x) / xdiv) * - state->bpp[i]; - state->xstride[i] = ((patched_src_w - 1) / ydiv) * + offset += (state->src_x / xdiv) * state->bpp[i]; + state->xstride[i] = ((state->src_h - 1) / ydiv) * fb->pitches[i]; state->pstride[i] = -fb->pitches[i] - state->bpp[i]; break; case DRM_MODE_ROTATE_0: default: - offset = ((y_offset + state->src_y) / ydiv) * - fb->pitches[i]; - offset += ((x_offset + state->src_x) / xdiv) * - state->bpp[i]; + offset = (state->src_y / ydiv) * fb->pitches[i]; + offset += (state->src_x / xdiv) * state->bpp[i]; state->xstride[i] = fb->pitches[i] - - ((patched_src_w / xdiv) * + ((state->src_w / xdiv) * state->bpp[i]); state->pstride[i] = 0; break; @@ -731,35 +695,45 @@ static int atmel_hlcdc_plane_atomic_check(struct drm_plane *p, state->offsets[i] = offset + fb->offsets[i]; } - state->src_w = patched_src_w; - state->src_h = patched_src_h; - state->crtc_w = patched_crtc_w; - state->crtc_h = patched_crtc_h; + /* + * Swap width and size in case of 90 or 270 degrees rotation + */ + if (drm_rotation_90_or_270(state->base.rotation)) { + tmp = state->src_w; + state->src_w = state->src_h; + state->src_h = tmp; + } if (!desc->layout.size && (mode->hdisplay != state->crtc_w || mode->vdisplay != state->crtc_h)) return -EINVAL; - if (desc->max_height && state->crtc_h > desc->max_height) - return -EINVAL; - - if (desc->max_width && state->crtc_w > desc->max_width) - return -EINVAL; - if ((state->crtc_h != state->src_h || state->crtc_w != state->src_w) && (!desc->layout.memsize || state->base.fb->format->has_alpha)) return -EINVAL; - if (state->crtc_x < 0 || state->crtc_y < 0) - return -EINVAL; + return 0; +} - if (state->crtc_w + state->crtc_x > mode->hdisplay || - state->crtc_h + state->crtc_y > mode->vdisplay) - return -EINVAL; +static void atmel_hlcdc_plane_atomic_disable(struct drm_plane *p, + struct drm_plane_state *old_state) +{ + struct atmel_hlcdc_plane *plane = drm_plane_to_atmel_hlcdc_plane(p); - return 0; + /* Disable interrupts */ + atmel_hlcdc_layer_write_reg(&plane->layer, ATMEL_HLCDC_LAYER_IDR, + 0xffffffff); + + /* Disable the layer */ + atmel_hlcdc_layer_write_reg(&plane->layer, ATMEL_HLCDC_LAYER_CHDR, + ATMEL_HLCDC_LAYER_RST | + ATMEL_HLCDC_LAYER_A2Q | + ATMEL_HLCDC_LAYER_UPDATE); + + /* Clear all pending interrupts */ + atmel_hlcdc_layer_read_reg(&plane->layer, ATMEL_HLCDC_LAYER_ISR); } static void atmel_hlcdc_plane_atomic_update(struct drm_plane *p, @@ -773,6 +747,11 @@ static void atmel_hlcdc_plane_atomic_update(struct drm_plane *p, if (!p->state->crtc || !p->state->fb) return; + if (!state->base.visible) { + atmel_hlcdc_plane_atomic_disable(p, old_s); + return; + } + atmel_hlcdc_plane_update_pos_and_size(plane, state); atmel_hlcdc_plane_update_general_settings(plane, state); atmel_hlcdc_plane_update_format(plane, state); @@ -794,25 +773,6 @@ static void atmel_hlcdc_plane_atomic_update(struct drm_plane *p, ATMEL_HLCDC_LAYER_A2Q : ATMEL_HLCDC_LAYER_EN)); } -static void atmel_hlcdc_plane_atomic_disable(struct drm_plane *p, - struct drm_plane_state *old_state) -{ - struct atmel_hlcdc_plane *plane = drm_plane_to_atmel_hlcdc_plane(p); - - /* Disable interrupts */ - atmel_hlcdc_layer_write_reg(&plane->layer, ATMEL_HLCDC_LAYER_IDR, - 0xffffffff); - - /* Disable the layer */ - atmel_hlcdc_layer_write_reg(&plane->layer, ATMEL_HLCDC_LAYER_CHDR, - ATMEL_HLCDC_LAYER_RST | - ATMEL_HLCDC_LAYER_A2Q | - ATMEL_HLCDC_LAYER_UPDATE); - - /* Clear all pending interrupts */ - atmel_hlcdc_layer_read_reg(&plane->layer, ATMEL_HLCDC_LAYER_ISR); -} - static void atmel_hlcdc_plane_destroy(struct drm_plane *p) { struct atmel_hlcdc_plane *plane = drm_plane_to_atmel_hlcdc_plane(p); From patchwork Thu Jan 10 15:10:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Rosin X-Patchwork-Id: 10757499 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 451FC13B5 for ; Fri, 11 Jan 2019 08:19:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 357B7296A7 for ; Fri, 11 Jan 2019 08:19:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 29C11296BC; Fri, 11 Jan 2019 08:19:03 +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 D8C88296B2 for ; Fri, 11 Jan 2019 08:19:02 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 58C786F590; Fri, 11 Jan 2019 08:18:58 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80101.outbound.protection.outlook.com [40.107.8.101]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0B2286F36D for ; Thu, 10 Jan 2019 15:10:51 +0000 (UTC) Received: from AM6PR02MB4470.eurprd02.prod.outlook.com (20.177.191.218) by AM6PR02MB4037.eurprd02.prod.outlook.com (20.177.112.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1516.14; Thu, 10 Jan 2019 15:10:49 +0000 Received: from AM6PR02MB4470.eurprd02.prod.outlook.com ([fe80::e5f3:a239:2ec4:4453]) by AM6PR02MB4470.eurprd02.prod.outlook.com ([fe80::e5f3:a239:2ec4:4453%6]) with mapi id 15.20.1516.015; Thu, 10 Jan 2019 15:10:49 +0000 From: Peter Rosin To: "linux-kernel@vger.kernel.org" Subject: [PATCH 4/4] drm/atmel-hlcdc: do not immediately disable planes, wait for next frame Thread-Topic: [PATCH 4/4] drm/atmel-hlcdc: do not immediately disable planes, wait for next frame Thread-Index: AQHUqParKHXTvsIK8EaTrDTiqxp7vA== Date: Thu, 10 Jan 2019 15:10:48 +0000 Message-ID: <20190110151020.30468-5-peda@axentia.se> References: <20190110151020.30468-1-peda@axentia.se> In-Reply-To: <20190110151020.30468-1-peda@axentia.se> Accept-Language: en-US, sv-SE Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.11.0 x-originating-ip: [85.226.244.23] x-clientproxiedby: HE1PR05CA0257.eurprd05.prod.outlook.com (2603:10a6:3:fb::33) To AM6PR02MB4470.eurprd02.prod.outlook.com (2603:10a6:20b:60::26) x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM6PR02MB4037; 6:l5rhVY1b7Vw+8qRryBKOAWCM+qSOqEKtoIViAXkUnIHinZT0ZFWR6q3OcI+/+RRdoPBJpakmte+wm3juySvuuuFb5k0xp4DMC7lOwcH56NoSQGdAJL9gK16QpGoJ6L36+YtquhRFltf9iCTH74RNLdnxALH9YwNb6kzLIBBtvie1i8pzHju3y1Erkufq3l+d1hoFtf7Nh7uOrRnkJ2RUE1wQFZVYlSdWpW0l5fFdmkT1YT7oocc4Iu5gn3hTt9mW4M12BrGiEXDwVCh9ZRwU9ss5bA5BOTjQB/ac3rFfWrQynVc0dIO9eX9fReSq2UcRf1vI1VWcWsOa0Atu5E//wGP2paKB11JvMfSwd0CTAJpEcKV/f0gGjqv+5QaKg5ga1Rt20Iuuj5w0x2Fh6LyBgoacBceWqLbzyDjOFtpsphJAL5OAuB3iuc5buaE9MHqylEQ5aR6J8xg8Z4yFOyWrZw==; 5:SzL99niKpz8qePpr8b2aFnzNFY7nkbG+X7BOgZ2JkG+oZW+zuZLFA9yOFtIuaOfiGLMXcnHeQUYKOLlybd42GQYIu7WuVS25WuPvthtxRxhRY+sx4j/3B+2I+0DkQIq9XM63PWQ0nJaHQdoIOln2Bo0KZxz1o0TqN8Bl+ym3fVAgktck0PI6Sy9fEJHvoVAQrD+CY5l+OGHJ1C1udDfhqw==; 7:F1y0og5CbUNdVrxCikeqjbuEU/+yytYXU/z/LdeBew+TKUbSZV89YaiGa+oN4CKVU4fDh6V3aOFywJ5cG8FQz6V5mpBwsst+9TCe7a1Wzj9ualQpyux/hqhdXao6cawYcgzZJxtcmosG/fz0ogRmTQ== x-ms-office365-filtering-correlation-id: 529e6263-5f82-4f7b-2903-08d6770dcd8e x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(7021145)(8989299)(5600109)(711020)(4534185)(7022145)(4603075)(4627221)(201702281549075)(8990200)(7048125)(7024125)(7027125)(7023125)(2017052603328)(7153060)(7193020); SRVR:AM6PR02MB4037; x-ms-traffictypediagnostic: AM6PR02MB4037: x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(3230021)(908002)(999002)(5005026)(6040522)(8220060)(2401047)(8121501046)(3231475)(944501520)(52105112)(93006095)(93001095)(10201501046)(3002001)(6041310)(20161123558120)(2016111802025)(20161123562045)(20161123560045)(20161123564045)(6043046)(201708071742011)(7699051)(76991095); SRVR:AM6PR02MB4037; BCL:0; PCL:0; RULEID:; SRVR:AM6PR02MB4037; x-forefront-prvs: 0913EA1D60 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(39830400003)(136003)(366004)(396003)(346002)(376002)(199004)(189003)(53936002)(316002)(36756003)(6512007)(97736004)(50226002)(5660300001)(66066001)(186003)(14444005)(386003)(4326008)(6506007)(446003)(25786009)(26005)(256004)(11346002)(2501003)(476003)(102836004)(2616005)(6916009)(14454004)(71190400001)(71200400001)(106356001)(105586002)(2906002)(68736007)(7736002)(486006)(5640700003)(1076003)(6436002)(6486002)(508600001)(2351001)(81156014)(99286004)(81166006)(3846002)(8936002)(305945005)(6116002)(8676002)(86362001)(54906003)(74482002)(76176011)(52116002)(14773001); DIR:OUT; SFP:1102; SCL:1; SRVR:AM6PR02MB4037; H:AM6PR02MB4470.eurprd02.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: axentia.se does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: 2u7gdM1Ky+CIK2saE/pt0xt2IA/NLsZKeqmXJBtdIeIwRV+FoFw0H3enSJrl8cVyyqZ1AtsZ34j08PjfWdQB24V5A97kzUmO3KeAG1M1QemRrqgcQ4n532q2D3JTKFtJfwRKxMIkn78u5QMnxPqld/EgFmFdl94xRakkmcxlvE7F5qsBfHIcn9q6Xii7nVlmwBMkhK/88zSlTrbmr34vYqo32KsoE4NILVlQFqMoCI7p/b7VIYN5j9+31uyBfRZHwI1btJ44D2TycheXa0Y27w2m/jcOnvP73UkgdDQV65YCciZxvR1NNRE3blcMk8Yh spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: axentia.se X-MS-Exchange-CrossTenant-Network-Message-Id: 529e6263-5f82-4f7b-2903-08d6770dcd8e X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Jan 2019 15:10:48.1386 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 4ee68585-03e1-4785-942a-df9c1871a234 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR02MB4037 X-Mailman-Approved-At: Fri, 11 Jan 2019 08:18:04 +0000 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: Alexandre Belloni , David Airlie , Nicolas Ferre , "dri-devel@lists.freedesktop.org" , Boris Brezillon , Peter Rosin , "linux-arm-kernel@lists.infradead.org" Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP The A2Q and UPDATE bits have no effect in the channel disable registers. However, since they are present, assume that the intention is to disable planes, not immediately as indicated by the RST bit, but on the next frame shift since that is what A2Q and UPDATE means in the channel enable registers. Disabling the plane on the next frame shift is done with the EN bit, so use that. Signed-off-by: Peter Rosin --- drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c index 05519e8c6586..f2f570642f84 100644 --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c @@ -728,9 +728,7 @@ static void atmel_hlcdc_plane_atomic_disable(struct drm_plane *p, /* Disable the layer */ atmel_hlcdc_layer_write_reg(&plane->layer, ATMEL_HLCDC_LAYER_CHDR, - ATMEL_HLCDC_LAYER_RST | - ATMEL_HLCDC_LAYER_A2Q | - ATMEL_HLCDC_LAYER_UPDATE); + ATMEL_HLCDC_LAYER_EN); /* Clear all pending interrupts */ atmel_hlcdc_layer_read_reg(&plane->layer, ATMEL_HLCDC_LAYER_ISR);