Enlightenment CVS committal

Author  : doursse
Project : e17
Module  : libs/evas

Dir     : e17/libs/evas/src/modules/engines/software_xcb


Modified Files:
        Evas_Engine_Software_Xcb.h evas_engine.c evas_engine.h 
        evas_outbuf.c evas_xcb_buffer.c 


Log Message:
update software xcb engine to use the latest cache system

===================================================================
RCS file: 
/cvs/e/e17/libs/evas/src/modules/engines/software_xcb/Evas_Engine_Software_Xcb.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -3 -r1.7 -r1.8
--- Evas_Engine_Software_Xcb.h  9 Mar 2008 13:21:15 -0000       1.7
+++ Evas_Engine_Software_Xcb.h  7 Jul 2008 19:22:20 -0000       1.8
@@ -32,9 +32,9 @@
    } info;
    /* engine specific function calls to query stuff about the destination */
    struct {
-      xcb_visualtype_t * (*best_visual_get)   (xcb_connection_t *conn, int 
screen);
-      xcb_colormap_t     (*best_colormap_get) (xcb_connection_t *conn, int 
screen);
-      int                (*best_depth_get)    (xcb_connection_t *conn, int 
screen);
+      xcb_visualtype_t * (*best_visual_get)   (xcb_screen_t *screen);
+      xcb_colormap_t     (*best_colormap_get) (xcb_screen_t *screen);
+      int                (*best_depth_get)    (xcb_screen_t *screen);
    } func;
 
    int mask_changed;
===================================================================
RCS file: /cvs/e/e17/libs/evas/src/modules/engines/software_xcb/evas_engine.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -3 -r1.19 -r1.20
--- evas_engine.c       9 Mar 2008 13:21:15 -0000       1.19
+++ evas_engine.c       7 Jul 2008 19:22:20 -0000       1.20
@@ -21,9 +21,9 @@
 
 /* prototypes we will use here */
 static void *_output_setup(int w, int h, int rot, xcb_connection_t *conn, 
xcb_screen_t     *screen, xcb_drawable_t draw, xcb_visualtype_t *vis, 
xcb_colormap_t cmap, int depth, int debug, int grayscale, int max_colors, 
xcb_drawable_t mask, int shape_dither, int destination_alpha);
-static xcb_visualtype_t *_best_visual_get(xcb_connection_t *conn, int screen);
-static xcb_colormap_t _best_colormap_get(xcb_connection_t *conn, int screen);
-static int _best_depth_get(xcb_connection_t *conn, int screen);
+static xcb_visualtype_t *_best_visual_get(xcb_screen_t *screen);
+static xcb_colormap_t _best_colormap_get(xcb_screen_t *screen);
+static int _best_depth_get(xcb_screen_t *screen);
 
 static void *eng_info(Evas *e);
 static void eng_info_free(Evas *e, void *info);
@@ -120,32 +120,21 @@
 }
 
 static xcb_visualtype_t *
-_best_visual_get(xcb_connection_t *conn, int screen)
+_best_visual_get(xcb_screen_t *screen)
 {
-   xcb_screen_iterator_t iter_screen;
    xcb_depth_iterator_t  iter_depth;
-   xcb_screen_t         *scr = NULL;
 
-   if (!conn) return NULL;
+   if (!screen) return NULL;
 
-   iter_screen = xcb_setup_roots_iterator (xcb_get_setup (conn));
-   for (; iter_screen.rem; --screen, xcb_screen_next (&iter_screen))
-      if (screen == 0)
-        {
-           scr = iter_screen.data;
-           break;
-        }
-   if (!scr) return NULL;
-
-   iter_depth = xcb_screen_allowed_depths_iterator(scr);
+   iter_depth = xcb_screen_allowed_depths_iterator(screen);
    for (; iter_depth.rem; xcb_depth_next (&iter_depth))
      {
         xcb_visualtype_iterator_t iter_vis;
 
         iter_vis = xcb_depth_visuals_iterator(iter_depth.data);
-        for (; iter_vis.rem; --screen, xcb_visualtype_next (&iter_vis))
+        for (; iter_vis.rem; xcb_visualtype_next (&iter_vis))
           {
-            if (scr->root_visual == iter_vis.data->visual_id)
+            if (screen->root_visual == iter_vis.data->visual_id)
               return iter_vis.data;
           }
      }
@@ -154,34 +143,21 @@
 }
 
 static xcb_colormap_t
