Skip to content

Commit

Permalink
Vulkan video only for windows and linux
Browse files Browse the repository at this point in the history
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
  • Loading branch information
pingpongcat committed Jan 31, 2023
1 parent b38cfc8 commit 80ebccd
Show file tree
Hide file tree
Showing 10 changed files with 66 additions and 52 deletions.
5 changes: 3 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
27 changes: 15 additions & 12 deletions external/fetch_sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,25 +66,28 @@ def __init__(self, url, filename, checksum, baseDir, extractDir = "src", postExt
self.checksum = checksum
self.archiveDir = "packages"
self.postExtract = postExtract
self.sysNdx = {"Windows":0, "Linux":1, "Darwin":2}[platform.system()]
self.FFmpeg = "FFmpeg" in url

if ("FFmpeg" in url):
ndx = {"Windows":0, "Linux":1}[platform.system()]
self.url = self.url.split()[ndx]
self.checksum = self.checksum.split()[ndx]
self.filename = self.filename.split()[ndx]
if self.FFmpeg:
if self.sysNdx != 2:
self.url = self.url.split()[self.sysNdx]
self.checksum = self.checksum.split()[self.sysNdx]
self.filename = self.filename.split()[self.sysNdx]

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)
Expand Down Expand Up @@ -397,7 +400,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:
Expand Down
6 changes: 3 additions & 3 deletions external/vulkancts/framework/vulkan/vkPlatform.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -399,10 +399,10 @@ class Platform

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;
Expand Down
33 changes: 21 additions & 12 deletions external/vulkancts/modules/vulkan/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ add_subdirectory(reconvergence)
add_subdirectory(mesh_shader)
add_subdirectory(fragment_shading_barycentric)
add_subdirectory(sc)
if (DE_OS_IS_WIN32 OR DE_OS_IS_UNIX)
add_subdirectory(video)
endif()

