From patchwork Wed Apr 11 15:22:18 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: 10335695 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 95C2460365 for ; Wed, 11 Apr 2018 15:23:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 890662897C for ; Wed, 11 Apr 2018 15:23:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7CEDD28980; Wed, 11 Apr 2018 15:23:42 +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 22CF42897C for ; Wed, 11 Apr 2018 15:23:42 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D23536E6AB; Wed, 11 Apr 2018 15:23:28 +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-eopbgr20055.outbound.protection.outlook.com [40.107.2.55]) by gabe.freedesktop.org (Postfix) with ESMTPS id 86D376E6A6 for ; Wed, 11 Apr 2018 15:23:25 +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=8EQEpu7YiAGO6P0Mncu/35W6HfJtY3Z+5icJiIu/UO8=; b=rBi0e18mnjPIth1PDgbuHB4XdSRFfj+sDNY2HwOumtMqkUS3X01AZZni4idxasE87j65BUHf376m6hAqeEMv9ncj6SwaOIPfi0OePda/eQb7vt8NbpKiwJ0sX/e/+v88f0Rfc0+UU2gYvcP5L2rj7rz3/TX1wjkNC9nI1iSIyf8= 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:23 +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 07/18] drm_hwcomposer: Add display field to Drmencoder Date: Wed, 11 Apr 2018 16:22:18 +0100 Message-Id: <1523460149-1740-8-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:5yDto/2iwJAMxOOLewj3xBSNhimxZUas/kpwWOlHYog4daM69mC46NcUOV5AHNoSoQx4DgrTKF1U6Gba5XCz6Q/RM1E2fYo8Y6wGPp1xeKsD8LAhbgSMgB3IeQQ0IZsz+Au2A+LMARwfQPuuP1mVyRSk0iYYMVcfONtY/tyCffs7PLVj8CxANyl3tMrNSrU5rkIVyBM2habSmlV1urJ64hm0Nq4EMg0ACTzYGEH6qTFkve6vggaLz+zRs4EP5fU+; 25:oJiFaL3xQHLAwp7/VLY1c8/quQsp2LVC9NPc6b8rDMTql6z1nFFoOiKStUpppU5uLv2HoVZYJfLRKRI4I8Pm/M6HzihKO1q+lOr7ZylKmC2X2rCjhq0tRa+Y/FvI6cYinJnwcvauP3IOH8cQQ9p8+6sGDMvBlikXcFTqMIG//smFhm8sBkaernik05QxqG2SvTgYMNXkp+FQ/82NixDCKnhvS6fLgcJlNIefT9Z8VoN4sbCuqhcydLMk/+KHc9RPvrp5OySuRNloJ/LQM5SGAR5veyRNklV32WsXSGkFfyREoA4/XI1pGjUfbP559jXvbh7/Ak66Xo3yXAZ/Nh4RoQ==; 31:guFZB7JErqa0Gc7TM9i+2khHJGl5V2c/8mlREYui8VB8P3RN/gNS/dpE5qs/OeOvrXu4rww59+Ha/9W47QrJ3j5/Qvg2deXcve+Nflt+Muf75VhbghJ9e2e7M+W2gzQEEy1tsOUd9yGjEW0Xoff9JyWRXxVkil4IzSVwWxGnOYrqj8DDNdwkMjTM7ywgW3lYotkgWxY3edVLx41Ce2EofPhywhGvvqNw1f843fLCj1g= X-MS-TrafficTypeDiagnostic: AM5PR0801MB1249: NoDisclaimer: True X-Microsoft-Exchange-Diagnostics: 1; AM5PR0801MB1249; 20:evF9OJiOHLqGESUdOFrcM5YxqH0EQrr3U/Jk63LeCZytyM2GJXgZ4menHQGXyvFmiNUvosa3k3gtKoaOqUrAXrtud0e1nx1ajuAoQDUTbhqrOxXV/G5e0mlzCMQyzlWqnVzb94K9buDZe5uSfu9QVWaONrz/Pw7qpKsoHXWDEL0=; 4:7cEjVII9Crbk4jGo0Ngz+oAgdxSvjQ53C6fW7CcrS7g25vUAKIcgEaJOh6sw/nMdNFmVNct6Q0Do+BmgJD9HJfoU2t4mDPCIN2T8g84CXJSArkGqS9GuqGagx6QfrMt/IlzvsRHjHPNnKctqlHe1rLRQFHXHlpqwPYEeqmVfJ76w0AWZGMbkFambDrhbSuf/qy4U8Ca7iujBcOPLZCgzRkDpAovPuso1iK37hfZCp4mLrSwdrCfCn/W5vxNDOZEfbCNhRmIaIUr6wsfdKNsbUJ1+JfqkvooV0w00FYRQfr7C6XzKSty7WpHXc2VIq55p 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)(5890100001)(8936002)(6486002)(105586002)(48376002)(186003)(956004)(5660300001)(6666003)(72206003)(106356001)(476003)(53936002)(3846002)(76176011)(51416003)(52116002)(47776003)(7696005)(36756003)(66066001)(11346002)(446003)(386003)(97736004)(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:hp583uVp7VCjX/y3aNix//or3XWWKwKCRjGFaEq?= =?us-ascii?Q?5XUe1N5ewicgpOuwnC6z/wba3LhYqB1OupS+T1I2wYauQ281Ypl0qN5pmBae?= =?us-ascii?Q?E4k//iSoBKkQbdBtRIADSjZ4mUBeckucgE2sTkhni/bF5TrzgsY3JtYoEkGh?= =?us-ascii?Q?cqXRGdkrizapLuf6HLzpXV0bj3A9uufczmdbIcRC2MXAc6RNJuJhvvElK8UD?= =?us-ascii?Q?W75olikrzasEtN2RZRR0hCxrp/UPE291qT3wpADXy57VxanWayGa5d3ZhmxR?= =?us-ascii?Q?s5EXzWZpTJNZTAZB3NadJRoOZPrrw9F1grLXDSWxusbc2kVqYC7rNf8jDIXg?= =?us-ascii?Q?W93K7igZ09YMk3hawkcxOFwjzvprFXZLTWmqFPLgTyxY9mHyhyW19EMZj4WP?= =?us-ascii?Q?loQ7qihbbsTPiLi1D7Z8zHGjiwyRjF/PXYiHTtxWJhU91ivMGWSKWZ7vkSNY?= =?us-ascii?Q?ADCTguwXxSis+EEYi63tMhswFdMACQ+yeC32XBURS6ux09IHb9aaGdXTR12c?= =?us-ascii?Q?0FCmRk5Aqls7o2uust4GPh5kCpuMHxmlokAKPH2w9Ro/rjm7unySsM1X+UvQ?= =?us-ascii?Q?GD+Vtl4V7jLmOOl7IFu/Lx1FwJvhNTO6s4Rf9bF3q4NzMivitSMwXDYNy+v1?= =?us-ascii?Q?eLLt6Q0v/OwQsRWRxXbb00J8ASjK8gim8G/u956UYo4H3XQEx9gRcVgYTJJk?= =?us-ascii?Q?ER8hOL6T4vhC7xRcdq7xWmQTPgstQbezD4B0pCamz/Y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qVR1HeCO1K3sfaM3ZErxujjA3oE6c5I1iFisNXMIU6ZFDY89VsazpFvCSjn1JqKTvgq+z7x4YUtaTSu7VXw+Xgz5MPT2ZcsfmiO7PhYwFp3E3W70OTANKNZTkrji28/BPdjPUiHbL48YB2GxY4jfshYtMblrA2Glbp6U0voXBZB8gevoFXk05z3N96Bf+cabR/29Gy5+WluOVIN1YD0q0J3x7KoZP42nA==; 5:FQeN3ITUiA+k2ppVvB9qYH+1mfEhLpRZ7ssVjmZ3NevUT5pGZ0tWK/kaE93UjI7xi7H4y6i1k5kFEQ+Wd6MP3u41V8n/OYDHSHVlkxrxjABa5dBvZFW3H3qZG3Tw6uw6fLuE8l2tObKqPcwcrOEg/rSDBe4IPaWpWEV4km0qHtY=; 24:twgn4Xyow+iYOByE5xmd28N6Ps67DZ3rllEK3O1HidzFTkySj3wgOn9H+vRB8ohjTQlIC0pp6VZv+EUhZFZPfhSW/GkT8rs5gv0WoLZv9s8= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; AM5PR0801MB1249; 7:CUBVMn7qH/sF+EUXwN2TPeJmu1IyXFyFdlclWqkhEnzB3Q0kjTrsHDlp8tVly6/h+X3loWG0Ox6RquPJMNpAzuZ/7R0fEzBzrjBdNUKrgpWoZ/pCYt7INRNsFPnZ0DOyF6CeRWsIWjRZSk56+jo574rRs+FqKxtXBMgebJfmMZ0C04exY0pxzt8QSRYqYF6UZzsdt02ja4///xmBo6qx4U5tEmiH/104fIWRsUu9Ds5xnpWQBMmoMblemo8aYLIw X-MS-Office365-Filtering-Correlation-Id: 2322c4eb-504a-42c5-7078-08d59fc02ab0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Apr 2018 15:23:23.6632 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2322c4eb-504a-42c5-7078-08d59fc02ab0 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 In the current implementation TryEncoderForDisplay just looks at the crtc linked to the display, if that's not assigned to a display it means the encoder could be used, otherwise iterate to the list of possible_crtcs and find one which is not used. This logic works fine when you have just one encoder connected to a crtc but with two or more, like is the case when we attach a writeback connector, we need to know if we already assigned the encoder to a display. Signed-off-by: Alexandru Gheorghe --- drmencoder.cpp | 14 ++++++++++++++ drmencoder.h | 4 ++++ 2 files changed, 18 insertions(+) diff --git a/drmencoder.cpp b/drmencoder.cpp index 3d762f3..1da7ec3 100644 --- a/drmencoder.cpp +++ b/drmencoder.cpp @@ -27,6 +27,7 @@ DrmEncoder::DrmEncoder(drmModeEncoderPtr e, DrmCrtc *current_crtc, const std::vector &possible_crtcs) : id_(e->encoder_id), crtc_(current_crtc), + display_(-1), possible_crtcs_(possible_crtcs) { } @@ -40,5 +41,18 @@ DrmCrtc *DrmEncoder::crtc() const { void DrmEncoder::set_crtc(DrmCrtc *crtc) { crtc_ = crtc; + set_display(crtc->display()); +} + +int DrmEncoder::display() const { + return display_; +} + +void DrmEncoder::set_display(int display) { + display_ = display; +} + +bool DrmEncoder::can_bind(int display) const { + return display_ == -1 || display_ == display; } } diff --git a/drmencoder.h b/drmencoder.h index 58ccbfb..7e06691 100644 --- a/drmencoder.h +++ b/drmencoder.h @@ -36,6 +36,9 @@ class DrmEncoder { DrmCrtc *crtc() const; void set_crtc(DrmCrtc *crtc); + bool can_bind(int display) const; + void set_display(int display); + int display() const; const std::vector &possible_crtcs() const { return possible_crtcs_; @@ -44,6 +47,7 @@ class DrmEncoder { private: uint32_t id_; DrmCrtc *crtc_; + int display_; std::vector possible_crtcs_; };