From patchwork Fri Jul 20 21:15:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru-Cosmin Gheorghe X-Patchwork-Id: 10538363 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 8BCC56053F for ; Fri, 20 Jul 2018 21:16:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7AC86297DB for ; Fri, 20 Jul 2018 21:16:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6EA2E2980F; Fri, 20 Jul 2018 21:16:35 +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=BAD_ENC_HEADER,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 10FD8297DB for ; Fri, 20 Jul 2018 21:16:35 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id F0C626F0BD; Fri, 20 Jul 2018 21:16:33 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20072.outbound.protection.outlook.com [40.107.2.72]) by gabe.freedesktop.org (Postfix) with ESMTPS id 688706F0BD for ; Fri, 20 Jul 2018 21:16:31 +0000 (UTC) Received: from e114479-lin.cambridge.arm.com (217.140.96.140) by VI1PR0802MB2557.eurprd08.prod.outlook.com (2603:10a6:800:ae::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.973.21; Fri, 20 Jul 2018 21:16:26 +0000 From: Alexandru Gheorghe To: seanpaul@chromium.org, airlied@linux.ie, dri-devel@lists.freedesktop.org, liviu.dudau@arm.com, brian.starkey@arm.com, malidp@foss.arm.com, ville.syrjala@linux.intel.com, daniel@ffwll.ch, gustavo@padovan.org, maarten.lankhorst@linux.intel.com, alexander.deucher@amd.com, christian.koenig@amd.com, David1.Zhou@amd.com, harry.wentland@amd.com, andrey.grodzovsky@amd.com, Tony.Cheng@amd.com, sunpeng.li@amd.com, shirish.s@amd.com, boris.brezillon@bootlin.com, nicolas.ferre@microchip.com, alexandre.belloni@bootlin.com, inki.dae@samsung.com, jy0922.shim@samsung.com, sw0312.kim@samsung.com, kyungmin.park@samsung.com, kgene@kernel.org, krzk@kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, p.zabel@pengutronix.de, laurent.pinchart@ideasonboard.com, maxime.ripard@bootlin.com, wens@csie.org, eric@anholt.net, linux-graphics-maintainer@vmware.com, syeh@vmware.com, thellstrom@vmware.com Subject: [PATCH 01/10] drm/atomic: Add __drm_atomic_helper_plane_reset Date: Fri, 20 Jul 2018 22:15:00 +0100 Message-Id: <20180720211509.23605-2-alexandru-cosmin.gheorghe@arm.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180720211509.23605-1-alexandru-cosmin.gheorghe@arm.com> References: <20180713161407.GQ20303@art_vandelay> <20180720211509.23605-1-alexandru-cosmin.gheorghe@arm.com> MIME-Version: 1.0 X-Originating-IP: [217.140.96.140] X-ClientProxiedBy: VI1PR0601CA0017.eurprd06.prod.outlook.com (2603:10a6:800:1e::27) To VI1PR0802MB2557.eurprd08.prod.outlook.com (2603:10a6:800:ae::7) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: aee7e68e-7398-403c-ca31-08d5ee860e6a X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600067)(711020)(4618075)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(7193020); SRVR:VI1PR0802MB2557; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0802MB2557; 3:HKRWGE6n7KBDVdt8mLxU48hDStIKM2Pw5WlLwB5cOtwmmFG6m6BwGaSYqWbqTfXuixWcui+9O7G95ux0cKVwv/TpcdYbGcP0seyWLO+4NNvixF9iCPnJc88XHiTjiv86JF1uvUpsVf6fqzoTweaSJGdacnEp5wQaKECcjhUGdENaXBA+m0mqociKWPutK9EYhXO691TmfyfIfg3unM5B5Rk9ZTo4JbZlvCO0snUUU6MaIiRTqt7if9GZ/xI/4EXe; 25:HQ/sLYVC1aUmknOMirzyEdmxAntdzHXaXhe5cnVBjax92x7w8ie0WFojTGaTGdRxsjyeJ55KuALGFvgs9mi0/n03c1ASE9FC/3UCS6dfqOqRaUXDjVGL6YFWoXbSaUb3tS2oApcWxsFVEXZtvy/+LFhqqpGS+QN5/n0SPsWEsJEekV3VK2hdnLpWDiLDXGp5H4ETRUkGR8JzhLRkCtrsnfXkPOtm9NixXek9OH6IwWiidf026K2u7P7O9ImVDNCJbTIMk2LvMq1gX42t3UGdfmjfwKXPDQ3oc72ccSFtg7+4cCfgzqU9C+JDYaiI72p4Q6Ko56Sw0MmhKnO5PQMpjg==; 31:zHmx0G41SQlKaga4nCk2NUX9yyYDRgExgJuVrg0iY6u0um4WuWFUdh8KKwXVJgqtDFFT08MbuH3RFzB8nK/HB4QCJn+p6/PmhKjlEG75qJ/P3l8yagj2bCYZ8z6jkkwEeCqFd523t+xmlsK+wl+cWhiVYa9YcQgveOtLD2Fpqf/RDundhClxLnaIxta7eEsqTkpMyfKkz1PnGxR2LXv7/QUgWilBaSS+XHVygsm+5L8= X-MS-TrafficTypeDiagnostic: VI1PR0802MB2557: NoDisclaimer: True X-Microsoft-Exchange-Diagnostics: 1; VI1PR0802MB2557; 20:DX7UWQWol6nv863bK3OqQF5QwNCMpBQBTuBS/BYKhbk4t6bO0KP3OkNPq9SHCWqqxwhuZ6DLd9Ssww1k6lkd/VfJjRDcPUpMvf1qcxfzy8JdPNgjjA/NB+IVkqwyvhAqHB+ypL50PLIhXcc48DMRXaNcyx6jTL5r8f3BZUXQK95DrTE9V8ZeL6ztaEtRaUcDcMp6D3BiCXWwjrpSzzg/bUjTCpXoPoiXaSohbrZ3Y34LOjRbIeRfli47CvjOVNo1x9aIcqC/InrFB7tS6Qs02gmKcdiQzzdMJwk5c4Z0Un77tpAJ3oXuy6ebgaSsGnNFGv7qVrbjdetqu3hHDZIQ4w==; 4:j1gzJmjq4TQXu9ZGY6KvT61KsXjMPWV1GDlrScAOGQXrwAMRJxEQUEV+SV9bHJnFeK4CTR8/oE3sfvCg/CPqPiV14qoLAgQGV8TRysLl2GXIGxacKk6nA0XLCCF37WAnlXXfSEwcnLk/Ih+JHEEcpiPqeAwPfXRUuqNiy1iO5wmBJEa4ZRk5Gptqp67vUGF2ZTB28KFy+ZwWCmSJ3Cdc4fQcKrwxhFbdBud+m4zo36/eWGYZw/ZbKNm5HGtvM9hSv/saPGJ7rFuZQGWCYeX97TZNpSNaLSuPnclj7a9Nj54hw8BTRdoUsPHac6trDn+t X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(180628864354917); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3231311)(944501410)(52105095)(93006095)(93001095)(3002001)(10201501046)(6055026)(149027)(150027)(6041310)(20161123564045)(20161123560045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(6072148)(201708071742011)(7699016); SRVR:VI1PR0802MB2557; BCL:0; PCL:0; RULEID:; SRVR:VI1PR0802MB2557; X-Forefront-PRVS: 073966E86B X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(366004)(39860400002)(346002)(396003)(136003)(189003)(199004)(6116002)(316002)(305945005)(478600001)(25786009)(3846002)(53936002)(1076002)(7696005)(51416003)(52116002)(76176011)(7736002)(72206003)(4326008)(66066001)(6486002)(47776003)(68736007)(5660300001)(7416002)(7406005)(36756003)(8936002)(446003)(50226002)(50466002)(106356001)(16586007)(8676002)(81166006)(6666003)(81156014)(2906002)(48376002)(105586002)(26005)(86362001)(186003)(16526019)(97736004)(486006)(11346002)(386003)(956004)(476003)(2616005)(921003)(1121003); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR0802MB2557; H:e114479-lin.cambridge.arm.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: arm.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; VI1PR0802MB2557; 23:ubg8CBr/l3wzNa3iWv6de69VSsK0YAac5zoV9mm?= =?us-ascii?Q?kjxinqBeGzAbh3izREyy98wNJWyHDcjnJ6yxIMTueByBz0KLt49zh4AiVO/W?= =?us-ascii?Q?E/s0xAOxbq0v1axlvaSc+SkTN3z25/MgnRwfcEggaOOMXiE265c59zLjXDf8?= =?us-ascii?Q?RTVZQFJdszdePNXYVCr0Z/3bpcZy3hbwrU5bx+gip4GM31DnGocgtBMKzVcb?= =?us-ascii?Q?nLgueRjurOjcg695FAgY/CqujOqgXpb5CHTIdfoSdpRfNSr7hvPoxTh27LkK?= =?us-ascii?Q?o1riVMd8Gfyj9RoabrrXMtVsi8DteUgA16f/2zA6PzndBiis3Z+ltGVmG44E?= =?us-ascii?Q?1/kXzYi62/DWSRwFUAkwx+tJQ7D16wsQnxvrNQ+VEo4HC5j7UU/WXvB703Nu?= =?us-ascii?Q?WtP/DOYSnuLC5XxBbS/M4kwjpiRE/+cDGmlQg6oIFcIrDoW1B/jEy8QuAF4q?= =?us-ascii?Q?7d/oO1su6/nO/cUApRsTMMBB4axjFIKJEpxnhnRKlv01x0LhMG7o0hh7sNVg?= =?us-ascii?Q?xV7hkWVG3+PNYm8iMTyVPEp6PxAztbadNS6T9H/InuPjYOyVFCVFMsj0KBrn?= =?us-ascii?Q?ABhEcYVdd/vRA2cq8qhodWguwGXGF6MfvBCBWaRA7Oqen/xAjpB65ZK6Ppi1?= =?us-ascii?Q?hyRj/VVqmBK49MjM93n2hSYoYXIAopcsHHuBSIvXoPfSv2HbilzQieottGDH?= =?us-ascii?Q?XBaBaz/Ianwrcf06mN/dLONV0U+FAZceHt6PpbJJRMKP0lndYREzAhELacDl?= =?us-ascii?Q?0q3EMVyIaSxcdsDNwGJCiqpkInYS0/kmc3eXRFX2LqvKqHRpgmrHk6zMyiVu?= =?us-ascii?Q?8fA7X2P97LTz7R0jZx3x536rtF7m35fvk0bMjsl/IkS4yNs6GXdbJvN2m1GG?= =?us-ascii?Q?gkN2S9TWKlaX6R7PSPqTmspxXibQzzmMc4b+tcl/uepoFq+K1MZ8DE8SRG81?= =?us-ascii?Q?dgJG399XYALu1P9gNsr/WmrtzvjTeF4FoFb7CUC1qBjepaSDOPZX/l6Q//6j?= =?us-ascii?Q?R7x50zix5OYXZtTJs2eVYRW0GRcHvc3R0bYI/MvDeAT07QVOoci6v2zWFi7e?= =?us-ascii?Q?8QUUejHkIxMmqkmmKe3U5zamzB1PKC1XnENWiMuhexhWGip4GAn1YBfILL2N?= =?us-ascii?Q?eT7lUP15xUz5F7xwTTDRZJG9dRxUrN409QU/5KIfDvHRHe5YDLQjWjVUhEAA?= =?us-ascii?Q?y0j4/31CyoLyVS0D6iblOYixuCwQ4c4d6cYikUyJGMi0TFYyy0GDWgomfnho?= =?us-ascii?Q?OiPg9btLoDQD7FJ9NLmM=3D?= X-Microsoft-Antispam-Message-Info: gOIVZCXNVWY+LTtF+gEXgbUfB2EjkP2BKcqp1HgQSVpqhmPgij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qqlWHGE7T5WoI/0DOvDKZRCf02uwrZuoXwqHySNVofMVzHBym+psqw5F9XKkUygWPCvMAVvVpKwGBosWez+64xAvH3vWdS/h8qeaQOS0OdOIP9FJVGluD/23iZHBfW+0bNWc69KNt9DeLVKGuA4DU5mSl6IMZH6wwo4SPtF9CjNq6Wcf8id SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jul 2018 21:16:26.3951 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: aee7e68e-7398-403c-ca31-08d5ee860e6a X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0802MB2557 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@arm.com, Alexandru Gheorghe Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP There are a lot of drivers that subclass drm_plane_state, all of them duplicate the code that links toghether the plane with plane_state. On top of that, drivers that enable core properties also have to duplicate the code for initializing the properties to their default values, which in all cases are the same as the defaults from core. Signed-off-by: Alexandru Gheorghe --- drivers/gpu/drm/drm_atomic_helper.c | 32 +++++++++++++++++++++-------- include/drm/drm_atomic_helper.h | 2 ++ 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index 8008a7de2e10..e1c6f101652e 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -3507,6 +3507,28 @@ void drm_atomic_helper_crtc_destroy_state(struct drm_crtc *crtc, } EXPORT_SYMBOL(drm_atomic_helper_crtc_destroy_state); +/** + * __drm_atomic_helper_plane_reset - resets planes state to default values + * @plane: plane object + * @new_state: atomic plane state + * + * Initializes plane state to default. This is useful for drivers that subclass + * the plane state. + */ +void __drm_atomic_helper_plane_reset(struct drm_plane *plane, + struct drm_plane_state *state) +{ + if (state) { + state->plane = plane; + state->rotation = DRM_MODE_ROTATE_0; + /* Reset the alpha value to fully opaque if it matters */ + if (plane->alpha_property) + state->alpha = plane->alpha_property->values[1]; + } + plane->state = state; +} +EXPORT_SYMBOL(__drm_atomic_helper_plane_reset); + /** * drm_atomic_helper_plane_reset - default &drm_plane_funcs.reset hook for planes * @plane: drm plane @@ -3521,15 +3543,7 @@ void drm_atomic_helper_plane_reset(struct drm_plane *plane) kfree(plane->state); plane->state = kzalloc(sizeof(*plane->state), GFP_KERNEL); - - if (plane->state) { - plane->state->plane = plane; - plane->state->rotation = DRM_MODE_ROTATE_0; - - /* Reset the alpha value to fully opaque if it matters */ - if (plane->alpha_property) - plane->state->alpha = plane->alpha_property->values[1]; - } + __drm_atomic_helper_plane_reset(plane, plane->state); } EXPORT_SYMBOL(drm_atomic_helper_plane_reset); diff --git a/include/drm/drm_atomic_helper.h b/include/drm/drm_atomic_helper.h index 26aaba58d6ce..2dd40c761dfd 100644 --- a/include/drm/drm_atomic_helper.h +++ b/include/drm/drm_atomic_helper.h @@ -155,6 +155,8 @@ void __drm_atomic_helper_crtc_destroy_state(struct drm_crtc_state *state); void drm_atomic_helper_crtc_destroy_state(struct drm_crtc *crtc, struct drm_crtc_state *state); +void __drm_atomic_helper_plane_reset(struct drm_plane *plane, + struct drm_plane_state *state); void drm_atomic_helper_plane_reset(struct drm_plane *plane); void __drm_atomic_helper_plane_duplicate_state(struct drm_plane *plane, struct drm_plane_state *state);