-_best_colormap_get(xcb_connection_t *conn, int screen)
+_best_colormap_get(xcb_screen_t *screen)
 {
-   xcb_screen_iterator_t iter;
-   xcb_colormap_t        c = { 0 };
-
-   if (!conn) return c;
-
-   iter = xcb_setup_roots_iterator (xcb_get_setup (conn));
-   for (; iter.rem; --screen, xcb_screen_next (&iter))
-      if (screen == 0)
-         return iter.data->default_colormap;
+   if (!screen)
+     return 0;
 
-   return c;
+   return screen->default_colormap;
 }
 
 static int
-_best_depth_get(xcb_connection_t *conn, int screen)
+_best_depth_get(xcb_screen_t *screen)
 {
-   xcb_screen_iterator_t iter;
-
-   if (!conn) return 0;
-
-   iter = xcb_setup_roots_iterator (xcb_get_setup (conn));
-   for (; iter.rem; --screen, xcb_screen_next (&iter))
-      if (screen == 0)
-         return iter.data->root_depth;
+   if (!screen)
+     return 0;
 
-   return 0;
+   return screen->root_depth;
 }
 
 /* engine api this module provides */
===================================================================
RCS file: /cvs/e/e17/libs/evas/src/modules/engines/software_xcb/evas_engine.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -3 -r1.9 -r1.10
--- evas_engine.h       9 Mar 2008 13:21:15 -0000       1.9
+++ evas_engine.h       7 Jul 2008 19:22:20 -0000       1.10
@@ -64,14 +64,18 @@
       unsigned char mask_dither       : 1;
       unsigned char destination_alpha : 1;
       unsigned char debug             : 1;
-      unsigned char synced : 1;
+      unsigned char synced            : 1;
    } priv;
 };
 
 struct _Outbuf_Region
 {
-   Xcb_Output_Buffer *xcbob, *mxcbob;
-   int x, y, w, h;
+   Xcb_Output_Buffer *xcbob;
+   Xcb_Output_Buffer *mxcbob;
+   int                x;
+   int                y;
+   int                w;
+   int                h;
 };
 
 struct _Xcb_Output_Buffer
===================================================================
RCS file: /cvs/e/e17/libs/evas/src/modules/engines/software_xcb/evas_outbuf.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -3 -r1.21 -r1.22
--- evas_outbuf.c       3 Jun 2008 09:09:38 -0000       1.21
+++ evas_outbuf.c       7 Jul 2008 19:22:20 -0000       1.22
@@ -3,7 +3,6 @@
 #include "evas_macros.h"
 #include <xcb/shm.h>
 #include <xcb/xcb_image.h>
-#include <xcb/xcb_atom.h>
 #include <pixman.h>
 #include <sys/time.h>
 #include <sys/utsname.h>
@@ -134,7 +133,7 @@
        im = buf->priv.pending_writes->data;
        buf->priv.pending_writes = 
evas_list_remove_list(buf->priv.pending_writes, buf->priv.pending_writes);
        obr = im->extended_info;
-       evas_cache_image_drop(im);
+       evas_cache_image_drop(&im->cache_entry);
        if (obr->xcbob) _unfind_xcbob(obr->xcbob, 0);
        if (obr->mxcbob) _unfind_xcbob(obr->mxcbob, 0);
        free(obr);
@@ -378,6 +377,7 @@
    Outbuf_Region *obr;
    int            bpl = 0;
    int            use_shm = 1;
+   int                 alpha;
 
    if ((buf->onebuf) && (buf->priv.x.shm))
      {
@@ -409,7 +409,7 @@
                  im = buf->priv.onebuf;
                  for (yy = y; yy < (y + h); yy++)
                    {
-                      memset(im->image->data + (im->image->w * yy) + x,
+                      memset(im->image.data + (im->cache_entry.w * yy) + x,
                              0, w * sizeof(DATA32));
                    }
               }
@@ -425,24 +425,24 @@
        *cw = w;
        *ch = h;
 
+        alpha = ((buf->priv.x.mask) || (buf->priv.destination_alpha));
+
        use_shm = buf->priv.x.shm;
        if ((buf->rot == 0) &&
            (buf->priv.mask.r == 0xff0000) &&
            (buf->priv.mask.g == 0x00ff00) &&
            (buf->priv.mask.b == 0x0000ff))
          {
-            im = evas_cache_image_empty(evas_common_image_cache_get());
-            im->image->w = buf->w;
-            im->image->h = buf->h;
-            im->image->data = NULL;
-            im->image->no_free = 1;
-            im->extended_info = obr;
             obr->xcbob = 
evas_software_xcb_x_output_buffer_new(buf->priv.x.conn,
                                                                 
buf->priv.x.depth,
                                                                 buf->w, buf->h,
                                                                 use_shm,
                                                                 NULL);
-            im->image->data = (DATA32 *) 
evas_software_xcb_x_output_buffer_data(obr->xcbob, &bpl);
+             im = (RGBA_Image *) 
evas_cache_image_data(evas_common_image_cache_get(),
+                                                       buf->w, buf->h,
+                                                       (DATA32 *) 
evas_software_xcb_x_output_buffer_data(obr->xcbob, &bpl),
+                                                       alpha, 
EVAS_COLORSPACE_ARGB8888);
+            im->extended_info = obr;
             if (buf->priv.x.mask)
               obr->mxcbob = 
evas_software_xcb_x_output_buffer_new(buf->priv.x.conn,
                                                                    1,
@@ -452,10 +452,9 @@
          }
        else
          {
-            im = evas_cache_image_empty(evas_common_image_cache_get());
-            im->image->w = buf->w;
-            im->image->h = buf->h;
-            evas_common_image_surface_alloc(im->image);
+            im = (RGBA_Image *) 
evas_cache_image_empty(evas_common_image_cache_get());
+             im->cache_entry.flags.alpha |= alpha ? 1 : 0;
+             evas_cache_image_surface_alloc(&im->cache_entry, buf->w, buf->h);
             im->extended_info = obr;
             if ((buf->rot == 0) || (buf->rot == 180))
               obr->xcbob = 
evas_software_xcb_x_output_buffer_new(buf->priv.x.conn,
@@ -475,12 +474,10 @@
                                                                    use_shm,
                                                                    NULL);
          }
-       if ((buf->priv.x.mask) || (buf->priv.destination_alpha))
-         {
-            im->cache_entry.flags.alpha = 1;
-            /* FIXME: faster memset! */
-            memset(im->image->data, 0, w * h * sizeof(DATA32));
-         }
+       if (alpha)
+          /* FIXME: faster memset! */
+          memset(im->image.data, 0, w * h * sizeof(DATA32));
+
        buf->priv.onebuf = im;
        return im;
      }
@@ -503,24 +500,23 @@
 //   use_shm = 0; /* 630 -> 1006 fps */
 //   if ((w * h) < (200 * 200)) use_shm = 0; /* 630 -> 962 fps */
 
+   alpha = ((buf->priv.x.mask) || (buf->priv.destination_alpha));
+
    if ((buf->rot == 0) &&
        (buf->priv.mask.r == 0xff0000) &&
        (buf->priv.mask.g == 0x00ff00) &&
        (buf->priv.mask.b == 0x0000ff))
      {
-       im = (RGBA_Image *) 
evas_cache_image_empty(evas_common_image_cache_get());
-        if (!im) return NULL;
-        im = (RGBA_Image *) evas_cache_image_size_set(&im->cache_entry, w, h);
-        if (!im) return NULL;
-
-       im->extended_info = obr;
        obr->xcbob = _find_xcbob(buf->priv.x.conn,
                                  buf->priv.x.depth,
                                  w, h,
                                  use_shm,
                                  NULL);
-        im->image.no_free = 1;
-       im->image.data = (DATA32 
*)evas_software_xcb_x_output_buffer_data(obr->xcbob, &bpl);
+        im = (RGBA_Image *) 
evas_cache_image_data(evas_common_image_cache_get(),
+                                                  w, h,
+                                                  (DATA32 *) 
evas_software_xcb_x_output_buffer_data(obr->xcbob, &bpl),
+                                                  alpha, 
EVAS_COLORSPACE_ARGB8888);
+       im->extended_info = obr;
        if (buf->priv.x.mask)
          obr->mxcbob = _find_xcbob(buf->priv.x.conn,
                                     1, w, h,
@@ -535,8 +531,8 @@
      }
    else
      {
-        im = evas_cache_image_empty(evas_common_image_cache_get());
-        if (!im) return NULL;
+        im = (RGBA_Image *) 
evas_cache_image_empty(evas_common_image_cache_get());
+        im->cache_entry.flags.alpha |= alpha ? 1 : 0;
         evas_cache_image_surface_alloc(&im->cache_entry, w, h);
        im->extended_info = obr;
        if ((buf->rot == 0) || (buf->rot == 180))
@@ -576,11 +572,9 @@
 /*                                                           NULL); */
      }
    if ((buf->priv.x.mask) || (buf->priv.destination_alpha))
-     {
-       im->cache_entry.flags.alpha = 1;
        /* FIXME: faster memset! */
-       memset(im->image.data, 0, w * h * sizeof(DATA32));
-     }
+     memset(im->image.data, 0, w * h * sizeof(DATA32));
+
    buf->priv.pending_writes = evas_list_append(buf->priv.pending_writes, im);
    return im;
 }
@@ -680,7 +674,7 @@
              buf->priv.pending_writes = 
evas_list_remove_list(buf->priv.pending_writes,
                                                               
buf->priv.pending_writes);
              obr = im->extended_info;
-             evas_cache_image_drop(im);
+            evas_cache_image_drop(&im->cache_entry);
             if (obr->xcbob) _unfind_xcbob(obr->xcbob, 0);
             if (obr->mxcbob) _unfind_xcbob(obr->mxcbob, 0);
 /*              if (obr->xcbob) 
evas_software_xcb_x_output_buffer_free(obr->xcbob, 0); */
@@ -703,11 +697,11 @@
             if (buf->priv.debug)
               evas_software_x11_outbuf_debug_show(buf, buf->priv.x.win,
                                                   obr->x, obr->y, obr->w, 
obr->h);
-            evas_software_x11_x_output_buffer_paste(obr->xob, buf->priv.x.win,
+            evas_software_x11_x_output_buffer_paste(obr->xcbob, 
buf->priv.x.win,
                                                     buf->priv.x.gc,
                                                     obr->x, obr->y, 0);
-            if (obr->mxob)
-              evas_software_x11_x_output_buffer_paste(obr->mxob,
+            if (obr->mxcbob)
+              evas_software_x11_x_output_buffer_paste(obr->mxcbob,
                                                       buf->priv.x.mask,
                                                       buf->priv.x.gcm,
                                                       obr->x, obr->y, 0);
@@ -721,17 +715,18 @@
             RGBA_Image *im;
             Outbuf_Region *obr;
 
-            im = buf->priv.pending_writes->data;
+            im = evas_list_data(buf->priv.pending_writes);
             buf->priv.pending_writes = 
evas_list_remove_list(buf->priv.pending_writes, buf->priv.pending_writes);
             obr = im->extended_info;
-            evas_cache_image_drop(im);
-            if (obr->xob) _unfind_xob(obr->xob, 0);
-            if (obr->mxob) _unfind_xob(obr->mxob, 0);
+            evas_cache_image_drop(&im->cache_entry);
+            if (obr->xcbob) _unfind_xcbob(obr->xcbob, 0);
+            if (obr->mxcbob) _unfind_xcbob(obr->mxcbob, 0);
 /*
-            if (obr->xob) evas_software_x11_x_output_buffer_free(obr->xob, 0);
-            if (obr->mxob) evas_software_x11_x_output_buffer_free(obr->mxob, 
0);
+            if (obr->xcbob) evas_software_x11_x_output_buffer_free(obr->xcbob, 
0);
+            if (obr->mxcbob) 
evas_software_x11_x_output_buffer_free(obr->mxcbob, 0);
  */
             free(obr);
+            evas_cache_image_drop(&im->cache_entry);
          }
 #endif
      }
@@ -749,10 +744,10 @@
        im = buf->priv.onebuf;
        buf->priv.onebuf = NULL;
        obr = im->extended_info;
-       evas_cache_image_drop(im);
        if (obr->xcbob) evas_software_xcb_x_output_buffer_free(obr->xcbob, 0);
        if (obr->mxcbob) evas_software_xcb_x_output_buffer_free(obr->mxcbob, 0);
        free(obr);
+       evas_cache_image_drop(&im->cache_entry);
      }
    else
      {
@@ -768,7 +763,7 @@
               evas_list_remove_list(buf->priv.prev_pending_writes,
                                     buf->priv.prev_pending_writes);
             obr = im->extended_info;
-            evas_cache_image_drop(im);
+            evas_cache_image_drop(&im->cache_entry);
             if (obr->xcbob) _unfind_xcbob(obr->xcbob, 0);
             if (obr->mxcbob) _unfind_xcbob(obr->mxcbob, 0);
             free(obr);
@@ -893,8 +888,9 @@
      {
        for (yy = 0; yy < obr->h; yy++)
          evas_software_xcb_x_write_mask_line(buf, obr->mxcbob,
-                                             src_data +
-                                             (yy * obr->w), obr->w, yy);
+                                             src_data + (yy * obr->w),
+                                              obr->w,
+                                              yy);
 #if 1
 #else
        /* XX async push */
@@ -907,7 +903,7 @@
      }
 #if 1
 #else
