Handle EGL_EXT_yuv_surface in eglChooseConfig() tests

Includes various small code fixes to related utilities.

Bug: 30909517
Change-Id: Ib0142d89832be4226406238800ebeab84b59c599
diff --git a/framework/egl/egluConfigInfo.cpp b/framework/egl/egluConfigInfo.cpp
index b1eefc0..aed08f3 100644
--- a/framework/egl/egluConfigInfo.cpp
+++ b/framework/egl/egluConfigInfo.cpp
@@ -25,6 +25,8 @@
 #include "egluDefs.hpp"
 #include "eglwLibrary.hpp"
 #include "eglwEnums.hpp"
+#include "egluUtil.hpp"
+#include "deSTLUtil.hpp"
 
 namespace eglu
 {
@@ -66,11 +68,20 @@
 		case EGL_TRANSPARENT_RED_VALUE:		return transparentRedValue;
 		case EGL_TRANSPARENT_GREEN_VALUE:	return transparentGreenValue;
 		case EGL_TRANSPARENT_BLUE_VALUE:	return transparentBlueValue;
-		default:							TCU_FAIL("Unknown attribute");
+
+		// EGL_EXT_yuv_surface
+		case EGL_YUV_ORDER_EXT:				return yuvOrder;
+		case EGL_YUV_NUMBER_OF_PLANES_EXT:	return yuvNumberOfPlanes;
+		case EGL_YUV_SUBSAMPLE_EXT:			return yuvSubsample;
+		case EGL_YUV_DEPTH_RANGE_EXT:		return yuvDepthRange;
+		case EGL_YUV_CSC_STANDARD_EXT:		return yuvCscStandard;
+		case EGL_YUV_PLANE_BPP_EXT:			return yuvPlaneBpp;
+
+		default:							TCU_THROW(InternalError, "Unknown attribute");
 	}
 }
 
-void queryConfigInfo (const Library& egl, EGLDisplay display, EGLConfig config, ConfigInfo* dst)
+void queryCoreConfigInfo (const Library& egl, EGLDisplay display, EGLConfig config, ConfigInfo* dst)
 {
 	egl.getConfigAttrib(display, config, EGL_BUFFER_SIZE,				&dst->bufferSize);
 	egl.getConfigAttrib(display, config, EGL_RED_SIZE,					&dst->redSize);
@@ -106,4 +117,21 @@
 	EGLU_CHECK_MSG(egl, "Failed to query config info");
 }
 
+void queryExtConfigInfo (const eglw::Library& egl, eglw::EGLDisplay display, eglw::EGLConfig config, ConfigInfo* dst)
+{
+	const std::vector<std::string>	extensions	= getDisplayExtensions(egl, display);
+
+	if (de::contains(extensions.begin(), extensions.end(), "EGL_EXT_yuv_surface"))
+	{
+		egl.getConfigAttrib(display, config, EGL_YUV_ORDER_EXT,				(EGLint*)&dst->yuvOrder);
+		egl.getConfigAttrib(display, config, EGL_YUV_NUMBER_OF_PLANES_EXT,	(EGLint*)&dst->yuvNumberOfPlanes);
+		egl.getConfigAttrib(display, config, EGL_YUV_SUBSAMPLE_EXT,			(EGLint*)&dst->yuvSubsample);
+		egl.getConfigAttrib(display, config, EGL_YUV_DEPTH_RANGE_EXT,		(EGLint*)&dst->yuvDepthRange);
+		egl.getConfigAttrib(display, config, EGL_YUV_CSC_STANDARD_EXT,		(EGLint*)&dst->yuvCscStandard);
+		egl.getConfigAttrib(display, config, EGL_YUV_PLANE_BPP_EXT,			(EGLint*)&dst->yuvPlaneBpp);
+
+		EGLU_CHECK_MSG(egl, "Failed to query EGL_EXT_yuv_surface config attribs");
+	}
+}
+
 } // eglu
diff --git a/framework/egl/egluConfigInfo.hpp b/framework/egl/egluConfigInfo.hpp
index 42fcaa3..356c50a 100644
--- a/framework/egl/egluConfigInfo.hpp
+++ b/framework/egl/egluConfigInfo.hpp
@@ -10,7 +10,7 @@
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
- *      http://www.apache.org/licenses/LICENSE-2.0
+ *	  http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
@@ -25,6 +25,7 @@
 
 #include "tcuDefs.hpp"
 #include "eglwDefs.hpp"
+#include "eglwEnums.hpp"
 
 namespace eglw
 {
@@ -37,6 +38,7 @@
 class ConfigInfo
 {
 public:
+	// Core attributes
 	deInt32			bufferSize;
 	deInt32			redSize;
 	deInt32			greenSize;
@@ -69,45 +71,62 @@
 	deInt32			transparentGreenValue;
 	deInt32			transparentBlueValue;
 
+	// Extension attributes - set by queryExtConfigInfo()
+
+	// EGL_EXT_yuv_surface
+	deUint32		yuvOrder;
+	deInt32			yuvNumberOfPlanes;
+	deUint32		yuvSubsample;
+	deUint32		yuvDepthRange;
+	deUint32		yuvCscStandard;
+	deInt32			yuvPlaneBpp;
+
 	ConfigInfo (void)
-		: bufferSize            (0)
-		, redSize               (0)
-		, greenSize             (0)
-		, blueSize              (0)
-		, luminanceSize         (0)
-		, alphaSize             (0)
-		, alphaMaskSize         (0)
-		, bindToTextureRGB      (0)
-		, bindToTextureRGBA     (0)
-		, colorBufferType       (0)
-		, configCaveat          (0)
-		, configId              (0)
-		, conformant            (0)
-		, depthSize             (0)
-		, level                 (0)
-		, maxPbufferWidth       (0)
-		, maxPbufferHeight      (0)
-		, maxSwapInterval       (0)
-		, minSwapInterval       (0)
-		, nativeRenderable      (0)
-		, nativeVisualId        (0)
-		, nativeVisualType      (0)
-		, renderableType        (0)
-		, sampleBuffers         (0)
-		, samples               (0)
-		, stencilSize           (0)
-		, surfaceType           (0)
-		, transparentType       (0)
-		, transparentRedValue   (0)
-		, transparentGreenValue (0)
-		, transparentBlueValue  (0)
+		: bufferSize			(0)
+		, redSize				(0)
+		, greenSize				(0)
+		, blueSize				(0)
+		, luminanceSize			(0)
+		, alphaSize				(0)
+		, alphaMaskSize			(0)
+		, bindToTextureRGB		(0)
+		, bindToTextureRGBA		(0)
+		, colorBufferType		(0)
+		, configCaveat			(0)
+		, configId				(0)
+		, conformant			(0)
+		, depthSize				(0)
+		, level					(0)
+		, maxPbufferWidth		(0)
+		, maxPbufferHeight		(0)
+		, maxSwapInterval		(0)
+		, minSwapInterval		(0)
+		, nativeRenderable		(0)
+		, nativeVisualId		(0)
+		, nativeVisualType		(0)
+		, renderableType		(0)
+		, sampleBuffers			(0)
+		, samples				(0)
+		, stencilSize			(0)
+		, surfaceType			(0)
+		, transparentType		(0)
+		, transparentRedValue	(0)
+		, transparentGreenValue	(0)
+		, transparentBlueValue	(0)
+		, yuvOrder				(EGL_NONE)
+		, yuvNumberOfPlanes		(0)
+		, yuvSubsample			(EGL_NONE)
+		, yuvDepthRange			(EGL_NONE)
+		, yuvCscStandard		(EGL_NONE)
+		, yuvPlaneBpp			(EGL_YUV_PLANE_BPP_0_EXT)
 	{
 	}
 
 	deInt32 getAttribute (deUint32 attribute) const;
 };
 
-void	queryConfigInfo		(const eglw::Library& egl, eglw::EGLDisplay display, eglw::EGLConfig config, ConfigInfo* dst);
+void	queryCoreConfigInfo	(const eglw::Library& egl, eglw::EGLDisplay display, eglw::EGLConfig config, ConfigInfo* dst);
+void	queryExtConfigInfo	(const eglw::Library& egl, eglw::EGLDisplay display, eglw::EGLConfig config, ConfigInfo* dst);
 
 } // eglu
 
diff --git a/framework/egl/egluStrUtil.inl b/framework/egl/egluStrUtil.inl
index 51d8a54..297a00c 100644
--- a/framework/egl/egluStrUtil.inl
+++ b/framework/egl/egluStrUtil.inl
@@ -132,6 +132,33 @@
 	}
 }
 
+const char* getYuvOrderName (int value)
+{
+	switch (value)
+	{
+		case EGL_NONE:					return "EGL_NONE";
+		case EGL_YUV_ORDER_YUV_EXT:		return "EGL_YUV_ORDER_YUV_EXT";
+		case EGL_YUV_ORDER_YVU_EXT:		return "EGL_YUV_ORDER_YVU_EXT";
+		case EGL_YUV_ORDER_YUYV_EXT:	return "EGL_YUV_ORDER_YUYV_EXT";
+		case EGL_YUV_ORDER_UYVY_EXT:	return "EGL_YUV_ORDER_UYVY_EXT";
+		case EGL_YUV_ORDER_YVYU_EXT:	return "EGL_YUV_ORDER_YVYU_EXT";
+		case EGL_YUV_ORDER_VYUY_EXT:	return "EGL_YUV_ORDER_VYUY_EXT";
+		case EGL_YUV_ORDER_AYUV_EXT:	return "EGL_YUV_ORDER_AYUV_EXT";
+		default:						return DE_NULL;
+	}
+}
+
+const char* getYuvPlaneBppName (int value)
+{
+	switch (value)
+	{
+		case EGL_YUV_PLANE_BPP_0_EXT:	return "EGL_YUV_PLANE_BPP_0_EXT";
+		case EGL_YUV_PLANE_BPP_8_EXT:	return "EGL_YUV_PLANE_BPP_8_EXT";
+		case EGL_YUV_PLANE_BPP_10_EXT:	return "EGL_YUV_PLANE_BPP_10_EXT";
+		default:						return DE_NULL;
+	}
+}
+
 const char* getSurfaceTargetName (int value)
 {
 	switch (value)
diff --git a/framework/egl/egluStrUtilPrototypes.inl b/framework/egl/egluStrUtilPrototypes.inl
index f8620ec..fc2093f 100644
--- a/framework/egl/egluStrUtilPrototypes.inl
+++ b/framework/egl/egluStrUtilPrototypes.inl
@@ -10,6 +10,8 @@
 const char*							getContextAttribName		(int value);
 const char*							getConfigAttribName			(int value);
 const char*							getSurfaceAttribName		(int value);
+const char*							getYuvOrderName				(int value);
+const char*							getYuvPlaneBppName			(int value);
 const char*							getSurfaceTargetName		(int value);
 const char*							getColorBufferTypeName		(int value);
 const char*							getConfigCaveatName			(int value);
@@ -30,6 +32,8 @@
 inline tcu::Format::Enum<int, 2>	getContextAttribStr			(int value)		{ return tcu::Format::Enum<int, 2>(getContextAttribName, value); }
 inline tcu::Format::Enum<int, 2>	getConfigAttribStr			(int value)		{ return tcu::Format::Enum<int, 2>(getConfigAttribName, value); }
 inline tcu::Format::Enum<int, 2>	getSurfaceAttribStr			(int value)		{ return tcu::Format::Enum<int, 2>(getSurfaceAttribName, value); }
+inline tcu::Format::Enum<int, 2>	getYuvOrderStr				(int value)		{ return tcu::Format::Enum<int, 2>(getYuvOrderName, value); }
+inline tcu::Format::Enum<int, 2>	getYuvPlaneBppStr			(int value)		{ return tcu::Format::Enum<int, 2>(getYuvPlaneBppName, value); }
 inline tcu::Format::Enum<int, 2>	getSurfaceTargetStr			(int value)		{ return tcu::Format::Enum<int, 2>(getSurfaceTargetName, value); }
 inline tcu::Format::Enum<int, 2>	getColorBufferTypeStr		(int value)		{ return tcu::Format::Enum<int, 2>(getColorBufferTypeName, value); }
 inline tcu::Format::Enum<int, 2>	getConfigCaveatStr			(int value)		{ return tcu::Format::Enum<int, 2>(getConfigCaveatName, value); }
diff --git a/modules/egl/teglChooseConfigReference.cpp b/modules/egl/teglChooseConfigReference.cpp
index 8dfbef5..50a2769 100644
--- a/modules/egl/teglChooseConfigReference.cpp
+++ b/modules/egl/teglChooseConfigReference.cpp
@@ -29,6 +29,8 @@
 #include "eglwLibrary.hpp"
 #include "eglwEnums.hpp"
 
+#include "deSTLUtil.hpp"
+
 #include <algorithm>
 #include <vector>
 #include <map>
@@ -111,6 +113,35 @@
 		}
 	}
 
