From patchwork Wed Feb 1 14:48:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mihail Atanassov X-Patchwork-Id: 9549887 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 0176A60424 for ; Wed, 1 Feb 2017 14:49:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E85BA283E8 for ; Wed, 1 Feb 2017 14:49:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DD38528435; Wed, 1 Feb 2017 14:49:05 +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 6A0C5283E8 for ; Wed, 1 Feb 2017 14:49:05 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BE4C16E800; Wed, 1 Feb 2017 14:49:01 +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-db5eur01on0047.outbound.protection.outlook.com [104.47.2.47]) by gabe.freedesktop.org (Postfix) with ESMTPS id B059B6E7F8 for ; Wed, 1 Feb 2017 14:48:59 +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=W+W48/e/TC/1hhv87Y2yzNeen8DbthQ+AEFipqW6Tc8=; b=XwfLnrv4i+Z9gWs5/nmUSZYrV6CgbgZFpm5xVe4N33ZCUjRcj2TVU+HJ18QxjyExNJwOJoC255Bci+CHobkpxk3JH3Q++NvuITZeJFXgb5B7gMPrn4hkvkSdRcwRUTduFGdcHk0aYnT6jSAEArzKO+/VPl9gvQMd7pCtPGJhBho= 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 AM4PR08MB0884.eurprd08.prod.outlook.com (10.164.83.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.860.13; Wed, 1 Feb 2017 14:48:55 +0000 From: Mihail Atanassov To: Subject: [PATCH v2 1/2] drm: mali-dp: add malidp_crtc_state struct Date: Wed, 1 Feb 2017 14:48:49 +0000 Message-ID: <1485960530-22728-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: HE1PR0701CA0046.eurprd07.prod.outlook.com (10.168.191.14) To AM4PR08MB0884.eurprd08.prod.outlook.com (10.164.83.30) X-MS-Office365-Filtering-Correlation-Id: cf50f56f-4ec6-4cc0-da73-08d44ab17292 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(48565401081); SRVR:AM4PR08MB0884; X-Microsoft-Exchange-Diagnostics: 1; AM4PR08MB0884; 3:HZI3imJXNcYfHDgf45NAHG63nYX6n1RO/e9yuDjSdfRH2d0Mpo/6yYoBWu2v3LwAyy21JcNk+sVcLQzU5EHOulPJK0KXxN9PjDg7BRdQ5ZaXg1PdXmOhS1QiBc0gf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ntSeDLlgJPvESBx57HBYUiiJbgrY8NXhfuuty5Fgq+8YHmsTnXlscSuHTzLJwn69vILvxdzKrHA74= 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)(5005006)(8121501046)(10201501046)(3002001)(6055026)(6041248)(20161123562025)(20161123564025)(20161123555025)(20161123560025)(20161123558025)(6072148); SRVR:AM4PR08MB0884; BCL:0; PCL:0; RULEID:; SRVR:AM4PR08MB0884; X-Microsoft-Exchange-Diagnostics: 1; AM4PR08MB0884; 4:EF8DOrC2izpR/6E/eIurVctqSGY/B0N2U/Bc7HuqiKYZ3sdrzXjMEiY+zD7UIqNGGqXr9l9K7oDm9U5oF7Wj67xx2LO5w69p2kuW91uUfFs8YdnJ95vb5ahvmd2XqGj6xZPHAe17XtHbVUKdmMC+4DIUZIULInQWMGFCY28oBlRfAtgVHEkQBeXSZtQuKpWhj9ZrJPuU+u2q3TXsT6Px0mRzeKoeY4BS84zW+5Y4JiPBKpkJzYZudAcmSxwsc8Mb3jqV/4e9NfSl5Ljr9SNVbiVS3iX4+fkJBjMOIkqWfhoeWS2IKI4/6l4sEQ5T1tuHjNEokF3teFPLpFT6iDIUYnpwyEG3t/oA7xXtqtL7TlfYkmlvm5GfOWi8MPhpdogRiMYlnp4hbCGfsjc+vXZ5apm9tpdd9O9C0CbaIVubqwEDOCFLrs76pYDzUnLarj6zV5inxY0JMSL88cvt8c9aeyL/4uvaqWSDLgnrxPehnVoUIy39nCApGkhrh64C4LZh5AHyMt4I44jOcKllTChTV/yhx3/75Pk/Y6nHmMLJxh+0u4smWbl8yZ+3rZG0UkSjMG41RQQRWojJtdOZLre8Fmc64Os7DwM5gW3DXhgi6xRr24Lv1LfFyeIVnbepwF2H3epJN3kmOzkGD6KF7cOQlNxjvPJaI8r3W4zuoiGcmcg= X-Forefront-PRVS: 0205EDCD76 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(7916002)(39450400003)(39840400002)(39860400002)(39410400002)(39850400002)(189002)(199003)(189998001)(97736004)(2906002)(38730400001)(5660300001)(50466002)(6486002)(4326007)(7736002)(50986999)(50226002)(54906002)(47776003)(5003940100001)(305945005)(92566002)(6306002)(66066001)(110136003)(6666003)(33646002)(81166006)(6116002)(105586002)(3846002)(101416001)(42186005)(2351001)(36756003)(106356001)(81156014)(6916009)(25786008)(86362001)(68736007)(8676002)(48376002)(53936002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM4PR08MB0884; 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; AM4PR08MB0884; 23:dvyqKHQHO8ixeGJXHw/INKnpQMivAeSMidxxuipam?= =?us-ascii?Q?eyi4elAYb85XsMNwGc3gVSPfRCYF7PApuUeWp2ZgvdBKHmMDyXSUVNAgiu8z?= =?us-ascii?Q?XkqEFXKTLgZ2eoxEmTwB/W6TpqmSL6xjXbNv1gY2D2ri15N+oMd3xBCoGg8B?= =?us-ascii?Q?h55A/p8Ve61PFn+wNtGHml8KGpZ1gXTbmusfsCWbt4E9sQr/oxJsBdZKQSll?= =?us-ascii?Q?/cTCBGR47jT55KPF5fkWhI1I7V80W7NoTRwiXjloR8xjhme8x5bfW0v0eUz1?= =?us-ascii?Q?Pq08W2iC2LzBU2LSdRkjmln21iRX1UmRBgA5EmkBdXg0tKQz6krNq1+rWwRB?= =?us-ascii?Q?rmwibxVEIbrnIB+zIz+OjAQFZ+ekCqEeuW8fsFcuJ0L4u7Z3N4ybi3cGzpKo?= =?us-ascii?Q?ZHj8WXUvuPbEtbulurNlaubkwXq6Gw6JyBUarwMW0P1h5oMRuVJ41bpRCAmV?= =?us-ascii?Q?NxTdVUj4x3vDur+oyCn9L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Ax3oysci70zuxvZcoZ/nW1ywt/DUpQ04mpewqlvhiBKK5vgCW8Acbi85NXK05RFKu5TPcglwX8fYbPAf52IdlEcY5WUAd1wkqBffwXMDYbgeiXUGiyIm493MQd0sJNo0CTO1RtbihZ/mk9xf2zV2BhiSWLO3GeQEmSpWZgRXG+3WucSsM6J X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Feb 2017 14:48:55.0990 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR08MB0884 Cc: Liviu Dudau , linux-kernel@vger.kernel.org, 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 Add a custom CRTC state struct to enable storing driver-private per-CRTC state. This patch only adds the base drm_crtc_state struct. Signed-off-by: Mihail Atanassov Reviewed-by: Brian Starkey --- Link to v1: https://lkml.org/lkml/2017/2/1/203 Changes since v1: - Moved unused variable to patch 2/2, where it is used. drivers/gpu/drm/arm/malidp_crtc.c | 37 +++++++++++++++++++++++++++++++++++-- drivers/gpu/drm/arm/malidp_drv.h | 6 ++++++ 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/arm/malidp_crtc.c b/drivers/gpu/drm/arm/malidp_crtc.c index 08e6a71..ebf57e6 100644 --- a/drivers/gpu/drm/arm/malidp_crtc.c +++ b/drivers/gpu/drm/arm/malidp_crtc.c @@ -160,6 +160,39 @@ static int malidp_crtc_atomic_check(struct drm_crtc *crtc, return 0; } +static struct drm_crtc_state *malidp_crtc_duplicate_state(struct drm_crtc *crtc) +{ + struct malidp_crtc_state *state; + + if (WARN_ON(!crtc->state)) + return NULL; + + state = kmalloc(sizeof(*state), GFP_KERNEL); + if (!state) + return NULL; + + __drm_atomic_helper_crtc_duplicate_state(crtc, &state->base); + + return &state->base; +} + +static void malidp_crtc_reset(struct drm_crtc *crtc) +{ + struct malidp_crtc_state *cs = (crtc->state) ? + to_malidp_crtc_state(crtc->state) : NULL; + + if (crtc->state) + __drm_atomic_helper_crtc_destroy_state(crtc->state); + + kfree(cs); + cs = kzalloc(sizeof(*cs), GFP_KERNEL); + if (!cs) + return; + + crtc->state = &cs->base; + crtc->state->crtc = crtc; +} + static const struct drm_crtc_helper_funcs malidp_crtc_helper_funcs = { .mode_fixup = malidp_crtc_mode_fixup, .enable = malidp_crtc_enable, @@ -171,8 +204,8 @@ static int malidp_crtc_atomic_check(struct drm_crtc *crtc, .destroy = drm_crtc_cleanup, .set_config = drm_atomic_helper_set_config, .page_flip = drm_atomic_helper_page_flip, - .reset = drm_atomic_helper_crtc_reset, - .atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state, + .reset = malidp_crtc_reset, + .atomic_duplicate_state = malidp_crtc_duplicate_state, .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state, }; diff --git a/drivers/gpu/drm/arm/malidp_drv.h b/drivers/gpu/drm/arm/malidp_drv.h index 9fc8a2e..c7a69ae 100644 --- a/drivers/gpu/drm/arm/malidp_drv.h +++ b/drivers/gpu/drm/arm/malidp_drv.h @@ -47,6 +47,12 @@ struct malidp_plane_state { #define to_malidp_plane(x) container_of(x, struct malidp_plane, base) #define to_malidp_plane_state(x) container_of(x, struct malidp_plane_state, base) +struct malidp_crtc_state { + struct drm_crtc_state base; +}; + +#define to_malidp_crtc_state(x) container_of(x, struct malidp_crtc_state, base) + int malidp_de_planes_init(struct drm_device *drm); void malidp_de_planes_destroy(struct drm_device *drm); int malidp_crtc_init(struct drm_device *drm);