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: 10756043 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 45B1A14DE for ; Thu, 10 Jan 2019 15:10:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3186029960 for ; Thu, 10 Jan 2019 15:10:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2564029A7F; Thu, 10 Jan 2019 15:10:54 +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,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1BFF229A7C for ; Thu, 10 Jan 2019 15:10:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:In-Reply-To:References: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=sXzvUA7VkbB8UX4lOcyJy0pE1ADKfCDjb0/pQL5t6O4=; b=BeZq/k/C/t/EP7 zeYNkR5xwDLwwln6PVRH19xxEgFNlYxwsOpRqzabYgvoXy4ApoIID0X8GwIyJTyty8CCC5mGPUgTw n2jFW/ZZj0CinxgmXMcKzv+yflao5TGsX8Fe4og2fXHkqAT8U/2i40tOI6zn3O7b4KSvKm8Zce15I Qs8M63OVI3Qmg0KRlNMk6kP1sVZtwElZsdI+9tGV9A1PIclssmatD+0fSYy4rlzHUvtuoUjMWUa4C 4bQuxiwNaYp4485ZdCK3szeoyaFFGEBmnJ48OHh/vH/9LojBa1CkwWtwi5tGAWCeodXM7Yxo55ec8 4BcoNDP9ngwD/nFN+TpA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1ghbys-0000AY-ES; Thu, 10 Jan 2019 15:10:50 +0000 Received: from mail-vi1eur04on072a.outbound.protection.outlook.com ([2a01:111:f400:fe0e::72a] helo=EUR04-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1ghbyg-0008Qn-KR for linux-arm-kernel@lists.infradead.org; Thu, 10 Jan 2019 15:10:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axentia.se; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fubxctBDBF6kkbNS9MWkCLsoSWq6LbrnhCguLwzDgVc=; b=K6Td3zqaVkb5ckYSB7372Ie/eMSWXZRUoD1iuL8eCh/dK13VUyaCs4CPzeVTv+qv4n/typexhJHW+XMCNJq4+Or1f8VDtM8b7W+laiLaj+1wo491+L628CNldKhiTRP87rPyryJvMT8SgKNR9gL8qQaqJYdWUPIhC84cL+djqLA= 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) authentication-results: spf=none (sender IP is ) smtp.mailfrom=peda@axentia.se; 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190110_071038_666817_E04E60AE X-CRM114-Status: GOOD ( 10.62 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexandre Belloni , David Airlie , "dri-devel@lists.freedesktop.org" , Boris Brezillon , Peter Rosin , "linux-arm-kernel@lists.infradead.org" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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: 10756045 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 DA6A913B5 for ; Thu, 10 Jan 2019 15:11:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C972429A33 for ; Thu, 10 Jan 2019 15:11:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C7B7629A57; Thu, 10 Jan 2019 15:11:08 +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,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7AA6729A87 for ; Thu, 10 Jan 2019 15:11:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:In-Reply-To:References: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=r/AUd6eqoQuWFNFjV0XwgujvRysME+X6pXtWu79y0QM=; b=TJH+FrhVHQUfds 2oF0RSmg6gHlvR7FBJF6jzXXNp6b1x0h+GPLkxA+hJuuN7TP9lovv388i+LM+KE1ibjm2PGxIOUIE yK1w4jDBPPK15fgefV42m3WMY2ISYdJWiYsh2QoqnzcfNzy9mlOKCCmMbkl1/9bOdMLttoYrgd0a7 y0ZEml4leQo1ixw8HCgq0uGpo+vUnsrclCHm5wSIo5B4HtUtg/fOxEv+Ty6PHzghJYeNhn13gvFsB +omoQQiJIVOKFU7iPiUBwKSjMpxswp9gOwia8FqFEXRRQEy6alzW6Ctd3AeE2eYV+zPe5P6CYNBP4 Hb1Wn/XoRJzc5DeHgJaQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1ghbz8-0000SF-85; Thu, 10 Jan 2019 15:11:06 +0000 Received: from mail-vi1eur04on072a.outbound.protection.outlook.com ([2a01:111:f400:fe0e::72a] helo=EUR04-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1ghbyi-0008Qn-M2 for linux-arm-kernel@lists.infradead.org; Thu, 10 Jan 2019 15:10:42 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axentia.se; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=c3NQshP9lIPHHAPMrelZKkEChYzI3ptRTj3F2NAeNDc=; b=dEVabNWPaZHqKvwOwFtLweor2XQTsUGV1p0c7nm4VQiOjdCZXRt3xN6QesFY/VO6xCAAeUXCNE/0Pjh8UTygUEr5dq0/l5HnzQDmYi/AeeBeTFQMELnNqonCIcoiAEae8MDxhUOpkJrX7DHb+6N2G67Thf6cvWxeCk8b6le5q+o= 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) authentication-results: spf=none (sender IP is ) smtp.mailfrom=peda@axentia.se; 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190110_071040_968232_25ED95E0 X-CRM114-Status: GOOD ( 10.26 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexandre Belloni , David Airlie , "dri-devel@lists.freedesktop.org" , Boris Brezillon , Peter Rosin , "linux-arm-kernel@lists.infradead.org" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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: 10756049 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 8D92014DE for ; Thu, 10 Jan 2019 15:11:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7AE4829A6A for ; Thu, 10 Jan 2019 15:11:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7960D29A8D; Thu, 10 Jan 2019 15:11:32 +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,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C068D29A6A for ; Thu, 10 Jan 2019 15:11:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:In-Reply-To:References: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=tEYcSgOzKcRsglc1ne+U8nr3XEMop/GO6vWtsDprNEA=; b=LcZXn685wG77qk VEPKebaVe19BoMcv+RS66NqJx5cNuC5mUB4h3QMuvmmp6l8eeTycLr64OtCtgVUvkQKjZ1YTKqrQK WPeOWGk19TpmqeVGy3era2nq2IC/LS8bgaNZrbNyCeRt2W7wefN+S46775p5n8sdaveSdYI92EaOc chEaBF+lmp2VQ0ofQs8n+dIRXQwsw4o61eOlw6xCbduh4KdYAhIJBgShtrgaKmaKTG59EEV7f2ldB 9oPGeEbPo29/r7/RDEb8KzG+C9OZRpgNZA3B4GSw1yMB4gtkWHSXHhtZVCg3niTUlNdwop2mXJQHd wmLtWqMY7qw1vkRfcVmA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1ghbzU-0000nj-DP; Thu, 10 Jan 2019 15:11:28 +0000 Received: from mail-he1eur04on071d.outbound.protection.outlook.com ([2a01:111:f400:fe0d::71d] helo=EUR04-HE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1ghbyq-00006E-Kl for linux-arm-kernel@lists.infradead.org; Thu, 10 Jan 2019 15:10:59 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axentia.se; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=p5uGpSVwspiZlFxAcd0DqWqrymEEcvx7254O23WdfpE=; b=tg7/f3AZlL9V9kqMWECfCPl2EL2pWkeLj5mv2AH4dq83/KRvdHLvSrTypVUCLdmAG7tbGaKINQqAYz1eBQYRldYDi6e0Vwbff5MHgK4ghUhZWk9ZUNy0sfmESFPA2TTCUvOjTjNHd3KR52crJIYI4QdNdocXvPulVaGylmeGSs8= 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) authentication-results: spf=none (sender IP is ) smtp.mailfrom=peda@axentia.se; 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190110_071049_603278_2D0DE5C6 X-CRM114-Status: GOOD ( 16.89 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexandre Belloni , David Airlie , "dri-devel@lists.freedesktop.org" , Boris Brezillon , Peter Rosin , "linux-arm-kernel@lists.infradead.org" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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: 10756051 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 E884C13B5 for ; Thu, 10 Jan 2019 15:11:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D77CD29A4F for ; Thu, 10 Jan 2019 15:11:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CC1B529A92; Thu, 10 Jan 2019 15:11:53 +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,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7691529A95 for ; Thu, 10 Jan 2019 15:11:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:In-Reply-To:References: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=xAlX3pOIdxE6S1dUiib7m0/wMqQY+zAjoPVVIQILuds=; b=HZzk1UJKrfeUyr CZa7SDPAiiBPFS9NY7eoJpH78trowczdyd5yVNAfqbM9aVVgoyU2Ghf+8yj9LCu+KSRIs3K1t7lQ4 WRaRdpBQn25KQ6FGqeY/YuwYS5A77LogjFKFKKCwX9+bVv3pWufp/Pd1jz7BeS/+Sy1++bwL4qMJ2 4DZi6pb/tEoQkpHzLggwYUaHkNbKBS0NTGlRl62iy4m97JgfoRmYIVWQSlGaZP028HM2HpMkxab0C 4wt4hNMbBYz9weNYeb9f4JS5JNO70Ta4kFD+/i9arozEFlw3sJdgDSdagkjsgmTErcRcV+is8nKbS IpWW0Lfq9stP83dBAM0w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1ghbzr-00018h-3K; Thu, 10 Jan 2019 15:11:51 +0000 Received: from mail-he1eur04on071d.outbound.protection.outlook.com ([2a01:111:f400:fe0d::71d] helo=EUR04-HE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1ghbz2-00006E-9O for linux-arm-kernel@lists.infradead.org; Thu, 10 Jan 2019 15:11:28 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axentia.se; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=yfejE45XFsxyeIfyxe8zRHW01ZzjfRWcAHquFt+YA9c=; b=MgqBMrFR4naTxUAztDmCmDdzKMWtGJnD+MudZlHOAZkc+Zytc15CF8uv8qA89FUPKZQgXry//AHF+tB5jARZu9H8o/+LXK1ocgNmJV9OEMVkBKccksR2tUPNoPy+AdGJgAAAnYxqIjuOmyd7ohQzMepQQ3266TCXymP2TmdzYAc= 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) authentication-results: spf=none (sender IP is ) smtp.mailfrom=peda@axentia.se; 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190110_071101_522124_04759794 X-CRM114-Status: GOOD ( 11.52 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexandre Belloni , David Airlie , "dri-devel@lists.freedesktop.org" , Boris Brezillon , Peter Rosin , "linux-arm-kernel@lists.infradead.org" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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);