from build.common import *
EXTERNAL_DIR = os.path.realpath(os.path.normpath(os.path.dirname(__file__)))
-SHA1 = "64f5eea1e492de4664b39115ad82d330e019464b"
+SHA1 = "0eb3b7e9d717bda5b9ccc1e32f6dfdc4a12b8b2e"
PACKAGES = [
GitRepo(
#include "tcuPlatform.hpp"
#include "tcuRenderTarget.hpp"
#include "tcuVectorUtil.hpp"
-#include "vkPlatform.hpp"
#include <assert.h>
#include <climits>
#include <cmath>
void scaleDimensionsToMemory(int& width, int& height, int devLayers, int sysLayers, int devBPP, int sysBPP)
{
- vk::PlatformMemoryLimits memoryLimits;
- m_context.getTestContext().getPlatform().getVulkanPlatform().getMemoryLimits(memoryLimits);
+ tcu::PlatformMemoryLimits memoryLimits;
+ m_context.getTestContext().getPlatform().getMemoryLimits(memoryLimits);
GLsizeiptr sysSpace = memoryLimits.totalSystemMemory;
GLsizeiptr devSpace = memoryLimits.totalDeviceLocalMemory;
int devInSysLayers = 0;
class Display;
} // wsi
-struct PlatformMemoryLimits
-{
- // System memory properties
- size_t totalSystemMemory; //!< #bytes of system memory (heap + HOST_LOCAL) tests must not exceed
-
- // Device memory properties
- VkDeviceSize totalDeviceLocalMemory; //!< #bytes of total DEVICE_LOCAL memory tests must not exceed or 0 if DEVICE_LOCAL counts against system memory
- VkDeviceSize deviceMemoryAllocationGranularity; //!< VkDeviceMemory allocation granularity (typically page size)
-
- // Device memory page table geometry
- // \todo [2016-03-23 pyry] This becomes obsolete if Vulkan API adds a way for driver to expose internal device memory allocations
- VkDeviceSize devicePageSize; //!< Page size on device (must be rounded up to nearest POT)
- VkDeviceSize devicePageTableEntrySize; //!< Number of bytes per page table size
- size_t devicePageTableHierarchyLevels; //!< Number of levels in device page table hierarchy
-
- PlatformMemoryLimits (void)
- : totalSystemMemory (0)
- , totalDeviceLocalMemory (0)
- , deviceMemoryAllocationGranularity (0)
- , devicePageSize (0)
- , devicePageTableEntrySize (0)
- , devicePageTableHierarchyLevels (0)
- {}
-};
-
/*--------------------------------------------------------------------*//*!
* \brief Vulkan platform interface
*//*--------------------------------------------------------------------*/
~Platform (void) {}
virtual Library* createLibrary (void) const = 0;
-
virtual wsi::Display* createWsiDisplay (wsi::Type wsiType) const;
- virtual bool hasDisplay (wsi::Type wsiType) const;
-
- virtual void getMemoryLimits (PlatformMemoryLimits& limits) const = 0;
+ virtual bool hasDisplay (wsi::Type wsiType) const;
virtual void describePlatform (std::ostream& dst) const;
};
-inline PlatformMemoryLimits getMemoryLimits (const Platform& platform)
-{
- PlatformMemoryLimits limits;
- platform.getMemoryLimits(limits);
- return limits;
-}
-
} // vk
#endif // _VKPLATFORM_HPP
ALLOCATION_KIND_LAST,
};
-PlatformMemoryLimits getPlatformMemoryLimits (Context& context)
+tcu::PlatformMemoryLimits getPlatformMemoryLimits (Context& context)
{
- PlatformMemoryLimits memoryLimits;
+ tcu::PlatformMemoryLimits memoryLimits;
- context.getTestContext().getPlatform().getVulkanPlatform().getMemoryLimits(memoryLimits);
+ context.getTestContext().getPlatform().getMemoryLimits(memoryLimits);
return memoryLimits;
}
VkDeviceSize getMaxBufferSize(const VkDeviceSize& bufferSize,
const VkDeviceSize& alignment,
- const PlatformMemoryLimits& limits)
+ const tcu::PlatformMemoryLimits& limits)
{
VkDeviceSize size = bufferSize;
return context.isDeviceFunctionalitySupported(name);
}
-VkDeviceSize getPageTableSize (const PlatformMemoryLimits& limits, VkDeviceSize allocationSize)
+VkDeviceSize getPageTableSize (const tcu::PlatformMemoryLimits& limits, VkDeviceSize allocationSize)
{
VkDeviceSize totalSize = 0;
}
}
-size_t getSafeObjectCount (const PlatformMemoryLimits& memoryLimits,
- size_t objectSystemMemoryUsage,
- VkDeviceSize objectDeviceMemoryUsage = 0)
+size_t getSafeObjectCount (const tcu::PlatformMemoryLimits& memoryLimits,
+ size_t objectSystemMemoryUsage,
+ VkDeviceSize objectDeviceMemoryUsage = 0)
{
const VkDeviceSize roundedUpDeviceMemory = roundUpToNextMultiple(objectDeviceMemoryUsage, memoryLimits.deviceMemoryAllocationGranularity);
}
}
-PlatformMemoryLimits getPlatformMemoryLimits (Context& context)
+tcu::PlatformMemoryLimits getPlatformMemoryLimits (Context& context)
{
- PlatformMemoryLimits memoryLimits;
+ tcu::PlatformMemoryLimits memoryLimits;
- context.getTestContext().getPlatform().getVulkanPlatform().getMemoryLimits(memoryLimits);
+ context.getTestContext().getPlatform().getMemoryLimits(memoryLimits);
return memoryLimits;
}
, m_config (config)
, m_result (m_context.getTestContext().getLog())
, m_memoryTypeIndex (0)
- , m_memoryLimits (getMemoryLimits(context.getTestContext().getPlatform().getVulkanPlatform()))
+ , m_memoryLimits (tcu::getMemoryLimits(context.getTestContext().getPlatform()))
{
DE_ASSERT(!!m_config.memorySize != !!m_config.memoryPercentage);
}
const TestConfig m_config;
tcu::ResultCollector m_result;
deUint32 m_memoryTypeIndex;
- const PlatformMemoryLimits m_memoryLimits;
+ const tcu::PlatformMemoryLimits m_memoryLimits;
};
tcu::TestStatus iterate (void);
private:
- const size_t m_opCount;
- const size_t m_allocSysMemSize;
- const PlatformMemoryLimits m_memoryLimits;
- const deUint32 m_totalDeviceMaskCombinations;
-
- deUint32 m_memoryObjectCount;
- deUint32 m_memoryProtectedObjectCount;
- deUint32 m_currentDeviceMask;
- size_t m_opNdx;
- de::Random m_rng;
- vector<Heap> m_heaps;
- VkDeviceSize m_totalSystemMem;
- VkDeviceSize m_totalDeviceMem;
+ const size_t m_opCount;
+ const size_t m_allocSysMemSize;
+ const tcu::PlatformMemoryLimits m_memoryLimits;
+ const deUint32 m_totalDeviceMaskCombinations;
+
+ deUint32 m_memoryObjectCount;
+ deUint32 m_memoryProtectedObjectCount;
+ deUint32 m_currentDeviceMask;
+ size_t m_opNdx;
+ de::Random m_rng;
+ vector<Heap> m_heaps;
+ VkDeviceSize m_totalSystemMem;
+ VkDeviceSize m_totalDeviceMem;
};
RandomAllocFreeTestInstance::RandomAllocFreeTestInstance (Context& context, TestConfigRandom config)
, m_opCount (128)
, m_allocSysMemSize (computeDeviceMemorySystemMemFootprint(getDeviceInterface(), context.getDevice())
+ sizeof(MemoryObject))
- , m_memoryLimits (getMemoryLimits(context.getTestContext().getPlatform().getVulkanPlatform()))
+ , m_memoryLimits (tcu::getMemoryLimits(context.getTestContext().getPlatform()))
, m_totalDeviceMaskCombinations (m_subsetAllocationAllowed ? (1 << m_numPhysDevices) - 1 : 1)
, m_memoryObjectCount (0)
, m_memoryProtectedObjectCount (0)
class MemoryHeap
{
public:
- MemoryHeap (const VkMemoryHeap& heap,
- const vector<MemoryType>& memoryTypes,
- const PlatformMemoryLimits& memoryLimits,
- const VkDeviceSize nonCoherentAtomSize,
- TotalMemoryTracker& totalMemTracker)
+ MemoryHeap (const VkMemoryHeap& heap,
+ const vector<MemoryType>& memoryTypes,
+ const tcu::PlatformMemoryLimits& memoryLimits,
+ const VkDeviceSize nonCoherentAtomSize,
+ TotalMemoryTracker& totalMemTracker)
: m_heap (heap)
, m_memoryTypes (memoryTypes)
, m_limits (memoryLimits)
return MEMORY_CLASS_SYSTEM;
}
- const VkMemoryHeap m_heap;
- const vector<MemoryType> m_memoryTypes;
- const PlatformMemoryLimits& m_limits;
- const VkDeviceSize m_nonCoherentAtomSize;
- const VkDeviceSize m_minAtomSize;
- TotalMemoryTracker& m_totalMemTracker;
+ const VkMemoryHeap m_heap;
+ const vector<MemoryType> m_memoryTypes;
+ const tcu::PlatformMemoryLimits& m_limits;
+ const VkDeviceSize m_nonCoherentAtomSize;
+ const VkDeviceSize m_minAtomSize;
+ TotalMemoryTracker& m_totalMemTracker;
- VkDeviceSize m_usage;
- vector<MemoryObject*> m_objects;
+ VkDeviceSize m_usage;
+ vector<MemoryObject*> m_objects;
};
// Heap is full if there is not enough memory to allocate minimal memory object.
: TestInstance (context)
, m_memoryObjectSysMemSize (getMemoryObjectSystemSize(context))
, m_memoryMappingSysMemSize (getMemoryMappingSystemSize())
- , m_memoryLimits (getMemoryLimits(context.getTestContext().getPlatform().getVulkanPlatform()))
+ , m_memoryLimits (tcu::getMemoryLimits(context.getTestContext().getPlatform()))
, m_rng (seed)
, m_opNdx (0)
{
private:
const size_t m_memoryObjectSysMemSize;
const size_t m_memoryMappingSysMemSize;
- const PlatformMemoryLimits m_memoryLimits;
+ const tcu::PlatformMemoryLimits m_memoryLimits;
de::Random m_rng;
size_t m_opNdx;
VkDeviceSize neededMemory = static_cast<VkDeviceSize>(static_cast<float>(colorSize + depthStencilSize) * additionalMemory) + reserveForChecking;
VkDeviceSize maxMemory = getMaxDeviceHeapSize(context, caseDef) >> 2;
- vk::PlatformMemoryLimits memoryLimits;
- context.getTestContext().getPlatform().getVulkanPlatform().getMemoryLimits(memoryLimits);
+ tcu::PlatformMemoryLimits memoryLimits;
+ context.getTestContext().getPlatform().getMemoryLimits(memoryLimits);
maxMemory = std::min(maxMemory, VkDeviceSize(memoryLimits.totalSystemMemory));
const VkDeviceSize deviceMemoryBudget = std::min(neededMemory, maxMemory);
tcu::TestStatus logPlatformMemoryLimits (Context& context)
{
TestLog& log = context.getTestContext().getLog();
- vk::PlatformMemoryLimits limits;
+ tcu::PlatformMemoryLimits limits;
- context.getTestContext().getPlatform().getVulkanPlatform().getMemoryLimits(limits);
+ context.getTestContext().getPlatform().getMemoryLimits(limits);
log << TestLog::Message << "totalSystemMemory = " << prettySize(limits.totalSystemMemory) << " (" << limits.totalSystemMemory << ")\n"
<< "totalDeviceLocalMemory = " << prettySize(limits.totalDeviceLocalMemory) << " (" << limits.totalDeviceLocalMemory << ")\n"
TCU_THROW(NotSupportedError, "Vulkan is not supported");
}
+void Platform::getMemoryLimits (PlatformMemoryLimits& limits) const
+{
+ // Default values. Platforms can override these values.
+ limits.totalSystemMemory = 256*1024*1024;
+ limits.totalDeviceLocalMemory = 128*1024*1024;
+ limits.deviceMemoryAllocationGranularity = 64*1024;
+ limits.devicePageSize = 4096;
+ limits.devicePageTableEntrySize = 8;
+ limits.devicePageTableHierarchyLevels = 3;
+}
+
} // tcu
class CommandLine;
class FunctionLibrary;
+struct PlatformMemoryLimits
+{
+ // System memory properties
+ size_t totalSystemMemory; // #bytes of system memory (heap + HOST_LOCAL) tests must not exceed
+
+ // Device memory properties
+ std::uint64_t totalDeviceLocalMemory; // #bytes of total DEVICE_LOCAL memory tests must not exceed or 0 if DEVICE_LOCAL counts against system memory
+ std::uint64_t deviceMemoryAllocationGranularity; // VkDeviceMemory allocation granularity (typically page size)
+
+ // Device memory page table geometry
+ std::uint64_t devicePageSize; // Page size on device (must be rounded up to the nearest POT)
+ std::uint64_t devicePageTableEntrySize; // Number of bytes per page table size
+ size_t devicePageTableHierarchyLevels; // Number of levels in device page table hierarchy
+
+ PlatformMemoryLimits (void)
+ : totalSystemMemory (0)
+ , totalDeviceLocalMemory (0)
+ , deviceMemoryAllocationGranularity (0)
+ , devicePageSize (0)
+ , devicePageTableEntrySize (0)
+ , devicePageTableHierarchyLevels (0)
+ {}
+};
+
/*--------------------------------------------------------------------*//*!
* \brief Base class for platform implementation.
*
* point, tcuMain.cpp can be used as is. In that case you only have to
* implement createPlatform().
*
- * API-specific platform interfaces (glu::Platform and eglu::Platform)
+ * API-specific platform interfaces (glu::Platform, eglu::Platform and vk::Platform)
* can be provided by implementing get<API>Platform() functions.
*//*--------------------------------------------------------------------*/
class Platform
virtual const eglu::Platform& getEGLPlatform (void) const;
virtual const vk::Platform& getVulkanPlatform (void) const;
+
+ virtual void getMemoryLimits (PlatformMemoryLimits& limits) const;
};
+inline tcu::PlatformMemoryLimits getMemoryLimits (const tcu::Platform& platform)
+{
+ tcu::PlatformMemoryLimits limits;
+ platform.getMemoryLimits(limits);
+ return limits;
+}
+
} // tcu
#endif // _TCUPLATFORM_HPP
*
*//*!
* \file
- * \brief Android EGL platform.
+ * \brief Android EGL and Vulkan platforms.
*//*--------------------------------------------------------------------*/
#include "tcuAndroidPlatform.hpp"
tcu::Android::describePlatform(m_activity.getNativeActivity(), dst);
}
-void Platform::getMemoryLimits (vk::PlatformMemoryLimits& limits) const
+void Platform::getMemoryLimits (tcu::PlatformMemoryLimits& limits) const
{
// Worst-case estimates
const size_t MiB = (size_t)(1<<20);
virtual const glu::Platform& getGLPlatform (void) const { return static_cast<const glu::Platform&>(*this); }
virtual const eglu::Platform& getEGLPlatform (void) const { return static_cast<const eglu::Platform&>(*this); }
virtual const vk::Platform& getVulkanPlatform (void) const { return static_cast<const vk::Platform&>(*this); }
+ virtual void getMemoryLimits (tcu::PlatformMemoryLimits& limits) const;
WindowRegistry& getWindowRegistry (void) { return m_windowRegistry; }
// Vulkan Platform API
vk::Library* createLibrary (void) const;
void describePlatform (std::ostream& dst) const;
- void getMemoryLimits (vk::PlatformMemoryLimits& limits) const;
vk::wsi::Display* createWsiDisplay (vk::wsi::Type wsiType) const;
- bool hasDisplay (vk::wsi::Type wsiType) const;
+ bool hasDisplay (vk::wsi::Type wsiType) const;
private:
NativeActivity& m_activity;
dst << "CPU: " << sysInfo.machine << "\n";
}
-void VulkanPlatform::getMemoryLimits (vk::PlatformMemoryLimits& limits) const
-{
- limits.totalSystemMemory = 256*1024*1024;
- limits.totalDeviceLocalMemory = 128*1024*1024;
- limits.deviceMemoryAllocationGranularity = 64*1024;
- limits.devicePageSize = 4096;
- limits.devicePageTableEntrySize = 8;
- limits.devicePageTableHierarchyLevels = 3;
-}
-
} // linux
} // tcu
vk::Library* createLibrary (void) const;
bool hasDisplay (vk::wsi::Type wsiType) const;
void describePlatform (std::ostream& dst) const;
- void getMemoryLimits (vk::PlatformMemoryLimits& limits) const;
private :
EventState& m_eventState;
return vk::createNullDriver();
}
-void Platform::getMemoryLimits (vk::PlatformMemoryLimits& limits) const
+void Platform::getMemoryLimits (tcu::PlatformMemoryLimits& limits) const
{
limits.totalSystemMemory = 256*1024*1024;
limits.totalDeviceLocalMemory = 0;
virtual const glu::Platform& getGLPlatform (void) const { return static_cast<const glu::Platform&>(*this); }
virtual const eglu::Platform& getEGLPlatform (void) const { return static_cast<const eglu::Platform&>(*this); }
virtual const vk::Platform& getVulkanPlatform (void) const { return static_cast<const vk::Platform&>(*this); }
+ virtual void getMemoryLimits (tcu::PlatformMemoryLimits& limits) const;
private:
virtual vk::Library* createLibrary (void) const;
- void getMemoryLimits (vk::PlatformMemoryLimits& limits) const;
};
} // null
{
return new VulkanLibrary();
}
- // FINISHME: Query actual memory limits.
- //
- // These hard-coded memory limits were copied from tcuX11Platform.cpp,
- // and they work well enough for Intel platforms.
- void getMemoryLimits (vk::PlatformMemoryLimits& limits) const
- {
- limits.totalSystemMemory = 256*1024*1024;
- limits.totalDeviceLocalMemory = 128*1024*1024;
- limits.deviceMemoryAllocationGranularity = 64*1024;
- limits.devicePageSize = 4096;
- limits.devicePageTableEntrySize = 8;
- limits.devicePageTableHierarchyLevels = 3;
- }
-
};
} // nullws
dst << "CPU: " << sysInfo.machine << "\n";
}
-void VulkanPlatform::getMemoryLimits (vk::PlatformMemoryLimits& limits) const
-{
- limits.totalSystemMemory = 256*1024*1024;
- limits.totalDeviceLocalMemory = 128*1024*1024;
- limits.deviceMemoryAllocationGranularity = 64*1024;
- limits.devicePageSize = 4096;
- limits.devicePageTableEntrySize = 8;
- limits.devicePageTableHierarchyLevels = 3;
-}
-
} // osx
} // tcu
vk::Library* createLibrary (void) const;
bool hasDisplay (vk::wsi::Type wsiType) const;
void describePlatform (std::ostream& dst) const;
- void getMemoryLimits (vk::PlatformMemoryLimits& limits) const;
};
dst << "OS: " << sysInfo.sysname << " " << sysInfo.release << " " << sysInfo.version << "\n";
dst << "CPU: " << sysInfo.machine << "\n";
}
-
- // FINISHME: Query actual memory limits.
- //
- // These hard-coded memory limits were copied from tcuX11Platform.cpp,
- // and they work well enough for Intel platforms.
- void getMemoryLimits (vk::PlatformMemoryLimits& limits) const
- {
- limits.totalSystemMemory = 256*1024*1024;
- limits.totalDeviceLocalMemory = 128*1024*1024;
- limits.deviceMemoryAllocationGranularity = 64*1024;
- limits.devicePageSize = 4096;
- limits.devicePageTableEntrySize = 8;
- limits.devicePageTableHierarchyLevels = 3;
- }
};
bool isEGLExtensionSupported(
dst << "\n";
}
-void VulkanPlatform::getMemoryLimits (vk::PlatformMemoryLimits& limits) const
-{
- limits.totalSystemMemory = 256*1024*1024;
- limits.totalDeviceLocalMemory = 128*1024*1024;
- limits.deviceMemoryAllocationGranularity = 64*1024;
- limits.devicePageSize = 4096;
- limits.devicePageTableEntrySize = 8;
- limits.devicePageTableHierarchyLevels = 3;
-}
-
vk::wsi::Display* VulkanPlatform::createWsiDisplay (vk::wsi::Type wsiType) const
{
if (wsiType != vk::wsi::TYPE_WIN32)
vk::Library* createLibrary (void) const;
vk::wsi::Display* createWsiDisplay (vk::wsi::Type wsiType) const;
- bool hasDisplay (vk::wsi::Type wsiType) const;
-
- void getMemoryLimits (vk::PlatformMemoryLimits& limits) const;
+ bool hasDisplay (vk::wsi::Type wsiType) const;
void describePlatform (std::ostream& dst) const;
private: