From bebd946527303fe36fd5170d7398e51c1ae990a2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marcin=20Zaj=C4=85c?= Date: Fri, 23 Dec 2022 16:13:48 +0100 Subject: [PATCH] Vulkan video only for windows and linux Currently vulkan video is only part of the linux and windows platforms. The video module is therefore completely excluded from the compilation target on every other platform, and ffmpeg external library will not be downloaded by fetch_sources.py script. Affect tests: * dEQP-VK.video.* Components: Framework, Vulkan VK-GL-CTS issue: 4185 Change-Id: I24c9c3c9f2a9853a3db47028bececa9f96d592ad --- CMakeLists.txt | 5 +++-- external/fetch_sources.py | 21 ++++++++++++--------- external/vulkancts/framework/vulkan/vkPlatform.hpp | 6 +++--- external/vulkancts/modules/vulkan/CMakeLists.txt | 20 +++++--------------- .../modules/vulkan/api/vktApiVersionCheck.cpp | 6 +++--- .../vulkancts/modules/vulkan/video/CMakeLists.txt | 12 ++++++++---- .../modules/vulkan/video/vktVideoDecodeTests.cpp | 19 ++++++++++--------- .../modules/vulkan/video/vktVideoSessionNvUtils.cpp | 6 +++--- .../vulkancts/modules/vulkan/vktTestPackage.cpp | 8 ++++---- external/vulkancts/vkscpc/vkscpc.cpp | 4 ++++ external/vulkancts/vkscserver/vksServices.cpp | 4 ++++ 11 files changed, 59 insertions(+), 52 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5bd963b..1ff2bb9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -116,8 +116,9 @@ include_directories(external/jsoncpp/src/include) # RenderDoc API include_directories(external/renderdoc/src) -# FFmpeg used in vulkan video won't be part of android target -if (NOT DE_OS_IS_ANDROID) +# FFmpeg used in vulkan video won't be part of android, fushia, or macos target +if (DE_OS_IS_WIN32 OR DE_OS_IS_UNIX) + # FFmpeg if (DE_OS_IS_WIN32) add_subdirectory(external/ffmpeg) endif() diff --git a/external/fetch_sources.py b/external/fetch_sources.py index f70ba0a..3780af7 100644 --- a/external/fetch_sources.py +++ b/external/fetch_sources.py @@ -66,19 +66,22 @@ class SourcePackage (Source): self.checksum = checksum self.archiveDir = "packages" self.postExtract = postExtract + self.sysNdx = {"Windows":0, "Linux":1, "Darwin":2}[platform.system()] + self.FFmpeg = "FFmpeg" in url def clean (self): Source.clean(self) self.removeArchives() def update (self, cmdProtocol = None, force = False): - if not self.isArchiveUpToDate(): - self.fetchAndVerifyArchive() + if self.sysNdx != 2: + if not self.isArchiveUpToDate(): + self.fetchAndVerifyArchive() - if self.getExtractedChecksum() != self.checksum: - Source.clean(self) - self.extract() - self.storeExtractedChecksum(self.checksum) + if self.getExtractedChecksum() != self.checksum: + Source.clean(self) + self.extract() + self.storeExtractedChecksum(self.checksum) def removeArchives (self): archiveDir = os.path.join(EXTERNAL_DIR, pkg.baseDir, pkg.archiveDir) @@ -295,8 +298,8 @@ PACKAGES = [ "libpng", postExtract = postExtractLibpng), SourcePackage( - {"Windows":"https://github.com/BtbN/FFmpeg-Builds/releases/download/autobuild-2022-05-31-12-34/ffmpeg-n4.4.2-1-g8e98dfc57f-win64-lgpl-shared-4.4.zip", "Linux": "https://github.com/BtbN/FFmpeg-Builds/releases/download/autobuild-2022-05-31-12-34/ffmpeg-n4.4.2-1-g8e98dfc57f-linux64-gpl-shared-4.4.tar.xz"}[platform.system()], - {"Windows":"670df8e9d2ddd5e761459b3538f64b8826566270ef1ed13bcbfc63e73aab3fd9","Linux":"817f8c93ff1ef7ede3dad15b20415d5e366bcd6848844d55046111fd3de827d0"}[platform.system()], + {"Windows":"https://github.com/BtbN/FFmpeg-Builds/releases/download/autobuild-2022-05-31-12-34/ffmpeg-n4.4.2-1-g8e98dfc57f-win64-lgpl-shared-4.4.zip", "Linux": "https://github.com/BtbN/FFmpeg-Builds/releases/download/autobuild-2022-05-31-12-34/ffmpeg-n4.4.2-1-g8e98dfc57f-linux64-gpl-shared-4.4.tar.xz", "Darwin":""}[platform.system()], + {"Windows":"670df8e9d2ddd5e761459b3538f64b8826566270ef1ed13bcbfc63e73aab3fd9","Linux":"817f8c93ff1ef7ede3dad15b20415d5e366bcd6848844d55046111fd3de827d0", "Darwin":""}[platform.system()], "ffmpeg"), SourceFile( "https://raw.githubusercontent.com/baldurk/renderdoc/v1.1/renderdoc/api/app/renderdoc_app.h", @@ -388,7 +391,7 @@ def run(*popenargs, **kwargs): if __name__ == "__main__": # Rerun script with python3 as python2 does not have lzma (xz) decompression support if sys.version_info < (3, 0): - cmd = {"Windows": ['py', '-3'], "Linux": ['python3']}[platform.system()] + cmd = {"Windows": ['py', '-3'], "Linux": ['python3'], "Darwin": ['python3']}[platform.system()] cmd = cmd + sys.argv run(cmd) else: diff --git a/external/vulkancts/framework/vulkan/vkPlatform.hpp b/external/vulkancts/framework/vulkan/vkPlatform.hpp index 77ab2c4..bec39d3 100644 --- a/external/vulkancts/framework/vulkan/vkPlatform.hpp +++ b/external/vulkancts/framework/vulkan/vkPlatform.hpp @@ -399,10 +399,10 @@ public: Platform (void) {} ~Platform (void) {} -#if (DE_OS == DE_OS_ANDROID) - virtual Library* createLibrary (const char* libraryPath = DE_NULL) const = 0; -#else +#if (DE_OS == DE_OS_WIN32) || (DE_OS == DE_OS_UNIX) virtual Library* createLibrary (LibraryType libraryType = LIBRARY_TYPE_VULKAN, const char* libraryPath = DE_NULL) const = 0; +#else + virtual Library* createLibrary (const char* libraryPath = DE_NULL) const = 0; #endif virtual wsi::Display* createWsiDisplay (wsi::Type wsiType) const; diff --git a/external/vulkancts/modules/vulkan/CMakeLists.txt b/external/vulkancts/modules/vulkan/CMakeLists.txt index eade987..845465d 100644 --- a/external/vulkancts/modules/vulkan/CMakeLists.txt +++ b/external/vulkancts/modules/vulkan/CMakeLists.txt @@ -98,9 +98,9 @@ include_directories( reconvergence mesh_shader fragment_shading_barycentric + video ${DEQP_INL_DIR} sc - video ) set(DEQP_VK_SRCS @@ -173,7 +173,6 @@ set(DEQP_VK_LIBS deqp-vk-video ) - set(DEQP_VKSC_LIBS tcutil vkscutil @@ -253,22 +252,13 @@ ENDFOREACH() set(BINARY_COPY_DIR "./") -if (DE_OS_IS_WIN32) - add_data_dir(deqp-vk ../../../ffmpeg/src/bin ${BINARY_COPY_DIR}) -endif() - # Video parser used in vulkan video won't be part of android target -if (NOT DE_OS_IS_ANDROID) - if (DE_OS_IS_WIN32) - add_data_dir(deqp-vk ../../../video-parser/src/vk_video_decoder/bin/libs/nv_vkvideo_parser/wddm2_amd64_release ${BINARY_COPY_DIR}) - elseif(DE_OS_IS_UNIX) - add_data_dir(deqp-vk ../../../video-parser/src/vk_video_decoder/bin/libs/nv_vkvideo_parser/linux_amd64_release ${BINARY_COPY_DIR}) - else() - message(FATAL_ERROR "System is not supported") - endif() +if (DE_OS_IS_WIN32) + add_data_dir(deqp-vk ../../../video-parser/src/vk_video_decoder/bin/libs/nv_vkvideo_parser/wddm2_amd64_release ${BINARY_COPY_DIR}) +elseif(DE_OS_IS_UNIX) + add_data_dir(deqp-vk ../../../video-parser/src/vk_video_decoder/bin/libs/nv_vkvideo_parser/linux_amd64_release ${BINARY_COPY_DIR}) endif() - if (DE_OS_IS_WIN32 OR DE_OS_IS_UNIX OR DE_OS_IS_OSX) add_executable(vk-build-programs vktBuildPrograms.cpp) target_link_libraries(vk-build-programs deqp-vk${MODULE_LIB_TARGET_POSTFIX}) diff --git a/external/vulkancts/modules/vulkan/api/vktApiVersionCheck.cpp b/external/vulkancts/modules/vulkan/api/vktApiVersionCheck.cpp index 1498e93..5f6d884 100644 --- a/external/vulkancts/modules/vulkan/api/vktApiVersionCheck.cpp +++ b/external/vulkancts/modules/vulkan/api/vktApiVersionCheck.cpp @@ -133,10 +133,10 @@ public: tcu::TestLog& log = m_context.getTestContext().getLog(); const deUint32 apiVersion = m_context.getUsedApiVersion(); const vk::Platform& platform = m_context.getTestContext().getPlatform().getVulkanPlatform(); -#if (DE_OS == DE_OS_ANDROID) - de::MovePtr vkLibrary = de::MovePtr(platform.createLibrary(m_context.getTestContext().getCommandLine().getVkLibraryPath())); -#else +#if (DE_OS == DE_OS_WIN32) || (DE_OS == DE_OS_UNIX) de::MovePtr vkLibrary = de::MovePtr(platform.createLibrary(vk::Platform::LibraryType::LIBRARY_TYPE_VULKAN, m_context.getTestContext().getCommandLine().getVkLibraryPath())); +#else + de::MovePtr vkLibrary = de::MovePtr(platform.createLibrary(m_context.getTestContext().getCommandLine().getVkLibraryPath())); #endif const tcu::FunctionLibrary& funcLibrary = vkLibrary->getFunctionLibrary(); deUint32 failsQuantity = 0u; diff --git a/external/vulkancts/modules/vulkan/video/CMakeLists.txt b/external/vulkancts/modules/vulkan/video/CMakeLists.txt index 62b75bb..185e078 100644 --- a/external/vulkancts/modules/vulkan/video/CMakeLists.txt +++ b/external/vulkancts/modules/vulkan/video/CMakeLists.txt @@ -1,5 +1,8 @@ include_directories(..) -include_directories(${FFMPEG_INCLUDE_PATH}) +if (DE_OS_IS_WIN32 OR DE_OS_IS_UNIX) + include_directories(${FFMPEG_INCLUDE_PATH}) + add_compile_definitions(DE_BUILD_VIDEO) +endif() set(DEQP_VK_VIDEO_SRC_TARGET_DEPENDENT extFFmpegDemuxer.h @@ -25,13 +28,13 @@ set(DEQP_VK_VIDEO_SRCS_TARGET_INDEPENDENT vktVideoTests.hpp ) -if (DE_OS_IS_ANDROID) - set(DEQP_VK_VIDEO_SRCS ${DEQP_VK_VIDEO_SRCS_TARGET_INDEPENDENT}) - else() +if (DE_OS_IS_WIN32 OR DE_OS_IS_UNIX) set(DEQP_VK_VIDEO_SRCS ${DEQP_VK_VIDEO_SRC_TARGET_DEPENDENT} ${DEQP_VK_VIDEO_SRCS_TARGET_INDEPENDENT} ) +else() + set(DEQP_VK_VIDEO_SRCS ${DEQP_VK_VIDEO_SRCS_TARGET_INDEPENDENT}) endif() set(DEQP_VK_VIDEO_LIBS @@ -44,3 +47,4 @@ PCH(DEQP_VK_VIDEO_SRCS ../pch.cpp) add_library(deqp-vk-video STATIC ${DEQP_VK_VIDEO_SRCS}) target_link_libraries(deqp-vk-video ${DEQP_VK_VIDEO_LIBS}) + diff --git a/external/vulkancts/modules/vulkan/video/vktVideoDecodeTests.cpp b/external/vulkancts/modules/vulkan/video/vktVideoDecodeTests.cpp index b5989ac..6819089 100644 --- a/external/vulkancts/modules/vulkan/video/vktVideoDecodeTests.cpp +++ b/external/vulkancts/modules/vulkan/video/vktVideoDecodeTests.cpp @@ -33,6 +33,7 @@ #include "tcuFunctionLibrary.hpp" #include "tcuImageCompare.hpp" +#include #include "vkDefs.hpp" #include "vkBufferWithMemory.hpp" #include "vkImageWithMemory.hpp" @@ -44,10 +45,10 @@ #include "../ycbcr/vktYCbCrUtil.hpp" -#if (DE_OS != DE_OS_ANDROID) -#include "vktVideoSessionNvUtils.hpp" -#include "vktVideoSessionFfmpegUtils.hpp" -#include "vktVideoBaseDecodeUtils.hpp" +#ifdef DE_BUILD_VIDEO + #include "vktVideoSessionNvUtils.hpp" + #include "vktVideoSessionFfmpegUtils.hpp" + #include "vktVideoBaseDecodeUtils.hpp" #endif @@ -96,7 +97,7 @@ struct CaseDef // Vulkan video is not supported on android platform // all external libraries, helper functions and test instances has been excluded -#if (DE_OS != DE_OS_ANDROID) +#ifdef DE_BUILD_VIDEO DecodedFrame initDecodeFrame (void) { DecodedFrame frameTemplate = @@ -1075,7 +1076,7 @@ bool DualVideoDecodeTestInstance::verifyImage (bool firstClip, int32_t frameNumb return resultV && resultY && resultU; } -#endif // DE_OS != DE_OS_ANDROID +#endif // #ifdef DE_BUILD_VIDEO class VideoDecodeTestCase : public TestCase { public: @@ -1159,7 +1160,7 @@ TestInstance* VideoDecodeTestCase::createInstance (Context& context) const case TEST_TYPE_H265_DECODE_I_P_B_13: case TEST_TYPE_H265_DECODE_I_P_B_13_NOT_MATCHING_ORDER: { -#if (DE_OS != DE_OS_ANDROID) +#ifdef DE_BUILD_VIDEO return new VideoDecodeTestInstance(context, m_caseDef); #endif } @@ -1167,14 +1168,14 @@ TestInstance* VideoDecodeTestCase::createInstance (Context& context) const case TEST_TYPE_H264_BOTH_DECODE_ENCODE_INTERLEAVED: case TEST_TYPE_H264_H265_DECODE_INTERLEAVED: { -#if (DE_OS != DE_OS_ANDROID) +#ifdef DE_BUILD_VIDEO return new DualVideoDecodeTestInstance(context, m_caseDef); #endif } default: TCU_THROW(InternalError, "Unknown TestType"); } -#if (DE_OS == DE_OS_ANDROID) +#ifndef DE_BUILD_VIDEO DE_UNREF(context); #endif diff --git a/external/vulkancts/modules/vulkan/video/vktVideoSessionNvUtils.cpp b/external/vulkancts/modules/vulkan/video/vktVideoSessionNvUtils.cpp index 50ebefd..0049193 100644 --- a/external/vulkancts/modules/vulkan/video/vktVideoSessionNvUtils.cpp +++ b/external/vulkancts/modules/vulkan/video/vktVideoSessionNvUtils.cpp @@ -148,10 +148,10 @@ private: }; NvFunctions::NvFunctions (const vk::Platform& platform) -#if (DE_OS == DE_OS_ANDROID) - : m_library (de::MovePtr(platform.createLibrary())) -#else +#ifdef DE_BUILD_VIDEO : m_library (de::MovePtr(platform.createLibrary(vk::Platform::LIBRARY_TYPE_VULKAN_VIDEO_DECODE_PARSER, DE_NULL))) +#else + : m_library (de::MovePtr(platform.createLibrary())) #endif { const tcu::FunctionLibrary& funcsLibrary = m_library->getFunctionLibrary(); diff --git a/external/vulkancts/modules/vulkan/vktTestPackage.cpp b/external/vulkancts/modules/vulkan/vktTestPackage.cpp index 77b5356..959a9d3 100644 --- a/external/vulkancts/modules/vulkan/vktTestPackage.cpp +++ b/external/vulkancts/modules/vulkan/vktTestPackage.cpp @@ -117,10 +117,10 @@ #include "vktReconvergenceTests.hpp" #include "vktMeshShaderTests.hpp" #include "vktFragmentShadingBarycentricTests.hpp" +#include "vktVideoTests.hpp" #ifdef CTS_USES_VULKANSC #include "vktSafetyCriticalTests.hpp" #endif // CTS_USES_VULKANSC -#include "vktVideoTests.hpp" #include #include @@ -204,10 +204,10 @@ static void restoreStandardOutput () { qpRedirectOut(openWrite, open static MovePtr createLibrary (tcu::TestContext& testCtx) { -#if (DE_OS == DE_OS_ANDROID) - return MovePtr(testCtx.getPlatform().getVulkanPlatform().createLibrary(testCtx.getCommandLine().getVkLibraryPath())); -#else +#if (DE_OS == DE_OS_WIN32) || (DE_OS == DE_OS_UNIX) return MovePtr(testCtx.getPlatform().getVulkanPlatform().createLibrary(vk::Platform::LIBRARY_TYPE_VULKAN, testCtx.getCommandLine().getVkLibraryPath())); +#else + return MovePtr(testCtx.getPlatform().getVulkanPlatform().createLibrary(testCtx.getCommandLine().getVkLibraryPath())); #endif } diff --git a/external/vulkancts/vkscpc/vkscpc.cpp b/external/vulkancts/vkscpc/vkscpc.cpp index 1dc60fa..55b5665 100644 --- a/external/vulkancts/vkscpc/vkscpc.cpp +++ b/external/vulkancts/vkscpc/vkscpc.cpp @@ -288,7 +288,11 @@ int main (int argc, char** argv) tcu::DirArchive archive {""}; tcu::TestLog log { cmdLine.getOption().c_str() }; log.supressLogging(true); de::SharedPtr platform {createPlatform()}; +#if (DE_OS == DE_OS_WIN32) || (DE_OS == DE_OS_UNIX) de::SharedPtr library {platform->getVulkanPlatform().createLibrary(vk::Platform::LIBRARY_TYPE_VULKAN, DE_NULL)}; +#else + de::SharedPtr library {platform->getVulkanPlatform().createLibrary(DE_NULL)}; +#endif tcu::TestContext tcx {*platform, archive, log, cmdLineDummy, nullptr}; vk::BinaryCollection collection {}; vkt::Context context (tcx, library->getPlatformInterface(), collection, de::SharedPtr{new vk::ResourceInterfaceStandard{ tcx }}); diff --git a/external/vulkancts/vkscserver/vksServices.cpp b/external/vulkancts/vkscserver/vksServices.cpp index 0b4850b..461c7a3 100644 --- a/external/vulkancts/vkscserver/vksServices.cpp +++ b/external/vulkancts/vkscserver/vksServices.cpp @@ -163,7 +163,11 @@ VkscServer* createServerVKSC(const std::string& logFile) tcu::DirArchive archive {""}; tcu::TestLog log { logFile.c_str() }; log.supressLogging(true); tcu::Platform* platform {createPlatform()}; +#if (DE_OS == DE_OS_WIN32) || (DE_OS == DE_OS_UNIX) vk::Library* library {platform->getVulkanPlatform().createLibrary(vk::Platform::LIBRARY_TYPE_VULKAN, DE_NULL)}; +#else + vk::Library* library {platform->getVulkanPlatform().createLibrary(DE_NULL)}; +#endif tcu::TestContext* tcx = new tcu::TestContext{*platform, archive, log, cmdLine, nullptr}; vk::ResourceInterface* resource = new vk::ResourceInterfaceStandard{*tcx}; vk::BinaryCollection* collection = new vk::BinaryCollection{}; -- 2.7.4