summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-x.ci/scripts/windows/docker.sh5
-rw-r--r--.gitmodules6
-rw-r--r--CMakeLists.txt218
-rw-r--r--externals/CMakeLists.txt16
m---------externals/SDL0
m---------externals/ffmpeg0
-rw-r--r--externals/ffmpeg/CMakeLists.txt214
m---------externals/ffmpeg/ffmpeg0
-rw-r--r--src/input_common/drivers/udp_client.cpp74
-rw-r--r--src/input_common/helpers/udp_protocol.h21
-rw-r--r--src/tests/CMakeLists.txt3
-rw-r--r--src/tests/input_common/calibration_configuration_job.cpp136
-rw-r--r--src/video_core/command_classes/codecs/codec.cpp6
13 files changed, 430 insertions, 269 deletions
diff --git a/.ci/scripts/windows/docker.sh b/.ci/scripts/windows/docker.sh
index 155d8a5c8..584b9b39f 100755
--- a/.ci/scripts/windows/docker.sh
+++ b/.ci/scripts/windows/docker.sh
@@ -41,12 +41,11 @@ for i in package/*.exe; do
done
pip3 install pefile
-python3 .ci/scripts/windows/scan_dll.py package/*.exe "package/"
-python3 .ci/scripts/windows/scan_dll.py package/imageformats/*.dll "package/"
+python3 .ci/scripts/windows/scan_dll.py package/*.exe package/imageformats/*.dll "package/"
# copy FFmpeg libraries
EXTERNALS_PATH="$(pwd)/build/externals"
-FFMPEG_DLL_PATH="$(find ${EXTERNALS_PATH} -maxdepth 1 -type d | grep ffmpeg)/bin"
+FFMPEG_DLL_PATH="$(find "${EXTERNALS_PATH}" -maxdepth 1 -type d | grep 'ffmpeg-')/bin"
find ${FFMPEG_DLL_PATH} -type f -regex ".*\.dll" -exec cp -v {} package/ ';'
# copy libraries from yuzu.exe path
diff --git a/.gitmodules b/.gitmodules
index dc6ed500f..a9cf9a24a 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -34,12 +34,12 @@
[submodule "opus"]
path = externals/opus/opus
url = https://github.com/xiph/opus.git
-[submodule "ffmpeg"]
- path = externals/ffmpeg
- url = https://git.ffmpeg.org/ffmpeg.git
[submodule "SDL"]
path = externals/SDL
url = https://github.com/libsdl-org/SDL.git
[submodule "externals/cpp-httplib"]
path = externals/cpp-httplib
url = https://github.com/yhirose/cpp-httplib.git
+[submodule "externals/ffmpeg/ffmpeg"]
+ path = externals/ffmpeg/ffmpeg
+ url = https://git.ffmpeg.org/ffmpeg.git
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a810e11c2..18d553f4d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -514,7 +514,7 @@ if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
endif()
if (NOT YUZU_USE_BUNDLED_FFMPEG)
# Use system installed FFmpeg
- find_package(FFmpeg QUIET COMPONENTS ${FFmpeg_COMPONENTS})
+ find_package(FFmpeg 4.3 QUIET COMPONENTS ${FFmpeg_COMPONENTS})
if (FFmpeg_FOUND)
# Overwrite aggregate defines from FFmpeg module to avoid over-linking libraries.
@@ -527,225 +527,11 @@ if (NOT YUZU_USE_BUNDLED_FFMPEG)
set(FFmpeg_INCLUDE_DIR ${FFmpeg_INCLUDE_DIR} ${FFmpeg_INCLUDE_${COMPONENT}} CACHE PATH "Path to FFmpeg headers" FORCE)
endforeach()
else()
- message(WARNING "FFmpeg not found, falling back to externals")
+ message(WARNING "FFmpeg not found or too old, falling back to externals")
set(YUZU_USE_BUNDLED_FFMPEG ON)
endif()
endif()
-if (YUZU_USE_BUNDLED_FFMPEG)
- if (NOT WIN32)
- # TODO(lat9nq): Move this to externals/ffmpeg/CMakeLists.txt (and move externals/ffmpeg to
- # externals/ffmpeg/ffmpeg)
-
- # Build FFmpeg from externals
- message(STATUS "Using FFmpeg from externals")
-
- # FFmpeg has source that requires one of nasm or yasm to assemble it.
- # REQUIRED throws an error if not found here during configuration rather than during compilation.
- find_program(ASSEMBLER NAMES nasm yasm)
- if ("${ASSEMBLER}" STREQUAL "ASSEMBLER-NOTFOUND")
- message(FATAL_ERROR "One of either `nasm` or `yasm` not found but is required.")
- endif()
-
- find_program(AUTOCONF autoconf)
- if ("${AUTOCONF}" STREQUAL "AUTOCONF-NOTFOUND")
- message(FATAL_ERROR "Required program `autoconf` not found.")
- endif()
-
- set(FFmpeg_PREFIX ${PROJECT_SOURCE_DIR}/externals/ffmpeg)
- set(FFmpeg_BUILD_DIR ${PROJECT_BINARY_DIR}/externals/ffmpeg)
- set(FFmpeg_MAKEFILE ${FFmpeg_BUILD_DIR}/Makefile)
- make_directory(${FFmpeg_BUILD_DIR})
-
- # Read version string from external
- file(READ ${FFmpeg_PREFIX}/RELEASE FFmpeg_VERSION)
- set(FFmpeg_FOUND NO)
- if (NOT FFmpeg_VERSION STREQUAL "")
- set(FFmpeg_FOUND YES)
- endif()
-
- unset(FFmpeg_LIBRARIES CACHE)
- foreach(COMPONENT ${FFmpeg_COMPONENTS})
- set(FFmpeg_${COMPONENT}_PREFIX "${FFmpeg_BUILD_DIR}/lib${COMPONENT}")
- set(FFmpeg_${COMPONENT}_LIB_NAME "lib${COMPONENT}.a")
- set(FFmpeg_${COMPONENT}_LIBRARY "${FFmpeg_${COMPONENT}_PREFIX}/${FFmpeg_${COMPONENT}_LIB_NAME}")
-
- set(FFmpeg_LIBRARIES
- ${FFmpeg_LIBRARIES}
- ${FFmpeg_${COMPONENT}_LIBRARY}
- CACHE PATH "Paths to FFmpeg libraries" FORCE)
- endforeach()
-
- Include(FindPkgConfig REQUIRED)
- pkg_check_modules(LIBVA libva)
- pkg_check_modules(CUDA cuda)
- pkg_check_modules(FFNVCODEC ffnvcodec)
- pkg_check_modules(VDPAU vdpau)
-
- set(FFmpeg_HWACCEL_LIBRARIES)
- set(FFmpeg_HWACCEL_FLAGS)
- set(FFmpeg_HWACCEL_INCLUDE_DIRS)
- set(FFmpeg_HWACCEL_LDFLAGS)
-
- if(LIBVA_FOUND)
- pkg_check_modules(LIBDRM libdrm REQUIRED)
- find_package(X11 REQUIRED)
- pkg_check_modules(LIBVA-DRM libva-drm REQUIRED)
- pkg_check_modules(LIBVA-X11 libva-x11 REQUIRED)
- list(APPEND FFmpeg_HWACCEL_LIBRARIES
- ${LIBDRM_LIBRARIES}
- ${X11_LIBRARIES}
- ${LIBVA-DRM_LIBRARIES}
- ${LIBVA-X11_LIBRARIES}
- ${LIBVA_LIBRARIES})
- set(FFmpeg_HWACCEL_FLAGS
- --enable-hwaccel=h264_vaapi
- --enable-hwaccel=vp8_vaapi
- --enable-hwaccel=vp9_vaapi
- --enable-libdrm)
- list(APPEND FFmpeg_HWACCEL_INCLUDE_DIRS
- ${LIBDRM_INCLUDE_DIRS}
- ${X11_INCLUDE_DIRS}
- ${LIBVA-DRM_INCLUDE_DIRS}
- ${LIBVA-X11_INCLUDE_DIRS}
- ${LIBVA_INCLUDE_DIRS}
- )
- message(STATUS "VA-API found")
- else()
- set(FFmpeg_HWACCEL_FLAGS --disable-vaapi)
- endif()
-
- if (FFNVCODEC_FOUND AND CUDA_FOUND)
- list(APPEND FFmpeg_HWACCEL_FLAGS
- --enable-cuvid
- --enable-ffnvcodec
- --enable-nvdec
- --enable-hwaccel=h264_nvdec
- --enable-hwaccel=vp8_nvdec
- --enable-hwaccel=vp9_nvdec
- --extra-cflags=-I${CUDA_INCLUDE_DIRS}
- )
- list(APPEND FFmpeg_HWACCEL_LIBRARIES
- ${FFNVCODEC_LIBRARIES}
- ${CUDA_LIBRARIES}
- )
- list(APPEND FFmpeg_HWACCEL_INCLUDE_DIRS
- ${FFNVCODEC_INCLUDE_DIRS}
- ${CUDA_INCLUDE_DIRS}
- )
- list(APPEND FFmpeg_HWACCEL_LDFLAGS
- ${FFNVCODEC_LDFLAGS}
- ${CUDA_LDFLAGS}
- )
- message(STATUS "ffnvcodec libraries version ${FFNVCODEC_VERSION} found")
- endif()
-
- if (VDPAU_FOUND)
- list(APPEND FFmpeg_HWACCEL_FLAGS
- --enable-vdpau
- --enable-hwaccel=h264_vdpau
- --enable-hwaccel=vp9_vdpau
- )
- list(APPEND FFmpeg_HWACCEL_LIBRARIES ${VDPAU_LIBRARIES})
- list(APPEND FFmpeg_HWACCEL_INCLUDE_DIRS ${VDPAU_INCLUDE_DIRS})
- list(APPEND FFmpeg_HWACCEL_LDFLAGS ${VDPAU_LDFLAGS})
- message(STATUS "vdpau libraries version ${VDPAU_VERSION} found")
- else()
- list(APPEND FFmpeg_HWACCEL_FLAGS --disable-vdpau)
- endif()
-
- # `configure` parameters builds only exactly what yuzu needs from FFmpeg
- # `--disable-vdpau` is needed to avoid linking issues
- add_custom_command(
- OUTPUT
- ${FFmpeg_MAKEFILE}
- COMMAND
- /bin/bash ${FFmpeg_PREFIX}/configure
- --disable-avdevice
- --disable-avfilter
- --disable-avformat
- --disable-doc
- --disable-everything
- --disable-ffmpeg
- --disable-ffprobe
- --disable-network
- --disable-postproc
- --disable-swresample
- --enable-decoder=h264
- --enable-decoder=vp8
- --enable-decoder=vp9
- --cc="${CMAKE_C_COMPILER}"
- --cxx="${CMAKE_CXX_COMPILER}"
- ${FFmpeg_HWACCEL_FLAGS}
- WORKING_DIRECTORY
- ${FFmpeg_BUILD_DIR}
- )
- unset(FFmpeg_HWACCEL_FLAGS)
-
- # Workaround for Ubuntu 18.04's older version of make not being able to call make as a child
- # with context of the jobserver. Also helps ninja users.
- execute_process(
- COMMAND
- nproc
- OUTPUT_VARIABLE
- SYSTEM_THREADS)
-
- set(FFmpeg_BUILD_LIBRARIES ${FFmpeg_LIBRARIES})
- add_custom_command(
- OUTPUT
- ${FFmpeg_BUILD_LIBRARIES}
- COMMAND
- make -j${SYSTEM_THREADS}
- WORKING_DIRECTORY
- ${FFmpeg_BUILD_DIR}
- )
-
- set(FFmpeg_INCLUDE_DIR
- "${FFmpeg_PREFIX};${FFmpeg_BUILD_DIR};${FFmpeg_HWACCEL_INCLUDE_DIRS}"
- CACHE PATH "Path to FFmpeg headers" FORCE)
-
- set(FFmpeg_LDFLAGS
- "${FFmpeg_HWACCEL_LDFLAGS}"
- CACHE STRING "FFmpeg linker flags" FORCE)
-
- # ALL makes this custom target build every time
- # but it won't actually build if the DEPENDS parameter is up to date
- add_custom_target(ffmpeg-configure ALL DEPENDS ${FFmpeg_MAKEFILE})
- add_custom_target(ffmpeg-build ALL DEPENDS ${FFmpeg_BUILD_LIBRARIES} ffmpeg-configure)
- link_libraries(${FFmpeg_LIBVA_LIBRARIES})
- set(FFmpeg_LIBRARIES ${FFmpeg_BUILD_LIBRARIES} ${FFmpeg_HWACCEL_LIBRARIES}
- CACHE PATH "Paths to FFmpeg libraries" FORCE)
- unset(FFmpeg_BUILD_LIBRARIES)
- unset(FFmpeg_HWACCEL_FLAGS)
- unset(FFmpeg_HWACCEL_INCLUDE_DIRS)
- unset(FFmpeg_HWACCEL_LDFLAGS)
- unset(FFmpeg_HWACCEL_LIBRARIES)
-
- if (FFmpeg_FOUND)
- message(STATUS "Found FFmpeg version ${FFmpeg_VERSION}")
- else()
- message(FATAL_ERROR "FFmpeg not found")
- endif()
- else() # WIN32
- # Use yuzu FFmpeg binaries
- set(FFmpeg_EXT_NAME "ffmpeg-4.4")
- set(FFmpeg_PATH "${CMAKE_BINARY_DIR}/externals/${FFmpeg_EXT_NAME}")
- download_bundled_external("ffmpeg/" ${FFmpeg_EXT_NAME} "")
- set(FFmpeg_FOUND YES)
- set(FFmpeg_INCLUDE_DIR "${FFmpeg_PATH}/include" CACHE PATH "Path to FFmpeg headers" FORCE)
- set(FFmpeg_LIBRARY_DIR "${FFmpeg_PATH}/bin" CACHE PATH "Path to FFmpeg library directory" FORCE)
- set(FFmpeg_LDFLAGS "" CACHE STRING "FFmpeg linker flags" FORCE)
- set(FFmpeg_DLL_DIR "${FFmpeg_PATH}/bin" CACHE PATH "Path to FFmpeg dll's" FORCE)
- set(FFmpeg_LIBRARIES
- ${FFmpeg_LIBRARY_DIR}/swscale.lib
- ${FFmpeg_LIBRARY_DIR}/avcodec.lib
- ${FFmpeg_LIBRARY_DIR}/avutil.lib
- CACHE PATH "Paths to FFmpeg libraries" FORCE)
- endif()
-endif()
-
-unset(FFmpeg_COMPONENTS)
-
# Prefer the -pthread flag on Linux.
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
diff --git a/externals/CMakeLists.txt b/externals/CMakeLists.txt
index 64d1e6aec..e9095b123 100644
--- a/externals/CMakeLists.txt
+++ b/externals/CMakeLists.txt
@@ -52,11 +52,12 @@ endif()
# SDL2
if (YUZU_USE_EXTERNAL_SDL2)
if (NOT WIN32)
- # Yuzu itself needs: Events Joystick Haptic Sensor Timers Audio
+ # Yuzu itself needs: Atomic Audio Events Joystick Haptic Sensor Threads Timers
+ # Since 2.0.18 Atomic+Threads required for HIDAPI/libusb (see https://github.com/libsdl-org/SDL/issues/5095)
# Yuzu-cmd also needs: Video (depends on Loadso/Dlopen)
set(SDL_UNUSED_SUBSYSTEMS
- Atomic Render Power Threads
- File CPUinfo Filesystem Locale)
+ CPUinfo File Filesystem
+ Locale Power Render)
foreach(_SUB ${SDL_UNUSED_SUBSYSTEMS})
string(TOUPPER ${_SUB} _OPT)
option(SDL_${_OPT} "" OFF)
@@ -121,3 +122,12 @@ if (NOT opus_FOUND)
message(STATUS "opus 1.3 or newer not found, falling back to externals")
add_subdirectory(opus EXCLUDE_FROM_ALL)
endif()
+
+# FFMpeg
+if (YUZU_USE_BUNDLED_FFMPEG)
+ add_subdirectory(ffmpeg)
+ set(FFmpeg_PATH "${FFmpeg_PATH}" PARENT_SCOPE)
+ set(FFmpeg_LDFLAGS "${FFmpeg_LDFLAGS}" PARENT_SCOPE)
+ set(FFmpeg_LIBRARIES "${FFmpeg_LIBRARIES}" PARENT_SCOPE)
+ set(FFmpeg_INCLUDE_DIR "${FFmpeg_INCLUDE_DIR}" PARENT_SCOPE)
+endif()
diff --git a/externals/SDL b/externals/SDL
-Subproject 2e9821423a237a1206e3c09020778faacfe430b
+Subproject e2ade2bfc46d915cd306c63c830b81d800b2575
diff --git a/externals/ffmpeg b/externals/ffmpeg
deleted file mode 160000
-Subproject 79e8d17024e6c6328a40fcee191ffd70798a9c6
diff --git a/externals/ffmpeg/CMakeLists.txt b/externals/ffmpeg/CMakeLists.txt
new file mode 100644
index 000000000..c57b54f77
--- /dev/null
+++ b/externals/ffmpeg/CMakeLists.txt
@@ -0,0 +1,214 @@
+if (NOT WIN32)
+ # Build FFmpeg from externals
+ message(STATUS "Using FFmpeg from externals")
+
+ if (CMAKE_SYSTEM_PROCESSOR MATCHES "(x86_64|amd64)")
+ # FFmpeg has source that requires one of nasm or yasm to assemble it.
+ # REQUIRED throws an error if not found here during configuration rather than during compilation.
+ find_program(ASSEMBLER NAMES nasm yasm)
+ if ("${ASSEMBLER}" STREQUAL "ASSEMBLER-NOTFOUND")
+ message(FATAL_ERROR "One of either `nasm` or `yasm` not found but is required.")
+ endif()
+ endif()
+
+ find_program(AUTOCONF autoconf)
+ if ("${AUTOCONF}" STREQUAL "AUTOCONF-NOTFOUND")
+ message(FATAL_ERROR "Required program `autoconf` not found.")
+ endif()
+
+ set(FFmpeg_PREFIX ${PROJECT_SOURCE_DIR}/externals/ffmpeg/ffmpeg)
+ set(FFmpeg_BUILD_DIR ${PROJECT_BINARY_DIR}/externals/ffmpeg-build)
+ set(FFmpeg_MAKEFILE ${FFmpeg_BUILD_DIR}/Makefile)
+ make_directory(${FFmpeg_BUILD_DIR})
+
+ # Read version string from external
+ file(READ ${FFmpeg_PREFIX}/RELEASE FFmpeg_VERSION)
+ set(FFmpeg_FOUND NO)
+ if (NOT FFmpeg_VERSION STREQUAL "")
+ set(FFmpeg_FOUND YES)
+ endif()
+
+ unset(FFmpeg_LIBRARIES CACHE)
+ foreach(COMPONENT ${FFmpeg_COMPONENTS})
+ set(FFmpeg_${COMPONENT}_PREFIX "${FFmpeg_BUILD_DIR}/lib${COMPONENT}")
+ set(FFmpeg_${COMPONENT}_LIB_NAME "lib${COMPONENT}.a")
+ set(FFmpeg_${COMPONENT}_LIBRARY "${FFmpeg_${COMPONENT}_PREFIX}/${FFmpeg_${COMPONENT}_LIB_NAME}")
+
+ set(FFmpeg_LIBRARIES
+ ${FFmpeg_LIBRARIES}
+ ${FFmpeg_${COMPONENT}_LIBRARY}
+ CACHE PATH "Paths to FFmpeg libraries" FORCE)
+ endforeach()
+
+ Include(FindPkgConfig REQUIRED)
+ pkg_check_modules(LIBVA libva)
+ pkg_check_modules(CUDA cuda)
+ pkg_check_modules(FFNVCODEC ffnvcodec)
+ pkg_check_modules(VDPAU vdpau)
+
+ set(FFmpeg_HWACCEL_LIBRARIES)
+ set(FFmpeg_HWACCEL_FLAGS)
+ set(FFmpeg_HWACCEL_INCLUDE_DIRS)
+ set(FFmpeg_HWACCEL_LDFLAGS)
+
+ if(LIBVA_FOUND)
+ pkg_check_modules(LIBDRM libdrm REQUIRED)
+ find_package(X11 REQUIRED)
+ pkg_check_modules(LIBVA-DRM libva-drm REQUIRED)
+ pkg_check_modules(LIBVA-X11 libva-x11 REQUIRED)
+ list(APPEND FFmpeg_HWACCEL_LIBRARIES
+ ${LIBDRM_LIBRARIES}
+ ${X11_LIBRARIES}
+ ${LIBVA-DRM_LIBRARIES}
+ ${LIBVA-X11_LIBRARIES}
+ ${LIBVA_LIBRARIES})
+ set(FFmpeg_HWACCEL_FLAGS
+ --enable-hwaccel=h264_vaapi
+ --enable-hwaccel=vp8_vaapi
+ --enable-hwaccel=vp9_vaapi
+ --enable-libdrm)
+ list(APPEND FFmpeg_HWACCEL_INCLUDE_DIRS
+ ${LIBDRM_INCLUDE_DIRS}
+ ${X11_INCLUDE_DIRS}
+ ${LIBVA-DRM_INCLUDE_DIRS}
+ ${LIBVA-X11_INCLUDE_DIRS}
+ ${LIBVA_INCLUDE_DIRS}
+ )
+ message(STATUS "VA-API found")
+ else()
+ set(FFmpeg_HWACCEL_FLAGS --disable-vaapi)
+ endif()
+
+ if (FFNVCODEC_FOUND)
+ list(APPEND FFmpeg_HWACCEL_FLAGS
+ --enable-cuvid
+ --enable-ffnvcodec
+ --enable-nvdec
+ --enable-hwaccel=h264_nvdec
+ --enable-hwaccel=vp8_nvdec
+ --enable-hwaccel=vp9_nvdec
+ )
+ list(APPEND FFmpeg_HWACCEL_LIBRARIES ${FFNVCODEC_LIBRARIES})
+ list(APPEND FFmpeg_HWACCEL_INCLUDE_DIRS ${FFNVCODEC_INCLUDE_DIRS})
+ list(APPEND FFmpeg_HWACCEL_LDFLAGS ${FFNVCODEC_LDFLAGS})
+ message(STATUS "ffnvcodec libraries version ${FFNVCODEC_VERSION} found")
+ # ffnvenc could load CUDA libraries at the runtime using dlopen/dlsym or LoadLibrary/GetProcAddress
+ # here we handle the hard-linking senario where CUDA is linked during compilation
+ if (CUDA_FOUND)
+ list(APPEND FFmpeg_HWACCEL_FLAGS --extra-cflags=-I${CUDA_INCLUDE_DIRS})
+ list(APPEND FFmpeg_HWACCEL_LIBRARIES ${CUDA_LIBRARIES})
+ list(APPEND FFmpeg_HWACCEL_INCLUDE_DIRS ${CUDA_INCLUDE_DIRS})
+ list(APPEND FFmpeg_HWACCEL_LDFLAGS ${CUDA_LDFLAGS})
+ message(STATUS "CUDA libraries found, hard-linking will be performed")
+ endif(CUDA_FOUND)
+ endif()
+
+ if (VDPAU_FOUND)
+ list(APPEND FFmpeg_HWACCEL_FLAGS
+ --enable-vdpau
+ --enable-hwaccel=h264_vdpau
+ --enable-hwaccel=vp9_vdpau
+ )
+ list(APPEND FFmpeg_HWACCEL_LIBRARIES ${VDPAU_LIBRARIES})
+ list(APPEND FFmpeg_HWACCEL_INCLUDE_DIRS ${VDPAU_INCLUDE_DIRS})
+ list(APPEND FFmpeg_HWACCEL_LDFLAGS ${VDPAU_LDFLAGS})
+ message(STATUS "vdpau libraries version ${VDPAU_VERSION} found")
+ else()
+ list(APPEND FFmpeg_HWACCEL_FLAGS --disable-vdpau)
+ endif()
+
+ # `configure` parameters builds only exactly what yuzu needs from FFmpeg
+ # `--disable-vdpau` is needed to avoid linking issues
+ add_custom_command(
+ OUTPUT
+ ${FFmpeg_MAKEFILE}
+ COMMAND
+ /bin/bash ${FFmpeg_PREFIX}/configure
+ --disable-avdevice
+ --disable-avfilter
+ --disable-avformat
+ --disable-doc
+ --disable-everything
+ --disable-ffmpeg
+ --disable-ffprobe
+ --disable-network
+ --disable-postproc
+ --disable-swresample
+ --enable-decoder=h264
+ --enable-decoder=vp8
+ --enable-decoder=vp9
+ --cc="${CMAKE_C_COMPILER}"
+ --cxx="${CMAKE_CXX_COMPILER}"
+ ${FFmpeg_HWACCEL_FLAGS}
+ WORKING_DIRECTORY
+ ${FFmpeg_BUILD_DIR}
+ )
+ unset(FFmpeg_HWACCEL_FLAGS)
+
+ # Workaround for Ubuntu 18.04's older version of make not being able to call make as a child
+ # with context of the jobserver. Also helps ninja users.
+ execute_process(
+ COMMAND
+ nproc
+ OUTPUT_VARIABLE
+ SYSTEM_THREADS)
+
+ set(FFmpeg_BUILD_LIBRARIES ${FFmpeg_LIBRARIES})
+ add_custom_command(
+ OUTPUT
+ ${FFmpeg_BUILD_LIBRARIES}
+ COMMAND
+ make -j${SYSTEM_THREADS}
+ WORKING_DIRECTORY
+ ${FFmpeg_BUILD_DIR}
+ )
+
+ set(FFmpeg_INCLUDE_DIR
+ "${FFmpeg_PREFIX};${FFmpeg_BUILD_DIR};${FFmpeg_HWACCEL_INCLUDE_DIRS}"
+ CACHE PATH "Path to FFmpeg headers" FORCE)
+
+ set(FFmpeg_LDFLAGS
+ "${FFmpeg_HWACCEL_LDFLAGS}"
+ CACHE STRING "FFmpeg linker flags" FORCE)
+
+ # ALL makes this custom target build every time
+ # but it won't actually build if the DEPENDS parameter is up to date
+ add_custom_target(ffmpeg-configure ALL DEPENDS ${FFmpeg_MAKEFILE})
+ add_custom_target(ffmpeg-build ALL DEPENDS ${FFmpeg_BUILD_LIBRARIES} ffmpeg-configure)
+ link_libraries(${FFmpeg_LIBVA_LIBRARIES})
+ set(FFmpeg_LIBRARIES ${FFmpeg_BUILD_LIBRARIES} ${FFmpeg_HWACCEL_LIBRARIES}
+ CACHE PATH "Paths to FFmpeg libraries" FORCE)
+ unset(FFmpeg_BUILD_LIBRARIES)
+ unset(FFmpeg_HWACCEL_FLAGS)
+ unset(FFmpeg_HWACCEL_INCLUDE_DIRS)
+ unset(FFmpeg_HWACCEL_LDFLAGS)
+ unset(FFmpeg_HWACCEL_LIBRARIES)
+
+ if (FFmpeg_FOUND)
+ message(STATUS "Found FFmpeg version ${FFmpeg_VERSION}")
+ else()
+ message(FATAL_ERROR "FFmpeg not found")
+ endif()
+else(WIN32)
+ # Use yuzu FFmpeg binaries
+ set(FFmpeg_EXT_NAME "ffmpeg-4.4")
+ set(FFmpeg_PATH "${CMAKE_BINARY_DIR}/externals/${FFmpeg_EXT_NAME}")
+ download_bundled_external("ffmpeg/" ${FFmpeg_EXT_NAME} "")
+ set(FFmpeg_FOUND YES)
+ set(FFmpeg_INCLUDE_DIR "${FFmpeg_PATH}/include" CACHE PATH "Path to FFmpeg headers" FORCE)
+ set(FFmpeg_LIBRARY_DIR "${FFmpeg_PATH}/bin" CACHE PATH "Path to FFmpeg library directory" FORCE)
+ set(FFmpeg_LDFLAGS "" CACHE STRING "FFmpeg linker flags" FORCE)
+ set(FFmpeg_DLL_DIR "${FFmpeg_PATH}/bin" CACHE PATH "Path to FFmpeg dll's" FORCE)
+ set(FFmpeg_LIBRARIES
+ ${FFmpeg_LIBRARY_DIR}/swscale.lib
+ ${FFmpeg_LIBRARY_DIR}/avcodec.lib
+ ${FFmpeg_LIBRARY_DIR}/avutil.lib
+ CACHE PATH "Paths to FFmpeg libraries" FORCE)
+ # exported variables
+ set(FFmpeg_PATH "${FFmpeg_PATH}" PARENT_SCOPE)
+ set(FFmpeg_LDFLAGS "${FFmpeg_LDFLAGS}" PARENT_SCOPE)
+ set(FFmpeg_LIBRARIES "${FFmpeg_LIBRARIES}" PARENT_SCOPE)
+ set(FFmpeg_INCLUDE_DIR "${FFmpeg_INCLUDE_DIR}" PARENT_SCOPE)
+endif(WIN32)
+
+unset(FFmpeg_COMPONENTS)
diff --git a/externals/ffmpeg/ffmpeg b/externals/ffmpeg/ffmpeg
new file mode 160000
+Subproject dc91b913b6260e85e1304c74ff7bb3c22a8c9fb
diff --git a/src/input_common/drivers/udp_client.cpp b/src/input_common/drivers/udp_client.cpp
index 4ab991a7d..a1ce4525d 100644
--- a/src/input_common/drivers/udp_client.cpp
+++ b/src/input_common/drivers/udp_client.cpp
@@ -536,42 +536,46 @@ CalibrationConfigurationJob::CalibrationConfigurationJob(
std::function<void(u16, u16, u16, u16)> data_callback) {
std::thread([=, this] {
+ u16 min_x{UINT16_MAX};
+ u16 min_y{UINT16_MAX};
+ u16 max_x{};
+ u16 max_y{};
+
Status current_status{Status::Initialized};
- SocketCallback callback{
- [](Response::Version) {}, [](Response::PortInfo) {},
- [&](Response::PadData data) {
- static constexpr u16 CALIBRATION_THRESHOLD = 100;
- static constexpr u16 MAX_VALUE = UINT16_MAX;
-
- if (current_status == Status::Initialized) {
- // Receiving data means the communication is ready now
- current_status = Status::Ready;
- status_callback(current_status);
- }
- const auto& touchpad_0 = data.touch[0];
- if (touchpad_0.is_active == 0) {
- return;
- }
- LOG_DEBUG(Input, "Current touch: {} {}", touchpad_0.x, touchpad_0.y);
- const u16 min_x = std::min(MAX_VALUE, static_cast<u16>(touchpad_0.x));
- const u16 min_y = std::min(MAX_VALUE, static_cast<u16>(touchpad_0.y));
- if (current_status == Status::Ready) {
- // First touch - min data (min_x/min_y)
- current_status = Status::Stage1Completed;
- status_callback(current_status);
- }
- if (touchpad_0.x - min_x > CALIBRATION_THRESHOLD &&
- touchpad_0.y - min_y > CALIBRATION_THRESHOLD) {
- // Set the current position as max value and finishes configuration
- const u16 max_x = touchpad_0.x;
- const u16 max_y = touchpad_0.y;
- current_status = Status::Completed;
- data_callback(min_x, min_y, max_x, max_y);
- status_callback(current_status);
-
- complete_event.Set();
- }
- }};
+ SocketCallback callback{[](Response::Version) {}, [](Response::PortInfo) {},
+ [&](Response::PadData data) {
+ constexpr u16 CALIBRATION_THRESHOLD = 100;
+
+ if (current_status == Status::Initialized) {
+ // Receiving data means the communication is ready now
+ current_status = Status::Ready;
+ status_callback(current_status);
+ }
+ if (data.touch[0].is_active == 0) {
+ return;
+ }
+ LOG_DEBUG(Input, "Current touch: {} {}", data.touch[0].x,
+ data.touch[0].y);
+ min_x = std::min(min_x, static_cast<u16>(data.touch[0].x));
+ min_y = std::min(min_y, static_cast<u16>(data.touch[0].y));
+ if (current_status == Status::Ready) {
+ // First touch - min data (min_x/min_y)
+ current_status = Status::Stage1Completed;
+ status_callback(current_status);
+ }
+ if (data.touch[0].x - min_x > CALIBRATION_THRESHOLD &&
+ data.touch[0].y - min_y > CALIBRATION_THRESHOLD) {
+ // Set the current position as max value and finishes
+ // configuration
+ max_x = data.touch[0].x;
+ max_y = data.touch[0].y;
+ current_status = Status::Completed;
+ data_callback(min_x, min_y, max_x, max_y);
+ status_callback(current_status);
+
+ complete_event.Set();
+ }
+ }};
Socket socket{host, port, std::move(callback)};
std::thread worker_thread{SocketLoop, &socket};
complete_event.Wait();
diff --git a/src/input_common/helpers/udp_protocol.h b/src/input_common/helpers/udp_protocol.h
index bcba12c58..2d5d54ddb 100644
--- a/src/input_common/helpers/udp_protocol.h
+++ b/src/input_common/helpers/udp_protocol.h
@@ -54,6 +54,18 @@ struct Message {
template <typename T>
constexpr Type GetMessageType();
+template <typename T>
+Message<T> CreateMessage(const u32 magic, const T data, const u32 sender_id) {
+ boost::crc_32_type crc;
+ Header header{
+ magic, PROTOCOL_VERSION, sizeof(T) + sizeof(Type), 0, sender_id, GetMessageType<T>(),
+ };
+ Message<T> message{header, data};
+ crc.process_bytes(&message, sizeof(Message<T>));
+ message.header.crc = crc.checksum();
+ return message;
+}
+
namespace Request {
enum RegisterFlags : u8 {
@@ -101,14 +113,7 @@ static_assert(std::is_trivially_copyable_v<PadData>,
*/
template <typename T>
Message<T> Create(const T data, const u32 client_id = 0) {
- boost::crc_32_type crc;
- Header header{
- CLIENT_MAGIC, PROTOCOL_VERSION, sizeof(T) + sizeof(Type), 0, client_id, GetMessageType<T>(),
- };
- Message<T> message{header, data};
- crc.process_bytes(&message, sizeof(Message<T>));
- message.header.crc = crc.checksum();
- return message;
+ return CreateMessage(CLIENT_MAGIC, data, client_id);
}
} // namespace Request
diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt
index c4c012f3d..4a20c0768 100644
--- a/src/tests/CMakeLists.txt
+++ b/src/tests/CMakeLists.txt
@@ -10,11 +10,12 @@ add_executable(tests
core/network/network.cpp
tests.cpp
video_core/buffer_base.cpp
+ input_common/calibration_configuration_job.cpp
)
create_target_directory_groups(tests)
-target_link_libraries(tests PRIVATE common core)
+target_link_libraries(tests PRIVATE common core input_common)
target_link_libraries(tests PRIVATE ${PLATFORM_LIBRARIES} catch-single-include Threads::Threads)
add_test(NAME tests COMMAND tests)
diff --git a/src/tests/input_common/calibration_configuration_job.cpp b/src/tests/input_common/calibration_configuration_job.cpp
new file mode 100644
index 000000000..8c77d81e9
--- /dev/null
+++ b/src/tests/input_common/calibration_configuration_job.cpp
@@ -0,0 +1,136 @@
+// Copyright 2020 yuzu Emulator Project
+// Licensed under GPLv2 or any later version
+// Refer to the license.txt file included.
+
+#include <array>
+#include <string>
+#include <thread>
+#include <boost/asio.hpp>
+#include <boost/crc.hpp>
+#include <catch2/catch.hpp>
+
+#include "input_common/drivers/udp_client.h"
+#include "input_common/helpers/udp_protocol.h"
+
+class FakeCemuhookServer {
+public:
+ FakeCemuhookServer()
+ : socket(io_service, boost::asio::ip::udp::endpoint(boost::asio::ip::udp::v4(), 0)) {}
+
+ ~FakeCemuhookServer() {
+ is_running = false;
+ boost::system::error_code error_code;
+ socket.shutdown(boost::asio::socket_base::shutdown_both, error_code);
+ socket.close();
+ if (handler.joinable()) {
+ handler.join();
+ }
+ }
+
+ u16 GetPort() {
+ return socket.local_endpoint().port();
+ }
+
+ std::string GetHost() {
+ return socket.local_endpoint().address().to_string();
+ }
+
+ void Run(const std::vector<InputCommon::CemuhookUDP::Response::TouchPad> touch_movement_path) {
+ constexpr size_t HeaderSize = sizeof(InputCommon::CemuhookUDP::Header);
+ constexpr size_t PadDataSize =
+ sizeof(InputCommon::CemuhookUDP::Message<InputCommon::CemuhookUDP::Response::PadData>);
+
+ REQUIRE(touch_movement_path.size() > 0);
+ is_running = true;
+ handler = std::thread([touch_movement_path, this]() {
+ auto current_touch_position = touch_movement_path.begin();
+ while (is_running) {
+ boost::asio::ip::udp::endpoint sender_endpoint;
+ boost::system::error_code error_code;
+ auto received_size = socket.receive_from(boost::asio::buffer(receive_buffer),
+ sender_endpoint, 0, error_code);
+
+ if (received_size < HeaderSize) {
+ continue;
+ }
+
+ InputCommon::CemuhookUDP::Header header{};
+ std::memcpy(&header, receive_buffer.data(), HeaderSize);
+ switch (header.type) {
+ case InputCommon::CemuhookUDP::Type::PadData: {
+ InputCommon::CemuhookUDP::Response::PadData pad_data{};
+ pad_data.touch[0] = *current_touch_position;
+ const auto pad_message = InputCommon::CemuhookUDP::CreateMessage(
+ InputCommon::CemuhookUDP::SERVER_MAGIC, pad_data, 0);
+ std::memcpy(send_buffer.data(), &pad_message, PadDataSize);
+ socket.send_to(boost::asio::buffer(send_buffer, PadDataSize), sender_endpoint,
+ 0, error_code);
+
+ bool can_advance =
+ std::next(current_touch_position) != touch_movement_path.end();
+ if (can_advance) {
+ std::advance(current_touch_position, 1);
+ }
+ break;
+ }
+ case InputCommon::CemuhookUDP::Type::PortInfo:
+ case InputCommon::CemuhookUDP::Type::Version:
+ default:
+ break;
+ }
+ }
+ });
+ }
+
+private:
+ boost::asio::io_service io_service;
+ boost::asio::ip::udp::socket socket;
+ std::array<u8, InputCommon::CemuhookUDP::MAX_PACKET_SIZE> send_buffer;
+ std::array<u8, InputCommon::CemuhookUDP::MAX_PACKET_SIZE> receive_buffer;
+ bool is_running = false;
+ std::thread handler;
+};
+
+TEST_CASE("CalibrationConfigurationJob completed", "[input_common]") {
+ Common::Event complete_event;
+ FakeCemuhookServer server;
+ server.Run({{
+ .is_active = 1,
+ .x = 0,
+ .y = 0,
+ },
+ {
+ .is_active = 1,
+ .x = 200,
+ .y = 200,
+ }});
+
+ InputCommon::CemuhookUDP::CalibrationConfigurationJob::Status status{};
+ u16 min_x{};
+ u16 min_y{};
+ u16 max_x{};
+ u16 max_y{};
+ InputCommon::CemuhookUDP::CalibrationConfigurationJob job(
+ server.GetHost(), server.GetPort(),
+ [&status,
+ &complete_event](InputCommon::CemuhookUDP::CalibrationConfigurationJob::Status status_) {
+ status = status_;
+ if (status ==
+ InputCommon::CemuhookUDP::CalibrationConfigurationJob::Status::Completed) {
+ complete_event.Set();
+ }
+ },
+ [&](u16 min_x_, u16 min_y_, u16 max_x_, u16 max_y_) {
+ min_x = min_x_;
+ min_y = min_y_;
+ max_x = max_x_;
+ max_y = max_y_;
+ });
+
+ complete_event.WaitUntil(std::chrono::system_clock::now() + std::chrono::seconds(10));
+ REQUIRE(status == InputCommon::CemuhookUDP::CalibrationConfigurationJob::Status::Completed);
+ REQUIRE(min_x == 0);
+ REQUIRE(min_y == 0);
+ REQUIRE(max_x == 200);
+ REQUIRE(max_y == 200);
+}
diff --git a/src/video_core/command_classes/codecs/codec.cpp b/src/video_core/command_classes/codecs/codec.cpp
index 2a532b883..868b82f9b 100644
--- a/src/video_core/command_classes/codecs/codec.cpp
+++ b/src/video_core/command_classes/codecs/codec.cpp
@@ -130,6 +130,12 @@ bool Codec::CreateGpuAvDevice() {
}
if (config->methods & HW_CONFIG_METHOD && config->device_type == type) {
av_codec_ctx->pix_fmt = config->pix_fmt;
+ if (config->methods & AV_CODEC_HW_CONFIG_METHOD_HW_FRAMES_CTX) {
+ // skip zero-copy decoders, we don't currently support them
+ LOG_DEBUG(Service_NVDRV, "Skipping decoder {} with unsupported capability {}.",
+ av_hwdevice_get_type_name(type), config->methods);
+ continue;
+ }
LOG_INFO(Service_NVDRV, "Using {} GPU decoder", av_hwdevice_get_type_name(type));
return true;
}