[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.19-706-ge5415e9

jpetsovits at rim.com jpetsovits at rim.com
Thu Feb 4 21:23:41 UTC 2010


The following commit has been merged in the webkit-1.1 branch:
commit f63b54b744be28060c2e0f3006c5103dd245da3c
Author: jpetsovits at rim.com <jpetsovits at rim.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Jan 21 20:56:25 2010 +0000

    2010-01-21  Jakob Petsovits  <jpetsovits at rim.com>
    
            Reviewed by Adam Treat.
    
            Don't call vgGetError()/eglGetError() repeatedly
            https://bugs.webkit.org/show_bug.cgi?id=33959
    
            For vgGetError(), I missed the part of the spec where
            it says that calling that function clears the error
            and subsequent calls will return VG_NO_ERROR again.
    
            For eglGetError(), the specification doesn't mention
            that kind of behavior, and interpretations seem to
            differ between EGL implementations (even within
            Khronos: the OpenVG reference implementation doesn't
            reset the error code - and even mentions the difference
            to vgGetError() in a comment - whereas the online
            OpenGL ES API document explicitly specifies clearing
            the error code).
    
            It thus makes sense not to call either of the two
            error functions more than once for checking a single
            EGL/OpenVG call. This patch adapts assertions to
            accommodate for this behavior, and also needs to
            change surface creation methods as they previously
            relied on multiple calls of eglGetError().
    
            * platform/graphics/openvg/EGLDisplayOpenVG.cpp:
            (WebCore::EGLDisplayOpenVG::sharedPlatformSurface):
            (WebCore::EGLDisplayOpenVG::createPbufferSurface):
            * platform/graphics/openvg/EGLDisplayOpenVG.h:
            * platform/graphics/openvg/EGLUtils.h:
            * platform/graphics/openvg/SurfaceOpenVG.cpp:
            (WebCore::SurfaceOpenVG::SurfaceOpenVG):
            * platform/graphics/openvg/SurfaceOpenVG.h:
            * platform/graphics/openvg/VGUtils.h:
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@53639 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index d8dad58..7b14d13 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,40 @@
+2010-01-21  Jakob Petsovits  <jpetsovits at rim.com>
+
+        Reviewed by Adam Treat.
+
+        Don't call vgGetError()/eglGetError() repeatedly
+        https://bugs.webkit.org/show_bug.cgi?id=33959
+
+        For vgGetError(), I missed the part of the spec where
+        it says that calling that function clears the error
+        and subsequent calls will return VG_NO_ERROR again.
+
+        For eglGetError(), the specification doesn't mention
+        that kind of behavior, and interpretations seem to
+        differ between EGL implementations (even within
+        Khronos: the OpenVG reference implementation doesn't
+        reset the error code - and even mentions the difference
+        to vgGetError() in a comment - whereas the online
+        OpenGL ES API document explicitly specifies clearing
+        the error code).
+
+        It thus makes sense not to call either of the two
+        error functions more than once for checking a single
+        EGL/OpenVG call. This patch adapts assertions to
+        accommodate for this behavior, and also needs to
+        change surface creation methods as they previously
+        relied on multiple calls of eglGetError().
+
+        * platform/graphics/openvg/EGLDisplayOpenVG.cpp:
+        (WebCore::EGLDisplayOpenVG::sharedPlatformSurface):
+        (WebCore::EGLDisplayOpenVG::createPbufferSurface):
+        * platform/graphics/openvg/EGLDisplayOpenVG.h:
+        * platform/graphics/openvg/EGLUtils.h:
+        * platform/graphics/openvg/SurfaceOpenVG.cpp:
+        (WebCore::SurfaceOpenVG::SurfaceOpenVG):
+        * platform/graphics/openvg/SurfaceOpenVG.h:
+        * platform/graphics/openvg/VGUtils.h:
+
 2010-01-20  Simon Fraser  <simon.fraser at apple.com>
 
         Reviewed by Dave Hyatt.
diff --git a/WebCore/platform/graphics/openvg/EGLDisplayOpenVG.cpp b/WebCore/platform/graphics/openvg/EGLDisplayOpenVG.cpp
index 576dc5b..3c7eaf2 100644
--- a/WebCore/platform/graphics/openvg/EGLDisplayOpenVG.cpp
+++ b/WebCore/platform/graphics/openvg/EGLDisplayOpenVG.cpp
@@ -222,7 +222,6 @@ SurfaceOpenVG* EGLDisplayOpenVG::sharedPlatformSurface()
         // We'll just make the shared surface as small as possible: 1x1 pixel.
         EGLConfig config = defaultPbufferConfig();
         EGLSurface surface = createPbufferSurface(IntSize(1, 1), config);
-        ASSERT_EGL_NO_ERROR();
 
         EGLContext context = eglCreateContext(m_display, config, EGL_NO_CONTEXT, 0);
         ASSERT_EGL_NO_ERROR();
@@ -237,7 +236,7 @@ SurfaceOpenVG* EGLDisplayOpenVG::sharedPlatformSurface()
     return m_sharedPlatformSurface;
 }
 
-EGLSurface EGLDisplayOpenVG::createPbufferSurface(const IntSize& size, const EGLConfig& config)
+EGLSurface EGLDisplayOpenVG::createPbufferSurface(const IntSize& size, const EGLConfig& config, EGLint* errorCode)
 {
     const EGLint attribList[] = {
         EGL_WIDTH, size.width(),
@@ -245,7 +244,13 @@ EGLSurface EGLDisplayOpenVG::createPbufferSurface(const IntSize& size, const EGL
         EGL_NONE
     };
     EGLSurface surface = eglCreatePbufferSurface(m_display, config, attribList);
-    if (eglGetError() != EGL_SUCCESS)
+
+    if (errorCode)
+        *errorCode = eglGetError();
+    else
+        ASSERT_EGL_NO_ERROR();
+
+    if (surface == EGL_NO_SURFACE)
         return EGL_NO_SURFACE;
 
     EGLint surfaceConfigId;
diff --git a/WebCore/platform/graphics/openvg/EGLDisplayOpenVG.h b/WebCore/platform/graphics/openvg/EGLDisplayOpenVG.h
index 5d367c5..fd8353d 100644
--- a/WebCore/platform/graphics/openvg/EGLDisplayOpenVG.h
+++ b/WebCore/platform/graphics/openvg/EGLDisplayOpenVG.h
@@ -47,8 +47,10 @@ public:
 
     /** Creates a pbuffer surface using the given config. If no surface
      * could be created, EGL_NO_SURFACE is returned and errors can be
-     * caught with eglGetError() (respectively ASSERT_EGL_NO_ERROR()). */
-    EGLSurface createPbufferSurface(const IntSize&, const EGLConfig&);
+     * checked with the value that is written to the errorCode parameter
+     * If no surface could be created and errorCode is zero, this method
+     * will trigger an assertion by itself. */
+    EGLSurface createPbufferSurface(const IntSize&, const EGLConfig&, EGLint* errorCode = 0);
 
     EGLSurface surfaceForWindow(EGLNativeWindowType, const EGLConfig&);
 
diff --git a/WebCore/platform/graphics/openvg/EGLUtils.h b/WebCore/platform/graphics/openvg/EGLUtils.h
index 84e318e..6f5d793 100644
--- a/WebCore/platform/graphics/openvg/EGLUtils.h
+++ b/WebCore/platform/graphics/openvg/EGLUtils.h
@@ -62,8 +62,10 @@ static inline const char* toEGLErrorConstant(EGLint error)
 #if ASSERT_DISABLED
 #define ASSERT_EGL_NO_ERROR() ((void)0)
 #else
-#define ASSERT_EGL_NO_ERROR() \
-    ASSERT_WITH_MESSAGE(eglGetError() == VG_NO_ERROR, "Found %s", toEGLErrorConstant(eglGetError()))
+#define ASSERT_EGL_NO_ERROR() do { \
+    EGLint eglErrorCode = eglGetError(); \
+    ASSERT_WITH_MESSAGE(eglErrorCode == EGL_SUCCESS, "Found %s", toEGLErrorConstant(eglErrorCode)); \
+} while (0)
 #endif
 
 #endif
diff --git a/WebCore/platform/graphics/openvg/SurfaceOpenVG.cpp b/WebCore/platform/graphics/openvg/SurfaceOpenVG.cpp
index 88a8f91..dcb2709 100644
--- a/WebCore/platform/graphics/openvg/SurfaceOpenVG.cpp
+++ b/WebCore/platform/graphics/openvg/SurfaceOpenVG.cpp
@@ -44,7 +44,7 @@ SurfaceOpenVG* SurfaceOpenVG::currentSurface()
 }
 
 #if PLATFORM(EGL)
