From patchwork Mon Dec 24 09:26:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Qian Wang X-Patchwork-Id: 10742147 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 ADDD313AD for ; Mon, 24 Dec 2018 09:26:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9B45E26E96 for ; Mon, 24 Dec 2018 09:26:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8EB5328F33; Mon, 24 Dec 2018 09:26:47 +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 3A84126E96 for ; Mon, 24 Dec 2018 09:26:47 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5E9EA6E558; Mon, 24 Dec 2018 09:26:46 +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-eopbgr150052.outbound.protection.outlook.com [40.107.15.52]) by gabe.freedesktop.org (Postfix) with ESMTPS id C59F96E558 for ; Mon, 24 Dec 2018 09:26:44 +0000 (UTC) Received: from AM3PR08MB0611.eurprd08.prod.outlook.com (10.163.188.149) by AM3PR08MB0262.eurprd08.prod.outlook.com (10.161.35.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1446.23; Mon, 24 Dec 2018 09:26:42 +0000 Received: from AM3PR08MB0611.eurprd08.prod.outlook.com ([fe80::3c73:534c:9c6e:352d]) by AM3PR08MB0611.eurprd08.prod.outlook.com ([fe80::3c73:534c:9c6e:352d%2]) with mapi id 15.20.1446.026; Mon, 24 Dec 2018 09:26:42 +0000 From: "james qian wang (Arm Technology China)" To: Liviu Dudau Subject: [PATCH 08/11] drm/komeda: Add komeda_crtc_funcs Thread-Topic: [PATCH 08/11] drm/komeda: Add komeda_crtc_funcs Thread-Index: AQHUm2rHxJ/QoI5+q0mpQIwQisN8JA== Date: Mon, 24 Dec 2018 09:26:42 +0000 Message-ID: <20181224092435.2792-9-james.qian.wang@arm.com> References: <20181224092435.2792-1-james.qian.wang@arm.com> In-Reply-To: <20181224092435.2792-1-james.qian.wang@arm.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [113.29.88.7] x-clientproxiedby: SYXPR01CA0099.ausprd01.prod.outlook.com (2603:10c6:0:2e::32) To AM3PR08MB0611.eurprd08.prod.outlook.com (2a01:111:e400:c408::21) x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM3PR08MB0262; 6:AdEefwiqoWQwuBy+hM0/MSzAi8eFzVyPIfnaN8bRr/REZFma+LrvNgZ/a3azM7k8U8IUUqFkxCXN5UIwfn9oeTUmWpqcjHl9FLMUs/lDXbYjH/buyPd9IsMIb52vrendPetmecdGOKIphVpLfgnGrUzdnD3BLracnETy1l7a7ae/JmKKh552YVWzhbdzjbqOhgziO21sx7SJwlS6NZrjcP4GhwKe5NaF7rlNCLZQqQ/Ze3Zx9dibIW2kNqsbDljRr6zufmK6p519/NoPIHmZR018q0BWT+cWkVBvPq3EBSvJlv4YwgYXD7knrVfn9uGZL1JwNTX0NyPy6++Ra6BOYFngW2PIPy8HoIelNmYKz8n3XPlQOplabLSxA4pyeHnHdvAqlst/0PN7r9Gf8re9SEVHXohBUORu4l2qHg5eiKVBtR7dnjzBa3ofYKkUN4fIDBLUZvBdyI96g/pGLCegRw==; 5:pxpeSRjNdk/9HOeKFT2pHJxWHdt3qRRU3SWNxTRSsIRdQVEfl5UdDNFnhsQuTyYmo9RW/eCqLpR6LAwsAZIX1AfSMDSNvVWr4GOf40u+I1dduqlSslqPmeF9+4+dxbfxKUKEejNixogihTa0VJfvpl+9jELNF9aSQxakk11fJZU=; 7:h9nYHelNhJZoZCEemqCXRSFlOejkKER+CjWbhWoZUsS9NTVCA2ER+xZ0lfGpoc4G/lFgAZGFyjiO+TCraH2jvJRoS1T4rMuJ3d9YyxjukeQ/wa8zg8xvvBjaSeIBzKiPIMAlfvU+ZoOhc3bWGYSEaw== x-ms-office365-filtering-correlation-id: 3e3498b3-43e2-432c-768f-08d66981ea2b x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:AM3PR08MB0262; x-ms-traffictypediagnostic: AM3PR08MB0262: nodisclaimer: True x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(3230021)(908002)(999002)(5005026)(6040522)(2401047)(8121501046)(10201501046)(3231475)(944501520)(52105112)(3002001)(93006095)(93001095)(6055026)(6041310)(20161123560045)(20161123562045)(20161123564045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991095); SRVR:AM3PR08MB0262; BCL:0; PCL:0; RULEID:; SRVR:AM3PR08MB0262; x-forefront-prvs: 0896BFCE6C x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(396003)(366004)(136003)(376002)(39850400004)(346002)(199004)(189003)(4326008)(256004)(305945005)(53936002)(6862004)(71190400001)(71200400001)(486006)(7736002)(97736004)(446003)(2906002)(52116002)(6116002)(76176011)(1076003)(6436002)(86362001)(6512007)(5660300001)(11346002)(186003)(26005)(68736007)(3846002)(2616005)(476003)(55236004)(386003)(102836004)(6506007)(25786009)(103116003)(14454004)(105586002)(99286004)(54906003)(37006003)(6486002)(106356001)(316002)(8676002)(81166006)(81156014)(8936002)(6636002)(36756003)(478600001)(66066001); DIR:OUT; SFP:1101; SCL:1; SRVR:AM3PR08MB0262; H:AM3PR08MB0611.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: A0k1O/KRk+5SqXUkZuq1Y2akb6FPU2gqCN/Y9oicpNtSuMX2RgEjy7yxDiJm9dYfhYnrTD5pVMKgwoqQAE4FhUN2CYgE4QIiinuiGp+0u9CkMDorzSqv+2eyr5rgY2Z5QOZQK8ohiKk22y2uzpszA96K8FLRTYgQKpAAIaZwNEcsvP5oHCeG5xrMHlaIgW5l6qdCW/VIy3sHBQaBcIpUuGrwO8rXGuhBw2u3ouhZzLALR0Y/Ifh3YMyAHuw/uW3BDBdAGddAvLIqFxg+mfk2OxB/Pb8UAEnIPCCz6F/uj4lLWjev22/ykrGy20V2sNtI spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3e3498b3-43e2-432c-768f-08d66981ea2b X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Dec 2018 09:26:42.3691 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM3PR08MB0262 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: nd , Ayan Halder , "Tiannan Zhu \(Arm Technology China\)" , "airlied@linux.ie" , "Jonathan Chai \(Arm Technology China\)" , Alexandru-Cosmin Gheorghe , "linux-kernel@vger.kernel.org" , "dri-devel@lists.freedesktop.org" , "Julien Yin \(Arm Technology China\)" , "yamada.masahiro@socionext.com" , "james qian wang \(Arm Technology China\)" , "malidp@foss.arm.com" , "Yiqi Kang \(Arm Technology China\)" , "maxime.ripard@bootlin.com" , "thomas Sun \(Arm Technology China\)" , "Jin Gao \(Arm Technology China\)" , "Lowry Li \(Arm Technology China\)" , "sean@poorly.run" Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Added functions: - komeda_crtc_reset - komeda_crtc_vblank_enable - komeda_crtc_vblank_disable Signed-off-by: James (Qian) Wang --- .../gpu/drm/arm/display/komeda/komeda_crtc.c | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c b/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c index 6d9fb4626ba5..cc7f67fb08fd 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c @@ -347,6 +347,47 @@ struct drm_crtc_helper_funcs komeda_crtc_helper_funcs = { .mode_fixup = komeda_crtc_mode_fixup, }; +static void komeda_crtc_reset(struct drm_crtc *crtc) +{ + struct komeda_crtc_state *state; + + if (crtc->state) + __drm_atomic_helper_crtc_destroy_state(crtc->state); + + kfree(to_kcrtc_st(crtc->state)); + crtc->state = NULL; + + state = kzalloc(sizeof(*state), GFP_KERNEL); + if (state) { + crtc->state = &state->base; + crtc->state->crtc = crtc; + } +} + +static struct drm_crtc_state * +komeda_crtc_atomic_duplicate_state(struct drm_crtc *crtc) +{ + struct komeda_crtc_state *old = to_kcrtc_st(crtc->state); + struct komeda_crtc_state *new; + + new = kzalloc(sizeof(*new), GFP_KERNEL); + if (!new) + return NULL; + + __drm_atomic_helper_crtc_duplicate_state(crtc, &new->base); + + new->affected_pipes = old->active_pipes; + + return &new->base; +} + +static void komeda_crtc_atomic_destroy_state(struct drm_crtc *crtc, + struct drm_crtc_state *state) +{ + __drm_atomic_helper_crtc_destroy_state(state); + kfree(to_kcrtc_st(state)); +} + static int komeda_crtc_vblank_enable(struct drm_crtc *crtc) { struct komeda_dev *mdev = crtc->dev->dev_private; @@ -365,6 +406,13 @@ static void komeda_crtc_vblank_disable(struct drm_crtc *crtc) } static const struct drm_crtc_funcs komeda_crtc_funcs = { + .gamma_set = drm_atomic_helper_legacy_gamma_set, + .destroy = drm_crtc_cleanup, + .set_config = drm_atomic_helper_set_config, + .page_flip = drm_atomic_helper_page_flip, + .reset = komeda_crtc_reset, + .atomic_duplicate_state = komeda_crtc_atomic_duplicate_state, + .atomic_destroy_state = komeda_crtc_atomic_destroy_state, .enable_vblank = komeda_crtc_vblank_enable, .disable_vblank = komeda_crtc_vblank_disable, };