From 24cf7bb0a3f0b82c2f3017cc3c42e6ff9cc8fce2 Mon Sep 17 00:00:00 2001 From: Pyry Haulos Date: Wed, 21 Jan 2015 14:54:52 -0800 Subject: [PATCH] Support platform attributes in eglu::NativeDisplay This change adds getPlatformAttributes() to eglu::NativeDisplay. Certain platforms may need to pass extra attributes to eglGetPlatformDisplay() and can now implement this function to achieve that. Change-Id: I98be8145634c458d36fff7d2474300ac7a8917b2 --- framework/egl/egluNativeDisplay.cpp | 6 ++++++ framework/egl/egluNativeDisplay.hpp | 3 +++ framework/egl/egluUtil.cpp | 4 +++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/framework/egl/egluNativeDisplay.cpp b/framework/egl/egluNativeDisplay.cpp index 4cdcd33..8f7af55 100644 --- a/framework/egl/egluNativeDisplay.cpp +++ b/framework/egl/egluNativeDisplay.cpp @@ -65,6 +65,12 @@ void* NativeDisplay::getPlatformNative (void) throw tcu::NotSupportedError("eglu::NativeDisplay can't be used with eglGetPlatformDisplay()", DE_NULL, __FILE__, __LINE__); } +const EGLAttrib* NativeDisplay::getPlatformAttributes (void) const +{ + TCU_CHECK_INTERNAL((m_capabilities & CAPABILITY_GET_DISPLAY_PLATFORM) == 0); + return DE_NULL; +} + // NativeDisplayFactory NativeDisplayFactory::NativeDisplayFactory (const std::string& name, const std::string& description, NativeDisplay::Capability capabilities, EGLenum platformType, const char* platformExtension) diff --git a/framework/egl/egluNativeDisplay.hpp b/framework/egl/egluNativeDisplay.hpp index ce7d2e4..bd142cc 100644 --- a/framework/egl/egluNativeDisplay.hpp +++ b/framework/egl/egluNativeDisplay.hpp @@ -62,6 +62,9 @@ public: //! Return display pointer that can be used with eglGetPlatformDisplay(). Default implementations throw tcu::NotSupportedError() virtual void* getPlatformNative (void); + //! Attributes to pass to eglGetPlatformDisplay(EXT) + virtual const eglw::EGLAttrib* getPlatformAttributes (void) const; + protected: NativeDisplay (Capability capabilities, eglw::EGLenum platformType, const char* platformExtension); NativeDisplay (Capability capabilities); diff --git a/framework/egl/egluUtil.cpp b/framework/egl/egluUtil.cpp index e4804bc..d1cb1be 100644 --- a/framework/egl/egluUtil.cpp +++ b/framework/egl/egluUtil.cpp @@ -243,7 +243,9 @@ EGLDisplay getDisplay (NativeDisplay& nativeDisplay) if (usePlatformExt) { - display = egl.getPlatformDisplayEXT(nativeDisplay.getPlatformType(), nativeDisplay.getPlatformNative(), DE_NULL); + const vector legacyAttribs = toLegacyAttribList(nativeDisplay.getPlatformAttributes()); + + display = egl.getPlatformDisplayEXT(nativeDisplay.getPlatformType(), nativeDisplay.getPlatformNative(), &legacyAttribs[0]); EGLU_CHECK_MSG(egl, "eglGetPlatformDisplayEXT()"); TCU_CHECK(display != EGL_NO_DISPLAY); } -- 2.7.4