From patchwork Mon Nov 21 18:52:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gregory J. Wolfe" X-Patchwork-Id: 1518 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.90.1 with SMTP id o1csp1778165vsb; Mon, 21 Nov 2016 10:53:13 -0800 (PST) X-Received: by 10.195.11.229 with SMTP id el5mr13107538wjd.64.1479754393816; Mon, 21 Nov 2016 10:53:13 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id r70si14843107wme.125.2016.11.21.10.53.13; Mon, 21 Nov 2016 10:53:13 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@KodakAlaris.onmicrosoft.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id AD9F6689D6F; Mon, 21 Nov 2016 20:53:08 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mx0a-001e4c01.pphosted.com (mx0b-001e4c01.pphosted.com [148.163.159.69]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 829AC689742 for ; Mon, 21 Nov 2016 20:53:02 +0200 (EET) Received: from pps.filterd (m0087347.ppops.net [127.0.0.1]) by mx0b-001e4c01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id uALIpWIZ002716 for ; Mon, 21 Nov 2016 13:53:04 -0500 Received: from nam03-dm3-obe.outbound.protection.outlook.com (mail-dm3nam03lp0023.outbound.protection.outlook.com [207.46.163.23]) by mx0b-001e4c01.pphosted.com with ESMTP id 26tks8c425-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Mon, 21 Nov 2016 13:53:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=KodakAlaris.onmicrosoft.com; s=selector1-kodakalaris-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=RkXr4U5oif2ETOA/UxdDKTHOeRjiN8OL+3Ox5ad/jyk=; b=Y/IUM4bm5LDzIS9Ij8Vwp1PFjybJNQ+pTPyVxL28TNLSn9H27/l4QVIC1WFvbvluPMtqOtSMa4T2wdpvv3vXgBdmstL2PzDxtY38reHpNE/7NdHbwQ7GDTBuzTB6aGvzYahJRkUiK6OrCOIGwDbOmJ0BP711YHsFZ0GQd8+R15g= Received: from DM5PR03CA0007.namprd03.prod.outlook.com (10.175.104.17) by BN3PR0301MB1282.namprd03.prod.outlook.com (10.161.210.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.734.8; Mon, 21 Nov 2016 18:53:01 +0000 Received: from BL2FFO11OLC007.protection.gbl (2a01:111:f400:7c09::103) by DM5PR03CA0007.outlook.office365.com (2603:10b6:3:118::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.734.8 via Frontend Transport; Mon, 21 Nov 2016 18:53:00 +0000 Received-SPF: Pass (protection.outlook.com: domain of kodakalaris.com designates 137.117.101.28 as permitted sender) receiver=protection.outlook.com; client-ip=137.117.101.28; helo=W5AZEXGP02.kaidmz.kodakalaris.net; Received: from W5AZEXGP02.kaidmz.kodakalaris.net (137.117.101.28) by BL2FFO11OLC007.mail.protection.outlook.com (10.173.160.142) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.721.5 via Frontend Transport; Mon, 21 Nov 2016 18:52:59 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:; UpperCasedChecksum:; SizeAsReceived:642; Count:11 Received: from localhost (10.234.8.126) by W5AZEXGP02.kaidmz.kodakalaris.net (10.81.4.5) with Microsoft SMTP Server id 15.0.847.32; Mon, 21 Nov 2016 13:52:52 -0500 From: "Gregory J. Wolfe" To: Date: Mon, 21 Nov 2016 13:52:39 -0500 Message-ID: <1479754359-7116-1-git-send-email-gregory.wolfe@kodakalaris.com> X-Mailer: git-send-email 2.5.1.windows.1 MIME-Version: 1.0 X-IncomingHeaderCount: 11 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:137.117.101.28; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(7916002)(2980300002)(438002)(3190300001)(189002)(199003)(110136003)(68736007)(106466001)(86362001)(8676002)(189998001)(356003)(2906002)(76506005)(2351001)(50466002)(36756003)(38730400001)(626004)(77096005)(104016004)(48376002)(6666003)(6916009)(4001430100002)(5660300001)(87936001)(450100001)(81166006)(92566002)(5003940100001)(97736004)(8936002)(81156014)(50226002)(50986999)(4326007)(305945005)(107886002)(33646002)(47776003)(57986006)(7846002); DIR:OUT; SFP:1102; SCL:1; SRVR:BN3PR0301MB1282; H:W5AZEXGP02.kaidmz.kodakalaris.net; FPR:; SPF:Pass; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11OLC007; 1:tlp3Elc+hHwAWPlbKO3ix3Vo4/k7/pFxeOP/6kiB/rvvRXLeJ48uyYf9AWsx3F4/dNzo1Zf5AcZRXlSyfnAJh5ekyk8Kn8q4qCmS0WSnjBo4fG8qVodinkt5gKD0lqnnWPUBJHyaNFfjziai5K3eh0dhP81BPhbqAMteMCdEvrCy74AgBreawyRIBKVGl5NC7KBCf58q/Nl2HeaW7Twm8pQ4IT2edPtQbQaV6vngD5TF4SrXIJ57atOSPuLw0dtrCmGgYcjmQ+54/dwa/speEUb0vSe8Q1/mvm0NyQsXPC/O2W4uAXQCpPpmPo+EbFDH/VYloEMwsGLp4cmbJUvnQyE9yHwm9R5K24XoxUA97N9fD6FPCXgX1bILjm1njBMZu9aWrbPwrs+jzE/2nYdEUiDrbW3aac89FShNm14AsEeDoE69pHvfMAMI/ioFUIFTODkStNdj9qIzns7rqC+5bTtd24KSlksO2aDKA3BjGUYcbffXkMINpA7qRzbaVX6LYNd2PcsKHv8l/r9eWQyBO5VGHb8tg7yx7VqhgvYEdMAak+1/CdMcP7d51jIQh0ixO6LmH1W7LotzYNIVmHKazXYAyTnYkE+WoDJqUcNHq0C18J3jp2CctA8sg2PJDvfCLV56JzJYRoWPMvCZE2ImfMUKQC+tQU9QA6tRXzaC6BAHJMQAdMfO2Fj6TjXCkXpWokR0iotykUpAWGFwLSoN3Q== X-Microsoft-Exchange-Diagnostics: 1; BN3PR0301MB1282; 2:ckxen092EltXOC+AYFMzoFU9gHfyXqaf+hHsoMQckQ3fT2TkmK6b43UhhoVlOEpsypNJyIFCXxj6aPp4IRGClzs0FcAcvgfIlPEWy88K3kyEwQqQGByTHvL4WS0u365VCpPdLiUPOHKEyywYsaMdC8UBSsDXNNR3iY74FeTrXeo=; 3:pImn99C6Nf199Ujtj5OW/eMELOE5uW4PKUZcWXO9XCLPXd317RrmSHrbRiU3LmwoI4aZK6WH+4104t1TKt+EuA1JplVazGabDuvx58nYz0AE22MVO+PJF8DEU0VmbGJW2/UQqx4qVnfBLvE7JigR6EA9WgvwQminJjYwUgx0YzbSJNx5yekPgdjD3I0LgQQsGmQ7riLArriKRm3KIbg5BFzQvBA4zia6SW9nWhuFYMQ4SfdcrQ6m7LcXQ5K+AWfLYHARzHdoJZGNpHYELUDSlIuVZaaVEhmw8mFru0sfGCA= X-MS-Office365-Filtering-Correlation-Id: a2073112-d371-4cd6-09a9-08d4123f9d68 X-Microsoft-Antispam: UriScan:; BCL:0; PC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VG3kqXlMMRnQxMcivTCzxfLPPa4KF+E+u065tONhcjPo8s/ge2/LZUJqXlKuKRMAvAbv5QgYiA9HyYTB+1nr+yhVCl/qUvEFEubT9dNoGXRVXoVZuuBSb7qHGO57AVS6bVEwtbeDLzpL12Zns+V5Oj/JUawHg==; 20:F5SE2hm0MB7v09MeJJUwAlI5XiA61efQxnSiEduyna0AtbkmJ8S/WBpZp96YqvRb3Jk3HOJ3fTA913pqP6Yhbat02Guzj/xLtvQw1PgDWKVSx1FCGh5KK8P6cEQA4YsUN3MDBQdSbhdHR3IPmVfTju86YaiU797LO+00PAcG7bO5r8xeX5DAMbkdZwIF79W+JvSkYrJYb5InKQ6uNKe7kcDGqAJpMaq83DGS1wDcLIspuwhg0zB8w+mLKlc+Vu1TesGT9WhffZOyWy2eWbTwNVmDu5sHTq86Ax7BsrMTHDONPi8fdyN6oc8rwwBbAyYDbWyFPSSkGyBpDUhiQ/jneDaCr67UBkAa6ac0uDdox6mGgV6xqs+mkPErlm+sHvq4JBL82fVTrO4IkJilM+xL1GVZtwp+e0uJ65jeTY+9nrfuZfGs7dGWtcDcnJLdPVpBERO0EYYoAmNmjWK6KrxSahA05fSYzACuQfcki9VpC4DSViqFGr1yLyNL8Ns0XHmn X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6060326)(6040307)(6045199)(601004)(2401047)(8121501046)(13015025)(13018025)(13017025)(5005006)(13024025)(13023025)(3002001)(10201501046)(6055026)(6041248)(6061324)(6046074)(6047074)(6072148)(6042181); SRVR:BN3PR0301MB1282; BCL:0; PCL:0; RULEID:; SRVR:BN3PR0301MB1282; X-Microsoft-Exchange-Diagnostics: 1; BN3PR0301MB1282; 4:Y7WsOxT03t3MWYvwzsVqwx3tdkyR9gR0IGOKtfQHUV/daXXpEHXOR8drwPCwqpfeIwyvwUdsZ7zwpDKL9pEadIM5htNOW0h4shmASP1LUnvCMIR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1dj9TbkgqacAZ8Ww1E4JxbQf4a4hsLLs49fBUqLAnb2FU5WgraG0KdihVZ8kA0AEHyBtRhxoaP46DIPME+QFIQHj2jO+JXTScGSEsp9qwXcUnxn8KFV5VUO74CqMRNXOmohpQoJtjwo/iypvh4z9D9M/ljx5FcKsLIJKRtCk7+rWWQhRKvk/vyFa8FvB9NbBEbX1Qob+mh2r4sfPD1nkxnQ+n/xdMtDycnqRFdZqdp5FUGpxLnhNLb4JyaRmye8UqP3ii2qJzOyUBj5qlc4kqAjxZqbnJU2fPCv; 5:3AfiabBC5hvfxUA4ZLWrE9BaguJBgyL2n4kQMQ5gY+0yYwXkrBMtwiwOWm3XlCemMqilWTrovPnYUPkX0IZKlEWhm9bkpBuWbAxBFPUntrnmojS7WxtEzv6Je9Fcf9/rgqJlIkbbRepzFrwLF9GRbUAbfCyfsgO76Llq5Pnhzfg=; 24:KFbXe2f/HUxw0fMXXYS5XYTauzTrA7RN+uL0h8pz3SRW1FyLc/W3ljfzQnUeQSNTBW4FJIlwkQqOOA5Qq6Z496Ve++ivcB0kTMQaJrfxZoU= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN3PR0301MB1282; 7:cv3T+M9OxaSeItw+zAYka5/moc/9iyU/WVQ19/Szj2Luf4kMGnJFz4OkTxtF7cwW0+1JURH01s8O44owZWpzrAb70tS9zdUCJP5CQZUepcBe3f1rAgY1r0TQTSB5E1ExwzWqPNSMb9nnA+YAk6atttlG78J4xypTDTvsgj4odwR/+bgqKIjc2GV+4gPN4CO+jOPm4WLT5D71weX9HNM30d/aKomBZV+XMJl0yZYUzEDtil82hOzkg3lirVWpPkBZTgDHHlygrvtMuwhEH46AplbrCspyc7a/dgXaGzH7nx5ir6nw7dKGgceQygbb50QFbif0GW3bRDUyzpP4q57+qCTHuDnD/dgg1NtSeNAOkVM= X-OriginatorOrg: kodakalaris.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Nov 2016 18:52:59.8539 (UTC) X-MS-Exchange-CrossTenant-Id: d29b7a9b-6edb-4720-99a8-3c5c6c3eeeb0 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=d29b7a9b-6edb-4720-99a8-3c5c6c3eeeb0; Ip=[137.117.101.28]; Helo=[W5AZEXGP02.kaidmz.kodakalaris.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR0301MB1282 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-11-21_13:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1609300000 definitions=main-1611210318 Subject: [FFmpeg-devel] [PATCH] Avoid creating unecessary dependencies on thread libraries. X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" (1) Multi-threading support requires knowing the number of CPUs available. When building with MinGW on a Windows system, both Windows and gcc run time functions are available to get this information. If available, the Windows function should be used, not the gcc function. This avoids creating an unnecessary dependency on the gcc thread library. (2) When ALL threading support is disabled, the build should not create a dependency on ANY thread library. Signed-off-by: Gregory J. Wolfe --- libavutil/cpu.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/libavutil/cpu.c b/libavutil/cpu.c index f5785fc..a55921a 100644 --- a/libavutil/cpu.c +++ b/libavutil/cpu.c @@ -258,20 +258,25 @@ int av_cpu_count(void) static volatile int printed; int nb_cpus = 1; +#if HAVE_THREADS #if HAVE_WINRT SYSTEM_INFO sysinfo; #endif -#if HAVE_SCHED_GETAFFINITY && defined(CPU_COUNT) + // if HAVE_GETPROCESSAFFINITYMASK, we will use Windows + // GetProcessAffinityMask() over gcc library function + // sched_getaffinity(). This avoids creating a dependency + // on the gcc thread library that we don't need/want. +#if HAVE_GETPROCESSAFFINITYMASK + DWORD_PTR proc_aff, sys_aff; + if (GetProcessAffinityMask(GetCurrentProcess(), &proc_aff, &sys_aff)) + nb_cpus = av_popcount64(proc_aff); +#elif HAVE_SCHED_GETAFFINITY && defined(CPU_COUNT) cpu_set_t cpuset; CPU_ZERO(&cpuset); if (!sched_getaffinity(0, sizeof(cpuset), &cpuset)) nb_cpus = CPU_COUNT(&cpuset); -#elif HAVE_GETPROCESSAFFINITYMASK - DWORD_PTR proc_aff, sys_aff; - if (GetProcessAffinityMask(GetCurrentProcess(), &proc_aff, &sys_aff)) - nb_cpus = av_popcount64(proc_aff); #elif HAVE_SYSCTL && defined(HW_NCPU) int mib[2] = { CTL_HW, HW_NCPU }; size_t len = sizeof(nb_cpus); @@ -286,6 +291,7 @@ int av_cpu_count(void) GetNativeSystemInfo(&sysinfo); nb_cpus = sysinfo.dwNumberOfProcessors; #endif +#endif if (!printed) { av_log(NULL, AV_LOG_DEBUG, "detected %d logical cores\n", nb_cpus);