sung pushed a commit to branch master.
commit 7aa516c01a620da3438de864ac0c0e5b80c93d0b
Author: Sung W. Park <[email protected]>
Date: Tue Jul 23 10:23:36 2013 +0900
Evas: adding image dump debug feature for wayland_egl backend
Porting commit f10c108283d9b76708418ba172b9ff0b28a09cd6 to wayland
engine.
Added a feature to dump out a png image before calling SwapBuffers.
To turn on the feature, use the following env vars.
EVAS_GL_SWAP_BUFFER_DEBUG_DIR="dir_name" sets the name of the directory
that the files will be output to and enables the debug mode.
EVAS_GL_SWAP_BUFFER_DEBUG_ALWAYS=1 will enable the writing of the
files every frame. This in effect turns on the swap_buffer_debug
variable, which can be set on or off in gdb for debugging. This will
allow dumping of certain frames without having to dump out a ton of
files to track down one frame.
---
src/modules/evas/engines/wayland_egl/evas_engine.c | 43 ++++++++++++++++++++++
1 file changed, 43 insertions(+)
diff --git a/src/modules/evas/engines/wayland_egl/evas_engine.c
b/src/modules/evas/engines/wayland_egl/evas_engine.c
index 1db4dbd..65edcca 100644
--- a/src/modules/evas/engines/wayland_egl/evas_engine.c
+++ b/src/modules/evas/engines/wayland_egl/evas_engine.c
@@ -41,6 +41,7 @@ struct _Render_Engine
Eina_Bool lost_back : 1;
Eina_Bool end : 1;
Eina_Bool evgl_initted : 1;
+ int frame_cnt;
struct
{
@@ -103,6 +104,9 @@ static Eina_Bool extn_have_buffer_age = EINA_TRUE;
static int safe_native = -1;
static int partial_rect_union_mode = -1;
+static int swap_buffer_debug_mode = -1;
+static int swap_buffer_debug = 0;
+
/* function tables - filled in later (func and parent func) */
static Evas_Func func, pfunc;
static EVGL_Interface evgl_funcs =
@@ -1188,6 +1192,7 @@ static void
eng_output_flush(void *data, Evas_Render_Mode render_mode)
{
Render_Engine *re;
+ static char *dname = NULL;
if (!(re = (Render_Engine *)data)) return;
@@ -1201,6 +1206,41 @@ eng_output_flush(void *data, Evas_Render_Mode
render_mode)
evas_gl_common_context_done(re->win->gl_context);
+ // Save contents of the framebuffer to a file
+ if (swap_buffer_debug_mode == -1)
+ {
+ if ((dname = getenv("EVAS_GL_SWAP_BUFFER_DEBUG_DIR")))
+ {
+ int stat;
+ // Create a directory with 0775 permission
+ stat = mkdir(dname, S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH);
+ if ((!stat) || errno == EEXIST) swap_buffer_debug_mode = 1;
+ }
+ else
+ swap_buffer_debug_mode = 0;
+ }
+
+ if (swap_buffer_debug_mode == 1)
+ {
+ // Set this env var to dump files every frame
+ // Or set the global var in gdb to 1|0 to turn it on and off
+ if (getenv("EVAS_GL_SWAP_BUFFER_DEBUG_ALWAYS"))
+ swap_buffer_debug = 1;
+
+ if (swap_buffer_debug)
+ {
+ char fname[100];
+ int ret = 0;
+ sprintf(fname, "%p", (void*)re->win);
+
+ ret = evas_gl_common_buffer_dump(re->win->gl_context,
+ (const char*)dname,
+ (const char*)fname,
+ re->frame_cnt);
+ if (!ret) swap_buffer_debug_mode = 0;
+ }
+ }
+
if (!re->vsync)
{
if (re->info->vsync) eglSwapInterval(re->win->egl_disp, 1);
@@ -1278,6 +1318,9 @@ eng_output_flush(void *data, Evas_Render_Mode render_mode)
evas_common_tilebuf_free_render_rects(re->rects);
re->rects = NULL;
}
+
+ re->frame_cnt++;
+
end:
evas_gl_preload_render_unlock(eng_gl_preload_make_current, re);
}
--
------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk