gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] [SCM] Gnash branch, openvg, updated. ea7360bf19bdc3705377


From: Rob Savoye
Subject: [Gnash-commit] [SCM] Gnash branch, openvg, updated. ea7360bf19bdc370537744dad62759fd8ce7e7b7
Date: Tue, 02 Nov 2010 23:47:56 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnash".

The branch, openvg has been updated
       via  ea7360bf19bdc370537744dad62759fd8ce7e7b7 (commit)
      from  c22cbb7585b050913462ec1ef1d481c6ff3f0c96 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit//commit/?id=ea7360bf19bdc370537744dad62759fd8ce7e7b7


commit ea7360bf19bdc370537744dad62759fd8ce7e7b7
Author: Rob Savoye <address@hidden>
Date:   Tue Nov 2 17:46:51 2010 -0600

    Add support for Pbuffers and native pixmaps.
    Add test cases for the above.

diff --git a/librender/eglDevice.cpp b/librender/eglDevice.cpp
index d269d42..f0f6390 100644
--- a/librender/eglDevice.cpp
+++ b/librender/eglDevice.cpp
@@ -66,6 +66,8 @@ static const EGLint attrib32_list[] = {
     EGL_STENCIL_SIZE,   8,
 #endif
     EGL_SURFACE_TYPE,   EGL_WINDOW_BIT,
+//    EGL_SAMPLE_BUFFERS, 1,
+    // EGL_RENDER_BUFFER, EGL_SINGLE_BUFFER
     EGL_NONE
 };
 
@@ -96,7 +98,7 @@ const EGLint window_attrib_list[] = {
     // EGL_SINGLE_BUFFER is by pixmap surfaces. With OpenVG, windows
     // can also be single buffered. eglCopyBuffers() can be used to copy
     // both back and single buffered surfaces to a pixmap.
-    EGL_RENDER_BUFFER, EGL_BACK_BUFFER,
+    EGL_RENDER_BUFFER, EGL_SINGLE_BUFFER,
     EGL_COLORSPACE,    EGL_COLORSPACE_sRGB,
     EGL_NONE
 };
@@ -171,6 +173,11 @@ EGLDevice::~EGLDevice()
 
     if (_eglDisplay != EGL_NO_DISPLAY) {  
         eglMakeCurrent(_eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, 
EGL_NO_CONTEXT);
+
+        std::vector<EGLSurface>::iterator it;
+        for (it = _pbuffers.begin(); it != _pbuffers.end(); ++it) {
+            eglDestroySurface(_eglDisplay, *it);
+        }
         
         if (_eglContext != EGL_NO_CONTEXT)
             eglDestroyContext(_eglDisplay, _eglContext);
@@ -183,6 +190,7 @@ EGLDevice::~EGLDevice()
         
         eglTerminate(_eglDisplay);
     }
+
     
 #ifdef HAVE_GTK2
     gdk_exit (0);
@@ -195,7 +203,7 @@ EGLDevice::initDevice(EGLDevice::rtype_t rtype)
     GNASH_REPORT_FUNCTION;
 
     // // FIXME: for now, always run verbose till this supports command line 
args
-//    dbglogfile.setVerbosity();
+    // dbglogfile.setVerbosity();
 
 #ifdef HAVE_GTK2
     // As gdk_init() wants the command line arguments, we have to create
@@ -311,8 +319,8 @@ EGLDevice::initDevice(EGLDevice::rtype_t rtype)
 
     gdk_image_destroy(tmpimage);
 #endif
-    
-   // printEGLConfig(_eglConfig);
+
+    // printEGLConfig(_eglConfig);
 #if 0
    if (!checkEGLConfig(_eglConfig)) {
        log_error("EGL configuration doesn't match!");
@@ -352,7 +360,8 @@ EGLDevice::initEGL(EGLNativeWindowType window)
 
     log_debug("Initializing EGL Surface");
     if (_nativeWindow) {
-        _eglSurface = eglCreateWindowSurface(_eglDisplay, _eglConfig, 
_nativeWindow, 0);
+        _eglSurface = eglCreateWindowSurface(_eglDisplay, _eglConfig, 
_nativeWindow,
+            window_attrib_list);
     } else {
         log_error("No native window!");
     }
@@ -636,6 +645,70 @@ EGLDevice::printEGLSurface(EGLSurface surface)
                  ? "EGL_MULTISAMPLE_RESOLVE_BOX" : 
"EGL_MULTISAMPLE_RESOLVE_DEFAULT") << std::endl;
 }
 
