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. 79304200638161e380ab


From: Rob Savoye
Subject: [Gnash-commit] [SCM] Gnash branch, openvg, updated. 79304200638161e380abf72a734327e1456047c9
Date: Sat, 11 Dec 2010 03:24:33 +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  79304200638161e380abf72a734327e1456047c9 (commit)
       via  90cd4e808c785703b78fed38aa7e53327eafb2b3 (commit)
       via  f9a9f36409192a8e4aa54936fb7b77bc236d71c1 (commit)
       via  27c8acf865512d093bee9d4b37915f5418b1aff0 (commit)
       via  e0cadeb90646d41837332879d2da4e4c2a89246f (commit)
       via  cc5b7e739981fcf862f185275a23020ab7db8299 (commit)
       via  1e0c991bcba73089ec92c187d687913351cb320e (commit)
       via  e68775c062caec2b2c0aa1aed36ce5a797bec1da (commit)
       via  ecfcdb8d363fda96d5aba328e79f95eb1ab450be (commit)
       via  dd6bd67f11bf7580914d01170d4b84c29f1f1f13 (commit)
       via  2b9d805b11a71060d0495c38a22afc686af7d5df (commit)
       via  a33ea12b01a2ef5c82f4a6cecae1a811a81e7beb (commit)
       via  c36e75f1b03b2e0d967ac589caba1324e6457e39 (commit)
       via  16158610971c1c4711048d5493e2d4f1448e9d60 (commit)
       via  76aa4caf6e4f32e70acef3f116aa7e8a33c1353a (commit)
       via  1d767c816058f248015af68391db57ff01da90dc (commit)
       via  8e3d9e06a47f3472d209ca82e40d00ee294bee40 (commit)
       via  c838ae4b8a4618f13f56b1233125f22d1e48708a (commit)
      from  eafe1c943cae1e57aee3292468ceb44bd68c9c67 (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=79304200638161e380abf72a734327e1456047c9


commit 79304200638161e380abf72a734327e1456047c9
Author: Rob Savoye <address@hidden>
Date:   Fri Dec 10 20:23:23 2010 -0700

    rearrange heavily where code lives, as it's being separated into the rawFB 
device layer and the glue layer from fb.cpp

diff --git a/gui/fb/fb.cpp b/gui/fb/fb.cpp
index f4b304a..c36f94c 100644
--- a/gui/fb/fb.cpp
+++ b/gui/fb/fb.cpp
@@ -153,23 +153,22 @@ terminate_signal(int /*signo*/) {
 
 FBGui::FBGui(unsigned long xid, float scale, bool loop, RunResources& r)
     : Gui(xid, scale, loop, r),
-      fd(-1),
-      original_vt(-1),
-      original_kd(-1),
-      own_vt(-1),
-      fbmem(0),
-      buffer(0),        // the real value is set by ENABLE_DOUBLE_BUFFERING
+      _fd(-1),
+      _original_vt(-1),
+      _original_kd(-1),
+      _own_vt(-1),
       _xpos(0),
       _ypos(0),  
-      m_rowsize(0),
+      _rowsize(0),
       _timeout(0)
 {
     GNASH_REPORT_FUNCTION;
     
     // initializing to zero helps with debugging and prevents weird bugs
 //    memset(mouse_buf, 0, 256);
-    memset(&var_screeninfo, 0, sizeof(fb_var_screeninfo));
-    memset(&fix_screeninfo, 0, sizeof(fb_fix_screeninfo));
+    memset(&_var_screeninfo, 0, sizeof(fb_var_screeninfo));
+    memset(&_fix_screeninfo, 0, sizeof(fb_fix_screeninfo));
+    memset(&_cmap, 0, sizeof(struct fb_cmap));
 
     signal(SIGINT, terminate_signal);
     signal(SIGTERM, terminate_signal);
@@ -179,18 +178,11 @@ FBGui::~FBGui()
 {  
     GNASH_REPORT_FUNCTION;
     
-    if (fd > 0) {
+    if (_fd > 0) {
         enable_terminal();
         log_debug(_("Closing framebuffer device"));
-        close(fd);
+        close(_fd);
     }
-
-#ifdef ENABLE_DOUBLE_BUFFERING
-    if (buffer) {
-        log_debug(_("Free'ing offscreen buffer"));
-        free(buffer);
-    }
-#endif
 }
 
 bool
@@ -223,9 +215,9 @@ FBGui::set_grayscale_lut8()
     }
 
 #ifdef ENABLE_FAKE_FRAMEBUFFER
-    if (fakefb_ioctl(fd, FBIOPUTCMAP, &cmap))
+    if (fakefb_ioctl(_fd, FBIOPUTCMAP, &_cmap))
 #else
-    if (ioctl(fd, FBIOPUTCMAP, &cmap))
+    if (ioctl(_fd, FBIOPUTCMAP, &_cmap))
 #endif
     {
         log_error(_("LUT8: Error setting colormap: %s"), strerror(errno));
@@ -250,51 +242,42 @@ FBGui::init(int argc, char *** argv)
         log_error("Found no accessible input event devices");
     }
     
+#if 0
+    // FIME: moved to fb_glue_agg.cpp
+    
     // Open the framebuffer device
 #ifdef ENABLE_FAKE_FRAMEBUFFER
-    fd = open(FAKEFB, O_RDWR);
+    _fd = open(FAKEFB, O_RDWR);
+    log_debug("WARNING: Using %s as a fake framebuffer!", FAKEFB);
 #else
-    fd = open("/dev/fb0", O_RDWR);
+    _fd = open("/dev/fb0", O_RDWR);
 #endif
-    if (fd < 0) {
+    if (_fd < 0) {
         log_error("Could not open framebuffer device: %s", strerror(errno));
         return false;
     }
   
     // Load framebuffer properties
 #ifdef ENABLE_FAKE_FRAMEBUFFER
-    fakefb_ioctl(fd, FBIOGET_VSCREENINFO, &var_screeninfo);
-    fakefb_ioctl(fd, FBIOGET_FSCREENINFO, &fix_screeninfo);
+    fakefb_ioctl(_fd, FBIOGET_VSCREENINFO, &_var_screeninfo);
+    fakefb_ioctl(_fd, FBIOGET_FSCREENINFO, &_fix_screeninfo);
 #else
-    ioctl(fd, FBIOGET_VSCREENINFO, &var_screeninfo);
-    ioctl(fd, FBIOGET_FSCREENINFO, &fix_screeninfo);
+    ioctl(_fd, FBIOGET_VSCREENINFO, &_var_screeninfo);
+    ioctl(_fd, FBIOGET_FSCREENINFO, &_fix_screeninfo);
 #endif
     log_debug(_("Framebuffer device uses %d bytes of memory."),
-              fix_screeninfo.smem_len);
+              _fix_screeninfo.smem_len);
     log_debug(_("Video mode: %dx%d with %d bits per pixel."),
-              var_screeninfo.xres, var_screeninfo.yres, 
var_screeninfo.bits_per_pixel);
-
-    // map framebuffer into memory
-    fbmem = (unsigned char *)
-        mmap(0, fix_screeninfo.smem_len, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 
0);
-
-#ifdef ENABLE_DOUBLE_BUFFERING
-    // allocate offscreen buffer
-    buffer = (unsigned char*)malloc(fix_screeninfo.smem_len);
-    memset(buffer, 0, fix_screeninfo.smem_len);
-#endif  
-
-#ifdef PIXELFORMAT_LUT8
-    // Set grayscale for 8 bit modes
-    if (var_screeninfo.bits_per_pixel==8) {
-        if (!set_grayscale_lut8())
-            return false;
-    }
-#endif
+              _var_screeninfo.xres, _var_screeninfo.yres,
+              _var_screeninfo.bits_per_pixel);
 
+    _fbmem.reset(static_cast<boost::uint8_t *>(mmap(0, _fixinfo.smem_len,
+                                                    PROT_READ|PROT_WRITE, 
MAP_SHARED,
+                                                    _fd, 0)));
+    
     // Set "window" size
-    _width    = var_screeninfo.xres;
-    _height   = var_screeninfo.yres;
+    _width    = _var_screeninfo.xres;
+    _height   = _var_screeninfo.yres;
 
     // Let -j -k override "window" size
     optind = 0; opterr = 0; char c;
@@ -315,28 +298,32 @@ FBGui::init(int argc, char *** argv)
         }
     }
 
-    if ( _xpos < 0 ) _xpos += var_screeninfo.xres - _width;
-    _xpos = clamp<int>(_xpos, 0, var_screeninfo.xres-_width);
+    if ( _xpos < 0 ) _xpos += _var_screeninfo.xres - _width;
+    _xpos = clamp<int>(_xpos, 0, _var_screeninfo.xres-_width);
 
-    if ( _ypos < 0 ) _ypos += var_screeninfo.yres - _height;
-    _ypos = clamp<int>(_ypos, 0, var_screeninfo.yres-_height);
+    if ( _ypos < 0 ) _ypos += _var_screeninfo.yres - _height;
+    _ypos = clamp<int>(_ypos, 0, _var_screeninfo.yres-_height);
 
     log_debug("Width:%d, Height:%d", _width, _height);
     log_debug("X:%d, Y:%d", _xpos, _ypos);
 
     _validbounds.setTo(0, 0, _width - 1, _height - 1);
+#endif
 
-    // Create a new Glue layer
-    _glue.reset(new FBAggGlue);
+    // the current renderer as set on the command line or gnashrc file
+    std::string renderer = _runResources.getRenderBackend();
 
-    // Initialize the renderer
+    // map framebuffer into memory
+    // Create a new Glue layer
+    // if (renderer == "agg") {
+    _glue.reset(new FBAggGlue());
+    // } else if (renderer = "openvg") {
+    //     _glue.reset(new FBOvgGlue);
+    // }
+        
+    // Initialize the glue layer between the renderer and the gui toolkit
     _glue->init(argc, argv);
 
-    // The agg glue file defines a typedef of Renderer, so we have to make sure
-    gnash::Renderer *rend = reinterpret_cast<gnash::Renderer *>
-                                             _glue->createRenderHandler());
-    _renderer.reset(rend);
-    
     return true;
 }
 
@@ -386,7 +373,7 @@ FBGui::renderBuffer()
 {
     GNASH_REPORT_FUNCTION;
 
-    if ( _drawbounds.size() == 0 ) return; // nothing to do..
+    // if ( _drawbounds.size() == 0 ) return; // nothing to do..
 
 #ifdef ENABLE_DOUBLE_BUFFERING
 
@@ -409,12 +396,13 @@ FBGui::renderBuffer()
         for (int y=bounds.getMinY(), y1=y+_ypos; y<=maxy; ++y, ++y1) {
             const unsigned int pix_idx_in = y*m_rowsize + minx*pixel_size;
             const unsigned int pix_idx_out = y1*m_rowsize + minx1*pixel_size;
-            memcpy(&fbmem[pix_idx_out], &buffer[pix_idx_in], row_size);
+            memcpy(&(fbmem[pix_idx_out]), &buffer[pix_idx_in], row_size);
         }
     }  
        
 #endif
-  
+
+    // FIXME: should call swapBuffer()
 }
 
 bool
@@ -423,11 +411,7 @@ FBGui::createWindow(const char* /*title*/, int /*width*/, 
int /*height*/,
 {
     GNASH_REPORT_FUNCTION;
     
-    // Now initialize AGG
-//    return initialize_renderer();
-//    _renderer->createRenderHandler();
-
-    return false;
+    return true;
 }
 
 bool
@@ -484,35 +468,19 @@ FBGui::showMouse(bool /*show*/)
 }
 
 void
-FBGui::setInvalidatedRegion(const SWFRect& /* bounds */)
+FBGui::setInvalidatedRegion(const SWFRect& bounds)
 {
     GNASH_REPORT_FUNCTION;
+
+//    _glue->setInvalidatedRegion(bounds);
 }
 
 void
 FBGui::setInvalidatedRegions(const InvalidatedRanges& ranges)
