src/modules/engines/direct3d/Makefile
src/modules/engines/software_16_wince/Makefile
src/modules/engines/software_x11/Makefile
-src/modules/engines/software_xcb/Makefile
src/modules/engines/fb/Makefile
src/modules/engines/buffer/Makefile
src/modules/engines/software_win32_gdi/Makefile
echo
echo "Engines:"
echo " Software Memory Buffer.....: $have_evas_engine_buffer"
-echo " Software X11...............: $have_evas_engine_software_x11"
+echo " Software X11...............: $have_evas_engine_software_x11 (XCB: $have_evas_engine_software_xcb)"
echo " XRender X11................: $have_evas_engine_xrender_x11"
echo " OpenGL X11.................: $have_evas_engine_gl_x11"
echo " Glitz X11..................: $have_evas_engine_glitz_x11"
echo " Cairo X11..................: $have_evas_engine_cairo_x11"
-echo " Software XCB...............: $have_evas_engine_software_xcb"
echo " XRender XCB................: $have_evas_engine_xrender_xcb"
echo " Software DirectDraw........: $have_evas_engine_software_ddraw"
echo " Direct3d...................: $have_evas_engine_direct3d"
software_win32_gdi \
software_ddraw \
software_x11 \
-software_xcb \
xrender_x11 \
xrender_xcb \
software_sdl \
#include <X11/Xlib.h>
-typedef struct _Evas_Engine_Info_Software_X11 Evas_Engine_Info_Software_X11;
+typedef struct _Evas_Engine_Info_Software_X11 Evas_Engine_Info_Software_X11;
+
+/*
+ * backend: 0 == Xlib, 1 == XCB
+ *
+ * Xlib | XCB
+ * connection | Display * | xcb_connection_t *
+ * screen | NULL | xcb_screen_t *
+ * drawable | Drawable | xcb_drawable_t
+ * mask | Drawable | xcb_drawable_t
+ * visual | Visual * | xcb_visualtype_t *
+ * colormap | Colormap | xcb_colormap_t
+ */
struct _Evas_Engine_Info_Software_X11
{
/* engine specific data & parameters it needs to set up */
struct {
- Display *display;
- Drawable drawable;
- Pixmap mask;
- Visual *visual;
- Colormap colormap;
- int depth;
- int rotation;
-
- int alloc_grayscale : 1;
- int debug : 1;
- int shape_dither : 1;
- int destination_alpha : 1;
- int track_mask_changes : 1;
-
- int alloc_colors_max;
+ int backend;
+ void *connection;
+ void *screen;
+ unsigned int drawable;
+ unsigned int mask;
+ void *visual;
+ unsigned int colormap;
+ int depth;
+ int rotation;
+
+ int alloc_grayscale : 1;
+ int debug : 1;
+ int shape_dither : 1;
+ int destination_alpha : 1;
+ int track_mask_changes : 1;
+
+ int alloc_colors_max;
} info;
/* engine specific function calls to query stuff about the destination */
struct {
- Visual * (*best_visual_get) (Display *disp, int screen);
- Colormap (*best_colormap_get) (Display *disp, int screen);
- int (*best_depth_get) (Display *disp, int screen);
+ void *(*best_visual_get) (int backend, void *connection, int screen);
+ unsigned int (*best_colormap_get) (int backend, void *connection, int screen);
+ int (*best_depth_get) (int backend, void *connection, int screen);
} func;
int mask_changed;
-I$(top_srcdir)/src/modules/engines \
@FREETYPE_CFLAGS@ \
@EINA_CFLAGS@ \
-@evas_engine_software_x11_cflags@
+@evas_engine_software_x11_cflags@ \
+@evas_engine_software_xcb_cflags@
if BUILD_ENGINE_SOFTWARE_X11
module_la_SOURCES = \
evas_engine.c \
-evas_outbuf.c \
-evas_x_buffer.c \
-evas_x_color.c \
-evas_x_main.c
+evas_xlib_outbuf.c \
+evas_xlib_buffer.c \
+evas_xlib_color.c \
+evas_xlib_main.c
-module_la_LIBADD = $(top_builddir)/src/lib/libevas.la @EINA_LIBS@ @evas_engine_software_x11_libs@
+if BUILD_ENGINE_SOFTWARE_XCB
+
+module_la_SOURCES += \
+evas_xcb_outbuf.c \
+evas_xcb_buffer.c \
+evas_xcb_color.c \
+evas_xcb_main.c
+
+endif
+
+module_la_LIBADD = $(top_builddir)/src/lib/libevas.la @EINA_LIBS@ @evas_engine_software_x11_libs@ @evas_engine_software_xcb_libs@
module_la_LDFLAGS = -module -avoid-version
module_la_LIBTOOLFLAGS = --tag=disable-static
endif
-EXTRA_DIST = evas_engine.h
+EXTRA_DIST = \
+evas_engine.h \
+evas_xlib_outbuf.h \
+evas_xlib_buffer.h \
+evas_xlib_color.h \
+evas_xcb_outbuf.h \
+evas_xcb_buffer.h \
+evas_xcb_color.h
#include "evas_common.h"
#include "evas_private.h"
-#include "evas_engine.h"
+
#include "Evas_Engine_Software_X11.h"
+#include "evas_engine.h"
+#include "evas_xlib_outbuf.h"
+#include "evas_xlib_color.h"
+
+#ifdef BUILD_ENGINE_SOFTWARE_XCB
+# include "evas_xcb_outbuf.h"
+# include "evas_xcb_color.h"
+#endif
+
/* function tables - filled in later (func and parent func) */
static Evas_Func func, pfunc;
struct _Render_Engine
{
- Tilebuf *tb;
- Outbuf *ob;
- Tilebuf_Rect *rects;
- Eina_Inlist *cur_rect;
- int end : 1;
+ Tilebuf *tb;
+ Outbuf *ob;
+ Tilebuf_Rect *rects;
+ Eina_Inlist *cur_rect;
+ int end : 1;
+
+ void (*outbuf_free)(Outbuf *ob);
+ void (*outbuf_reconfigure)(Outbuf *ob, int w, int h, int rot, Outbuf_Depth depth);
+ int (*outbuf_get_rot)(Outbuf *ob);
+ RGBA_Image *(*outbuf_new_region_for_update)(Outbuf *ob, int x, int y, int w, int h, int *cx, int *cy, int *cw, int *ch);
+ void (*outbuf_push_updated_region)(Outbuf *ob, RGBA_Image *update, int x, int y, int w, int h);
+ void (*outbuf_free_region_for_update)(Outbuf *ob, RGBA_Image *update);
+ void (*outbuf_flush)(Outbuf *ob);
+ void (*outbuf_idle_flush)(Outbuf *ob);
};
/* prototypes we will use here */
-static void *_output_setup(int w, int h, int rot, Display *disp, Drawable draw, Visual *vis, Colormap cmap, int depth, int debug, int grayscale, int max_colors, Pixmap mask, int shape_dither, int destination_alpha);
-static Visual *_best_visual_get(Display *disp, int screen);
-static Colormap _best_colormap_get(Display *disp, int screen);
-static int _best_depth_get(Display *disp, int screen);
+static void *_output_xlib_setup(int w, int h, int rot, Display *disp, Drawable draw, Visual *vis, Colormap cmap, int depth, int debug, int grayscale, int max_colors, Pixmap mask, int shape_dither, int destination_alpha);
+
+static void *_best_visual_get (int backend, void *connection, int screen);
+static unsigned int _best_colormap_get (int backend, void *connection, int screen);
+static int _best_depth_get (int backend, void *connection, int screen);
static void *eng_info(Evas *e);
static void eng_info_free(Evas *e, void *info);
static void eng_output_flush(void *data);
static void eng_output_idle_flush(void *data);
+
/* internal engine routines */
+
+static void *
+_output_xlib_setup(int w,
+ int h,
+ int rot,
+ Display *disp,
+ Drawable draw,
+ Visual *vis,
+ Colormap cmap,
+ int depth,
+ int debug,
+ int grayscale,
+ int max_colors,
+ Pixmap mask,
+ int shape_dither,
+ int destination_alpha)
+{
+ Render_Engine *re;
+
+ re = calloc(1, sizeof(Render_Engine));
+
+ evas_software_xlib_x_init();
+ evas_software_xlib_x_color_init();
+ evas_software_xlib_outbuf_init();
+
+ re->ob = evas_software_xlib_outbuf_setup_x(w,
+ h,
+ rot,
+ OUTBUF_DEPTH_INHERIT,
+ disp,
+ draw,
+ vis,
+ cmap,
+ depth,
+ grayscale,
+ max_colors,
+ mask,
+ shape_dither,
+ destination_alpha);
+ if (!re->ob)
+ {
+ free(re);
+ return NULL;
+ }
+
+ /* for updates return 1 big buffer, but only use portions of it, also cache
+ it and keepit around until an idle_flush */
+ /* disable for now - i am hunting down why some expedite tests are slower,
+ * as well as shaped stuff is broken and probable non-32bpp is broken as
+ * convert funcs dont do the right thing
+ *
+ re->ob->onebuf = 1;
+ */
+
+ evas_software_xlib_outbuf_debug_set(re->ob, debug);
+ re->tb = evas_common_tilebuf_new(w, h);
+ if (!re->tb)
+ {
+ evas_software_xlib_outbuf_free(re->ob);
+ free(re);
+ return NULL;
+ }
+ /* in preliminary tests 16x16 gave highest framerates */
+ evas_common_tilebuf_set_tile_size(re->tb, TILESIZE, TILESIZE);
+ return re;
+}
+
+#ifdef BUILD_ENGINE_SOFTWARE_XCB
static void *
-_output_setup(int w, int h, int rot, Display *disp, Drawable draw, Visual *vis, Colormap cmap, int depth, int debug, int grayscale, int max_colors, Pixmap mask, int shape_dither, int destination_alpha)
+_output_xcb_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)
{
Render_Engine *re;
re = calloc(1, sizeof(Render_Engine));
- /* if we haven't initialized - init (automatic abort if already done) */
- evas_common_cpu_init();
-
- evas_common_blend_init();
- evas_common_image_init();
- evas_common_convert_init();
- evas_common_scale_init();
- evas_common_rectangle_init();
- evas_common_gradient_init();
- evas_common_polygon_init();
- evas_common_line_init();
- evas_common_font_init();
- evas_common_draw_init();
- evas_common_tilebuf_init();
-
- evas_software_x11_x_init();
- evas_software_x11_x_color_init();
- evas_software_x11_outbuf_init();
-
- re->ob = evas_software_x11_outbuf_setup_x(w, h, rot, OUTBUF_DEPTH_INHERIT,
- disp, draw, vis, cmap, depth,
- grayscale, max_colors, mask,
- shape_dither, destination_alpha);
+
+ evas_software_xcb_x_init();
+ evas_software_xcb_x_color_init();
+ evas_software_xcb_outbuf_init();
+
+ re->ob = evas_software_xcb_outbuf_setup_x(w,
+ h,
+ rot,
+ OUTBUF_DEPTH_INHERIT,
+ conn,
+ screen,
+ draw,
+ vis,
+ cmap,
+ depth,
+ grayscale,
+ max_colors,
+ mask,
+ shape_dither,
+ destination_alpha);
if (!re->ob)
{
free(re);
return NULL;
}
-
+
/* for updates return 1 big buffer, but only use portions of it, also cache
it and keepit around until an idle_flush */
/* disable for now - i am hunting down why some expedite tests are slower,
*
re->ob->onebuf = 1;
*/
-
- evas_software_x11_outbuf_debug_set(re->ob, debug);
+
+ evas_software_xcb_outbuf_debug_set(re->ob, debug);
re->tb = evas_common_tilebuf_new(w, h);
if (!re->tb)
{
- evas_software_x11_outbuf_free(re->ob);
+ evas_software_xcb_outbuf_free(re->ob);
free(re);
return NULL;
}
evas_common_tilebuf_set_tile_size(re->tb, TILESIZE, TILESIZE);
return re;
}
+#endif
-static Visual *
-_best_visual_get(Display *disp, int screen)
+static void *
+_best_visual_get(int backend, void *connection, int screen)
{
- if (!disp) return NULL;
- return DefaultVisual(disp, screen);
+ if (!connection) return NULL;
+
+ if (backend == 0)
+ {
+ return DefaultVisual((Display *)connection, screen);
+ }
+
+#ifdef BUILD_ENGINE_SOFTWARE_XCB
+ if (backend == 1)
+ {
+ xcb_screen_iterator_t iter_screen;
+ xcb_depth_iterator_t iter_depth;
+ xcb_screen_t *s;
+
+ iter_screen = xcb_setup_roots_iterator(xcb_get_setup((xcb_connection_t *)connection));
+ for (; iter_screen.rem; --screen, xcb_screen_next (&iter_screen))
+ if (screen == 0)
+ {
+ s = iter_screen.data;
+ break;
+ }
+
+ iter_depth = xcb_screen_allowed_depths_iterator(s);
+ 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; xcb_visualtype_next (&iter_vis))
+ {
+ if (s->root_visual == iter_vis.data->visual_id)
+ return iter_vis.data;
+ }
+ }
+ }
+#endif
+
+ return NULL;
}
-static Colormap
-_best_colormap_get(Display *disp, int screen)
+static unsigned int
+_best_colormap_get(int backend, void *connection, int screen)
{
- if (!disp) return 0;
- return DefaultColormap(disp, screen);
+ if (!connection) return 0;
+
+ if (backend == 0)
+ {
+ return DefaultColormap((Display *)connection, screen);
+ }
+
+#ifdef BUILD_ENGINE_SOFTWARE_XCB
+ if (backend == 1)
+ {
+ xcb_screen_iterator_t iter_screen;
+ xcb_screen_t *s;
+
+ iter_screen = xcb_setup_roots_iterator(xcb_get_setup((xcb_connection_t *)connection));
+ for (; iter_screen.rem; --screen, xcb_screen_next (&iter_screen))
+ if (screen == 0)
+ {
+ s = iter_screen.data;
+ break;
+ }
+
+ return s->default_colormap;
+ }
+#endif
+
+ return 0;
}
static int
-_best_depth_get(Display *disp, int screen)
+_best_depth_get(int backend, void *connection, int screen)
{
- if (!disp) return 0;
- return DefaultDepth(disp, screen);
+ if (!connection) return 0;
+
+ if (backend == 0)
+ {
+ return DefaultDepth((Display *)connection, screen);
+ }
+
+#ifdef BUILD_ENGINE_SOFTWARE_XCB
+ if (backend == 1)
+ {
+ xcb_screen_iterator_t iter_screen;
+ xcb_screen_t *s;
+
+ iter_screen = xcb_setup_roots_iterator(xcb_get_setup((xcb_connection_t *)connection));
+ for (; iter_screen.rem; --screen, xcb_screen_next (&iter_screen))
+ if (screen == 0)
+ {
+ s = iter_screen.data;
+ break;
+ }
+
+ return s->root_depth;
+ }
+#endif
+
+ return 0;
}
/* engine api this module provides */
static void
eng_setup(Evas *e, void *in)
{
- Render_Engine *re;
+ Render_Engine *re;
Evas_Engine_Info_Software_X11 *info;
info = (Evas_Engine_Info_Software_X11 *)in;
if (!e->engine.data.output)
- e->engine.data.output =
- _output_setup(e->output.w,
- e->output.h,
- info->info.rotation,
- info->info.display,
- info->info.drawable,
- info->info.visual,
- info->info.colormap,
- info->info.depth,
- info->info.debug,
- info->info.alloc_grayscale,
- info->info.alloc_colors_max,
- info->info.mask,
- info->info.shape_dither,
- info->info.destination_alpha);
+ {
+ /* if we haven't initialized - init (automatic abort if already done) */
+ evas_common_cpu_init();
+ evas_common_blend_init();
+ evas_common_image_init();
+ evas_common_convert_init();
+ evas_common_scale_init();
+ evas_common_rectangle_init();
+ evas_common_gradient_init();
+ evas_common_polygon_init();
+ evas_common_line_init();
+ evas_common_font_init();
+ evas_common_draw_init();
+ evas_common_tilebuf_init();
+
+ if (info->info.backend == 0)
+ {
+ re = _output_xlib_setup(e->output.w,
+ e->output.h,
+ info->info.rotation,
+ info->info.connection,
+ info->info.drawable,
+ info->info.visual,
+ info->info.colormap,
+ info->info.depth,
+ info->info.debug,
+ info->info.alloc_grayscale,
+ info->info.alloc_colors_max,
+ info->info.mask,
+ info->info.shape_dither,
+ info->info.destination_alpha);
+
+ re->outbuf_free = evas_software_xlib_outbuf_free;
+ re->outbuf_reconfigure = evas_software_xlib_outbuf_reconfigure;
+ re->outbuf_get_rot = evas_software_xlib_outbuf_get_rot;
+ re->outbuf_new_region_for_update = evas_software_xlib_outbuf_new_region_for_update;
+ re->outbuf_push_updated_region = evas_software_xlib_outbuf_push_updated_region;
+ re->outbuf_free_region_for_update = evas_software_xlib_outbuf_free_region_for_update;
+ re->outbuf_flush = evas_software_xlib_outbuf_flush;
+ re->outbuf_idle_flush = evas_software_xlib_outbuf_idle_flush;
+ }
+
+ if (info->info.backend == 1)
+ {
+#ifdef BUILD_ENGINE_SOFTWARE_XCB
+ re = _output_xcb_setup(e->output.w,
+ e->output.h,
+ info->info.rotation,
+ info->info.connection,
+ info->info.screen,
+ info->info.drawable,
+ info->info.visual,
+ info->info.colormap,
+ info->info.depth,
+ info->info.debug,
+ info->info.alloc_grayscale,
+ info->info.alloc_colors_max,
+ info->info.mask,
+ info->info.shape_dither,
+ info->info.destination_alpha);
+
+ re->outbuf_free = evas_software_xcb_outbuf_free;
+ re->outbuf_reconfigure = evas_software_xcb_outbuf_reconfigure;
+ re->outbuf_get_rot = evas_software_xcb_outbuf_get_rot;
+ re->outbuf_new_region_for_update = evas_software_xcb_outbuf_new_region_for_update;
+ re->outbuf_push_updated_region = evas_software_xcb_outbuf_push_updated_region;
+ re->outbuf_free_region_for_update = evas_software_xcb_outbuf_free_region_for_update;
+ re->outbuf_flush = evas_software_xcb_outbuf_flush;
+ re->outbuf_idle_flush = evas_software_xcb_outbuf_idle_flush;
+#endif
+ }
+
+ e->engine.data.output = re;
+ }
else
{
- int ponebuf = 0;
-
+ int ponebuf = 0;
+
re = e->engine.data.output;
ponebuf = re->ob->onebuf;
- evas_software_x11_outbuf_free(re->ob);
- re->ob = evas_software_x11_outbuf_setup_x(e->output.w,
- e->output.h,
- info->info.rotation,
- OUTBUF_DEPTH_INHERIT,
- info->info.display,
- info->info.drawable,
- info->info.visual,
- info->info.colormap,
- info->info.depth,
- info->info.alloc_grayscale,
- info->info.alloc_colors_max,
- info->info.mask,
- info->info.shape_dither,
- info->info.destination_alpha);
- evas_software_x11_outbuf_debug_set(re->ob, info->info.debug);
+
+ if (info->info.backend == 0)
+ {
+ evas_software_xlib_outbuf_free(re->ob);
+ re->ob = evas_software_xlib_outbuf_setup_x(e->output.w,
+ e->output.h,
+ info->info.rotation,
+ OUTBUF_DEPTH_INHERIT,
+ info->info.connection,
+ info->info.drawable,
+ info->info.visual,
+ info->info.colormap,
+ info->info.depth,
+ info->info.alloc_grayscale,
+ info->info.alloc_colors_max,
+ info->info.mask,
+ info->info.shape_dither,
+ info->info.destination_alpha);
+ evas_software_xlib_outbuf_debug_set(re->ob, info->info.debug);
+ }
+
+ if (info->info.backend == 1)
+ {
+#ifdef BUILD_ENGINE_SOFTWARE_XCB
+ evas_software_xcb_outbuf_free(re->ob);
+ re->ob = evas_software_xcb_outbuf_setup_x(e->output.w,
+ e->output.h,
+ info->info.rotation,
+ OUTBUF_DEPTH_INHERIT,
+ info->info.connection,
+ info->info.screen,
+ info->info.drawable,
+ info->info.visual,
+ info->info.colormap,
+ info->info.depth,
+ info->info.alloc_grayscale,
+ info->info.alloc_colors_max,
+ info->info.mask,
+ info->info.shape_dither,
+ info->info.destination_alpha);
+ evas_software_xcb_outbuf_debug_set(re->ob, info->info.debug);
+#endif
+ }
re->ob->onebuf = ponebuf;
}
if (!e->engine.data.output) return;
e->engine.func->context_new(e->engine.data.output);
re = e->engine.data.output;
- evas_software_x11_outbuf_drawable_set(re->ob, info->info.drawable);
- evas_software_x11_outbuf_mask_set(re->ob, info->info.mask);
- evas_software_x11_outbuf_rotation_set(re->ob, info->info.rotation);
}
static void
if (!data) return;
re = (Render_Engine *)data;
- evas_software_x11_outbuf_free(re->ob);
+ re->outbuf_free(re->ob);
evas_common_tilebuf_free(re->tb);
if (re->rects) evas_common_tilebuf_free_render_rects(re->rects);
free(re);
Render_Engine *re;
re = (Render_Engine *)data;
- evas_software_x11_outbuf_reconfigure(re->ob, w, h,
- evas_software_x11_outbuf_get_rot(re->ob),
- OUTBUF_DEPTH_INHERIT);
+ re->outbuf_reconfigure(re->ob, w, h,
+ re->outbuf_get_rot(re->ob),
+ OUTBUF_DEPTH_INHERIT);
evas_common_tilebuf_free(re->tb);
re->tb = evas_common_tilebuf_new(w, h);
if (re->tb)
re->end = 1;
}
- surface = evas_software_x11_outbuf_new_region_for_update
- (re->ob, ux, uy, uw, uh, cx, cy, cw, ch);
+ surface = re->outbuf_new_region_for_update (re->ob, ux, uy, uw, uh, cx, cy, cw, ch);
*x = ux; *y = uy; *w = uw; *h = uh;
return surface;
}
re = (Render_Engine *)data;
evas_common_pipe_begin(surface);
evas_common_pipe_flush(surface);
- evas_software_x11_outbuf_push_updated_region(re->ob, surface, x, y, w, h);
- evas_software_x11_outbuf_free_region_for_update(re->ob, surface);
+ re->outbuf_push_updated_region(re->ob, surface, x, y, w, h);
+ re->outbuf_free_region_for_update(re->ob, surface);
evas_common_cpu_end_opt();
}
Render_Engine *re;
re = (Render_Engine *)data;
- evas_software_x11_outbuf_flush(re->ob);
+ re->outbuf_flush(re->ob);
}
static void
Render_Engine *re;
re = (Render_Engine *)data;
- evas_software_x11_outbuf_idle_flush(re->ob);
+ re->outbuf_idle_flush(re->ob);
}
#ifndef EVAS_ENGINE_H
#define EVAS_ENGINE_H
+#include <sys/ipc.h>
+#include <sys/shm.h>
+
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>
#include <X11/extensions/XShm.h>
-#include <sys/ipc.h>
-#include <sys/shm.h>
-typedef struct _Outbuf Outbuf;
-typedef struct _Outbuf_Region Outbuf_Region;
-typedef struct _X_Output_Buffer X_Output_Buffer;
+#ifdef BUILD_ENGINE_SOFTWARE_XCB
+# include <xcb/xcb.h>
+# include <xcb/xcb_image.h>
+#endif
+
-typedef enum _Outbuf_Depth Outbuf_Depth;
+typedef enum _Outbuf_Depth Outbuf_Depth;
enum _Outbuf_Depth
{
OUTBUF_DEPTH_NONE,
- OUTBUF_DEPTH_INHERIT,
- OUTBUF_DEPTH_RGB_16BPP_565_565_DITHERED,
- OUTBUF_DEPTH_RGB_16BPP_555_555_DITHERED,
- OUTBUF_DEPTH_RGB_16BPP_444_444_DITHERED,
- OUTBUF_DEPTH_RGB_16BPP_565_444_DITHERED,
- OUTBUF_DEPTH_RGB_32BPP_888_8888,
- OUTBUF_DEPTH_LAST
+ OUTBUF_DEPTH_INHERIT,
+ OUTBUF_DEPTH_RGB_16BPP_565_565_DITHERED,
+ OUTBUF_DEPTH_RGB_16BPP_555_555_DITHERED,
+ OUTBUF_DEPTH_RGB_16BPP_444_444_DITHERED,
+ OUTBUF_DEPTH_RGB_16BPP_565_444_DITHERED,
+ OUTBUF_DEPTH_RGB_32BPP_888_8888,
+ OUTBUF_DEPTH_LAST
};
+typedef struct _Outbuf Outbuf;
+
struct _Outbuf
{
Outbuf_Depth depth;
struct {
Convert_Pal *pal;
- struct {
- Display *disp;
- Window win;
- Pixmap mask;
- Visual *vis;
- Colormap cmap;
- int depth;
- int shm;
- GC gc;
- GC gcm;
- unsigned char swap : 1;
- unsigned char bit_swap : 1;
- } x;
+ union {
+ struct {
+ Display *disp;
+ Window win;
+ Pixmap mask;
+ Visual *vis;
+ Colormap cmap;
+ int depth;
+ int shm;
+ GC gc;
+ GC gcm;
+ unsigned char swap : 1;
+ unsigned char bit_swap : 1;
+ } xlib;
+#ifdef BUILD_ENGINE_SOFTWARE_XCB
+ struct {
+ xcb_connection_t *conn;
+ xcb_screen_t *screen;
+ xcb_drawable_t win;
+ xcb_drawable_t mask;
+ xcb_visualtype_t *vis;
+ xcb_colormap_t cmap;
+ int depth;
+ int shm;
+ xcb_gcontext_t gc;
+ xcb_gcontext_t gcm;
+ unsigned char swap : 1;
+ unsigned char bit_swap : 1;
+ } xcb;
+#endif
+ } x11;
struct {
DATA32 r, g, b;
} mask;
} priv;
};
-struct _Outbuf_Region
-{
- X_Output_Buffer *xob, *mxob;
- int x, y, w, h;
-};
-struct _X_Output_Buffer
-{
- Display *display;
- XImage *xim;
- XShmSegmentInfo *shm_info;
- Visual *visual;
- void *data;
- int w, h, bpl;
- int psize;
-};
+void evas_software_xlib_x_init (void);
+void evas_software_xcb_x_init (void);
-/****/
-void evas_software_x11_x_init (void);
-
-void evas_software_x11_x_write_mask_line (Outbuf *buf, X_Output_Buffer *xob, DATA32 *src, int w, int y);
-int evas_software_x11_x_can_do_shm (Display *d);
-X_Output_Buffer *evas_software_x11_x_output_buffer_new (Display *d, Visual *v, int depth, int w, int h, int try_shm, void *data);
-void evas_software_x11_x_output_buffer_free (X_Output_Buffer *xob, int sync);
-void evas_software_x11_x_output_buffer_paste (X_Output_Buffer *xob, Drawable d, GC gc, int x, int y, int sync);
-DATA8 *evas_software_x11_x_output_buffer_data (X_Output_Buffer *xob, int *bytes_per_line_ret);
-int evas_software_x11_x_output_buffer_depth (X_Output_Buffer *xob);
-int evas_software_x11_x_output_buffer_byte_order (X_Output_Buffer *xob);
-int evas_software_x11_x_output_buffer_bit_order (X_Output_Buffer *xob);
-
-void evas_software_x11_x_color_init (void);
-Convert_Pal *evas_software_x11_x_color_allocate (Display *disp, Colormap cmap, Visual *vis, Convert_Pal_Mode colors);
-void evas_software_x11_x_color_deallocate (Display *disp, Colormap cmap, Visual *vis, Convert_Pal *pal);
-
-void evas_software_x11_outbuf_init (void);
-void evas_software_x11_outbuf_free (Outbuf *buf);
-
-Outbuf *evas_software_x11_outbuf_setup_x (int w, int h, int rot, Outbuf_Depth depth, Display *disp, Drawable draw, Visual *vis, Colormap cmap, int x_depth, int grayscale, int max_colors, Pixmap mask, int shape_dither, int destination_alpha);
-
-RGBA_Image *evas_software_x11_outbuf_new_region_for_update (Outbuf *buf, int x, int y, int w, int h, int *cx, int *cy, int *cw, int *ch);
-void evas_software_x11_outbuf_free_region_for_update (Outbuf *buf, RGBA_Image *update);
-void evas_software_x11_outbuf_flush (Outbuf *buf);
-void evas_software_x11_outbuf_idle_flush (Outbuf *buf);
-void evas_software_x11_outbuf_push_updated_region (Outbuf *buf, RGBA_Image *update, int x, int y, int w, int h);
-void evas_software_x11_outbuf_reconfigure (Outbuf *buf, int w, int h, int rot, Outbuf_Depth depth);
-int evas_software_x11_outbuf_get_width (Outbuf *buf);
-int evas_software_x11_outbuf_get_height (Outbuf *buf);
-Outbuf_Depth evas_software_x11_outbuf_get_depth (Outbuf *buf);
-int evas_software_x11_outbuf_get_rot (Outbuf *buf);
-void evas_software_x11_outbuf_drawable_set (Outbuf *buf, Drawable draw);
-void evas_software_x11_outbuf_mask_set (Outbuf *buf, Pixmap mask);
-void evas_software_x11_outbuf_rotation_set (Outbuf *buf, int rot);
-
-void evas_software_x11_outbuf_debug_set (Outbuf *buf, int debug);
-void evas_software_x11_outbuf_debug_show (Outbuf *buf, Drawable draw, int x, int y, int w, int h);
#endif
+++ /dev/null
-#include "evas_common.h"
-#include "evas_engine.h"
-
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-
-void
-evas_software_x11_x_init(void)
-{
-}
--- /dev/null
+#include "evas_common.h"
+
+#include "evas_xcb_buffer.h"
+
+static int _xcb_err = 0;
+
+void
+evas_software_xcb_x_write_mask_line(Outbuf *buf,
+ Xcb_Output_Buffer *xcbob,
+ DATA32 *src,
+ int w,
+ int y)
+{
+ int x;
+ DATA32 *src_ptr;
+ DATA8 *dst_ptr;
+ int bpl = 0;
+
+ src_ptr = src;
+ dst_ptr = evas_software_xcb_x_output_buffer_data(xcbob, &bpl);
+ dst_ptr = dst_ptr + (bpl * y);
+ w -= 7;
+ if (buf->priv.x11.xcb.bit_swap)
+ {
+ for (x = 0; x < w; x += 8)
+ {
+ *dst_ptr =
+ ((A_VAL(&(src_ptr[0])) >> 7) << 7) |
+ ((A_VAL(&(src_ptr[1])) >> 7) << 6) |
+ ((A_VAL(&(src_ptr[2])) >> 7) << 5) |
+ ((A_VAL(&(src_ptr[3])) >> 7) << 4) |
+ ((A_VAL(&(src_ptr[4])) >> 7) << 3) |
+ ((A_VAL(&(src_ptr[5])) >> 7) << 2) |
+ ((A_VAL(&(src_ptr[6])) >> 7) << 1) |
+ ((A_VAL(&(src_ptr[7])) >> 7) << 0);
+ src_ptr += 8;
+ dst_ptr++;
+ }
+ }
+ else
+ {
+ for (x = 0; x < w; x += 8)
+ {
+ *dst_ptr =
+ ((A_VAL(&(src_ptr[0])) >> 7) << 0) |
+ ((A_VAL(&(src_ptr[1])) >> 7) << 1) |
+ ((A_VAL(&(src_ptr[2])) >> 7) << 2) |
+ ((A_VAL(&(src_ptr[3])) >> 7) << 3) |
+ ((A_VAL(&(src_ptr[4])) >> 7) << 4) |
+ ((A_VAL(&(src_ptr[5])) >> 7) << 5) |
+ ((A_VAL(&(src_ptr[6])) >> 7) << 6) |
+ ((A_VAL(&(src_ptr[7])) >> 7) << 7);
+ src_ptr += 8;
+ dst_ptr++;
+ }
+ }
+ w += 7;
+ for (; x < w; x ++)
+ {
+ xcb_image_put_pixel(xcbob->image, x, y, A_VAL(src_ptr) >> 7);
+ src_ptr++;
+ }
+}
+
+int
+evas_software_xcb_x_can_do_shm(xcb_connection_t *c,
+ xcb_screen_t *screen)
+{
+ static xcb_connection_t *cached_c = NULL;
+ static int cached_result = 0;
+
+ if (c == cached_c) return cached_result;
+ cached_c = c;
+
+ if (xcb_get_extension_data(c, &xcb_shm_id))
+ {
+ Xcb_Output_Buffer *xcbob;
+
+ xcbob = evas_software_xcb_x_output_buffer_new(c,
+ screen->root_depth,
+ 16,
+ 16,
+ 2,
+ NULL);
+ if (!xcbob)
+ {
+ cached_result = 0;
+ return 0;
+ }
+ evas_software_xcb_x_output_buffer_free(xcbob, 1);
+ cached_result = 1;
+ return 1;
+ }
+ cached_result = 0;
+ return 0;
+}
+
+/*
+ * FIXME: no error mechanism
+ */
+
+/* static void */
+/* x_output_tmp_xcb_err(xcb_connection_t *c, XErrorEvent * ev) */
+/* { */
+/* _xcb_err = 1; */
+/* return; */
+/* } */
+
+Xcb_Output_Buffer *
+evas_software_xcb_x_output_buffer_new(xcb_connection_t *c,
+ int depth,
+ int w,
+ int h,
+ int try_shm,
+ void *data)
+{
+ Xcb_Output_Buffer *xcbob;
+
+ xcbob = calloc(1, sizeof(Xcb_Output_Buffer));
+ if (!xcbob) return NULL;
+
+ xcbob->connection = c;
+ xcbob->image = NULL;
+ xcbob->shm_info = NULL;
+ xcbob->w = w;
+ xcbob->h = h;
+
+ try_shm = 0;
+
+ if (try_shm > 0)
+ {
+ xcbob->shm_info = malloc(sizeof(xcb_shm_segment_info_t));
+ if (xcbob->shm_info)
+ {
+ xcbob->shm_info->shmseg = xcb_generate_id(c);
+ xcbob->image = xcb_image_create_native(c, w, h,
+ XCB_IMAGE_FORMAT_Z_PIXMAP,
+ depth, NULL, ~0, NULL);
+ if (xcbob->image)
+ {
+ xcbob->shm_info->shmid = shmget(IPC_PRIVATE,
+ xcbob->image->size,
+ IPC_CREAT | 0777);
+ if (xcbob->shm_info->shmid >= 0)
+ {
+ xcbob->shm_info->shmaddr = xcbob->image->data =
+ shmat(xcbob->shm_info->shmid, 0, 0);
+ if (xcbob->shm_info->shmaddr != NULL)
+ {
+ /*
+ * FIXME: no error mechanism
+ */
+
+ /* XErrorHandler ph; */
+ /* EventHandlers eh; */
+
+ // 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_unchecked(c), NULL));
+ /* XSetErrorHandler((XErrorHandler)ph); */
+ if (!_xcb_err)
+ {
+ xcbob->bpl = xcbob->image->stride;
+ xcbob->psize = xcbob->bpl * xcbob->h;
+ return xcbob;
+ }
+ }
+ shmdt(xcbob->shm_info->shmaddr);
+ shmctl(xcbob->shm_info->shmid, IPC_RMID, 0);
+ }
+ if (xcbob->image) xcb_image_destroy(xcbob->image);
+ xcbob->image = NULL;
+ }
+ if (xcbob->shm_info) free(xcbob->shm_info);
+ xcbob->shm_info = NULL;
+ }
+ }
+
+ if (try_shm > 1) return NULL;
+
+ xcbob->image = xcb_image_create_native(c, w, h, XCB_IMAGE_FORMAT_Z_PIXMAP,
+ depth, NULL, ~0, NULL);
+ if (!xcbob->image)
+ {
+ free(xcbob);
+ return NULL;
+ }
+
+ xcbob->data = data;
+
+ if (!xcbob->image->data)
+ {
+ xcbob->image->data = malloc(xcbob->image->size);
+ if (!xcbob->image->data)
+ {
+ xcb_image_destroy(xcbob->image);
+ free(xcbob);
+ return NULL;
+ }
+ }
+
+ xcbob->bpl = xcbob->image->stride;
+ xcbob->psize = xcbob->image->size;
+
+ return xcbob;
+}
+
+void
+evas_software_xcb_x_output_buffer_free(Xcb_Output_Buffer *xcbob,
+ int sync)
+{
+ if (xcbob->shm_info)
+ {
+ if (sync)
+ free(xcb_get_input_focus_reply(xcbob->connection,
+ xcb_get_input_focus_unchecked(xcbob->connection),
+ NULL));
+ xcb_shm_detach(xcbob->connection, xcbob->shm_info->shmseg);
+ xcb_image_destroy(xcbob->image);
+ shmdt(xcbob->shm_info->shmaddr);
+ shmctl(xcbob->shm_info->shmid, IPC_RMID, 0);
+ free(xcbob->shm_info);
+ }
+ else
+ {
+ if (xcbob->data) xcbob->image->data = NULL;
+ xcb_image_destroy(xcbob->image);
+ }
+ free(xcbob);
+}
+
+void
+evas_software_xcb_x_output_buffer_paste(Xcb_Output_Buffer *xcbob,
+ xcb_drawable_t d,
+ xcb_gcontext_t gc,
+ int x,
+ int y,
+ int sync)
+{
+ if (xcbob->shm_info)
+ {
+ xcb_image_shm_put(xcbob->connection, d, gc,
+ xcbob->image, *xcbob->shm_info,
+ 0, 0,
+ x, y,
+ xcbob->image->width, xcbob->image->height,
+ 0);
+ if (sync)
+ free(xcb_get_input_focus_reply(xcbob->connection,
+ xcb_get_input_focus_unchecked(xcbob->connection),
+ NULL));
+ }
+ else
+ xcb_image_put(xcbob->connection, d, gc,
+ xcbob->image,
+ x, y, 0);
+}
+
+DATA8 *
+evas_software_xcb_x_output_buffer_data(Xcb_Output_Buffer *xcbob,
+ int *bytes_per_line_ret)
+{
+ if (bytes_per_line_ret) *bytes_per_line_ret = xcbob->image->stride;
+ return xcbob->image->data;
+}
+
+int
+evas_software_xcb_x_output_buffer_depth(Xcb_Output_Buffer *xcbob)
+{
+ return xcbob->image->bpp;
+}
+
+int
+evas_software_xcb_x_output_buffer_byte_order(Xcb_Output_Buffer *xcbob)
+{
+ return xcbob->image->byte_order;
+}
+
+int
+evas_software_xcb_x_output_buffer_bit_order(Xcb_Output_Buffer *xcbob)
+{
+ return xcbob->image->bit_order;
+}
--- /dev/null
+#ifndef EVAS_XCB_BUFFER_H
+#define EVAS_XCB_BUFFER_H
+
+
+#include "evas_engine.h"
+
+
+typedef struct _Xcb_Output_Buffer Xcb_Output_Buffer;
+
+struct _Xcb_Output_Buffer
+{
+ xcb_connection_t *connection;
+ xcb_image_t *image;
+ xcb_shm_segment_info_t *shm_info;
+ void *data;
+ int w;
+ int h;
+ int bpl;
+ int psize;
+};
+
+void evas_software_xcb_x_write_mask_line (Outbuf *buf,
+ Xcb_Output_Buffer *xcbob,
+ DATA32 *src,
+ int w,
+ int y);
+int evas_software_xcb_x_can_do_shm (xcb_connection_t *c,
+ xcb_screen_t *screen);
+Xcb_Output_Buffer *evas_software_xcb_x_output_buffer_new (xcb_connection_t *c,
+ int depth,
+ int w,
+ int h,
+ int try_shm,
+ void *data);
+void evas_software_xcb_x_output_buffer_free (Xcb_Output_Buffer *xcbob,
+ int sync);
+void evas_software_xcb_x_output_buffer_paste (Xcb_Output_Buffer *xcbob,
+ xcb_drawable_t d,
+ xcb_gcontext_t gc,
+ int x,
+ int y,
+ int sync);
+DATA8 *evas_software_xcb_x_output_buffer_data (Xcb_Output_Buffer *xcbob,
+ int *bytes_per_line_ret);
+int evas_software_xcb_x_output_buffer_depth (Xcb_Output_Buffer *xcbob);
+int evas_software_xcb_x_output_buffer_byte_order(Xcb_Output_Buffer *xcbob);
+int evas_software_xcb_x_output_buffer_bit_order (Xcb_Output_Buffer *xcbob);
+
+
+#endif
--- /dev/null
+#include "evas_common.h"
+
+#include "evas_engine.h"
+
+typedef struct _Convert_Pal_Priv Convert_Pal_Priv;
+
+struct _Convert_Pal_Priv
+{
+ xcb_connection_t *conn;
+ xcb_colormap_t cmap;
+ xcb_visualtype_t *vis;
+};
+
+typedef DATA8 * (*Xcb_Func_Alloc_Colors) (xcb_connection_t *conn, xcb_colormap_t cmap, xcb_visualtype_t *v);
+
+static Xcb_Func_Alloc_Colors x_color_alloc[PAL_MODE_LAST + 1];
+static int x_color_count[PAL_MODE_LAST + 1];
+static Eina_List *palettes = NULL;
+
+static DATA8 * x_color_alloc_rgb(int nr, int ng, int nb, xcb_connection_t *conn, xcb_colormap_t cmap, xcb_visualtype_t *v);
+static DATA8 * x_color_alloc_gray(int ng, xcb_connection_t *conn, xcb_colormap_t cmap, xcb_visualtype_t *v);
+
+static DATA8 * x_color_alloc_rgb_332 (xcb_connection_t *conn, xcb_colormap_t cmap, xcb_visualtype_t *v);
+static DATA8 * x_color_alloc_rgb_666 (xcb_connection_t *conn, xcb_colormap_t cmap, xcb_visualtype_t *v);
+static DATA8 * x_color_alloc_rgb_232 (xcb_connection_t *conn, xcb_colormap_t cmap, xcb_visualtype_t *v);
+static DATA8 * x_color_alloc_rgb_222 (xcb_connection_t *conn, xcb_colormap_t cmap, xcb_visualtype_t *v);
+static DATA8 * x_color_alloc_rgb_221 (xcb_connection_t *conn, xcb_colormap_t cmap, xcb_visualtype_t *v);
+static DATA8 * x_color_alloc_rgb_121 (xcb_connection_t *conn, xcb_colormap_t cmap, xcb_visualtype_t *v);
+static DATA8 * x_color_alloc_rgb_111 (xcb_connection_t *conn, xcb_colormap_t cmap, xcb_visualtype_t *v);
+static DATA8 * x_color_alloc_gray_256 (xcb_connection_t *conn, xcb_colormap_t cmap, xcb_visualtype_t *v);
+static DATA8 * x_color_alloc_gray_64 (xcb_connection_t *conn, xcb_colormap_t cmap, xcb_visualtype_t *v);
+static DATA8 * x_color_alloc_gray_16 (xcb_connection_t *conn, xcb_colormap_t cmap, xcb_visualtype_t *v);
+static DATA8 * x_color_alloc_gray_4 (xcb_connection_t *conn, xcb_colormap_t cmap, xcb_visualtype_t *v);
+static DATA8 * x_color_alloc_mono (xcb_connection_t *conn, xcb_colormap_t cmap, xcb_visualtype_t *v);
+
+static DATA8 *
+x_color_alloc_rgb(int nr,
+ int ng,
+ int nb,
+ xcb_connection_t *conn,
+ xcb_colormap_t cmap,
+ xcb_visualtype_t *v)
+{
+ int r, g, b, i;
+ DATA8 *color_lut;
+ int sig_mask = 0;
+ int delt = 0;
+
+ for (i = 0; i < v->bits_per_rgb_value; i++) sig_mask |= (0x1 << i);
+ sig_mask <<= (16 - v->bits_per_rgb_value);
+ i = 0;
+ color_lut = malloc((nr) * (ng) * (nb));
+ if (!color_lut) return NULL;
+ delt = 0x0101 * 3;
+ /* FIXME: remove the round-trip ? */
+ for (r = 0; r < (nr); r++)
+ {
+ for (g = 0; g < (ng); g++)
+ {
+ for (b = 0; b < (nb); b++)
+ {
+ xcb_coloritem_t xcl;
+ xcb_coloritem_t xcl_in;
+ xcb_alloc_color_reply_t *rep;
+ int val;
+ int dr, dg, db;
+
+ val = (int)((((double)r) / ((nr) - 1)) * 255);
+ val = (val << 8) | val;
+ xcl.red = (uint16_t)(val);
+ val = (int)((((double)g) / ((ng) - 1)) * 255);
+ val = (val << 8) | val;
+ xcl.green = (uint16_t)(val);
+ val = (int)((((double)b) / ((nb) - 1)) * 255);
+ val = (val << 8) | val;
+ xcl.blue = (uint16_t)(val);
+ xcl_in = xcl;
+ rep = xcb_alloc_color_reply(conn,
+ xcb_alloc_color_unchecked(conn,
+ cmap,
+ xcl.red,
+ xcl.green,
+ xcl.blue),
+ 0);
+ dr = (int)xcl_in.red - (int)xcl.red;
+ if (dr < 0) dr = -dr;
+ dg = (int)xcl_in.green - (int)xcl.green;
+ if (dg < 0) dg = -dg;
+ db = (int)xcl_in.blue - (int)xcl.blue;
+ if (db < 0) db = -db;
+/*
+ printf("ASK [%i]: %04x %04x %04x = %04x %04x %04x | dif = %04x / %04x\n",
+ ret,
+ xcl_in.red, xcl_in.green, xcl_in.blue,
+ xcl.red, xcl.green, xcl.blue,
+ (dr + dg +db), delt);
+ */
+
+ /* TODO: XAllocColor tries to approach the color */
+ /* in case the allocation fails */
+ /* XCB does not that (i think). It should be done */
+ /* So if rep == NULL, the other following tests */
+ /* should be always satisfied */
+ if ((!rep) ||
+ ((dr + dg + db) > delt)
+ /*
+ ((xcl_in.red & sig_mask) != (xcl.red & sig_mask)) ||
+ ((xcl_in.green & sig_mask) != (xcl.green & sig_mask)) ||
+ ((xcl_in.blue & sig_mask) != (xcl.blue & sig_mask))
+ */
+ )
+ {
+ uint32_t pixels[256];
+ int j;
+
+ if (i > 0)
+ {
+ for (j = 0; j < i; j++)
+ pixels[j] = (uint32_t)color_lut[j];
+ xcb_free_colors(conn, cmap, 0, i, pixels);
+ }
+ free(color_lut);
+ return NULL;
+ }
+ color_lut[i] = rep->pixel;
+ i++;
+ free(rep);
+ }
+ }
+ }
+ return color_lut;
+}
+
+static DATA8 *
+x_color_alloc_gray(int ng,
+ xcb_connection_t *conn,
+ xcb_colormap_t cmap,
+ xcb_visualtype_t *v)
+{
+ int g, i;
+ DATA8 *color_lut;
+ int sig_mask = 0;
+
+ for (i = 0; i < v->bits_per_rgb_value; i++) sig_mask |= (0x1 << i);
+ sig_mask <<= (16 - v->bits_per_rgb_value);
+ i = 0;
+ color_lut = malloc(ng);
+ if (!color_lut) return NULL;
+ /* FIXME: remove the round-trip ? */
+ for (g = 0; g < (ng); g++)
+ {
+ xcb_coloritem_t xcl;
+ xcb_coloritem_t xcl_in;
+ int val;
+ xcb_alloc_color_reply_t *rep;
+
+ val = (int)((((double)g) / ((ng) - 1)) * 255);
+ val = (val << 8) | val;
+ xcl.red = (uint16_t)(val);
+ xcl.green = (uint16_t)(val);
+ xcl.blue = (uint16_t)(val);
+ xcl_in = xcl;
+ rep = xcb_alloc_color_reply(conn,
+ xcb_alloc_color_unchecked(conn,
+ cmap,
+ xcl.red,
+ xcl.green,
+ xcl.blue),
+ 0);
+ /* FIXME: XAllocColor tries to approach the color */
+ /* in case the allocation fails */
+ /* XCB does not that (i think). It should be done */
+ /* So if rep == NULL, the other following tests */
+ /* should be always satisfied */
+ if ((!rep) ||
+ ((xcl_in.red & sig_mask) != (xcl.red & sig_mask)) ||
+ ((xcl_in.green & sig_mask) != (xcl.green & sig_mask)) ||
+ ((xcl_in.blue & sig_mask) != (xcl.blue & sig_mask)))
+ {
+ uint32_t pixels[256];
+ int j;
+
+ if (i > 0)
+ {
+ for (j = 0; j < i; j++)
+ pixels[j] = (uint32_t) color_lut[j];
+ xcb_free_colors(conn, cmap, 0, i, pixels);
+ }
+ free(color_lut);
+ return NULL;
+ }
+ color_lut[i] = rep->pixel;
+ i++;
+ free(rep);
+ }
+ return color_lut;
+}
+
+static DATA8 *
+x_color_alloc_rgb_332(xcb_connection_t *conn,
+ xcb_colormap_t cmap,
+ xcb_visualtype_t *v)
+{
+ return x_color_alloc_rgb(8, 8, 4, conn, cmap, v);
+}
+
+static DATA8 *
+x_color_alloc_rgb_666(xcb_connection_t *conn,
+ xcb_colormap_t cmap,
+ xcb_visualtype_t *v)
+{
+ return x_color_alloc_rgb(6, 6, 6, conn, cmap, v);
+}
+
+static DATA8 *
+x_color_alloc_rgb_232(xcb_connection_t *conn,
+ xcb_colormap_t cmap,
+ xcb_visualtype_t *v)
+{
+ return x_color_alloc_rgb(4, 8, 4, conn, cmap, v);
+}
+
+static DATA8 *
+x_color_alloc_rgb_222(xcb_connection_t *conn,
+ xcb_colormap_t cmap,
+ xcb_visualtype_t *v)
+{
+ return x_color_alloc_rgb(4, 4, 4, conn, cmap, v);
+}
+
+static DATA8 *
+x_color_alloc_rgb_221(xcb_connection_t *conn,
+ xcb_colormap_t cmap,
+ xcb_visualtype_t *v)
+{
+ return x_color_alloc_rgb(4, 4, 2, conn, cmap, v);
+}
+
+static DATA8 *
+x_color_alloc_rgb_121(xcb_connection_t *conn,
+ xcb_colormap_t cmap,
+ xcb_visualtype_t *v)
+{
+ return x_color_alloc_rgb(2, 4, 2, conn, cmap, v);
+}
+
+static DATA8 *
+x_color_alloc_rgb_111(xcb_connection_t *conn,
+ xcb_colormap_t cmap,
+ xcb_visualtype_t *v)
+{
+ return x_color_alloc_rgb(2, 2, 2, conn, cmap, v);
+}
+
+static DATA8 *
+x_color_alloc_gray_256(xcb_connection_t *conn,
+ xcb_colormap_t cmap,
+ xcb_visualtype_t *v)
+{
+ return x_color_alloc_gray(256, conn, cmap, v);
+}
+
+static DATA8 *
+x_color_alloc_gray_64(xcb_connection_t *conn,
+ xcb_colormap_t cmap,
+ xcb_visualtype_t *v)
+{
+ return x_color_alloc_gray(64, conn, cmap, v);
+}
+
+static DATA8 *
+x_color_alloc_gray_16(xcb_connection_t *conn,
+ xcb_colormap_t cmap,
+ xcb_visualtype_t *v)
+{
+ return x_color_alloc_gray(32, conn, cmap, v);
+}
+
+static DATA8 *
+x_color_alloc_gray_4(xcb_connection_t *conn,
+ xcb_colormap_t cmap,
+ xcb_visualtype_t *v)
+{
+ return x_color_alloc_gray(16, conn, cmap, v);
+}
+
+static DATA8 *
+x_color_alloc_mono(xcb_connection_t *conn,
+ xcb_colormap_t cmap,
+ xcb_visualtype_t *v)
+{
+ return x_color_alloc_gray(2, conn, cmap, v);
+}
+
+void
+evas_software_xcb_x_color_init(void)
+{
+ static int initialised = 0;
+
+ if (initialised) return;
+ x_color_alloc[PAL_MODE_NONE] = NULL;
+ x_color_count[PAL_MODE_NONE] = 0;
+
+ x_color_alloc[PAL_MODE_MONO] = x_color_alloc_mono;
+ x_color_count[PAL_MODE_MONO] = 2;
+
+ x_color_alloc[PAL_MODE_GRAY4] = x_color_alloc_gray_4;
+ x_color_count[PAL_MODE_GRAY4] = 4;
+
+ x_color_alloc[PAL_MODE_GRAY16] = x_color_alloc_gray_16;
+ x_color_count[PAL_MODE_GRAY16] = 16;
+
+ x_color_alloc[PAL_MODE_GRAY64] = x_color_alloc_gray_64;
+ x_color_count[PAL_MODE_GRAY64] = 64;
+
+ x_color_alloc[PAL_MODE_GRAY256] = x_color_alloc_gray_256;
+ x_color_count[PAL_MODE_GRAY256] = 256;
+
+ x_color_alloc[PAL_MODE_RGB111] = x_color_alloc_rgb_111;
+ x_color_count[PAL_MODE_RGB111] = 2 * 2 * 2;
+
+ x_color_alloc[PAL_MODE_RGB121] = x_color_alloc_rgb_121;
+ x_color_count[PAL_MODE_RGB121] = 2 * 4 * 2;
+
+ x_color_alloc[PAL_MODE_RGB221] = x_color_alloc_rgb_221;
+ x_color_count[PAL_MODE_RGB221] = 4 * 4 * 2;
+
+ x_color_alloc[PAL_MODE_RGB222] = x_color_alloc_rgb_222;
+ x_color_count[PAL_MODE_RGB222] = 4 * 4 * 4;
+
+ x_color_alloc[PAL_MODE_RGB232] = x_color_alloc_rgb_232;
+ x_color_count[PAL_MODE_RGB232] = 4 * 8 * 4;
+
+ x_color_alloc[PAL_MODE_RGB666] = x_color_alloc_rgb_666;
+ x_color_count[PAL_MODE_RGB666] = 6 * 6 * 6;
+
+ x_color_alloc[PAL_MODE_RGB332] = x_color_alloc_rgb_332;
+ x_color_count[PAL_MODE_RGB332] = 8 * 8 * 4;
+
+ x_color_alloc[PAL_MODE_LAST] = NULL;
+ x_color_count[PAL_MODE_LAST] = 0;
+ initialised = 1;
+}
+
+Convert_Pal *
+evas_software_xcb_x_color_allocate(xcb_connection_t *conn,
+ xcb_colormap_t cmap,
+ xcb_visualtype_t *vis,
+ Convert_Pal_Mode colors)
+{
+ Convert_Pal_Priv *palpriv;
+ Convert_Pal *pal;
+ Convert_Pal_Mode c;
+ Eina_List *l;
+
+/* printf("ALLOC cmap=%i vis=%p\n", cmap, vis);*/
+ EINA_LIST_FOREACH(palettes, l, pal)
+ {
+ palpriv = pal->data;
+ if ((conn == palpriv->conn) &&
+ (vis == palpriv->vis) &&
+ (cmap == palpriv->cmap))
+ {
+ pal->references++;
+ return pal;
+ }
+ }
+ pal = calloc(1, sizeof(struct _Convert_Pal));
+ if (!pal) return NULL;
+ for (c = colors; c > PAL_MODE_NONE; c--)
+ {
+ if (x_color_alloc[c])
+ {
+/* printf("TRY PAL %i\n", c);*/
+ pal->lookup = (x_color_alloc[c])(conn, cmap, vis);
+ if (pal->lookup) break;
+ }
+ }
+ pal->references = 1;
+ pal->colors = c;
+ pal->count = x_color_count[c];
+ palpriv = calloc(1, sizeof(Convert_Pal_Priv));
+ pal->data = palpriv;
+ if (!palpriv)
+ {
+ if (pal->lookup) free(pal->lookup);
+ free(pal);
+ return NULL;
+ }
+ palpriv->conn = conn;
+ palpriv->vis = vis;
+ palpriv->cmap = cmap;
+ if (pal->colors == PAL_MODE_NONE)
+ {
+ if (pal->lookup) free(pal->lookup);
+ free(pal);
+ return NULL;
+ }
+ palettes = eina_list_append(palettes, pal);
+ return pal;
+}
+
+void
+evas_software_xcb_x_color_deallocate(xcb_connection_t *conn,
+ xcb_colormap_t cmap,
+ xcb_visualtype_t *vis,
+ Convert_Pal *pal)
+{
+ uint32_t pixels[256];
+ int j;
+
+ pal->references--;
+ if (pal->references > 0) return;
+ if (pal->lookup)
+ {
+ for(j = 0; j < pal->count; j++)
+ pixels[j] = (uint32_t) pal->lookup[j];
+ xcb_free_colors(conn, cmap, 0, pal->count, pixels);
+ free(pal->lookup);
+ }
+ free(pal->data);
+ palettes = eina_list_remove(palettes, pal);
+ free(pal);
+}
--- /dev/null
+#ifndef EVAS_XCB_COLOR_H
+#define EVAS_XCB_COLOR_H
+
+
+void evas_software_xcb_x_color_init (void);
+Convert_Pal *evas_software_xcb_x_color_allocate (xcb_connection_t *conn,
+ xcb_colormap_t cmap,
+ xcb_visualtype_t *vis,
+ Convert_Pal_Mode colors);
+void evas_software_xcb_x_color_deallocate (xcb_connection_t *conn,
+ xcb_colormap_t cmap,
+ xcb_visualtype_t *vis,
+ Convert_Pal *pal);
+
+#endif
--- /dev/null
+#include "evas_common.h"
+#include "evas_engine.h"
+
+void
+evas_software_xcb_x_init(void)
+{
+}
--- /dev/null
+#include <xcb/shm.h>
+#include <xcb/xcb_image.h>
+#include <pixman.h>
+#include <sys/time.h>
+#include <sys/utsname.h>
+
+#include "evas_common.h"
+#include "evas_macros.h"
+#include "evas_xcb_outbuf.h"
+#include "evas_xcb_buffer.h"
+#include "evas_xcb_color.h"
+
+
+typedef struct _Outbuf_Region Outbuf_Region;
+
+struct _Outbuf_Region
+{
+ Xcb_Output_Buffer *xcbob;
+ Xcb_Output_Buffer *mxcbob;
+ int x;
+ int y;
+ int w;
+ int h;
+};
+
+static Eina_List *shmpool = NULL;
+static int shmsize = 0;
+static int shmmemlimit = 10 * 1024 * 1024;
+static int shmcountlimit = 32;
+
+static Xcb_Output_Buffer *
+_find_xcbob(xcb_connection_t *conn, int depth, int w, int h, int shm, void *data)
+{
+ Eina_List *l;
+ Eina_List *xl;
+ Xcb_Output_Buffer *xcbob = NULL;
+ Xcb_Output_Buffer *xcbob2;
+ int fitness = 0x7fffffff;
+ int sz;
+ int lbytes;
+ int bpp;
+
+// return evas_software_xcb_x_output_buffer_new(d, v, depth, w, h, shm, data);
+ if (!shm)
+ return evas_software_xcb_x_output_buffer_new(conn, depth, w, h, shm, data);
+ if (depth > 1)
+ {
+ bpp = depth / 8;
+ if (bpp == 3) bpp = 4;
+ lbytes = (((w * bpp) + 3) / 4) * 4;
+ }
+ else
+ lbytes = ((w + 31) / 32) * 4;
+ sz = lbytes * h;
+ EINA_LIST_FOREACH(shmpool, l, xcbob2)
+ {
+ int szdif;
+
+ if ((xcbob2->image->depth != depth) ||
+ (xcbob2->connection != conn))
+ continue;
+ szdif = xcbob2->psize - sz;
+ if (szdif < 0) continue;
+ if (szdif == 0)
+ {
+ xcbob = xcbob2;
+ xl = l;
+ goto have_xcbob;
+ }
+ if (szdif < fitness)
+ {
+ fitness = szdif;
+ xcbob = xcbob2;
+ xl = l;
+ }
+ }
+ if ((fitness > (100 * 100)) || (!xcbob))
+ return evas_software_xcb_x_output_buffer_new(conn, depth, w, h, shm, data);
+
+ have_xcbob:
+ shmpool = eina_list_remove_list(shmpool, xl);
+ xcbob->w = w;
+ xcbob->h = h;
+ xcbob->bpl = lbytes;
+ xcbob->image->width = xcbob->w;
+ xcbob->image->height = xcbob->h;
+ xcbob->image->stride = xcbob->bpl;
+ shmsize -= xcbob->psize * (xcbob->image->depth / 8);
+ return xcbob;
+}
+
+static void
+_unfind_xcbob(Xcb_Output_Buffer *xcbob, int sync)
+{
+// evas_software_xcb_x_output_buffer_free(xcbob, sync); return;
+ if (xcbob->shm_info)
+ {
+ shmpool = eina_list_prepend(shmpool, xcbob);
+ shmsize += xcbob->psize * xcbob->image->depth / 8;
+ while ((shmsize > (shmmemlimit)) ||
+ (eina_list_count(shmpool) > shmcountlimit))
+ {
+ Eina_List *xl;
+
+ xl = eina_list_last(shmpool);
+ if (!xl)
+ {
+ shmsize = 0;
+ break;
+ }
+ xcbob = xl->data;
+ shmpool = eina_list_remove_list(shmpool, xl);
+ evas_software_xcb_x_output_buffer_free(xcbob, sync);
+ }
+ }
+ else
+ evas_software_xcb_x_output_buffer_free(xcbob, sync);
+}
+
+static void
+_clear_xcbob(int sync)
+{
+ while (shmpool)
+ {
+ Xcb_Output_Buffer *xcbob;
+
+ xcbob = shmpool->data;
+ shmpool = eina_list_remove_list(shmpool, shmpool);
+ evas_software_xcb_x_output_buffer_free(xcbob, sync);
+ }
+ shmsize = 0;
+}
+
+void
+evas_software_xcb_outbuf_init(void)
+{
+}
+
+void
+evas_software_xcb_outbuf_free(Outbuf * buf)
+{
+ while (buf->priv.pending_writes)
+ {
+ RGBA_Image *im;
+ Outbuf_Region *obr;
+
+ im = buf->priv.pending_writes->data;
+ buf->priv.pending_writes = eina_list_remove_list(buf->priv.pending_writes, buf->priv.pending_writes);
+ obr = im->extended_info;
+ 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);
+ }
+ evas_software_xcb_outbuf_idle_flush(buf);
+ evas_software_xcb_outbuf_flush(buf);
+ if (buf->priv.x11.xcb.gc)
+ xcb_free_gc(buf->priv.x11.xcb.conn, buf->priv.x11.xcb.gc);
+ if (buf->priv.x11.xcb.gcm)
+ xcb_free_gc(buf->priv.x11.xcb.conn, buf->priv.x11.xcb.gcm);
+ if (buf->priv.pal)
+ evas_software_xcb_x_color_deallocate(buf->priv.x11.xcb.conn,
+ buf->priv.x11.xcb.cmap,
+ buf->priv.x11.xcb.vis,
+ buf->priv.pal);
+ free(buf);
+ _clear_xcbob(0);
+}
+
+void
+evas_software_xcb_outbuf_rotation_set(Outbuf *buf, int rot)
+{
+ buf->rot = rot;
+}
+
+Outbuf *
+evas_software_xcb_outbuf_setup_x(int w,
+ int h,
+ int rot,
+ Outbuf_Depth depth,
+ xcb_connection_t *conn,
+ xcb_screen_t *screen,
+ xcb_drawable_t draw,
+ xcb_visualtype_t *vis,
+ xcb_colormap_t cmap,
+ int x_depth,
+ int grayscale,
+ int max_colors,
+ xcb_drawable_t mask,
+ int shape_dither,
+ int destination_alpha)
+{
+ Outbuf *buf;
+
+ buf = calloc(1, sizeof(Outbuf));
+ if (!buf)
+ return NULL;
+
+ buf->w = w;
+ buf->h = h;
+ buf->depth = depth;
+ buf->rot = rot;
+
+ buf->priv.x11.xcb.conn = conn;
+ buf->priv.x11.xcb.screen = screen;
+ buf->priv.x11.xcb.vis = vis;
+ buf->priv.x11.xcb.cmap = cmap;
+ buf->priv.x11.xcb.depth = x_depth;
+
+ buf->priv.mask_dither = shape_dither;
+ buf->priv.destination_alpha = destination_alpha;
+
+ {
+ Gfx_Func_Convert conv_func;
+ Xcb_Output_Buffer *xcbob;
+
+ buf->priv.x11.xcb.shm = evas_software_xcb_x_can_do_shm(buf->priv.x11.xcb.conn, buf->priv.x11.xcb.screen);
+ xcbob = evas_software_xcb_x_output_buffer_new(buf->priv.x11.xcb.conn,
+ buf->priv.x11.xcb.depth,
+ 1, 1,
+ buf->priv.x11.xcb.shm, NULL);
+
+ conv_func = NULL;
+ if (xcbob)
+ {
+#ifdef WORDS_BIGENDIAN
+ if (evas_software_xcb_x_output_buffer_byte_order(xcbob) == XCB_IMAGE_ORDER_LSB_FIRST)
+ buf->priv.x11.xcb.swap = 1;
+ if (evas_software_xcb_x_output_buffer_bit_order(xcbob) == XCB_IMAGE_ORDER_MSB_FIRST)
+ buf->priv.x11.xcb.bit_swap = 1;
+#else
+ if (evas_software_xcb_x_output_buffer_byte_order(xcbob) == XCB_IMAGE_ORDER_MSB_FIRST)
+ buf->priv.x11.xcb.swap = 1;
+ if (evas_software_xcb_x_output_buffer_bit_order(xcbob) == XCB_IMAGE_ORDER_MSB_FIRST)
+ buf->priv.x11.xcb.bit_swap = 1;
+#endif
+ if (((vis->_class == XCB_VISUAL_CLASS_TRUE_COLOR) ||
+ (vis->_class == XCB_VISUAL_CLASS_DIRECT_COLOR)) &&
+ (x_depth > 8))
+
+ {
+ buf->priv.mask.r = (DATA32) vis->red_mask;
+ buf->priv.mask.g = (DATA32) vis->green_mask;
+ buf->priv.mask.b = (DATA32) vis->blue_mask;
+ if (buf->priv.x11.xcb.swap)
+ {
+ SWAP32(buf->priv.mask.r);
+ SWAP32(buf->priv.mask.g);
+ SWAP32(buf->priv.mask.b);
+ }
+ }
+ else if ((vis->_class == XCB_VISUAL_CLASS_STATIC_GRAY) ||
+ (vis->_class == XCB_VISUAL_CLASS_GRAY_SCALE) ||
+ (vis->_class == XCB_VISUAL_CLASS_STATIC_COLOR) ||
+ (vis->_class == XCB_VISUAL_CLASS_PSEUDO_COLOR) ||
+ (x_depth <= 8))
+ {
+ Convert_Pal_Mode pm = PAL_MODE_RGB332;
+
+ if ((vis->_class == XCB_VISUAL_CLASS_GRAY_SCALE) ||
+ (vis->_class == XCB_VISUAL_CLASS_STATIC_GRAY))
+ grayscale = 1;
+ if (grayscale)
+ {
+ if (max_colors >= 256)
+ pm = PAL_MODE_GRAY256;
+ else if (max_colors >= 64)
+ pm = PAL_MODE_GRAY64;
+ else if (max_colors >= 16)
+ pm = PAL_MODE_GRAY16;
+ else if (max_colors >= 4)
+ pm = PAL_MODE_GRAY4;
+ else
+ pm = PAL_MODE_MONO;
+ }
+ else
+ {
+ if (max_colors >= 256)
+ pm = PAL_MODE_RGB332;
+ else if (max_colors >= 216)
+ pm = PAL_MODE_RGB666;
+ else if (max_colors >= 128)
+ pm = PAL_MODE_RGB232;
+ else if (max_colors >= 64)
+ pm = PAL_MODE_RGB222;
+ else if (max_colors >= 32)
+ pm = PAL_MODE_RGB221;
+ else if (max_colors >= 16)
+ pm = PAL_MODE_RGB121;
+ else if (max_colors >= 8)
+ pm = PAL_MODE_RGB111;
+ else if (max_colors >= 4)
+ pm = PAL_MODE_GRAY4;
+ else
+ pm = PAL_MODE_MONO;
+ }
+ /* FIXME: only alloc once per display+cmap */
+ buf->priv.pal =
+ evas_software_xcb_x_color_allocate(conn,
+ cmap,
+ vis,
+ PAL_MODE_RGB666);
+ if (!buf->priv.pal)
+ {
+ free(buf);
+ return NULL;
+ }
+ }
+ if (buf->priv.pal)
+ {
+ if (buf->rot == 0 || buf->rot == 180)
+ conv_func = evas_common_convert_func_get(0,
+ buf->w,
+ buf->h,
+ evas_software_xcb_x_output_buffer_depth (xcbob),
+ buf->priv.mask.r,
+ buf->priv.mask.g,
+ buf->priv.mask.b,
+ buf->priv.pal->colors,
+ buf->rot);
+ else if (buf->rot == 90 || buf->rot == 270)
+ conv_func = evas_common_convert_func_get(0,
+ buf->h,
+ buf->w,
+ evas_software_xcb_x_output_buffer_depth (xcbob),
+ buf->priv.mask.r,
+ buf->priv.mask.g,
+ buf->priv.mask.b,
+ buf->priv.pal->colors,
+ buf->rot);
+ }
+ else
+ {
+ if (buf->rot == 0 || buf->rot == 180)
+ conv_func = evas_common_convert_func_get(0,
+ buf->w,
+ buf->h,
+ evas_software_xcb_x_output_buffer_depth(xcbob),
+ buf->priv.mask.r,
+ buf->priv.mask.g,
+ buf->priv.mask.b,
+ PAL_MODE_NONE,
+ buf->rot);
+ else if (buf->rot == 90 || buf->rot == 270)
+ conv_func = evas_common_convert_func_get(0,
+ buf->h,
+ buf->w,
+ evas_software_xcb_x_output_buffer_depth(xcbob),
+ buf->priv.mask.r,
+ buf->priv.mask.g,
+ buf->priv.mask.b,
+ PAL_MODE_NONE,
+ buf->rot);
+ }
+ evas_software_xcb_x_output_buffer_free(xcbob, 1);
+ if (!conv_func)
+ {
+ printf(".[ Evas Error ].\n"
+ " {\n"
+ " At depth %i:\n"
+ " RGB format mask: %08x, %08x, %08x\n"
+ " Palette mode: %i\n"
+ " Not supported by and compiled in converters!\n"
+ " }\n",
+ buf->priv.x11.xcb.depth,
+ buf->priv.mask.r,
+ buf->priv.mask.g,
+ buf->priv.mask.b,
+ buf->priv.pal->colors);
+ }
+ }
+ evas_software_xcb_outbuf_drawable_set(buf, draw);
+ evas_software_xcb_outbuf_mask_set(buf, mask);
+ }
+
+ return buf;
+}
+
+RGBA_Image *
+evas_software_xcb_outbuf_new_region_for_update(Outbuf *buf,
+ int x,
+ int y,
+ int w,
+ int h,
+ int *cx,
+ int *cy,
+ int *cw,
+ int *ch)
+{
+ RGBA_Image *im;
+ Outbuf_Region *obr;
+ int bpl = 0;
+ int use_shm = 1;
+ int alpha;
+
+ if ((buf->onebuf) && (buf->priv.x11.xcb.shm))
+ {
+ Evas_Rectangle *rect;
+
+ rect = malloc(sizeof(Evas_Rectangle));
+ RECTS_CLIP_TO_RECT(x, y, w, h, 0, 0, buf->w, buf->h);
+ rect->x = x;
+ rect->y = y;
+ rect->w = w;
+ rect->h = h;
+ buf->priv.onebuf_regions = eina_list_append(buf->priv.onebuf_regions, rect);
+ if (buf->priv.onebuf)
+ {
+ *cx = x;
+ *cy = y;
+ *cw = w;
+ *ch = h;
+ if (!buf->priv.synced)
+ {
+ /* we sync */
+ free(xcb_get_input_focus_reply(buf->priv.x11.xcb.conn, xcb_get_input_focus_unchecked(buf->priv.x11.xcb.conn), NULL));
+ buf->priv.synced = 1;
+ }
+ if ((buf->priv.x11.xcb.mask) || (buf->priv.destination_alpha))
+ {
+ int yy;
+
+ im = buf->priv.onebuf;
+ for (yy = y; yy < (y + h); yy++)
+ {
+ memset(im->image.data + (im->cache_entry.w * yy) + x,
+ 0, w * sizeof(DATA32));
+ }
+ }
+ return buf->priv.onebuf;
+ }
+ obr = calloc(1, sizeof(Outbuf_Region));
+ obr->x = 0;
+ obr->y = 0;
+ obr->w = buf->w;
+ obr->h = buf->h;
+ *cx = x;
+ *cy = y;
+ *cw = w;
+ *ch = h;
+
+ alpha = ((buf->priv.x11.xcb.mask) || (buf->priv.destination_alpha));
+
+ use_shm = buf->priv.x11.xcb.shm;
+ if ((buf->rot == 0) &&
+ (buf->priv.mask.r == 0xff0000) &&
+ (buf->priv.mask.g == 0x00ff00) &&
+ (buf->priv.mask.b == 0x0000ff))
+ {
+ obr->xcbob = evas_software_xcb_x_output_buffer_new(buf->priv.x11.xcb.conn,
+ buf->priv.x11.xcb.depth,
+ buf->w, buf->h,
+ use_shm,
+ NULL);
+ 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.x11.xcb.mask)
+ obr->mxcbob = evas_software_xcb_x_output_buffer_new(buf->priv.x11.xcb.conn,
+ 1,
+ buf->w, buf->h,
+ use_shm,
+ NULL);
+ }
+ else
+ {
+ 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.x11.xcb.conn,
+ buf->priv.x11.xcb.depth,
+ buf->w, buf->h,
+ use_shm,
+ NULL);
+ else if ((buf->rot == 90) || (buf->rot == 270))
+ obr->xcbob = evas_software_xcb_x_output_buffer_new(buf->priv.x11.xcb.conn,
+ buf->priv.x11.xcb.depth,
+ buf->h, buf->w,
+ use_shm,
+ NULL);
+ if (buf->priv.x11.xcb.mask)
+ obr->mxcbob = evas_software_xcb_x_output_buffer_new(buf->priv.x11.xcb.conn,
+ 1, buf->w, buf->h,
+ use_shm,
+ NULL);
+ }
+ if (alpha)
+ /* FIXME: faster memset! */
+ memset(im->image.data, 0, w * h * sizeof(DATA32));
+
+ buf->priv.onebuf = im;
+ return im;
+ }
+
+
+ obr = calloc(1, sizeof(Outbuf_Region));
+ obr->x = x;
+ obr->y = y;
+ obr->w = w;
+ obr->h = h;
+ *cx = 0;
+ *cy = 0;
+ *cw = w;
+ *ch = h;
+
+ use_shm = buf->priv.x11.xcb.shm;
+ /* FIXME: magic - i found if shm regions are smaller than 200x200 its
+ * faster to use ximages over unix sockets - trial and error
+ */
+// use_shm = 0; /* 630 -> 1006 fps */
+// if ((w * h) < (200 * 200)) use_shm = 0; /* 630 -> 962 fps */
+
+ alpha = ((buf->priv.x11.xcb.mask) || (buf->priv.destination_alpha));
+
+ if ((buf->rot == 0) &&
+ (buf->priv.mask.r == 0xff0000) &&
+ (buf->priv.mask.g == 0x00ff00) &&
+ (buf->priv.mask.b == 0x0000ff))
+ {
+ obr->xcbob = _find_xcbob(buf->priv.x11.xcb.conn,
+ buf->priv.x11.xcb.depth,
+ w, h,
+ use_shm,
+ NULL);
+ 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.x11.xcb.mask)
+ obr->mxcbob = _find_xcbob(buf->priv.x11.xcb.conn,
+ 1, w, h,
+ use_shm,
+ NULL);
+/* obr->mxcbob = evas_software_xcb_x_output_buffer_new(buf->priv.x11.xcb.conn, */
+/* 1, */
+/* w, */
+/* h, */
+/* use_shm, */
+/* NULL); */
+ }
+ else
+ {
+ 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))
+ obr->xcbob = _find_xcbob(buf->priv.x11.xcb.conn,
+ buf->priv.x11.xcb.depth,
+ w, h,
+ use_shm,
+ NULL);
+/* obr->xcbob = evas_software_xcb_x_output_buffer_new(buf->priv.x11.xcb.conn, */
+/* buf->priv.x11.xcb.depth, */
+/* w, */
+/* h, */
+/* use_shm, */
+/* NULL); */
+ else if ((buf->rot == 90) || (buf->rot == 270))
+ obr->xcbob = _find_xcbob(buf->priv.x11.xcb.conn,
+ buf->priv.x11.xcb.depth,
+ h, w,
+ use_shm,
+ NULL);
+/* obr->xcbob = evas_software_xcb_x_output_buffer_new(buf->priv.x11.xcb.conn, */
+/* buf->priv.x11.xcb.depth, */
+/* h, */
+/* w, */
+/* use_shm, */
+/* NULL); */
+ if (buf->priv.x11.xcb.mask)
+ obr->mxcbob = _find_xcbob(buf->priv.x11.xcb.conn,
+ 1, w, h,
+ use_shm,
+ NULL);
+/* obr->mxcbob = evas_software_xcb_x_output_buffer_new(buf->priv.x11.xcb.conn, */
+/* 1, */
+/* w, */
+/* h, */
+/* use_shm, */
+/* NULL); */
+ }
+ if ((buf->priv.x11.xcb.mask) || (buf->priv.destination_alpha))
+ /* FIXME: faster memset! */
+ memset(im->image.data, 0, w * h * sizeof(DATA32));
+
+ buf->priv.pending_writes = eina_list_append(buf->priv.pending_writes, im);
+ return im;
+}
+
+void
+evas_software_xcb_outbuf_free_region_for_update(Outbuf *buf,
+ RGBA_Image *update)
+{
+ /* no need to do anything - they are cleaned up on flush */
+}
+
+void
+evas_software_xcb_outbuf_flush(Outbuf *buf)
+{
+ Eina_List *l;
+ RGBA_Image *im;
+ Outbuf_Region *obr;
+
+
+ if ((buf->priv.onebuf) && (buf->priv.onebuf_regions))
+ {
+ pixman_region16_t tmpr;
+
+ im = buf->priv.onebuf;
+ obr = im->extended_info;
+ pixman_region_init(&tmpr);
+ while (buf->priv.onebuf_regions)
+ {
+ Evas_Rectangle *rect;
+
+ rect = buf->priv.onebuf_regions->data;
+ buf->priv.onebuf_regions = eina_list_remove_list(buf->priv.onebuf_regions, buf->priv.onebuf_regions);
+ pixman_region_union_rect(&tmpr, &tmpr,
+ rect->x, rect->y,
+ rect->w, rect->h);
+ if (buf->priv.debug)
+ evas_software_xcb_outbuf_debug_show(buf, buf->priv.x11.xcb.win,
+ rect->x, rect->y, rect->w, rect->h);
+ free(rect);
+ }
+ xcb_set_clip_rectangles(buf->priv.x11.xcb.conn, XCB_CLIP_ORDERING_YX_BANDED,
+ buf->priv.x11.xcb.gc,
+ 0, 0, pixman_region_n_rects(&tmpr),
+ (const xcb_rectangle_t *)pixman_region_rectangles(&tmpr, NULL));
+ evas_software_xcb_x_output_buffer_paste(obr->xcbob, buf->priv.x11.xcb.win,
+ buf->priv.x11.xcb.gc,
+ 0, 0, 0);
+ if (obr->mxcbob)
+ {
+ xcb_set_clip_rectangles(buf->priv.x11.xcb.conn, XCB_CLIP_ORDERING_YX_BANDED,
+ buf->priv.x11.xcb.gcm,
+ 0, 0, pixman_region_n_rects(&tmpr),
+ (const xcb_rectangle_t *)pixman_region_rectangles(&tmpr, NULL));
+ evas_software_xcb_x_output_buffer_paste(obr->mxcbob,
+ buf->priv.x11.xcb.mask,
+ buf->priv.x11.xcb.gcm,
+ 0, 0, 0);
+ }
+ buf->priv.synced = 0;
+ }
+ else
+ {
+#if 1
+ /* we sync */
+ free(xcb_get_input_focus_reply(buf->priv.x11.xcb.conn, xcb_get_input_focus_unchecked(buf->priv.x11.xcb.conn), NULL));
+ EINA_LIST_FOREACH(buf->priv.pending_writes, l, im)
+ {
+ obr = im->extended_info;
+ if (buf->priv.debug)
+ evas_software_xcb_outbuf_debug_show(buf,
+ buf->priv.x11.xcb.win,
+ obr->x,
+ obr->y,
+ obr->w,
+ obr->h);
+ evas_software_xcb_x_output_buffer_paste(obr->xcbob,
+ buf->priv.x11.xcb.win,
+ buf->priv.x11.xcb.gc,
+ obr->x,
+ obr->y, 0);
+ if (obr->mxcbob)
+ evas_software_xcb_x_output_buffer_paste(obr->mxcbob,
+ buf->priv.x11.xcb.mask,
+ buf->priv.x11.xcb.gcm,
+ obr->x,
+ obr->y, 0);
+ }
+ while (buf->priv.pending_writes)
+ {
+ im = buf->priv.pending_writes->data;
+ buf->priv.pending_writes = eina_list_remove_list(buf->priv.pending_writes,
+ buf->priv.pending_writes);
+ obr = im->extended_info;
+ 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); */
+/* if (obr->mxcbob) evas_software_xcb_x_output_buffer_free(obr->mxcbob, 0); */
+ free(obr);
+ }
+ buf->priv.prev_pending_writes = buf->priv.pending_writes;
+ buf->priv.pending_writes = NULL;
+ xcb_flush(buf->priv.x11.xcb.conn);
+#else
+ /* XX async push - disable */
+ /*
+ EINA_LIST_FOREACH(buf->priv.pending_writes, l, im)
+ {
+ obr = im->extended_info;
+ if (buf->priv.debug)
+ evas_software_x11_outbuf_debug_show(buf, buf->priv.x11.xcb.win,
+ obr->x, obr->y, obr->w, obr->h);
+ evas_software_x11_x_output_buffer_paste(obr->xcbob, buf->priv.x11.xcb.win,
+ buf->priv.x11.xcb.gc,
+ obr->x, obr->y, 0);
+ if (obr->mxcbob)
+ evas_software_x11_x_output_buffer_paste(obr->mxcbob,
+ buf->priv.x11.xcb.mask,
+ buf->priv.x11.xcb.gcm,
+ obr->x, obr->y, 0);
+ }
+ */
+ /* we sync */
+ free(xcb_get_input_focus_reply(buf->priv.x11.xcb.conn, xcb_get_input_focus_unchecked(buf->priv.x11.xcb.conn), NULL));
+
+ while (buf->priv.pending_writes)
+ {
+ im = eina_list_data_get(buf->priv.pending_writes);
+ buf->priv.pending_writes = eina_list_remove_list(buf->priv.pending_writes, buf->priv.pending_writes);
+ obr = im->extended_info;
+ 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_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
+ }
+ evas_common_cpu_end_opt();
+}
+
+void
+evas_software_xcb_outbuf_idle_flush(Outbuf *buf)
+{
+ if (buf->priv.onebuf)
+ {
+ RGBA_Image *im;
+ Outbuf_Region *obr;
+
+ im = buf->priv.onebuf;
+ buf->priv.onebuf = NULL;
+ obr = im->extended_info;
+ 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
+ {
+ if (buf->priv.prev_pending_writes)
+ free(xcb_get_input_focus_reply(buf->priv.x11.xcb.conn, xcb_get_input_focus_unchecked(buf->priv.x11.xcb.conn), NULL));
+ while (buf->priv.prev_pending_writes)
+ {
+ RGBA_Image *im;
+ Outbuf_Region *obr;
+
+ im = buf->priv.prev_pending_writes->data;
+ buf->priv.prev_pending_writes =
+ 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);
+ if (obr->xcbob) _unfind_xcbob(obr->xcbob, 0);
+ if (obr->mxcbob) _unfind_xcbob(obr->mxcbob, 0);
+ free(obr);
+ }
+ _clear_xcbob(0);
+ }
+}
+
+void
+evas_software_xcb_outbuf_push_updated_region(Outbuf *buf,
+ RGBA_Image *update,
+ int x,
+ int y,
+ int w,
+ int h)
+{
+ Gfx_Func_Convert conv_func = NULL;
+ Outbuf_Region *obr;
+ DATA32 *src_data;
+ void *data;
+ int bpl = 0;
+ int yy;
+
+ obr = update->extended_info;
+ if (buf->priv.pal)
+ {
+ if ((buf->rot == 0) || (buf->rot == 180))
+ conv_func = evas_common_convert_func_get(0, w, h,
+ evas_software_xcb_x_output_buffer_depth
+ (obr->xcbob), buf->priv.mask.r,
+ buf->priv.mask.g, buf->priv.mask.b,
+ buf->priv.pal->colors, buf->rot);
+ else if ((buf->rot == 90) || (buf->rot == 270))
+ conv_func = evas_common_convert_func_get(0, h, w,
+ evas_software_xcb_x_output_buffer_depth
+ (obr->xcbob), buf->priv.mask.r,
+ buf->priv.mask.g, buf->priv.mask.b,
+ buf->priv.pal->colors, buf->rot);
+ }
+ else
+ {
+ if ((buf->rot == 0) || (buf->rot == 180))
+ conv_func = evas_common_convert_func_get(0, w, h,
+ evas_software_xcb_x_output_buffer_depth
+ (obr->xcbob), buf->priv.mask.r,
+ buf->priv.mask.g, buf->priv.mask.b,
+ PAL_MODE_NONE, buf->rot);
+ else if ((buf->rot == 90) || (buf->rot == 270))
+ conv_func = evas_common_convert_func_get(0, h, w,
+ evas_software_xcb_x_output_buffer_depth
+ (obr->xcbob), buf->priv.mask.r,
+ buf->priv.mask.g, buf->priv.mask.b,
+ PAL_MODE_NONE, buf->rot);
+ }
+ if (!conv_func) return;
+
+ data = evas_software_xcb_x_output_buffer_data(obr->xcbob, &bpl);
+ src_data = update->image.data;
+ if (buf->rot == 0)
+ {
+ obr->x = x;
+ obr->y = y;
+ }
+ else if (buf->rot == 90)
+ {
+ obr->x = y;
+ obr->y = buf->w - x - w;
+ }
+ else if (buf->rot == 180)
+ {
+ obr->x = buf->w - x - w;
+ obr->y = buf->h - y - h;
+ }
+ else if (buf->rot == 270)
+ {
+ obr->x = buf->h - y - h;
+ obr->y = x;
+ }
+ if ((buf->rot == 0) || (buf->rot == 180))
+ {
+ obr->w = w;
+ obr->h = h;
+ }
+ else if ((buf->rot == 90) || (buf->rot == 270))
+ {
+ obr->w = h;
+ obr->h = w;
+ }
+ if (buf->priv.pal)
+ {
+ if (data != src_data)
+ conv_func(src_data, data,
+ 0,
+ bpl /
+ ((evas_software_xcb_x_output_buffer_depth(obr->xcbob) / 8)) - obr->w,
+ obr->w, obr->h, x, y,
+ buf->priv.pal->lookup);
+ }
+ else
+ {
+ if (data != src_data)
+ conv_func(src_data, data,
+ 0,
+ bpl /
+ ((evas_software_xcb_x_output_buffer_depth(obr->xcbob) / 8)) - obr->w,
+ obr->w, obr->h, x, y, NULL);
+ }
+#if 1
+#else
+ /* XX async push */
+ if (!((buf->priv.onebuf) && (buf->priv.onebuf_regions)))
+ {
+ if (buf->priv.debug)
+ evas_software_xcb_outbuf_debug_show(buf, buf->priv.x11.xcb.win,
+ obr->x, obr->y, obr->w, obr->h);
+ evas_software_xcb_x_output_buffer_paste(obr->xcbob, buf->priv.x11.xcb.win,
+ buf->priv.x11.xcb.gc,
+ obr->x, obr->y, 0);
+ }
+#endif
+ if (obr->mxcbob)
+ {
+ 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);
+#if 1
+#else
+ /* XX async push */
+ if (!((buf->priv.onebuf) && (buf->priv.onebuf_regions)))
+ evas_software_xcb_x_output_buffer_paste(obr->mxcbob,
+ buf->priv.x11.xcb.mask,
+ buf->priv.x11.xcb.gcm,
+ obr->x, obr->y, 0);
+#endif
+ }
+#if 1
+#else
+ xcb_flush(buf->priv.x11.xcb.conn);
+#endif
+}
+
+void
+evas_software_xcb_outbuf_reconfigure(Outbuf *buf,
+ int w,
+ int h,
+ int rot,
+ Outbuf_Depth depth)
+{
+ if ((w == buf->w) &&
+ (h == buf->h) &&
+ (rot == buf->rot) &&
+ (depth == buf->depth)) return;
+ buf->w = w;
+ buf->h = h;
+ buf->rot = rot;
+ evas_software_xcb_outbuf_idle_flush(buf);
+}
+
+int
+evas_software_xcb_outbuf_get_width(Outbuf * buf)
+{
+ return buf->w;
+}
+
+int
+evas_software_xcb_outbuf_get_height(Outbuf * buf)
+{
+ return buf->h;
+}
+
+Outbuf_Depth
+evas_software_xcb_outbuf_get_depth(Outbuf * buf)
+{
+ return buf->depth;
+}
+
+int
+evas_software_xcb_outbuf_get_rot(Outbuf * buf)
+{
+ return buf->rot;
+}
+
+void
+evas_software_xcb_outbuf_drawable_set(Outbuf *buf,
+ xcb_drawable_t draw)
+{
+ if (buf->priv.x11.xcb.win == draw) return;
+ if (buf->priv.x11.xcb.gc)
+ {
+ xcb_free_gc(buf->priv.x11.xcb.conn, buf->priv.x11.xcb.gc);
+ buf->priv.x11.xcb.gc = 0;
+ }
+ buf->priv.x11.xcb.win = draw;
+ buf->priv.x11.xcb.gc = xcb_generate_id(buf->priv.x11.xcb.conn);
+ xcb_create_gc(buf->priv.x11.xcb.conn, buf->priv.x11.xcb.gc, buf->priv.x11.xcb.win, 0, NULL);
+}
+
+void
+evas_software_xcb_outbuf_mask_set(Outbuf *buf,
+ xcb_drawable_t mask)
+{
+ if (buf->priv.x11.xcb.mask == mask) return;
+ if (buf->priv.x11.xcb.gcm)
+ {
+ xcb_free_gc(buf->priv.x11.xcb.conn, buf->priv.x11.xcb.gcm);
+ buf->priv.x11.xcb.gcm = 0;
+ }
+ buf->priv.x11.xcb.mask = mask;
+ if (buf->priv.x11.xcb.mask)
+ {
+ buf->priv.x11.xcb.gcm = xcb_generate_id(buf->priv.x11.xcb.conn);
+ xcb_create_gc(buf->priv.x11.xcb.conn, buf->priv.x11.xcb.gcm, buf->priv.x11.xcb.win, 0, NULL);
+ }
+}
+
+void
+evas_software_xcb_outbuf_debug_set(Outbuf *buf,
+ int debug)
+{
+ buf->priv.debug = debug;
+}
+void
+evas_software_xcb_outbuf_debug_show(Outbuf *buf,
+ xcb_drawable_t draw,
+ int x,
+ int y,
+ int w,
+ int h)
+{
+ int i;
+ xcb_screen_t *screen = NULL;
+
+ {
+ xcb_get_geometry_reply_t *geom;
+ xcb_drawable_t root;
+ xcb_screen_iterator_t i;
+
+ geom = xcb_get_geometry_reply (buf->priv.x11.xcb.conn, xcb_get_geometry_unchecked(buf->priv.x11.xcb.conn, draw), 0);
+ root = geom->root;
+ free (geom);
+ geom = xcb_get_geometry_reply (buf->priv.x11.xcb.conn, xcb_get_geometry_unchecked(buf->priv.x11.xcb.conn, root), 0);
+
+ i = xcb_setup_roots_iterator((xcb_setup_t *)xcb_get_setup(buf->priv.x11.xcb.conn));
+ for (; i.rem; xcb_screen_next(&i))
+ if (i.data->root == geom->root)
+ {
+ screen = i.data;
+ break;
+ }
+ free (geom);
+ }
+ for (i = 0; i < 20; i++)
+ {
+/* xcb_image_t *image; */
+ xcb_rectangle_t rect = { x, y, w, h};
+ uint32_t mask;
+ uint32_t value[2];
+
+ mask = XCB_GC_FOREGROUND | XCB_GC_GRAPHICS_EXPOSURES;
+ value[0] = screen->black_pixel;
+ value[1] = XCB_EXPOSURES_NOT_ALLOWED; /* no graphics exposures allowed */
+ xcb_change_gc(buf->priv.x11.xcb.conn, buf->priv.x11.xcb.gc, mask, value);
+ xcb_poly_fill_rectangle (buf->priv.x11.xcb.conn, draw, buf->priv.x11.xcb.gc, 1, &rect);
+ /* we sync */
+ free(xcb_get_input_focus_reply(buf->priv.x11.xcb.conn, xcb_get_input_focus_unchecked(buf->priv.x11.xcb.conn), NULL));
+// image = xcb_image_get(buf->priv.x11.xcb.conn, draw, x, y, w, h, XCB_ALL_PLANES, XCB_IMAGE_FORMAT_Z_PIXMAP);
+// if (image)
+// xcb_image_destroy(image);
+ /* we sync */
+ free(xcb_get_input_focus_reply(buf->priv.x11.xcb.conn, xcb_get_input_focus_unchecked(buf->priv.x11.xcb.conn), NULL));
+ mask = XCB_GC_FOREGROUND | XCB_GC_GRAPHICS_EXPOSURES;
+ value[0] = screen->white_pixel;
+ value[1] = XCB_EXPOSURES_NOT_ALLOWED; /* no graphics exposures allowed */
+ xcb_change_gc(buf->priv.x11.xcb.conn, buf->priv.x11.xcb.gc, mask, value);
+ xcb_poly_fill_rectangle (buf->priv.x11.xcb.conn, draw, buf->priv.x11.xcb.gc, 1, &rect);
+ /* we sync */
+ free(xcb_get_input_focus_reply(buf->priv.x11.xcb.conn, xcb_get_input_focus_unchecked(buf->priv.x11.xcb.conn), NULL));
+// image = xcb_image_get(buf->priv.x11.xcb.conn, draw, x, y, w, h, XCB_ALL_PLANES, XCB_IMAGE_FORMAT_Z_PIXMAP);
+// if (image)
+// xcb_image_destroy(image);
+ /* we sync */
+ free(xcb_get_input_focus_reply(buf->priv.x11.xcb.conn, xcb_get_input_focus_unchecked(buf->priv.x11.xcb.conn), NULL));
+ }
+}
--- /dev/null
+#ifndef EVAS_XCB_OUTBUF_H
+#define EVAS_XCB_OUTBUF_H
+
+
+#include "evas_engine.h"
+
+
+void evas_software_xcb_outbuf_init (void);
+
+void evas_software_xcb_outbuf_free (Outbuf *buf);
+
+Outbuf *evas_software_xcb_outbuf_setup_x (int w,
+ int h,
+ int rot,
+ Outbuf_Depth depth,
+ xcb_connection_t *conn,
+ xcb_screen_t *screen,
+ xcb_drawable_t draw,
+ xcb_visualtype_t *vis,
+ xcb_colormap_t cmap,
+ int x_depth,
+ int grayscale,
+ int max_colors,
+ xcb_drawable_t mask,
+ int shape_dither,
+ int destination_alpha);
+
+
+RGBA_Image *evas_software_xcb_outbuf_new_region_for_update (Outbuf *buf,
+ int x,
+ int y,
+ int w,
+ int h,
+ int *cx,
+ int *cy,
+ int *cw,
+ int *ch);
+
+void evas_software_xcb_outbuf_free_region_for_update (Outbuf *buf,
+ RGBA_Image *update);
+
+void evas_software_xcb_outbuf_flush (Outbuf *buf);
+
+void evas_software_xcb_outbuf_idle_flush (Outbuf *buf);
+
+void evas_software_xcb_outbuf_push_updated_region (Outbuf *buf,
+ RGBA_Image *update,
+ int x,
+ int y,
+ int w,
+ int h);
+
+void evas_software_xcb_outbuf_reconfigure (Outbuf *buf,
+ int w,
+ int h,
+ int rot,
+ Outbuf_Depth depth);
+
+int evas_software_xcb_outbuf_get_width (Outbuf *buf);
+
+int evas_software_xcb_outbuf_get_height (Outbuf *buf);
+
+Outbuf_Depth evas_software_xcb_outbuf_get_depth (Outbuf *buf);
+
+int evas_software_xcb_outbuf_get_rot (Outbuf *buf);
+
+void evas_software_xcb_outbuf_drawable_set (Outbuf *buf,
+ xcb_drawable_t draw);
+
+void evas_software_xcb_outbuf_mask_set (Outbuf *buf,
+ xcb_drawable_t mask);
+
+void evas_software_xcb_outbuf_rotation_set (Outbuf *buf,
+ int rot);
+
+void evas_software_xcb_outbuf_debug_set (Outbuf *buf,
+ int debug);
+
+void evas_software_xcb_outbuf_debug_show (Outbuf *buf,
+ xcb_drawable_t draw,
+ int x,
+ int y,
+ int w,
+ int h);
+
+#endif
#include "evas_common.h"
-#include "evas_engine.h"
+
+#include "evas_xlib_buffer.h"
static int _x_err = 0;
void
-evas_software_x11_x_write_mask_line(Outbuf *buf, X_Output_Buffer *xob, DATA32 *src, int w, int y)
+evas_software_xlib_x_write_mask_line(Outbuf *buf, X_Output_Buffer *xob, DATA32 *src, int w, int y)
{
int x;
DATA32 *src_ptr;
int bpl = 0;
src_ptr = src;
- dst_ptr = evas_software_x11_x_output_buffer_data(xob, &bpl);
+ dst_ptr = evas_software_xlib_x_output_buffer_data(xob, &bpl);
dst_ptr = dst_ptr + (bpl * y);
w -= 7;
- if (buf->priv.x.bit_swap)
+ if (buf->priv.x11.xlib.bit_swap)
{
for (x = 0; x < w; x += 8)
{
}
int
-evas_software_x11_x_can_do_shm(Display *d)
+evas_software_xlib_x_can_do_shm(Display *d)
{
static Display *cached_d = NULL;
static int cached_result = 0;
{
X_Output_Buffer *xob;
- xob = evas_software_x11_x_output_buffer_new
+ xob = evas_software_xlib_x_output_buffer_new
(d, DefaultVisual(d, DefaultScreen(d)),
DefaultDepth(d, DefaultScreen(d)), 16, 16, 2, NULL);
if (!xob)
cached_result = 0;
return 0;
}
- evas_software_x11_x_output_buffer_free(xob, 1);
+ evas_software_xlib_x_output_buffer_free(xob, 1);
cached_result = 1;
return 1;
}
//static int creates = 0;
X_Output_Buffer *
-evas_software_x11_x_output_buffer_new(Display *d, Visual *v, int depth, int w, int h, int try_shm, void *data)
+evas_software_xlib_x_output_buffer_new(Display *d, Visual *v, int depth, int w, int h, int try_shm, void *data)
{
X_Output_Buffer *xob;
}
void
-evas_software_x11_x_output_buffer_free(X_Output_Buffer *xob, int sync)
+evas_software_xlib_x_output_buffer_free(X_Output_Buffer *xob, int sync)
{
if (xob->shm_info)
{
}
void
-evas_software_x11_x_output_buffer_paste(X_Output_Buffer *xob, Drawable d, GC gc, int x, int y, int sync)
+evas_software_xlib_x_output_buffer_paste(X_Output_Buffer *xob, Drawable d, GC gc, int x, int y, int sync)
{
if (xob->shm_info)
{
}
DATA8 *
-evas_software_x11_x_output_buffer_data(X_Output_Buffer *xob, int *bytes_per_line_ret)
+evas_software_xlib_x_output_buffer_data(X_Output_Buffer *xob, int *bytes_per_line_ret)
{
if (bytes_per_line_ret) *bytes_per_line_ret = xob->xim->bytes_per_line;
- return xob->xim->data;
+ return (DATA8 *)xob->xim->data;
}
int
-evas_software_x11_x_output_buffer_depth(X_Output_Buffer *xob)
+evas_software_xlib_x_output_buffer_depth(X_Output_Buffer *xob)
{
return xob->xim->bits_per_pixel;
}
int
-evas_software_x11_x_output_buffer_byte_order(X_Output_Buffer *xob)
+evas_software_xlib_x_output_buffer_byte_order(X_Output_Buffer *xob)
{
return xob->xim->byte_order;
}
int
-evas_software_x11_x_output_buffer_bit_order(X_Output_Buffer *xob)
+evas_software_xlib_x_output_buffer_bit_order(X_Output_Buffer *xob)
{
return xob->xim->bitmap_bit_order;
}
--- /dev/null
+#ifndef EVAS_XLIB_BUFFER_H
+#define EVAS_XLIB_BUFFER_H
+
+
+#include "evas_engine.h"
+
+
+typedef struct _X_Output_Buffer X_Output_Buffer;
+
+struct _X_Output_Buffer
+{
+ Display *display;
+ XImage *xim;
+ XShmSegmentInfo *shm_info;
+ Visual *visual;
+ void *data;
+ int w;
+ int h;
+ int bpl;
+ int psize;
+};
+
+void evas_software_xlib_x_write_mask_line (Outbuf *buf, X_Output_Buffer *xob, DATA32 *src, int w, int y);
+
+int evas_software_xlib_x_can_do_shm (Display *d);
+
+X_Output_Buffer *evas_software_xlib_x_output_buffer_new (Display *d, Visual *v, int depth, int w, int h, int try_shm, void *data);
+
+void evas_software_xlib_x_output_buffer_free (X_Output_Buffer *xob, int sync);
+
+void evas_software_xlib_x_output_buffer_paste (X_Output_Buffer *xob, Drawable d, GC gc, int x, int y, int sync);
+
+DATA8 *evas_software_xlib_x_output_buffer_data (X_Output_Buffer *xob, int *bytes_per_line_ret);
+
+int evas_software_xlib_x_output_buffer_depth (X_Output_Buffer *xob);
+
+int evas_software_xlib_x_output_buffer_byte_order (X_Output_Buffer *xob);
+
+int evas_software_xlib_x_output_buffer_bit_order (X_Output_Buffer *xob);
+
+
+#endif
#include "evas_common.h"
+
#include "evas_engine.h"
#include <X11/Xlib.h>
if (dg < 0) dg = -dg;
db = (int)xcl_in.blue - (int)xcl.blue;
if (db < 0) db = -db;
-/*
+/*
printf("ASK [%i]: %04x %04x %04x = %04x %04x %04x | dif = %04x / %04x\n",
ret,
xcl_in.red, xcl_in.green, xcl_in.blue,
*/
if ((ret == 0) ||
((dr + dg + db) > delt)
-/*
+/*
||
((xcl_in.red & sig_mask) != (xcl.red & sig_mask)) ||
((xcl_in.green & sig_mask) != (xcl.green & sig_mask)) ||
}
void
-evas_software_x11_x_color_init(void)
+evas_software_xlib_x_color_init(void)
{
static int initialised = 0;
}
Convert_Pal *
-evas_software_x11_x_color_allocate(Display *disp, Colormap cmap, Visual *vis, Convert_Pal_Mode colors)
+evas_software_xlib_x_color_allocate(Display *disp,
+ Colormap cmap,
+ Visual *vis,
+ Convert_Pal_Mode colors)
{
Convert_Pal_Priv *palpriv;
Convert_Pal *pal;
}
void
-evas_software_x11_x_color_deallocate(Display *disp, Colormap cmap, Visual *vis, Convert_Pal *pal)
+evas_software_xlib_x_color_deallocate(Display *disp,
+ Colormap cmap,
+ Visual *vis,
+ Convert_Pal *pal)
{
unsigned long pixels[256];
int j;
--- /dev/null
+#ifndef EVAS_XLIB_COLOR_H
+#define EVAS_XLIB_COLOR_H
+
+void evas_software_xlib_x_color_init (void);
+
+Convert_Pal *evas_software_xlib_x_color_allocate (Display *disp,
+ Colormap cmap,
+ Visual *vis,
+ Convert_Pal_Mode colors);
+
+void evas_software_xlib_x_color_deallocate (Display *disp,
+ Colormap cmap,
+ Visual *vis,
+ Convert_Pal *pal);
+
+#endif
--- /dev/null
+#include "evas_common.h"
+#include "evas_engine.h"
+
+void
+evas_software_xlib_x_init(void)
+{
+}
-#include "evas_common.h"
-#include "evas_engine.h"
-#include "evas_macros.h"
#include <sys/time.h>
#include <sys/utsname.h>
+#include "evas_common.h"
+#include "evas_macros.h"
+#include "evas_xlib_outbuf.h"
+#include "evas_xlib_buffer.h"
+#include "evas_xlib_color.h"
+
+
+typedef struct _Outbuf_Region Outbuf_Region;
+
+struct _Outbuf_Region
+{
+ X_Output_Buffer *xob;
+ X_Output_Buffer *mxob;
+ int x;
+ int y;
+ int w;
+ int h;
+};
+
static Eina_List *shmpool = NULL;
static int shmsize = 0;
static int shmmemlimit = 10 * 1024 * 1024;
static int shmcountlimit = 32;
+
static X_Output_Buffer *
_find_xob(Display *d, Visual *v, int depth, int w, int h, int shm, void *data)
{
X_Output_Buffer *xob2;
int fitness = 0x7fffffff;
int sz, lbytes, bpp;
-
-// return evas_software_x11_x_output_buffer_new(d, v, depth, w, h, shm, data);
+
+// return evas_software_xlib_x_output_buffer_new(d, v, depth, w, h, shm, data);
if (!shm)
- return evas_software_x11_x_output_buffer_new(d, v, depth, w, h, shm, data);
+ return evas_software_xlib_x_output_buffer_new(d, v, depth, w, h, shm, data);
if (depth > 1)
{
bpp = depth / 8;
}
}
if ((fitness > (100 * 100)) || (!xob))
- return evas_software_x11_x_output_buffer_new(d, v, depth, w, h, shm, data);
-
+ return evas_software_xlib_x_output_buffer_new(d, v, depth, w, h, shm, data);
+
have_xob:
shmpool = eina_list_remove_list(shmpool, xl);
xob->w = w;
static void
_unfind_xob(X_Output_Buffer *xob, int sync)
{
-// evas_software_x11_x_output_buffer_free(xob, sync); return;
+// evas_software_xlib_x_output_buffer_free(xob, sync); return;
if (xob->shm_info)
{
shmpool = eina_list_prepend(shmpool, xob);
(eina_list_count(shmpool) > shmcountlimit))
{
Eina_List *xl;
-
+
xl = eina_list_last(shmpool);
if (!xl)
{
}
xob = xl->data;
shmpool = eina_list_remove_list(shmpool, xl);
- evas_software_x11_x_output_buffer_free(xob, sync);
+ evas_software_xlib_x_output_buffer_free(xob, sync);
}
}
- else
- evas_software_x11_x_output_buffer_free(xob, sync);
+ else
+ evas_software_xlib_x_output_buffer_free(xob, sync);
}
static void
while (shmpool)
{
X_Output_Buffer *xob;
-
+
xob = shmpool->data;
shmpool = eina_list_remove_list(shmpool, shmpool);
- evas_software_x11_x_output_buffer_free(xob, sync);
+ evas_software_xlib_x_output_buffer_free(xob, sync);
}
shmsize = 0;
}
void
-evas_software_x11_outbuf_init(void)
+evas_software_xlib_outbuf_init(void)
{
}
void
-evas_software_x11_outbuf_free(Outbuf *buf)
+evas_software_xlib_outbuf_free(Outbuf *buf)
{
while (buf->priv.pending_writes)
{
RGBA_Image *im;
Outbuf_Region *obr;
-
+
im = buf->priv.pending_writes->data;
buf->priv.pending_writes = eina_list_remove_list(buf->priv.pending_writes, buf->priv.pending_writes);
obr = im->extended_info;
if (obr->mxob) _unfind_xob(obr->mxob, 0);
free(obr);
}
- evas_software_x11_outbuf_idle_flush(buf);
- evas_software_x11_outbuf_flush(buf);
- if (buf->priv.x.gc)
- XFreeGC(buf->priv.x.disp, buf->priv.x.gc);
- if (buf->priv.x.gcm)
- XFreeGC(buf->priv.x.disp, buf->priv.x.gcm);
+ evas_software_xlib_outbuf_idle_flush(buf);
+ evas_software_xlib_outbuf_flush(buf);
+ if (buf->priv.x11.xlib.gc)
+ XFreeGC(buf->priv.x11.xlib.disp, buf->priv.x11.xlib.gc);
+ if (buf->priv.x11.xlib.gcm)
+ XFreeGC(buf->priv.x11.xlib.disp, buf->priv.x11.xlib.gcm);
if (buf->priv.pal)
- evas_software_x11_x_color_deallocate(buf->priv.x.disp, buf->priv.x.cmap,
- buf->priv.x.vis, buf->priv.pal);
+ evas_software_xlib_x_color_deallocate(buf->priv.x11.xlib.disp, buf->priv.x11.xlib.cmap,
+ buf->priv.x11.xlib.vis, buf->priv.pal);
free(buf);
_clear_xob(0);
}
-void
-evas_software_x11_outbuf_rotation_set(Outbuf *buf, int rot)
-{
- buf->rot = rot;
-}
-
-Outbuf *
-evas_software_x11_outbuf_setup_x(int w, int h, int rot, Outbuf_Depth depth,
+Outbuf *
+evas_software_xlib_outbuf_setup_x(int w, int h, int rot, Outbuf_Depth depth,
Display *disp, Drawable draw, Visual *vis,
Colormap cmap, int x_depth,
int grayscale, int max_colors, Pixmap mask,
buf->depth = depth;
buf->rot = rot;
- buf->priv.x.disp = disp;
- buf->priv.x.vis = vis;
- buf->priv.x.cmap = cmap;
- buf->priv.x.depth = x_depth;
+ buf->priv.x11.xlib.disp = disp;
+ buf->priv.x11.xlib.vis = vis;
+ buf->priv.x11.xlib.cmap = cmap;
+ buf->priv.x11.xlib.depth = x_depth;
buf->priv.mask_dither = shape_dither;
buf->priv.destination_alpha = destination_alpha;
Gfx_Func_Convert conv_func;
X_Output_Buffer *xob;
- buf->priv.x.shm = evas_software_x11_x_can_do_shm(buf->priv.x.disp);
- xob = evas_software_x11_x_output_buffer_new(buf->priv.x.disp,
- buf->priv.x.vis,
- buf->priv.x.depth,
- 1, 1, buf->priv.x.shm, NULL);
+ buf->priv.x11.xlib.shm = evas_software_xlib_x_can_do_shm(buf->priv.x11.xlib.disp);
+ xob = evas_software_xlib_x_output_buffer_new(buf->priv.x11.xlib.disp,
+ buf->priv.x11.xlib.vis,
+ buf->priv.x11.xlib.depth,
+ 1, 1, buf->priv.x11.xlib.shm, NULL);
conv_func = NULL;
if (xob)
{
#ifdef WORDS_BIGENDIAN
- if (evas_software_x11_x_output_buffer_byte_order(xob) == LSBFirst)
- buf->priv.x.swap = 1;
- if (evas_software_x11_x_output_buffer_bit_order(xob) == MSBFirst)
- buf->priv.x.bit_swap = 1;
+ if (evas_software_xlib_x_output_buffer_byte_order(xob) == LSBFirst)
+ buf->priv.x11.xlib.swap = 1;
+ if (evas_software_xlib_x_output_buffer_bit_order(xob) == MSBFirst)
+ buf->priv.x11.xlib.bit_swap = 1;
#else
- if (evas_software_x11_x_output_buffer_byte_order(xob) == MSBFirst)
- buf->priv.x.swap = 1;
- if (evas_software_x11_x_output_buffer_bit_order(xob) == MSBFirst)
- buf->priv.x.bit_swap = 1;
+ if (evas_software_xlib_x_output_buffer_byte_order(xob) == MSBFirst)
+ buf->priv.x11.xlib.swap = 1;
+ if (evas_software_xlib_x_output_buffer_bit_order(xob) == MSBFirst)
+ buf->priv.x11.xlib.bit_swap = 1;
#endif
if (((vis->class == TrueColor) || (vis->class == DirectColor)) &&
(x_depth > 8))
buf->priv.mask.r = (DATA32) vis->red_mask;
buf->priv.mask.g = (DATA32) vis->green_mask;
buf->priv.mask.b = (DATA32) vis->blue_mask;
- if (buf->priv.x.swap)
+ if (buf->priv.x11.xlib.swap)
{
SWAP32(buf->priv.mask.r);
SWAP32(buf->priv.mask.g);
pm = PAL_MODE_MONO;
}
/* FIXME: only alloc once per display+cmap */
- buf->priv.pal = evas_software_x11_x_color_allocate(disp, cmap, vis,
+ buf->priv.pal = evas_software_xlib_x_color_allocate(disp, cmap, vis,
PAL_MODE_RGB666);
if (!buf->priv.pal)
{
{
if (buf->rot == 0 || buf->rot == 180)
conv_func = evas_common_convert_func_get(0, buf->w, buf->h,
- evas_software_x11_x_output_buffer_depth
+ evas_software_xlib_x_output_buffer_depth
(xob), buf->priv.mask.r,
buf->priv.mask.g,
buf->priv.mask.b,
buf->rot);
else if (buf->rot == 90 || buf->rot == 270)
conv_func = evas_common_convert_func_get(0, buf->h, buf->w,
- evas_software_x11_x_output_buffer_depth
+ evas_software_xlib_x_output_buffer_depth
(xob), buf->priv.mask.r,
buf->priv.mask.g,
buf->priv.mask.b,
{
if (buf->rot == 0 || buf->rot == 180)
conv_func = evas_common_convert_func_get(0, buf->w, buf->h,
- evas_software_x11_x_output_buffer_depth
+ evas_software_xlib_x_output_buffer_depth
(xob), buf->priv.mask.r,
buf->priv.mask.g,
buf->priv.mask.b, PAL_MODE_NONE,
buf->rot);
else if (buf->rot == 90 || buf->rot == 270)
conv_func = evas_common_convert_func_get(0, buf->h, buf->w,
- evas_software_x11_x_output_buffer_depth
+ evas_software_xlib_x_output_buffer_depth
(xob), buf->priv.mask.r,
buf->priv.mask.g,
buf->priv.mask.b, PAL_MODE_NONE,
buf->rot);
}
- evas_software_x11_x_output_buffer_free(xob, 1);
+ evas_software_xlib_x_output_buffer_free(xob, 1);
if (!conv_func)
{
printf(".[ Evas Error ].\n"
" Palette mode: %i\n"
" Not supported by compiled in converters!\n"
" }\n",
- buf->priv.x.depth,
+ buf->priv.x11.xlib.depth,
buf->priv.mask.r,
buf->priv.mask.g,
buf->priv.mask.b, buf->priv.pal->colors);
}
}
- evas_software_x11_outbuf_drawable_set(buf, draw);
- evas_software_x11_outbuf_mask_set(buf, mask);
+ evas_software_xlib_outbuf_drawable_set(buf, draw);
+ evas_software_xlib_outbuf_mask_set(buf, mask);
}
return buf;
}
-RGBA_Image *
-evas_software_x11_outbuf_new_region_for_update(Outbuf *buf, int x, int y, int w, int h, int *cx, int *cy, int *cw, int *ch)
+RGBA_Image *
+evas_software_xlib_outbuf_new_region_for_update(Outbuf *buf, int x, int y, int w, int h, int *cx, int *cy, int *cw, int *ch)
{
RGBA_Image *im;
Outbuf_Region *obr;
int use_shm = 1;
int alpha;
- if ((buf->onebuf) && (buf->priv.x.shm))
+ if ((buf->onebuf) && (buf->priv.x11.xlib.shm))
{
Evas_Rectangle *rect;
-
+
rect = malloc(sizeof(Evas_Rectangle));
RECTS_CLIP_TO_RECT(x, y, w, h, 0, 0, buf->w, buf->h);
rect->x = x;
*ch = h;
if (!buf->priv.synced)
{
- XSync(buf->priv.x.disp, False);
+ XSync(buf->priv.x11.xlib.disp, False);
buf->priv.synced = 1;
}
- if ((buf->priv.x.mask) || (buf->priv.destination_alpha))
+ if ((buf->priv.x11.xlib.mask) || (buf->priv.destination_alpha))
{
int yy;
-
+
im = buf->priv.onebuf;
for (yy = y; yy < (y + h); yy++)
{
*cw = w;
*ch = h;
- alpha = ((buf->priv.x.mask) || (buf->priv.destination_alpha));
+ alpha = ((buf->priv.x11.xlib.mask) || (buf->priv.destination_alpha));
- use_shm = buf->priv.x.shm;
+ use_shm = buf->priv.x11.xlib.shm;
if ((buf->rot == 0) &&
(buf->priv.mask.r == 0xff0000) &&
(buf->priv.mask.g == 0x00ff00) &&
(buf->priv.mask.b == 0x0000ff))
{
- obr->xob = evas_software_x11_x_output_buffer_new(buf->priv.x.disp,
- buf->priv.x.vis,
- buf->priv.x.depth,
+ obr->xob = evas_software_xlib_x_output_buffer_new(buf->priv.x11.xlib.disp,
+ buf->priv.x11.xlib.vis,
+ buf->priv.x11.xlib.depth,
buf->w, buf->h,
use_shm,
NULL);
im = (RGBA_Image *) evas_cache_image_data(evas_common_image_cache_get(),
buf->w, buf->h,
- (DATA32 *) evas_software_x11_x_output_buffer_data(obr->xob, &bpl),
+ (DATA32 *) evas_software_xlib_x_output_buffer_data(obr->xob, &bpl),
alpha, EVAS_COLORSPACE_ARGB8888);
im->extended_info = obr;
- if (buf->priv.x.mask)
- obr->mxob = evas_software_x11_x_output_buffer_new(buf->priv.x.disp,
- buf->priv.x.vis,
- 1,
+ if (buf->priv.x11.xlib.mask)
+ obr->mxob = evas_software_xlib_x_output_buffer_new(buf->priv.x11.xlib.disp,
+ buf->priv.x11.xlib.vis,
+ 1,
buf->w, buf->h,
use_shm,
NULL);
evas_cache_image_surface_alloc(&im->cache_entry, buf->w, buf->h);
im->extended_info = obr;
if ((buf->rot == 0) || (buf->rot == 180))
- obr->xob = evas_software_x11_x_output_buffer_new(buf->priv.x.disp,
- buf->priv.x.vis,
- buf->priv.x.depth,
+ obr->xob = evas_software_xlib_x_output_buffer_new(buf->priv.x11.xlib.disp,
+ buf->priv.x11.xlib.vis,
+ buf->priv.x11.xlib.depth,
buf->w, buf->h,
use_shm,
NULL);
else if ((buf->rot == 90) || (buf->rot == 270))
- obr->xob = evas_software_x11_x_output_buffer_new(buf->priv.x.disp,
- buf->priv.x.vis,
- buf->priv.x.depth,
+ obr->xob = evas_software_xlib_x_output_buffer_new(buf->priv.x11.xlib.disp,
+ buf->priv.x11.xlib.vis,
+ buf->priv.x11.xlib.depth,
buf->h, buf->w,
use_shm,
NULL);
- if (buf->priv.x.mask)
- obr->mxob = evas_software_x11_x_output_buffer_new(buf->priv.x.disp,
- buf->priv.x.vis,
+ if (buf->priv.x11.xlib.mask)
+ obr->mxob = evas_software_xlib_x_output_buffer_new(buf->priv.x11.xlib.disp,
+ buf->priv.x11.xlib.vis,
1, buf->w, buf->h,
use_shm,
NULL);
*cw = w;
*ch = h;
- use_shm = buf->priv.x.shm;
+ use_shm = buf->priv.x11.xlib.shm;
/* FIXME: magic - i found if shm regions are smaller than 200x200 its
* faster to use ximages over unix sockets - trial and error
*/
// 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));
+ alpha = ((buf->priv.x11.xlib.mask) || (buf->priv.destination_alpha));
if ((buf->rot == 0) &&
(buf->priv.mask.r == 0xff0000) &&
(buf->priv.mask.g == 0x00ff00) &&
(buf->priv.mask.b == 0x0000ff))
{
- obr->xob = _find_xob(buf->priv.x.disp,
- buf->priv.x.vis,
- buf->priv.x.depth,
+ obr->xob = _find_xob(buf->priv.x11.xlib.disp,
+ buf->priv.x11.xlib.vis,
+ buf->priv.x11.xlib.depth,
w, h,
use_shm,
NULL);
-/* obr->xob = evas_software_x11_x_output_buffer_new(buf->priv.x.disp, */
-/* buf->priv.x.vis, */
-/* buf->priv.x.depth, */
-/* w, h, */
-/* use_shm, */
-/* NULL); */
+/* obr->xob = evas_software_xlib_x_output_buffer_new(buf->priv.x11.xlib.disp, */
+/* buf->priv.x11.xlib.vis, */
+/* buf->priv.x11.xlib.depth, */
+/* w, h, */
+/* use_shm, */
+/* NULL); */
im = (RGBA_Image *) evas_cache_image_data(evas_common_image_cache_get(),
w, h,
- (DATA32 *) evas_software_x11_x_output_buffer_data(obr->xob, &bpl),
+ (DATA32 *) evas_software_xlib_x_output_buffer_data(obr->xob, &bpl),
alpha, EVAS_COLORSPACE_ARGB8888);
im->extended_info = obr;
- if (buf->priv.x.mask)
- obr->mxob = _find_xob(buf->priv.x.disp,
- buf->priv.x.vis,
+ if (buf->priv.x11.xlib.mask)
+ obr->mxob = _find_xob(buf->priv.x11.xlib.disp,
+ buf->priv.x11.xlib.vis,
1, w, h,
use_shm,
NULL);
-/*
- obr->mxob = evas_software_x11_x_output_buffer_new(buf->priv.x.disp,
- buf->priv.x.vis,
+/*
+ obr->mxob = evas_software_xlib_x_output_buffer_new(buf->priv.x11.xlib.disp,
+ buf->priv.x11.xlib.vis,
1, w, h,
use_shm,
NULL);
evas_cache_image_surface_alloc(&im->cache_entry, w, h);
im->extended_info = obr;
if ((buf->rot == 0) || (buf->rot == 180))
- obr->xob = _find_xob(buf->priv.x.disp,
- buf->priv.x.vis,
- buf->priv.x.depth,
+ obr->xob = _find_xob(buf->priv.x11.xlib.disp,
+ buf->priv.x11.xlib.vis,
+ buf->priv.x11.xlib.depth,
w, h,
use_shm,
NULL);
-/*
- obr->xob = evas_software_x11_x_output_buffer_new(buf->priv.x.disp,
- buf->priv.x.vis,
- buf->priv.x.depth,
+/*
+ obr->xob = evas_software_xlib_x_output_buffer_new(buf->priv.x11.xlib.disp,
+ buf->priv.x11.xlib.vis,
+ buf->priv.x11.xlib.depth,
w, h,
use_shm,
NULL);
*/
else if ((buf->rot == 90) || (buf->rot == 270))
- obr->xob = _find_xob(buf->priv.x.disp,
- buf->priv.x.vis,
- buf->priv.x.depth,
+ obr->xob = _find_xob(buf->priv.x11.xlib.disp,
+ buf->priv.x11.xlib.vis,
+ buf->priv.x11.xlib.depth,
h, w,
use_shm,
NULL);
-/*
- obr->xob = evas_software_x11_x_output_buffer_new(buf->priv.x.disp,
- buf->priv.x.vis,
- buf->priv.x.depth,
+/*
+ obr->xob = evas_software_xlib_x_output_buffer_new(buf->priv.x11.xlib.disp,
+ buf->priv.x11.xlib.vis,
+ buf->priv.x11.xlib.depth,
h, w,
use_shm,
NULL);
*/
- if (buf->priv.x.mask)
- obr->mxob = _find_xob(buf->priv.x.disp,
- buf->priv.x.vis,
+ if (buf->priv.x11.xlib.mask)
+ obr->mxob = _find_xob(buf->priv.x11.xlib.disp,
+ buf->priv.x11.xlib.vis,
1, w, h,
use_shm,
NULL);
-/*
- obr->mxob = evas_software_x11_x_output_buffer_new(buf->priv.x.disp,
- buf->priv.x.vis,
+/*
+ obr->mxob = evas_software_xlib_x_output_buffer_new(buf->priv.x11.xlib.disp,
+ buf->priv.x11.xlib.vis,
1, w, h,
use_shm,
NULL);
*/
}
- if ((buf->priv.x.mask) || (buf->priv.destination_alpha))
+ if ((buf->priv.x11.xlib.mask) || (buf->priv.destination_alpha))
/* FIXME: faster memset! */
memset(im->image.data, 0, w * h * sizeof(DATA32));
}
void
-evas_software_x11_outbuf_free_region_for_update(Outbuf *buf, RGBA_Image *update)
+evas_software_xlib_outbuf_free_region_for_update(Outbuf *buf, RGBA_Image *update)
{
/* no need to do anything - they are cleaned up on flush */
}
void
-evas_software_x11_outbuf_flush(Outbuf *buf)
+evas_software_xlib_outbuf_flush(Outbuf *buf)
{
Eina_List *l;
RGBA_Image *im;
xr.height = rect->h;
XUnionRectWithRegion(&xr, tmpr, tmpr);
if (buf->priv.debug)
- evas_software_x11_outbuf_debug_show(buf, buf->priv.x.win,
+ evas_software_xlib_outbuf_debug_show(buf, buf->priv.x11.xlib.win,
rect->x, rect->y, rect->w, rect->h);
free(rect);
}
- XSetRegion(buf->priv.x.disp, buf->priv.x.gc, tmpr);
- evas_software_x11_x_output_buffer_paste(obr->xob, buf->priv.x.win,
- buf->priv.x.gc,
+ XSetRegion(buf->priv.x11.xlib.disp, buf->priv.x11.xlib.gc, tmpr);
+ evas_software_xlib_x_output_buffer_paste(obr->xob, buf->priv.x11.xlib.win,
+ buf->priv.x11.xlib.gc,
0, 0, 0);
if (obr->mxob)
{
- XSetRegion(buf->priv.x.disp, buf->priv.x.gcm, tmpr);
- evas_software_x11_x_output_buffer_paste(obr->mxob,
- buf->priv.x.mask,
- buf->priv.x.gcm,
+ XSetRegion(buf->priv.x11.xlib.disp, buf->priv.x11.xlib.gcm, tmpr);
+ evas_software_xlib_x_output_buffer_paste(obr->mxob,
+ buf->priv.x11.xlib.mask,
+ buf->priv.x11.xlib.gcm,
0, 0, 0);
}
XDestroyRegion(tmpr);
}
else
{
-#if 1
- XSync(buf->priv.x.disp, False);
+#if 1
+ XSync(buf->priv.x11.xlib.disp, False);
EINA_LIST_FOREACH(buf->priv.pending_writes, l, im)
{
obr = im->extended_info;
if (buf->priv.debug)
- evas_software_x11_outbuf_debug_show(buf, buf->priv.x.win,
+ evas_software_xlib_outbuf_debug_show(buf, buf->priv.x11.xlib.win,
obr->x, obr->y, obr->w, obr->h);
- evas_software_x11_x_output_buffer_paste(obr->xob, buf->priv.x.win,
- buf->priv.x.gc,
+ evas_software_xlib_x_output_buffer_paste(obr->xob, buf->priv.x11.xlib.win,
+ buf->priv.x11.xlib.gc,
obr->x, obr->y, 0);
if (obr->mxob)
- evas_software_x11_x_output_buffer_paste(obr->mxob,
- buf->priv.x.mask,
- buf->priv.x.gcm,
+ evas_software_xlib_x_output_buffer_paste(obr->mxob,
+ buf->priv.x11.xlib.mask,
+ buf->priv.x11.xlib.gcm,
obr->x, obr->y, 0);
}
while (buf->priv.prev_pending_writes)
{
im = buf->priv.prev_pending_writes->data;
- buf->priv.prev_pending_writes =
- eina_list_remove_list(buf->priv.prev_pending_writes,
+ buf->priv.prev_pending_writes =
+ 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);
if (obr->xob) _unfind_xob(obr->xob, 0);
if (obr->mxob) _unfind_xob(obr->mxob, 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->xob) evas_software_xlib_x_output_buffer_free(obr->xob, 0);
+ if (obr->mxob) evas_software_xlib_x_output_buffer_free(obr->mxob, 0);
*/
free(obr);
}
buf->priv.prev_pending_writes = buf->priv.pending_writes;
buf->priv.pending_writes = NULL;
- XFlush(buf->priv.x.disp);
-#else
+ XFlush(buf->priv.x11.xlib.disp);
+#else
/* XX async push - disable */
/*
EINA_LIST_FOREACH(buf->priv.pending_writes, l, im)
{
obr = im->extended_info;
if (buf->priv.debug)
- evas_software_x11_outbuf_debug_show(buf, buf->priv.x.win,
+ evas_software_xlib_outbuf_debug_show(buf, buf->priv.x11.xlib.win,
obr->x, obr->y, obr->w, obr->h);
- evas_software_x11_x_output_buffer_paste(obr->xob, buf->priv.x.win,
- buf->priv.x.gc,
+ evas_software_xlib_x_output_buffer_paste(obr->xob, buf->priv.x11.xlib.win,
+ buf->priv.x11.xlib.gc,
obr->x, obr->y, 0);
if (obr->mxob)
- evas_software_x11_x_output_buffer_paste(obr->mxob,
- buf->priv.x.mask,
- buf->priv.x.gcm,
+ evas_software_xlib_x_output_buffer_paste(obr->mxob,
+ buf->priv.x11.xlib.mask,
+ buf->priv.x11.xlib.gcm,
obr->x, obr->y, 0);
}
*/
- XSync(buf->priv.x.disp, False);
-
+ XSync(buf->priv.x11.xlib.disp, False);
+
while (buf->priv.pending_writes)
{
RGBA_Image *im;
Outbuf_Region *obr;
-
+
im = eina_list_data_get(buf->priv.pending_writes);
buf->priv.pending_writes = eina_list_remove_list(buf->priv.pending_writes, buf->priv.pending_writes);
obr = im->extended_info;
evas_cache_image_drop(&im->cache_entry);
if (obr->xob) _unfind_xob(obr->xob, 0);
if (obr->mxob) _unfind_xob(obr->mxob, 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->xob) evas_software_xlib_x_output_buffer_free(obr->xob, 0);
+ if (obr->mxob) evas_software_xlib_x_output_buffer_free(obr->mxob, 0);
*/
free(obr);
evas_cache_image_drop(&im->cache_entry);
}
-#endif
+#endif
}
evas_common_cpu_end_opt();
}
void
-evas_software_x11_outbuf_idle_flush(Outbuf *buf)
+evas_software_xlib_outbuf_idle_flush(Outbuf *buf)
{
if (buf->priv.onebuf)
{
im = buf->priv.onebuf;
buf->priv.onebuf = NULL;
obr = im->extended_info;
- 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->xob) evas_software_xlib_x_output_buffer_free(obr->xob, 0);
+ if (obr->mxob) evas_software_xlib_x_output_buffer_free(obr->mxob, 0);
free(obr);
evas_cache_image_drop(&im->cache_entry);
}
else
{
- if (buf->priv.prev_pending_writes) XSync(buf->priv.x.disp, False);
+ if (buf->priv.prev_pending_writes) XSync(buf->priv.x11.xlib.disp, False);
while (buf->priv.prev_pending_writes)
{
RGBA_Image *im;
Outbuf_Region *obr;
-
+
im = buf->priv.prev_pending_writes->data;
- buf->priv.prev_pending_writes =
- eina_list_remove_list(buf->priv.prev_pending_writes,
+ buf->priv.prev_pending_writes =
+ 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);
}
void
-evas_software_x11_outbuf_push_updated_region(Outbuf *buf, RGBA_Image *update, int x, int y, int w, int h)
+evas_software_xlib_outbuf_push_updated_region(Outbuf *buf, RGBA_Image *update, int x, int y, int w, int h)
{
Gfx_Func_Convert conv_func = NULL;
Outbuf_Region *obr;
{
if ((buf->rot == 0) || (buf->rot == 180))
conv_func = evas_common_convert_func_get(0, w, h,
- evas_software_x11_x_output_buffer_depth
+ evas_software_xlib_x_output_buffer_depth
(obr->xob), buf->priv.mask.r,
buf->priv.mask.g, buf->priv.mask.b,
buf->priv.pal->colors, buf->rot);
else if ((buf->rot == 90) || (buf->rot == 270))
conv_func = evas_common_convert_func_get(0, h, w,
- evas_software_x11_x_output_buffer_depth
+ evas_software_xlib_x_output_buffer_depth
(obr->xob), buf->priv.mask.r,
buf->priv.mask.g, buf->priv.mask.b,
buf->priv.pal->colors, buf->rot);
{
if ((buf->rot == 0) || (buf->rot == 180))
conv_func = evas_common_convert_func_get(0, w, h,
- evas_software_x11_x_output_buffer_depth
+ evas_software_xlib_x_output_buffer_depth
(obr->xob), buf->priv.mask.r,
buf->priv.mask.g, buf->priv.mask.b,
PAL_MODE_NONE, buf->rot);
else if ((buf->rot == 90) || (buf->rot == 270))
conv_func = evas_common_convert_func_get(0, h, w,
- evas_software_x11_x_output_buffer_depth
+ evas_software_xlib_x_output_buffer_depth
(obr->xob), buf->priv.mask.r,
buf->priv.mask.g, buf->priv.mask.b,
PAL_MODE_NONE, buf->rot);
}
if (!conv_func) return;
- data = evas_software_x11_x_output_buffer_data(obr->xob, &bpl);
+ data = evas_software_xlib_x_output_buffer_data(obr->xob, &bpl);
src_data = update->image.data;
if (buf->rot == 0)
{
conv_func(src_data, data,
0,
bpl /
- ((evas_software_x11_x_output_buffer_depth(obr->xob) /
+ ((evas_software_xlib_x_output_buffer_depth(obr->xob) /
8)) - obr->w, obr->w, obr->h, x, y,
buf->priv.pal->lookup);
}
conv_func(src_data, data,
0,
bpl /
- ((evas_software_x11_x_output_buffer_depth(obr->xob) /
+ ((evas_software_xlib_x_output_buffer_depth(obr->xob) /
8)) - obr->w, obr->w, obr->h, x, y, NULL);
}
#if 1
-#else
+#else
/* XX async push */
if (!((buf->priv.onebuf) && (buf->priv.onebuf_regions)))
- {
+ {
if (buf->priv.debug)
- evas_software_x11_outbuf_debug_show(buf, buf->priv.x.win,
+ evas_software_xlib_outbuf_debug_show(buf, buf->priv.x11.xlib.win,
obr->x, obr->y, obr->w, obr->h);
- evas_software_x11_x_output_buffer_paste(obr->xob, buf->priv.x.win,
- buf->priv.x.gc,
+ evas_software_xlib_x_output_buffer_paste(obr->xob, buf->priv.x11.xlib.win,
+ buf->priv.x11.xlib.gc,
obr->x, obr->y, 0);
}
-#endif
+#endif
if (obr->mxob)
{
for (yy = 0; yy < obr->h; yy++)
- evas_software_x11_x_write_mask_line(buf, obr->mxob,
+ evas_software_xlib_x_write_mask_line(buf, obr->mxob,
src_data +
(yy * obr->w), obr->w, yy);
#if 1
-#else
+#else
/* XX async push */
if (!((buf->priv.onebuf) && (buf->priv.onebuf_regions)))
- evas_software_x11_x_output_buffer_paste(obr->mxob,
- buf->priv.x.mask,
- buf->priv.x.gcm,
+ evas_software_xlib_x_output_buffer_paste(obr->mxob,
+ buf->priv.x11.xlib.mask,
+ buf->priv.x11.xlib.gcm,
obr->x, obr->y, 0);
-#endif
+#endif
}
#if 1
#else
- XFlush(buf->priv.x.disp);
-#endif
+ XFlush(buf->priv.x11.xlib.disp);
+#endif
}
void
-evas_software_x11_outbuf_reconfigure(Outbuf * buf, int w, int h, int rot,
+evas_software_xlib_outbuf_reconfigure(Outbuf * buf, int w, int h, int rot,
Outbuf_Depth depth)
{
if ((w == buf->w) &&
buf->w = w;
buf->h = h;
buf->rot = rot;
- evas_software_x11_outbuf_idle_flush(buf);
+ evas_software_xlib_outbuf_idle_flush(buf);
}
int
-evas_software_x11_outbuf_get_width(Outbuf * buf)
+evas_software_xlib_outbuf_get_width(Outbuf * buf)
{
return buf->w;
}
int
-evas_software_x11_outbuf_get_height(Outbuf * buf)
+evas_software_xlib_outbuf_get_height(Outbuf * buf)
{
return buf->h;
}
Outbuf_Depth
-evas_software_x11_outbuf_get_depth(Outbuf * buf)
+evas_software_xlib_outbuf_get_depth(Outbuf * buf)
{
return buf->depth;
}
int
-evas_software_x11_outbuf_get_rot(Outbuf * buf)
+evas_software_xlib_outbuf_get_rot(Outbuf * buf)
{
return buf->rot;
}
void
-evas_software_x11_outbuf_drawable_set(Outbuf * buf, Drawable draw)
+evas_software_xlib_outbuf_drawable_set(Outbuf * buf, Drawable draw)
{
XGCValues gcv;
- if (buf->priv.x.win == draw) return;
- if (buf->priv.x.gc)
+ if (buf->priv.x11.xlib.win == draw) return;
+ if (buf->priv.x11.xlib.gc)
{
- XFreeGC(buf->priv.x.disp, buf->priv.x.gc);
- buf->priv.x.gc = NULL;
+ XFreeGC(buf->priv.x11.xlib.disp, buf->priv.x11.xlib.gc);
+ buf->priv.x11.xlib.gc = NULL;
}
- buf->priv.x.win = draw;
- buf->priv.x.gc = XCreateGC(buf->priv.x.disp, buf->priv.x.win, 0, &gcv);
+ buf->priv.x11.xlib.win = draw;
+ buf->priv.x11.xlib.gc = XCreateGC(buf->priv.x11.xlib.disp, buf->priv.x11.xlib.win, 0, &gcv);
}
void
-evas_software_x11_outbuf_mask_set(Outbuf * buf, Pixmap mask)
+evas_software_xlib_outbuf_mask_set(Outbuf * buf, Pixmap mask)
{
XGCValues gcv;
- if (buf->priv.x.mask == mask) return;
- if (buf->priv.x.gcm)
+ if (buf->priv.x11.xlib.mask == mask) return;
+ if (buf->priv.x11.xlib.gcm)
{
- XFreeGC(buf->priv.x.disp, buf->priv.x.gcm);
- buf->priv.x.gcm = NULL;
+ XFreeGC(buf->priv.x11.xlib.disp, buf->priv.x11.xlib.gcm);
+ buf->priv.x11.xlib.gcm = NULL;
}
- buf->priv.x.mask = mask;
- if (buf->priv.x.mask)
- buf->priv.x.gcm = XCreateGC(buf->priv.x.disp, buf->priv.x.mask, 0, &gcv);
+ buf->priv.x11.xlib.mask = mask;
+ if (buf->priv.x11.xlib.mask)
+ buf->priv.x11.xlib.gcm = XCreateGC(buf->priv.x11.xlib.disp, buf->priv.x11.xlib.mask, 0, &gcv);
}
void
-evas_software_x11_outbuf_debug_set(Outbuf * buf, int debug)
+evas_software_xlib_outbuf_debug_set(Outbuf * buf, int debug)
{
buf->priv.debug = debug;
}
void
-evas_software_x11_outbuf_debug_show(Outbuf * buf, Drawable draw, int x, int y, int w,
+evas_software_xlib_outbuf_debug_show(Outbuf * buf, Drawable draw, int x, int y, int w,
int h)
{
int i;
Window wdum, root;
XWindowAttributes wattr;
- XGetGeometry(buf->priv.x.disp, draw, &root, &wx, &wy, &ww, &wh, &bd, &dp);
- XGetGeometry(buf->priv.x.disp, root, &wdum, &wx, &wy, &ww, &wh, &bd, &dp);
- XGetWindowAttributes(buf->priv.x.disp, root, &wattr);
+ XGetGeometry(buf->priv.x11.xlib.disp, draw, &root, &wx, &wy, &ww, &wh, &bd, &dp);
+ XGetGeometry(buf->priv.x11.xlib.disp, root, &wdum, &wx, &wy, &ww, &wh, &bd, &dp);
+ XGetWindowAttributes(buf->priv.x11.xlib.disp, root, &wattr);
screen_num = XScreenNumberOfScreen(wattr.screen);
}
for (i = 0; i < 20; i++)
{
// XImage *xim;
- XSetForeground(buf->priv.x.disp, buf->priv.x.gc,
- BlackPixel(buf->priv.x.disp, screen_num));
- XFillRectangle(buf->priv.x.disp, draw, buf->priv.x.gc, x, y, w, h);
- XSync(buf->priv.x.disp, False);
+ XSetForeground(buf->priv.x11.xlib.disp, buf->priv.x11.xlib.gc,
+ BlackPixel(buf->priv.x11.xlib.disp, screen_num));
+ XFillRectangle(buf->priv.x11.xlib.disp, draw, buf->priv.x11.xlib.gc, x, y, w, h);
+ XSync(buf->priv.x11.xlib.disp, False);
// xim =
-// XGetImage(buf->priv.x.disp, draw, x, y, w, h, 0xffffffff, ZPixmap);
+// XGetImage(buf->priv.x11.xlib.disp, draw, x, y, w, h, 0xffffffff, ZPixmap);
// if (xim)
// XDestroyImage(xim);
- XSync(buf->priv.x.disp, False);
- XSetForeground(buf->priv.x.disp, buf->priv.x.gc,
- WhitePixel(buf->priv.x.disp, screen_num));
- XFillRectangle(buf->priv.x.disp, draw, buf->priv.x.gc, x, y, w, h);
- XSync(buf->priv.x.disp, False);
+ XSync(buf->priv.x11.xlib.disp, False);
+ XSetForeground(buf->priv.x11.xlib.disp, buf->priv.x11.xlib.gc,
+ WhitePixel(buf->priv.x11.xlib.disp, screen_num));
+ XFillRectangle(buf->priv.x11.xlib.disp, draw, buf->priv.x11.xlib.gc, x, y, w, h);
+ XSync(buf->priv.x11.xlib.disp, False);
// xim =
-// XGetImage(buf->priv.x.disp, draw, x, y, w, h, 0xffffffff, ZPixmap);
+// XGetImage(buf->priv.x11.xlib.disp, draw, x, y, w, h, 0xffffffff, ZPixmap);
// if (xim)
// XDestroyImage(xim);
- XSync(buf->priv.x.disp, False);
+ XSync(buf->priv.x11.xlib.disp, False);
}
}
--- /dev/null
+#ifndef EVAS_XLIB_OUTBUF_H
+#define EVAS_XLIB_OUTBUF_H
+
+
+#include "evas_engine.h"
+
+
+void evas_software_xlib_outbuf_init (void);
+
+void evas_software_xlib_outbuf_free (Outbuf *buf);
+
+Outbuf *evas_software_xlib_outbuf_setup_x (int w,
+ int h,
+ int rot,
+ Outbuf_Depth depth,
+ Display *disp,
+ Drawable draw,
+ Visual *vis,
+ Colormap cmap,
+ int x_depth,
+ int grayscale,
+ int max_colors,
+ Pixmap mask,
+ int shape_dither,
+ int destination_alpha);
+
+
+RGBA_Image *evas_software_xlib_outbuf_new_region_for_update (Outbuf *buf,
+ int x,
+ int y,
+ int w,
+ int h,
+ int *cx,
+ int *cy,
+ int *cw,
+ int *ch);
+
+void evas_software_xlib_outbuf_free_region_for_update (Outbuf *buf,
+ RGBA_Image *update);
+
+void evas_software_xlib_outbuf_flush (Outbuf *buf);
+
+void evas_software_xlib_outbuf_idle_flush (Outbuf *buf);
+
+void evas_software_xlib_outbuf_push_updated_region (Outbuf *buf,
+ RGBA_Image *update,
+ int x,
+ int y,
+ int w,
+ int h);
+
+void evas_software_xlib_outbuf_reconfigure (Outbuf *buf,
+ int w,
+ int h,
+ int rot,
+ Outbuf_Depth depth);
+
+int evas_software_xlib_outbuf_get_width (Outbuf *buf);
+
+int evas_software_xlib_outbuf_get_height (Outbuf *buf);
+
+Outbuf_Depth evas_software_xlib_outbuf_get_depth (Outbuf *buf);
+
+int evas_software_xlib_outbuf_get_rot (Outbuf *buf);
+
+void evas_software_xlib_outbuf_drawable_set (Outbuf *buf,
+ Drawable draw);
+
+void evas_software_xlib_outbuf_mask_set (Outbuf *buf,
+ Pixmap mask);
+
+void evas_software_xlib_outbuf_rotation_set (Outbuf *buf,
+ int rot);
+
+void evas_software_xlib_outbuf_debug_set (Outbuf *buf,
+ int debug);
+
+void evas_software_xlib_outbuf_debug_show (Outbuf *buf,
+ Drawable draw,
+ int x,
+ int y,
+ int w,
+ int h);
+
+#endif