+// EGL WIDTH, EGL HEIGHT, EGL LARGEST PBUFFER, EGL TEXTURE FORMAT, 
+// EGL TEXTURE TARGET, EGL MIPMAP TEXTURE, EGL COLORSPACE, and EGL ALPHA 
FORMAT.
+EGLSurface
+EGLDevice::createPbuffer(int width, int height)
+{
+    const EGLint attribs[] = {
+        EGL_WIDTH,      width,
+        EGL_HEIGHT,     height,
+        EGL_NONE
+    };
+
+    EGLSurface pbuf = eglCreatePbufferSurface(_eglDisplay, _eglConfig, 
attribs);
+    if (pbuf == EGL_NO_SURFACE) {
+        log_error( "eglCreatePbufferSurface() failed (error 0x%x)", 
eglGetError());
+        return EGL_NO_SURFACE;
+    }
+
+    _pbuffers.push_back(pbuf);
+    
+    return pbuf;
+}
+EGLSurface
+EGLDevice::createPbuffer(int width, int height, EGLClientBuffer buf, EGLenum 
type)
+{
+    const EGLint attribs[] = {
+        EGL_WIDTH,      width,
+        EGL_HEIGHT,     height,
+        EGL_NONE
+    };
+
+    EGLSurface pbuf = eglCreatePbufferFromClientBuffer(_eglDisplay, type, buf,
+                                              _eglConfig, attribs);
+    if (pbuf == EGL_NO_SURFACE) {
+        log_error( "eglCreatePbufferFromClientBuffer() failed (error 0x%x)",
+                   eglGetError());
+        return EGL_NO_SURFACE;
+    }
+
+    _pbuffers.push_back(pbuf);
+    
+    return pbuf;
+}
+
+EGLSurface
+EGLDevice::createPixmap(int width, int height, NativePixmapType buf)
+{
+      const EGLint attribs[] = {
+        EGL_WIDTH,      width,
+        EGL_HEIGHT,     height,
+        EGL_NONE
+    };
+
+      EGLSurface pbuf = eglCreatePixmapSurface(_eglDisplay, _eglConfig, buf, 
attribs);
+    if (pbuf == EGL_NO_SURFACE) {
+        log_error( "eglCreatePbufferFromClientBuffer() failed (error 0x%x)",
+                   eglGetError());
+        return EGL_NO_SURFACE;
+    }
+
+    _pbuffers.push_back(pbuf);
+    
+    return pbuf;  
+}
+
 } // namespace renderer
 } // namespace gnash
 
diff --git a/librender/eglDevice.h b/librender/eglDevice.h
index 0b7e7c0..dfdeacd 100644
--- a/librender/eglDevice.h
+++ b/librender/eglDevice.h
@@ -59,11 +59,15 @@ class EGLDevice
     // Utility methods not in the base class
     /// Return a string with the error code as text, instead of a numeric value
     const char *getErrorString(int error);
+    
     /// Check the requested EGl configuration against the current one
     bool checkEGLConfig(EGLConfig config);
+    
     /// Query the system for all supported configs
     int queryEGLConfig() { return queryEGLConfig(_eglDisplay); };
     int queryEGLConfig(EGLDisplay display);
+
+    // Debugging utilities
     void printEGLConfig() { return printEGLConfig(_eglConfig); };
     void printEGLConfig(EGLConfig config);
     void printEGLContext() { return printEGLContext(_eglContext); };
@@ -71,16 +75,32 @@ class EGLDevice
     void printEGLSurface() { return printEGLSurface(_eglSurface); };
     void printEGLSurface(EGLSurface surface);
 
