From patchwork Wed Apr 11 15:22:19 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: 10335697 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 873A06053B for ; Wed, 11 Apr 2018 15:23:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 78C142897C for ; Wed, 11 Apr 2018 15:23:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6C28528980; Wed, 11 Apr 2018 15:23:46 +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 0DCD72897C for ; Wed, 11 Apr 2018 15:23:46 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 889B86E6AA; Wed, 11 Apr 2018 15:23:29 +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-eopbgr20050.outbound.protection.outlook.com [40.107.2.50]) by gabe.freedesktop.org (Postfix) with ESMTPS id 13CE46E6AA for ; Wed, 11 Apr 2018 15:23:27 +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=laVyxZAPcK43I3qEemLbppRGkXnyAqfIBIDVtXjKoOs=; b=JBgEbuQJmfyU4/eyM+W0RKj0ofBukFg5pKTBBqP+7ozK6x8EulGuw+0pZcc1aEooT2xA7D0gCZbJkKmId8unap+FQ2E4VubshmaGZ5nzSFFL2UXQkTTUg5UuZIRkoVZddb2vcvzDbH1RObaWXNV9s3UPSGuuXsxnJXRyWP8K1cU= 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:25 +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 08/18] drm_hwcomposer: Parse and store possible_clones information Date: Wed, 11 Apr 2018 16:22:19 +0100 Message-Id: <1523460149-1740-9-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:zpFY1jxGjzKhzv9AwPUyj/9FX9r6io/fOxfV0WfpvP56BPpmrMeGvallxXGtNUng3FiwV3HRk4jDz5bkipTYMSqvDZeyLGaoQ0PAL3QqQnPO2/JxB4dFLF6ZRIb+V/JGYGUllu7VU5qoTndAVuhncns8UqmfFrHhkdisd7i92q2gn1neVZDoARbaPkxYvRIXECV/AjHgoQCcaSjI2Qngsr5ZlyHmcVMzWSB6L4aVYcgpHDIpwkqRq7JP0kDq+By7; 25:8I4r4qAkAP/Q5tA1wY9Upg4I0zXzzoY02kzu25CsI7r2L2X2UA8TjV8gk54i7sDbpPgL5D61Qssp3/TCnWo0QD2vkC0/1Y6E+jekAK+aikLrnCI0kBrrvhmOqJ7sTLS/lvW9czSki+Rdyb3v+IxEtnfe4wD53DLxBF4VXXqdV1G96yOiQwDjJ5bABdeg8K9kz8CHZCxW2n4jSGxxvLe97MGBysXdLzmZOCFcPIaS+ME8Qgckp+SICTTkIzCMMaly4fIbm2Xjpkg05+5vaSC1lH9+NMDnJwBUYlg/t72ufpSrrTPfeT+PjV5OwjIZ8eztF5dBXv1H3Y9+FYKCuN+NPw==; 31:WJ75haIHs/9t0hRWcV0W4eT1xyhW4qPLCGKPzTvtrmho/HBulIQNrvPj+fQTWEZ8yFoW7mUce7oC8O5/ArcKuQ2zfFU1lpn59r+npGCuxPg7Ee9bQ8/WlAxgF3tEmFYQr+xTutctokiEuUpavMmV+EtjUbu8UiW/G5U9C7HnyUAO/RHMhAxYD0DHqeziV+wy96L++yiyjMJSmPs/zq2i+WXrElFdsmCTvhTr2s4jw54= X-MS-TrafficTypeDiagnostic: AM5PR0801MB1249: NoDisclaimer: True X-Microsoft-Exchange-Diagnostics: 1; AM5PR0801MB1249; 20:Rlc12HaRNSkjG/ZpSiuA296raKm3g1MWf1Spim1Q4Fvztw4R7tJOaTxveXtnTjg/or/Xnk3C9MznPya8sQIeZOWYlphdTdyDfR7FuS9sI952/bkd+y83dCvaZaW921GGXDOcB3uSBk80zC0sFjYDJvNn8PS8143wyA45oQhFB7U=; 4:las8R0Agd7O1vVjCJIRmuC1f5dFFAvkTIh0Tn3pGrUfegABA43VHa+IVaIWNDTO1ORXuQB9Uo6SKG2xjgKCd2/Em3gyibPlxH1gFXDG5we5O/ItvUHhmMCMclWyd+3g32VhanlARqxonhQnrwKVMPtA2yOUTZuCE5aVPuNdgI8vTa7u2afV8KjWVnEKRrgzAZHiUixsTpT1zLs6ctxKxSHGsOfTx64aNeH9MZz5CueWP5wxIqXhOjhpnNcZUZARZSOKL8q6qaX3aUSncPtYnAfnicwIIjMOxt4D6gNcXRLkhfyeCcnP+rCLocUb+Hv4C 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:zrxV5mCa6bmGdA7XHzCTupi3YhRUq2MBirB9rG3?= =?us-ascii?Q?tgeZb5AopxZiRgQb91WKV87+rTohw2MmVyuakAyYheVmEIJ2rRkexZUjN/t+?= =?us-ascii?Q?EYTy4wcphPsQs4Tgvct8CzrR9dpG/kMh9d4KD0XfWdM+K8I7xo+JLRA9En8x?= =?us-ascii?Q?UU71N3wevMfau+U9AtwybzRY753vuIOekaKZfGa1xvs0omLgSuTjO7i/ImDv?= =?us-ascii?Q?W6WL0eD9R3pf99UzN7Q9BsG+mwWqayIB3OyhrSuRP8FslNDitJBE5zGEGk88?= =?us-ascii?Q?RmYz1UbXHkAmduH/oickB8Ob5vk76gYQjzYlF0A8sIb0oOwApA6fxzu2GN75?= =?us-ascii?Q?nXLRT38MtTkwlsZiDh4Vgwk4N9BlKXH0YDWTD38Rb4tXAs7XFy1y+qMe2+Bk?= =?us-ascii?Q?419PXUBX+54QoNcWZtxF6gV/FDnHkYVOJvL45J2Ls3Q30flCXy3Jv00iBadv?= =?us-ascii?Q?dVEuJh1Kwf7JGu/KfHTj8n8yMxO2H2KfVvPpKzDDLEsXjJRE3QutRZbnnH10?= =?us-ascii?Q?+07lllW5v1VhM9XeguMWeVm2NqG06SFEbUCjnHJ5S8Eyd4UfgDlkQlzfP19T?= =?us-ascii?Q?Gpr/aVdMh4QkISafBlYSbuZ+rubgtZKKxSnyQOvYfjbM4EDIZPdwOZQLxb23?= =?us-ascii?Q?sTeBOUW9GD6DwPV0qN7Wm5I8MvEmuq09262IgfqwafjdNQT/B/2DbkqT62Yf?= =?us-ascii?Q?LuwF+AV108el4fA98YJHEh8O7mEdorLSVS7z/+fsX9apjc0n5Sn/18LBt0c7?= =?us-ascii?Q?mIdaGnmVs/2cjVfasEUt50Sx/8+PFFg5TTxLoQ8qmgKL9O4BUJHtYVVsLCnn?= =?us-ascii?Q?6+JbmuOckmLwEbBsMgM42F7jDM3C272Iow+LpL+P4fbhMxnxksnomwt8Rauq?= =?us-ascii?Q?LOnYfWzbLIl7zpi0GIy9iNP5+JVDY02wddnP1CIJ9w4GpxKygCOP/T0Gy7su?= =?us-ascii?Q?R8xGL9aBy8rWb2+tWDIKJw67HuDY0y7rgPfiEpOZLRITaAjF+UPHDdDZjd+7?= =?us-ascii?Q?qSMdTHLB+M62yknynDf+fWoj0tlH2oE+ApvUCoG6z8jTXlfuh25iPqhKYBcB?= =?us-ascii?Q?7gd+oA9FdG+z5YoXGWqrzIN2CETzDTziAwA8WSIVYslXooy8N+SRELXTLZuN?= =?us-ascii?Q?7V72QvkSjoTZzHiOjYok35khh17h6VQmwOJUUzjF5ifmZXKW09zqxfboHRhW?= =?us-ascii?Q?L3S0OcVtReFgZS7o=3D?= X-Microsoft-Antispam-Message-Info: XpLVwcZzirpQrG63UMecKiv60wi0fAK4ilYrfHiOFUxmfFBLIbukJTbChrhhk/aTpLjHl6EO5jIN+YxrPqL3keKsx4OMSpOngfhI9x4UuLLXxJHnCOWUjz7lX5gxzuhGmfOHVSVGG0h0/rExZA0w/qcvoLouIGDfYS3z9IfZsL8nRzullevIU5W+ZMMIj2Cf X-Microsoft-Exchange-Diagnostics: 1; AM5PR0801MB1249; 6:uckCwg+w1trqYmG6c8qzLnKsGm+ubOzFy0Ws0Z89mTvO+GdJu3yd9l08/cpAxGi9mJixAD1eOwPtVYsZcHvuRJbb0ijHoGtc+p8YFRCYfnd+QuS9KJ5DNRJaROvMTKPOKb7KUdoW9TTNEfFJf2NhSo0fnJtknH//cOVPOdnjrsC29aK+s8KzG3cFJeAbt75kjawPtyP7YT+euIvlQf6Pv/SD/Pqimv5Xzkq3xRMxkSWPy+u8NcNAVJdWNrkcE/lzEeuOPagH2oTTbqzN3qE3pHhFc0bdfIMpTjo1E1DxXD+YsnLb/g2qyoffexvxwT1tbRA5aFaXJ//LyWfH/Q1fDucBqOsQ6P3pXb67Irbu8DqGB6rARPecQKouKeH2oGQIK6fhtiXAYKhkMHX6JFj3aDuOJJMhxNj7Edq9sOJCGafCU1ToyGjqBceFJMbwUGJjR8USLWSBGhSR1Fn439+aJQ==; 5:fT9DsXWRSjhFDAikdqud6ypfBDQ1EwR1uFPrsHxD7EDemSudHY0rsp/8tH/rYPINjR9z4E9gz5mU/Qglkbhe9dc2JmqkEP3Bt0RYbpp04icTF8qRgXiMHmMPVppO0UkdGX6nTizdBayJZmE/JOMUXDNEJUX61/ULvg0llo6j9j4=; 24:On2SexUCZGQ5jyxZkhyeb4R5g/K+wvy8UgNRhVGz5/aWcjDYtKHZldoNICr60wZWk/0YZj00MZ+MCwYpaktBLOrQG0B9CABoqcsFqo8pdNg= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; AM5PR0801MB1249; 7:V73AYDAooAvAjiuvmy8AvMnPzPI8O3LjvKob1dG9CqY47i7XuFLQAXdsJ4iwh9qG6N1o7xvks4+2OHqc3ZLZ5+xZ/JAYfH1xNhfNxt45s3QkOfnLY7aVfX7Au06OsvGz8hEtzqzjyrhBB3qRraONidW4nXiKWjgJdUe7tzeCsleZQHxO+U6qjF2Fw9Jn+u+zKy0L1cx4clr7EHpwsCBpEHItpNkv0C6805/d5mIwfZJSh0PDHOZ8/T1Z3f4peZCb X-MS-Office365-Filtering-Correlation-Id: 84795196-b99a-4710-7c06-08d59fc02bad X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Apr 2018 15:23:25.2935 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 84795196-b99a-4710-7c06-08d59fc02bad 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 drmModeEncoder has a field called possible_clones. It's a bit mask which tells if the encoder could be simultaneously connected, to the same CRTC, with the encoders specified in the possible_clones mask. Signed-off-by: Alexandru Gheorghe --- drmencoder.cpp | 8 ++++++++ drmencoder.h | 4 ++++ drmresources.cpp | 9 ++++++++- 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/drmencoder.cpp b/drmencoder.cpp index 1da7ec3..ff675f5 100644 --- a/drmencoder.cpp +++ b/drmencoder.cpp @@ -39,6 +39,14 @@ DrmCrtc *DrmEncoder::crtc() const { return crtc_; } +bool DrmEncoder::can_clone(DrmEncoder *encoder) { + return possible_clones_.find(encoder) != possible_clones_.end(); +} + +void DrmEncoder::add_possible_clone(DrmEncoder *possible_clone) { + possible_clones_[possible_clone] = true; +} + void DrmEncoder::set_crtc(DrmCrtc *crtc) { crtc_ = crtc; set_display(crtc->display()); diff --git a/drmencoder.h b/drmencoder.h index 7e06691..5e7c010 100644 --- a/drmencoder.h +++ b/drmencoder.h @@ -21,6 +21,7 @@ #include #include +#include #include namespace android { @@ -43,6 +44,8 @@ class DrmEncoder { const std::vector &possible_crtcs() const { return possible_crtcs_; } + bool can_clone(DrmEncoder *encoder); + void add_possible_clone(DrmEncoder *possible_clone); private: uint32_t id_; @@ -50,6 +53,7 @@ class DrmEncoder { int display_; std::vector possible_crtcs_; + std::map possible_clones_; }; } diff --git a/drmresources.cpp b/drmresources.cpp index a5ddda0..39f50be 100644 --- a/drmresources.cpp +++ b/drmresources.cpp @@ -97,6 +97,7 @@ int DrmResources::Init(ResourceManager *resource_manager, char *path, crtcs_.emplace_back(std::move(crtc)); } + std::vector possible_clones; for (int i = 0; !ret && i < res->count_encoders; ++i) { drmModeEncoderPtr e = drmModeGetEncoder(fd(), res->encoders[i]); if (!e) { @@ -117,12 +118,18 @@ int DrmResources::Init(ResourceManager *resource_manager, char *path, std::unique_ptr enc( new DrmEncoder(e, current_crtc, possible_crtcs)); - + possible_clones.push_back(e->possible_clones); drmModeFreeEncoder(e); encoders_.emplace_back(std::move(enc)); } + for (uint32_t i = 0; i < encoders_.size(); i++) { + for (uint32_t j = 0; j < encoders_.size(); j++) + if (possible_clones[i] & (1 << j)) + encoders_[i]->add_possible_clone(encoders_[j].get()); + } + for (int i = 0; !ret && i < res->count_connectors; ++i) { drmModeConnectorPtr c = drmModeGetConnector(fd(), res->connectors[i]); if (!c) {