From patchwork Wed Apr 11 15:22:23 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: 10335707 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 9816D6053B for ; Wed, 11 Apr 2018 15:24:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8A0EB2897C for ; Wed, 11 Apr 2018 15:24:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7EF3228980; Wed, 11 Apr 2018 15:24:15 +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.1 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, MAILING_LIST_MULTI, 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 10AEF2897C for ; Wed, 11 Apr 2018 15:24:15 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3C78E6E65D; Wed, 11 Apr 2018 15:23:39 +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 2DC8A6E6B2 for ; Wed, 11 Apr 2018 15:23:33 +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=0YbMj2gVl0T/lT4N7qltvN/xGbRJJULzZsjT4hp+jf0=; b=QeZdY5DWs6lEPuve0dIfc3IyXmLfi1Ul5j1NGZ0/DNmxM/gdTZgy6yIKSErSH0o13rkeTdFU0/VzcJelUGawxAWWk4yhgm8lKivqk6tBM+ebXN1bUaUOuBB7ZxG0S6o8OwyjqPVVnRvf0MuSc9gHYOb6yu6XUKcc4YsSAZtJdi0= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Alexandru-Cosmin.Gheorghe@arm.com; Received: from e114479-lin.cambridge.arm.com (217.140.96.140) by AM5PR0801MB1249.eurprd08.prod.outlook.com (2603:10a6:203:1e::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.675.10; Wed, 11 Apr 2018 15:23:31 +0000 From: Alexandru Gheorghe To: dri-devel@lists.freedesktop.org, liviu.dudau@arm.com, brian.starkey@arm.com, ayan.halder@arm.com, seanpaul@chromium.org Subject: [PATCH hwc v2 12/18] drm_hwcomposer: Add utility function to create an initialized composition Date: Wed, 11 Apr 2018 16:22:23 +0100 Message-Id: <1523460149-1740-13-git-send-email-alexandru-cosmin.gheorghe@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1523460149-1740-1-git-send-email-alexandru-cosmin.gheorghe@arm.com> References: <1523460149-1740-1-git-send-email-alexandru-cosmin.gheorghe@arm.com> MIME-Version: 1.0 X-Originating-IP: [217.140.96.140] X-ClientProxiedBy: VI1PR0701CA0066.eurprd07.prod.outlook.com (2603:10a6:800:5f::28) To AM5PR0801MB1249.eurprd08.prod.outlook.com (2603:10a6:203:1e::8) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4534165)(4627221)(201703031133081)(201702281549075)(48565401081)(2017052603328)(7153060)(7193020); SRVR:AM5PR0801MB1249; X-Microsoft-Exchange-Diagnostics: 1; AM5PR0801MB1249; 3:taqwULfV1Zq24Z+2B3IFWr0D1KITBnoK/MHf9UzBsN/OQE7VzrSJm+b7ehyT92F0mMtnl8MxDIBky8IGwxBJggmZn3/VMReGWcrw0U425OP2AEve7f10yZFKMY/f9DVxBIt1lIlTB9LSThC6nKXs3bTMy0JXiL1p/Eps4T0O3EqtMU5OxiJuu4HKTmzjV+c4UHNq8LqOPky3+nKMGJwIT+2iR7amXstFP0Q3odGu6D88vk8vsjlHLYHIn/9VqI9a; 25:g1F8JHLAa67jObHZda1L+IFlGYojc7Z3RqXuK68wB5JzLtxyc+PmsYt3vA7oWyHTzAnN8sxALH5Qe16swWV/ZYk3nkSvlj8Q6T8/QpA5Dg+bwF6u+8M8wqNLMUd/uyLBEWbWpL5CTEDt4zfS9sKPyqLtPGREjutIpfaQv5wUlUcsJAlMRKdGRSeAAFNl6MGyco4My8m5kNGgdoNkyouImshQMcsz9NP9HnAsnIyNKJG4yIGvIzJxXkew+XorYD8jQwQEC9wnxzWEpTmGqzml+zI9XsAP1kfHT4yeUV/5vuozdzkXk+9aSY+ElG2dWoIksFOjpLSWXKmKphO2/xlkuw==; 31:S/gcuVBbeB+DR6Q21s3hnZkxvcC3ON6S82kdQTeioQBhmb05zmR2+rw5TFGPCzGmZrHe8mVyVV2PgvJ5Y9h83YTeR+s3zpbv89prk182wGFsmOKly6jj4bNsWlxi+LQo3k0z2Bu3XNinmxe3hvi+Pv8pHsyfC9b9R/X8xCVJwzAHT6gdghhBld56jgQXB+xIO6/V4ebZeIP9+22bs89YwynbsUm7kJyBTwVG6OsOiuw= X-MS-TrafficTypeDiagnostic: AM5PR0801MB1249: NoDisclaimer: True X-Microsoft-Exchange-Diagnostics: 1; AM5PR0801MB1249; 20:UuVdn0p4KKD7Tv2glM3kYbwCFycfSM3/LUfQPAZbMH0kekf7EamdaYthDFPLK+EvLkL9pXlO9o3+i81Wdpnl+/0UB7wKuu87MyNLeVFvi5LM/7iJH7l2NLGctO5bL86+/EU7BcJzYHCvNPhhbc1le872tRZD66G+s5GWzGopT8k=; 4:LTov5pT84nSMrgWvexNEXXo0ryFrlmTboyesQcbflLYuC61xibCpTPmPUI2uWfcdMpw2QHsCy+FncvP4yltcQH8fN9N4+ZDKv8QpnY7vtHsvPSR1fiL36INccXiYEKGI/pWXcqfc/OSj18tshgFSiO73sjfWlZAaUh15dhrx5pf5642B3V7cOhJufSDDRox8yHm/8mnmSQ7wrg98EILdalJXjDhZRPunFZRBoSMnXfzlLYf78/ijA0yL1BnEundxDvnPGy5fz6Pf0oIzY6N9VTx/cMw7qA/zXvjqE/7TwXi1qZYnyO7Jv7rOrDtZG3F5 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(180628864354917); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3002001)(10201501046)(93006095)(93001095)(3231221)(944501327)(52105095)(6055026)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(6072148)(201708071742011); SRVR:AM5PR0801MB1249; BCL:0; PCL:0; RULEID:; SRVR:AM5PR0801MB1249; X-Forefront-PRVS: 0639027A9E X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39380400002)(346002)(396003)(376002)(366004)(39860400002)(189003)(199004)(16526019)(478600001)(305945005)(50226002)(16586007)(68736007)(7736002)(86362001)(81156014)(8676002)(316002)(81166006)(4326008)(25786009)(2906002)(50466002)(8936002)(6486002)(105586002)(48376002)(186003)(956004)(5660300001)(6666003)(72206003)(106356001)(476003)(53936002)(3846002)(76176011)(51416003)(52116002)(47776003)(7696005)(36756003)(66066001)(11346002)(446003)(386003)(97736004)(59450400001)(6116002)(2616005)(26005)(486006); DIR:OUT; SFP:1101; SCL:1; SRVR:AM5PR0801MB1249; 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; AM5PR0801MB1249; 23:Tl7hZLns2h2sKQACQGczJqJwzPXaXnj5r50imYl?= =?us-ascii?Q?jv0//QvNgy/FZSaEuVe2kixDPGGHvtqLS4ku5d2ICKQKnFirlEmdUD6IkYUW?= =?us-ascii?Q?hAXnIt6KCw1HfulLLBmkMpihpZkUxEYlY4Vyk7NV1O8LE5dvMwvYNThysnK2?= =?us-ascii?Q?xuC0LsKxSyn66NOv/RN/GaHo7xvPOqR82liUhr9r7+0B7Zm5OUH20js8ycMM?= =?us-ascii?Q?kSAahD6KcBUmJETrRFKUjcGEzhfwVic20hfyPWvwFp0frk4ixNx8GaJfRbt9?= =?us-ascii?Q?LtVua8+Nu/Eh57aTErS6ch/Ud+8F7cjKhi5OIuBQObDaf8HRb/5vKcOWPMS3?= =?us-ascii?Q?Rx0i2Qbk6sygmG5Dw6Bf/bmuOGQesz5n+Q1vkFCi+xtQi9duUcG6qW0f9VvN?= =?us-ascii?Q?pC5fIotFObhUrxcdzYVc6PZg4vyB6dw9vySAajfIFC4huU085ClMNQJb0ASp?= =?us-ascii?Q?a96SEkTqVOQhz1rZQIN0Jw3iue6bIxEnECnrVAkPwVkKP0C3Ji8F3VHs7kQF?= =?us-ascii?Q?AkIRlttCfsi/TuN/ZlJ1/WhpTRBqXL5TX9BUUAawjij5s313G676uKmbuH1g?= =?us-ascii?Q?DaVaSNjKHpK2uBoyd7hic2g6qwuu5UEM0V/2mRqgUaECkaHab/JuF8noXW0+?= =?us-ascii?Q?+uewq0Autm8ZY3D46lIYDv90mgWWCd/TVHs8hRssIcIq7cnE7hgPtdaJW3Ii?= =?us-ascii?Q?DDlJS436rbM3T2dJ2KCHxTP/k78KTOWuLrRRuTPnKkRQTWNislvCmVHjRfdM?= =?us-ascii?Q?FkzPFi4Q2uEVRk2pEMxI5UzVbej1i1ZfczJaTid6iITd31ijQQdZKNhz7hTs?= =?us-ascii?Q?zNE80LWBCmcwolUNzneZViE+GoiflJ7SwGjSaZfs/X7+87N6n9lRUN+zC/oc?= =?us-ascii?Q?YdAfgvkcatJ/t/R9W6eqGXcui2k44kXMh5mEhTGCn4RHbWuSUZDhmmDq1cKp?= =?us-ascii?Q?hqULmhblNpVNeazADtSLIsT7IU4hnJDMExuIeuY2qT5MFuQFkzRKfoJ71uKP?= =?us-ascii?Q?x6454soAeCI9mGaocKVGUQjtR5bULwJQD8lZ9Fcaq2YkLC5v+8aZlMCx4kol?= =?us-ascii?Q?XF5c5zCRC5hBroMtlC7/hnqamDKR3yd5GGvN7m5bLS0g6H+lYs++Tt85K8MQ?= =?us-ascii?Q?0g/Utv7eor5VoorOMoISG069DL+d5AENWaKTvuDQ0iK50De/S4iNmWHrVB/N?= =?us-ascii?Q?isRF9KsD0Yo3Gpr0=3D?= X-Microsoft-Antispam-Message-Info: j8UwHVwfcvoKJEgTCalE0WeiRMEC/jcvpBufOisc2xdeWQMml+Er6ADm+iCawLqLaqtxWVAWzMOUrnkxbCd3/YXqg2J6ALmfUwlSaAO0JOFbMCP/FovTgItBdq22g5mwWgb/3OlEIdq/1RF9zXkiMvVNwmGHz3f/3r8UdlbEkuFjRc1tyYGkW6oEYlAlA3yn X-Microsoft-Exchange-Diagnostics: 1; AM5PR0801MB1249; 6:RNJN7jLyBU5rQP1SZBsSux7+WGl0hrt2isxsnstHYEvy62SPFvEI5kXgei9+OBTU1G+7HT7frvFIInJejLl08NtQ5+PSOm4P8qvYGYHgiSFm7aPbANNrvPv9Y4WP8ruVVo6Ph4MwafyxPrqhWFZd8Un+hGZb7d9wyjcxFaKcP4X//U41Q7v0atg0kIa+34bp3oRexrQYA/Eh6XWJSE3+9OZrWWIZkKlW98QyDVQbkwkjIGNSjSluTWS1XhOx7LiuiLnwk+jQJDE3Vc/xzsrXxH8NNfZ1etMM9uljpPggmu/q5lQJn7eK2XRpzboqF8VN/r4AWu/F/MDBo5cLS8CBVFFqMrm0dBOcF/CuaAdtr0kPQ7GbMijivRcxTB3VBRZ4N0FAQdhYD0tRBhzt9ixRjfdIvsaxWG7JdI5QienJgh4Cv6i/uNBALBrfGC+y1ulmUZrpadEhYF9Qv5HH5ftBKA==; 5:OPyuxDtQN24JAtdiBKvxeBEC9ToH9flYY10xzN7Do5wWePOYDQ1yH5xN5XjdOxCD4kMUckVIGTu4qJKYUNi3lWs7HKUGahO0ga/ayJwJfAFOIrQG87WKX40Y7pksuwnN8kbFzmzRymFv6i4rimNHDV0OjAgtLZJ49iUmJJGJw3c=; 24:c5E+5urdHyZrOAq1RbPB+vP9G+JP1RvaD8Ez1kxFT75AQhQrtv5Nr/6z1jr+QkxDFWv+lNQemwn3bKacJnF632sLpqcYytIcoKo5oN7PodY= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; AM5PR0801MB1249; 7:5P7wCOM0qVnDxQOpBxQaMWvtzennvs/L+EpR+e9FJSBSbnkaYgHz049hduB1cKg+VEDlPhlfZe/kvMkcliv0kAjryad8qtswcLBwBLCi/fPmoQK2USZ8FlIBDk7h7lSXnXX3msC4S4im92+A2QDy4RR++dkK1oNVrUGOZdqHZJNUbMmP8J9x+Gk7/aRZE4QGUUYQE0TfvJ4IXXpOhHUFvEBKt0nPvTI0hXd4RNv24bQOZwQa6QOKE62DdSZOeiyU X-MS-Office365-Filtering-Correlation-Id: 1a65b014-f37f-4ce8-06f3-08d59fc02f5c X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Apr 2018 15:23:31.5016 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1a65b014-f37f-4ce8-06f3-08d59fc02f5c X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0801MB1249 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 is a lot of boilerplate for creating an initialized drmdisplaycomposition. This patch gathers that in a separate method. Signed-off-by: Alexandru Gheorghe --- drmdisplaycompositor.cpp | 23 +++++++++++++++++++++++ drmdisplaycompositor.h | 2 ++ 2 files changed, 25 insertions(+) diff --git a/drmdisplaycompositor.cpp b/drmdisplaycompositor.cpp index e556e86..6e5be24 100644 --- a/drmdisplaycompositor.cpp +++ b/drmdisplaycompositor.cpp @@ -221,6 +221,7 @@ int DrmDisplayCompositor::Init(DrmResources *drm, int display) { ALOGE("Failed to initialize drm compositor lock %d\n", ret); return ret; } + planner_ = Planner::CreateInstance(drm); initialized_ = true; return 0; @@ -231,6 +232,28 @@ std::unique_ptr DrmDisplayCompositor::CreateComposition() return std::unique_ptr(new DrmDisplayComposition()); } +std::unique_ptr +DrmDisplayCompositor::CreateInitializedComposition() const { + DrmCrtc *crtc = drm_->GetCrtcForDisplay(display_); + if (!crtc) { + ALOGE("Failed to find crtc for display = %d", display_); + return std::unique_ptr(); + } + std::unique_ptr comp = CreateComposition(); + std::shared_ptr importer = + drm_->resource_manager()->GetImporter(display_); + if (!importer) { + ALOGE("Failed to find resources for display = %d", display_); + return std::unique_ptr(); + } + int ret = comp->Init(drm_, crtc, importer.get(), planner_.get(), 0); + if (ret) { + ALOGE("Failed to init composition for display = %d", display_); + return std::unique_ptr(); + } + return comp; +} + std::tuple DrmDisplayCompositor::GetActiveModeResolution() { DrmConnector *connector = drm_->GetConnectorForDisplay(display_); diff --git a/drmdisplaycompositor.h b/drmdisplaycompositor.h index f1965fb..ccaffb4 100644 --- a/drmdisplaycompositor.h +++ b/drmdisplaycompositor.h @@ -87,6 +87,7 @@ class DrmDisplayCompositor { int Init(DrmResources *drm, int display); std::unique_ptr CreateComposition() const; + std::unique_ptr CreateInitializedComposition() const; int ApplyComposition(std::unique_ptr composition); int Composite(); int SquashAll(); @@ -155,6 +156,7 @@ class DrmDisplayCompositor { // we need to reset them on every Dump() call. mutable uint64_t dump_frames_composited_; mutable uint64_t dump_last_timestamp_ns_; + std::unique_ptr planner_; }; }