From patchwork Tue Feb 7 16:49:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mihail Atanassov X-Patchwork-Id: 9560647 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 3C9D960434 for ; Tue, 7 Feb 2017 16:49:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2F51528426 for ; Tue, 7 Feb 2017 16:49:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 23F4628425; Tue, 7 Feb 2017 16:49:58 +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 BA07628425 for ; Tue, 7 Feb 2017 16:49:57 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 09A9B6E031; Tue, 7 Feb 2017 16:49:54 +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-db5eur01on0087.outbound.protection.outlook.com [104.47.2.87]) by gabe.freedesktop.org (Postfix) with ESMTPS id F2A1289B67 for ; Tue, 7 Feb 2017 16:49:51 +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=E7mHMQcW7K7WhwYFUNJUyp05JryJj79Dd95KNO0TlgU=; b=DkvwvkOSO/CQUVmlLLKvkzNb4R46Hj4GYvOR79qmFJVZ5x/6gja2jdNmEqvDFCxc/aAlETxSIQ7/a93qGcc43q6zxVSuCv6r7Q1sIqxbd8Hu5iPrX4bK9241GbDvk+2Wj9ga/REPBGMWyV4qJcho0hiLLPn/aT99rGUPhQ5nby0= 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.888.16; Tue, 7 Feb 2017 16:49:48 +0000 From: Mihail Atanassov To: Subject: [PATCH v3 1/2] drm: mali-dp: add malidp_crtc_state struct Date: Tue, 7 Feb 2017 16:49:45 +0000 Message-ID: <1486486186-29545-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: DB5PR08CA0029.eurprd08.prod.outlook.com (10.163.102.167) To AM4PR08MB0884.eurprd08.prod.outlook.com (10.164.83.30) X-MS-Office365-Filtering-Correlation-Id: 96fe62ef-9a6e-4ec6-3761-08d44f79544f 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:hUxnxBJMNBaXX4Efebl0hxAIlwEqfz5UmBam/Azhc0PReIucRGig3WwEpvdYLl4jD9NTcyYtyc9FUzfi3cifmkTyTWgkUiNBacivzl90ZOCL3mvYOdmPCCaOXNtYHlLuktQhUk9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fTA7UlpNJPs6DqZ3zR1o9Tq0XDQiv70sQngfIaFX+kYjCOUI= 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)(2017020603029)(20170203043)(8121501046)(3002001)(10201501046)(6055026)(6041248)(20161123558025)(20161123564025)(20161123560025)(20161123555025)(20161123562025)(6072148); SRVR:AM4PR08MB0884; BCL:0; PCL:0; RULEID:; SRVR:AM4PR08MB0884; X-Microsoft-Exchange-Diagnostics: 1; AM4PR08MB0884; 4:ZIQqHSVcIo1aiO+7MdKzGR21ZkhoAb+X9pduedPNk0Y0iyD/117yx+d3sOUyfLZJQvK5zFLix+ehvJh97q460N0MhmSRBFVqDvzmVJ3PCgJONkmAxmJVI47PMHSTfDS/YfFWqZyOHP1klfNSB+5is/POsqeP6YAta8RVyt8k9k0/rMc3jI6tUivkezO/qo7Ipp5D2G5XElpXOh8ibn9RQU+Baq7YkF3oLG2Ju1pwLRdeEj9tnm3Qxhx1dIgG3QQqIHc1LZ80d7q9X4NnHo8f8IULpKCTp1RlvAtyCOD0blxyPo1+0cHyvp/+atIzElj492/PUp1eWBrxTl1zBcd262m8p9AfVEEAfkrgrHmoP5JoYVEn0oag+pTCU71BcJX6+1kdlN8vYLLRxQM6/4iEDeLaIn4CXe5jLgCtUML8xmqv9yolgYUY1FN53Zs0LpNCnYPkPJHgAMOMFhof2oi529z8+92Gij0C73gp5MtULjeVKnLxAFXjtuOEK7GIL3IQ2ghMNccrC8wBmP6aq49sTKuwmA/8v8W8hPiLe45TnxnieRD2ng+bcNccxrDdZIyDT45mcIlbKhqFWO3aX3A+dkFfe/W73HNw7/8MHxg23mYjQu3hqUDKqfHlOoFANom7XulQSxzvMsXZPZEAQB8qohlFP10ZiK/LzCi97RiA8ys2q1v2ob06C4Lib30L181y2Vqcx8F2LUgvlwN/00pZF6vkG3Inex9zBUZkYHXB7y8= X-Forefront-PRVS: 0211965D06 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(7916002)(39850400002)(39840400002)(39860400002)(39450400003)(39410400002)(199003)(189002)(25786008)(66066001)(50466002)(6486002)(86362001)(101416001)(47776003)(50986999)(54906002)(36756003)(53936002)(68736007)(50226002)(106356001)(48376002)(110136004)(105586002)(2351001)(6306002)(42186005)(8676002)(92566002)(4326007)(81156014)(6916009)(38730400002)(6666003)(81166006)(189998001)(305945005)(3846002)(6116002)(7736002)(5003940100001)(33646002)(2906002)(97736004)(5660300001); DIR:OUT; SFP:1101; SCL:1; SRVR:AM4PR08MB0884; H:e110433-lin.cambridge.arm.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX: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:Xsq8P8JQhfUFfg5nHiQ9ACC5CHinsqeZh4z/T/ueq?= =?us-ascii?Q?J+cPYDuHsiiVppG0TbpV9IyOXI3uIrFwUWh/NyKsBrJEIpequXJwrUyCHZ6A?= =?us-ascii?Q?reRszyskgEBMbsgE4srJ13J03ix1Y6eBAdh7LdC6u9uyNwgzHwKinuYvM+6i?= =?us-ascii?Q?wPixuHxmrHPKkry19u1TXIQsTlchd8hfv8BjG8VkcJa2o8xJsGN+5T2oFGmo?= =?us-ascii?Q?uonI4OHLS/BIPpJ0+A3FadbcdE4ChY5x1FOF0TpqMDpPFb5qgXNi13Mp5232?= =?us-ascii?Q?Eimp6ELrAKoZ6KRQ3zCwG00LNMNHs2YcJCiiLRY4W/ttT+YMJH76vWm6GjDk?= =?us-ascii?Q?VIxL7zOhjfztd9C+M6KZIi0AeZx3KBBcRU78m4/fFeZnl4nJL/P1O6IO92LP?= =?us-ascii?Q?U2oSjH9NYQhkkOJAThMBaw0gCFvI1YhybGKKaTKLDRlDJGMZk9H/P82Zrt16?= =?us-ascii?Q?cZcwLfx3SkqxTfW/ObYUv116cvFTEEZOG9fgjeAn7lAxc4L80AxFybYBXkv+?= =?us-ascii?Q?kK87H8NhpNZwGUuXFX3fOm+WvrEwnInk9J3QrnaPuw8HROBwzJ235FpieFVE?= =?us-ascii?Q?49EV0I4Mq63TBXzH0gXLw0ijUoqOcrXDURBfQV5JfC1hdSSFLBbTQVbEB5Q3?= =?us-ascii?Q?5AWXtGi4VYt52Lqth4/Oaln+HVwMYvwKcTKu3SK08EFSLCvuAxDA+YbNOsn+?= =?us-ascii?Q?euV88RifblFJ0bZyXti0EkHtZyOJ7/WDleBZT7vKfsLNfEHEhWlr0x7nZEz+?= =?us-ascii?Q?sT60tlWzo/p5wrFm+xNVdimqy3nuCw/kM8nsNDREBDN882i5TsNqqF5sCvSh?= =?us-ascii?Q?rtKC8umKn0SesvhWjxTLEF0PTkq264uwpvIiJSenG0LisrkBoN5sz7YeudZF?= =?us-ascii?Q?aTWtj7b8ZP7ujZjzx4U31pDP4/xr5san8A5Jo6BsALaKI3Of11cVAj3zMceX?= =?us-ascii?Q?3uue2low7yo/4GGyName50YvRjjVeg6hYJDku+Wru5nGJ/xUiocqlXNvX0rf?= =?us-ascii?Q?zkHQsQzFmgICcLt0+YfWkCAomT+Zzh2iZnc3jV5ArrQyIyh/fRsWkKuxlXs8?= =?us-ascii?Q?upfSuKb0KGp4UJdEp1WtAOX5lfYDm8Kttt0mD54J/Kszj9hMTo8MDB6rQK+T?= =?us-ascii?Q?pKdO9fuVZii9aB1m2BfFaUnW0+BnqX8G62Q3aBdkpc4idzeW2Cs8ytKrIt4U?= =?us-ascii?Q?cYZRnGVrFxcpdw=3D?= X-Microsoft-Exchange-Diagnostics: 1; AM4PR08MB0884; 6:e9NnAx4eIU4aVz8wfik8/1UiEwT/wH/2B8jXXSPHBqdKsbVGXA5KlxTer/wTrkrfNUEgJoNzoV9+xCSt9B1QYbf8y9ji72faShUtS9t4D8f3gVUVsSGwRDNdSMmJynvH7opRq2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QxBf72NEIrnniIcQ+mJsoJzTTvE6pWZJ7oDLfyfwG9H8osOujWmdeAPO24WzUP2+3UoRyfeXgBz5iSaPAlxiX/TAX+ZdyDV6grg6gvAkVRFZQg== X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Feb 2017 16:49:48.6447 (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 Acked-by: Liviu Dudau --- Link to v2: https://lkml.org/lkml/2017/2/1/378 Link to v1: https://lkml.org/lkml/2017/2/1/203 Changes since v2: - rebased and fixed conflicts - s/MALIDP_DISP_FUNC_GAM/MALIDP_DISP_FUNC_GAMMA/g - added MALIDP_GAMMA_LUT_SIZE #define + s/4096/MALIDP_GAMMA_LUT_SIZE/g in malidp_crtc.c - improved readability in a few places 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 dbc617c..558f4bf 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);