-{
-    GNASH_REPORT_FUNCTION;
-    
-    if (!_renderer) {
-        log_error("No renderer set!");
-        return;
-    }
-    _renderer->set_invalidated_regions(ranges);
-    
-    _drawbounds.clear();
-    
-    for (size_t rno = 0; rno<ranges.size(); rno++) {
-        geometry::Range2d<int> bounds = Intersection(
-            _renderer->world_to_pixel(ranges.getRange(rno)),
-            _validbounds);
-        
-        // it may happen that a particular range is out of the screen, which 
-        // will lead to bounds==null. 
-        if (bounds.isNull()) continue; 
-        
-        _drawbounds.push_back(bounds);   
-    }
+ {
+     GNASH_REPORT_FUNCTION;
+
+//    _glue->setInvalidatedRegions(ranges);
 }
 
 char *
@@ -551,7 +519,7 @@ FBGui::find_accessible_tty(const char* format, int no)
 bool
 FBGui::disable_terminal() 
 {
-    original_kd = -1;
+    _original_kd = -1;
     
     struct vt_stat vts;
     
@@ -578,64 +546,66 @@ FBGui::disable_terminal()
     
     if (ioctl(fd, VT_GETSTATE, &vts) == -1) {
         log_debug(_("WARNING: Could not get current VT state"));
-        close(fd);
+        close(_fd);
         return false;
     }
     
-    original_vt = vts.v_active;
-    log_debug(_("Original TTY NO = %d"), original_vt);   
+    _original_vt = vts.v_active;
+    log_debug(_("Original TTY NO = %d"), _original_vt);
   
 #ifdef REQUEST_NEW_VT
     // Request a new VT number
-    if (ioctl(fd, VT_OPENQRY, &own_vt) == -1) {
+    if (ioctl(fd, VT_OPENQRY, &_own_vt) == -1) {
         log_debug(_("WARNING: Could not request a new VT"));
         close(fd);
         return false;
     }
   
-    log_debug(_("Own TTY NO = %d"), own_vt);
+    log_debug(_("Own TTY NO = %d"), _own_vt);
 
     if (fd > 0) {
         close(fd);
     }
   
     // Activate our new VT
-    tty = find_accessible_tty(own_vt);
+    tty = find_accessible_tty(_own_vt);
     if (!tty) {
-        log_debug(_("WARNING: Could not find device for VT number %d"), 
own_vt);
+        log_debug(_("WARNING: Could not find device for VT number %d"), 
_own_vt);
         return false;
     }
   
-    fd = open(tty, O_RDWR);
+    _fd = open(tty, O_RDWR);
     if (fd < 0) {
         log_debug(_("WARNING: Could not open %s"), tty);
         return false;
     }
   
-    if (ioctl(fd, VT_ACTIVATE, own_vt) == -1) {
-        log_debug(_("WARNING: Could not activate VT number %d"), own_vt);
+    if (ioctl(fd, VT_ACTIVATE, _own_vt) == -1) {
+        log_debug(_("WARNING: Could not activate VT number %d"), _own_vt);
         close(fd);
         return false;
     }
   
-    if (ioctl(fd, VT_WAITACTIVE, own_vt) == -1) {
-        log_debug(_("WARNING: Error waiting for VT %d becoming active"), 
own_vt);
+    if (ioctl(fd, VT_WAITACTIVE, _own_vt) == -1) {
+        log_debug(_("WARNING: Error waiting for VT %d becoming active"),
+                  _own_vt);
         //close(tty);
         //return false;   don't abort
     }
 
 #else
 
-    own_vt = original_vt;   // keep on using the original VT
+    _own_vt = _original_vt;   // keep on using the original VT
   
     if (fd > 0) {
         close(fd);
     }
   
     // Activate our new VT
-    tty = find_accessible_tty(own_vt);
+    tty = find_accessible_tty(_own_vt);
     if (!tty) {
-        log_debug(_("WARNING: Could not find device for VT number %d"), 
own_vt);
+        log_debug(_("WARNING: Could not find device for VT number %d"),
+                  _own_vt);
         return false;
     }
   
@@ -645,18 +615,18 @@ FBGui::disable_terminal()
         return false;
     }
   
-    /*
+#if 0
     // Become session leader and attach to terminal
     setsid();
     if (ioctl(fd, TIOCSCTTY, 0) == -1) {
     log_debug(_("WARNING: Could not attach controlling terminal (%s)"), tty);
     }
-    */
-#endif  
+#endif
+#endif  // end of if REQUEST_NEW_VT
   
     // Disable keyboard cursor
   
-    if (ioctl(fd, KDGETMODE, &original_kd) == -1) {
+    if (ioctl(fd, KDGETMODE, &_original_kd) == -1) {
         log_debug(_("WARNING: Could not query current keyboard mode on VT"));
     }
 
@@ -668,7 +638,7 @@ FBGui::disable_terminal()
         close(fd);
     }
   
-    log_debug(_("VT %d ready"), own_vt);  
+    log_debug(_("VT %d ready"), _own_vt);  
   
     // NOTE: We could also implement virtual console switching by using 
     // VT_GETMODE / VT_SETMODE ioctl calls and handling their signals, but
@@ -682,9 +652,9 @@ FBGui::enable_terminal()
 {
     log_debug(_("Restoring terminal..."));
 
-    char* tty = find_accessible_tty(own_vt);
+    char* tty = find_accessible_tty(_own_vt);
     if (!tty) {
-        log_debug(_("WARNING: Could not find device for VT number %d"), 
own_vt);
+        log_debug(_("WARNING: Could not find device for VT number %d"), 
_own_vt);
         return false;
     }
 
@@ -694,21 +664,22 @@ FBGui::enable_terminal()
         return false;
     }
 
-    if (ioctl(fd, VT_ACTIVATE, original_vt)) {
-        log_debug(_("WARNING: Could not activate VT number %d"), original_vt);
-        close(fd);
+    if (ioctl(fd, VT_ACTIVATE, _original_vt)) {
+        log_debug(_("WARNING: Could not activate VT number %d"), _original_vt);
+        close(_fd);
         return false;
     }
 
-    if (ioctl(fd, VT_WAITACTIVE, original_vt)) {
-        log_debug(_("WARNING: Error waiting for VT %d becoming active"), 
original_vt);
+    if (ioctl(fd, VT_WAITACTIVE, _original_vt)) {
+        log_debug(_("WARNING: Error waiting for VT %d becoming active"),
+                  _original_vt);
         //close(tty);
         //return false;   don't abort
     }  
   
     // Restore keyboard
   
-    if (ioctl(fd, KDSETMODE, original_kd)) {
+    if (ioctl(fd, KDSETMODE, _original_kd)) {
         log_debug(_("WARNING: Could not restore keyboard mode"));
     }  
 
@@ -734,114 +705,6 @@ FBGui::checkForData()
 } // end of namespace gui
 } // end of namespace gnash
 
-#ifdef ENABLE_FAKE_FRAMEBUFFER
-// Simulate the ioctls used to get information from the framebuffer
-// driver. Since this is an emulator, we have to set these fields
-// to a reasonable default.
-int
-fakefb_ioctl(int /* fd */, int request, void *data)
-{
-    // GNASH_REPORT_FUNCTION;
-    
-    switch (request) {
-      case FBIOGET_VSCREENINFO:
-      {
-          struct fb_var_screeninfo *ptr =
-              reinterpret_cast<struct fb_var_screeninfo *>(data);
-          // If we are using a simulated framebuffer, the default for
-          // fbe us 640x480, 8bits. So use that as a sensible
-          // default. Note that the fake framebuffer is only used for
-          // debugging and development.
-          ptr->xres          = 640; // visible resolution
-          ptr->xres_virtual  = 640; // virtual resolution
-          ptr->yres          = 480; // visible resolution
-          ptr->yres_virtual  = 480; // virtual resolution
-          ptr->width         = 640; // width of picture in mm
-          ptr->height        = 480; // height of picture in mm
-
-          // Android and fbe use a 16bit 5/6/5 framebuffer
-          ptr->bits_per_pixel = 16;
-          ptr->red.length    = 5;
-          ptr->red.offset    = 11;
-          ptr->green.length  = 6;
-          ptr->green.offset  = 5;
-          ptr->blue.length   = 5;
-          ptr->blue.offset   = 0;
-          ptr->transp.offset = 0;
-          ptr->transp.length = 0;
-          // 8bit framebuffer
-          // ptr->bits_per_pixel = 8;
-          // ptr->red.length    = 8;
-          // ptr->red.offset    = 0;
-          // ptr->green.length  = 8;
-          // ptr->green.offset  = 0;
-          // ptr->blue.length   = 8;
-          // ptr->blue.offset   = 0;
-          // ptr->transp.offset = 0;
-          // ptr->transp.length = 0;
-          ptr->grayscale     = 1; // != 0 Graylevels instead of color
-          
-          break;
-      }
-      case FBIOGET_FSCREENINFO:
-      {
-          struct fb_fix_screeninfo *ptr =
-              reinterpret_cast<struct fb_fix_screeninfo *>(data);
-          ptr->smem_len = 307200; // Length of frame buffer mem
-          ptr->type = FB_TYPE_PACKED_PIXELS; // see FB_TYPE_*
-          ptr->visual = FB_VISUAL_PSEUDOCOLOR; // see FB_VISUAL_*
-          ptr->xpanstep = 0;      // zero if no hardware panning
-          ptr->ypanstep = 0;      // zero if no hardware panning
-          ptr->ywrapstep = 0;     // zero if no hardware panning
-          ptr->accel = FB_ACCEL_NONE; // Indicate to driver which specific
-                                  // chip/card we have
-          break;
-      }
-      case FBIOPUTCMAP:
-      {
-          // Fbe uses this name for the fake framebuffer, so in this
-          // case assume we're using fbe, so write to the known fbe
-          // cmap file.
-          std::string str = FAKEFB;
-          if (str == "/tmp/fbe_buffer") {
-              int fd = open("/tmp/fbe_cmap", O_WRONLY);
-              if (fd) {
-                  write(fd, data, sizeof(struct fb_cmap));
-                  close(fd);
-              } else {
-                  gnash::log_error("Couldn't write to the fake cmap!");
-                  return -1;
-              }
-          } else {
-              gnash::log_error("Couldn't write to the fake cmap, unknown 
type!");
-              return -1;
-          }
-          // If we send a SIGUSR1 signal to fbe, it'll reload the
-          // color map.
-          int fd = open("/tmp/fbe.pid", O_RDONLY);
-          char buf[10];
-          if (fd) {
-              if (read(fd, buf, 10) == 0) {
-                  close(fd);
-                  return -1;
-              } else {
-                  pid_t pid = strtol(buf, 0, NULL);
-                  kill(pid, SIGUSR1);
-                  gnash::log_debug("Signaled fbe to reload it's colormap.");
-              }
-              close(fd);
-          }
-          break;
-      }
-      default:
-          gnash::log_unimpl("fakefb_ioctl(%d)", request);
-          break;
-    }
-
-    return 0;
-}
-#endif  // ENABLE_FAKE_FRAMEBUFFER
-
 // Local Variables:
 // mode: C++
 // indent-tabs-mode: nil
diff --git a/gui/fb/fb_glue_agg.cpp b/gui/fb/fb_glue_agg.cpp
index 9ccac9c..2d5cbc9 100644
--- a/gui/fb/fb_glue_agg.cpp
+++ b/gui/fb/fb_glue_agg.cpp
@@ -25,6 +25,7 @@
 #include <cstring>
 #include <boost/cstdint.hpp>
 #include <boost/shared_ptr.hpp>
+#include <fcntl.h>
 
 #include "log.h"
 #include "Renderer.h"
@@ -33,6 +34,10 @@
 #include "RunResources.h"
 #include "fb_glue_agg.h"
 
+#ifdef BUILD_RAWFB_DEVICE
+#include "rawfb/RawFBDevice.h"
+#endif
+
 namespace gnash {
 
 namespace gui {
@@ -47,12 +52,19 @@ FBGlue::~FBGlue()
     GNASH_REPORT_FUNCTION;
 }
 
+//---------------------------------------------
 FBAggGlue::FBAggGlue()
+    : _fd(-1)
 {
     GNASH_REPORT_FUNCTION;
+    memset(&_varinfo, 0, sizeof(fb_var_screeninfo));
+    memset(&_fixinfo, 0, sizeof(fb_fix_screeninfo));
+}
 
-    memset(&_var_screeninfo, 0, sizeof(struct fb_var_screeninfo));
-    memset(&_fix_screeninfo, 0, sizeof(struct fb_fix_screeninfo));
+FBAggGlue::FBAggGlue(int fd)
+    : _fd(fd)
+{
+    GNASH_REPORT_FUNCTION;    
 }
 
 FBAggGlue::~FBAggGlue()
@@ -66,56 +78,69 @@ FBAggGlue::~FBAggGlue()
 }
 
 void
-FBAggGlue::setInvalidatedRegions(const InvalidatedRanges & /* ranges */)
+FBAggGlue::setInvalidatedRegion(const SWFRect &/*bounds */)
 {
     GNASH_REPORT_FUNCTION;
-
+    if (!_renderer) {
+        log_error("No renderer set!");
+        return;
+    }
 }
 
-bool
-FBAggGlue::init (int /* argc */, char *** /* argv */)
+void
+FBAggGlue::setInvalidatedRegions(const InvalidatedRanges &ranges)
 {
     GNASH_REPORT_FUNCTION;
+    if (!_renderer) {
+        log_error("No renderer set!");
+        return;
+    }
 
-    // Load framebuffer properties
-#ifdef ENABLE_FAKE_FRAMEBUFFER
-    fakefb_ioctl(_fd, FBIOGET_VSCREENINFO, &_var_screeninfo);
-    fakefb_ioctl(_fd, FBIOGET_FSCREENINFO, &_fix_screeninfo);
-#else  // ENABLE_FAKE_FRAMEBUFFER
-    ioctl(_fd, FBIOGET_VSCREENINFO, &_var_screeninfo);
-    ioctl(_fd, FBIOGET_FSCREENINFO, &_fix_screeninfo);
-#endif
-    
-    log_debug(_("Framebuffer device uses %d bytes of memory."),
-             _fix_screeninfo.smem_len);
-    log_debug(_("Video mode: %dx%d with %d bits per pixel."),
-             _var_screeninfo.xres, _var_screeninfo.yres,
-              _var_screeninfo.bits_per_pixel);
+    _renderer->set_invalidated_regions(ranges);
     
-    // map framebuffer into memory
-    _fbmem.reset(static_cast<boost::uint8_t *>(mmap(0, 
_fix_screeninfo.smem_len,
-                                          PROT_READ|PROT_WRITE, MAP_SHARED,
-                                          _fd, 0)));
-
-    if (!_fbmem) {
-        log_error("Couldn't mmap() %d bytes of memory!",
-                  _fix_screeninfo.smem_len);
+    _drawbounds.clear();
+
+#if 0
+    for (size_t rno = 0; rno<ranges.size(); rno++) {
+        geometry::Range2d<int> bounds = Intersection(
+            _renderer->world_to_pixel(ranges.getRange(rno)),
+            _validbounds);
+        // it may happen that a particular range is out of the screen, which 
+        // will lead to bounds==null. 
+        if (bounds.isNull()) continue; 
+        
+        _drawbounds.push_back(bounds);   
     }
-    
-#ifdef ENABLE_DOUBLE_BUFFERING
-    // allocate offscreen buffer
-    _buffer.reset(new boost::uint8_t[_fix_screeninfo.smem_len]);
-    memset(_buffer.get(), 0, _fix_screeninfo.smem_len);
-#endif  
-    
+#endif   
+
+}
+
+bool
+FBAggGlue::init (int argc, char ***argv)
+{
+    GNASH_REPORT_FUNCTION;    
+
 #ifdef PIXELFORMAT_LUT8
     // Set grayscale for 8 bit modes
-    if (_var_screeninfo.bits_per_pixel == 8) {
+    if (_varinfo.bits_per_pixel == 8) {
        if (!set_grayscale_lut8())
            return false;
     }
 #endif
 
+    // The agg glue file defines a typedef of Renderer, so we have to make sure
+    gnash::Renderer *rend = reinterpret_cast<gnash::Renderer *>
+        (createRenderHandler());
+    // boost::shared_array<renderer::GnashDevice::dtype_t>
+    //     devs = _renderer->probeDevices();
+    // boost::shared_array<renderer::GnashDevice::dtype_t>::iterator it;
+    // Initialize to EGL for now
+    _device.reset(new renderer::rawfb::RawFBDevice);
+    _device->initDevice(argc, *argv);
+    
+    // Set the renderer for the AGG glue layer
+    _renderer.reset(rend);
+
     return true;
 }
 
@@ -150,15 +175,15 @@ FBAggGlue::set_grayscale_lut8()
        
     }
     
-#ifdef ENABLE_FAKE_FRAMEBUFFER
-    if (fakefb_ioctl(_fd, FBIOPUTCMAP, &cmap))
-#else
-    if (ioctl(_fd, FBIOPUTCMAP, &cmap))
-#endif
-    {
-       log_error(_("LUT8: Error setting colormap: %s"), strerror(errno));
-       return false;
-    }
+// #ifdef ENABLE_FAKE_FRAMEBUFFER
+//     if (fakefb_ioctl(_fd, FBIOPUTCMAP, &cmap))
+// #else
+//     if (ioctl(_fd, FBIOPUTCMAP, &cmap))
+// #endif
+//     {
+//     log_error(_("LUT8: Error setting colormap: %s"), strerror(errno));
+//     return false;
+//     }
     
     return true;
      
@@ -170,10 +195,14 @@ FBAggGlue::createRenderHandler()
 {
     GNASH_REPORT_FUNCTION;
 
-    const int width     = _var_screeninfo.xres;
-    const int height    = _var_screeninfo.yres;
-    const int bpp       = _var_screeninfo.bits_per_pixel;
-    const int size      = _fix_screeninfo.smem_len; 
+    if (!_device) {
+        log_error("No Device layer initialized yet!");
+        return 0;
+    }
+    
+    const int width     = _device->getWidth();
+    const int height    = _device->getHeight();
+    const int bpp       = _device->getDepth();
     
     // TODO: should recalculate!  
     boost::uint8_t       *mem;
@@ -181,37 +210,38 @@ FBAggGlue::createRenderHandler()
 
     agg_handler = NULL;
 
-    // _validbounds.setTo(0, 0, width - 1, height - 1);
+//    _validbounds.setTo(0, 0, width - 1, height - 1);
     
 #ifdef ENABLE_DOUBLE_BUFFERING
     log_debug(_("Double buffering enabled"));
     mem = _buffer;
 #else
     log_debug(_("Double buffering disabled"));
-    mem = _fbmem.get();
+    mem = _device->getFBMemory();
 #endif
     
     agg_handler = NULL;
   
     // choose apropriate pixel format
-    
-    log_debug(_("red channel: %d / %d"), _var_screeninfo.red.offset, 
-             _var_screeninfo.red.length);
-    log_debug(_("green channel: %d / %d"), _var_screeninfo.green.offset, 
-             _var_screeninfo.green.length);
-    log_debug(_("blue channel: %d / %d"), _var_screeninfo.blue.offset, 
-             _var_screeninfo.blue.length);
-    log_debug(_("Total bits per pixel: %d"), _var_screeninfo.bits_per_pixel);
+
+    renderer::rawfb::RawFBDevice *rawfb = reinterpret_cast
+        <renderer::rawfb::RawFBDevice *>(_device.get());
+    log_debug(_("red channel: %d / %d"), rawfb->getRedOffset(), 
+             rawfb->getRedSize());
+    log_debug(_("green channel: %d / %d"), rawfb->getGreenOffset(), 
+             rawfb->getGreenSize());
+    log_debug(_("blue channel: %d / %d"), rawfb->getBlueOffset(), 
+              rawfb->getBlueSize());
+    log_debug(_("Total bits per pixel: %d"), bpp);
     
     const char* pixelformat = agg_detect_pixel_format(
-        _var_screeninfo.red.offset, _var_screeninfo.red.length,
-        _var_screeninfo.green.offset, _var_screeninfo.green.length,
-        _var_screeninfo.blue.offset, _var_screeninfo.blue.length,
-        bpp
-        );
-    
-    if (pixelformat) {    
-       agg_handler = create_Renderer_agg(pixelformat);      
+        rawfb->getRedOffset(),   rawfb->getRedSize(),
+        rawfb->getGreenOffset(), rawfb->getGreenSize(),
+        rawfb->getBlueOffset(),  rawfb->getBlueSize(),
+        bpp);
+
+    if (pixelformat) {
+       agg_handler = create_Renderer_agg(pixelformat);
     } else {
        log_error("The pixel format of your framebuffer could not be 
detected.");
        return false;
@@ -219,9 +249,11 @@ FBAggGlue::createRenderHandler()
     
     assert(agg_handler != NULL);
 
-    _rowsize = _var_screeninfo.xres_virtual*((bpp+7)/8);
-    
-    agg_handler->init_buffer(mem, size, width, height, _rowsize);
+    size_t rowsize = width*((bpp+7)/8);
+
+    agg_handler->init_buffer((unsigned char *)_device->getFBMemory(),
+                             _device->getFBMemSize(),
+                             width, height, rowsize);
     
     return (Renderer *)agg_handler;
 }    
@@ -230,6 +262,8 @@ void
 FBAggGlue::prepDrawingArea(FbWidget */* drawing_area */)
 {
     GNASH_REPORT_FUNCTION;
+
+
 }
 
 void
@@ -266,7 +300,7 @@ FBAggGlue::render()
        
        for (int y=bounds.getMinY(); y<=maxy; ++y) {    
            const unsigned int pixel_index = y * _rowsize + minx*pixel_size;
-           memcpy(&fbmem[pixel_index], &buffer[pixel_index], row_size);
+           memcpy(&(_fbmem[pixel_index]), &buffer[pixel_index], row_size);
            
        }
     }  
@@ -281,13 +315,23 @@ FBAggGlue::render()
 int
 FBAggGlue::width()
 {
-    return _var_screeninfo.xres_virtual;
+    GNASH_REPORT_FUNCTION;
+
+    if (_device) {
+        return _device->getWidth();
+    }
+    return 0;
 }
 
 int
 FBAggGlue::height()
 {
-    return _var_screeninfo.yres_virtual;
+    GNASH_REPORT_FUNCTION;
+
+    if (_device) {
+        return _device->getHeight();
+    }
+    return 0;
 }
 
 } // end of namespace gui
diff --git a/gui/fb/fb_glue_agg.h b/gui/fb/fb_glue_agg.h
index 7704093..c3530eb 100644
--- a/gui/fb/fb_glue_agg.h
+++ b/gui/fb/fb_glue_agg.h
@@ -39,6 +39,10 @@ class FBAggGlue: public FBGlue
 public:
     FBAggGlue();
 
+    // This constructor is not part of the API, as it's AGG and
+    // Framebuffer specific
+    FBAggGlue(int fd);
+
     // All of these virtuals are all defined in the base FBGlue class
     ~FBAggGlue();
 
@@ -48,8 +52,9 @@ public:
     /// @param argc The commandline argument count.
     /// @param argv The commandline arguments.
     /// @return True on success; false on failure.
-    bool init(int argc, char ***argv);    
-    
+    bool init(int argc, char ***argv);
+
+    /// Create the renderer handler
     Renderer *createRenderHandler();
 
     /// \brief
@@ -74,6 +79,7 @@ public:
     // does not need to be implemented (optional feature),
     // but still needs to be available.
     //
+    void setInvalidatedRegion(const SWFRect& bounds);
     void setInvalidatedRegions(const InvalidatedRanges &ranges);
     /// \brief
     ///  The Width of the drawing area, in pixels. For framebuffer
@@ -93,21 +99,23 @@ public:
     /// This GUI currently does not support palette modes.
     bool set_grayscale_lut8();
 
+    // these are used only for debugging purpose to access private data
+    size_t getBounds() { return _drawbounds.size(); };
+    size_t getMemSize() { return _fixinfo.smem_len; };
+    
 protected:
     /// This is the file descriptor for the framebuffer memory
     int                      _fd;
-    struct fb_var_screeninfo _var_screeninfo;
-    struct fb_fix_screeninfo _fix_screeninfo;
-    struct fb_cmap           _cmap;
-    
+    struct fb_fix_screeninfo _fixinfo;
+    struct fb_var_screeninfo _varinfo;
     boost::shared_ptr<boost::uint8_t> _fbmem;  // framebuffer memory
+    
 #ifdef ENABLE_DOUBLE_BUFFERING
     boost::shared_ptr<boost::uint8_t> _buffer; // offscreen buffer
 #endif
-    boost::uint32_t             _rowsize;
     std::vector< geometry::Range2d<int> > _drawbounds;
 
-    boost::shared_ptr<Renderer> _renderer;
+    boost::scoped_ptr<Renderer> _renderer;
 };
 
 } // end of namespace gui
diff --git a/gui/fb/fbsup.h b/gui/fb/fbsup.h
index f036c95..5adf9e6 100644
--- a/gui/fb/fbsup.h
+++ b/gui/fb/fbsup.h
@@ -25,11 +25,14 @@
 
 #include <boost/scoped_array.hpp>
 #include <boost/shared_ptr.hpp>
+#include <boost/cstdint.hpp>
 #include <vector>
+
 #include <linux/fb.h>
 
 #include "gui.h"
 #include "InputDevice.h"
+#include "Renderer.h"
 
 #define PIXELFORMAT_LUT8
 #define CMAP_SIZE (256*2)
@@ -52,7 +55,6 @@ namespace gnash {
 
 namespace gui {
 
-class Renderer;
 class FBGlue;
 
 /// A Framebuffer-based GUI for Gnash.
@@ -98,9 +100,12 @@ class FBGui : public Gui
 public:
     FBGui(unsigned long xid, float scale, bool loop, RunResources& r);
     virtual ~FBGui();
+    /// \brief Initialize the framebuffer
+    ///
+    /// This opens the framebuffer device,
     virtual bool init(int argc, char ***argv);
     /// \brief
-    ///Create and display our window.
+    /// Create and display our window.
     ///
     /// @param title The window title.
     /// @param width The desired window width in pixels.
@@ -114,7 +119,6 @@ public:
     /// For OpenGL, this means that the front and back buffers are swapped.
     void renderBuffer();
     
-
     /// Start main rendering loop.
     bool run();
 
@@ -186,43 +190,27 @@ private:
     /// reverts disable_terminal() changes
     bool enable_terminal();
     
-    int fd;
-    int original_vt;       // virtual terminal that was active at startup
-    int original_kd;       // keyboard mode at startup
-    int own_vt;            // virtual terminal we are running in   
-    unsigned char *fbmem;  // framebuffer memory
-    unsigned char *buffer; // offscreen buffer
+    int         _fd;
+    int         _original_vt; // virtual terminal that was active at startup
+    int         _original_kd; // keyboard mode at startup
+    int         _own_vt;      // virtual terminal we are running in   
     
-    std::vector< geometry::Range2d<int> > _drawbounds;
+    int         _xpos;          // X position of the output window
+    int         _ypos;          // Y position of the output window
+    size_t      _timeout;       // timeout period for the event loop
 
-    // X position of the output window
-    int _xpos;
-
-    // Y position of the output window
-    int _ypos;
-    
-    unsigned m_rowsize;
-    
-    std::vector<boost::shared_ptr<InputDevice> > _inputs;
+    struct fb_cmap _cmap;       // the colormap
+    struct fb_var_screeninfo _var_screeninfo;
+    struct fb_fix_screeninfo _fix_screeninfo;
+    boost::shared_ptr<FBGlue> _glue;
 
-    struct fb_var_screeninfo var_screeninfo;
-    struct fb_fix_screeninfo fix_screeninfo;
-
-    unsigned int _timeout;
-    
-    boost::shared_ptr<FBGlue> _glue;    
+    /// This is the array of functioning input devices.
+    std::vector<boost::shared_ptr<InputDevice> > _inputs;    
 };
 
 } // end of namespace gui
 } // end of namespace gnash
 
-#ifdef ENABLE_FAKE_FRAMEBUFFER
-/// Simulate the ioctls used to get information from the framebuffer driver.
-///
-/// Since this is an emulator, we have to set these fields to a reasonable 
default.
-int fakefb_ioctl(int fd, int request, void *data);
-#endif
-
 #endif  // end of GNASH_FBSUP_H
 
 // local Variables:

http://git.savannah.gnu.org/cgit//commit/?id=90cd4e808c785703b78fed38aa7e53327eafb2b3


commit 90cd4e808c785703b78fed38aa7e53327eafb2b3
Author: Rob Savoye <address@hidden>
Date:   Fri Dec 10 20:22:12 2010 -0700

    fix typo

diff --git a/librender/README b/librender/README
index 6efad11..943d068 100644
--- a/librender/README
+++ b/librender/README
@@ -19,7 +19,7 @@ the displayed one after rendering.
 
 The main difference between how the Gnash renderers used to work and
 the way they work now is they have gained device knowledge. In the
-embedded world, all GPUs have varying levels of accleration
+embedded world, all GPUs have varying levels of acceleration
 support. This functionality is probed at runtime now, and the optimal
 acceleration support selected automatically. For the features without
 hardware accleration available, they will be renderered in software.

http://git.savannah.gnu.org/cgit//commit/?id=f9a9f36409192a8e4aa54936fb7b77bc236d71c1


commit f9a9f36409192a8e4aa54936fb7b77bc236d71c1
Author: Rob Savoye <address@hidden>
Date:   Fri Dec 10 20:21:51 2010 -0700

    output device code move to the glue layer

diff --git a/gui/fb/fb_glue.h b/gui/fb/fb_glue.h
index 204559b..5fdc2b7 100644
--- a/gui/fb/fb_glue.h
+++ b/gui/fb/fb_glue.h
@@ -52,8 +52,96 @@ public:
 
     virtual void beforeRendering(movie_root *) {};
 
-  protected:
-    //    FbWidget *_drawing_area;
+    boost::shared_array<renderer::GnashDevice::dtype_t> probeDevices() {
+        GNASH_REPORT_FUNCTION;
+        
+        size_t total = 0;
+#ifdef BUILD_EGL_DEVICE
+        total++;
+#endif
+#ifdef BUILD_RAWFB_DEVICE
+        total++;
+#endif
+#ifdef BUILD_DIRECTFB_DEVICE
+        total++;
+#endif
+#ifdef BUILD_X11_DEVICE
+        total++;
+#endif
+        boost::shared_array<renderer::GnashDevice::dtype_t> devs
+            (new renderer::GnashDevice::dtype_t[total]);
+#ifdef BUILD_X11_DEVICE
+        devs[--total] = renderer::GnashDevice::X11;
+#endif
+#ifdef BUILD_EGL_DEVICE
+        devs[--total] = renderer::GnashDevice::EGL;
+#endif
+#ifdef BUILD_RAWFB_DEVICE
+        devs[--total] = renderer::GnashDevice::RAWFB;
+#endif
+#ifdef BUILD_DIRECTFB_DEVICE
+        devs[--total] = renderer::GnashDevice::DIRECTFB;
+#endif
+        
+        return devs;
+    }
+
+    void resetDevice() { _device.reset(); };
+    
+    renderer::GnashDevice::dtype_t getDevice()
+    {
+        if (_device) {
+            return _device->getType();
+        }
+        return renderer::GnashDevice::NODEV;
+    }
+    
+    void setDevice(renderer::GnashDevice::dtype_t dtype) {
+        switch (dtype) {
+#ifdef BUILD_EGL_DEVICE
+          case renderer::GnashDevice::EGL:
+          {
+              _device.reset(new renderer::EGLDevice);
+              break;
+          }
+#endif
+#ifdef BUILD_RAWFB_DEVICE_XX
+          case renderer::GnashDevice::RAWFB:
+          {
+              _device.reset(new renderer::rawfb::RawFBDevice);
+              break;
+          }
+#endif
+#ifdef BUILD_DIRECTFB_DEVICE
+          case renderer::GnashDevice::DIRECTFB:
+          {
+              _device.reset(new renderer::directfb::DirectFBDevice);
+              break;
+          }
+#endif
+#ifdef BUILD_X11_DEVICE
+          case renderer::GnashDevice::X11:
+          {
+              _device.reset(new renderer::x11::X11Device);
+              break;
+          }
+#endif
+          default:
+              log_error("unsupported Display Device!");
+        }
+        // // EGL doesn't care about command line argument, so pass NULL
+        // _device->initDevice(0, 0);
+        // renderer::EGLDevice *egl = (renderer::EGLDevice*)_device.get();
+        // egl->printEGLConfig();
+        // egl->printEGLSurface();
+    }
+
+    size_t getWidth()  { return (_device) ? _device->getWidth() : 0; };
+    size_t getHeight() { return (_device) ? _device->getWidth() : 0; };
+    size_t getDepth()  { return (_device) ? _device->getDepth() : 0; };
+    
+protected:
+    boost::scoped_ptr<renderer::GnashDevice> _device;    
 };
 
 } // end of namespace gui
diff --git a/librender/Renderer.h b/librender/Renderer.h
index d9128ab..d7c6d1b 100644
--- a/librender/Renderer.h
+++ b/librender/Renderer.h
@@ -469,78 +469,8 @@ public:
         return true;
     }
 
-    /// ==================================================================
-    /// Interface for using low-level devices like EGL or DirectFB
-    /// These are unused by AGG, Cairo, and OpenGL, but are needed
-    /// when using OpenGLES1, OpenGLES2, or OpenVG.
-    /// ==================================================================
-    boost::shared_array<renderer::GnashDevice::dtype_t> probeDevices() {
-        GNASH_REPORT_FUNCTION;
-        
-        size_t total = 0;
-#ifdef BUILD_EGL_DEVICE
-        total++;
-#endif
-#ifdef BUILD_DIRECTFB_DEVICE
-        total++;
-#endif
-#ifdef BUILD_X11_DEVICE
-        total++;
-#endif
-        boost::shared_array<renderer::GnashDevice::dtype_t> devs
-            (new renderer::GnashDevice::dtype_t[total]);
-#ifdef BUILD_X11_DEVICE
-        devs[--total] = renderer::GnashDevice::X11;
-#endif
-#ifdef BUILD_EGL_DEVICE
-        devs[--total] = renderer::GnashDevice::EGL;
-#endif
-#ifdef BUILD_DIRECTFB_DEVICE
-        devs[--total] = renderer::GnashDevice::DIRECTFB;
-#endif
-        
-        return devs;
-    }
-
-    void resetDevice() { _device.reset(); };
-    
-    renderer::GnashDevice::dtype_t getDevice()
-    {
-        if (_device) {
-            return _device->getType();
-        }
-        return renderer::GnashDevice::NODEV;
-    }
-    
-    void setDevice(renderer::GnashDevice::dtype_t dtype) {
-        switch (dtype) {
-#ifdef BUILD_EGL_DEVICE
-          case renderer::GnashDevice::EGL:
-          {
-              _device.reset(new renderer::EGLDevice);
-              break;
-          }
-#endif
-#ifdef BUILD_DIRECTFB_DEVICE
-          case renderer::GnashDevice::DIRECTFB:
-          {
-              _device.reset(new renderer::directfb::DirectFBDevice);
-              break;
-          }
-#endif
-#ifdef BUILD_X11_DEVICE
-          case renderer::GnashDevice::X11:
-          {
-              _device.reset(new renderer::x11::X11Device);
-              break;
-          }
-#endif
-          default:
-              log_error("unsupported Display Device!");
-        }
-    }
-    
 #ifdef USE_TESTSUITE
+
         
     /// ==================================================================
     /// Interfaces for testing only. Disabled when the testsuite isn't built.
@@ -708,9 +638,6 @@ protected:
     // Delayed imaged to render
     RenderImages _render_images;
 
-    // 
-    boost::scoped_ptr<renderer::GnashDevice> _device;
-    
 private:
 
     /// Bracket the displaying of a frame from a movie.

http://git.savannah.gnu.org/cgit//commit/?id=27c8acf865512d093bee9d4b37915f5418b1aff0


commit 27c8acf865512d093bee9d4b37915f5418b1aff0
Author: Rob Savoye <address@hidden>
Date:   Fri Dec 10 20:20:50 2010 -0700

    minor reformatting change

diff --git a/librender/agg/Renderer_agg.h b/librender/agg/Renderer_agg.h
index 1c609fb..06ac0c5 100644
--- a/librender/agg/Renderer_agg.h
+++ b/librender/agg/Renderer_agg.h
@@ -40,9 +40,10 @@ public:
     virtual ~Renderer_agg_base() {}
     
     // these methods need to be accessed from outside:
-    virtual void init_buffer(unsigned char *mem, int size, int x, int y, int 
rowstride)=0;
+    virtual void init_buffer(unsigned char *mem, int size, int x, int y,
+                             int rowstride) = 0;
     
-    virtual unsigned int getBytesPerPixel() const=0;
+    virtual unsigned int getBytesPerPixel() const = 0;
     
     unsigned int getBitsPerPixel() const { return getBytesPerPixel()*8; }
     

http://git.savannah.gnu.org/cgit//commit/?id=e0cadeb90646d41837332879d2da4e4c2a89246f


commit e0cadeb90646d41837332879d2da4e4c2a89246f
Author: Rob Savoye <address@hidden>
Date:   Fri Dec 10 20:20:26 2010 -0700

    add namespcae for GnashDevice

diff --git a/librender/openvg/Renderer_ovg.h b/librender/openvg/Renderer_ovg.h
index a7dd3be..2a0e535 100644
--- a/librender/openvg/Renderer_ovg.h
+++ b/librender/openvg/Renderer_ovg.h
@@ -59,7 +59,7 @@ public:
     std::string description() const { return "OpenVG"; }
 
     Renderer_ovg();
-    Renderer_ovg(GnashDevice::dtype_t dtype);
+    Renderer_ovg(renderer::GnashDevice::dtype_t dtype);
     
     ~Renderer_ovg();
         
@@ -206,7 +206,7 @@ public:
 #endif
     unsigned char *_testBuffer; // buffer used by initTestBuffer() only
     
-    boost::scoped_ptr<GnashDevice> _device;
+    boost::scoped_ptr<renderer::GnashDevice> _device;
 };
 
 DSOEXPORT Renderer* create_handler(const char *pixelformat);

http://git.savannah.gnu.org/cgit//commit/?id=cc5b7e739981fcf862f185275a23020ab7db8299


commit cc5b7e739981fcf862f185275a23020ab7db8299
Author: Rob Savoye <address@hidden>
Date:   Fri Dec 10 20:18:40 2010 -0700

    minor indenting fix

diff --git a/gui/sdl/sdl_agg_glue.h b/gui/sdl/sdl_agg_glue.h
index 9a4b2f8..b23c2ff 100644
--- a/gui/sdl/sdl_agg_glue.h
+++ b/gui/sdl/sdl_agg_glue.h
@@ -42,7 +42,7 @@ class SdlAggGlue : public SdlGlue
     SDL_Surface     *_sdl_surface;
     unsigned char   *_offscreenbuf;
     SDL_Surface     *_screen;
-    Renderer  *_agg_renderer;
+    Renderer        *_agg_renderer;
     
     geometry::Range2d<int> _validbounds;
     std::vector< geometry::Range2d<int> > _drawbounds;

http://git.savannah.gnu.org/cgit//commit/?id=1e0c991bcba73089ec92c187d687913351cb320e


commit 1e0c991bcba73089ec92c187d687913351cb320e
Author: Rob Savoye <address@hidden>
Date:   Fri Dec 10 20:18:14 2010 -0700

    add accessors for the memory and it's size

diff --git a/libdevice/GnashDevice.h b/libdevice/GnashDevice.h
index 380a9af..2c68136 100644
--- a/libdevice/GnashDevice.h
+++ b/libdevice/GnashDevice.h
@@ -112,6 +112,9 @@ struct GnashDevice
 
     /// Is this renderering natively
     virtual bool isNativeRender() = 0;
+
+    virtual boost::uint8_t *getFBMemory() { };
+    virtual size_t getFBMemSize() { };
 };
 
 } // namespace renderer

http://git.savannah.gnu.org/cgit//commit/?id=e68775c062caec2b2c0aa1aed36ce5a797bec1da


commit e68775c062caec2b2c0aa1aed36ce5a797bec1da
Author: Rob Savoye <address@hidden>
Date:   Fri Dec 10 20:16:58 2010 -0700

    add test case for the glue API

diff --git a/gui/Makefile.am b/gui/Makefile.am
index 71128af..a22fca9 100644
--- a/gui/Makefile.am
+++ b/gui/Makefile.am
@@ -307,3 +307,15 @@ clean-hook:
 #      done
 # endif
 
+check_PROGRAMS = test_glue
+
+test_glue_SOURCES = test_glue.cpp fb/fb_glue_agg.cpp
+test_glue_CPPFLAGS = \
+       -DFAKEFB=\"$(FAKEFB)\" \
+       $(AM_CPPFLAGS) \
+       $(DIRECTFB_CFLAGS)
+#       -DUSE_TESTSUITE
+test_glue_LDADD = \
+       ../librender/libgnashrender.la \
+       ../libdevice/libgnashdevice.la \
+       $(GNASH_LIBS)

http://git.savannah.gnu.org/cgit//commit/?id=ecfcdb8d363fda96d5aba328e79f95eb1ab450be


commit ecfcdb8d363fda96d5aba328e79f95eb1ab450be
Author: Rob Savoye <address@hidden>
Date:   Fri Dec 10 20:16:24 2010 -0700

    add a raw framebuffer to the output device list

diff --git a/configure.ac b/configure.ac
index 83cf122..9a52064 100644
--- a/configure.ac
+++ b/configure.ac
@@ -852,20 +852,20 @@ dnl required when using the Framebuffer, as without the 
X11 desktop,
 dnl Gnash has to handle all these internally. This can get
 dnl messy, as one might want to use a touchscreen with a normal mouse
 dnl or keyboard attached. 
-dnl By default, don't build any of these, as they are only for the Framebuffer
-dnl running without X11.
-if test x"${build_fb}" = xyes; then
-build_ps2mouse=yes
-build_ps2keyboard=no
-build_input_events=yes
-build_tslib=yes
-input_events="PS/2 Mouse, Input Devices, Touchscreen via Tslib"
+dnl By default, don't build any of these, as they are only for the 
+dnl Framebuffer running without X11.
+if test x"${build_fb}" = xyes -a x"${linux}" = yes; then
+  build_ps2mouse=yes
+  build_ps2keyboard=no
+  build_input_events=yes
+  build_tslib=yes
+  input_events="PS/2 Mouse, Input Devices, Touchscreen via Tslib"
 else
-build_ps2mouse=no
-build_ps2keyboard=no
-build_input_events=no
-build_tslib=no
-input_events=
+  build_ps2mouse=no
+  build_ps2keyboard=no
+  build_input_events=no
+  build_tslib=no
+  input_events=
 fi
 AC_ARG_ENABLE(input,
   AC_HELP_STRING([--enable-input=], [Enable support for the specified input 
devices for the framebuffer GUI 
(default=ps2mouse|ps2keyboard|events|touchscreen)]),
@@ -1140,11 +1140,12 @@ build_vaapi_device=no
 build_openmax_device=no
 build_egl_device=yes
 build_directfb_device=yes
+build_rawfb_device=yes
 build_x11_device=yes
 device_list="X11 EGL DirectFB"
 ndevice=3
 AC_ARG_ENABLE(device,
-  AC_HELP_STRING([--enable-device], [Specify which hardware abstraction to use 
to support to enable (none,openmax,egl,directfb,x11,vaapi)]),
+  AC_HELP_STRING([--enable-device], [Specify which hardware abstraction to use 
to support to enable (none,openmax,egl,directfb,rawfb,x11,vaapi)]),
   if test -z ${enableval}; then
       device_list="none"
       ndevice=0
@@ -1182,11 +1183,17 @@ AC_ARG_ENABLE(device,
         build_directfb_device=yes
         ndevice=$((ndevice+1))
         ;;
+      ra*|RAW*)
+        device_list="${device_list} RawFB"
+        build_rawfb_device=yes
+        ndevice=$((ndevice+1))
+        ;;
       all|ALL)
         device_list="OpenMax EGL DirectFB X11 VAAPI"
         build_openmax_device=yes
         build_vaapi_device=yes
         build_egl_device=yes
+        build_rawfb_device=yes
         build_directfb_device=yes
         build_x11_device=yes
         ndevice=5
@@ -2438,6 +2445,11 @@ if test x"${build_gles1}" = xyes -o  x"${build_gles2}" = 
xyes -o x"${build_ovg}"
   build_egl_device=yes
 fi
 
+dnl only Linux supports /dev/fb0
+if test x"${build_rawfb_device}" = xyes -a x"${linux}" = xyes; then
+   AC_DEFINE([BUILD_RAWFB_DEVICE], [1], [Use raw Framebuffer device support])
+fi
+
 if test x"${build_directfb_device}" = xyes; then
    GNASH_PKG_FIND(directfb, [directfb/directfb.h], [DirectFB render library], 
DirectFBCreate)
    AC_DEFINE([BUILD_DIRECTFB_DEVICE], [1], [Use DirectFB device support])
@@ -2451,6 +2463,7 @@ fi
 AM_CONDITIONAL(BUILD_VAAPI_DEVICE, [test x"${use_libva}" = xyes])
 AM_CONDITIONAL(BUILD_EGL_DEVICE, [test x"${build_egl_device}" = xyes])
 AM_CONDITIONAL(BUILD_DIRECTFB_DEVICE, [ test x${build_directfb_device} = xyes])
+AM_CONDITIONAL(BUILD_RAWFB_DEVICE, [ test x${build_rawfb_device} = xyes])
 AM_CONDITIONAL(BUILD_X11_DEVICE, [test x$build_x11_device = xyes])
 
 if test x"${build_ovg}" = xyes; then

http://git.savannah.gnu.org/cgit//commit/?id=dd6bd67f11bf7580914d01170d4b84c29f1f1f13


commit dd6bd67f11bf7580914d01170d4b84c29f1f1f13
Author: Rob Savoye <address@hidden>
Date:   Fri Dec 10 19:14:26 2010 -0700

    implement support for a raw framebuffer

diff --git a/libdevice/rawfb/RawFBDevice.cpp b/libdevice/rawfb/RawFBDevice.cpp
index 11cff3e..f8ccccd 100644
--- a/libdevice/rawfb/RawFBDevice.cpp
+++ b/libdevice/rawfb/RawFBDevice.cpp
@@ -24,6 +24,7 @@
 #include <cerrno>
 #include <exception>
 #include <sstream>
+#include <csignal>
 
 #include "log.h"
 #include "GnashException.h"
@@ -42,11 +43,15 @@ static LogFile& dbglogfile = LogFile::getDefaultInstance();
 
 
 RawFBDevice::RawFBDevice()
+    : _fd(0),
+      _fbmem(0)
 {
     GNASH_REPORT_FUNCTION;
 }
 
 RawFBDevice::RawFBDevice(int vid)
+    : _fd(0),
+      _fbmem(0)
 {
     GNASH_REPORT_FUNCTION;
 
@@ -56,20 +61,83 @@ RawFBDevice::RawFBDevice(int vid)
 }
 
 RawFBDevice::RawFBDevice(int argc, char *argv[])
+    : _fd(0),
+      _fbmem(0)
 {
     GNASH_REPORT_FUNCTION;
     
 }
 
+void
+RawFBDevice::clear()
+{
+    GNASH_REPORT_FUNCTION;
+    memset(_fbmem, 0, _fixinfo.smem_len);
+}
+
 RawFBDevice::~RawFBDevice()
 {
     GNASH_REPORT_FUNCTION;
+
+    if (_fbmem) {
+        munmap(_fbmem, 0);
+        _fbmem = 0;
+        if (_fd) {
+            close (_fd);
+            _fd = -1;
+        }
+    }
 }
 
 bool
-RawFBDevice::initDevice(int argc, char *argv[])
+RawFBDevice::initDevice(int /* argc */, char **/* argv[] */)
 {
     GNASH_REPORT_FUNCTION;
+
+    // Open the framebuffer device
+#ifdef ENABLE_FAKE_FRAMEBUFFER
+    _fd = open(FAKEFB, O_RDWR);
+    log_debug("WARNING: Using %s as a fake framebuffer!", FAKEFB);
+#else
+    _fd = open("/dev/fb0", O_RDWR);
+#endif
+    if (_fd < 0) {
+        log_error("Could not open framebuffer device: %s", strerror(errno));
+        return false;
+    }
+    
+    // Load framebuffer properties
+#ifdef ENABLE_FAKE_FRAMEBUFFER
+    fakefb_ioctl(_fd, FBIOGET_VSCREENINFO, &_varinfo);
+    fakefb_ioctl(_fd, FBIOGET_FSCREENINFO, &_fixinfo);
+#else
+    ioctl(_fd, FBIOGET_VSCREENINFO, &_varinfo);
+    ioctl(_fd, FBIOGET_FSCREENINFO, &_fixinfo);
+#endif
+    log_debug(_("Framebuffer device uses %d bytes of memory."),
+              _fixinfo.smem_len);
+    log_debug(_("Video mode: %dx%d with %d bits per pixel."),
+              _varinfo.xres, _varinfo.yres,
+              _varinfo.bits_per_pixel);    
+
+    // map framebuffer into memory
+#if 0
+    _fbmem.reset(static_cast<boost::uint8_t *>(mmap(0, _fixinfo.smem_len,
+                                              PROT_READ|PROT_WRITE, MAP_SHARED,
+                                              _fd, 0)));
+#else
+    _fbmem = (unsigned char *)mmap(0, _fixinfo.smem_len,
+                                   PROT_READ|PROT_WRITE, MAP_SHARED,
+                                   _fd, 0);
+#endif
+    
+    if (!_fbmem) {
+        log_error("Couldn't mmap() %d bytes of memory!",
+                  _fixinfo.smem_len);
+        return false;
+    }
+    
+    return true;
 }
 
 // Initialize RAWFB Window layer
@@ -96,7 +164,139 @@ RawFBDevice::createWindow(const char *name, int x, int y, 
int width, int height)
 void
 RawFBDevice::eventLoop(size_t passes)
 {
+    GNASH_REPORT_FUNCTION;    
+}
+
+#ifdef ENABLE_FAKE_FRAMEBUFFER
+// Simulate the ioctls used to get information from the framebuffer
+// driver. Since this is an emulator, we have to set these fields
+// to a reasonable default.
+int
+fakefb_ioctl(int /* fd */, int request, void *data)
+{
+    // GNASH_REPORT_FUNCTION;
+    
+    switch (request) {
+      case FBIOGET_VSCREENINFO:
+      {
+          struct fb_var_screeninfo *ptr =
+              reinterpret_cast<struct fb_var_screeninfo *>(data);
+          // If we are using a simulated framebuffer, the default for
+          // fbe us 640x480, 8bits. So use that as a sensible
+          // default. Note that the fake framebuffer is only used for
+          // debugging and development.
+          ptr->xres          = 1280; // visible resolution
+          ptr->xres_virtual  = 1280; // virtual resolution
+          ptr->yres          = 1024; // visible resolution
+          ptr->yres_virtual  = 1024; // virtual resolution
+
+          // standard PC framebuffer use a 32 bit 8/8/8 framebuffer
+          ptr->bits_per_pixel = 32;
+          ptr->red.offset    = 16;
+          ptr->red.length    = 8;
+          ptr->green.offset  = 8;
+          ptr->green.length  = 8;
+          ptr->blue.offset   = 0;
+          ptr->blue.length   = 8;
+          ptr->transp.offset = 0;
+          ptr->transp.length = 0;
+#if 0
+          // Android and fbe use a 16bit 5/6/5 framebuffer
+          ptr->bits_per_pixel = 16;
+          ptr->red.length    = 5;
+          ptr->red.offset    = 11;
+          ptr->green.length  = 6;
+          ptr->green.offset  = 5;
+          ptr->blue.length   = 5;
+          ptr->blue.offset   = 0;
+          ptr->transp.offset = 0;
+          ptr->transp.length = 0;
+#endif
+          // 8bit framebuffer
+          // ptr->bits_per_pixel = 8;
+          // ptr->red.length    = 8;
+          // ptr->red.offset    = 0;
+          // ptr->green.length  = 8;
+          // ptr->green.offset  = 0;
+          // ptr->blue.length   = 8;
+          // ptr->blue.offset   = 0;
+          // ptr->transp.offset = 0;
+          // ptr->transp.length = 0;
+          ptr->grayscale     = 1; // != 0 Graylevels instead of color
+          
+          break;
+      }
+      case FBIOGET_FSCREENINFO:
+      {
+          struct fb_fix_screeninfo *ptr =
+              reinterpret_cast<struct fb_fix_screeninfo *>(data);
+          // Android and fbe use a 16bit 5/6/5 framebuffer
+          ptr->smem_len = 5242880; // size of frame buffer memory
+          ptr->type = 0; // see FB_TYPE_*
+          ptr->visual = 2; // see FB_VISUAL_*
+          ptr->xpanstep = 1;      // zero if no hardware panning
+          ptr->ypanstep = 1;      // zero if no hardware panning
+          ptr->ywrapstep = 0;     // zero if no hardware panning
+          ptr->line_length = 5120; // line length
+          ptr->accel = FB_ACCEL_NONE; // Indicate to driver which specific
+                                  // chip/card we have
+#if 0
+          // Android and fbe use a 16bit 5/6/5 framebuffer
+          ptr->smem_len = 307200; // Length of frame buffer mem
+          ptr->type = FB_TYPE_PACKED_PIXELS; // see FB_TYPE_*
+          ptr->visual = FB_VISUAL_PSEUDOCOLOR; // see FB_VISUAL_*
+          ptr->xpanstep = 0;      // zero if no hardware panning
+          ptr->ypanstep = 0;      // zero if no hardware panning
+          ptr->ywrapstep = 0;     // zero if no hardware panning
+          ptr->accel = FB_ACCEL_NONE; // Indicate to driver which specific
+                                  // chip/card we have
+#endif
+          break;
+      }
+      case FBIOPUTCMAP:
+      {
+          // Fbe uses this name for the fake framebuffer, so in this
+          // case assume we're using fbe, so write to the known fbe
+          // cmap file.
+          std::string str = FAKEFB;
+          if (str == "/tmp/fbe_buffer") {
+              int fd = open("/tmp/fbe_cmap", O_WRONLY);
+              if (fd) {
+                  write(fd, data, sizeof(struct fb_cmap));
+                  close(fd);
+              } else {
+                  gnash::log_error("Couldn't write to the fake cmap!");
+                  return -1;
+              }
+          } else {
+              gnash::log_error("Couldn't write to the fake cmap, unknown 
type!");
+              return -1;
+          }
+          // If we send a SIGUSR1 signal to fbe, it'll reload the
+          // color map.
+          int fd = open("/tmp/fbe.pid", O_RDONLY);
+          char buf[10];
+          if (fd) {
+              if (read(fd, buf, 10) == 0) {
+                  close(fd);
+                  return -1;
+              } else {
+                  pid_t pid = strtol(buf, 0, NULL);
+                  kill(pid, SIGUSR1);
+                  gnash::log_debug("Signaled fbe to reload it's colormap.");
+              }
+              close(fd);
+          }
+          break;
+      }
+      default:
+          gnash::log_unimpl("fakefb_ioctl(%d)", request);
+          break;
+    }
+
+    return 0;
 }
+#endif  // ENABLE_FAKE_FRAMEBUFFER
 
 } // namespace rawfb
 } // namespace renderer
diff --git a/libdevice/rawfb/RawFBDevice.h b/libdevice/rawfb/RawFBDevice.h
index 0996ce2..1e40f0a 100644
--- a/libdevice/rawfb/RawFBDevice.h
+++ b/libdevice/rawfb/RawFBDevice.h
@@ -26,6 +26,12 @@
 
 #include <boost/scoped_array.hpp>
 #include <boost/scoped_ptr.hpp>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <sys/mman.h>
+#include <linux/fb.h>
+#include <linux/kd.h>
+#include <linux/vt.h>
 
 #include "GnashDevice.h"
 
@@ -59,12 +65,12 @@ class RawFBDevice : public GnashDevice
     // Return a string with the error code as text, instead of a numeric value
     const char *getErrorString(int error);
     
-    int getDepth() {GNASH_REPORT_FUNCTION; };
+    int getDepth() { return _varinfo.bits_per_pixel; };
 
     // Accessors for the settings needed by higher level code.
     // Surface accessors
-    size_t getWidth() {GNASH_REPORT_FUNCTION; };
-    size_t getHeight() {GNASH_REPORT_FUNCTION; };
+    size_t getWidth() { return _varinfo.xres; };
+    size_t getHeight() { return _varinfo.yres; };
     
     bool isSingleBuffered() { return true; }
     
@@ -74,12 +80,20 @@ class RawFBDevice : public GnashDevice
     // bool isBufferDestroyed(IRAWFBSurface surface) {
     //     return false;
     // }
-    int getID() {GNASH_REPORT_FUNCTION; };
-
-    // Get the size of the pixels, for RAWFB it's always 8 as far as I can tell
-    int getRedSize() {GNASH_REPORT_FUNCTION; };
-    int getGreenSize(){GNASH_REPORT_FUNCTION; };
-    int getBlueSize() {GNASH_REPORT_FUNCTION; };
+    int getID() { return 0; };
+
+    // Get the size of the pixels
+    int getRedSize()   { return _varinfo.red.length; };
+    int getGreenSize() { return _varinfo.green.length; };
+    int getBlueSize()  { return _varinfo.blue.length; };
+
+#ifdef RENDERER_AGG
+    /// These methods are only needed by AGG, which uses these
+    /// to calculate the pixel format.
+    int getRedOffset()   { return _varinfo.red.offset; };
+    int getGreenOffset() { return _varinfo.green.offset; };
+    int getBlueOffset()  { return _varinfo.blue.offset; };    
+#endif
     
     // Using RAWFB always means a native renderer
     bool isNativeRender() { return true; }
@@ -93,6 +107,9 @@ class RawFBDevice : public GnashDevice
     // Create an RAWFB window to render in. This is only used by testing
     void createWindow(const char *name, int x, int y, int width, int height);
 
+    boost::uint8_t *getFBMemory() { return _fbmem; };
+    size_t getFBMemSize() { return _fixinfo.smem_len; };
+    
     /// Start an RAWFB event loop. This is only used by testing. Note that
     /// calling this function blocks until the specified number of events
     /// have been handled. The first 5 are used up by creating the window.
@@ -100,11 +117,25 @@ class RawFBDevice : public GnashDevice
     /// @param passes the number of events to process before returning.
     /// @return nothing
     void eventLoop(size_t passes);
-
+    
 protected:
-    std::string _filespec;
+    /// Clear the framebuffer memory
+    void clear();
+
+    int                      _fd;
+    std::string              _filespec;
+    struct fb_fix_screeninfo _fixinfo;
+    struct fb_var_screeninfo _varinfo;
+    boost::uint8_t           *_fbmem;
 };
 
+#ifdef ENABLE_FAKE_FRAMEBUFFER
+/// Simulate the ioctls used to get information from the framebuffer driver.
+///
+/// Since this is an emulator, we have to set these fields to a reasonable 
default.
+int fakefb_ioctl(int fd, int request, void *data);
+#endif
+
 typedef void (*init_func)();
 typedef void (*reshape_func)(int, int);
 typedef void (*draw_func)();
diff --git a/libdevice/rawfb/rawfb.am b/libdevice/rawfb/rawfb.am
index 7e4b3f1..f954216 100644
--- a/libdevice/rawfb/rawfb.am
+++ b/libdevice/rawfb/rawfb.am
@@ -1,5 +1,8 @@
 if BUILD_RAWFB_DEVICE
