Commit c7ab6aff authored by wm4's avatar wm4 Committed by Diego Biurrun

w32pthreads: always use Vista+ API, drop XP support

This removes the XP compatibility code, and switches entirely to SRW
locks, which are available starting at Windows Vista.

This removes CRITICAL_SECTION use, which allows us to add
PTHREAD_MUTEX_INITIALIZER, which will be useful later.

Windows XP is hereby not a supported build target anymore.
Signed-off-by: 's avatarDiego Biurrun <diego@biurrun.de>
parent c31f6b1d
...@@ -22,6 +22,8 @@ version <next>: ...@@ -22,6 +22,8 @@ version <next>:
- Intel QSV-accelerated overlay filter - Intel QSV-accelerated overlay filter
- AV1 Support through libaom - AV1 Support through libaom
- Haivision SRT protocol via libsrt - Haivision SRT protocol via libsrt
- Dropped support for building for Windows XP. The minimum supported Windows
version is Windows Vista.
version 12: version 12:
......
This diff is collapsed.
...@@ -1732,7 +1732,6 @@ TOOLCHAIN_FEATURES=" ...@@ -1732,7 +1732,6 @@ TOOLCHAIN_FEATURES="
" "
TYPES_LIST=" TYPES_LIST="
CONDITION_VARIABLE_Ptr
CUVIDDECODECREATEINFO_bitDepthMinus8 CUVIDDECODECREATEINFO_bitDepthMinus8
socklen_t socklen_t
struct_addrinfo struct_addrinfo
...@@ -2002,7 +2001,7 @@ atomics_gcc_if="sync_val_compare_and_swap" ...@@ -2002,7 +2001,7 @@ atomics_gcc_if="sync_val_compare_and_swap"
atomics_suncc_if="atomic_cas_ptr machine_rw_barrier" atomics_suncc_if="atomic_cas_ptr machine_rw_barrier"
atomics_win32_if="MemoryBarrier" atomics_win32_if="MemoryBarrier"
atomics_native_if_any="$ATOMICS_LIST" atomics_native_if_any="$ATOMICS_LIST"
w32threads_deps="atomics_native" w32threads_deps="atomics_native CONDITION_VARIABLE"
threads_if_any="$THREADS_LIST" threads_if_any="$THREADS_LIST"
# subsystems # subsystems
...@@ -4103,12 +4102,16 @@ probe_libc(){ ...@@ -4103,12 +4102,16 @@ probe_libc(){
elif test_${pfx}cpp_condition newlib.h "defined _NEWLIB_VERSION"; then elif test_${pfx}cpp_condition newlib.h "defined _NEWLIB_VERSION"; then
eval ${pfx}libc_type=newlib eval ${pfx}libc_type=newlib
add_${pfx}cppflags -U__STRICT_ANSI__ -D_XOPEN_SOURCE=600 add_${pfx}cppflags -U__STRICT_ANSI__ -D_XOPEN_SOURCE=600
test_${pfx}cpp_condition windows.h "!defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0600" &&
add_${pfx}cppflags -D_WIN32_WINNT=0x0600
# MinGW64 is backwards compatible with MinGW32, so check for it first. # MinGW64 is backwards compatible with MinGW32, so check for it first.
elif test_${pfx}cpp_condition _mingw.h "defined __MINGW64_VERSION_MAJOR"; then elif test_${pfx}cpp_condition _mingw.h "defined __MINGW64_VERSION_MAJOR"; then
eval ${pfx}libc_type=mingw64 eval ${pfx}libc_type=mingw64
add_${pfx}cppflags -U__STRICT_ANSI__ -D__USE_MINGW_ANSI_STDIO=1 add_${pfx}cppflags -U__STRICT_ANSI__ -D__USE_MINGW_ANSI_STDIO=1
eval test \$${pfx_no_}cc_type = "gcc" && eval test \$${pfx_no_}cc_type = "gcc" &&
add_${pfx}cppflags -D__printf__=__gnu_printf__ add_${pfx}cppflags -D__printf__=__gnu_printf__
test_${pfx}cpp_condition windows.h "!defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0600" &&
add_${pfx}cppflags -D_WIN32_WINNT=0x0600
elif test_${pfx}cpp_condition _mingw.h "defined __MINGW_VERSION" || elif test_${pfx}cpp_condition _mingw.h "defined __MINGW_VERSION" ||
test_${pfx}cpp_condition _mingw.h "defined __MINGW32_VERSION"; then test_${pfx}cpp_condition _mingw.h "defined __MINGW32_VERSION"; then
eval ${pfx}libc_type=mingw32 eval ${pfx}libc_type=mingw32
...@@ -4118,8 +4121,8 @@ probe_libc(){ ...@@ -4118,8 +4121,8 @@ probe_libc(){
add_${pfx}cppflags -U__STRICT_ANSI__ -D__USE_MINGW_ANSI_STDIO=1 add_${pfx}cppflags -U__STRICT_ANSI__ -D__USE_MINGW_ANSI_STDIO=1
test_${pfx}cpp_condition _mingw.h "__MSVCRT_VERSION__ < 0x0700" && test_${pfx}cpp_condition _mingw.h "__MSVCRT_VERSION__ < 0x0700" &&
add_${pfx}cppflags -D__MSVCRT_VERSION__=0x0700 add_${pfx}cppflags -D__MSVCRT_VERSION__=0x0700
test_${pfx}cpp_condition windows.h "defined(_WIN32_WINNT) && _WIN32_WINNT < 0x0502" && test_${pfx}cpp_condition windows.h "!defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0600" &&
add_${pfx}cppflags -D_WIN32_WINNT=0x0502 add_${pfx}cppflags -D_WIN32_WINNT=0x0600
eval test \$${pfx_no_}cc_type = "gcc" && eval test \$${pfx_no_}cc_type = "gcc" &&
add_${pfx}cppflags -D__printf__=__gnu_printf__ add_${pfx}cppflags -D__printf__=__gnu_printf__
elif test_${pfx}cpp_condition crtversion.h "defined _VC_CRT_MAJOR_VERSION"; then elif test_${pfx}cpp_condition crtversion.h "defined _VC_CRT_MAJOR_VERSION"; then
...@@ -4139,14 +4142,14 @@ probe_libc(){ ...@@ -4139,14 +4142,14 @@ probe_libc(){
# 0x601 by default unless something else is set by the user. # 0x601 by default unless something else is set by the user.
# This can easily lead to us detecting functions only present # This can easily lead to us detecting functions only present
# in such new versions and producing binaries requiring windows 7.0. # in such new versions and producing binaries requiring windows 7.0.
# Therefore explicitly set the default to XP unless the user has # Therefore explicitly set the default to Vista unless the user has
# set something else on the command line. # set something else on the command line.
# Don't do this if WINAPI_FAMILY is set and is set to a non-desktop # Don't do this if WINAPI_FAMILY is set and is set to a non-desktop
# family. For these cases, configure is free to use any functions # family. For these cases, configure is free to use any functions
# found in the SDK headers by default. (Alternatively, we could force # found in the SDK headers by default. (Alternatively, we could force
# _WIN32_WINNT to 0x0602 in that case.) # _WIN32_WINNT to 0x0602 in that case.)
test_${pfx}cpp_condition stdlib.h "defined(_WIN32_WINNT)" || test_${pfx}cpp_condition stdlib.h "defined(_WIN32_WINNT)" ||
{ test_${pfx}cpp <<EOF && add_${pfx}cppflags -D_WIN32_WINNT=0x0502; } { test_${pfx}cpp <<EOF && add_${pfx}cppflags -D_WIN32_WINNT=0x0600; }
#ifdef WINAPI_FAMILY #ifdef WINAPI_FAMILY
#include <winapifamily.h> #include <winapifamily.h>
#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) #if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
...@@ -4553,7 +4556,6 @@ check_func_headers windows.h MapViewOfFile ...@@ -4553,7 +4556,6 @@ check_func_headers windows.h MapViewOfFile
check_func_headers windows.h SetConsoleTextAttribute check_func_headers windows.h SetConsoleTextAttribute
check_func_headers windows.h Sleep check_func_headers windows.h Sleep
check_func_headers windows.h VirtualAlloc check_func_headers windows.h VirtualAlloc
check_struct windows.h "CONDITION_VARIABLE" Ptr
check_header direct.h check_header direct.h
check_header dxgidebug.h check_header dxgidebug.h
...@@ -4605,7 +4607,8 @@ check_type "va/va.h va/va_enc_vp9.h" "VAEncPictureParameterBufferVP9" ...@@ -4605,7 +4607,8 @@ check_type "va/va.h va/va_enc_vp9.h" "VAEncPictureParameterBufferVP9"
check_type "vdpau/vdpau.h" "VdpPictureInfoHEVC" check_type "vdpau/vdpau.h" "VdpPictureInfoHEVC"
if ! disabled w32threads && ! enabled pthreads; then if ! disabled w32threads && ! enabled pthreads; then
check_lib w32threads "windows.h process.h" _beginthreadex check_lib w32threads "windows.h process.h" _beginthreadex &&
check_type "windows.h" CONDITION_VARIABLE
fi fi
# check for some common methods of building with pthread support # check for some common methods of building with pthread support
......
...@@ -658,10 +658,6 @@ int ff_frame_thread_init(AVCodecContext *avctx) ...@@ -658,10 +658,6 @@ int ff_frame_thread_init(AVCodecContext *avctx)
FrameThreadContext *fctx; FrameThreadContext *fctx;
int i, err = 0; int i, err = 0;
#if HAVE_W32THREADS
w32thread_init();
#endif
if (!thread_count) { if (!thread_count) {
int nb_cpus = av_cpu_count(); int nb_cpus = av_cpu_count();
av_log(avctx, AV_LOG_DEBUG, "detected %d logical cores\n", nb_cpus); av_log(avctx, AV_LOG_DEBUG, "detected %d logical cores\n", nb_cpus);
......
...@@ -169,10 +169,6 @@ int ff_slice_thread_init(AVCodecContext *avctx) ...@@ -169,10 +169,6 @@ int ff_slice_thread_init(AVCodecContext *avctx)
SliceThreadContext *c; SliceThreadContext *c;
int thread_count = avctx->thread_count; int thread_count = avctx->thread_count;
#if HAVE_W32THREADS
w32thread_init();
#endif
if (!thread_count) { if (!thread_count) {
int nb_cpus = av_cpu_count(); int nb_cpus = av_cpu_count();
av_log(avctx, AV_LOG_DEBUG, "detected %d logical cores\n", nb_cpus); av_log(avctx, AV_LOG_DEBUG, "detected %d logical cores\n", nb_cpus);
......
...@@ -200,10 +200,6 @@ int ff_graph_thread_init(AVFilterGraph *graph) ...@@ -200,10 +200,6 @@ int ff_graph_thread_init(AVFilterGraph *graph)
{ {
int ret; int ret;
#if HAVE_W32THREADS
w32thread_init();
#endif
if (graph->nb_threads == 1) { if (graph->nb_threads == 1) {
graph->thread_type = 0; graph->thread_type = 0;
return 0; return 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment