Evas: Support cserve2 for xcb engine.
authordevilhorns <devilhorns@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Fri, 29 Jun 2012 12:01:34 +0000 (12:01 +0000)
committerdevilhorns <devilhorns@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Fri, 29 Jun 2012 12:01:34 +0000 (12:01 +0000)
git-svn-id: http://svn.enlightenment.org/svn/e/trunk/evas@73033 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/modules/engines/software_x11/Makefile.am
src/modules/engines/software_x11/evas_xcb_outbuf.c

index 1d5d17b..7c15a27 100644 (file)
@@ -35,6 +35,7 @@ AM_CPPFLAGS = \
 -I. \
 -I$(top_srcdir)/src/lib \
 -I$(top_srcdir)/src/lib/include \
+-I$(top_srcdir)/src/lib/cserve2 \
 -I$(top_srcdir)/src/modules/engines \
 @FREETYPE_CFLAGS@ \
 @PIXMAN_CFLAGS@ \
index b02df10..73dd245 100644 (file)
@@ -1,9 +1,17 @@
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <pixman.h>
+
+#ifdef EVAS_CSERVE2
+# include "evas_cs2_private.h"
+#endif
 #include "evas_common.h"
 #include "evas_macros.h"
 #include "evas_xcb_outbuf.h"
 #include "evas_xcb_buffer.h"
 #include "evas_xcb_color.h"
-#include <pixman.h>
 
 /* local structures */
 typedef struct _Outbuf_Region Outbuf_Region;
@@ -46,7 +54,13 @@ evas_software_xcb_outbuf_free(Outbuf *buf)
           eina_list_remove_list(buf->priv.pending_writes, 
                                 buf->priv.pending_writes);
         obr = im->extended_info;
-        evas_cache_image_drop(&im->cache_entry);
+#ifdef EVAS_CSERVE2
+        if (evas_cserve2_use_get())
+          evas_cache2_image_close(&im->cache_entry);
+        else
+#endif
+          evas_cache_image_drop(&im->cache_entry);
+
         if (obr->xcbob) _unfind_xcbob(obr->xcbob, EINA_FALSE);
         if (obr->mask) _unfind_xcbob(obr->mask, EINA_FALSE);
         free(obr);
@@ -281,11 +295,25 @@ evas_software_xcb_outbuf_new_region_for_update(Outbuf *buf, int x, int y, int w,
                   free(obr);
                   return NULL;
                }
-             im = 
-               (RGBA_Image *)evas_cache_image_data(evas_common_image_cache_get(), 
-                                                   buf->w, buf->h, 
-                                                   (DATA32 *)evas_software_xcb_output_buffer_data(obr->xcbob, &bpl), 
-                                                   alpha, EVAS_COLORSPACE_ARGB8888);
+#ifdef EVAS_CSERVE2
+             if (evas_cserve2_use_get())
+               {
+                  im = 
+                    (RGBA_Image *)evas_cache2_image_data(evas_common_image_cache2_get(), 
+                                                         buf->w, buf->h, 
+                                                         (DATA32 *)evas_software_xcb_output_buffer_data(obr->xcbob, &bpl), 
+                                                         alpha, EVAS_COLORSPACE_ARGB8888);
+               }
+             else
+#endif
+               {
+                  im = 
+                    (RGBA_Image *)evas_cache_image_data(evas_common_image_cache_get(), 
+                                                        buf->w, buf->h, 
+                                                        (DATA32 *)evas_software_xcb_output_buffer_data(obr->xcbob, &bpl), 
+                                                        alpha, EVAS_COLORSPACE_ARGB8888);
+               }
+
              if (!im) 
                {
                   evas_software_xcb_output_buffer_free(obr->xcbob, EINA_FALSE);
@@ -306,15 +334,32 @@ evas_software_xcb_outbuf_new_region_for_update(Outbuf *buf, int x, int y, int w,
           {
              int bw = 0, bh = 0;
 
-             im = 
-               (RGBA_Image *)evas_cache_image_empty(evas_common_image_cache_get());
+#ifdef EVAS_CSERVE2
+             if (evas_cserve2_use_get())
+               {
+                  im = 
+                    (RGBA_Image *)evas_cache2_image_empty(evas_common_image_cache2_get());
+               }
+             else
+#endif
+               {
+                  im = 
+                    (RGBA_Image *)evas_cache_image_empty(evas_common_image_cache_get());
+               }
+
              if (!im) 
                {
                   free(obr);
                   return NULL;
                }
              im->cache_entry.flags.alpha |= (alpha ? 1 : 0);
-             evas_cache_image_surface_alloc(&im->cache_entry, buf->w, buf->h);
+#ifdef EVAS_CSERVE2
+             if (evas_cserve2_use_get())
+               evas_cache2_image_surface_alloc(&im->cache_entry, buf->w, buf->h);
+             else
+#endif
+               evas_cache_image_surface_alloc(&im->cache_entry, buf->w, buf->h);
+
              im->extended_info = obr;
              if ((buf->rot == 0) || (buf->rot == 180)) 
                {
@@ -333,7 +378,13 @@ evas_software_xcb_outbuf_new_region_for_update(Outbuf *buf, int x, int y, int w,
                                                    bw, bh, use_shm, NULL);
              if (!obr->xcbob) 
                {
-                  evas_cache_image_drop(&im->cache_entry);
+#ifdef EVAS_CSERVE2
+                  if (evas_cserve2_use_get())
+                    evas_cache2_image_close(&im->cache_entry);
+                  else
+#endif
+                    evas_cache_image_drop(&im->cache_entry);
+
                   free(obr);
                   return NULL;
                }
@@ -381,11 +432,25 @@ evas_software_xcb_outbuf_new_region_for_update(Outbuf *buf, int x, int y, int w,
              free(obr);
              return NULL;
           }
-        im = 
-          (RGBA_Image *)evas_cache_image_data(evas_common_image_cache_get(), 
-                                              w, h, 
-                                              (DATA32 *)evas_software_xcb_output_buffer_data(obr->xcbob, &bpl), 
-                                              alpha, EVAS_COLORSPACE_ARGB8888);
+#ifdef EVAS_CSERVE2
+        if (evas_cserve2_use_get())
+          {
+             im = 
+               (RGBA_Image *)evas_cache2_image_data(evas_common_image_cache2_get(), 
+                                                   w, h, 
+                                                   (DATA32 *)evas_software_xcb_output_buffer_data(obr->xcbob, &bpl), 
+                                                   alpha, EVAS_COLORSPACE_ARGB8888);
+          }
+        else
+#endif
+          {
+             im = 
+               (RGBA_Image *)evas_cache_image_data(evas_common_image_cache_get(), 
+                                                   w, h, 
+                                                   (DATA32 *)evas_software_xcb_output_buffer_data(obr->xcbob, &bpl), 
+                                                   alpha, EVAS_COLORSPACE_ARGB8888);
+          }
+
         if (!im) 
           {
              _unfind_xcbob(obr->xcbob, EINA_FALSE);
@@ -404,15 +469,32 @@ evas_software_xcb_outbuf_new_region_for_update(Outbuf *buf, int x, int y, int w,
      {
         int bw = 0, bh = 0;
 
-        im = 
-          (RGBA_Image *)evas_cache_image_empty(evas_common_image_cache_get());
+#ifdef EVAS_CSERVE2
+        if (evas_cserve2_use_get())
+          {
+             im = 
+               (RGBA_Image *)evas_cache2_image_empty(evas_common_image_cache2_get());
+          }
+        else
+#endif
+          {
+             im = 
+               (RGBA_Image *)evas_cache_image_empty(evas_common_image_cache_get());
+          }
+
         if (!im) 
           {
              free(obr);
              return NULL;
           }
         im->cache_entry.flags.alpha |= (alpha ? 1 : 0);
-        evas_cache_image_surface_alloc(&im->cache_entry, w, h);
+#ifdef EVAS_CSERVE2
+        if (evas_cserve2_use_get())
+          evas_cache2_image_surface_alloc(&im->cache_entry, w, h);
+        else
+#endif
+          evas_cache_image_surface_alloc(&im->cache_entry, w, h);
+
         im->extended_info = obr;
         if ((buf->rot == 0) || (buf->rot == 180)) 
           {
@@ -429,7 +511,12 @@ evas_software_xcb_outbuf_new_region_for_update(Outbuf *buf, int x, int y, int w,
                       buf->priv.x11.xcb.depth, bw, bh, use_shm, NULL);
         if (!obr->xcbob) 
           {
-             evas_cache_image_drop(&im->cache_entry);
+#ifdef EVAS_CSERVE2
+             if (evas_cserve2_use_get())
+               evas_cache2_image_close(&im->cache_entry);
+             else
+#endif
+               evas_cache_image_drop(&im->cache_entry);
              free(obr);
              return NULL;
           }
@@ -567,7 +654,13 @@ evas_software_xcb_outbuf_flush(Outbuf *buf)
                eina_list_remove_list(buf->priv.prev_pending_writes, 
                                      buf->priv.prev_pending_writes);
              obr = im->extended_info;
-             evas_cache_image_drop(&im->cache_entry);
+# ifdef EVAS_CSERVE2
+             if (evas_cserve2_use_get())
+               evas_cache2_image_close(&im->cache_entry);
+             else
+# endif
+               evas_cache_image_drop(&im->cache_entry);
+
              if (obr->xcbob) _unfind_xcbob(obr->xcbob, EINA_FALSE);
              if (obr->mask) _unfind_xcbob(obr->mask, EINA_FALSE);
              free(obr);
@@ -586,11 +679,21 @@ evas_software_xcb_outbuf_flush(Outbuf *buf)
                eina_list_remove_list(buf->priv.pending_writes, 
                                      buf->priv.pending_writes);
              obr = im->extended_info;
-             evas_cache_image_drop(&im->cache_entry);
+# ifdef EVAS_CSERVE2
+             if (evas_cserve2_use_get())
+               evas_cache2_image_close(&im->cache_entry);
+             else
+# endif
+               evas_cache_image_drop(&im->cache_entry);
              if (obr->xcbob) _unfind_xcbob(obr->xcbob, EINA_FALSE);
              if (obr->mask) _unfind_xcbob(obr->mask, EINA_FALSE);
              free(obr);
-             evas_cache_image_drop(&im->cache_entry);
+# ifdef EVAS_CSERVE2
+             if (evas_cserve2_use_get())
+               evas_cache2_image_close(&im->cache_entry);
+             else
+# endif
+               evas_cache_image_drop(&im->cache_entry);
           }
 #endif
      }
@@ -613,7 +716,12 @@ evas_software_xcb_outbuf_idle_flush(Outbuf *buf)
         if (obr->mask) 
           evas_software_xcb_output_buffer_free(obr->mask, EINA_FALSE);
         free(obr);
-        evas_cache_image_drop(&im->cache_entry);
+# ifdef EVAS_CSERVE2
+        if (evas_cserve2_use_get())
+          evas_cache2_image_close(&im->cache_entry);
+        else
+# endif
+          evas_cache_image_drop(&im->cache_entry);
      }
    else 
      {
@@ -629,7 +737,12 @@ evas_software_xcb_outbuf_idle_flush(Outbuf *buf)
                eina_list_remove_list(buf->priv.prev_pending_writes, 
                                      buf->priv.prev_pending_writes);
              obr = im->extended_info;
-             evas_cache_image_drop(&im->cache_entry);
+# ifdef EVAS_CSERVE2
+             if (evas_cserve2_use_get())
+               evas_cache2_image_close(&im->cache_entry);
+             else
+# endif
+               evas_cache_image_drop(&im->cache_entry);
              if (obr->xcbob) _unfind_xcbob(obr->xcbob, EINA_FALSE);
              if (obr->mask) _unfind_xcbob(obr->mask, EINA_FALSE);
              free(obr);