include_directories(
api
Expand Down Expand Up @@ -100,9 +102,12 @@ include_directories(
fragment_shading_barycentric
${DEQP_INL_DIR}
sc
video
)

if (DE_OS_IS_WIN32 OR DE_OS_IS_UNIX)
include_directories(video)
endif()

set(DEQP_VK_SRCS
vktTestCaseDefs.hpp
vktTestCase.cpp
Expand All @@ -121,7 +126,7 @@ set(DEQP_VK_SRCS
vktCustomInstancesDevices.hpp
)

set(DEQP_VK_LIBS
set(DEQP_VK_STANDARD_LIBS
tcutil
vkutil
glutil
Expand Down Expand Up @@ -170,9 +175,18 @@ set(DEQP_VK_LIBS
deqp-vk-reconvergence
deqp-vk-mesh-shader
deqp-vk-fragment-shading-barycentric
deqp-vk-video
)

set(DEQP_VK_VIDEO_LIB deqp-vk-video)

if (DE_OS_IS_WIN32 OR DE_OS_IS_UNIX)
set(DEQP_VK_LIBS
${DEQP_VK_STANDARD_LIBS}
${DEQP_VK_VIDEO_LIB}
)
else()
set(DEQP_VK_LIBS ${DEQP_VK_STANDARD_LIBS})
endif()

set(DEQP_VKSC_LIBS
tcutil
Expand Down Expand Up @@ -253,19 +267,14 @@ ENDFOREACH()

set(BINARY_COPY_DIR "./")

# Video parser used in vulkan video won't be part of non supported platforms
if (DE_OS_IS_WIN32)
add_data_dir(deqp-vk ../../../ffmpeg/src/bin ${BINARY_COPY_DIR})
add_data_dir(deqp-vk ../../../video-parser/src/vk_video_decoder/bin/libs/nv_vkvideo_parser/wddm2_amd64_release ${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_UNIX)
add_data_dir(deqp-vk ../../../video-parser/src/vk_video_decoder/bin/libs/nv_vkvideo_parser/linux_amd64_release ${BINARY_COPY_DIR})
endif()


Expand Down
6 changes: 3 additions & 3 deletions external/vulkancts/modules/vulkan/api/vktApiVersionCheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,10 @@ class APIEntryPointsTestInstance : public TestInstance
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<vk::Library> vkLibrary = de::MovePtr<vk::Library>(platform.createLibrary(m_context.getTestContext().getCommandLine().getVkLibraryPath()));
#else
#if (DE_OS == DE_OS_WIN32) || (DE_OS == DE_OS_UNIX)
de::MovePtr<vk::Library> vkLibrary = de::MovePtr<vk::Library>(platform.createLibrary(vk::Platform::LibraryType::LIBRARY_TYPE_VULKAN, m_context.getTestContext().getCommandLine().getVkLibraryPath()));
#else
de::MovePtr<vk::Library> vkLibrary = de::MovePtr<vk::Library>(platform.createLibrary(m_context.getTestContext().getCommandLine().getVkLibraryPath()));
#endif
const tcu::FunctionLibrary& funcLibrary = vkLibrary->getFunctionLibrary();
deUint32 failsQuantity = 0u;
Expand Down
17 changes: 3 additions & 14 deletions external/vulkancts/modules/vulkan/video/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
include_directories(..)
include_directories(${FFMPEG_INCLUDE_PATH})

set(DEQP_VK_VIDEO_SRC_TARGET_DEPENDENT
set(DEQP_VK_VIDEO_SRCS
extFFmpegDemuxer.h
extNvidiaVideoParserIf.hpp
vktVideoSessionNvUtils.cpp
Expand All @@ -10,29 +10,18 @@ set(DEQP_VK_VIDEO_SRC_TARGET_DEPENDENT
vktVideoSessionFfmpegUtils.hpp
vktVideoBaseDecodeUtils.hpp
vktVideoBaseDecodeUtils.cpp
)

set(DEQP_VK_VIDEO_SRCS_TARGET_INDEPENDENT
vktVideoDecodeTests.cpp
vktVideoDecodeTests.hpp
vktVideoPictureUtils.cpp
vktVideoPictureUtils.hpp
vktVideoCapabilitiesTests.cpp
vktVideoCapabilitiesTests.hpp
vktVideoDecodeTests.cpp
vktVideoDecodeTests.hpp
vktVideoTestUtils.cpp
vktVideoTestUtils.hpp
vktVideoTests.cpp
vktVideoTests.hpp
)

if (DE_OS_IS_ANDROID)
set(DEQP_VK_VIDEO_SRCS ${DEQP_VK_VIDEO_SRCS_TARGET_INDEPENDENT})
else()
set(DEQP_VK_VIDEO_SRCS
${DEQP_VK_VIDEO_SRC_TARGET_DEPENDENT}
${DEQP_VK_VIDEO_SRCS_TARGET_INDEPENDENT}
)
endif()

set(DEQP_VK_VIDEO_LIBS
tcutil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,10 @@ class NvFunctions: public IfcNvFunctions
};

NvFunctions::NvFunctions (const vk::Platform& platform)
#if (DE_OS == DE_OS_ANDROID)
: m_library (de::MovePtr<vk::Library>(platform.createLibrary()))
#else
#if (DE_OS == DE_OS_WIN32) || (DE_OS == DE_OS_UNIX)
: m_library (de::MovePtr<vk::Library>(platform.createLibrary(vk::Platform::LIBRARY_TYPE_VULKAN_VIDEO_DECODE_PARSER, DE_NULL)))
#else
: m_library (de::MovePtr<vk::Library>(platform.createLibrary()))
#endif
{
const tcu::FunctionLibrary& funcsLibrary = m_library->getFunctionLibrary();
Expand Down
10 changes: 7 additions & 3 deletions external/vulkancts/modules/vulkan/vktTestPackage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,9 @@
#ifdef CTS_USES_VULKANSC
#include "vktSafetyCriticalTests.hpp"
#endif // CTS_USES_VULKANSC
#if (DE_OS == DE_OS_WIN32) || (DE_OS == DE_OS_UNIX)
#include "vktVideoTests.hpp"
#endif

#include <vector>
#include <sstream>
Expand Down Expand Up @@ -204,10 +206,10 @@ static void restoreStandardOutput () { qpRedirectOut(openWrite, open

static MovePtr<vk::Library> createLibrary (tcu::TestContext& testCtx)
{
#if (DE_OS == DE_OS_ANDROID)
return MovePtr<vk::Library>(testCtx.getPlatform().getVulkanPlatform().createLibrary(testCtx.getCommandLine().getVkLibraryPath()));
#else
#if (DE_OS == DE_OS_WIN32) || (DE_OS == DE_OS_UNIX)
return MovePtr<vk::Library>(testCtx.getPlatform().getVulkanPlatform().createLibrary(vk::Platform::LIBRARY_TYPE_VULKAN, testCtx.getCommandLine().getVkLibraryPath()));
#else
return MovePtr<vk::Library>(testCtx.getPlatform().getVulkanPlatform().createLibrary(testCtx.getCommandLine().getVkLibraryPath()));
#endif
}

Expand Down Expand Up @@ -1137,7 +1139,9 @@ void TestPackage::init (void)
addChild(FragmentShadingBarycentric::createTests(m_testCtx));
// Amber depth pipeline tests
addChild(cts_amber::createAmberDepthGroup (m_testCtx));
#if (DE_OS == DE_OS_WIN32) || (DE_OS == DE_OS_UNIX)
addChild(video::createTests (m_testCtx));
#endif
}

void ExperimentalTestPackage::init (void)
Expand Down
4 changes: 4 additions & 0 deletions external/vulkancts/vkscpc/vkscpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,11 @@ int main (int argc, char** argv)
tcu::DirArchive archive {""};
tcu::TestLog log { cmdLine.getOption<opt::LogFile>().c_str() }; log.supressLogging(true);
de::SharedPtr<tcu::Platform> platform {createPlatform()};
#if (DE_OS == DE_OS_WIN32) || (DE_OS == DE_OS_UNIX)
de::SharedPtr<vk::Library> library {platform->getVulkanPlatform().createLibrary(vk::Platform::LIBRARY_TYPE_VULKAN, DE_NULL)};
#else
de::SharedPtr<vk::Library> 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<vk::ResourceInterface>{new vk::ResourceInterfaceStandard{ tcx }});
Expand Down
4 changes: 4 additions & 0 deletions external/vulkancts/vkscserver/vksServices.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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{};
Expand Down

0 comments on commit 80ebccd

Please sign in to comment.