+	static int getYuvOrderRank (EGLenum order)
+	{
+		switch (order)
+		{
+			case EGL_NONE:					return 0;
+			case EGL_YUV_ORDER_YUV_EXT:		return 1;
+			case EGL_YUV_ORDER_YVU_EXT:		return 2;
+			case EGL_YUV_ORDER_YUYV_EXT:	return 3;
+			case EGL_YUV_ORDER_YVYU_EXT:	return 4;
+			case EGL_YUV_ORDER_UYVY_EXT:	return 5;
+			case EGL_YUV_ORDER_VYUY_EXT:	return 6;
+			case EGL_YUV_ORDER_AYUV_EXT:	return 7;
+			default:
+				TCU_THROW(TestError, (std::string("Unknown YUV order: ") + eglu::getYuvOrderStr(order).toString()).c_str());
+		}
+	}
+
+	static int getYuvPlaneBppValue (EGLenum bpp)
+	{
+		switch (bpp)
+		{
+			case EGL_YUV_PLANE_BPP_0_EXT:	return 0;
+			case EGL_YUV_PLANE_BPP_8_EXT:	return 8;
+			case EGL_YUV_PLANE_BPP_10_EXT:	return 10;
+			default:
+				TCU_THROW(TestError, (std::string("Unknown YUV plane BPP: ") + eglu::getYuvPlaneBppStr(bpp).toString()).c_str());
+		}
+	}
+
 	typedef bool (*CompareFunc) (const SurfaceConfig& a, const SurfaceConfig& b);
 
 	static bool compareCaveat (const SurfaceConfig& a, const SurfaceConfig& b)
@@ -123,7 +154,12 @@
 		return getColorBufferTypeRank((EGLenum)a.m_info.colorBufferType) < getColorBufferTypeRank((EGLenum)b.m_info.colorBufferType);
 	}
 
-	static bool compareColorBufferBits (const SurfaceConfig& a, const SurfaceConfig& b, const tcu::BVec4& specifiedRGBColors, const tcu::BVec2& specifiedLuminanceColors)
+	static bool compareYuvOrder (const SurfaceConfig& a, const SurfaceConfig& b)
+	{
+		return getYuvOrderRank((EGLenum)a.m_info.yuvOrder) < getYuvOrderRank((EGLenum)b.m_info.yuvOrder);
+	}
+
+	static bool compareColorBufferBits (const SurfaceConfig& a, const SurfaceConfig& b, const tcu::BVec4& specifiedRGBColors, const tcu::BVec2& specifiedLuminanceColors, bool yuvPlaneBppSpecified)
 	{
 		DE_ASSERT(a.m_info.colorBufferType == b.m_info.colorBufferType);
 		switch (a.m_info.colorBufferType)
@@ -144,8 +180,7 @@
 			}
 
 			case EGL_YUV_BUFFER_EXT:
