From patchwork Tue Oct 18 08:44:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ying Liu X-Patchwork-Id: 9381639 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 76F5E607D0 for ; Tue, 18 Oct 2016 08:44:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 64BCE28D97 for ; Tue, 18 Oct 2016 08:44:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5936029357; Tue, 18 Oct 2016 08:44:27 +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=-4.2 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,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 D5B8328D97 for ; Tue, 18 Oct 2016 08:44:26 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 664DB6E66C; Tue, 18 Oct 2016 08:44:24 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0080.outbound.protection.outlook.com [104.47.42.80]) by gabe.freedesktop.org (Postfix) with ESMTPS id B19266E667 for ; Tue, 18 Oct 2016 08:44:22 +0000 (UTC) Received: from BN3PR0301CA0047.namprd03.prod.outlook.com (10.160.152.143) by BY1PR03MB1418.namprd03.prod.outlook.com (10.162.127.148) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.659.11; Tue, 18 Oct 2016 08:44:20 +0000 Received: from BL2FFO11OLC016.protection.gbl (2a01:111:f400:7c09::135) by BN3PR0301CA0047.outlook.office365.com (2a01:111:e400:401e::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.669.16 via Frontend Transport; Tue, 18 Oct 2016 08:44:21 +0000 Authentication-Results: spf=softfail (sender IP is 192.88.168.50) smtp.mailfrom=gmail.com; vger.kernel.org; dkim=none (message not signed) header.d=none; vger.kernel.org; dmarc=fail action=none header.from=gmail.com; Received-SPF: SoftFail (protection.outlook.com: domain of transitioning gmail.com discourages use of 192.88.168.50 as permitted sender) Received: from tx30smr01.am.freescale.net (192.88.168.50) by BL2FFO11OLC016.mail.protection.outlook.com (10.173.160.82) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.669.7 via Frontend Transport; Tue, 18 Oct 2016 08:44:20 +0000 Received: from victor.ap.freescale.net (victor.ap.freescale.net [10.192.241.62]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id u9I8iHQt015671; Tue, 18 Oct 2016 01:44:18 -0700 From: Liu Ying To: Subject: [PATCH v2] drm/imx: ipuv3-plane: Access old u/vbo properly in ->atomic_check for YU12/YV12 Date: Tue, 18 Oct 2016 16:44:03 +0800 Message-ID: <1476780243-30051-1-git-send-email-gnuiyl@gmail.com> X-Mailer: git-send-email 2.7.4 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131212538611559479; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(7916002)(2980300002)(189002)(199003)(586003)(626004)(82202001)(5003940100001)(305945005)(2906002)(7846002)(55446002)(19580395003)(104016004)(76482005)(68736007)(81442002)(106466001)(6260500002)(81156014)(48376002)(47776003)(50466002)(8676002)(19580405001)(15975445007)(92566002)(97736004)(61266001)(73972006)(189998001)(110136003)(36756003)(6666003)(83322999)(81166006)(77096005)(87936001)(86362001)(356003)(5660300001)(73392002)(50986999)(33646002)(50226002)(575784001)(105596002)(87572001)(229853001)(4326007)(8936002)(2351001)(6916009); DIR:OUT; SFP:1101; SCL:1; SRVR:BY1PR03MB1418; H:tx30smr01.am.freescale.net; FPR:; SPF:SoftFail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11OLC016; 1:yrbuGss6xy7q5m+rXaFohuPrL/GlKwEYeLPMMukO4c/tYdF4P95Rzl0ku2SAjCsTtcNPgHjU1M2iXwOJq3MO+lftVBmeJHm2dbOTWvD0Bx2S8a4flq+DhTziX+jU+erMlkL1C9xN9Py7CijD6CCuk5RVWrfYKifodGUBnYQmGTFPu1Cf6Olsv5KnKiUCqfvPOBndHkwQdAXCjy9pdJUMy2EAn39j20/6ll9F2znoObmZSn1UdZAJ7YzVLakD5HBYCU1wraeFcpuz8cXxCIqsvj3mIkNKKHKEbnCSR8lPo8nsuSznTO39JO7OFhq7+7/hG8sYXlAdAFCEmWaxXYQcaIw9bS2D23DAVD38tj3pOnKSIqyX+KoR/fKU4VaPEIYvAWsAW/BjC93NPB1tzjNSyF3/5CmNHvdmoplSUBs0v1fi431cRBcto+ywemfavw8jWKaVwuocwxn10o3eN9nIL1E9ltSZSGcwNuCRMeHKfFUd2HImipAER9OWNjbY4AcA9Ipx4065DFkPzQ5eeNxfTP9hM8cSbyCJONj0HP+YmQzgdIIUL/wNFeXwJzkasEujH5wi1j1vFfBdiQOX1p2qyIyji9h5HBPPofQRR4sIt/o= MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-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X-Microsoft-Exchange-Diagnostics: 1; BY1PR03MB1418; 31:KPG8eL2sQajYNHAkEA9RteTau7moM7DcmId5+yPTdyVYIfwe6ghvk84nqQgemKcQZ6n3m+iMRbd84uhsqH2bmz8UZja4NFrM38DLhNLqU7A3VsNk9fz1CHfoM1ZoPMpfCcL7lU/soUOP9sKybzVZE+3UCHvNqRzjTDfQDsH8XQTIu9/5bjrbtYgm0IErmBw9cYXL3ZRDF6Rswzn2dPAYBdYpIF1YmswLQG7b07xT0FkvEP+gnT2/SXNLFCgItqY1nCNX9FCvSMZBnDdA9NpYnA==; 4:AIsfzO3VGXIQ4NY6/6NkA8oxdt/7o6I/pRkEua3IWN0qr+enu/SoJLsqQEokD7W6g64D996f8eN7eEKVZ9Y153v+d6VMgs7jUhzdw0dJoAn1izZEizcO4Q4aPZXWFKoDjIy8UcLYsKU6lhYYHGjCVvIMd8zn1wccH/W2MLdRpcjur+j3ovFvHhGuE5eM0OYYagqNvrGwpcqlMInIP/IP/1+uu0fkEgx4mrrQrJqFRIXVrbWnwLimqBzwvwQ9Y88opPZbvR8BqJYKCjHgp0kTzlDRko/Yj0y17eqfpnxGTMlJhEmmgHO1MOAtFOmZ8KGlN1PHuDlGS3Kapz+IAKBvji9711dbfJgNm/s42ND9oxkGY2ANOHMtkGd74nP+3zKmPXgF1waQYq7Fv74kFgoIHhL/oTUYjbbQQu3Ap+juSLvMFTSlbpPKrshDmNcsGY9WwSmwb4EKqFTE7Hlf57yfwye7UfYPZgi4y7WsF0FWVy63eBkks2zTD9qE/WhJqoKS48WKQZdjHxKUN9PUD9eBvKTaa6LmO5jp7K9soSjBP2/I1k2WwYpHdjzmvuWUL09J X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(9452136761055); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(8121501046)(13024025)(5005006)(13023025)(13015025)(13017025)(13018025)(3002001)(10201501046)(6055026); SRVR:BY1PR03MB1418; BCL:0; PCL:0; RULEID:(400006); SRVR:BY1PR03MB1418; X-Forefront-PRVS: 00997889E7 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY1PR03MB1418; 23:re42ykwhO8PrcVs1nCii0exojdzlNS+67b6lT/Z2Z?= =?us-ascii?Q?us+V56ULJNOaRzRGZv8wwM2b/xJ8gKeBX31EJ7V5/C4h1roKlKTqYUZdFdHA?= =?us-ascii?Q?A0tze6suV+IjfqZy9PMiaCHcB+TTKOBRMco9xm5vGFiVsw0p2YvFosV8z0zj?= =?us-ascii?Q?0jJDjBXmDg75v/1XYhHlcCAw9BmM5VyvSgCNjGya/KlgEUQ9tG8sfVwjzo7e?= =?us-ascii?Q?jSaOKmJFQt8L1M27w0mwyUtuBIhd29oEGMLL9QBtd8d7Pyl6fnF5cZySRq3l?= =?us-ascii?Q?e1upyMOQr9LV4ME2KJXIJyP2ILi+j2NPiRM44v3V3peehRpwnq5e2wTkwL5I?= =?us-ascii?Q?IlX0YvlSD/oY7XGMfrbLILSi1l0m5r4KOkB92KHNnoBcdYC/YyZnqkfnTd9I?= =?us-ascii?Q?PydIL6SHeXVTifruZnib5DOLn/eBrAle5UWTcGhRqQyohS6a6Se9R/7IaSRp?= =?us-ascii?Q?xYeFhmgTun8L9ObxXSGvgf3DdsuWBxGiK/H1T8UKkHmn+wzY9la1uAtilhWj?= =?us-ascii?Q?9mQUaSBE0sX8KDHtHoexY7izp2xptsoQLQLjtbug1L8IJCIkfoaKbA9R83Vb?= =?us-ascii?Q?eQafqbQtUw6Vy8/piPkcvFBs8HGs/6gBPUTBqQBpjhU2MoHeEbkOtD/YLsAK?= =?us-ascii?Q?sxPBybMe9scEVdALJyWObA5hzaJzEEKS+wmMtNfc3hF8TCuPqzlbDaTTXF6a?= =?us-ascii?Q?Jb7nD5hn7l4HsMfpYmG5DBpMGRHf4Hl1RZBgLeJGcspwEsmuLmmD6eSHkvOK?= =?us-ascii?Q?sGFOtK/PbgfzDHTkV2fO/Sl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jdEx6dnsuOhV/PAefS1GtiicwrDKp1+INOxKoxUCbXwooe7YlUavDz7BBBm4xG7hO8MHnDz9aakdkkxn0oxTNNIxIGiv4XauO669KrIz9vsg5Y8KD9s9VWQz//8Z6YV/dGwGf057WA; 24:7Yhim1vKXa5OTusbFZ1W2TTDngybN1SexVKcCXAEiWBFWxxYzAiqgvXZfu6MaHV3LaZnpAIfVoqRP3RMaBbhNIJGVgl/H+fkWRgkRH009VA= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BY1PR03MB1418; 7:r2qB8QKBF2Xsv3UOT3j/zXoGp5UjN747XtXDGj7J/8G+r7qdwbLeGB0asNKqzumZjrX54DZlHVu5HZAJKgPFiZJ9aDW1Yus6AaYnff/Q3jpgTNOIzmnbQ4T6ouQrrl9hHfmpLqVP5plMVbKshCGOd9w03s3P+7BPfCj+3ma/J0+78De2dL91VE141emGEjz8C8bVwIyNeKwAsU8fNKecbR+x13nzieFC3xUT3S0bmwenAIvTwk0qHNJQ+xzqD56khrjr3tpYFVbworih6sjxcfNxGecwy6y//Ki4ncQFHD/RRPds5wmXWyHqwFYosxjYgWlr9KR6bNdnGL5yNpKmMHxAsvMTEwyDqEJRNnZB2I8= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2016 08:44:20.9687 (UTC) X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR03MB1418 Cc: stable@vger.kernel.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Before accessing the u/v offset(aka, u/vbo for IPUv3) of the old plane state's relevant fb, we should make sure the fb is in YU12 or YV12 pixel format(which are the two YUV pixel formats we support only), otherwise, we are likely to trigger BUG_ON() in drm_plane_state_to_u/vbo() since the fb's pixel format is probably not YU12 or YV12. Link: https://bugs.freedesktop.org/show_bug.cgi?id=98150 Fixes: c6c1f9bc798b ("drm/imx: Add active plane reconfiguration support") Cc: stable@vger.kernel.org # 4.8 Signed-off-by: Liu Ying --- v1->v2: * Correct the condition under which we may access old u/vbo - old->pixel_format is not necessarily the same to fb->pixel_format, instead, it could be YU12 or YV12. This may cover the case in which we switch fb pixel format bewteen YU12 and YV12. drivers/gpu/drm/imx/ipuv3-plane.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/imx/ipuv3-plane.c b/drivers/gpu/drm/imx/ipuv3-plane.c index e33110e..08d0fd5 100644 --- a/drivers/gpu/drm/imx/ipuv3-plane.c +++ b/drivers/gpu/drm/imx/ipuv3-plane.c @@ -359,7 +359,9 @@ static int ipu_plane_atomic_check(struct drm_plane *plane, if ((ubo > 0xfffff8) || (vbo > 0xfffff8)) return -EINVAL; - if (old_fb) { + if (old_fb && + (old_fb->pixel_format == DRM_FORMAT_YUV420 || + old_fb->pixel_format == DRM_FORMAT_YVU420)) { old_ubo = drm_plane_state_to_ubo(old_state); old_vbo = drm_plane_state_to_vbo(old_state); if (ubo != old_ubo || vbo != old_vbo)