gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash/gui gtk.cpp gtk_glue.h gtk_glue_agg.cpp g...


From: Udo Giacomozzi
Subject: [Gnash-commit] gnash/gui gtk.cpp gtk_glue.h gtk_glue_agg.cpp g...
Date: Wed, 01 Aug 2007 13:16:41 +0000

CVSROOT:        /cvsroot/gnash
Module name:    gnash
Changes by:     Udo Giacomozzi <udog>   07/08/01 13:16:40

Modified files:
        gui            : gtk.cpp gtk_glue.h gtk_glue_agg.cpp 
                         gtk_glue_agg.h gtksup.h gui.cpp gui.h 

Log message:
        added beforeRendering() callback and optimized MIT-SHM syncing.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gtk.cpp?cvsroot=gnash&r1=1.101&r2=1.102
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gtk_glue.h?cvsroot=gnash&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gtk_glue_agg.cpp?cvsroot=gnash&r1=1.24&r2=1.25
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gtk_glue_agg.h?cvsroot=gnash&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gtksup.h?cvsroot=gnash&r1=1.47&r2=1.48
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gui.cpp?cvsroot=gnash&r1=1.89&r2=1.90
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gui.h?cvsroot=gnash&r1=1.57&r2=1.58

Patches:
Index: gtk.cpp
===================================================================
RCS file: /cvsroot/gnash/gnash/gui/gtk.cpp,v
retrieving revision 1.101
retrieving revision 1.102
diff -u -b -r1.101 -r1.102
--- gtk.cpp     30 Jul 2007 21:26:39 -0000      1.101
+++ gtk.cpp     1 Aug 2007 13:16:39 -0000       1.102
@@ -17,7 +17,7 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
 
-/* $Id: gtk.cpp,v 1.101 2007/07/30 21:26:39 strk Exp $ */
+/* $Id: gtk.cpp,v 1.102 2007/08/01 13:16:39 udog Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -268,6 +268,12 @@
 }
 
 void
+GtkGui::beforeRendering()
+{
+  _glue->beforeRendering();
+}
+
+void
 GtkGui::renderBuffer()
 {
        if ( _drawbounds.size() == 0 ) return; // nothing to do..

Index: gtk_glue.h
===================================================================
RCS file: /cvsroot/gnash/gnash/gui/gtk_glue.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- gtk_glue.h  30 Jul 2007 21:26:39 -0000      1.12
+++ gtk_glue.h  1 Aug 2007 13:16:40 -0000       1.13
@@ -43,6 +43,7 @@
                        { render();     };
     virtual void configure(GtkWidget *const widget,
                            GdkEventConfigure *const event) = 0;
+    virtual void beforeRendering() { /* nop */ };
   protected:
     GtkWidget *_drawing_area;
 };

Index: gtk_glue_agg.cpp
===================================================================
RCS file: /cvsroot/gnash/gnash/gui/gtk_glue_agg.cpp,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -b -r1.24 -r1.25
--- gtk_glue_agg.cpp    1 Aug 2007 12:06:30 -0000       1.24
+++ gtk_glue_agg.cpp    1 Aug 2007 13:16:40 -0000       1.25
@@ -18,7 +18,7 @@
 //
 //
 
-/* $Id: gtk_glue_agg.cpp,v 1.24 2007/08/01 12:06:30 udog Exp $ */
+/* $Id: gtk_glue_agg.cpp,v 1.25 2007/08/01 13:16:40 udog Exp $ */
 
 
 /// \page gtk_shm_support GTK shared memory extension support
@@ -109,7 +109,7 @@
       return false;
     }
     
-    log_msg("Your X server expects %s pixmap data.", _pixelformat);
+    log_msg("Your X server expects %s pixmap data for standard mode.", 
_pixelformat);
     
     return true;
 }
@@ -419,6 +419,24 @@
 }
 
 void
+GtkAggGlue::beforeRendering()
+{
+#ifdef ENABLE_MIT_SHM
+  if (_shm_image) {
+    // The shared memory buffer is copied in background(!) since the X 
+    // calls are executed asynchroneously. This is dangerous because it
+    // may happen that the renderer updates the buffer while the X server
+    // still copies the data to the VRAM (flicker can occurr).
+    // Instead of using the XShmCompletionEvent for this we just call XSync
+    // right before writing to the shared memory again. This will make sure
+    // that the X server finishes to copy the data to VRAM before we
+    // change it again.
+    XSync(gdk_display, False);
+  }
+#endif  
+}
+
+void
 GtkAggGlue::render()
 {
 
@@ -435,22 +453,7 @@
       _width, _height,
       False); 
       
