raster pushed a commit to branch master.

commit 1a81f0a8c205b89fd8d21e0e9033e6a04ae7cf4f
Author: Carsten Haitzler (Rasterman) <[email protected]>
Date:   Fri May 3 19:31:28 2013 +0900

    force scissor to always be on indicating partial gl update region so
    gpu can.. do more sensible things.
---
 .../evas/engines/gl_common/evas_gl_common.h        |   5 +
 .../evas/engines/gl_common/evas_gl_context.c       | 102 +++++++++++++++------
 src/modules/evas/engines/gl_x11/evas_engine.c      |   6 ++
 3 files changed, 83 insertions(+), 30 deletions(-)

diff --git a/src/modules/evas/engines/gl_common/evas_gl_common.h 
b/src/modules/evas/engines/gl_common/evas_gl_common.h
index 1bffda5..b3b8b24 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_common.h
+++ b/src/modules/evas/engines/gl_common/evas_gl_common.h
@@ -350,6 +350,11 @@ struct _Evas_Engine_GL_Context
          int             clip;
       } current;
    } state;
+   
+   struct {
+      int                x, y, w, h;
+      Eina_Bool          enabled : 1;
+   } master_clip;
 
    struct {
       struct {
diff --git a/src/modules/evas/engines/gl_common/evas_gl_context.c 
b/src/modules/evas/engines/gl_common/evas_gl_context.c
index f936bc3..2f73027 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_context.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_context.c
@@ -2571,7 +2571,7 @@ scissor_rot(Evas_Engine_GL_Context *gc EINA_UNUSED,
 static void
 shader_array_flush(Evas_Engine_GL_Context *gc)
 {
-   int i, gw, gh, setclip, cy, fbo = 0, done = 0;
+   int i, gw, gh, setclip, fbo = 0, done = 0;
 
    if (!gc->havestuff) return;
    gw = gc->w;
@@ -2719,47 +2719,89 @@ shader_array_flush(Evas_Engine_GL_Context *gc)
           }
         if (gc->pipe[i].shader.clip != gc->state.current.clip)
           {
-
-             if (gc->pipe[i].shader.clip)
+             int cx, cy, cw, ch;
+             
+             cx = gc->pipe[i].shader.cx;
+             cy = gc->pipe[i].shader.cy;
+             cw = gc->pipe[i].shader.cw;
+             ch = gc->pipe[i].shader.ch;
+             if ((gc->master_clip.enabled) && (!fbo))
+               {
+                  if (gc->pipe[i].shader.clip)
+                    {
+                       RECTS_CLIP_TO_RECT(cx, cy, cw, ch,
+                                          gc->master_clip.x, gc->master_clip.y,
+                                          gc->master_clip.w, 
gc->master_clip.h);
+                    }
+                  else
+                    {
+                       cx = gc->master_clip.x;
+                       cy = gc->master_clip.y;
+                       cw = gc->master_clip.w;
+                       ch = gc->master_clip.h;
+                    }
+               }
+             if ((gc->pipe[i].shader.clip) || (gc->master_clip.enabled))
                {
-                  cy = gh - gc->pipe[i].shader.cy - gc->pipe[i].shader.ch;
-                  if (fbo) cy = gc->pipe[i].shader.cy;
                   glEnable(GL_SCISSOR_TEST);
                   if (!fbo)
-                     scissor_rot(gc, gc->rot, gw, gh,
-                                 gc->pipe[i].shader.cx,
-                                 cy,
-                                 gc->pipe[i].shader.cw,
-                                 gc->pipe[i].shader.ch);
+                     scissor_rot(gc, gc->rot, gw, gh, cx, gh - cy - ch, cw, 
ch);
                   else
-                     glScissor(gc->pipe[i].shader.cx, cy,
-                               gc->pipe[i].shader.cw, gc->pipe[i].shader.ch);
+                     glScissor(cx, cy, cw, ch);
                   setclip = 1;
+                  gc->state.current.cx = cx;
+                  gc->state.current.cy = cy;
+                  gc->state.current.cw = cw;
+                  gc->state.current.ch = ch;
                }
              else
                {
                   glDisable(GL_SCISSOR_TEST);
                   glScissor(0, 0, 0, 0);
+                  gc->state.current.cx = 0;
+                  gc->state.current.cy = 0;
+                  gc->state.current.cw = 0;
+                  gc->state.current.ch = 0;
                }
           }
-        if ((gc->pipe[i].shader.clip) && (!setclip))
+        if (((gc->pipe[i].shader.clip) && (!setclip)) ||
+            (gc->master_clip.enabled))
           {
-             if ((gc->pipe[i].shader.cx != gc->state.current.cx) ||
-                 (gc->pipe[i].shader.cy != gc->state.current.cy) ||
-                 (gc->pipe[i].shader.cw != gc->state.current.cw) ||
-                 (gc->pipe[i].shader.ch != gc->state.current.ch))
+             int cx, cy, cw, ch;
+             
+             cx = gc->pipe[i].shader.cx;
+             cy = gc->pipe[i].shader.cy;
+             cw = gc->pipe[i].shader.cw;
+             ch = gc->pipe[i].shader.ch;
+             if ((gc->master_clip.enabled) && (!fbo))
+               {
+                  if (gc->pipe[i].shader.clip)
+                    {
+                       RECTS_CLIP_TO_RECT(cx, cy, cw, ch,
+                                          gc->master_clip.x, gc->master_clip.y,
+                                          gc->master_clip.w, 
gc->master_clip.h);
+                    }
+                  else
+                    {
+                       cx = gc->master_clip.x;
+                       cy = gc->master_clip.y;
+                       cw = gc->master_clip.w;
+                       ch = gc->master_clip.h;
+                    }
+               }
+             if ((cx != gc->state.current.cx) ||
+                 (cy != gc->state.current.cy) ||
+                 (cw != gc->state.current.cw) ||
+                 (ch != gc->state.current.ch))
                {
-                  cy = gh - gc->pipe[i].shader.cy - gc->pipe[i].shader.ch;
-                  if (fbo) cy = gc->pipe[i].shader.cy;
                   if (!fbo)
-                     scissor_rot(gc, gc->rot, gw, gh,
-                                 gc->pipe[i].shader.cx,
-                                 cy,
-                                 gc->pipe[i].shader.cw,
-                                 gc->pipe[i].shader.ch);
+                     scissor_rot(gc, gc->rot, gw, gh, cx, gh - cy - ch, cw, 
ch);
                   else
-                     glScissor(gc->pipe[i].shader.cx, cy,
-                               gc->pipe[i].shader.cw, gc->pipe[i].shader.ch);
+                     glScissor(cx, cy, cw, ch);
+                  gc->state.current.cx = cx;
+                  gc->state.current.cy = cy;
+                  gc->state.current.cw = cw;
+                  gc->state.current.ch = ch;
                }
           }
 
@@ -2976,10 +3018,10 @@ shader_array_flush(Evas_Engine_GL_Context *gc)
         gc->state.current.cur_prog  = gc->pipe[i].shader.cur_prog;
         gc->state.current.cur_tex   = gc->pipe[i].shader.cur_tex;
         gc->state.current.render_op = gc->pipe[i].shader.render_op;
-        gc->state.current.cx        = gc->pipe[i].shader.cx;
-        gc->state.current.cy        = gc->pipe[i].shader.cy;
-        gc->state.current.cw        = gc->pipe[i].shader.cw;
-        gc->state.current.ch        = gc->pipe[i].shader.ch;
+//        gc->state.current.cx        = gc->pipe[i].shader.cx;
+//        gc->state.current.cy        = gc->pipe[i].shader.cy;
+//        gc->state.current.cw        = gc->pipe[i].shader.cw;
+//        gc->state.current.ch        = gc->pipe[i].shader.ch;
         gc->state.current.smooth    = gc->pipe[i].shader.smooth;
         gc->state.current.blend     = gc->pipe[i].shader.blend;
         gc->state.current.clip      = gc->pipe[i].shader.clip;
diff --git a/src/modules/evas/engines/gl_x11/evas_engine.c 
b/src/modules/evas/engines/gl_x11/evas_engine.c
index 1785fa5..75da4b9 100644
--- a/src/modules/evas/engines/gl_x11/evas_engine.c
+++ b/src/modules/evas/engines/gl_x11/evas_engine.c
@@ -1314,6 +1314,11 @@ eng_output_redraws_next_update_get(void *data, int *x, 
int *y, int *w, int *h, i
              *cw = rect->w;
              *ch = rect->h;
              re->cur_rect = re->cur_rect->next;
+             re->win->gl_context->master_clip.enabled = EINA_TRUE;
+             re->win->gl_context->master_clip.x = rect->x;
+             re->win->gl_context->master_clip.y = rect->y;
+             re->win->gl_context->master_clip.w = rect->w;
+             re->win->gl_context->master_clip.h = rect->h;
              break;
            case MODE_FULL:
              re->cur_rect = NULL;
@@ -1325,6 +1330,7 @@ eng_output_redraws_next_update_get(void *data, int *x, 
int *y, int *w, int *h, i
              if (cy) *cy = 0;
              if (cw) *cw = re->win->w;
              if (ch) *ch = re->win->h;
+             re->win->gl_context->master_clip.enabled = EINA_FALSE;
              break;
            default:
              break;

-- 

------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite
It's a free troubleshooting tool designed for production
Get down to code-level detail for bottlenecks, with <2% overhead.
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap2

Reply via email to