-   xcb_flush(buf->priv.x.disp);
+   xcb_flush(buf->priv.x.conn);
 #endif
 }
 
===================================================================
RCS file: 
/cvs/e/e17/libs/evas/src/modules/engines/software_xcb/evas_xcb_buffer.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -3 -r1.13 -r1.14
--- evas_xcb_buffer.c   9 Mar 2008 13:21:16 -0000       1.13
+++ evas_xcb_buffer.c   7 Jul 2008 19:22:20 -0000       1.14
@@ -121,6 +121,10 @@
    xcbob->connection = c;
    xcbob->image      = NULL;
    xcbob->shm_info   = NULL;
+   xcbob->w = w;
+   xcbob->h = h;
+
+   try_shm = 0;
 
    if (try_shm > 0)
      {
@@ -149,14 +153,14 @@
                            /* XErrorHandler ph; */
                            /* EventHandlers eh; */
 
-                           //                           
free(xcb_get_input_focus_reply(c, xcb_get_input_focus(c), NULL));
+                           //                           
free(xcb_get_input_focus_reply(c, xcb_get_input_focus_unchecked(c), NULL));
                            _xcb_err = 0;
                            /* ph = XSetErrorHandler((XErrorHandler) */
                            /* x_output_tmp_x_err); */
                            xcb_shm_attach(c,
                                           xcbob->shm_info->shmseg,
                                           xcbob->shm_info->shmid, 0);
-                           //                           
free(xcb_get_input_focus_reply(c, xcb_get_input_focus(c), NULL));
+                           //                           
free(xcb_get_input_focus_reply(c, xcb_get_input_focus_unchecked(c), NULL));
                            /* XSetErrorHandler((XErrorHandler)ph); */
                            if (!_xcb_err)
                              {
@@ -179,7 +183,7 @@
    if (try_shm > 1) return NULL;
 
    xcbob->image = xcb_image_create_native(c, w, h, XCB_IMAGE_FORMAT_Z_PIXMAP,
-                                          depth, NULL, 0, data);
+                                          depth, NULL, ~0, NULL);
    if (!xcbob->image)
      {
        free(xcbob);
@@ -198,6 +202,10 @@
             return NULL;
          }
      }
+
+   xcbob->bpl = xcbob->image->stride;
+   xcbob->psize = xcbob->image->size;
+
    return xcbob;
 }
 
@@ -209,7 +217,7 @@
      {
        if (sync)
           free(xcb_get_input_focus_reply(xcbob->connection,
-                                         
xcb_get_input_focus(xcbob->connection),
+                                         
xcb_get_input_focus_unchecked(xcbob->connection),
                                          NULL));
        xcb_shm_detach(xcbob->connection, xcbob->shm_info->shmseg);
        xcb_image_destroy(xcbob->image);
@@ -243,7 +251,7 @@
                           0);
        if (sync)
           free(xcb_get_input_focus_reply(xcbob->connection,
-                                         
xcb_get_input_focus(xcbob->connection),
+                                         
xcb_get_input_focus_unchecked(xcbob->connection),
                                          NULL));
      }
    else



-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to