-      // <Udo>:
-      // The shared memory buffer is copied in background(!) since the X 
-      // calls are executed asynchroneously. This is dangerous because it
-      // may happen that the renderer updates the buffer while the X server
-      // still copies the data to the VRAM (flicker can occurr).
-      // Normally this is avoided using the XShmCompletionEvent which is sent
-      // to the client once the buffer has been copied. The last argument to
-      // XShmPutImage must be set to True for this. 
-      // We'd need to wait for this event before calling the renderer again.
-      // I know nothing about X event handling and so I just call XSync here
-      // to wait until all commands have been executed. This has the 
-      // disadvantage that we can't leave the X server some time till the core 
-      // is ready to *render* the next frame. I don't think it would make a 
-      // significant performance difference unless data to video ram is very 
-      // slow (could be the case for old / embedded computers, though).       
-      XSync(gdk_display, False);
+      // NOTE: Data will be copied in background, see beforeRendering()
 
   } else {
 #endif  
@@ -491,7 +494,7 @@
                maxx-minx+1, maxy-miny+1,
       False);
       
-    XSync(gdk_display, False); // see GtkAggGlue::render(void)
+    // NOTE: Data will be copied in background, see beforeRendering()
   
   } else {
 #endif       

Index: gtk_glue_agg.h
===================================================================
RCS file: /cvsroot/gnash/gnash/gui/gtk_glue_agg.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- gtk_glue_agg.h      1 Aug 2007 12:06:30 -0000       1.14
+++ gtk_glue_agg.h      1 Aug 2007 13:16:40 -0000       1.15
@@ -47,6 +47,7 @@
     void prepDrawingArea(GtkWidget *drawing_area);
     render_handler* createRenderHandler();
     void setRenderHandlerSize(int width, int height);
+    void beforeRendering();
     void render();
     void render(int minx, int miny, int maxx, int maxy);
     void configure(GtkWidget *const widget, GdkEventConfigure *const event);

Index: gtksup.h
===================================================================
RCS file: /cvsroot/gnash/gnash/gui/gtksup.h,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -b -r1.47 -r1.48
--- gtksup.h    30 Jul 2007 21:26:39 -0000      1.47
+++ gtksup.h    1 Aug 2007 13:16:40 -0000       1.48
@@ -53,6 +53,7 @@
 
     virtual bool createMenu();
     virtual bool setupEvents();
+    virtual void beforeRendering();
     virtual void renderBuffer();
     virtual void setInterval(unsigned int interval);
     virtual void setTimeout(unsigned int timeout);

Index: gui.cpp
===================================================================
RCS file: /cvsroot/gnash/gnash/gui/gui.cpp,v
retrieving revision 1.89
retrieving revision 1.90
diff -u -b -r1.89 -r1.90
--- gui.cpp     3 Jul 2007 15:53:39 -0000       1.89
+++ gui.cpp     1 Aug 2007 13:16:40 -0000       1.90
@@ -415,6 +415,8 @@
                setInvalidatedRegions(changed_ranges);
 #endif
 
+    beforeRendering();
+
                // render the frame.
                // It's up to the GUI/renderer combination
                // to do any clipping, if desired.     

Index: gui.h
===================================================================
RCS file: /cvsroot/gnash/gnash/gui/gui.h,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -b -r1.57 -r1.58
--- gui.h       26 Jul 2007 14:39:09 -0000      1.57
+++ gui.h       1 Aug 2007 13:16:40 -0000       1.58
@@ -131,6 +131,10 @@
     virtual void setInvalidatedRegion(const rect& bounds);
     virtual void setInvalidatedRegions(const InvalidatedRanges& ranges);
     
+    // Called right before rendering anything (after setInvalidatedRegion).
+    // Used by GTK-AGG.
+    virtual void beforeRendering() { /* nop */ };
+    
     // Should return TRUE when the GUI/Renderer combination supports multiple
     // invalidated bounds regions. 
     virtual bool want_multiple_regions() { return false; }




reply via email to

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