Support platform attributes in eglu::NativeDisplay
authorPyry Haulos <phaulos@google.com>
Wed, 21 Jan 2015 22:54:52 +0000 (14:54 -0800)
committerPyry Haulos <phaulos@google.com>
Wed, 21 Jan 2015 22:54:52 +0000 (14:54 -0800)
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
framework/egl/egluNativeDisplay.hpp
framework/egl/egluUtil.cpp

index 4cdcd33..8f7af55 100644 (file)
@@ -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)
index ce7d2e4..bd142cc 100644 (file)
@@ -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);
index e4804bc..d1cb1be 100644 (file)
@@ -243,7 +243,9 @@ EGLDisplay getDisplay (NativeDisplay& nativeDisplay)
 
        if (usePlatformExt)
        {
-               display = egl.getPlatformDisplayEXT(nativeDisplay.getPlatformType(), nativeDisplay.getPlatformNative(), DE_NULL);
+               const vector<EGLint>    legacyAttribs   = toLegacyAttribList(nativeDisplay.getPlatformAttributes());
+
+               display = egl.getPlatformDisplayEXT(nativeDisplay.getPlatformType(), nativeDisplay.getPlatformNative(), &legacyAttribs[0]);
                EGLU_CHECK_MSG(egl, "eglGetPlatformDisplayEXT()");
                TCU_CHECK(display != EGL_NO_DISPLAY);
        }