-libgnashdevice_la_CPPFLAGS += $(RAWFB_CFLAGS) $(TSLIB_CFLAGS)
+libgnashdevice_la_CPPFLAGS += \
+        -DFAKEFB=\"$(FAKEFB)\" \
+       $(RAWFB_CFLAGS) \
+       $(TSLIB_CFLAGS)
 libgnashdevice_la_SOURCES += \
        rawfb/RawFBDevice.cpp \
        rawfb/RawFBDevice.h
diff --git a/libdevice/rawfb/test_rawfb.cpp b/libdevice/rawfb/test_rawfb.cpp
index ccda4bb..ff7c048 100644
--- a/libdevice/rawfb/test_rawfb.cpp
+++ b/libdevice/rawfb/test_rawfb.cpp
@@ -56,7 +56,7 @@ main(int argc, char *argv[])
         exit(0);
     }
     
-    if (ret) {
+    if ((ret) && (rfb.getFBMemory() > 0) && (rfb.getFBMemSize() > 0)) {
         runtest.pass("RawFBDevice:InitDevice()");
     } else {
         runtest.fail("RawFBDevice:InitDevice()");
@@ -74,54 +74,56 @@ main(int argc, char *argv[])
         runtest.fail("DirecTFBDevice::getHeight()");
     }
 
-#if 0
-    if (rfb.getVerticalRes()) {
-        runtest.pass("RawFBDevice::getVerticalRes()");
+    if (rfb.isSingleBuffered()) {
+        runtest.pass("RawFBDevice::is*Buffered()");
     } else {
-        runtest.fail("RawFBDevice::getVerticalRes()");
+        runtest.fail("RawFBDevice::is*Buffered()");
     }
     
-    if (rfb.getHorzRes()) {
-        runtest.pass("RawFBDevice::getHorzRes()");
+    if (rfb.getDepth()) {
+        runtest.pass("RawFBDevice::getDepth()");
     } else {
-        runtest.fail("RawFBDevice::getHorzRes()");
-    }    
-#endif
+        runtest.fail("RawFBDevice::getDepth()");
+    }
     
-    if (rfb.isSingleBuffered()) {
-        runtest.pass("RawFBDevice::is*Buffered()");
+    if (rfb.getRedSize() > 0) {
+        runtest.pass("RawFBDevice::getRedSize()");
     } else {
-        runtest.fail("RawFBDevice::is*Buffered()");
+        runtest.fail("RawFBDevice::getRedSize()");
     }
 
-#if 0
-    if (rfb.isContextSingleBuffered() != rfb.isContextBackBuffered()) {
-        runtest.pass("RawFBDevice::iisContextBuffered()");
+    if (rfb.getGreenSize() > 0) {
+        runtest.pass("RawFBDevice::getGreenSize()");
     } else {
-        runtest.fail("RawFBDevice::isContextBuffered()");
+        runtest.fail("RawFBDevice::getGreenSize()");
     }
 
-    // Context accessor tests
-    std::cerr << "FIXME: " << rfb.getContextID() << std::endl;
-
-    if (rfb.getContextID() >= 0) {
-        runtest.pass("RawFBDevice::getContextID()");
+    if (rfb.getBlueSize() > 0) {
+        runtest.pass("RawFBDevice::getBlueSize()");
     } else {
-        runtest.fail("RawFBDevice::getContextID()");
-    }    
+        runtest.fail("RawFBDevice::getBlueSize()");
+    }
 
-    if (rfb.getSurfaceID() >= 0) {
-        runtest.pass("RawFBDevice::getSurfaceID()");
+    // AGG uses these to calculate the poixel format
+#ifdef RENDERER_AGG
+    if (rfb.getRedOffset() > 0) {
+        runtest.pass("RawFBDevice::getRedOffset()");
     } else {
-        runtest.fail("RawFBDevice::getSurfaceID()");
+        runtest.fail("RawFBDevice::getRedOffset()");
     }
-#endif
     
-    if (rfb.getDepth()) {
-        runtest.pass("RawFBDevice::getDepth()");
+    if (rfb.getGreenOffset() > 0) {
+        runtest.pass("RawFBDevice::getGreenOffset()");
     } else {
-        runtest.fail("RawFBDevice::getDepth()");
+        runtest.fail("RawFBDevice::getGreenOffset()");
     }
+    
+    if (rfb.getBlueOffset() == 0) {
+        runtest.pass("RawFBDevice::getBlueOffset()");
+    } else {
+        runtest.fail("RawFBDevice::getBlueOffset()");
+    }
+#endif
 }
 
 // Local Variables:

http://git.savannah.gnu.org/cgit//commit/?id=2b9d805b11a71060d0495c38a22afc686af7d5df


commit 2b9d805b11a71060d0495c38a22afc686af7d5df
Author: Rob Savoye <address@hidden>
Date:   Fri Dec 10 17:13:26 2010 -0700

    fix namespace mess

diff --git a/libdevice/rawfb/RawFBDevice.cpp b/libdevice/rawfb/RawFBDevice.cpp
index e62b25f..11cff3e 100644
--- a/libdevice/rawfb/RawFBDevice.cpp
+++ b/libdevice/rawfb/RawFBDevice.cpp
@@ -33,7 +33,7 @@
 
 namespace gnash {
 
-namespace device {
+namespace renderer {
 
 namespace rawfb {
     
diff --git a/libdevice/rawfb/RawFBDevice.h b/libdevice/rawfb/RawFBDevice.h
index 7e68339..0996ce2 100644
--- a/libdevice/rawfb/RawFBDevice.h
+++ b/libdevice/rawfb/RawFBDevice.h
@@ -31,11 +31,11 @@
 
 namespace gnash {
 
-namespace device {
+namespace renderer {
 
 namespace rawfb {
 
-class RawFBDevice : public device::GnashDevice
+class RawFBDevice : public GnashDevice
 {
   public:
     
@@ -59,12 +59,12 @@ class RawFBDevice : public device::GnashDevice
     // Return a string with the error code as text, instead of a numeric value
     const char *getErrorString(int error);
     
-    int getDepth();
+    int getDepth() {GNASH_REPORT_FUNCTION; };
 
     // Accessors for the settings needed by higher level code.
     // Surface accessors
-    size_t getWidth();
-    size_t getHeight();
+    size_t getWidth() {GNASH_REPORT_FUNCTION; };
+    size_t getHeight() {GNASH_REPORT_FUNCTION; };
     
     bool isSingleBuffered() { return true; }
     
@@ -74,17 +74,17 @@ class RawFBDevice : public device::GnashDevice
     // bool isBufferDestroyed(IRAWFBSurface surface) {
     //     return false;
     // }
-    int getID();
+    int getID() {GNASH_REPORT_FUNCTION; };
 
     // Get the size of the pixels, for RAWFB it's always 8 as far as I can tell
-    int getRedSize();
-    int getGreenSize();
-    int getBlueSize();
+    int getRedSize() {GNASH_REPORT_FUNCTION; };
+    int getGreenSize(){GNASH_REPORT_FUNCTION; };
+    int getBlueSize() {GNASH_REPORT_FUNCTION; };
     
     // Using RAWFB always means a native renderer
     bool isNativeRender() { return true; }
 
-    native_window_t getDrawableWindow();
+    native_window_t getDrawableWindow() {GNASH_REPORT_FUNCTION; };
     
     //
     // Testing Support
@@ -111,7 +111,7 @@ typedef void (*draw_func)();
 typedef int  (*key_func)(unsigned key);
 
 } // namespace rawFB
-} // namespace device
+} // namespace renderer
 } // namespace gnash
 
 #endif  // end of __RAWFB_DEVICE_H__
diff --git a/libdevice/rawfb/test_rawfb.cpp b/libdevice/rawfb/test_rawfb.cpp
index e6de483..ccda4bb 100644
--- a/libdevice/rawfb/test_rawfb.cpp
+++ b/libdevice/rawfb/test_rawfb.cpp
@@ -38,7 +38,7 @@ TestState runtest;
 
 using namespace gnash;
 using namespace std;
-using namespace device;
+using namespace renderer;
 
 // The debug log used by all the gnash libraries.
 static LogFile& dbglogfile = LogFile::getDefaultInstance();

http://git.savannah.gnu.org/cgit//commit/?id=a33ea12b01a2ef5c82f4a6cecae1a811a81e7beb


commit a33ea12b01a2ef5c82f4a6cecae1a811a81e7beb
Author: Rob Savoye <address@hidden>
Date:   Fri Dec 10 17:12:28 2010 -0700

    add a raw framebuffer to the device enum

diff --git a/libdevice/GnashDevice.h b/libdevice/GnashDevice.h
index 306c66c..380a9af 100644
--- a/libdevice/GnashDevice.h
+++ b/libdevice/GnashDevice.h
@@ -51,7 +51,7 @@ struct GnashDevice
     /// The list of supported renders that use devices
     typedef enum {OPENVG, OPENGL, OPENGLES1, OPENGLES2, XORG, VAAPI} rtype_t;
     /// The list of supported device types
-    typedef enum {NODEV, EGL, DIRECTFB, X11} dtype_t;
+    typedef enum {NODEV, EGL, DIRECTFB, X11, RAWFB} dtype_t;
     
     GnashDevice(int argc, char *argv[]);
     GnashDevice() { GNASH_REPORT_FUNCTION; };

http://git.savannah.gnu.org/cgit//commit/?id=c36e75f1b03b2e0d967ac589caba1324e6457e39


commit c36e75f1b03b2e0d967ac589caba1324e6457e39
Author: Rob Savoye <address@hidden>
Date:   Fri Dec 10 16:58:27 2010 -0700

    Revert "change from renderer to device namespace now that this code is in 
it's own directory"
    
    This reverts commit 16158610971c1c4711048d5493e2d4f1448e9d60.

diff --git a/libdevice/GnashDevice.h b/libdevice/GnashDevice.h
index dc8cc6c..306c66c 100644
--- a/libdevice/GnashDevice.h
+++ b/libdevice/GnashDevice.h
@@ -35,7 +35,7 @@
 /// determine functionality.
 namespace gnash {
 
-namespace device {
+namespace renderer {
 
 struct GnashDevice
 {
@@ -51,12 +51,12 @@ struct GnashDevice
     /// The list of supported renders that use devices
     typedef enum {OPENVG, OPENGL, OPENGLES1, OPENGLES2, XORG, VAAPI} rtype_t;
     /// The list of supported device types
-    typedef enum {NODEV, EGL, DIRECTFB, X11, RAWFB} dtype_t;
+    typedef enum {NODEV, EGL, DIRECTFB, X11} dtype_t;
     
     GnashDevice(int argc, char *argv[]);
-    GnashDevice();
+    GnashDevice() { GNASH_REPORT_FUNCTION; };
     
-    virtual ~GnashDevice();
+    virtual ~GnashDevice() { GNASH_REPORT_FUNCTION; };
 
     /// Get the type of the instatiated device. Since the
     /// renderer has a single value for the supported device,
@@ -114,7 +114,7 @@ struct GnashDevice
     virtual bool isNativeRender() = 0;
 };
 
-} // namespace device
+} // namespace renderer
 } // namespace gnash
 
 #endif  // end of __GNASH_DEVICE_H__
diff --git a/libdevice/directfb/DirectFBDevice.cpp 
b/libdevice/directfb/DirectFBDevice.cpp
index af37fb7..8d849ce 100644
--- a/libdevice/directfb/DirectFBDevice.cpp
+++ b/libdevice/directfb/DirectFBDevice.cpp
@@ -40,7 +40,7 @@
 
 namespace gnash {
 
-namespace device {
+namespace renderer {
 
 namespace directfb {
     
@@ -1239,7 +1239,7 @@ DirectFBDevice::printFBInputDevice(IDirectFBInputDevice 
*input)
 }
 
 } // namespace directfb
-} // namespace device
+} // namespace renderer
 } // namespace gnash
 
 // local Variables:
diff --git a/libdevice/directfb/DirectFBDevice.h 
b/libdevice/directfb/DirectFBDevice.h
index 7fbfea6..c8ad9a7 100644
--- a/libdevice/directfb/DirectFBDevice.h
+++ b/libdevice/directfb/DirectFBDevice.h
@@ -37,7 +37,7 @@
 
 namespace gnash {
 
-namespace device {
+namespace renderer {
 
 namespace directfb {
 
@@ -281,7 +281,7 @@ protected:
 };
 
 } // namespace directfb
-} // namespace device
+} // namespace renderer
 } // namespace gnash
 
 #endif  // end of __DIRECTFB_DEVICE_H__
diff --git a/libdevice/directfb/Renderer_DirectFB.cpp 
b/libdevice/directfb/Renderer_DirectFB.cpp
index e57c2e2..ede22b1 100644
--- a/libdevice/directfb/Renderer_DirectFB.cpp
+++ b/libdevice/directfb/Renderer_DirectFB.cpp
@@ -64,7 +64,7 @@
 
 namespace gnash {
 
-namespace device {
+namespace renderer {
 
 namespace DirectFB {
 
@@ -271,8 +271,8 @@ create_handler(const char *pixelformat)
   return renderer;
 }  
 
-} // namespace gnash::device::DirectFB
-} // namespace gnash::device
+} // namespace gnash::renderer::DirectFB
+} // namespace gnash::renderer
 } // end of gnash namespace
 
 // local Variables:
diff --git a/libdevice/directfb/Renderer_DirectFB.h 
b/libdevice/directfb/Renderer_DirectFB.h
index 4ce2dd2..d175707 100644
--- a/libdevice/directfb/Renderer_DirectFB.h
+++ b/libdevice/directfb/Renderer_DirectFB.h
@@ -38,7 +38,7 @@ namespace gnash {
 class GnashImage;
 class SWFCxForm;
 
-namespace device {
+namespace renderer {
 
 namespace DirectFB {
 
@@ -102,8 +102,8 @@ public:
 
 DSOEXPORT Renderer* create_handler(const char *pixelformat);
 
-} // namespace gnash::device::DirectFB
-} // namespace gnash::device
+} // namespace gnash::renderer::DirectFB
+} // namespace gnash::renderer
 } // namespace gnash
 
 #endif // __RENDER_HANDLER_DIRECTFB_H__
diff --git a/libdevice/directfb/test_dfb.cpp b/libdevice/directfb/test_dfb.cpp
index c5c5442..2b63fda 100644
--- a/libdevice/directfb/test_dfb.cpp
+++ b/libdevice/directfb/test_dfb.cpp
@@ -37,7 +37,7 @@ TestState runtest;
 
 using namespace gnash;
 using namespace std;
-using namespace device;
+using namespace renderer;
 
 // The debug log used by all the gnash libraries.
 static LogFile& dbglogfile = LogFile::getDefaultInstance();
diff --git a/libdevice/egl/eglDevice.cpp b/libdevice/egl/eglDevice.cpp
index c490aba..a00f63b 100644
--- a/libdevice/egl/eglDevice.cpp
+++ b/libdevice/egl/eglDevice.cpp
@@ -47,7 +47,7 @@
 
 namespace gnash {
 
-namespace device {
+namespace renderer {
 
 static const EGLint attrib32_list[] = {
     EGL_RED_SIZE,       8,
@@ -55,7 +55,6 @@ static const EGLint attrib32_list[] = {
     EGL_BLUE_SIZE,      8,
 //  EGL_ALPHA_SIZE,     0,
 //  EGL_DEPTH_SIZE,     24,
-#if 0
 #ifdef RENDERER_GLES1
     EGL_RENDERABLE_TYPE, EGL_OPENGL_ES_BIT,
 #endif
@@ -66,7 +65,6 @@ static const EGLint attrib32_list[] = {
     EGL_RENDERABLE_TYPE, EGL_OPENVG_BIT,
 //    EGL_STENCIL_SIZE,   8,
 #endif
-#endif
     EGL_RENDERABLE_TYPE, EGL_OPENVG_BIT|EGL_OPENGL_ES_BIT|EGL_OPENGL_ES2_BIT,
     EGL_SURFACE_TYPE,   EGL_WINDOW_BIT|EGL_PBUFFER_BIT|EGL_PIXMAP_BIT,
 //    EGL_SAMPLE_BUFFERS, 1,
@@ -685,33 +683,28 @@ EGLDevice::printEGLContext(EGLContext context)
 void
 EGLDevice::printEGLSurface(EGLSurface surface)
 {
-    if (_eglSurface != EGL_NO_SURFACE) {
-        EGLint value;
-        eglQuerySurface(_eglDisplay, surface, EGL_CONFIG_ID, &value);
-        std::cerr << "Surface EGL_CONFIG_ID is " << value << std::endl;
-        eglQuerySurface(_eglDisplay, surface, EGL_HEIGHT, &value);
-        std::cerr << "\tEGL_HEIGHT is " << value<< std::endl;
-        eglQuerySurface(_eglDisplay, surface, EGL_WIDTH, &value);
-        std::cerr << "\tEGL_WIDTH is " << value << std::endl;
-        eglQuerySurface(_eglDisplay, surface, EGL_RENDER_BUFFER, &value);
-        std::cerr << "\tEGL_RENDER_BUFFER is " << std::string((value == 
EGL_BACK_BUFFER)
-                 ? "EGL_BACK_BUFFER" : "EGL_SINGLE_BUFFER") << std::endl;
-        eglQuerySurface(_eglDisplay, surface, EGL_VERTICAL_RESOLUTION, &value);
-        std::cerr << "\tEGL_VERTICAL_RESOLUTION is " << value << std::endl;
-        eglQuerySurface(_eglDisplay, surface, EGL_HORIZONTAL_RESOLUTION, 
&value);
-        std::cerr << "\tEGL_HORIZONTAL_RESOLUTION is " << value << std::endl;
-        eglQuerySurface(_eglDisplay, surface, EGL_SWAP_BEHAVIOR, &value);
-        std::cerr << "\tEGL_SWAP_BEHAVIOR is "
-                  << std::string((value == EGL_BUFFER_DESTROYED)
-                   ? "EGL_BUFFER_DESTROYED" : "EGL_BUFFER_PRESERVED") << 
std::endl;
-        eglQuerySurface(_eglDisplay, surface, EGL_MULTISAMPLE_RESOLVE, &value);
-        std::cerr << "\tEGL_MULTISAMPLE_RESOLVE is "
-                  << std::string((value == EGL_MULTISAMPLE_RESOLVE_BOX)
-                  ? "EGL_MULTISAMPLE_RESOLVE_BOX" : 
"EGL_MULTISAMPLE_RESOLVE_DEFAULT")
-                  << std::endl;
-    } else {
-        std::cerr << "Surface no configured yet" << std::endl;
-    }
+    EGLint value;
+    eglQuerySurface(_eglDisplay, surface, EGL_CONFIG_ID, &value);
+    std::cerr << "Surface EGL_CONFIG_ID is " << value << std::endl;
+    eglQuerySurface(_eglDisplay, surface, EGL_HEIGHT, &value);
+    std::cerr << "\tEGL_HEIGHT is " << value<< std::endl;
+    eglQuerySurface(_eglDisplay, surface, EGL_WIDTH, &value);
+    std::cerr << "\tEGL_WIDTH is " << value << std::endl;
+    eglQuerySurface(_eglDisplay, surface, EGL_RENDER_BUFFER, &value);
+    std::cerr << "\tEGL_RENDER_BUFFER is " << std::string((value == 
EGL_BACK_BUFFER)
+              ? "EGL_BACK_BUFFER" : "EGL_SINGLE_BUFFER") << std::endl;
+    eglQuerySurface(_eglDisplay, surface, EGL_VERTICAL_RESOLUTION, &value);
+    std::cerr << "\tEGL_VERTICAL_RESOLUTION is " << value << std::endl;
+    eglQuerySurface(_eglDisplay, surface, EGL_HORIZONTAL_RESOLUTION, &value);
+    std::cerr << "\tEGL_HORIZONTAL_RESOLUTION is " << value << std::endl;
+    eglQuerySurface(_eglDisplay, surface, EGL_SWAP_BEHAVIOR, &value);
+    std::cerr << "\tEGL_SWAP_BEHAVIOR is "
+              << std::string((value == EGL_BUFFER_DESTROYED)
+                 ? "EGL_BUFFER_DESTROYED" : "EGL_BUFFER_PRESERVED") << 
std::endl;
+    eglQuerySurface(_eglDisplay, surface, EGL_MULTISAMPLE_RESOLVE, &value);
+    std::cerr << "\tEGL_MULTISAMPLE_RESOLVE is "
+              << std::string((value == EGL_MULTISAMPLE_RESOLVE_BOX)
+                 ? "EGL_MULTISAMPLE_RESOLVE_BOX" : 
"EGL_MULTISAMPLE_RESOLVE_DEFAULT") << std::endl;
 }
 
 // EGL WIDTH, EGL HEIGHT, EGL LARGEST PBUFFER, EGL TEXTURE FORMAT, 
@@ -778,7 +771,7 @@ EGLDevice::createPixmap(int width, int height, 
NativePixmapType buf)
     return pbuf;  
 }
 
-} // namespace device
+} // namespace renderer
 } // namespace gnash
 
 // local Variables:
diff --git a/libdevice/egl/eglDevice.h b/libdevice/egl/eglDevice.h
index 79aef81..95161a9 100644
--- a/libdevice/egl/eglDevice.h
+++ b/libdevice/egl/eglDevice.h
@@ -39,7 +39,7 @@
 
 namespace gnash {
 
-namespace device {
+namespace renderer {
 
 struct eglVertex {
     eglVertex(float x, float y)
@@ -357,7 +357,7 @@ protected:
 #define DUMP_CURRENT_SURFACE printEGLSurface(eglGetCurrentSurface(EGL_DRAW))
 #define DUMP_CURRENT_CONTEXT printEGLContext(eglGetCurrentContext())
 
-} // namespace device
+} // namespace renderer
 } // namespace gnash
 
 #endif  // end of __EGL_DEVICE_H__
diff --git a/libdevice/egl/test_egl.cpp b/libdevice/egl/test_egl.cpp
index 3b55754..de582e8 100644
--- a/libdevice/egl/test_egl.cpp
+++ b/libdevice/egl/test_egl.cpp
@@ -44,7 +44,7 @@ TestState runtest;
 
 using namespace gnash;
 using namespace std;
-using namespace device;
+using namespace renderer;
 
 void test_egl(EGLDevice &egl, GnashDevice::rtype_t rtype, int argc, char 
*argv[]);
 
@@ -324,7 +324,7 @@ test_egl(EGLDevice &egl, GnashDevice::rtype_t rtype, int 
argc, char *argv[])
     }
     
     if (hwinit) {
-        if (egl.getDepth() == 24) {
+        if (egl.getDepth()) {
             runtest.pass("EGLDevice::getDepth()");
         } else {
             runtest.fail("EGLDevice::getDepth()");
@@ -334,7 +334,7 @@ test_egl(EGLDevice &egl, GnashDevice::rtype_t rtype, int 
argc, char *argv[])
     }
     
     if (hwinit) {
-        if (egl.getMaxSwapInterval() == 1) {
+        if (egl.getMaxSwapInterval() == 0) {
             runtest.pass("EGLDevice::getMaxSwapInterval()");
         } else {
             runtest.fail("EGLDevice::getMaxSwapInterval()");
diff --git a/libdevice/rawfb/RawFBDevice.cpp b/libdevice/rawfb/RawFBDevice.cpp
index 60ffdc0..e62b25f 100644
--- a/libdevice/rawfb/RawFBDevice.cpp
+++ b/libdevice/rawfb/RawFBDevice.cpp
@@ -77,8 +77,6 @@ bool
 RawFBDevice::attachWindow(GnashDevice::native_window_t window)
 {
     GNASH_REPORT_FUNCTION;
-
-    return false;
 }
     
 
@@ -86,7 +84,6 @@ RawFBDevice::attachWindow(GnashDevice::native_window_t window)
 const char *
 RawFBDevice::getErrorString(int error)
 {
-    return 0;
 }
 
 // Create an RAWFB window to render in. This is only used by testing
@@ -99,7 +96,6 @@ RawFBDevice::createWindow(const char *name, int x, int y, int 
width, int height)
 void
 RawFBDevice::eventLoop(size_t passes)
 {
-    GNASH_REPORT_FUNCTION;
 }
 
 } // namespace rawfb
diff --git a/libdevice/rawfb/RawFBDevice.h b/libdevice/rawfb/RawFBDevice.h
index b629db0..7e68339 100644
--- a/libdevice/rawfb/RawFBDevice.h
+++ b/libdevice/rawfb/RawFBDevice.h
@@ -59,12 +59,12 @@ class RawFBDevice : public device::GnashDevice
     // Return a string with the error code as text, instead of a numeric value
     const char *getErrorString(int error);
     
-    int getDepth() { return 0; };
+    int getDepth();
 
     // Accessors for the settings needed by higher level code.
     // Surface accessors
-    size_t getWidth() { return 0; };
-    size_t getHeight() { return 0; };
+    size_t getWidth();
+    size_t getHeight();
     
     bool isSingleBuffered() { return true; }
     
@@ -74,17 +74,17 @@ class RawFBDevice : public device::GnashDevice
     // bool isBufferDestroyed(IRAWFBSurface surface) {
     //     return false;
     // }
-    int getID() { return 0; };
+    int getID();
 
     // Get the size of the pixels, for RAWFB it's always 8 as far as I can tell
-    int getRedSize() { return 0; };
-    int getGreenSize() { return 0; };
-    int getBlueSize() { return 0; };
+    int getRedSize();
+    int getGreenSize();
+    int getBlueSize();
     
     // Using RAWFB always means a native renderer
     bool isNativeRender() { return true; }
 
-    native_window_t getDrawableWindow() { return 0; };
+    native_window_t getDrawableWindow();
     
     //
     // Testing Support
diff --git a/libdevice/x11/X11Device.cpp b/libdevice/x11/X11Device.cpp
index e0bcb2f..590efa8 100644
--- a/libdevice/x11/X11Device.cpp
+++ b/libdevice/x11/X11Device.cpp
@@ -46,7 +46,7 @@
 
 namespace gnash {
 
-namespace device {
+namespace renderer {
 
 namespace x11 {
     
@@ -306,7 +306,7 @@ X11Device::eventLoop(size_t passes)
 }
 
 } // namespace x11
-} // namespace device
+} // namespace renderer
 } // namespace gnash
 
 // local Variables:
diff --git a/libdevice/x11/X11Device.h b/libdevice/x11/X11Device.h
index c74ed36..527d944 100644
--- a/libdevice/x11/X11Device.h
+++ b/libdevice/x11/X11Device.h
@@ -39,7 +39,7 @@
 
 namespace gnash {
 
-namespace device {
+namespace renderer {
 
 namespace x11 {
 
@@ -128,7 +128,7 @@ typedef void (*draw_func)();
 typedef int  (*key_func)(unsigned key);
 
 } // namespace x11
-} // namespace device
+} // namespace renderer
 } // namespace gnash
 
 #endif  // end of __X11_DEVICE_H__
diff --git a/libdevice/x11/test_x11.cpp b/libdevice/x11/test_x11.cpp
index 788dae1..14aeb16 100644
--- a/libdevice/x11/test_x11.cpp
+++ b/libdevice/x11/test_x11.cpp
@@ -40,7 +40,7 @@ TestState runtest;
 
 using namespace gnash;
 using namespace std;
-using namespace device;
+using namespace renderer;
 
 // The debug log used by all the gnash libraries.
 static LogFile& dbglogfile = LogFile::getDefaultInstance();

http://git.savannah.gnu.org/cgit//commit/?id=16158610971c1c4711048d5493e2d4f1448e9d60


commit 16158610971c1c4711048d5493e2d4f1448e9d60
Author: Rob Savoye <address@hidden>
Date:   Fri Dec 10 16:15:30 2010 -0700

    change from renderer to device namespace now that this code is in it's own 
directory

diff --git a/libdevice/GnashDevice.h b/libdevice/GnashDevice.h
index 306c66c..dc8cc6c 100644
--- a/libdevice/GnashDevice.h
+++ b/libdevice/GnashDevice.h
@@ -35,7 +35,7 @@
 /// determine functionality.
 namespace gnash {
 
-namespace renderer {
+namespace device {
 
 struct GnashDevice
 {
@@ -51,12 +51,12 @@ struct GnashDevice
     /// The list of supported renders that use devices
     typedef enum {OPENVG, OPENGL, OPENGLES1, OPENGLES2, XORG, VAAPI} rtype_t;
     /// The list of supported device types
-    typedef enum {NODEV, EGL, DIRECTFB, X11} dtype_t;
+    typedef enum {NODEV, EGL, DIRECTFB, X11, RAWFB} dtype_t;
     
     GnashDevice(int argc, char *argv[]);
-    GnashDevice() { GNASH_REPORT_FUNCTION; };
+    GnashDevice();
     
-    virtual ~GnashDevice() { GNASH_REPORT_FUNCTION; };
+    virtual ~GnashDevice();
 
     /// Get the type of the instatiated device. Since the
     /// renderer has a single value for the supported device,
@@ -114,7 +114,7 @@ struct GnashDevice
     virtual bool isNativeRender() = 0;
 };
 
-} // namespace renderer
+} // namespace device
 } // namespace gnash
 
 #endif  // end of __GNASH_DEVICE_H__
diff --git a/libdevice/directfb/DirectFBDevice.cpp 
b/libdevice/directfb/DirectFBDevice.cpp
index 8d849ce..af37fb7 100644
--- a/libdevice/directfb/DirectFBDevice.cpp
+++ b/libdevice/directfb/DirectFBDevice.cpp
@@ -40,7 +40,7 @@
 
 namespace gnash {
 
-namespace renderer {
+namespace device {
 
 namespace directfb {
     
@@ -1239,7 +1239,7 @@ DirectFBDevice::printFBInputDevice(IDirectFBInputDevice 
*input)
 }
 
 } // namespace directfb
-} // namespace renderer
+} // namespace device
 } // namespace gnash
 
 // local Variables:
diff --git a/libdevice/directfb/DirectFBDevice.h 
b/libdevice/directfb/DirectFBDevice.h
index c8ad9a7..7fbfea6 100644
--- a/libdevice/directfb/DirectFBDevice.h
+++ b/libdevice/directfb/DirectFBDevice.h
@@ -37,7 +37,7 @@
 
 namespace gnash {
 
-namespace renderer {
+namespace device {
 
 namespace directfb {
 
@@ -281,7 +281,7 @@ protected:
 };
 
 } // namespace directfb
-} // namespace renderer
+} // namespace device
 } // namespace gnash
 
 #endif  // end of __DIRECTFB_DEVICE_H__
diff --git a/libdevice/directfb/Renderer_DirectFB.cpp 
b/libdevice/directfb/Renderer_DirectFB.cpp
index ede22b1..e57c2e2 100644
--- a/libdevice/directfb/Renderer_DirectFB.cpp
+++ b/libdevice/directfb/Renderer_DirectFB.cpp
@@ -64,7 +64,7 @@
 
 namespace gnash {
 
-namespace renderer {
+namespace device {
 
 namespace DirectFB {
 
@@ -271,8 +271,8 @@ create_handler(const char *pixelformat)
   return renderer;
 }  
 
-} // namespace gnash::renderer::DirectFB
-} // namespace gnash::renderer
+} // namespace gnash::device::DirectFB
+} // namespace gnash::device
 } // end of gnash namespace
 
 // local Variables:
diff --git a/libdevice/directfb/Renderer_DirectFB.h 
b/libdevice/directfb/Renderer_DirectFB.h
index d175707..4ce2dd2 100644
--- a/libdevice/directfb/Renderer_DirectFB.h
+++ b/libdevice/directfb/Renderer_DirectFB.h
@@ -38,7 +38,7 @@ namespace gnash {
 class GnashImage;
 class SWFCxForm;
 
-namespace renderer {
+namespace device {
 
 namespace DirectFB {
 
@@ -102,8 +102,8 @@ public:
 
 DSOEXPORT Renderer* create_handler(const char *pixelformat);
 
-} // namespace gnash::renderer::DirectFB
-} // namespace gnash::renderer
+} // namespace gnash::device::DirectFB
+} // namespace gnash::device
 } // namespace gnash
 
 #endif // __RENDER_HANDLER_DIRECTFB_H__
diff --git a/libdevice/directfb/test_dfb.cpp b/libdevice/directfb/test_dfb.cpp
index 2b63fda..c5c5442 100644
--- a/libdevice/directfb/test_dfb.cpp
+++ b/libdevice/directfb/test_dfb.cpp
@@ -37,7 +37,7 @@ TestState runtest;
 
 using namespace gnash;
 using namespace std;
-using namespace renderer;
+using namespace device;
 
 // The debug log used by all the gnash libraries.
 static LogFile& dbglogfile = LogFile::getDefaultInstance();
diff --git a/libdevice/egl/eglDevice.cpp b/libdevice/egl/eglDevice.cpp
index a00f63b..c490aba 100644
--- a/libdevice/egl/eglDevice.cpp
+++ b/libdevice/egl/eglDevice.cpp
@@ -47,7 +47,7 @@
 
 namespace gnash {
 
-namespace renderer {
+namespace device {
 
 static const EGLint attrib32_list[] = {
     EGL_RED_SIZE,       8,
@@ -55,6 +55,7 @@ static const EGLint attrib32_list[] = {
     EGL_BLUE_SIZE,      8,
 //  EGL_ALPHA_SIZE,     0,
 //  EGL_DEPTH_SIZE,     24,
+#if 0
 #ifdef RENDERER_GLES1
     EGL_RENDERABLE_TYPE, EGL_OPENGL_ES_BIT,
 #endif
@@ -65,6 +66,7 @@ static const EGLint attrib32_list[] = {
     EGL_RENDERABLE_TYPE, EGL_OPENVG_BIT,
 //    EGL_STENCIL_SIZE,   8,
 #endif
+#endif
     EGL_RENDERABLE_TYPE, EGL_OPENVG_BIT|EGL_OPENGL_ES_BIT|EGL_OPENGL_ES2_BIT,
     EGL_SURFACE_TYPE,   EGL_WINDOW_BIT|EGL_PBUFFER_BIT|EGL_PIXMAP_BIT,
 //    EGL_SAMPLE_BUFFERS, 1,
@@ -683,28 +685,33 @@ EGLDevice::printEGLContext(EGLContext context)
 void
 EGLDevice::printEGLSurface(EGLSurface surface)
 {
-    EGLint value;
-    eglQuerySurface(_eglDisplay, surface, EGL_CONFIG_ID, &value);
-    std::cerr << "Surface EGL_CONFIG_ID is " << value << std::endl;
-    eglQuerySurface(_eglDisplay, surface, EGL_HEIGHT, &value);
-    std::cerr << "\tEGL_HEIGHT is " << value<< std::endl;
-    eglQuerySurface(_eglDisplay, surface, EGL_WIDTH, &value);
-    std::cerr << "\tEGL_WIDTH is " << value << std::endl;
-    eglQuerySurface(_eglDisplay, surface, EGL_RENDER_BUFFER, &value);
-    std::cerr << "\tEGL_RENDER_BUFFER is " << std::string((value == 
EGL_BACK_BUFFER)
-              ? "EGL_BACK_BUFFER" : "EGL_SINGLE_BUFFER") << std::endl;
-    eglQuerySurface(_eglDisplay, surface, EGL_VERTICAL_RESOLUTION, &value);
-    std::cerr << "\tEGL_VERTICAL_RESOLUTION is " << value << std::endl;
-    eglQuerySurface(_eglDisplay, surface, EGL_HORIZONTAL_RESOLUTION, &value);
-    std::cerr << "\tEGL_HORIZONTAL_RESOLUTION is " << value << std::endl;
-    eglQuerySurface(_eglDisplay, surface, EGL_SWAP_BEHAVIOR, &value);
-    std::cerr << "\tEGL_SWAP_BEHAVIOR is "
-              << std::string((value == EGL_BUFFER_DESTROYED)
-                 ? "EGL_BUFFER_DESTROYED" : "EGL_BUFFER_PRESERVED") << 
std::endl;
-    eglQuerySurface(_eglDisplay, surface, EGL_MULTISAMPLE_RESOLVE, &value);
-    std::cerr << "\tEGL_MULTISAMPLE_RESOLVE is "
-              << std::string((value == EGL_MULTISAMPLE_RESOLVE_BOX)
-                 ? "EGL_MULTISAMPLE_RESOLVE_BOX" : 
"EGL_MULTISAMPLE_RESOLVE_DEFAULT") << std::endl;
+    if (_eglSurface != EGL_NO_SURFACE) {
+        EGLint value;
+        eglQuerySurface(_eglDisplay, surface, EGL_CONFIG_ID, &value);
+        std::cerr << "Surface EGL_CONFIG_ID is " << value << std::endl;
+        eglQuerySurface(_eglDisplay, surface, EGL_HEIGHT, &value);
+        std::cerr << "\tEGL_HEIGHT is " << value<< std::endl;
+        eglQuerySurface(_eglDisplay, surface, EGL_WIDTH, &value);
+        std::cerr << "\tEGL_WIDTH is " << value << std::endl;
+        eglQuerySurface(_eglDisplay, surface, EGL_RENDER_BUFFER, &value);
+        std::cerr << "\tEGL_RENDER_BUFFER is " << std::string((value == 
EGL_BACK_BUFFER)
+                 ? "EGL_BACK_BUFFER" : "EGL_SINGLE_BUFFER") << std::endl;
+        eglQuerySurface(_eglDisplay, surface, EGL_VERTICAL_RESOLUTION, &value);
+        std::cerr << "\tEGL_VERTICAL_RESOLUTION is " << value << std::endl;
+        eglQuerySurface(_eglDisplay, surface, EGL_HORIZONTAL_RESOLUTION, 
&value);
+        std::cerr << "\tEGL_HORIZONTAL_RESOLUTION is " << value << std::endl;
+        eglQuerySurface(_eglDisplay, surface, EGL_SWAP_BEHAVIOR, &value);
+        std::cerr << "\tEGL_SWAP_BEHAVIOR is "
+                  << std::string((value == EGL_BUFFER_DESTROYED)
+                   ? "EGL_BUFFER_DESTROYED" : "EGL_BUFFER_PRESERVED") << 
std::endl;
+        eglQuerySurface(_eglDisplay, surface, EGL_MULTISAMPLE_RESOLVE, &value);
+        std::cerr << "\tEGL_MULTISAMPLE_RESOLVE is "
+                  << std::string((value == EGL_MULTISAMPLE_RESOLVE_BOX)
+                  ? "EGL_MULTISAMPLE_RESOLVE_BOX" : 
"EGL_MULTISAMPLE_RESOLVE_DEFAULT")
+                  << std::endl;
+    } else {
+        std::cerr << "Surface no configured yet" << std::endl;
+    }
 }
 
 // EGL WIDTH, EGL HEIGHT, EGL LARGEST PBUFFER, EGL TEXTURE FORMAT, 
@@ -771,7 +778,7 @@ EGLDevice::createPixmap(int width, int height, 
NativePixmapType buf)
     return pbuf;  
 }
 
-} // namespace renderer
+} // namespace device
 } // namespace gnash
 
 // local Variables:
diff --git a/libdevice/egl/eglDevice.h b/libdevice/egl/eglDevice.h
index 95161a9..79aef81 100644
--- a/libdevice/egl/eglDevice.h
+++ b/libdevice/egl/eglDevice.h
@@ -39,7 +39,7 @@
 
 namespace gnash {
 
-namespace renderer {
+namespace device {
 
 struct eglVertex {
     eglVertex(float x, float y)
@@ -357,7 +357,7 @@ protected:
 #define DUMP_CURRENT_SURFACE printEGLSurface(eglGetCurrentSurface(EGL_DRAW))
 #define DUMP_CURRENT_CONTEXT printEGLContext(eglGetCurrentContext())
 
-} // namespace renderer
+} // namespace device
 } // namespace gnash
 
 #endif  // end of __EGL_DEVICE_H__
diff --git a/libdevice/egl/test_egl.cpp b/libdevice/egl/test_egl.cpp
index de582e8..3b55754 100644
--- a/libdevice/egl/test_egl.cpp
+++ b/libdevice/egl/test_egl.cpp
@@ -44,7 +44,7 @@ TestState runtest;
 
 using namespace gnash;
 using namespace std;
-using namespace renderer;
+using namespace device;
 
 void test_egl(EGLDevice &egl, GnashDevice::rtype_t rtype, int argc, char 
*argv[]);
 
@@ -324,7 +324,7 @@ test_egl(EGLDevice &egl, GnashDevice::rtype_t rtype, int 
argc, char *argv[])
     }
     
     if (hwinit) {
-        if (egl.getDepth()) {
+        if (egl.getDepth() == 24) {
             runtest.pass("EGLDevice::getDepth()");
         } else {
             runtest.fail("EGLDevice::getDepth()");
@@ -334,7 +334,7 @@ test_egl(EGLDevice &egl, GnashDevice::rtype_t rtype, int 
argc, char *argv[])
     }
     
     if (hwinit) {
-        if (egl.getMaxSwapInterval() == 0) {
+        if (egl.getMaxSwapInterval() == 1) {
             runtest.pass("EGLDevice::getMaxSwapInterval()");
         } else {
             runtest.fail("EGLDevice::getMaxSwapInterval()");
diff --git a/libdevice/rawfb/RawFBDevice.cpp b/libdevice/rawfb/RawFBDevice.cpp
index e62b25f..60ffdc0 100644
--- a/libdevice/rawfb/RawFBDevice.cpp
+++ b/libdevice/rawfb/RawFBDevice.cpp
@@ -77,6 +77,8 @@ bool
 RawFBDevice::attachWindow(GnashDevice::native_window_t window)
 {
     GNASH_REPORT_FUNCTION;
+
+    return false;
 }
     
 
@@ -84,6 +86,7 @@ RawFBDevice::attachWindow(GnashDevice::native_window_t window)
 const char *
 RawFBDevice::getErrorString(int error)
 {
+    return 0;
 }
 
 // Create an RAWFB window to render in. This is only used by testing
@@ -96,6 +99,7 @@ RawFBDevice::createWindow(const char *name, int x, int y, int 
width, int height)
 void
 RawFBDevice::eventLoop(size_t passes)
 {
+    GNASH_REPORT_FUNCTION;
 }
 
 } // namespace rawfb
diff --git a/libdevice/rawfb/RawFBDevice.h b/libdevice/rawfb/RawFBDevice.h
index 7e68339..b629db0 100644
--- a/libdevice/rawfb/RawFBDevice.h
+++ b/libdevice/rawfb/RawFBDevice.h
@@ -59,12 +59,12 @@ class RawFBDevice : public device::GnashDevice
     // Return a string with the error code as text, instead of a numeric value
     const char *getErrorString(int error);
     
-    int getDepth();
+    int getDepth() { return 0; };
 
     // Accessors for the settings needed by higher level code.
     // Surface accessors
-    size_t getWidth();
-    size_t getHeight();
+    size_t getWidth() { return 0; };
+    size_t getHeight() { return 0; };
     
     bool isSingleBuffered() { return true; }
     
@@ -74,17 +74,17 @@ class RawFBDevice : public device::GnashDevice
     // bool isBufferDestroyed(IRAWFBSurface surface) {
     //     return false;
     // }
-    int getID();
+    int getID() { return 0; };
 
     // Get the size of the pixels, for RAWFB it's always 8 as far as I can tell
-    int getRedSize();
-    int getGreenSize();
-    int getBlueSize();
+    int getRedSize() { return 0; };
+    int getGreenSize() { return 0; };
+    int getBlueSize() { return 0; };
     
     // Using RAWFB always means a native renderer
     bool isNativeRender() { return true; }
 
-    native_window_t getDrawableWindow();
+    native_window_t getDrawableWindow() { return 0; };
     
     //
     // Testing Support
diff --git a/libdevice/x11/X11Device.cpp b/libdevice/x11/X11Device.cpp
index 590efa8..e0bcb2f 100644
--- a/libdevice/x11/X11Device.cpp
+++ b/libdevice/x11/X11Device.cpp
@@ -46,7 +46,7 @@
 
 namespace gnash {
 
-namespace renderer {
+namespace device {
 
 namespace x11 {
     
@@ -306,7 +306,7 @@ X11Device::eventLoop(size_t passes)
 }
 
 } // namespace x11
-} // namespace renderer
+} // namespace device
 } // namespace gnash
 
 // local Variables:
diff --git a/libdevice/x11/X11Device.h b/libdevice/x11/X11Device.h
index 527d944..c74ed36 100644
--- a/libdevice/x11/X11Device.h
+++ b/libdevice/x11/X11Device.h
@@ -39,7 +39,7 @@
 
 namespace gnash {
 
-namespace renderer {
+namespace device {
 
 namespace x11 {
 
@@ -128,7 +128,7 @@ typedef void (*draw_func)();
 typedef int  (*key_func)(unsigned key);
 
 } // namespace x11
-} // namespace renderer
+} // namespace device
 } // namespace gnash
 
 #endif  // end of __X11_DEVICE_H__
diff --git a/libdevice/x11/test_x11.cpp b/libdevice/x11/test_x11.cpp
index 14aeb16..788dae1 100644
--- a/libdevice/x11/test_x11.cpp
+++ b/libdevice/x11/test_x11.cpp
@@ -40,7 +40,7 @@ TestState runtest;
 
 using namespace gnash;
 using namespace std;
-using namespace renderer;
+using namespace device;
 
 // The debug log used by all the gnash libraries.
 static LogFile& dbglogfile = LogFile::getDefaultInstance();

http://git.savannah.gnu.org/cgit//commit/?id=76aa4caf6e4f32e70acef3f116aa7e8a33c1353a


commit 76aa4caf6e4f32e70acef3f116aa7e8a33c1353a
Author: Rob Savoye <address@hidden>
Date:   Fri Dec 10 16:14:49 2010 -0700

    add raw framebuffer device

diff --git a/libdevice/Makefile.am b/libdevice/Makefile.am
index fd3e0b8..0b84476 100644
--- a/libdevice/Makefile.am
+++ b/libdevice/Makefile.am
@@ -118,6 +118,10 @@ endif
 
 check_PROGRAMS =
 
+if BUILD_RAWFB_DEVICE
+include rawfb/rawfb.am
+endif
+
 if BUILD_EGL_DEVICE
 check_PROGRAMS += test_egl
 # this tests the low level EGL interface, used by OpenVG, OpenGLES1,

http://git.savannah.gnu.org/cgit//commit/?id=1d767c816058f248015af68391db57ff01da90dc


commit 1d767c816058f248015af68391db57ff01da90dc
Author: Rob Savoye <address@hidden>
Date:   Fri Dec 10 16:08:05 2010 -0700

    initial files for raw framebuffer device

diff --git a/libdevice/rawfb/RawFBDevice.cpp b/libdevice/rawfb/RawFBDevice.cpp
new file mode 100644
index 0000000..e62b25f
--- /dev/null
+++ b/libdevice/rawfb/RawFBDevice.cpp
@@ -0,0 +1,108 @@
+//
+//   Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software
+//   Foundation, Inc
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// 
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+#ifdef HAVE_CONFIG_H
+#include "gnashconfig.h"
+#endif
+
+#include <iostream>
+#include <cerrno>
+#include <exception>
+#include <sstream>
+
+#include "log.h"
+#include "GnashException.h"
+
+#include "RawFBDevice.h"
+#include "GnashDevice.h"
+
+namespace gnash {
+
+namespace device {
+
+namespace rawfb {
+    
+// The debug log used by all the gnash libraries.
+static LogFile& dbglogfile = LogFile::getDefaultInstance();
+
+
+RawFBDevice::RawFBDevice()
+{
+    GNASH_REPORT_FUNCTION;
+}
+
+RawFBDevice::RawFBDevice(int vid)
+{
+    GNASH_REPORT_FUNCTION;
+
+    if (!initDevice(0, 0)) {
+        log_error("Couldn't initialize RAWFB device!");
+    }
+}
+
+RawFBDevice::RawFBDevice(int argc, char *argv[])
+{
+    GNASH_REPORT_FUNCTION;
+    
+}
+
+RawFBDevice::~RawFBDevice()
+{
+    GNASH_REPORT_FUNCTION;
+}
+
+bool
+RawFBDevice::initDevice(int argc, char *argv[])
+{
+    GNASH_REPORT_FUNCTION;
+}
+
+// Initialize RAWFB Window layer
+bool
+RawFBDevice::attachWindow(GnashDevice::native_window_t window)
+{
+    GNASH_REPORT_FUNCTION;
+}
+    
+
+// Return a string with the error code as text, instead of a numeric value
+const char *
+RawFBDevice::getErrorString(int error)
+{
+}
+
+// Create an RAWFB window to render in. This is only used by testing
+void
+RawFBDevice::createWindow(const char *name, int x, int y, int width, int 
height)
+{
+    GNASH_REPORT_FUNCTION;
+}
+
+void
+RawFBDevice::eventLoop(size_t passes)
+{
+}
+
+} // namespace rawfb
+} // namespace renderer
+} // namespace gnash
+
+// local Variables:
+// mode: C++
+// indent-tabs-mode: nil
+// End:
diff --git a/libdevice/rawfb/RawFBDevice.h b/libdevice/rawfb/RawFBDevice.h
new file mode 100644
index 0000000..7e68339
--- /dev/null
+++ b/libdevice/rawfb/RawFBDevice.h
@@ -0,0 +1,122 @@
+//
+//   Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software
+//   Foundation, Inc
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// 
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+//
+
+#ifndef __RAWFB_DEVICE_H__
+#define __RAWFB_DEVICE_H__ 1
+
+#ifdef HAVE_CONFIG_H
+#include "gnashconfig.h"
+#endif
+
+#include <boost/scoped_array.hpp>
+#include <boost/scoped_ptr.hpp>
+
+#include "GnashDevice.h"
+
+namespace gnash {
+
+namespace device {
+
+namespace rawfb {
+
+class RawFBDevice : public device::GnashDevice
+{
+  public:
+    
+    RawFBDevice();
+    RawFBDevice(int);
+    RawFBDevice(int argc, char *argv[]);
+    
+    // virtual classes should have virtual destructors
+    virtual ~RawFBDevice();
+
+    dtype_t getType() { return RAWFB; };
+
+    // Initialize RAWFB Device layer
+    bool initDevice(int argc, char *argv[]);
+
+    // Initialize RAWFB Window layer
+    bool attachWindow(GnashDevice::native_window_t window);
+    
+    // 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);
+    
+    int getDepth();
+
+    // Accessors for the settings needed by higher level code.
+    // Surface accessors
+    size_t getWidth();
+    size_t getHeight();
+    
+    bool isSingleBuffered() { return true; }
+    
+    bool supportsRenderer(GnashDevice::rtype_t /* rtype */) { return false; }
+    
+    bool isBufferDestroyed() { return false; }
+    // bool isBufferDestroyed(IRAWFBSurface surface) {
+    //     return false;
+    // }
+    int getID();
+
+    // Get the size of the pixels, for RAWFB it's always 8 as far as I can tell
+    int getRedSize();
+    int getGreenSize();
+    int getBlueSize();
+    
+    // Using RAWFB always means a native renderer
+    bool isNativeRender() { return true; }
+
+    native_window_t getDrawableWindow();
+    
+    //
+    // Testing Support
+    //
+    
+    // Create an RAWFB window to render in. This is only used by testing
+    void createWindow(const char *name, int x, int y, int width, int height);
+
+    /// Start an RAWFB event loop. This is only used by testing. Note that
+    /// calling this function blocks until the specified number of events
+    /// have been handled. The first 5 are used up by creating the window.
+    ///
+    /// @param passes the number of events to process before returning.
+    /// @return nothing
+    void eventLoop(size_t passes);
+
+protected:
+    std::string _filespec;
+};
+
+typedef void (*init_func)();
+typedef void (*reshape_func)(int, int);
+typedef void (*draw_func)();
+typedef int  (*key_func)(unsigned key);
+
+} // namespace rawFB
+} // namespace device
+} // namespace gnash
+
+#endif  // end of __RAWFB_DEVICE_H__
+
+// local Variables:
+// mode: C++
+// indent-tabs-mode: nil
+// End:
diff --git a/libdevice/rawfb/rawfb.am b/libdevice/rawfb/rawfb.am
new file mode 100644
index 0000000..7e4b3f1
--- /dev/null
+++ b/libdevice/rawfb/rawfb.am
@@ -0,0 +1,19 @@
+if BUILD_RAWFB_DEVICE
+libgnashdevice_la_CPPFLAGS += $(RAWFB_CFLAGS) $(TSLIB_CFLAGS)
+libgnashdevice_la_SOURCES += \
+       rawfb/RawFBDevice.cpp \
+       rawfb/RawFBDevice.h
+libgnashdevice_la_LIBADD += $(TSLIB_LIBS)
+
+check_PROGRAMS += test_rawfb
+
+# this tests the low level EGL interface, used by OpenVG, OpenGLES1,
+# and OpenGLES2.
+test_rawfb_SOURCES = rawfb/test_rawfb.cpp
+test_rawfb_CPPFLAGS = $(AM_CPPFLAGS)
+test_rawfb_LDADD = \
+       ../librender/libgnashrender.la \
+       libgnashdevice.la \
+       $(GNASH_LIBS)
+endif
+
diff --git a/libdevice/rawfb/test_rawfb.cpp b/libdevice/rawfb/test_rawfb.cpp
new file mode 100644
index 0000000..e6de483
--- /dev/null
+++ b/libdevice/rawfb/test_rawfb.cpp
@@ -0,0 +1,130 @@
+// 
+//   Copyright (C) 2010 Free Software Foundation, Inc
+// 
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+// 
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+//
+
+#ifdef HAVE_CONFIG_H
+#include "gnashconfig.h"
+#endif
+
+#include <iostream>
+#include <string>
+#include <cstdlib>
+#include <vector>
+#include <map>
+#include <cassert>
+#include <regex.h>
+#include <boost/assign/list_of.hpp>
+
+#include "log.h"
+#include "dejagnu.h"
+#include "GnashDevice.h"
+#include "RawFBDevice.h"
+
+TestState runtest;
+
+using namespace gnash;
+using namespace std;
+using namespace device;
+
+// The debug log used by all the gnash libraries.
+static LogFile& dbglogfile = LogFile::getDefaultInstance();
+
+int
+main(int argc, char *argv[])
+{
+    // FIXME: for now, always run verbose till this supports command line args
+    dbglogfile.setVerbosity();
+
+    rawfb::RawFBDevice rfb;
+
+    bool ret = rfb.initDevice(argc, argv);
+    if (ret <= 0) {
+        exit(0);
+    }
+    
+    if (ret) {
+        runtest.pass("RawFBDevice:InitDevice()");
+    } else {
+        runtest.fail("RawFBDevice:InitDevice()");
+    }
+
+    if (rfb.getWidth()) {
+        runtest.pass("RawFBDevice::getWidth()");
+    } else {
+        runtest.fail("RawFBDevice::getWidth()");
+    }
+    
+    if (rfb.getHeight()) {
+        runtest.pass("RawFBDevice::getHeight()");
+    } else {
+        runtest.fail("DirecTFBDevice::getHeight()");
+    }
+
+#if 0
+    if (rfb.getVerticalRes()) {
+        runtest.pass("RawFBDevice::getVerticalRes()");
+    } else {
+        runtest.fail("RawFBDevice::getVerticalRes()");
+    }
+    
+    if (rfb.getHorzRes()) {
+        runtest.pass("RawFBDevice::getHorzRes()");
+    } else {
+        runtest.fail("RawFBDevice::getHorzRes()");
+    }    
+#endif
+    
+    if (rfb.isSingleBuffered()) {
+        runtest.pass("RawFBDevice::is*Buffered()");
+    } else {
+        runtest.fail("RawFBDevice::is*Buffered()");
+    }
+
+#if 0
+    if (rfb.isContextSingleBuffered() != rfb.isContextBackBuffered()) {
+        runtest.pass("RawFBDevice::iisContextBuffered()");
+    } else {
+        runtest.fail("RawFBDevice::isContextBuffered()");
+    }
+
+    // Context accessor tests
+    std::cerr << "FIXME: " << rfb.getContextID() << std::endl;
+
+    if (rfb.getContextID() >= 0) {
+        runtest.pass("RawFBDevice::getContextID()");
+    } else {
+        runtest.fail("RawFBDevice::getContextID()");
+    }    
+
+    if (rfb.getSurfaceID() >= 0) {
+        runtest.pass("RawFBDevice::getSurfaceID()");
+    } else {
+        runtest.fail("RawFBDevice::getSurfaceID()");
+    }
+#endif
+    
+    if (rfb.getDepth()) {
+        runtest.pass("RawFBDevice::getDepth()");
+    } else {
+        runtest.fail("RawFBDevice::getDepth()");
+    }
+}
+
+// Local Variables:
+// mode: C++
+// indent-tabs-mode: nil
+// End:

http://git.savannah.gnu.org/cgit//commit/?id=8e3d9e06a47f3472d209ca82e40d00ee294bee40


commit 8e3d9e06a47f3472d209ca82e40d00ee294bee40
Author: Rob Savoye <address@hidden>
Date:   Fri Dec 10 13:29:50 2010 -0700

    cleanup formatting to be more readable

diff --git a/librender/agg/Renderer_agg.cpp b/librender/agg/Renderer_agg.cpp
index dc5e0ae..3054184 100644
--- a/librender/agg/Renderer_agg.cpp
+++ b/librender/agg/Renderer_agg.cpp
@@ -190,10 +190,10 @@ inline void applyClipBox(Rasterizer& ras, const 
geometry::Range2d<int>& bounds)
 {
     assert(bounds.isFinite());
     ras.clip_box(static_cast<double>(bounds.getMinX()),
-            static_cast<double>(bounds.getMinY()),
-            static_cast<double>(bounds.getMaxX() + 1), 
-            static_cast<double>(bounds.getMaxY() + 1)
-            );  
+                static_cast<double>(bounds.getMinY()),
+                static_cast<double>(bounds.getMaxX() + 1), 
+                static_cast<double>(bounds.getMaxY() + 1)
+       );
 }
 
 /// Analyzes a set of paths to detect real presence of fills and/or outlines
@@ -206,13 +206,13 @@ analyzePaths(const GnashPaths &paths, bool& have_shape,
 
     have_shape = false;
     have_outline = false;
-
+    
     const int pcount = paths.size();
-
+    
     for (int pno=0; pno<pcount; ++pno) {
-
+       
         const Path &the_path = paths[pno];
-
+       
         if ((the_path.m_fill0 > 0) || (the_path.m_fill1 > 0)) {
             have_shape = true;
             if (have_outline) return; // have both
@@ -811,13 +811,13 @@ public:
       m_display_height(0.0),
       m_drawing_mask(false)
   {
-    // TODO: we really don't want to set the scale here as the core should
-    // tell us the right values before rendering anything. However this is
-    // currently difficult to implement. Removing the next call will
-    // lead to an assertion failure in begin_display() because we check
-    // whether the scale is known there.
-    set_scale(1.0f, 1.0f);
-       GNASH_REPORT_FUNCTION;
+      // TODO: we really don't want to set the scale here as the core should
+      // tell us the right values before rendering anything. However this is
+      // currently difficult to implement. Removing the next call will
+      // lead to an assertion failure in begin_display() because we check
+      // whether the scale is known there.
+      set_scale(1.0f, 1.0f);
+      GNASH_REPORT_FUNCTION;
   }   
 
   /// Initializes the rendering buffer. The memory pointed by "mem" is not
@@ -851,29 +851,26 @@ public:
       float /*x0*/, float /*x1*/, float /*y0*/, float /*y1*/)
   {
        GNASH_REPORT_FUNCTION;
-    assert(m_pixf.get());
-    
-    assert(scale_set);
-
-    // Render images list is cleared here because the GUI may want
+       assert(m_pixf.get());
+       
+       assert(scale_set);
+       
+       // Render images list is cleared here because the GUI may want
     // them for display after ::end_display()
     _render_images.clear();
 
     // clear the stage using the background color
-    if ( ! _clipbounds.empty() )
-    {
+    if ( ! _clipbounds.empty() ) {
         const agg::rgba8& col = agg::rgba8_pre(bg.m_r, bg.m_g, bg.m_b, bg.m_a);
         for (ClipBounds::const_iterator i = _clipbounds.begin(),
-                e = _clipbounds.end(); i!= e; ++i) 
-        {
-            clear_framebuffer(*i, col);
-        }
+                e = _clipbounds.end(); i!= e; ++i) {
+           clear_framebuffer(*i, col);
+       }
     }
     
     // reset status variables
     m_drawing_mask = false;
   }
-  
  
     virtual Renderer* startInternalRender(image::GnashImage& im) {
        GNASH_REPORT_FUNCTION;
@@ -2198,81 +2195,54 @@ DSOEXPORT const char *agg_detect_pixel_format(unsigned 
int rofs,
         unsigned int rsize, unsigned int gofs, unsigned int gsize,
         unsigned int bofs, unsigned int bsize, unsigned int bpp)
 {
-  
-  if (!is_little_endian_host() && (bpp>=24)) {
-  
-    // Swap bits for big endian hosts, because the following tests assume
-    // little endians. The pixel format string matches the bytes in memory.
     
-    // This applies for 24 bpp and 32 bpp modes only because AGG uses arrays
-    // in the premultiply() implementation for these modes. 16 bpp modes 
-    // instead use bit shifting, which is transparent to host endianess.
-    // See bug #22799.
+    if (!is_little_endian_host() && (bpp>=24)) {
+       
+       // Swap bits for big endian hosts, because the following tests assume
+       // little endians. The pixel format string matches the bytes in memory.
+       
+       // This applies for 24 bpp and 32 bpp modes only because AGG uses arrays
+       // in the premultiply() implementation for these modes. 16 bpp modes 
+       // instead use bit shifting, which is transparent to host endianess.
+       // See bug #22799.
+       
+       rofs = bpp - rofs - rsize;
+       gofs = bpp - gofs - gsize;
+       bofs = bpp - bofs - bsize; 
+       
+    }
+    
+    // 15 bits RGB (hicolor)
+    if ((rofs == 10) && (rsize == 5)
+       && (gofs == 5) && (gsize == 5)
+       && (bofs == 0) && (bsize == 5)) {
+       return "RGB555";
+    } else if ((rofs == 11) && (rsize == 5)    // 16 bits RGB (hicolor)
+              && (gofs == 5) && (gsize == 6)
+              && (bofs == 0) && (bsize == 5)) {
+       return "RGB565";
+    } else if ((rofs == 16) && (rsize == 8)    // 24 bits RGB (truecolor)
+              && (gofs == 8) && (gsize == 8)
+              && (bofs == 0) && (bsize == 8)) {
+       // BGRA32 seems to be standard for linux desktops
+       return (bpp == 24) ? "BGR24" : "BGRA32";
+    } else if ((rofs == 0) && (rsize == 8) // 24 bits BGR (truecolor)
+              && (gofs == 8) && (gsize == 8)
+              && (bofs == 16) && (bsize == 8)) {
+       return (bpp == 24) ? "RGB24" : "RGBA32";
+       // special 32 bits (mostly on big endian hosts
+    } else if ((rofs==8) && (rsize==8)
+              && (gofs==16) && (gsize==8)
+              && (bofs==24) && (bsize==8)) {
+       return "ARGB32";
+       // special 32 bits (mostly on big endian hosts)
+    } else if ((rofs==24) && (rsize==8)
+              && (gofs==16) && (gsize==8)
+              && (bofs==8) && (bsize==8)) {
+       return "ABGR32";
+    }
     
-    rofs = bpp - rofs - rsize;
-    gofs = bpp - gofs - gsize;
-    bofs = bpp - bofs - bsize; 
-  
-  }
-  
-  // 15 bits RGB (hicolor)
-  if ((rofs==10) && (rsize==5)
-   && (gofs==5) && (gsize==5)
-   && (bofs==0) && (bsize==5) ) {
-   
-    return "RGB555";
-      
-  } else   
-  // 16 bits RGB (hicolor)
-  if ((rofs==11) && (rsize==5)
-   && (gofs==5) && (gsize==6)
-   && (bofs==0) && (bsize==5) ) {
-   
-    return "RGB565";
-      
-  } else   
-  
-  // 24 bits RGB (truecolor)
-  if ((rofs==16) && (rsize==8)
-   && (gofs==8) && (gsize==8)
-   && (bofs==0) && (bsize==8) ) {
-   
-    if (bpp==24)
-      return "BGR24";
-    else
-      return "BGRA32";
-      
-  } else   
-  // 24 bits BGR (truecolor)
-  if ((rofs==0) && (rsize==8)
-   && (gofs==8) && (gsize==8)
-   && (bofs==16) && (bsize==8)) {
-   
-    if (bpp==24)
-      return "RGB24";
-    else
-      return "RGBA32";
-      
-  } else
-  // special 32 bits (mostly on big endian hosts)
-  if ((rofs==8) && (rsize==8)
-   && (gofs==16) && (gsize==8)
-   && (bofs==24) && (bsize==8)) {
-   
-   return "ARGB32";
-   
-  } else
-  // special 32 bits (mostly on big endian hosts)
-  if ((rofs==24) && (rsize==8)
-   && (gofs==16) && (gsize==8)
-   && (bofs==8) && (bsize==8)) {
-   
-   return "ABGR32";
-   
-  }
-  
-  return NULL; // unknown format
-  
+    return NULL; // unknown format
 }
 
 } // end of namespace gnash

http://git.savannah.gnu.org/cgit//commit/?id=c838ae4b8a4618f13f56b1233125f22d1e48708a


commit c838ae4b8a4618f13f56b1233125f22d1e48708a
Author: Rob Savoye <address@hidden>
Date:   Thu Dec 9 22:05:49 2010 -0700

    add private variable for the glue layer.

diff --git a/gui/fb/fb.cpp b/gui/fb/fb.cpp
index 793f918..f4b304a 100644
--- a/gui/fb/fb.cpp
+++ b/gui/fb/fb.cpp
@@ -106,12 +106,29 @@
 #include "log.h"
 #include "movie_root.h"
 #include "RunResources.h"
-
-#include "Renderer.h"
 #include "GnashSleep.h" // for gnashSleep
+#include "Renderer.h"
 
 #include <linux/input.h>    // for /dev/input/event*
 
+#ifdef RENDERER_AGG
+#include "fb_glue_agg.h"
+#endif
+
+#if 0
+#ifdef RENDERER_OPENVG
+#include "fb_glue_ovg.h"
+#endif
+
+// FIXME: this is just to remind us to implement these too
+#ifdef RENDERER_GLES1
+#include "fb_glue_gles1.h"
+#endif
+
+#ifdef RENDERER_GLES2
+#include "fb_glue_gles2.h"
+#endif
+#endif
 
 namespace gnash {
 
@@ -307,8 +324,19 @@ FBGui::init(int argc, char *** argv)
     log_debug("Width:%d, Height:%d", _width, _height);
     log_debug("X:%d, Y:%d", _xpos, _ypos);
 
-    _validbounds.setTo(0, 0, _width - 1, _height - 1);    
+    _validbounds.setTo(0, 0, _width - 1, _height - 1);
+
+    // Create a new Glue layer
+    _glue.reset(new FBAggGlue);
+
+    // Initialize the renderer
+    _glue->init(argc, argv);
 
+    // The agg glue file defines a typedef of Renderer, so we have to make sure
+    gnash::Renderer *rend = reinterpret_cast<gnash::Renderer *>
+                                             _glue->createRenderHandler());
+    _renderer.reset(rend);
+    
     return true;
 }
 
@@ -396,7 +424,8 @@ FBGui::createWindow(const char* /*title*/, int /*width*/, 
int /*height*/,
     GNASH_REPORT_FUNCTION;
     
     // Now initialize AGG
-    // return initialize_renderer();
+//    return initialize_renderer();
+//    _renderer->createRenderHandler();
 
     return false;
 }
@@ -464,12 +493,11 @@ void
 FBGui::setInvalidatedRegions(const InvalidatedRanges& ranges)
 {
     GNASH_REPORT_FUNCTION;
-
+    
     if (!_renderer) {
         log_error("No renderer set!");
         return;
     }
-    
     _renderer->set_invalidated_regions(ranges);
     
     _drawbounds.clear();
diff --git a/gui/fb/fb_glue_agg.h b/gui/fb/fb_glue_agg.h
index dd457fe..7704093 100644
--- a/gui/fb/fb_glue_agg.h
+++ b/gui/fb/fb_glue_agg.h
@@ -26,6 +26,7 @@
 #include <boost/cstdint.hpp>
 #include <boost/shared_ptr.hpp>
 
+#include "Renderer.h"
 #include "fbsup.h"
 #include "fb_glue.h"
 
@@ -33,8 +34,6 @@ namespace gnash {
 
 namespace gui {
 
-class Renderer;
-
 class FBAggGlue: public FBGlue
 {
 public:
diff --git a/gui/fb/fbsup.h b/gui/fb/fbsup.h
index 719c5a1..f036c95 100644
--- a/gui/fb/fbsup.h
+++ b/gui/fb/fbsup.h
@@ -24,6 +24,7 @@
 #endif
 
 #include <boost/scoped_array.hpp>
+#include <boost/shared_ptr.hpp>
 #include <vector>
 #include <linux/fb.h>
 
@@ -52,6 +53,7 @@ namespace gnash {
 namespace gui {
 
 class Renderer;
+class FBGlue;
 
 /// A Framebuffer-based GUI for Gnash.
 /// ----------------------------------
@@ -206,8 +208,9 @@ private:
     struct fb_var_screeninfo var_screeninfo;
     struct fb_fix_screeninfo fix_screeninfo;
 
-    unsigned int _timeout; /* TODO: should we move this to base class ? */
+    unsigned int _timeout;
     
+    boost::shared_ptr<FBGlue> _glue;    
 };
 
 } // end of namespace gui

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

Summary of changes:
 configure.ac                                       |   41 ++-
 gui/Makefile.am                                    |   12 +
 gui/fb/fb.cpp                                      |  337 +++++++-------------
 gui/fb/fb_glue.h                                   |   92 ++++++-
 gui/fb/fb_glue_agg.cpp                             |  190 +++++++-----
 gui/fb/fb_glue_agg.h                               |   27 +-
 gui/fb/fbsup.h                                     |   53 ++--
 gui/sdl/sdl_agg_glue.h                             |    2 +-
 libdevice/GnashDevice.h                            |    5 +-
 libdevice/Makefile.am                              |    4 +
 libdevice/rawfb/RawFBDevice.cpp                    |  308 ++++++++++++++++++
 libdevice/{x11/X11Device.h => rawfb/RawFBDevice.h} |  106 ++++---
 libdevice/rawfb/rawfb.am                           |   22 ++
 libdevice/rawfb/test_rawfb.cpp                     |  132 ++++++++
 librender/README                                   |    2 +-
 librender/Renderer.h                               |   75 +-----
 librender/agg/Renderer_agg.cpp                     |  170 ++++------
 librender/agg/Renderer_agg.h                       |    5 +-
 librender/openvg/Renderer_ovg.h                    |    4 +-
 19 files changed, 1007 insertions(+), 580 deletions(-)
 create mode 100644 libdevice/rawfb/RawFBDevice.cpp
 copy libdevice/{x11/X11Device.h => rawfb/RawFBDevice.h} (52%)
 create mode 100644 libdevice/rawfb/rawfb.am
 create mode 100644 libdevice/rawfb/test_rawfb.cpp


hooks/post-receive
-- 
Gnash



reply via email to

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