[Title] Added surface dumping point for EGL pixmaps & FBOs
authorHaegeun Park <haegeun.park@samsung.com>
Tue, 27 Aug 2013 07:59:41 +0000 (00:59 -0700)
committerHaegeun Park <haegeun.park@samsung.com>
Tue, 27 Aug 2013 07:59:41 +0000 (00:59 -0700)
[Issue#]
[Problem]
[Cause]
[Solution]
- FBOs are dumped when calling BindFramebuffer, Flush, Finish
- EGLPixmaps are dumped when calling SwapBuffers, Flush, Finish

src/modules/fastpath/coregl_fastpath.c
src/modules/fastpath/coregl_fastpath_gl.c
src/modules/tracepath/coregl_tracepath.c
src/modules/tracepath/coregl_tracepath.h
src/modules/tracepath/coregl_tracepath_egl.c
src/modules/tracepath/coregl_tracepath_gl.c

index 1414e4c..99f8507 100644 (file)
@@ -212,6 +212,7 @@ fastpath_apply_overrides_gl(int enable)
                COREGL_OVERRIDE(fastpath_, glBindFramebuffer);
                COREGL_OVERRIDE(fastpath_, glIsFramebuffer);
                COREGL_OVERRIDE(fastpath_, glDeleteFramebuffers);
+               COREGL_OVERRIDE(fastpath_, glGetFramebufferAttachmentParameteriv);
 
                COREGL_OVERRIDE(fastpath_, glGenRenderbuffers);
                COREGL_OVERRIDE(fastpath_, glBindRenderbuffer);
index 2e0d819..c3c29df 100644 (file)
@@ -440,6 +440,51 @@ finish:
        _COREGL_FASTPATH_FUNC_END();
 }
 