-				// \todo [mika 2015-05-05] Sort YUV configs correctly. Currently all YUV configs are non-conformant and ordering can be relaxed.
-				return true;
+				return yuvPlaneBppSpecified ? (a.m_info.yuvPlaneBpp > b.m_info.yuvPlaneBpp) : false;
 
 			default:
 				DE_ASSERT(DE_FALSE);
@@ -177,7 +212,9 @@
 
 	friend bool operator== (const SurfaceConfig& a, const SurfaceConfig& b)
 	{
-		for (std::map<EGLenum, AttribRule>::const_iterator iter = SurfaceConfig::defaultRules.begin(); iter != SurfaceConfig::defaultRules.end(); iter++)
+		const std::map<EGLenum, AttribRule> defaultRules = getDefaultRules();
+
+		for (std::map<EGLenum, AttribRule>::const_iterator iter = defaultRules.begin(); iter != defaultRules.end(); iter++)
 		{
 			const EGLenum attribute = iter->first;
 
@@ -186,7 +223,7 @@
 		return true;
 	}
 
-	bool compareTo (const SurfaceConfig& b, const tcu::BVec4& specifiedRGBColors, const tcu::BVec2& specifiedLuminanceColors) const
+	bool compareTo (const SurfaceConfig& b, const tcu::BVec4& specifiedRGBColors, const tcu::BVec2& specifiedLuminanceColors, bool yuvPlaneBppSpecified) const
 	{
 		static const SurfaceConfig::CompareFunc compareFuncs[] =
 		{
@@ -199,6 +236,7 @@
 			SurfaceConfig::compareAttributeSmaller<EGL_DEPTH_SIZE>,
 			SurfaceConfig::compareAttributeSmaller<EGL_STENCIL_SIZE>,
 			SurfaceConfig::compareAttributeSmaller<EGL_ALPHA_MASK_SIZE>,
+			SurfaceConfig::compareYuvOrder,
 			SurfaceConfig::compareAttributeSmaller<EGL_CONFIG_ID>
 		};
 
@@ -209,9 +247,9 @@
 		{
 			if (!compareFuncs[ndx])
 			{
-				if (compareColorBufferBits(*this, b, specifiedRGBColors, specifiedLuminanceColors))
+				if (compareColorBufferBits(*this, b, specifiedRGBColors, specifiedLuminanceColors, yuvPlaneBppSpecified))
 					return true;
-				else if (compareColorBufferBits(b, *this, specifiedRGBColors, specifiedLuminanceColors))
+				else if (compareColorBufferBits(b, *this, specifiedRGBColors, specifiedLuminanceColors, yuvPlaneBppSpecified))
 					return false;
 
 				continue;
@@ -226,9 +264,7 @@
 		TCU_FAIL("Unable to compare configs - duplicate ID?");
 	}
 
-	static const std::map<EGLenum, AttribRule> defaultRules;
-
-	static std::map<EGLenum, AttribRule> initAttribRules (void)
+	static std::map<EGLenum, AttribRule> getDefaultRules (void)
 	{
 		// \todo [2011-03-24 pyry] From EGL 1.4 spec - check that this is valid for other versions as well
 		std::map<EGLenum, AttribRule> rules;
@@ -263,6 +299,14 @@
 		rules[EGL_TRANSPARENT_GREEN_VALUE]	= AttribRule(EGL_TRANSPARENT_GREEN_VALUE,	EGL_DONT_CARE,		CRITERIA_EXACT,		SORTORDER_NONE);
 		rules[EGL_TRANSPARENT_BLUE_VALUE]	= AttribRule(EGL_TRANSPARENT_BLUE_VALUE,	EGL_DONT_CARE,		CRITERIA_EXACT,		SORTORDER_NONE);
 
+		// EGL_EXT_yuv_surface
+		rules[EGL_YUV_ORDER_EXT]			= AttribRule(EGL_YUV_ORDER_EXT,				EGL_DONT_CARE,		CRITERIA_EXACT,		SORTORDER_SPECIAL);
+		rules[EGL_YUV_NUMBER_OF_PLANES_EXT]	= AttribRule(EGL_YUV_NUMBER_OF_PLANES_EXT,	EGL_DONT_CARE,		CRITERIA_EXACT,		SORTORDER_NONE);
+		rules[EGL_YUV_SUBSAMPLE_EXT]		= AttribRule(EGL_YUV_SUBSAMPLE_EXT,			EGL_DONT_CARE,		CRITERIA_EXACT,		SORTORDER_NONE);
+		rules[EGL_YUV_DEPTH_RANGE_EXT]		= AttribRule(EGL_YUV_DEPTH_RANGE_EXT,		EGL_DONT_CARE,		CRITERIA_EXACT,		SORTORDER_NONE);
+		rules[EGL_YUV_CSC_STANDARD_EXT]		= AttribRule(EGL_YUV_CSC_STANDARD_EXT,		EGL_DONT_CARE,		CRITERIA_EXACT,		SORTORDER_NONE);
+		rules[EGL_YUV_PLANE_BPP_EXT]		= AttribRule(EGL_YUV_PLANE_BPP_EXT,			EGL_DONT_CARE,		CRITERIA_AT_LEAST,	SORTORDER_SPECIAL);	//	3
+
 		return rules;
 	}
 private:
@@ -270,25 +314,25 @@
 	ConfigInfo m_info;
 };
 
-const std::map<EGLenum, AttribRule> SurfaceConfig::defaultRules = SurfaceConfig::initAttribRules();
-
 class CompareConfigs
 {
 public:
-	CompareConfigs (const tcu::BVec4& specifiedRGBColors, const tcu::BVec2& specifiedLuminanceColors)
+	CompareConfigs (const tcu::BVec4& specifiedRGBColors, const tcu::BVec2& specifiedLuminanceColors, bool yuvPlaneBppSpecified)
 		: m_specifiedRGBColors			(specifiedRGBColors)
 		, m_specifiedLuminanceColors	(specifiedLuminanceColors)
+		, m_yuvPlaneBppSpecified		(yuvPlaneBppSpecified)
 	{
 	}
 
 	bool operator() (const SurfaceConfig& a, const SurfaceConfig& b)
 	{
-		return a.compareTo(b, m_specifiedRGBColors, m_specifiedLuminanceColors);
+		return a.compareTo(b, m_specifiedRGBColors, m_specifiedLuminanceColors, m_yuvPlaneBppSpecified);
 	}
 
 private:
 	const tcu::BVec4	m_specifiedRGBColors;
 	const tcu::BVec2	m_specifiedLuminanceColors;
+	const bool			m_yuvPlaneBppSpecified;
 };
 
 class ConfigFilter
@@ -297,13 +341,13 @@
 	std::map<EGLenum, AttribRule> m_rules;
 public:
 	ConfigFilter ()
-		: m_rules(SurfaceConfig::defaultRules)
+		: m_rules(SurfaceConfig::getDefaultRules())
 	{
 	}
 
 	void setValue (EGLenum name, EGLint value)
 	{
-		DE_ASSERT(SurfaceConfig::defaultRules.find(name) != SurfaceConfig::defaultRules.end());
+		DE_ASSERT(de::contains(m_rules, name));
 		m_rules[name].value = value;
 	}
 
@@ -318,13 +362,13 @@
 		}
 	}
 
