From 0d1c4661ab4f348f98b4ad5f4e98df2d0a994565 Mon Sep 17 00:00:00 2001 From: Christopher Michael Date: Fri, 29 Jun 2012 12:01:34 +0000 Subject: [PATCH] Evas: Support cserve2 for xcb engine. SVN revision: 73033 --- .../modules/engines/software_x11/Makefile.am | 1 + .../engines/software_x11/evas_xcb_outbuf.c | 163 +++++++++++++++--- 2 files changed, 139 insertions(+), 25 deletions(-) diff --git a/legacy/evas/src/modules/engines/software_x11/Makefile.am b/legacy/evas/src/modules/engines/software_x11/Makefile.am index 1d5d17bca9..7c15a270a7 100644 --- a/legacy/evas/src/modules/engines/software_x11/Makefile.am +++ b/legacy/evas/src/modules/engines/software_x11/Makefile.am @@ -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@ \ diff --git a/legacy/evas/src/modules/engines/software_x11/evas_xcb_outbuf.c b/legacy/evas/src/modules/engines/software_x11/evas_xcb_outbuf.c index b02df10bb5..73dd245aaf 100644 --- a/legacy/evas/src/modules/engines/software_x11/evas_xcb_outbuf.c +++ b/legacy/evas/src/modules/engines/software_x11/evas_xcb_outbuf.c @@ -1,9 +1,17 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include + +#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 /* 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);