+void
+fastpath_glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint *params)
+{
+       GLint real_obj, fa_type;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       switch (pname)
+       {
+               case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:
+                       params[0] = 0;
+                       _orig_fastpath_glGetFramebufferAttachmentParameteriv(target, attachment, pname, &real_obj);
+                       _orig_fastpath_glGetFramebufferAttachmentParameteriv(target, attachment, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, &fa_type);
+                       switch (fa_type)
+                       {
+                               case GL_TEXTURE:
+                                       if (GET_GLUE_OBJ(GL_OBJECT_TYPE_TEXTURE, real_obj, (GLuint *)params) != 1)
+                                       {
+                                               params[0] = 0;
+                                               goto finish;
+                                       }
+                                       break;
+                               case GL_RENDERBUFFER:
+                                       if (GET_GLUE_OBJ(GL_OBJECT_TYPE_RENDERBUFFER, real_obj, (GLuint *)params) != 1)
+                                       {
+                                               params[0] = 0;
+                                               goto finish;
+                                       }
+                                       break;
+                       }
+                       break;
+               default:
+                       _orig_fastpath_glGetFramebufferAttachmentParameteriv(target, attachment, pname, params);
+                       break;
+       }
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
 GLboolean
 fastpath_glIsTexture(GLuint texture)
 {
index 8eea9f9..aad4a44 100644 (file)
@@ -1006,42 +1006,8 @@ void (*dl_png_write_image) (png_structp png_ptr,
 void (*dl_png_write_end) (png_structp png_ptr,
                             png_infop info_ptr);
 
-void
-tracepath_surface_trace_add(const char *desc, GLDisplay dpy, GLContext ctx, GLSurface surf, GLint fbo, GLint tex, GLint rb, GLint tex_w, GLint tex_h, GLint tex_format)
-{
-       Surface_Data *std = NULL;
-
-       if (trace_surface_flag == 1)
-       {
-               AST(mutex_lock(&std_access_mutex) == 1);
-
-               if (std_table == NULL)
-               {
-                       std_table = (Surface_Data **)calloc(1, sizeof(Surface_Data *) * MAX_TRACE_TABLE_SIZE);
-               }
-
-               std = (Surface_Data *)_get_trace_data((Trace_Data **)std_table, sizeof(Surface_Data), desc);
-
-               AST(std != NULL);
-
-               std->display = dpy;
-               std->surface = surf;
-               std->context = ctx;
-               if (fbo >= 0) std->fbo = fbo;
-               std->tex = tex;
-               std->rb = rb;
-               if (tex_w >= 0) std->tex_w = tex_w;
-               if (tex_h >= 0) std->tex_h = tex_h;
-               if (tex_format >= 0) std->tex_format = tex_format;
-
-               AST(mutex_unlock(&std_access_mutex) == 1);
-
-       }
-
-}
-
 static void
-_dump_surface(int force_output, const char *position, Surface_Data *sdata)
+_dump_surface(int force_output, int type, const char *position, Surface_Data *sdata)
 {
        static int alldumpcount = 0;
 
@@ -1068,7 +1034,6 @@ _dump_surface(int force_output, const char *position, Surface_Data *sdata)
                png_struct *png;
                png_info *info;
                png_byte **rows;
-               png_color_16 black;
 
                if (!png_lib_handle ||
                    dl_png_create_write_struct == NULL ||
@@ -1095,7 +1060,7 @@ _dump_surface(int force_output, const char *position, Surface_Data *sdata)
                else
                        sprintf(name, "[%d %p-%p] %s %04d (%s).png", getpid(), sdata->display, sdata->context, sdata->trace_data.name, sdata->dump_count, position);
 
-               if (sdata->fbo == 0 && sdata->tex == 0 && sdata->rb == 0)
+               if (!strncmp(sdata->trace_data.name, "EGL", 3) && type != 2)
                { // EGL
                        if (trace_surface_filter_type != 0 &&
                            trace_surface_filter_type != 1) return;
@@ -1132,7 +1097,9 @@ _dump_surface(int force_output, const char *position, Surface_Data *sdata)
                                return;
                        }
 
-                       TRACE("\E[40;31;1m[[TRACE SURFACE]] : '%s' is dumped (%dx%d).\E[0m\n", name, width, height);
+                       if (channel == 3) channel = 4;
+
+                       TRACE("\E[40;31;1m[[TRACE SURFACE]] : '%s' is dumped (%dx%dx%d).\E[0m\n", name, width, height, channel);
                        if (trace_surface_print_only_flag == 1 && force_output == 0)
                        {
                                alldumpcount++;
@@ -1140,7 +1107,7 @@ _dump_surface(int force_output, const char *position, Surface_Data *sdata)
                                return;
                        }
 
-                       data = (unsigned char *)malloc(width * height * channel * sizeof(unsigned char));
+                       data = (unsigned char *)calloc(1, width * height * channel * sizeof(unsigned char));
                        if (data == NULL)
                        {
                                COREGL_ERR("Can't trace surface : Failed to allocate memory");
@@ -1160,8 +1127,10 @@ _dump_surface(int force_output, const char *position, Surface_Data *sdata)
 
                        _orig_tracepath_glBindFramebuffer(GL_FRAMEBUFFER, oldfb);
                }
-               if (sdata->fbo != 0)
+               if (!strncmp(sdata->trace_data.name, "FBO", 3) && type != 1)
                { // FBO
+                       if (sdata->fbo == 0) return;
+
                        if (trace_surface_filter_type != 0 &&
                            trace_surface_filter_type != 2) return;
 
@@ -1194,7 +1163,7 @@ _dump_surface(int force_output, const char *position, Surface_Data *sdata)
                                        return;
                                }
 
-                               TRACE("\E[40;31;1m[[TRACE SURFACE]] : '%s' is dumped (%dx%d).\E[0m\n", name, width, height);
+                               TRACE("\E[40;31;1m[[TRACE SURFACE]] : '%s' is dumped (%dx%dx%d).\E[0m\n", name, width, height, channel);
                                if (trace_surface_print_only_flag == 1 && force_output == 0)
                                {
                                        alldumpcount++;
@@ -1202,7 +1171,9 @@ _dump_surface(int force_output, const char *position, Surface_Data *sdata)
                                        return;
                                }
 
-                               data = (unsigned char *)malloc(width * height * channel * sizeof(unsigned char));
+                               if (channel == 3) channel = 4;
+
+                               data = (unsigned char *)calloc(1, width * height * channel * sizeof(unsigned char));
                                if (data == NULL)
                                {
                                        COREGL_ERR("Can't trace surface : Failed to allocate memory");
@@ -1210,6 +1181,21 @@ _dump_surface(int force_output, const char *position, Surface_Data *sdata)
                                }
 
                                _orig_tracepath_glBindFramebuffer(GL_FRAMEBUFFER, sdata->fbo);
+                               int atttype = _COREGL_INT_INIT_VALUE;
+                          _orig_tracepath_glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, &atttype);
+                               AST(atttype != sdata->tex);
+                               int attname = _COREGL_INT_INIT_VALUE;
+                          _orig_tracepath_glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, &attname);
+                               switch (atttype)
+                               {
+                                       case GL_TEXTURE:
+                                               AST(attname == sdata->tex);
+                                               break;
+                                       case GL_RENDERBUFFER:
+                                               AST(attname == sdata->rb);
+                                               break;
+                               }
+
                                switch(channel)
                                {
                                        case 4: _orig_tracepath_glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, data); break;
@@ -1271,13 +1257,6 @@ _dump_surface(int force_output, const char *position, Surface_Data *sdata)
                        case 1: dl_png_set_IHDR(png, info, width, height, 8, PNG_COLOR_TYPE_GRAY, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT); break;
                }
 
-               black.red = 0x00;
-               black.green = 0x00;
-               black.blue = 0x00;
-               dl_png_set_bKGD(png, info, &black);
-
-               //dl_png_set_bgr(png);
-
                dl_png_write_info(png, info);
 
                dl_png_write_image(png, rows);
@@ -1296,34 +1275,64 @@ _dump_surface(int force_output, const char *position, Surface_Data *sdata)
 
 }
 
-
 void
-tracepath_surface_trace(int force_output, const char *position)
+tracepath_surface_trace_add(const char *desc, GLDisplay dpy, GLContext ctx, GLSurface surf, GLint fbo, GLint tex, GLint rb, GLint tex_w, GLint tex_h, GLint tex_format, const char *dump)
 {
-       GLThreadState *tstate = NULL;
-       MY_MODULE_TSTATE *tstate_tm = NULL;
-       int i;
+       Surface_Data *std = NULL;
 
-       if (trace_surface_flag != 1)
+       if (trace_surface_flag == 1)
        {
-               goto finish;
+               AST(mutex_lock(&std_access_mutex) == 1);
+
+               if (std_table == NULL)
+               {
+                       std_table = (Surface_Data **)calloc(1, sizeof(Surface_Data *) * MAX_TRACE_TABLE_SIZE);
+               }
+
+               std = (Surface_Data *)_get_trace_data((Trace_Data **)std_table, sizeof(Surface_Data), desc);
+
+               AST(std != NULL);
+
+               if (dump != NULL)
+               {
+                       _dump_surface(0, 0, dump, std);
+               }
+
+               std->display = dpy;
+               std->surface = surf;
+               std->context = ctx;
+               if (fbo >= 0) std->fbo = fbo;
+               std->tex = tex;
+               std->rb = rb;
+               if (tex_w >= 0) std->tex_w = tex_w;
+               if (tex_h >= 0) std->tex_h = tex_h;
+               if (tex_format >= 0) std->tex_format = tex_format;
+
+               AST(mutex_unlock(&std_access_mutex) == 1);
+
        }
 
-       tstate = get_current_thread_state();
+}
 
-       if (tstate == NULL)
-       {
-               init_new_thread_state();
+void
+tracepath_surface_trace(int force_output, int type, const char *position)
+{
+       int i;
 
-               tstate = get_current_thread_state();
-               AST(tstate != NULL);
+       if (trace_surface_flag != 1)
+       {
+               goto finish;
        }
 
-       GET_MY_TSTATE(tstate_tm, tstate);
-       if (tstate_tm == NULL) return;
+       AST(mutex_lock(&std_access_mutex) == 1);
 
        if (std_table != NULL)
        {
+               EGLDisplay olddpy = _orig_tracepath_eglGetCurrentDisplay();
+               EGLContext oldctx = _orig_tracepath_eglGetCurrentContext();
+               EGLSurface oldsurf_read = _orig_tracepath_eglGetCurrentSurface(EGL_READ);
+               EGLSurface oldsurf_draw = _orig_tracepath_eglGetCurrentSurface(EGL_DRAW);
+
                for (i = 0; i < MAX_TRACE_TABLE_SIZE; i++)
                {
                        if (std_table[i] != NULL)
@@ -1336,7 +1345,7 @@ tracepath_surface_trace(int force_output, const char *position)
                                        {
                                                if (_orig_tracepath_eglMakeCurrent(current->display, current->surface, current->surface, current->context) == EGL_TRUE)
                                                {
-                                                       _dump_surface(force_output, position, current);
+                                                       _dump_surface(force_output, type, position, current);
                                                }
                                        }
 
@@ -1344,11 +1353,12 @@ tracepath_surface_trace(int force_output, const char *position)
                                }
                        }
                }
-
-               _orig_tracepath_eglMakeCurrent(tstate_tm->ctx->dpy, tstate_tm->surf_draw, tstate_tm->surf_read, tstate_tm->ctx->handle);
+               _orig_tracepath_eglMakeCurrent(olddpy, oldsurf_read, oldsurf_draw, oldctx);
 
        }
 
+       AST(mutex_unlock(&std_access_mutex) == 1);
+
        goto finish;
 
        finish:
@@ -1359,6 +1369,6 @@ tracepath_surface_trace(int force_output, const char *position)
 COREGL_API void
 coregl_dump_surface()
 {
-       _COREGL_TRACE_SURFACE(1, "USER CALL");
+       _COREGL_TRACE_SURFACE(1, 0, "USER CALL");
 }
 
index a2be915..61b05d8 100644 (file)
 #endif
 \r
 #ifdef COREGL_TRACEPATH_TRACE_SURFACE_INFO\r
-# define _COREGL_TRACE_SURFACE(force_output, position) \\r
-   tracepath_surface_trace(force_output, position);\r
+# define _COREGL_TRACE_SURFACE(force_output, type, position) \\r
+   tracepath_surface_trace(force_output, type, position);\r
 #else
-# define _COREGL_TRACE_SURFACE(force_output, position)\r
+# define _COREGL_TRACE_SURFACE(force_output, type, position)\r
 #endif
 \r
 #define _COREGL_TRACEPATH_FUNC_BEGIN() \\r
@@ -137,8 +137,8 @@ extern void                tracepath_mem_trace_add(const char *desc, int alloc_s
 extern void                tracepath_mem_trace_remove(const char *desc, int alloc_size);\r
 extern void                tracepath_mem_trace_output(int force_output);\r
 \r
-extern void                tracepath_surface_trace_add(const char *desc, GLDisplay dpy, GLContext ctx, GLSurface surf, GLint fbo, GLint tex, GLint rb, GLint tex_w, GLint tex_h, GLint tex_format);\r
-extern void                tracepath_surface_trace(int force_output, const char *position);\r
+extern void                tracepath_surface_trace_add(const char *desc, GLDisplay dpy, GLContext ctx, GLSurface surf, GLint fbo, GLint tex, GLint rb, GLint tex_w, GLint tex_h, GLint tex_format, const char *dump);\r
+extern void                tracepath_surface_trace(int force_output, int type, const char *position);\r
 \r
 extern void                tracepath_glbuf_clear(Glbuf_Data **glbuf);\r
 \r
index 9d09df5..1bc186c 100644 (file)
@@ -455,7 +455,7 @@ finish:
    {
       char name[256];
       sprintf(name, "EGLSURFACE_%p", surface);
-      tracepath_surface_trace_add(name, 0, 0, 0, 0, 0, 0, 0, 0, 0);
+      tracepath_surface_trace_add(name, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL);
    }
 #endif // COREGL_TRACEPATH_TRACE_SURFACE_INFO
        return ret;
@@ -788,6 +788,9 @@ tracepath_eglWaitGL(void)
 
        _COREGL_TRACEPATH_FUNC_BEGIN();
        ret = _orig_tracepath_eglWaitGL();
+
+       _COREGL_TRACE_SURFACE(0, 1, "EGLWAITGL");
+
        goto finish;
 
 finish:
@@ -814,7 +817,7 @@ tracepath_eglSwapBuffers(EGLDisplay dpy, EGLSurface surface)
 {
        EGLBoolean ret = EGL_FALSE;
 
-       _COREGL_TRACE_SURFACE(0, "SWAPBUFFERS");
+       _COREGL_TRACE_SURFACE(0, 1, "SWAPBUFFERS");
 
        _COREGL_TRACEPATH_FUNC_BEGIN();
        ret = _orig_tracepath_eglSwapBuffers(dpy, surface);
index e030ba1..0b57645 100644 (file)
@@ -174,19 +174,19 @@ _surface_trace_set(int set, GLint fbname, GLenum attachment, MY_MODULE_TSTATE *t
                switch (atttype)
                {
                        case GL_TEXTURE:
-                               //COREGL_LOG("FBO DUMPING BEGIN = (TEX)%d\n", attname);
+                               //COREGL_LOG("FBO DUMPING BEGIN = (TEX)0x%X\n", attname);
                                {
                                        char name[256];
-                                       sprintf(name, "FBOTEX_%d", attname);
-                                       tracepath_surface_trace_add(name, tstate->ctx->dpy, tstate->ctx->handle, tstate->surf_draw, fbname, attname, 0, -1, -1, -1);
+                                       sprintf(name, "FBOTEX_0x%X", attname);
+                                       tracepath_surface_trace_add(name, tstate->ctx->dpy, tstate->ctx->handle, tstate->surf_draw, fbname, attname, 0, -1, -1, -1, NULL);
                                }
                                break;
                        case GL_RENDERBUFFER:
-                               //COREGL_LOG("FBO DUMPING BEGIN = (RB)%d\n", attname);
+                               //COREGL_LOG("FBO DUMPING BEGIN = (RB)0x%X\n", attname);
                                {
                                        char name[256];
-                                       sprintf(name, "FBORB_%d", attname);
-                                       tracepath_surface_trace_add(name, tstate->ctx->dpy, tstate->ctx->handle, tstate->surf_draw, fbname, 0, attname, -1, -1, -1);
+                                       sprintf(name, "FBORB_0x%X", attname);
+                                       tracepath_surface_trace_add(name, tstate->ctx->dpy, tstate->ctx->handle, tstate->surf_draw, fbname, 0, attname, -1, -1, -1, NULL);
                                }
                                break;
                }
@@ -196,19 +196,19 @@ _surface_trace_set(int set, GLint fbname, GLenum attachment, MY_MODULE_TSTATE *t
                switch (atttype)
                {
                        case GL_TEXTURE:
-                               //COREGL_LOG("FBO DUMPING END = (TEX)%d\n", attname);
+                               //COREGL_LOG("FBO DUMPING END = (TEX)0x%X\n", attname);
                                {
                                        char name[256];
-                                       sprintf(name, "FBOTEX_%d", attname);
-                                       tracepath_surface_trace_add(name, tstate->ctx->dpy, tstate->ctx->handle, tstate->surf_draw, 0, attname, 0, -1, -1, -1);
+                                       sprintf(name, "FBOTEX_0x%X", attname);
+                                       tracepath_surface_trace_add(name, tstate->ctx->dpy, tstate->ctx->handle, tstate->surf_draw, 0, attname, 0, -1, -1, -1, NULL);
                                }
                                break;
                        case GL_RENDERBUFFER:
-                               //COREGL_LOG("FBO DUMPING END = (RB)%d\n", attname);
+                               //COREGL_LOG("FBO DUMPING END = (RB)0x%X\n", attname);
                                {
                                        char name[256];
-                                       sprintf(name, "FBORB_%d", attname);
-                                       tracepath_surface_trace_add(name, tstate->ctx->dpy, tstate->ctx->handle, tstate->surf_draw, 0, 0, attname, -1, -1, -1);
+                                       sprintf(name, "FBORB_0x%X", attname);
+                                       tracepath_surface_trace_add(name, tstate->ctx->dpy, tstate->ctx->handle, tstate->surf_draw, 0, 0, attname, -1, -1, -1, NULL);
                                }
                                break;
                }
@@ -232,8 +232,8 @@ tracepath_fbdump_update(GLint set)
                        if (tstate->ctx != NULL)
                        {
                                _surface_trace_set(set, fbname, GL_COLOR_ATTACHMENT0, tstate);
-                               _surface_trace_set(set, fbname, GL_DEPTH_ATTACHMENT, tstate);
-                               _surface_trace_set(set, fbname, GL_STENCIL_ATTACHMENT, tstate);
+//                             _surface_trace_set(set, fbname, GL_DEPTH_ATTACHMENT, tstate);
+//                             _surface_trace_set(set, fbname, GL_STENCIL_ATTACHMENT, tstate);
                        }
                }
        }
@@ -295,6 +295,13 @@ tracepath_glBindFramebuffer(GLenum target, GLuint framebuffer)
        _COREGL_TRACEPATH_FUNC_BEGIN();
 
 #ifdef COREGL_TRACEPATH_TRACE_SURFACE_INFO
+       GLint oldfb;
+       _orig_tracepath_glGetIntegerv(GL_FRAMEBUFFER_BINDING, &oldfb);
+       if (oldfb != 0)
+       {
+               _COREGL_TRACE_SURFACE(0, 2, "GLBINDFBO");
+       }
+
        tracepath_fbdump_update(0);
 #endif // COREGL_TRACEPATH_TRACE_SURFACE_INFO
 
@@ -818,8 +825,13 @@ finish:
                if (fbname == 0)
                {
                        char name[256];
-                       sprintf(name, "EGLSURFACE_%p", _orig_tracepath_eglGetCurrentSurface(EGL_DRAW));
-                       tracepath_surface_trace_add(name, _orig_tracepath_eglGetCurrentDisplay(), _orig_tracepath_eglGetCurrentContext(), _orig_tracepath_eglGetCurrentSurface(EGL_DRAW), 0, 0, 0, 0, 0, 0);
+                       EGLint btype;
+                       _orig_tracepath_eglQuerySurface(_orig_tracepath_eglGetCurrentDisplay(), _orig_tracepath_eglGetCurrentSurface(EGL_DRAW), EGL_RENDER_BUFFER, &btype);
+                       if (btype == EGL_SINGLE_BUFFER)
+                               sprintf(name, "EGLPIXMAP_%p", _orig_tracepath_eglGetCurrentSurface(EGL_DRAW));
+                       else
+                               sprintf(name, "EGLWINDOW_%p", _orig_tracepath_eglGetCurrentSurface(EGL_DRAW));
+                       tracepath_surface_trace_add(name, _orig_tracepath_eglGetCurrentDisplay(), _orig_tracepath_eglGetCurrentContext(), _orig_tracepath_eglGetCurrentSurface(EGL_DRAW), 0, 0, 0, 0, 0, 0, NULL);
                }
    }
 #endif // COREGL_TRACEPATH_TRACE_SURFACE_INFO
@@ -844,8 +856,13 @@ finish:
                if (fbname == 0)
                {
                        char name[256];
-                       sprintf(name, "EGLSURFACE_%p", _orig_tracepath_eglGetCurrentSurface(EGL_DRAW));
-                       tracepath_surface_trace_add(name, _orig_tracepath_eglGetCurrentDisplay(), _orig_tracepath_eglGetCurrentContext(), _orig_tracepath_eglGetCurrentSurface(EGL_DRAW), 0, 0, 0, 0, 0, 0);
+                       EGLint btype;
+                       _orig_tracepath_eglQuerySurface(_orig_tracepath_eglGetCurrentDisplay(), _orig_tracepath_eglGetCurrentSurface(EGL_DRAW), EGL_RENDER_BUFFER, &btype);
+                       if (btype == EGL_SINGLE_BUFFER)
+                               sprintf(name, "EGLPIXMAP_%p", _orig_tracepath_eglGetCurrentSurface(EGL_DRAW));
+                       else
+                               sprintf(name, "EGLWINDOW_%p", _orig_tracepath_eglGetCurrentSurface(EGL_DRAW));
+                       tracepath_surface_trace_add(name, _orig_tracepath_eglGetCurrentDisplay(), _orig_tracepath_eglGetCurrentContext(), _orig_tracepath_eglGetCurrentSurface(EGL_DRAW), 0, 0, 0, 0, 0, 0, NULL);
                }
    }
 #endif // COREGL_TRACEPATH_TRACE_SURFACE_INFO
@@ -881,6 +898,8 @@ tracepath_glFinish(void)
        _COREGL_TRACEPATH_FUNC_BEGIN();
        _orig_tracepath_glFinish();
 
+       _COREGL_TRACE_SURFACE(0, 0, "GLFINISH");
+
        goto finish;
 
 finish:
@@ -895,6 +914,8 @@ tracepath_glFlush(void)
        _COREGL_TRACEPATH_FUNC_BEGIN();
        _orig_tracepath_glFlush();
 
+       _COREGL_TRACE_SURFACE(0, 0, "GLFLUSH");
+
        goto finish;
 
 finish:
@@ -1646,7 +1667,7 @@ finish:
 
                                char name[256];
                                sprintf(name, "FBORB_%d", objidx);
-                               tracepath_surface_trace_add(name, tstate->ctx->dpy, tstate->ctx->handle, tstate->surf_draw, -1, 0, objidx, width, height, channel);
+                               tracepath_surface_trace_add(name, tstate->ctx->dpy, tstate->ctx->handle, tstate->surf_draw, -1, 0, objidx, width, height, channel, NULL);
                        }
                }
        }
@@ -1856,8 +1877,8 @@ finish:
                                }
 
                                char name[256];
-                               sprintf(name, "FBOTEX_%d", objidx);
-                               tracepath_surface_trace_add(name, tstate->ctx->dpy, tstate->ctx->handle, tstate->surf_draw, -1, objidx, 0, width, height, channel);
+                               sprintf(name, "FBOTEX_0x%X", objidx);
+                               tracepath_surface_trace_add(name, tstate->ctx->dpy, tstate->ctx->handle, tstate->surf_draw, -1, objidx, 0, width, height, channel, NULL);
                        }
                }
        }
@@ -2828,8 +2849,8 @@ finish:
                                }
 
                                char name[256];
-                               sprintf(name, "FBORB_%d", objidx);
-                               tracepath_surface_trace_add(name, tstate->ctx->dpy, tstate->ctx->handle, tstate->surf_draw, -1, 0, objidx, width, height, channel);
+                               sprintf(name, "FBORB_0x%X", objidx);
+                               tracepath_surface_trace_add(name, tstate->ctx->dpy, tstate->ctx->handle, tstate->surf_draw, -1, 0, objidx, width, height, channel, NULL);
                        }
                }
        }