Snap for 9936701 from abf08dc0b9ef85726f293569f54a5490c43e1b78 to tm-qpr3-release

Change-Id: Ie0aed8e279d354f5b7cbc80c62c0a86e22d0a91b
diff --git a/external/vulkancts/modules/vulkan/api/vktApiExternalMemoryTests.cpp b/external/vulkancts/modules/vulkan/api/vktApiExternalMemoryTests.cpp
index c343cec..acdc1ab 100644
--- a/external/vulkancts/modules/vulkan/api/vktApiExternalMemoryTests.cpp
+++ b/external/vulkancts/modules/vulkan/api/vktApiExternalMemoryTests.cpp
@@ -1448,6 +1448,9 @@
 		{
 			NativeHandle handle;
 
+			// Need to touch watchdog due to how long one iteration takes
+			context.getTestContext().touchWatchdog();
+
 			if (transference == TRANSFERENCE_COPY)
 			{
 				submitAtomicCalculationsAndGetSemaphoreNative(context, vkd, *device, alloc, queue, queueFamilyIndex, *semaphore, config.externalType, handle);
@@ -1456,9 +1459,6 @@
 			}
 			else
 				getSemaphoreNative(vkd, *device, *semaphore, config.externalType, handle);
-
-			// Let watchdog know we're alive
-			context.getTestContext().touchWatchdog();
 		}
 
 		submitEmptySignal(vkd, queue, *semaphore);
@@ -2520,6 +2520,9 @@
 		{
 			NativeHandle handle;
 
+			// Need to touch watchdog due to how long one iteration takes
+			context.getTestContext().touchWatchdog();
+
 			if (transference == TRANSFERENCE_COPY)
 			{
 				submitAtomicCalculationsAndGetFenceNative(context, vkd, *device, alloc, queue, queueFamilyIndex, *fence, config.externalType, handle, exportNdx == 0 /* expect fence to be signaled after first pass */);
@@ -2528,9 +2531,6 @@
 			}
 			else
 				getFenceNative(vkd, *device, *fence, config.externalType, handle, exportNdx == 0 /* expect fence to be signaled after first pass */);
-
-			// Let watchdog know we're alive
-			context.getTestContext().touchWatchdog();
 		}
 
 		submitEmptySignal(vkd, queue, *fence);