-	AttribRule getAttribute (EGLenum name)
+	AttribRule getAttribute (EGLenum name) const
 	{
-		DE_ASSERT(SurfaceConfig::defaultRules.find(name) != SurfaceConfig::defaultRules.end());
-		return m_rules[name];
+		DE_ASSERT(de::contains(m_rules, name));
+		return m_rules.find(name)->second;
 	}
 
-	bool isMatch (const SurfaceConfig& config)
+	bool isMatch (const SurfaceConfig& config) const
 	{
 		for (std::map<EGLenum, AttribRule>::const_iterator iter = m_rules.begin(); iter != m_rules.end(); iter++)
 		{
@@ -366,7 +410,7 @@
 		return true;
 	}
 
-	tcu::BVec4 getSpecifiedRGBColors (void)
+	tcu::BVec4 getSpecifiedRGBColors (void) const
 	{
 		const EGLenum bitAttribs[] =
 		{
@@ -392,7 +436,7 @@
 		return result;
 	}
 
-	tcu::BVec2 getSpecifiedLuminanceColors (void)
+	tcu::BVec2 getSpecifiedLuminanceColors (void) const
 	{
 		const EGLenum bitAttribs[] =
 		{
@@ -416,7 +460,15 @@
 		return result;
 	}
 
-	std::vector<SurfaceConfig> filter (const std::vector<SurfaceConfig>& configs)
+	bool isYuvPlaneBppSpecified (void) const
+	{
+		const EGLenum	attrib	= EGL_YUV_PLANE_BPP_EXT;
+		const EGLint	value	= getAttribute(attrib).value;
+
+		return (value != 0) && (value != EGL_DONT_CARE);
+	}
+
+	std::vector<SurfaceConfig> filter (const std::vector<SurfaceConfig>& configs) const
 	{
 		std::vector<SurfaceConfig> out;
 
@@ -434,11 +486,15 @@
 	// Get all configs
 	std::vector<EGLConfig> eglConfigs = eglu::getConfigs(egl, display);
 
-	// Config infos
+	// Config infos - including extension attributes
 	std::vector<ConfigInfo> configInfos;
 	configInfos.resize(eglConfigs.size());
+
 	for (size_t ndx = 0; ndx < eglConfigs.size(); ndx++)
-		eglu::queryConfigInfo(egl, display, eglConfigs[ndx], &configInfos[ndx]);
+	{
+		eglu::queryCoreConfigInfo(egl, display, eglConfigs[ndx], &configInfos[ndx]);
+		eglu::queryExtConfigInfo(egl, display, eglConfigs[ndx], &configInfos[ndx]);
+	}
 
 	// Pair configs with info
 	std::vector<SurfaceConfig> configs;
@@ -452,7 +508,7 @@
 	std::vector<SurfaceConfig> filteredConfigs = configFilter.filter(configs);
 
 	// Sort configs
-	std::sort(filteredConfigs.begin(), filteredConfigs.end(), CompareConfigs(configFilter.getSpecifiedRGBColors(), configFilter.getSpecifiedLuminanceColors()));
+	std::sort(filteredConfigs.begin(), filteredConfigs.end(), CompareConfigs(configFilter.getSpecifiedRGBColors(), configFilter.getSpecifiedLuminanceColors(), configFilter.isYuvPlaneBppSpecified()));
 
 	// Write to dst list
 	dst.resize(filteredConfigs.size());
diff --git a/modules/egl/teglQuerySurfaceTests.cpp b/modules/egl/teglQuerySurfaceTests.cpp
index be44395..3815818 100644
--- a/modules/egl/teglQuerySurfaceTests.cpp
+++ b/modules/egl/teglQuerySurfaceTests.cpp
@@ -309,7 +309,7 @@
 		const eglu::NativeWindowFactory&	windowFactory	= eglu::selectNativeWindowFactory(m_eglTestCtx.getNativeDisplayFactory(), m_testCtx.getCommandLine());
 		ConfigInfo							info;
 
-		eglu::queryConfigInfo(egl, display, config, &info);
+		eglu::queryCoreConfigInfo(egl, display, config, &info);
 
 		log << TestLog::Message << "Creating window surface with config ID " << info.configId << TestLog::EndMessage;
 		EGLU_CHECK_MSG(egl, "before queries");
@@ -340,7 +340,7 @@
 		const eglu::NativePixmapFactory&	pixmapFactory	= eglu::selectNativePixmapFactory(m_eglTestCtx.getNativeDisplayFactory(), m_testCtx.getCommandLine());
 		ConfigInfo							info;
 
-		eglu::queryConfigInfo(egl, display, config, &info);
+		eglu::queryCoreConfigInfo(egl, display, config, &info);
 
 		log << TestLog::Message << "Creating pixmap surface with config ID " << info.configId << TestLog::EndMessage;
 		EGLU_CHECK_MSG(egl, "before queries");
@@ -370,7 +370,7 @@
 		int				height	= 64;
 		ConfigInfo		info;
 
-		eglu::queryConfigInfo(egl, display, config, &info);
+		eglu::queryCoreConfigInfo(egl, display, config, &info);
 
 		log << TestLog::Message << "Creating pbuffer surface with config ID " << info.configId << TestLog::EndMessage;
 		EGLU_CHECK_MSG(egl, "before queries");
@@ -582,7 +582,7 @@
 		const eglu::NativeWindowFactory&	windowFactory	= eglu::selectNativeWindowFactory(m_eglTestCtx.getNativeDisplayFactory(), m_testCtx.getCommandLine());
 		ConfigInfo							info;
 
-		eglu::queryConfigInfo(egl, display, config, &info);
+		eglu::queryCoreConfigInfo(egl, display, config, &info);
 
 		log << TestLog::Message << "Creating window surface with config ID " << info.configId << TestLog::EndMessage;
 		EGLU_CHECK_MSG(egl, "before queries");
@@ -611,7 +611,7 @@
 		const eglu::NativePixmapFactory&	pixmapFactory	= eglu::selectNativePixmapFactory(m_eglTestCtx.getNativeDisplayFactory(), m_testCtx.getCommandLine());
 		ConfigInfo							info;
 
-		eglu::queryConfigInfo(egl, display, config, &info);
+		eglu::queryCoreConfigInfo(egl, display, config, &info);
 
 		log << TestLog::Message << "Creating pixmap surface with config ID " << info.configId << TestLog::EndMessage;
 		EGLU_CHECK_MSG(egl, "before queries");
@@ -639,7 +639,7 @@
 		int				height	= 64;
 		ConfigInfo		info;
 
-		eglu::queryConfigInfo(egl, display, config, &info);
+		eglu::queryCoreConfigInfo(egl, display, config, &info);
 
 		log << TestLog::Message << "Creating pbuffer surface with config ID " << info.configId << TestLog::EndMessage;
 		EGLU_CHECK_MSG(egl, "before queries");
diff --git a/scripts/egl/str_util.py b/scripts/egl/str_util.py
index d00fe45..4372932 100644
--- a/scripts/egl/str_util.py
+++ b/scripts/egl/str_util.py
@@ -126,6 +126,21 @@
 		"ALPHA_FORMAT",
 		"COLORSPACE"
 		]),
+	("YuvOrder", [
+		"NONE",
+		"YUV_ORDER_YUV_EXT",
+		"YUV_ORDER_YVU_EXT",
+		"YUV_ORDER_YUYV_EXT",
+		"YUV_ORDER_UYVY_EXT",
+		"YUV_ORDER_YVYU_EXT",
+		"YUV_ORDER_VYUY_EXT",
+		"YUV_ORDER_AYUV_EXT",
+		]),
+	("YuvPlaneBpp", [
+		"YUV_PLANE_BPP_0_EXT",
+		"YUV_PLANE_BPP_8_EXT",
+		"YUV_PLANE_BPP_10_EXT",
+		]),
 	("SurfaceTarget",		["READ", "DRAW"]),
 
 	# ConfigAttrib values