+    
+    // Create a Pbuffer for offscreen rendering
+    EGLSurface createPbuffer(int width, int height);
+    EGLSurface createPbuffer(int width, int height, EGLClientBuffer buf, 
EGLenum type);
+    EGLSurface createPixmap(int width, int height, NativePixmapType buf);
+    size_t totalPbuffers() { return _pbuffers.size(); };
+    EGLSurface &operator[](int index) { return _pbuffers[index]; };
+
     // Accessors for the settings needed by higher level code.
     // Surface accessors
     EGLint getWidth() {
+        return getWidth(_eglSurface);
+    }
+    
+    EGLint getWidth(EGLSurface surface) {
         EGLint value;
-        eglQuerySurface(_eglDisplay, _eglSurface, EGL_WIDTH, &value);
+        eglQuerySurface(_eglDisplay, surface, EGL_WIDTH, &value);
         return value;
     };
     EGLint getHeigth() {
+        return getHeigth(_eglSurface);
+    }
+    
+    EGLint getHeigth(EGLSurface surface) {
         EGLint value;
-        eglQuerySurface(_eglDisplay, _eglSurface, EGL_HEIGHT, &value);
+        eglQuerySurface(_eglDisplay, surface, EGL_HEIGHT, &value);
         return value;
     }
     EGLint getVerticalRes() {
@@ -94,8 +114,12 @@ class EGLDevice
         return value;
     }
     bool isSurfaceSingleBuffered() {
+        return isSurfaceSingleBuffered(_eglSurface);
+    }
+    
+    bool isSurfaceSingleBuffered(EGLSurface surface) {
         EGLint value;
-        eglQuerySurface(_eglDisplay, _eglSurface, EGL_RENDER_BUFFER, &value);
+        eglQuerySurface(_eglDisplay, surface, EGL_RENDER_BUFFER, &value);
         if (value == EGL_SINGLE_BUFFER) {
             return true;
         }
@@ -103,8 +127,11 @@ class EGLDevice
     }
     
     bool isSurfaceBackBuffered() {
+        return isSurfaceBackBuffered(_eglSurface);
+    }
+    bool isSurfaceBackBuffered(EGLSurface surface) {
         EGLint value;
-        eglQuerySurface(_eglDisplay, _eglSurface, EGL_RENDER_BUFFER, &value);
+        eglQuerySurface(_eglDisplay, surface, EGL_RENDER_BUFFER, &value);
         if (value == EGL_BACK_BUFFER) {
             return true;
         }
@@ -112,8 +139,11 @@ class EGLDevice
     }
 
     bool isBufferDestroyed() {
+        return isBufferDestroyed(_eglSurface);
+    }
+    bool isBufferDestroyed(EGLSurface surface) {
         EGLint value;
-        eglQuerySurface(_eglDisplay, _eglSurface, EGL_SWAP_BEHAVIOR, &value);
+        eglQuerySurface(_eglDisplay, surface, EGL_SWAP_BEHAVIOR, &value);
         if (value == EGL_BUFFER_DESTROYED) {
             return true;
         }
@@ -236,6 +266,7 @@ protected:
     unsigned int        _bpp;
     unsigned int        _width;
     unsigned int        _height;
+    std::vector<EGLSurface> _pbuffers;
 };
 
 #define DUMP_CURRENT_SURFACE printEGLSurface(eglGetCurrentSurface(EGL_DRAW))
diff --git a/librender/test_egl.cpp b/librender/test_egl.cpp
index f52ae7c..a68dd48 100644
--- a/librender/test_egl.cpp
+++ b/librender/test_egl.cpp
@@ -229,7 +229,28 @@ test_egl(EGLDevice &egl, EGLDevice::rtype_t rtype)
     } else {
         runtest.fail("EGLDevice::getMinSwapInterval()");
     }
+
+    // Test Pbuffers
+    EGLSurface surf = egl.createPbuffer(200, 200);
+    if ((surf != EGL_NO_SURFACE) && (egl.getWidth(surf) == 200)) {
+        runtest.pass("EGLDevice::createPbuffer(int, int)");
+    } else {
+        runtest.fail("EGLDevice::createPbuffer(int, int)");
+    }
+    
+    if (egl.totalPbuffers()) {
+        runtest.pass("EGLDevice::totalPbuffers()");
+    } else {
+        runtest.fail("EGLDevice::totalPbuffers()");
+    }
     
+    EGLSurface surf1 = egl[0];
+    if ((surf1 != EGL_NO_SURFACE) && (egl.getWidth(surf1) == 200)
+        && (egl.getHeigth(surf1) == 200)) {
+        runtest.pass("EGLDevice::operator[]()");
+    } else {
+        runtest.fail("EGLDevice::operator[]()");
+    }
 
 
 }

-----------------------------------------------------------------------

Summary of changes:
 librender/eglDevice.cpp |   83 ++++++++++++++++++++++++++++++++++++++++++++---
 librender/eglDevice.h   |   41 ++++++++++++++++++++---
 librender/test_egl.cpp  |   21 ++++++++++++
 3 files changed, 135 insertions(+), 10 deletions(-)


hooks/post-receive
-- 
Gnash



reply via email to

[Prev in Thread] Current Thread [Next in Thread]