diff --git a/external/vulkancts/modules/vulkan/pipeline/vktPipelineCacheTests.cpp b/external/vulkancts/modules/vulkan/pipeline/vktPipelineCacheTests.cpp
index f1a10dc..63ac226 100644
--- a/external/vulkancts/modules/vulkan/pipeline/vktPipelineCacheTests.cpp
+++ b/external/vulkancts/modules/vulkan/pipeline/vktPipelineCacheTests.cpp
@@ -659,10 +659,11 @@
 			{
 				case VK_SHADER_STAGE_VERTEX_BIT:
 					programCollection.glslSources.add("color_vert" + missSuffix) << glu::VertexSource(
-						"#version 310 es\n"
+						"#version 450\n"
 						"layout(location = 0) in vec4 position;\n"
 						"layout(location = 1) in vec4 color;\n"
 						"layout(location = 0) out highp vec4 vtxColor;\n"
+						"out gl_PerVertex { vec4 gl_Position; };\n"
 						"void main (void)\n"
 						"{\n"
 						"  gl_Position = position;\n"
diff --git a/external/vulkancts/modules/vulkan/pipeline/vktPipelineMultisampleTests.cpp b/external/vulkancts/modules/vulkan/pipeline/vktPipelineMultisampleTests.cpp
index 3c4dbb5..647026f 100644
--- a/external/vulkancts/modules/vulkan/pipeline/vktPipelineMultisampleTests.cpp
+++ b/external/vulkancts/modules/vulkan/pipeline/vktPipelineMultisampleTests.cpp
@@ -1701,18 +1701,22 @@
 	if (m_useFragmentShadingRate && !checkFragmentShadingRateRequirements(context, m_rasterizationSamples))
 		TCU_THROW(NotSupportedError, "Required FragmentShadingRate not supported");
 
-	if (m_enablePostDepthCoverage)
-		context.requireDeviceFunctionality("VK_EXT_post_depth_coverage");
-
 	context.requireDeviceFunctionality("VK_EXT_conservative_rasterization");
 
-	const VkPhysicalDeviceConservativeRasterizationPropertiesEXT	conservativeRasterizationProperties = context.getConservativeRasterizationPropertiesEXT();
-	const deUint32													subPixelPrecisionBits = context.getDeviceProperties().limits.subPixelPrecisionBits;
-	const deUint32													subPixelPrecision = 1 << subPixelPrecisionBits;
-	const float														primitiveOverestimationSizeMult = float(subPixelPrecision) * conservativeRasterizationProperties.primitiveOverestimationSize;
+	const auto&		conservativeRasterizationProperties	= context.getConservativeRasterizationPropertiesEXT();
+	const deUint32	subPixelPrecisionBits				= context.getDeviceProperties().limits.subPixelPrecisionBits;
+	const deUint32	subPixelPrecision					= (1 << subPixelPrecisionBits);
+	const float		primitiveOverestimationSizeMult		= float(subPixelPrecision) * conservativeRasterizationProperties.primitiveOverestimationSize;
 
 	DE_ASSERT(subPixelPrecisionBits < sizeof(deUint32) * 8);
 
+	if (m_enablePostDepthCoverage)
+	{
+		context.requireDeviceFunctionality("VK_EXT_post_depth_coverage");
+		if (!conservativeRasterizationProperties.conservativeRasterizationPostDepthCoverage)
+			TCU_THROW(NotSupportedError, "conservativeRasterizationPostDepthCoverage not supported");
+	}
+
 	context.getTestContext().getLog()
 		<< tcu::TestLog::Message
 		<< "maxExtraPrimitiveOverestimationSize=" << conservativeRasterizationProperties.maxExtraPrimitiveOverestimationSize << '\n'
diff --git a/external/vulkancts/modules/vulkan/ray_tracing/vktRayTracingBuildLargeTests.cpp b/external/vulkancts/modules/vulkan/ray_tracing/vktRayTracingBuildLargeTests.cpp
index 6a04ad9..e92b32b 100644
--- a/external/vulkancts/modules/vulkan/ray_tracing/vktRayTracingBuildLargeTests.cpp
+++ b/external/vulkancts/modules/vulkan/ray_tracing/vktRayTracingBuildLargeTests.cpp
@@ -397,7 +397,7 @@
 	const VkImageMemoryBarrier			preImageBarrier						= makeImageMemoryBarrier(0u, VK_ACCESS_TRANSFER_WRITE_BIT,
 																				VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
 																				**image, imageSubresourceRange);
-	const VkImageMemoryBarrier			postImageBarrier					= makeImageMemoryBarrier(VK_ACCESS_TRANSFER_WRITE_BIT, VK_ACCESS_ACCELERATION_STRUCTURE_READ_BIT_KHR | VK_ACCESS_ACCELERATION_STRUCTURE_WRITE_BIT_KHR,
+	const VkImageMemoryBarrier			postImageBarrier					= makeImageMemoryBarrier(VK_ACCESS_TRANSFER_WRITE_BIT, VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_SHADER_WRITE_BIT,
 																				VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, VK_IMAGE_LAYOUT_GENERAL,
 																				**image, imageSubresourceRange);
 	const VkMemoryBarrier				postTraceMemoryBarrier				= makeMemoryBarrier(VK_ACCESS_SHADER_WRITE_BIT, VK_ACCESS_TRANSFER_READ_BIT);
diff --git a/external/vulkancts/modules/vulkan/renderpass/vktRenderPassTests.cpp b/external/vulkancts/modules/vulkan/renderpass/vktRenderPassTests.cpp
index 0679319..e8e6881 100644
--- a/external/vulkancts/modules/vulkan/renderpass/vktRenderPassTests.cpp
+++ b/external/vulkancts/modules/vulkan/renderpass/vktRenderPassTests.cpp
@@ -1986,6 +1986,8 @@
 									? VK_TRUE
 									: VK_FALSE;
 
+	VkStencilOp		stencilOp		= writeStencil ? VK_STENCIL_OP_REPLACE : VK_STENCIL_OP_KEEP;
+
 	const VkPipelineDepthStencilStateCreateInfo depthStencilState =
 	{
 		VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO,	// sType
@@ -1997,18 +1999,18 @@
 		VK_FALSE,													// depthBoundsEnable
 		writeStencil,												// stencilTestEnable
 		{
-			VK_STENCIL_OP_REPLACE,									// stencilFailOp
-			VK_STENCIL_OP_REPLACE,									// stencilPassOp
-			VK_STENCIL_OP_REPLACE,									// stencilDepthFailOp
+			stencilOp,												// stencilFailOp
+			stencilOp,												// stencilPassOp
+			stencilOp,												// stencilDepthFailOp
 			VK_COMPARE_OP_ALWAYS,									// stencilCompareOp
 			~0u,													// stencilCompareMask
 			~0u,													// stencilWriteMask
 			((stencilIndex % 2) == 0) ? ~0x0u : 0x0u				// stencilReference
 		},															// front
 		{
-			VK_STENCIL_OP_REPLACE,									// stencilFailOp
-			VK_STENCIL_OP_REPLACE,									// stencilPassOp
-			VK_STENCIL_OP_REPLACE,									// stencilDepthFailOp
+			stencilOp,												// stencilFailOp
+			stencilOp,												// stencilPassOp
+			stencilOp,												// stencilDepthFailOp
 			VK_COMPARE_OP_ALWAYS,									// stencilCompareOp
 			~0u,													// stencilCompareMask
 			~0u,													// stencilWriteMask
diff --git a/external/vulkancts/modules/vulkan/vktInfoTests.cpp b/external/vulkancts/modules/vulkan/vktInfoTests.cpp
index 63052c9..6fab27e 100644
--- a/external/vulkancts/modules/vulkan/vktInfoTests.cpp
+++ b/external/vulkancts/modules/vulkan/vktInfoTests.cpp
@@ -29,6 +29,7 @@
 #include "tcuFormatUtil.hpp"
 #include "tcuCommandLine.hpp"
 #include "tcuPlatform.hpp"
+#include "deDefs.h"
 #include "deStringUtil.hpp"
 #include "vktApiFeatureInfo.hpp"
 
@@ -84,6 +85,8 @@
 		case DE_CPU_ARM_64:		return "DE_CPU_ARM_64";
 		case DE_CPU_MIPS:		return "DE_CPU_MIPS";
 		case DE_CPU_MIPS_64:	return "DE_CPU_MIPS_64";
+		case DE_CPU_RISCV_32:	return "DE_CPU_RISCV_32";
+		case DE_CPU_RISCV_64:	return "DE_CPU_RISCV_64";
 		default:
 			return de::toString(cpu);
 	}
@@ -180,14 +183,16 @@
 	{
 		// \note Must be ordered from largest to smallest
 		{ "TiB",	1ull<<40ull		},
-		{ "MiB",	1ull<<20ull		},
 		{ "GiB",	1ull<<30ull		},
+		{ "MiB",	1ull<<20ull		},
 		{ "KiB",	1ull<<10ull		},
 	};
 	static const SizeUnit s_defaultUnit	= { "B", 1u };
 
 	for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(s_units); ++ndx)
 	{
+		DE_ASSERT(ndx == DE_LENGTH_OF_ARRAY(s_units) ||
+		          s_units[ndx].value > s_units[ndx + 1].value);
 		if (value >= s_units[ndx].value)
 			return &s_units[ndx];
 	}
diff --git a/external/vulkancts/modules/vulkan/vktTestCase.cpp b/external/vulkancts/modules/vulkan/vktTestCase.cpp
index f7e5444..bce34eb 100644
--- a/external/vulkancts/modules/vulkan/vktTestCase.cpp
+++ b/external/vulkancts/modules/vulkan/vktTestCase.cpp
@@ -533,8 +533,6 @@
 				return !!vk12Features.shaderOutputViewportIndex && !!vk12Features.shaderOutputLayer;
 
 			const auto& vk13Features = m_device->getVulkan13Features();
-			if (extension == "VK_EXT_image_robustness")
-				return !!vk13Features.robustImageAccess;
 			if (extension == "VK_EXT_inline_uniform_block")
 				return !!vk13Features.inlineUniformBlock;
 			if (extension == "VK_EXT_pipeline_creation_cache_control")
diff --git a/framework/delibs/debase/deDefs.c b/framework/delibs/debase/deDefs.c
index 203ce0c..078c71a 100644
--- a/framework/delibs/debase/deDefs.c
+++ b/framework/delibs/debase/deDefs.c
@@ -38,8 +38,8 @@
 DE_STATIC_ASSERT(DE_PTR_SIZE		== sizeof(void*));
 
 /* Sanity checks for DE_PTR_SIZE & DE_CPU */
-#if !((DE_CPU == DE_CPU_X86_64 || DE_CPU == DE_CPU_ARM_64 || DE_CPU == DE_CPU_MIPS_64) && (DE_PTR_SIZE == 8)) && \
-	!((DE_CPU == DE_CPU_X86    || DE_CPU == DE_CPU_ARM    || DE_CPU == DE_CPU_MIPS)    && (DE_PTR_SIZE == 4))
+#if !((DE_CPU == DE_CPU_X86_64 || DE_CPU == DE_CPU_ARM_64 || DE_CPU == DE_CPU_MIPS_64 || DE_CPU == DE_CPU_RISCV_64) && (DE_PTR_SIZE == 8)) && \
+	!((DE_CPU == DE_CPU_X86    || DE_CPU == DE_CPU_ARM    || DE_CPU == DE_CPU_MIPS || DE_CPU == DE_CPU_RISCV_32)    && (DE_PTR_SIZE == 4))
 #	error "DE_CPU and DE_PTR_SIZE mismatch"
 #endif
 
diff --git a/framework/delibs/debase/deDefs.h b/framework/delibs/debase/deDefs.h
index fa19567..80b240a 100644
--- a/framework/delibs/debase/deDefs.h
+++ b/framework/delibs/debase/deDefs.h
@@ -108,6 +108,8 @@
 #define DE_CPU_ARM_64	4
 #define DE_CPU_MIPS		5
 #define DE_CPU_MIPS_64	6
+#define DE_CPU_RISCV_32	7
+#define DE_CPU_RISCV_64	8
 
 /* CPU detection. */
 #if defined(DE_CPU)
@@ -124,6 +126,10 @@
 #	define DE_CPU DE_CPU_MIPS
 #elif defined(__mips__) && ((__mips) == 64)
 #	define DE_CPU DE_CPU_MIPS_64
+#elif defined(__riscv) && ((__riscv_xlen) == 32)
+#	define DE_CPU DE_CPU_RISCV_32
+#elif defined(__riscv) && ((__riscv_xlen) == 64)
+#	define DE_CPU DE_CPU_RISCV_64
 #else
 #	error Unknown CPU.
 #endif
diff --git a/modules/internal/ditBuildInfoTests.cpp b/modules/internal/ditBuildInfoTests.cpp
index 056da8e..345e6ec 100644
--- a/modules/internal/ditBuildInfoTests.cpp
+++ b/modules/internal/ditBuildInfoTests.cpp
@@ -71,6 +71,8 @@
 		case DE_CPU_ARM_64:		return "DE_CPU_ARM_64";
 		case DE_CPU_MIPS:		return "DE_CPU_MIPS";
 		case DE_CPU_MIPS_64:	return "DE_CPU_MIPS_64";
+		case DE_CPU_RISCV_32:	return "DE_CPU_RISCV_32";
+		case DE_CPU_RISCV_64:	return "DE_CPU_RISCV_64";
 		default:
 			return DE_NULL;
 	}
diff --git a/scripts/android/build_apk.py b/scripts/android/build_apk.py
index b39d4b7..f721f51 100644
--- a/scripts/android/build_apk.py
+++ b/scripts/android/build_apk.py
@@ -769,7 +769,8 @@
 			libFiles.append(libRelPath)
 
 			if config.layers:
-				layersGlob = os.path.join(config.layers, abi, "libVkLayer_*.so")
+				# Need to copy everything in the layer folder
+				layersGlob = os.path.join(config.layers, abi, "*")
 				libVkLayers = glob.glob(layersGlob)
 				for layer in libVkLayers:
 					layerFilename = os.path.basename(layer)