-SurfaceOpenVG::SurfaceOpenVG(const IntSize& size, const EGLDisplay& display, EGLConfig* confPtr)
+SurfaceOpenVG::SurfaceOpenVG(const IntSize& size, const EGLDisplay& display, EGLConfig* confPtr, EGLint* errorCode)
     : m_eglDisplay(display)
     , m_eglSurface(EGL_NO_SURFACE)
     , m_eglContext(EGL_NO_CONTEXT)
@@ -53,7 +53,7 @@ SurfaceOpenVG::SurfaceOpenVG(const IntSize& size, const EGLDisplay& display, EGL
 
     EGLDisplayOpenVG* displayManager = EGLDisplayOpenVG::forDisplay(m_eglDisplay);
     EGLConfig config = confPtr ? (*confPtr) : displayManager->defaultPbufferConfig();
-    m_eglSurface = displayManager->createPbufferSurface(size, config);
+    m_eglSurface = displayManager->createPbufferSurface(size, config, errorCode);
 
     if (m_eglSurface == EGL_NO_SURFACE)
         return;
@@ -72,9 +72,7 @@ SurfaceOpenVG::SurfaceOpenVG(EGLNativeWindowType window, const EGLDisplay& displ
     EGLDisplayOpenVG* displayManager = EGLDisplayOpenVG::forDisplay(m_eglDisplay);
     EGLConfig config = confPtr ? (*confPtr) : displayManager->defaultWindowConfig();
     m_eglSurface = displayManager->surfaceForWindow(window, config);
-
-    if (m_eglSurface == EGL_NO_SURFACE)
-        return;
+    ASSERT(m_eglSurface != EGL_NO_SURFACE);
 
     m_eglContext = displayManager->contextForSurface(m_eglSurface);
     EGLDisplayOpenVG::registerPlatformSurface(this);
diff --git a/WebCore/platform/graphics/openvg/SurfaceOpenVG.h b/WebCore/platform/graphics/openvg/SurfaceOpenVG.h
index 37b17e7..751c143 100644
--- a/WebCore/platform/graphics/openvg/SurfaceOpenVG.h
+++ b/WebCore/platform/graphics/openvg/SurfaceOpenVG.h
@@ -54,21 +54,17 @@ public:
      * the given display. If config is not specified, the display's default
      * pbuffer config is used.
      *
-     * For reasons of recoverability (e.g. ImageBuffer's "bool success"
-     * return value), this constructor won't assert if creation of the surface
-     * fails. Make sure to check successful surface creation with either
-     * ASSERT_EGL_NO_ERROR() or the surface's isValid() method.
+     * This constructor will trigger an assertion if creation of the surface
+     * fails, unless you pledge to manually process the error code by passing
+     * a non-zero pointer as errorCode parameter. The error code returned by
+     * eglGetError() will be written to that variable.
      */
-    SurfaceOpenVG(const IntSize& size, const EGLDisplay& display, EGLConfig* config = 0);
+    SurfaceOpenVG(const IntSize& size, const EGLDisplay& display, EGLConfig* config = 0, EGLint* errorCode = 0);
 
     /**
      * Create a new EGL window surface with the specified native window handle
      * and config on the given display. If config is not specified, the
      * display's default window config is used.
-     *
-     * For reasons of recoverability, this constructor won't assert if creation
-     * of the surface fails. Make sure to check successful surface creation
-     * with either ASSERT_EGL_NO_ERROR() or the surface's isValid() method.
      */
     SurfaceOpenVG(EGLNativeWindowType window, const EGLDisplay& display, EGLConfig* config = 0);
 
diff --git a/WebCore/platform/graphics/openvg/VGUtils.h b/WebCore/platform/graphics/openvg/VGUtils.h
index f08e06e..8276d71 100644
--- a/WebCore/platform/graphics/openvg/VGUtils.h
+++ b/WebCore/platform/graphics/openvg/VGUtils.h
@@ -50,8 +50,10 @@ static inline const char* toVGErrorConstant(VGErrorCode error)
 #if ASSERT_DISABLED
 #define ASSERT_VG_NO_ERROR() ((void)0)
 #else
-#define ASSERT_VG_NO_ERROR() \
-    ASSERT_WITH_MESSAGE(vgGetError() == VG_NO_ERROR, "Found %s", toVGErrorConstant(vgGetError()))
+#define ASSERT_VG_NO_ERROR() do { \
+    VGErrorCode vgErrorCode = vgGetError(); \
+    ASSERT_WITH_MESSAGE(vgErrorCode == VG_NO_ERROR, "Found %s", toVGErrorConstant(vgErrorCode)); \
+} while (0)
 #endif
 
 #endif

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list