From patchwork Mon Jan 30 15:42:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mihail Atanassov X-Patchwork-Id: 9545633 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 A2D9A60417 for ; Mon, 30 Jan 2017 15:42:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 91F2A27E15 for ; Mon, 30 Jan 2017 15:42:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 85F8F28138; Mon, 30 Jan 2017 15:42:37 +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.1 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID 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 0D0FD27E15 for ; Mon, 30 Jan 2017 15:42:37 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 594B089EF7; Mon, 30 Jan 2017 15:42:36 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0061.outbound.protection.outlook.com [104.47.2.61]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1AD3289EF7 for ; Mon, 30 Jan 2017 15:42:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector1-arm-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=XBlfVcnOWK6jDRLCKq1C/Y3QXfU5m7+osUyqbSO6A3I=; b=BL4HsK+EYFpdb9ItxPjMRIKle6W4YnCvH8JTDi/cCjQ6aUqbjguJUrBcIKnPIVmHuPEdOoutIufsr5innK7FVgEpBIVj5AcSW+Z8yEBE6tDyOGu02jQWPPBiQ8irHy0CrPsuwDMnK9dVlbMHHcFAagWIYnO65Cs/aFvphOtc0Ms= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Mihail.Atanassov@arm.com; Received: from e110433-lin.cambridge.arm.com (217.140.96.140) by HE1PR08MB0891.eurprd08.prod.outlook.com (10.164.53.29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.860.13; Mon, 30 Jan 2017 15:42:30 +0000 From: Mihail Atanassov To: DRI devel Subject: [PATCH] drm: mali-dp: add custom plane ->reset hook Date: Mon, 30 Jan 2017 15:42:26 +0000 Message-ID: <1485790946-18718-1-git-send-email-mihail.atanassov@arm.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 X-Originating-IP: [217.140.96.140] X-ClientProxiedBy: HE1PR1001CA0005.EURPRD10.PROD.OUTLOOK.COM (10.171.99.15) To HE1PR08MB0891.eurprd08.prod.outlook.com (10.164.53.29) X-MS-Office365-Filtering-Correlation-Id: 6a22720a-90a3-4f53-5e46-08d449269a0e X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(48565401076); SRVR:HE1PR08MB0891; X-Microsoft-Exchange-Diagnostics: 1; HE1PR08MB0891; 3:7lOjGmC1KmnQjE934cHW8fwGaVnyhZ4/3pstSDvaZyBD/IgtWBEZ/g2TC5F+lY5lSWCg88w7Zdywj4sMjVg61574hT2isO1mvdonEA1dGOf3G4jeqHiN6BP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Q2NXBrEubfZleQ3IRyIjRecKpZ+a3KEYSE= NoDisclaimer: True X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(180628864354917); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6055026)(6041248)(20161123564025)(20161123562025)(20161123555025)(20161123560025)(6072148); SRVR:HE1PR08MB0891; BCL:0; PCL:0; RULEID:; SRVR:HE1PR08MB0891; X-Microsoft-Exchange-Diagnostics: 1; HE1PR08MB0891; 4:zt+WBbuO7NkYhQmeWWFaPqcpJTBXaNlFkKcVRoB6fy7bS1m7v2M11XrwvIDRxgbV00ae7S3HyqoJvl6AXOldtKHEHyPPghARtdlZvDmn4rxsSSFHtENIztTgZ90Zxuk8SgXdiBN6lgI/3TOuDHlxv6FVTGmKWEVrleO4T5zBrHJv/vpIjPtNSLjfVeRrutxNX3boovwpaNj/JnsUrC5XSwH8+DRPymSNtWMX6chr7ZEj97CDyIbE4A2soJU8aQJqNcc4gP/G2j942jLB0S8FD7eb2n8v6WHohBNSvVd8jZGLmnYg4mwNi1NgsR6RKcK7DWwMPLTLtj+z1LtZp4QG7CLNl12bJTPwP4EE1gUtU8gJKqgFQnIaRmwrwx4vq8K57dqW1F+aZKv+wgcpunF96zT59fu8gwTnb7ZAmzS77yS7Hcdwz41sJxp8PyI7m3oUfmSti+QC6wZ3apqRZAZ2nhvTjK5vBaj7Ajfvx7C0tBSb5o2xuPDIDu3FjVt2UY2AUnaVe2soaduZmciDhunoHPaYdyNjMAXHPi/CCwkb6p5dIanRPusfBpkHwiIf3oMPYnvSE+F1H9vgtzojGyjVzSu5WWP9cizqMO/E8tEjTy25Puz/aeY7Aq6l/th0V4LWzXhxCKSWZt/bm6X2KugTVg== X-Forefront-PRVS: 0203C93D51 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(7916002)(39840400002)(39410400002)(39450400003)(39860400002)(39850400002)(189002)(199003)(66066001)(33646002)(47776003)(6916009)(5660300001)(6666003)(25786008)(53936002)(68736007)(97736004)(50986999)(81166006)(3846002)(8676002)(6116002)(2906002)(50226002)(86362001)(110136003)(38730400001)(101416001)(36756003)(7736002)(81156014)(4326007)(189998001)(5003940100001)(6486002)(105586002)(92566002)(50466002)(48376002)(54906002)(305945005)(42186005)(106356001); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR08MB0891; H:e110433-lin.cambridge.arm.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: arm.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; HE1PR08MB0891; 23:1Dlt3rh13VPTKMgT1Mgb8xLpJRRsixGBc7KmZN7un?= =?us-ascii?Q?CV0VXsu8AbAE2QAX6MJ0z1arrRwO3jfGJtkDzOXsptLCt7sgmgT7e7PloBmT?= =?us-ascii?Q?RkoBg3vXlX2D80OPGSp4W5yDipW6MniYin6XAbaTer+oR+LdpNitk0LkK0bz?= =?us-ascii?Q?dAxKnMRSzO/sSTfRDjZpOVRObWD3pfoVFfGofEwadnqcOBOcZg4uh1uWorEo?= =?us-ascii?Q?waEfkPyAdgXFDbxN8b7CsjHLIZCGn9ofXNcho4G8hUdKkDIUlNVaGrfjTykU?= =?us-ascii?Q?pdcMdr1J5Cf0WBivndnh99/O6AzIF1pNiq/UW30oum4f8iGZRtMe7vziJ4YX?= =?us-ascii?Q?IjLEI4VbkKnnLUU9AIlRipSezmDP0WqXCQrh6RFbHS7hUTlsCNzYyxwk+3i7?= =?us-ascii?Q?MRquAEk+Im1qFj0YiDkBK1qPjhRaoi+47YJmGG1XdfyY1RLNb4h/sEsw4we0?= =?us-ascii?Q?kKtHWQ55XUMp/8W9OTtqhW5YOt68ljPSvCvXVg0oM78YnHOjrHyWcr869xio?= =?us-ascii?Q?A5JQXKeWFvbtYlGVIG3ljTYsv3lurzLIxTlW7wc64HR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wviQ/naquOxzYKixhjmI0TE614qWTNI/+x14BwhfWkX/peRlDZBz6C07piGfOV0PbcGpx/8ky60341s+4CPBuup35aT2Cy6RfneP0qaibw+gHR8RikB/n7qBe3TKuUFGTNWzriAEi1r; 5:zihdSVYbhc4bRzBio0+EO1vPyAy1NtmuLM+l8Jj50K8RbdxBH/v3x+H2kpq8fa82ICZqMECBOIRNE065m/Ku57M90zNWFbh+RysFaoff7AqGnWUsivqrgWT4xadDUUYCTDM7jShO3ILXwiRXqhS1VA==; 24:xR9LmW6gD03/1yNAW/YLqWlTKRGuyRvvCKQHh0mQzNlyMoxaZVVRslFsVTe8KZug0DJDkyGoITa2hAhiu6y64gjEBRS9FzIFaP++JnCc+YQ= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; HE1PR08MB0891; 7:HWNyG2lw4PxBNPFSfMw+F9Q890aRI7UOqFGwmNvkzuwPnQsXyKmYtT43cPY/dS8IkRK1UAjvl+kcILqWkhIUWnvafED49dsNNca3HWTzOwZinS+iWKQLBeCXi/PKnkbrD421603s+EbCQaxsUwpyJ3wyyt7HKfyMDkyUQHqptaw6pdHIph5+xEsCKP2A33mcfKRE3oDxbayo2SfMovPSjTr8Xh2Ea70etHH/GG1evO+q0Dt9yKvtSa14vTtYnZyD5r6EaUyw6rFVm6joLWvQrvABzbC+P0S7kwLujkTvpxkify4+DrjAVRmfqEkobdQM54u8DH/5XqR+Z4LPq4tAJ2q4d7RJmwbSuPVCxQnbJw7UJ5S3PfofWihTmrYE0/jP27mEvX3raUCOCPFl3qAzEYjtJ5FLiuzRRBY7Iz0M2wkI6NczhB2EyZDtpzW5b6ZKtSpqfxGyw1OK86/g6L5puw== X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jan 2017 15:42:30.4116 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR08MB0891 Cc: Liviu Dudau , LKML , Mali DP Maintainers , nd@arm.com 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 The reset hook needs to allocate space for a malidp_plane_state, which is larger than drm_plane_state. Otherwise, the hook is identical to the default one. Signed-off-by: Mihail Atanassov Acked-by: Liviu Dudau --- drivers/gpu/drm/arm/malidp_planes.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/arm/malidp_planes.c b/drivers/gpu/drm/arm/malidp_planes.c index eff2fe4..686ff86 100644 --- a/drivers/gpu/drm/arm/malidp_planes.c +++ b/drivers/gpu/drm/arm/malidp_planes.c @@ -58,6 +58,27 @@ static void malidp_de_plane_destroy(struct drm_plane *plane) devm_kfree(plane->dev->dev, mp); } +/* + * Replicate what the default ->reset hook does: free the state pointer and + * allocate a new empty object. We just need enough space to store + * a malidp_plane_state instead of a drm_plane_state. + */ +static void malidp_plane_reset(struct drm_plane *plane) +{ + struct malidp_plane_state *state = to_malidp_plane_state(plane->state); + + if (state) + __drm_atomic_helper_plane_destroy_state(&state->base); + kfree(state); + plane->state = NULL; + state = kzalloc(sizeof(*state), GFP_KERNEL); + if (state) { + state->base.plane = plane; + state->base.rotation = DRM_ROTATE_0; + plane->state = &state->base; + } +} + static struct drm_plane_state *malidp_duplicate_plane_state(struct drm_plane *plane) { @@ -92,7 +113,7 @@ static void malidp_destroy_plane_state(struct drm_plane *plane, .disable_plane = drm_atomic_helper_disable_plane, .set_property = drm_atomic_helper_plane_set_property, .destroy = malidp_de_plane_destroy, - .reset = drm_atomic_helper_plane_reset, + .reset = malidp_plane_reset, .atomic_duplicate_state = malidp_duplicate_plane_state, .atomic_destroy_state = malidp_destroy_plane_state, };