forked from enlightenment/efl
Evas: Commit new XCB engine code for Evas.
NB: XCB Engine is currently disabled by default as it's not considered 'complete' yet and is of little use to users/devs at the moment without the needed ecore_x & E changes. SVN revision: 61139
This commit is contained in:
parent
5b771c43f5
commit
88d1949180
|
@ -1,24 +1,14 @@
|
|||
#ifndef _EVAS_ENGINE_SOFTWARE_X11_H
|
||||
#define _EVAS_ENGINE_SOFTWARE_X11_H
|
||||
# define _EVAS_ENGINE_SOFTWARE_X11_H
|
||||
|
||||
typedef enum
|
||||
{
|
||||
EVAS_ENGINE_INFO_SOFTWARE_X11_BACKEND_XLIB,
|
||||
EVAS_ENGINE_INFO_SOFTWARE_X11_BACKEND_XCB
|
||||
EVAS_ENGINE_INFO_SOFTWARE_X11_BACKEND_XLIB,
|
||||
EVAS_ENGINE_INFO_SOFTWARE_X11_BACKEND_XCB
|
||||
} Evas_Engine_Info_Software_X11_Backend;
|
||||
|
||||
typedef struct _Evas_Engine_Info_Software_X11 Evas_Engine_Info_Software_X11;
|
||||
|
||||
/*
|
||||
* Xlib | XCB
|
||||
* connection | Display * | xcb_connection_t *
|
||||
* screen | NULL | xcb_screen_t *
|
||||
* drawable | Drawable | xcb_drawable_t
|
||||
* mask | Pixmap | xcb_pixmap_t
|
||||
* visual | Visual * | xcb_visualtype_t *
|
||||
* colormap | Colormap | xcb_colormap_t
|
||||
*/
|
||||
|
||||
struct _Evas_Engine_Info_Software_X11
|
||||
{
|
||||
/* PRIVATE - don't mess with this baby or evas will poke its tongue out */
|
||||
|
@ -26,37 +16,37 @@ struct _Evas_Engine_Info_Software_X11
|
|||
Evas_Engine_Info magic;
|
||||
|
||||
/* engine specific data & parameters it needs to set up */
|
||||
struct {
|
||||
Evas_Engine_Info_Software_X11_Backend backend;
|
||||
void *connection;
|
||||
void *screen;
|
||||
unsigned int drawable;
|
||||
unsigned int mask;
|
||||
void *visual;
|
||||
unsigned int colormap;
|
||||
int depth;
|
||||
int rotation;
|
||||
struct
|
||||
{
|
||||
Evas_Engine_Info_Software_X11_Backend backend;
|
||||
|
||||
unsigned int alloc_grayscale : 1;
|
||||
unsigned int debug : 1;
|
||||
unsigned int shape_dither : 1;
|
||||
unsigned int destination_alpha : 1;
|
||||
unsigned int track_mask_changes : 1;
|
||||
void *connection, *screen;
|
||||
unsigned int drawable, mask;
|
||||
void *visual;
|
||||
unsigned int colormap;
|
||||
int depth, rotation;
|
||||
|
||||
Eina_Bool alloc_grayscale : 1;
|
||||
Eina_Bool debug : 1;
|
||||
Eina_Bool shape_dither : 1;
|
||||
Eina_Bool destination_alpha : 1;
|
||||
Eina_Bool track_mask_changes : 1;
|
||||
|
||||
int alloc_colors_max;
|
||||
} info;
|
||||
|
||||
int alloc_colors_max;
|
||||
} info;
|
||||
/* engine specific function calls to query stuff about the destination */
|
||||
struct {
|
||||
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;
|
||||
struct
|
||||
{
|
||||
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;
|
||||
|
||||
unsigned char mask_changed : 1;
|
||||
|
||||
int mask_changed;
|
||||
/* non-blocking or blocking mode */
|
||||
Evas_Engine_Render_Mode render_mode;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,12 @@
|
|||
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
|
||||
if BUILD_ENGINE_SOFTWARE_X11
|
||||
|
||||
SOFTWARE_X11_SOURCES = evas_engine.c
|
||||
|
||||
if BUILD_ENGINE_SOFTWARE_XLIB
|
||||
|
||||
AM_CPPFLAGS = \
|
||||
-I. \
|
||||
-I$(top_srcdir)/src/lib \
|
||||
|
@ -9,14 +15,7 @@ AM_CPPFLAGS = \
|
|||
@FREETYPE_CFLAGS@ \
|
||||
@PIXMAN_CFLAGS@ \
|
||||
@EINA_CFLAGS@ \
|
||||
@evas_engine_software_xlib_cflags@ \
|
||||
@evas_engine_software_xcb_cflags@
|
||||
|
||||
if BUILD_ENGINE_SOFTWARE_X11
|
||||
|
||||
SOFTWARE_X11_SOURCES = evas_engine.c
|
||||
|
||||
if BUILD_ENGINE_SOFTWARE_XLIB
|
||||
@evas_engine_software_xlib_cflags@
|
||||
|
||||
SOFTWARE_X11_SOURCES += \
|
||||
evas_xlib_outbuf.c \
|
||||
|
@ -24,18 +23,30 @@ evas_xlib_buffer.c \
|
|||
evas_xlib_color.c \
|
||||
evas_xlib_main.c
|
||||
|
||||
SOFTWARE_X11_LIBADD = @evas_engine_software_xlib_libs@ @evas_engine_software_xcb_libs@
|
||||
SOFTWARE_X11_LIBADD = @FREETYPE_LIBS@ @EINA_LIBS@ @evas_engine_software_xlib_libs@
|
||||
|
||||
endif
|
||||
|
||||
if BUILD_ENGINE_SOFTWARE_XCB
|
||||
|
||||
AM_CPPFLAGS = \
|
||||
-I. \
|
||||
-I$(top_srcdir)/src/lib \
|
||||
-I$(top_srcdir)/src/lib/include \
|
||||
-I$(top_srcdir)/src/modules/engines \
|
||||
@FREETYPE_CFLAGS@ \
|
||||
@PIXMAN_CFLAGS@ \
|
||||
@EINA_CFLAGS@ \
|
||||
@evas_engine_software_xcb_cflags@
|
||||
|
||||
SOFTWARE_X11_SOURCES += \
|
||||
evas_xcb_outbuf.c \
|
||||
evas_xcb_buffer.c \
|
||||
evas_xcb_color.c \
|
||||
evas_xcb_main.c
|
||||
|
||||
SOFTWARE_X11_LIBADD = @FREETYPE_LIBS@ @PIXMAN_LIBS@ @EINA_LIBS@ @evas_engine_software_xcb_libs@
|
||||
|
||||
endif
|
||||
|
||||
includes_HEADERS = Evas_Engine_Software_X11.h
|
||||
|
@ -47,7 +58,7 @@ pkgdir = $(libdir)/evas/modules/engines/software_x11/$(MODULE_ARCH)
|
|||
pkg_LTLIBRARIES = module.la
|
||||
|
||||
module_la_SOURCES = $(SOFTWARE_X11_SOURCES)
|
||||
module_la_LIBADD = $(top_builddir)/src/lib/libevas.la @EINA_LIBS@ $(SOFTWARE_X11_LIBADD)
|
||||
module_la_LIBADD = $(top_builddir)/src/lib/libevas.la $(SOFTWARE_X11_LIBADD)
|
||||
module_la_LDFLAGS = -no-undefined -module -avoid-version
|
||||
module_la_LIBTOOLFLAGS = --tag=disable-static
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
#include "evas_private.h"
|
||||
|
||||
#include "Evas_Engine_Software_X11.h"
|
||||
|
||||
#include "evas_engine.h"
|
||||
|
||||
#ifdef BUILD_ENGINE_SOFTWARE_XLIB
|
||||
|
@ -16,7 +15,7 @@
|
|||
#endif
|
||||
|
||||
int _evas_engine_soft_x11_log_dom = -1;
|
||||
int test ;
|
||||
|
||||
/* function tables - filled in later (func and parent func) */
|
||||
static Evas_Func func, pfunc;
|
||||
|
||||
|
@ -32,16 +31,21 @@ static struct xrdb_user xrdb_user = {0, 0, NULL};
|
|||
static Eina_Bool
|
||||
xrdb_user_query(const char *name, const char *cls, char **type, XrmValue *val)
|
||||
{
|
||||
time_t last = xrdb_user.last_stat, now = time(NULL);
|
||||
time_t last, now;
|
||||
|
||||
last = xrdb_user.last_stat;
|
||||
now = time(NULL);
|
||||
|
||||
xrdb_user.last_stat = now;
|
||||
if (last != now) /* don't stat() more than once every second */
|
||||
{
|
||||
struct stat st;
|
||||
const char *home = getenv("HOME");
|
||||
const char *home;
|
||||
char tmp[PATH_MAX];
|
||||
|
||||
if (!home) goto failed;
|
||||
if (!(home = getenv("HOME")))
|
||||
goto failed;
|
||||
|
||||
snprintf(tmp, sizeof(tmp), "%s/.Xdefaults", home);
|
||||
if (stat(tmp, &st) != 0) goto failed;
|
||||
if (xrdb_user.last_mtime != st.st_mtime)
|
||||
|
@ -72,40 +76,42 @@ typedef struct _Render_Engine Render_Engine;
|
|||
|
||||
struct _Render_Engine
|
||||
{
|
||||
Tilebuf *tb;
|
||||
Outbuf *ob;
|
||||
Tilebuf *tb;
|
||||
Outbuf *ob;
|
||||
Tilebuf_Rect *rects;
|
||||
Eina_Inlist *cur_rect;
|
||||
int end : 1;
|
||||
|
||||
Eina_Inlist *cur_rect;
|
||||
unsigned char end : 1;
|
||||
|
||||
#ifdef BUILD_ENGINE_SOFTWARE_XLIB
|
||||
XrmDatabase xrdb; // xres - dpi
|
||||
struct { // xres - dpi
|
||||
int dpi; // xres - dpi
|
||||
} xr; // xres - dpi
|
||||
XrmDatabase xrdb;
|
||||
#endif
|
||||
struct
|
||||
{
|
||||
int dpi;
|
||||
} xr;
|
||||
|
||||
#ifdef EVAS_FRAME_QUEUING
|
||||
Evas_Engine_Render_Mode render_mode;
|
||||
#endif
|
||||
|
||||
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);
|
||||
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);
|
||||
Eina_Bool (*outbuf_alpha_get)(Outbuf *ob);
|
||||
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);
|
||||
Eina_Bool (*outbuf_alpha_get)(Outbuf *ob);
|
||||
#ifdef EVAS_FRAME_QUEUING
|
||||
void (*outbuf_set_priv)(Outbuf *ob, void *cur, void *prev);
|
||||
void (*outbuf_set_priv)(Outbuf *ob, void *cur, void *prev);
|
||||
#endif
|
||||
};
|
||||
|
||||
/* prototypes we will use here */
|
||||
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 *_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);
|
||||
|
@ -121,104 +127,81 @@ static void eng_output_redraws_next_update_push(void *data, void *surface, int x
|
|||
static void eng_output_flush(void *data);
|
||||
static void eng_output_idle_flush(void *data);
|
||||
|
||||
|
||||
/* internal engine routines */
|
||||
|
||||
#ifdef BUILD_ENGINE_SOFTWARE_XLIB
|
||||
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)
|
||||
_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;
|
||||
int status;
|
||||
char *type = NULL;
|
||||
XrmValue val;
|
||||
|
||||
re = calloc(1, sizeof(Render_Engine));
|
||||
if (!re)
|
||||
return NULL;
|
||||
if (!(re = calloc(1, sizeof(Render_Engine)))) return NULL;
|
||||
|
||||
evas_software_xlib_x_init();
|
||||
evas_software_xlib_x_color_init();
|
||||
evas_software_xlib_outbuf_init();
|
||||
|
||||
re->xr.dpi = 75000; // dpy * 1000
|
||||
|
||||
status = xrdb_user_query("Xft.dpi", "Xft.Dpi", &type, &val);
|
||||
if ((!status) || (!type))
|
||||
{
|
||||
int status;
|
||||
char *type = NULL;
|
||||
XrmValue val;
|
||||
|
||||
re->xr.dpi = 75000; // dpy * 1000
|
||||
if (!re->xrdb) re->xrdb = XrmGetDatabase(disp);
|
||||
if (re->xrdb)
|
||||
status = XrmGetResource(re->xrdb,
|
||||
"Xft.dpi", "Xft.Dpi", &type, &val);
|
||||
}
|
||||
|
||||
status = xrdb_user_query("Xft.dpi", "Xft.Dpi", &type, &val);
|
||||
if ((!status) || (!type))
|
||||
{
|
||||
if (!re->xrdb) re->xrdb = XrmGetDatabase(disp);
|
||||
if (re->xrdb)
|
||||
status = XrmGetResource(re->xrdb,
|
||||
"Xft.dpi", "Xft.Dpi", &type, &val);
|
||||
}
|
||||
|
||||
if ((status) && (type))
|
||||
if ((status) && (type))
|
||||
{
|
||||
if (!strcmp(type, "String"))
|
||||
{
|
||||
if (!strcmp(type, "String"))
|
||||
const char *str, *dp;
|
||||
|
||||
str = val.addr;
|
||||
dp = strchr(str, '.');
|
||||
if (!dp) dp = strchr(str, ',');
|
||||
|
||||
if (dp)
|
||||
{
|
||||
const char *str, *dp;
|
||||
|
||||
str = val.addr;
|
||||
dp = strchr(str, '.');
|
||||
if (!dp) dp = strchr(str, ',');
|
||||
|
||||
if (dp)
|
||||
int subdpi, len, i;
|
||||
char *buf;
|
||||
|
||||
buf = alloca(dp - str + 1);
|
||||
strncpy(buf, str, dp - str);
|
||||
buf[dp - str] = 0;
|
||||
len = strlen(dp + 1);
|
||||
subdpi = atoi(dp + 1);
|
||||
|
||||
if (len < 3)
|
||||
{
|
||||
int subdpi, len, i;
|
||||
char *buf;
|
||||
|
||||
buf = alloca(dp - str + 1);
|
||||
strncpy(buf, str, dp - str);
|
||||
buf[dp - str] = 0;
|
||||
len = strlen(dp + 1);
|
||||
subdpi = atoi(dp + 1);
|
||||
|
||||
if (len < 3)
|
||||
{
|
||||
for (i = len; i < 3; i++) subdpi *= 10;
|
||||
}
|
||||
else if (len > 3)
|
||||
{
|
||||
for (i = len; i > 3; i--) subdpi /= 10;
|
||||
}
|
||||
re->xr.dpi = atoi(buf) * 1000;
|
||||
for (i = len; i < 3; i++)
|
||||
subdpi *= 10;
|
||||
}
|
||||
else
|
||||
re->xr.dpi = atoi(str) * 1000;
|
||||
evas_common_font_dpi_set(re->xr.dpi / 1000);
|
||||
else if (len > 3)
|
||||
{
|
||||
for (i = len; i > 3; i--)
|
||||
subdpi /= 10;
|
||||
}
|
||||
re->xr.dpi = atoi(buf) * 1000;
|
||||
}
|
||||
else
|
||||
re->xr.dpi = atoi(str) * 1000;
|
||||
evas_common_font_dpi_set(re->xr.dpi / 1000);
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
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);
|
||||
|
@ -226,12 +209,13 @@ _output_xlib_setup(int w,
|
|||
}
|
||||
|
||||
/* for updates return 1 big buffer, but only use portions of it, also cache
|
||||
it and keepit around until an idle_flush */
|
||||
* 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;
|
||||
re->ob->onebuf = 1;
|
||||
*/
|
||||
|
||||
evas_software_xlib_outbuf_debug_set(re->ob, debug);
|
||||
|
@ -242,6 +226,7 @@ _output_xlib_setup(int w,
|
|||
free(re);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* in preliminary tests 16x16 gave highest framerates */
|
||||
evas_common_tilebuf_set_tile_size(re->tb, TILESIZE, TILESIZE);
|
||||
return re;
|
||||
|
@ -250,65 +235,47 @@ _output_xlib_setup(int w,
|
|||
|
||||
#ifdef BUILD_ENGINE_SOFTWARE_XCB
|
||||
static void *
|
||||
_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)
|
||||
_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 (!re)
|
||||
return NULL;
|
||||
if (!(re = calloc(1, sizeof(Render_Engine)))) return NULL;
|
||||
|
||||
evas_software_xcb_x_init();
|
||||
evas_software_xcb_x_color_init();
|
||||
evas_software_xcb_init();
|
||||
evas_software_xcb_color_init();
|
||||
evas_software_xcb_outbuf_init();
|
||||
|
||||
// FIXME: re->xrdb
|
||||
|
||||
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);
|
||||
re->xr.dpi = 75000; // dpy * 1000
|
||||
evas_common_font_dpi_set(re->xr.dpi / 1000);
|
||||
|
||||
re->ob =
|
||||
evas_software_xcb_outbuf_setup(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 */
|
||||
/* 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;
|
||||
re->ob->onebuf = 1;
|
||||
*/
|
||||
|
||||
evas_software_xcb_outbuf_debug_set(re->ob, debug);
|
||||
|
||||
re->tb = evas_common_tilebuf_new(w, h);
|
||||
if (!re->tb)
|
||||
{
|
||||
|
@ -316,6 +283,7 @@ _output_xcb_setup(int w,
|
|||
free(re);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* in preliminary tests 16x16 gave highest framerates */
|
||||
evas_common_tilebuf_set_tile_size(re->tb, TILESIZE, TILESIZE);
|
||||
return re;
|
||||
|
@ -329,20 +297,19 @@ _best_visual_get(int backend, void *connection, int screen)
|
|||
|
||||
#ifdef BUILD_ENGINE_SOFTWARE_XLIB
|
||||
if (backend == EVAS_ENGINE_INFO_SOFTWARE_X11_BACKEND_XLIB)
|
||||
{
|
||||
return DefaultVisual((Display *)connection, screen);
|
||||
}
|
||||
return DefaultVisual((Display *)connection, screen);
|
||||
#endif
|
||||
|
||||
#ifdef BUILD_ENGINE_SOFTWARE_XCB
|
||||
if (backend == EVAS_ENGINE_INFO_SOFTWARE_X11_BACKEND_XCB)
|
||||
{
|
||||
xcb_screen_iterator_t iter_screen;
|
||||
xcb_depth_iterator_t iter_depth;
|
||||
xcb_screen_t *s;
|
||||
xcb_depth_iterator_t iter_depth;
|
||||
xcb_screen_t *s = NULL;
|
||||
|
||||
iter_screen = xcb_setup_roots_iterator(xcb_get_setup((xcb_connection_t *)connection));
|
||||
for (; iter_screen.rem; --screen, xcb_screen_next (&iter_screen))
|
||||
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;
|
||||
|
@ -350,12 +317,12 @@ _best_visual_get(int backend, void *connection, int screen)
|
|||
}
|
||||
|
||||
iter_depth = xcb_screen_allowed_depths_iterator(s);
|
||||
for (; iter_depth.rem; xcb_depth_next (&iter_depth))
|
||||
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))
|
||||
for (; iter_vis.rem; xcb_visualtype_next(&iter_vis))
|
||||
{
|
||||
if (s->root_visual == iter_vis.data->visual_id)
|
||||
return iter_vis.data;
|
||||
|
@ -374,19 +341,18 @@ _best_colormap_get(int backend, void *connection, int screen)
|
|||
|
||||
#ifdef BUILD_ENGINE_SOFTWARE_XLIB
|
||||
if (backend == EVAS_ENGINE_INFO_SOFTWARE_X11_BACKEND_XLIB)
|
||||
{
|
||||
return DefaultColormap((Display *)connection, screen);
|
||||
}
|
||||
return DefaultColormap((Display *)connection, screen);
|
||||
#endif
|
||||
|
||||
#ifdef BUILD_ENGINE_SOFTWARE_XCB
|
||||
if (backend == EVAS_ENGINE_INFO_SOFTWARE_X11_BACKEND_XCB)
|
||||
{
|
||||
xcb_screen_iterator_t iter_screen;
|
||||
xcb_screen_t *s;
|
||||
xcb_screen_t *s = NULL;
|
||||
|
||||
iter_screen = xcb_setup_roots_iterator(xcb_get_setup((xcb_connection_t *)connection));
|
||||
for (; iter_screen.rem; --screen, xcb_screen_next (&iter_screen))
|
||||
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;
|
||||
|
@ -407,19 +373,18 @@ _best_depth_get(int backend, void *connection, int screen)
|
|||
|
||||
#ifdef BUILD_ENGINE_SOFTWARE_XLIB
|
||||
if (backend == EVAS_ENGINE_INFO_SOFTWARE_X11_BACKEND_XLIB)
|
||||
{
|
||||
return DefaultDepth((Display *)connection, screen);
|
||||
}
|
||||
return DefaultDepth((Display *)connection, screen);
|
||||
#endif
|
||||
|
||||
#ifdef BUILD_ENGINE_SOFTWARE_XCB
|
||||
if (backend == EVAS_ENGINE_INFO_SOFTWARE_X11_BACKEND_XCB)
|
||||
{
|
||||
xcb_screen_iterator_t iter_screen;
|
||||
xcb_screen_t *s;
|
||||
xcb_screen_t *s = NULL;
|
||||
|
||||
iter_screen = xcb_setup_roots_iterator(xcb_get_setup((xcb_connection_t *)connection));
|
||||
for (; iter_screen.rem; --screen, xcb_screen_next (&iter_screen))
|
||||
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;
|
||||
|
@ -438,8 +403,10 @@ static void *
|
|||
eng_info(Evas *e __UNUSED__)
|
||||
{
|
||||
Evas_Engine_Info_Software_X11 *info;
|
||||
info = calloc(1, sizeof(Evas_Engine_Info_Software_X11));
|
||||
if (!info) return NULL;
|
||||
|
||||
if (!(info = calloc(1, sizeof(Evas_Engine_Info_Software_X11))))
|
||||
return NULL;
|
||||
|
||||
info->magic.magic = rand();
|
||||
info->info.debug = 0;
|
||||
info->info.alloc_grayscale = 0;
|
||||
|
@ -455,6 +422,7 @@ static void
|
|||
eng_info_free(Evas *e __UNUSED__, void *info)
|
||||
{
|
||||
Evas_Engine_Info_Software_X11 *in;
|
||||
|
||||
in = (Evas_Engine_Info_Software_X11 *)info;
|
||||
free(in);
|
||||
}
|
||||
|
@ -484,65 +452,64 @@ eng_setup(Evas *e, void *in)
|
|||
#ifdef BUILD_ENGINE_SOFTWARE_XLIB
|
||||
if (info->info.backend == EVAS_ENGINE_INFO_SOFTWARE_X11_BACKEND_XLIB)
|
||||
{
|
||||
re = _output_xlib_setup(e->output.w,
|
||||
e->output.h,
|
||||
info->info.rotation,
|
||||
info->info.connection,
|
||||
info->info.drawable,
|
||||
info->info.visual,
|
||||
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.depth, info->info.debug,
|
||||
info->info.alloc_grayscale,
|
||||
info->info.alloc_colors_max,
|
||||
info->info.mask,
|
||||
info->info.shape_dither,
|
||||
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_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;
|
||||
re->outbuf_alpha_get = evas_software_xlib_outbuf_alpha_get;
|
||||
#ifdef EVAS_FRAME_QUEUING
|
||||
# ifdef EVAS_FRAME_QUEUING
|
||||
re->outbuf_set_priv = evas_software_xlib_outbuf_set_priv;
|
||||
re->render_mode = info->render_mode;
|
||||
#endif
|
||||
# endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef BUILD_ENGINE_SOFTWARE_XCB
|
||||
if (info->info.backend == EVAS_ENGINE_INFO_SOFTWARE_X11_BACKEND_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,
|
||||
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.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_get_rot = evas_software_xcb_outbuf_rotation_get;
|
||||
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;
|
||||
re->outbuf_alpha_get = evas_software_xcb_outbuf_alpha_get;
|
||||
# ifdef EVAS_FRAME_QUEUING
|
||||
re->outbuf_set_priv = evas_software_xcb_outbuf_priv_set;
|
||||
re->render_mode = info->render_mode;
|
||||
# endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -550,10 +517,10 @@ eng_setup(Evas *e, void *in)
|
|||
}
|
||||
else
|
||||
{
|
||||
int ponebuf = 0;
|
||||
int ponebuf = 0;
|
||||
|
||||
#ifdef EVAS_FRAME_QUEUING
|
||||
evas_common_frameq_flush ();
|
||||
evas_common_frameq_flush();
|
||||
#endif
|
||||
re = e->engine.data.output;
|
||||
ponebuf = re->ob->onebuf;
|
||||
|
@ -562,24 +529,25 @@ eng_setup(Evas *e, void *in)
|
|||
if (info->info.backend == EVAS_ENGINE_INFO_SOFTWARE_X11_BACKEND_XLIB)
|
||||
{
|
||||
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);
|
||||
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);
|
||||
#ifdef EVAS_FRAME_QUEUING
|
||||
# ifdef EVAS_FRAME_QUEUING
|
||||
re->render_mode = info->render_mode;
|
||||
#endif
|
||||
# endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -587,30 +555,36 @@ eng_setup(Evas *e, void *in)
|
|||
if (info->info.backend == EVAS_ENGINE_INFO_SOFTWARE_X11_BACKEND_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);
|
||||
re->ob =
|
||||
evas_software_xcb_outbuf_setup(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);
|
||||
#ifdef EVAS_FRAME_QUEUING
|
||||
re->render_mode = info->render_mode;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
re->ob->onebuf = ponebuf;
|
||||
}
|
||||
if (!e->engine.data.output) return 0;
|
||||
if (!e->engine.data.context)
|
||||
e->engine.data.context =
|
||||
e->engine.func->context_new(e->engine.data.output);
|
||||
if (!e->engine.data.context)
|
||||
{
|
||||
e->engine.data.context =
|
||||
e->engine.func->context_new(e->engine.data.output);
|
||||
}
|
||||
|
||||
re = e->engine.data.output;
|
||||
|
||||
|
@ -646,8 +620,7 @@ eng_output_resize(void *data, int w, int h)
|
|||
Render_Engine *re;
|
||||
|
||||
re = (Render_Engine *)data;
|
||||
re->outbuf_reconfigure(re->ob, w, h,
|
||||
re->outbuf_get_rot(re->ob),
|
||||
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);
|
||||
|
@ -721,7 +694,9 @@ eng_output_redraws_next_update_get(void *data, int *x, int *y, int *w, int *h, i
|
|||
re->end = 1;
|
||||
}
|
||||
|
||||
surface = re->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;
|
||||
}
|
||||
|
@ -767,9 +742,9 @@ eng_image_map_surface_new(void *data , int w, int h, int alpha)
|
|||
|
||||
re = (Render_Engine *)data;
|
||||
|
||||
surface = evas_cache_image_copied_data(evas_common_image_cache_get(),
|
||||
w, h, NULL, alpha,
|
||||
EVAS_COLORSPACE_ARGB8888);
|
||||
surface =
|
||||
evas_cache_image_copied_data(evas_common_image_cache_get(), w, h, NULL,
|
||||
alpha, EVAS_COLORSPACE_ARGB8888);
|
||||
pixels = evas_cache_image_pixels(surface);
|
||||
|
||||
if (re->render_mode == EVAS_RENDER_MODE_NONBLOCKING)
|
||||
|
@ -778,8 +753,10 @@ eng_image_map_surface_new(void *data , int w, int h, int alpha)
|
|||
evas_common_frameq_prepare_frame();
|
||||
|
||||
/* add surface into the frame */
|
||||
e_surface = evas_common_frameq_new_surface (surface, 0, 0, w, h);
|
||||
e_surface->dontpush = 1; // this surface is not going to be pushed to screen
|
||||
e_surface = evas_common_frameq_new_surface(surface, 0, 0, w, h);
|
||||
|
||||
/* this surface is not going to be pushed to screen */
|
||||
e_surface->dontpush = 1;
|
||||
evas_common_frameq_add_surface(e_surface);
|
||||
}
|
||||
return surface;
|
||||
|
@ -825,17 +802,15 @@ eng_output_flush(void *data)
|
|||
if (re->render_mode == EVAS_RENDER_MODE_NONBLOCKING)
|
||||
{
|
||||
evas_common_frameq_set_frame_data(data,
|
||||
eng_output_frameq_redraws_next_update_push,
|
||||
eng_output_frameq_flush,
|
||||
eng_output_frameq_set_priv);
|
||||
eng_output_frameq_redraws_next_update_push,
|
||||
eng_output_frameq_flush,
|
||||
eng_output_frameq_set_priv);
|
||||
evas_common_frameq_ready_frame();
|
||||
evas_common_frameq_begin();
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
re->outbuf_flush(re->ob);
|
||||
}
|
||||
re->outbuf_flush(re->ob);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -863,6 +838,7 @@ module_open(Evas_Module *em)
|
|||
{
|
||||
#ifdef BUILD_ENGINE_SOFTWARE_XLIB
|
||||
static Eina_Bool xrm_inited = EINA_FALSE;
|
||||
|
||||
if (!xrm_inited)
|
||||
{
|
||||
xrm_inited = EINA_TRUE;
|
||||
|
@ -874,15 +850,19 @@ module_open(Evas_Module *em)
|
|||
|
||||
/* get whatever engine module we inherit from */
|
||||
if (!_evas_module_engine_inherit(&pfunc, "software_generic")) return 0;
|
||||
_evas_engine_soft_x11_log_dom = eina_log_domain_register
|
||||
("evas-software_x11", EVAS_DEFAULT_LOG_COLOR);
|
||||
|
||||
_evas_engine_soft_x11_log_dom =
|
||||
eina_log_domain_register("evas-software_x11", EVAS_DEFAULT_LOG_COLOR);
|
||||
|
||||
if (_evas_engine_soft_x11_log_dom < 0)
|
||||
{
|
||||
EINA_LOG_ERR("Can not create a module log domain.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* store it for later use */
|
||||
func = pfunc;
|
||||
|
||||
/* now to override methods */
|
||||
#define ORD(f) EVAS_API_OVERRIDE(f, &func, eng_)
|
||||
ORD(info);
|
||||
|
@ -899,11 +879,11 @@ module_open(Evas_Module *em)
|
|||
ORD(output_redraws_next_update_push);
|
||||
ORD(output_flush);
|
||||
ORD(output_idle_flush);
|
||||
/* now advertise out own api */
|
||||
#ifdef EVAS_FRAME_QUEUING
|
||||
ORD(image_map_surface_new);
|
||||
#endif
|
||||
|
||||
/* now advertise out own api */
|
||||
em->functions = (void *)(&func);
|
||||
return 1;
|
||||
}
|
||||
|
@ -925,9 +905,7 @@ module_close(Evas_Module *em __UNUSED__)
|
|||
|
||||
static Evas_Module_Api evas_modapi =
|
||||
{
|
||||
EVAS_MODULE_API_VERSION,
|
||||
"software_x11",
|
||||
"none",
|
||||
EVAS_MODULE_API_VERSION, "software_x11", "none",
|
||||
{
|
||||
module_open,
|
||||
module_close
|
||||
|
@ -939,4 +917,3 @@ EVAS_MODULE_DEFINE(EVAS_MODULE_TYPE_ENGINE, engine, software_x11);
|
|||
#ifndef EVAS_STATIC_BUILD_SOFTWARE_X11
|
||||
EVAS_EINA_MODULE_DEFINE(engine, software_x11);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,49 +1,52 @@
|
|||
#ifndef EVAS_ENGINE_H
|
||||
#define EVAS_ENGINE_H
|
||||
# define EVAS_ENGINE_H
|
||||
|
||||
#include <sys/ipc.h>
|
||||
#include <sys/shm.h>
|
||||
# include <sys/ipc.h>
|
||||
# include <sys/shm.h>
|
||||
|
||||
#ifdef BUILD_ENGINE_SOFTWARE_XLIB
|
||||
# include <X11/Xlib.h>
|
||||
# include <X11/Xutil.h>
|
||||
# include <X11/Xatom.h>
|
||||
# include <X11/extensions/XShm.h>
|
||||
# include <X11/Xresource.h> // xres - dpi
|
||||
#endif
|
||||
# ifdef BUILD_ENGINE_SOFTWARE_XLIB
|
||||
# include <X11/Xlib.h>
|
||||
# include <X11/Xutil.h>
|
||||
# include <X11/Xatom.h>
|
||||
# include <X11/extensions/XShm.h>
|
||||
# include <X11/Xresource.h> // xres - dpi
|
||||
# endif
|
||||
|
||||
#ifdef BUILD_ENGINE_SOFTWARE_XCB
|
||||
# include <xcb/xcb.h>
|
||||
# include <xcb/xcb_image.h>
|
||||
#endif
|
||||
# ifdef BUILD_ENGINE_SOFTWARE_XCB
|
||||
# include <xcb/xcb.h>
|
||||
# include <xcb/shm.h>
|
||||
# include <xcb/xcb_image.h>
|
||||
# endif
|
||||
|
||||
extern int _evas_engine_soft_x11_log_dom;
|
||||
#ifdef ERR
|
||||
# undef ERR
|
||||
#endif
|
||||
#define ERR(...) EINA_LOG_DOM_ERR(_evas_engine_soft_x11_log_dom, __VA_ARGS__)
|
||||
|
||||
#ifdef DBG
|
||||
# undef DBG
|
||||
#endif
|
||||
#define DBG(...) EINA_LOG_DOM_DBG(_evas_engine_soft_x11_log_dom, __VA_ARGS__)
|
||||
# ifdef ERR
|
||||
# undef ERR
|
||||
# endif
|
||||
# define ERR(...) EINA_LOG_DOM_ERR(_evas_engine_soft_x11_log_dom, __VA_ARGS__)
|
||||
|
||||
#ifdef INF
|
||||
# undef INF
|
||||
#endif
|
||||
#define INF(...) EINA_LOG_DOM_INFO(_evas_engine_soft_x11_log_dom, __VA_ARGS__)
|
||||
# ifdef DBG
|
||||
# undef DBG
|
||||
# endif
|
||||
# define DBG(...) EINA_LOG_DOM_DBG(_evas_engine_soft_x11_log_dom, __VA_ARGS__)
|
||||
|
||||
#ifdef WRN
|
||||
# undef WRN
|
||||
#endif
|
||||
#define WRN(...) EINA_LOG_DOM_WARN(_evas_engine_soft_x11_log_dom, __VA_ARGS__)
|
||||
# ifdef INF
|
||||
# undef INF
|
||||
# endif
|
||||
# define INF(...) EINA_LOG_DOM_INFO(_evas_engine_soft_x11_log_dom, __VA_ARGS__)
|
||||
|
||||
#ifdef CRIT
|
||||
# undef CRIT
|
||||
#endif
|
||||
#define CRIT(...) EINA_LOG_DOM_CRIT(_evas_engine_soft_x11_log_dom, __VA_ARGS__)
|
||||
# ifdef WRN
|
||||
# undef WRN
|
||||
# endif
|
||||
# define WRN(...) EINA_LOG_DOM_WARN(_evas_engine_soft_x11_log_dom, __VA_ARGS__)
|
||||
|
||||
typedef enum _Outbuf_Depth Outbuf_Depth;
|
||||
# ifdef CRIT
|
||||
# undef CRIT
|
||||
# endif
|
||||
# define CRIT(...) \
|
||||
EINA_LOG_DOM_CRIT(_evas_engine_soft_x11_log_dom, __VA_ARGS__)
|
||||
|
||||
typedef enum _Outbuf_Depth Outbuf_Depth;
|
||||
|
||||
enum _Outbuf_Depth
|
||||
{
|
||||
|
@ -57,77 +60,78 @@ enum _Outbuf_Depth
|
|||
OUTBUF_DEPTH_LAST
|
||||
};
|
||||
|
||||
typedef struct _Outbuf Outbuf;
|
||||
typedef struct _Outbuf Outbuf;
|
||||
|
||||
struct _Outbuf
|
||||
{
|
||||
Outbuf_Depth depth;
|
||||
int w, h;
|
||||
int rot;
|
||||
int onebuf;
|
||||
Outbuf_Depth depth;
|
||||
int w, h;
|
||||
int rot;
|
||||
int onebuf;
|
||||
|
||||
struct {
|
||||
Convert_Pal *pal;
|
||||
union {
|
||||
#ifdef BUILD_ENGINE_SOFTWARE_XLIB
|
||||
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;
|
||||
#endif
|
||||
#ifdef BUILD_ENGINE_SOFTWARE_XCB
|
||||
struct {
|
||||
xcb_connection_t *conn;
|
||||
xcb_screen_t *screen;
|
||||
xcb_drawable_t win;
|
||||
xcb_pixmap_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;
|
||||
struct
|
||||
{
|
||||
Convert_Pal *pal;
|
||||
union
|
||||
{
|
||||
# ifdef BUILD_ENGINE_SOFTWARE_XLIB
|
||||
struct
|
||||
{
|
||||
Display *disp;
|
||||
Window win;
|
||||
Pixmap mask;
|
||||
Visual *vis;
|
||||
Colormap cmap;
|
||||
int depth, shm;
|
||||
GC gc, gcm;
|
||||
unsigned char swap : 1;
|
||||
unsigned char bit_swap : 1;
|
||||
} xlib;
|
||||
# endif
|
||||
# ifdef BUILD_ENGINE_SOFTWARE_XCB
|
||||
struct
|
||||
{
|
||||
xcb_connection_t *conn;
|
||||
xcb_screen_t *screen;
|
||||
xcb_window_t win;
|
||||
xcb_pixmap_t mask;
|
||||
xcb_visualtype_t *visual;
|
||||
xcb_colormap_t cmap;
|
||||
int depth, shm;
|
||||
xcb_gcontext_t gc, gcm;
|
||||
unsigned char swap : 1;
|
||||
unsigned char bit_swap : 1;
|
||||
} xcb;
|
||||
# endif
|
||||
} x11;
|
||||
struct
|
||||
{
|
||||
DATA32 r, g, b;
|
||||
} mask;
|
||||
|
||||
/* 1 big buffer for updates - flush on idle_flush */
|
||||
RGBA_Image *onebuf;
|
||||
Eina_List *onebuf_regions;
|
||||
/* 1 big buffer for updates - flush on idle_flush */
|
||||
RGBA_Image *onebuf;
|
||||
Eina_List *onebuf_regions;
|
||||
|
||||
/* a list of pending regions to write to the target */
|
||||
Eina_List *pending_writes;
|
||||
/* a list of previous frame pending regions to write to the target */
|
||||
Eina_List *prev_pending_writes;
|
||||
#ifdef EVAS_FRAME_QUEUING
|
||||
/* protecting prev_pending_writes */
|
||||
LK(lock);
|
||||
#endif
|
||||
/* a list of pending regions to write to the target */
|
||||
Eina_List *pending_writes;
|
||||
|
||||
unsigned char mask_dither : 1;
|
||||
unsigned char destination_alpha : 1;
|
||||
unsigned char debug : 1;
|
||||
unsigned char synced : 1;
|
||||
} priv;
|
||||
/* a list of previous frame pending regions to write to the target */
|
||||
Eina_List *prev_pending_writes;
|
||||
|
||||
# ifdef EVAS_FRAME_QUEUING
|
||||
/* protecting prev_pending_writes */
|
||||
LK(lock);
|
||||
# endif
|
||||
|
||||
unsigned char mask_dither : 1;
|
||||
unsigned char destination_alpha : 1;
|
||||
unsigned char debug : 1;
|
||||
unsigned char synced : 1;
|
||||
} priv;
|
||||
};
|
||||
|
||||
|
||||
void evas_software_xlib_x_init (void);
|
||||
void evas_software_xcb_x_init (void);
|
||||
|
||||
void evas_software_xlib_x_init(void);
|
||||
void evas_software_xcb_init(void);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,23 +1,21 @@
|
|||
#include "evas_common.h"
|
||||
|
||||
#include "evas_xcb_buffer.h"
|
||||
#include <xcb/xcb_aux.h>
|
||||
|
||||
static int _xcb_err = 0;
|
||||
/* local function prototypes */
|
||||
static void _xcbob_sync(xcb_connection_t *conn);
|
||||
static xcb_image_t *_xcbob_create_native(xcb_connection_t *conn, int w, int h, xcb_image_format_t format, uint8_t depth, void *base, uint32_t bytes, uint8_t *data);
|
||||
static xcb_format_t *_xcbob_find_format(const xcb_setup_t *setup, uint8_t depth);
|
||||
|
||||
void
|
||||
evas_software_xcb_x_write_mask_line(Outbuf *buf,
|
||||
Xcb_Output_Buffer *xcbob,
|
||||
DATA32 *src,
|
||||
int w,
|
||||
int y)
|
||||
void
|
||||
evas_software_xcb_write_mask_line(Outbuf *buf, Xcb_Output_Buffer *xcbob, DATA32 *src, int w, int y)
|
||||
{
|
||||
int x;
|
||||
int x, bpl = 0;
|
||||
DATA32 *src_ptr;
|
||||
DATA8 *dst_ptr;
|
||||
int bpl = 0;
|
||||
DATA8 *dst_ptr;
|
||||
|
||||
src_ptr = src;
|
||||
dst_ptr = evas_software_xcb_x_output_buffer_data(xcbob, &bpl);
|
||||
dst_ptr = evas_software_xcb_output_buffer_data(xcbob, &bpl);
|
||||
dst_ptr = dst_ptr + (bpl * y);
|
||||
w -= 7;
|
||||
if (buf->priv.x11.xcb.bit_swap)
|
||||
|
@ -56,26 +54,21 @@ evas_software_xcb_x_write_mask_line(Outbuf *buf,
|
|||
}
|
||||
w += 7;
|
||||
for (; x < w; x ++)
|
||||
{
|
||||
xcb_image_put_pixel(xcbob->image, x, y, A_VAL(src_ptr) >> 7);
|
||||
src_ptr++;
|
||||
}
|
||||
{
|
||||
xcb_image_put_pixel(xcbob->xim, x, y, A_VAL(src_ptr) >> 7);
|
||||
src_ptr++;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
evas_software_xcb_x_write_mask_line_rev(Outbuf *buf,
|
||||
Xcb_Output_Buffer *xcbob,
|
||||
DATA32 *src,
|
||||
int w,
|
||||
int y)
|
||||
void
|
||||
evas_software_xcb_write_mask_line_rev(Outbuf *buf, Xcb_Output_Buffer *xcbob, DATA32 *src, int w, int y)
|
||||
{
|
||||
int x;
|
||||
int x, bpl = 0;
|
||||
DATA32 *src_ptr;
|
||||
DATA8 *dst_ptr;
|
||||
int bpl = 0;
|
||||
DATA8 *dst_ptr;
|
||||
|
||||
src_ptr = src + w - 1;
|
||||
dst_ptr = evas_software_xcb_x_output_buffer_data(xcbob, &bpl);
|
||||
dst_ptr = evas_software_xcb_output_buffer_data(xcbob, &bpl);
|
||||
dst_ptr = dst_ptr + (bpl * y);
|
||||
w -= 7;
|
||||
if (buf->priv.x11.xcb.bit_swap)
|
||||
|
@ -115,31 +108,25 @@ evas_software_xcb_x_write_mask_line_rev(Outbuf *buf,
|
|||
w += 7;
|
||||
for (; x < w; x ++)
|
||||
{
|
||||
xcb_image_put_pixel(xcbob->image, x, y, A_VAL(src_ptr) >> 7);
|
||||
xcb_image_put_pixel(xcbob->xim, x, y, A_VAL(src_ptr) >> 7);
|
||||
src_ptr--;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
evas_software_xcb_x_write_mask_line_vert(Outbuf *buf,
|
||||
Xcb_Output_Buffer *xcbob,
|
||||
DATA32 *src,
|
||||
int h,
|
||||
int ym,
|
||||
int w)
|
||||
void
|
||||
evas_software_xcb_write_mask_line_vert(Outbuf *buf, Xcb_Output_Buffer *xcbob, DATA32 *src, int h, int y, int w)
|
||||
{
|
||||
int y;
|
||||
int yy, bpl = 0;
|
||||
DATA32 *src_ptr;
|
||||
DATA8 *dst_ptr;
|
||||
int bpl = 0;
|
||||
DATA8 *dst_ptr;
|
||||
|
||||
src_ptr = src;
|
||||
dst_ptr = evas_software_xcb_x_output_buffer_data(xcbob, &bpl);
|
||||
dst_ptr = dst_ptr + (bpl * ym);
|
||||
dst_ptr = evas_software_xcb_output_buffer_data(xcbob, &bpl);
|
||||
dst_ptr = dst_ptr + (bpl * y);
|
||||
h -= 7;
|
||||
if (buf->priv.x11.xcb.bit_swap)
|
||||
{
|
||||
for (y = 0; y < h; y += 8)
|
||||
for (yy = 0; yy < h; yy += 8)
|
||||
{
|
||||
*dst_ptr =
|
||||
((A_VAL(&(src_ptr[0 * w])) >> 7) << 7) |
|
||||
|
@ -156,7 +143,7 @@ evas_software_xcb_x_write_mask_line_vert(Outbuf *buf,
|
|||
}
|
||||
else
|
||||
{
|
||||
for (y = 0; y < h; y += 8)
|
||||
for (yy = 0; yy < h; yy += 8)
|
||||
{
|
||||
*dst_ptr =
|
||||
((A_VAL(&(src_ptr[0 * w])) >> 7) << 0) |
|
||||
|
@ -172,33 +159,27 @@ evas_software_xcb_x_write_mask_line_vert(Outbuf *buf,
|
|||
}
|
||||
}
|
||||
h += 7;
|
||||
for (; y < h; y ++)
|
||||
for (; yy < h; yy ++)
|
||||
{
|
||||
xcb_image_put_pixel(xcbob->image, y, ym, A_VAL(src_ptr) >> 7);
|
||||
xcb_image_put_pixel(xcbob->xim, yy, y, A_VAL(src_ptr) >> 7);
|
||||
src_ptr += w;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
evas_software_xcb_x_write_mask_line_vert_rev(Outbuf *buf,
|
||||
Xcb_Output_Buffer *xcbob,
|
||||
DATA32 *src,
|
||||
int h,
|
||||
int ym,
|
||||
int w)
|
||||
void
|
||||
evas_software_xcb_write_mask_line_vert_rev(Outbuf *buf, Xcb_Output_Buffer *xcbob, DATA32 *src, int h, int y, int w)
|
||||
{
|
||||
int y;
|
||||
int yy, bpl = 0;
|
||||
DATA32 *src_ptr;
|
||||
DATA8 *dst_ptr;
|
||||
int bpl = 0;
|
||||
DATA8 *dst_ptr;
|
||||
|
||||
src_ptr = src + ((h - 1) * w);
|
||||
dst_ptr = evas_software_xcb_x_output_buffer_data(xcbob, &bpl);
|
||||
dst_ptr = dst_ptr + (bpl * ym);
|
||||
dst_ptr = evas_software_xcb_output_buffer_data(xcbob, &bpl);
|
||||
dst_ptr = dst_ptr + (bpl * y);
|
||||
h -= 7;
|
||||
if (buf->priv.x11.xcb.bit_swap)
|
||||
{
|
||||
for (y = 0; y < h; y += 8)
|
||||
for (yy = 0; yy < h; yy += 8)
|
||||
{
|
||||
*dst_ptr =
|
||||
((A_VAL(&(src_ptr[ 0 * w])) >> 7) << 7) |
|
||||
|
@ -215,7 +196,7 @@ evas_software_xcb_x_write_mask_line_vert_rev(Outbuf *buf,
|
|||
}
|
||||
else
|
||||
{
|
||||
for (y = 0; y < h; y += 8)
|
||||
for (yy = 0; yy < h; yy += 8)
|
||||
{
|
||||
*dst_ptr =
|
||||
((A_VAL(&(src_ptr[ 0 * w])) >> 7) << 0) |
|
||||
|
@ -231,238 +212,259 @@ evas_software_xcb_x_write_mask_line_vert_rev(Outbuf *buf,
|
|||
}
|
||||
}
|
||||
h += 7;
|
||||
for (; y < h; y ++)
|
||||
for (; yy < h; yy ++)
|
||||
{
|
||||
xcb_image_put_pixel(xcbob->image, y, ym, A_VAL(src_ptr) >> 7);
|
||||
xcb_image_put_pixel(xcbob->xim, yy, y, A_VAL(src_ptr) >> 7);
|
||||
src_ptr -= w;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
evas_software_xcb_x_can_do_shm(xcb_connection_t *c,
|
||||
xcb_screen_t *screen)
|
||||
Eina_Bool
|
||||
evas_software_xcb_can_do_shm(xcb_connection_t *conn, xcb_screen_t *screen)
|
||||
{
|
||||
static xcb_connection_t *cached_c = NULL;
|
||||
static int cached_result = 0;
|
||||
static xcb_connection_t *cached_conn = NULL;
|
||||
static int cached_result = 0;
|
||||
Xcb_Output_Buffer *xcbob = NULL;
|
||||
xcb_visualtype_t *visual;
|
||||
|
||||
if (c == cached_c) return cached_result;
|
||||
cached_c = c;
|
||||
if (conn == cached_conn) return cached_result;
|
||||
cached_conn = conn;
|
||||
|
||||
if (xcb_get_extension_data(c, &xcb_shm_id))
|
||||
visual = xcb_aux_find_visual_by_id(screen, screen->root_visual);
|
||||
|
||||
xcbob =
|
||||
evas_software_xcb_output_buffer_new(conn, visual, screen->root_depth,
|
||||
1, 1, EINA_TRUE, NULL);
|
||||
if (!xcbob)
|
||||
cached_result = 0;
|
||||
else
|
||||
{
|
||||
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;
|
||||
evas_software_xcb_output_buffer_free(xcbob, EINA_TRUE);
|
||||
cached_result = 1;
|
||||
}
|
||||
cached_result = 0;
|
||||
return 0;
|
||||
|
||||
return cached_result;
|
||||
}
|
||||
|
||||
/*
|
||||
* 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)
|
||||
evas_software_xcb_output_buffer_new(xcb_connection_t *conn, xcb_visualtype_t *vis, int depth, int w, int h, Eina_Bool try_shm, unsigned char *data)
|
||||
{
|
||||
Xcb_Output_Buffer *xcbob;
|
||||
Xcb_Output_Buffer *xcbob = NULL;
|
||||
|
||||
xcbob = calloc(1, sizeof(Xcb_Output_Buffer));
|
||||
if (!xcbob) return NULL;
|
||||
if (!(xcbob = calloc(1, sizeof(Xcb_Output_Buffer))))
|
||||
return NULL;
|
||||
|
||||
xcbob->connection = c;
|
||||
xcbob->image = NULL;
|
||||
xcbob->shm_info = NULL;
|
||||
xcbob->connection = conn;
|
||||
xcbob->visual = vis;
|
||||
xcbob->xim = NULL;
|
||||
xcbob->shm_info = NULL;
|
||||
xcbob->w = w;
|
||||
xcbob->h = h;
|
||||
|
||||
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)
|
||||
{
|
||||
/*
|
||||
* FIXME: no error mechanism
|
||||
*/
|
||||
|
||||
/* XErrorHandler ph; */
|
||||
/* EventHandlers eh; */
|
||||
|
||||
if (try_shm == 2) // only needed during testing
|
||||
{
|
||||
free(xcb_get_input_focus_reply(c, xcb_get_input_focus_unchecked(c), NULL));
|
||||
_xcb_err = 0;
|
||||
/* ph = XSetErrorHandler((XErrorHandler) */
|
||||
}
|
||||
xcb_shm_attach(c,
|
||||
xcbob->shm_info->shmseg,
|
||||
xcbob->shm_info->shmid, 0);
|
||||
if (try_shm == 2) // only needed during testing
|
||||
{
|
||||
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)
|
||||
if (try_shm)
|
||||
{
|
||||
xcbob->image->data = malloc(xcbob->image->size);
|
||||
if (!xcbob->image->data)
|
||||
{
|
||||
xcb_image_destroy(xcbob->image);
|
||||
free(xcbob);
|
||||
return NULL;
|
||||
}
|
||||
xcbob->shm_info = malloc(sizeof(xcb_shm_segment_info_t));
|
||||
if (xcbob->shm_info)
|
||||
{
|
||||
xcbob->shm_info->shmseg = xcb_generate_id(conn);
|
||||
xcbob->xim =
|
||||
_xcbob_create_native(conn, w, h, XCB_IMAGE_FORMAT_Z_PIXMAP,
|
||||
depth, NULL, ~0, NULL);
|
||||
if (xcbob->xim)
|
||||
{
|
||||
xcbob->shm_info->shmid =
|
||||
shmget(IPC_PRIVATE, xcbob->xim->size, (IPC_CREAT | 0666));
|
||||
if (xcbob->shm_info->shmid == (uint32_t)-1)
|
||||
{
|
||||
xcb_image_destroy(xcbob->xim);
|
||||
free(xcbob->shm_info);
|
||||
free(xcbob);
|
||||
return NULL;
|
||||
}
|
||||
xcbob->shm_info->shmaddr =
|
||||
shmat(xcbob->shm_info->shmid, 0, 0);
|
||||
if (xcbob->shm_info->shmaddr != ((void *)-1))
|
||||
{
|
||||
xcbob->xim->data = xcbob->shm_info->shmaddr;
|
||||
xcb_shm_attach(conn, xcbob->shm_info->shmseg,
|
||||
xcbob->shm_info->shmid, 0);
|
||||
xcbob->bpl = xcbob->xim->stride;
|
||||
xcbob->psize = (xcbob->bpl * xcbob->h);
|
||||
return xcbob;
|
||||
}
|
||||
else
|
||||
{
|
||||
shmctl(xcbob->shm_info->shmid, IPC_RMID, 0);
|
||||
xcb_image_destroy(xcbob->xim);
|
||||
free(xcbob->shm_info);
|
||||
free(xcbob);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
free(xcbob->shm_info);
|
||||
free(xcbob);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
free(xcbob);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* no shm */
|
||||
xcbob->xim =
|
||||
_xcbob_create_native(conn, w, h, XCB_IMAGE_FORMAT_Z_PIXMAP,
|
||||
depth, NULL, ~0, NULL);
|
||||
if (!xcbob->xim)
|
||||
{
|
||||
free(xcbob);
|
||||
return NULL;
|
||||
}
|
||||
if (!xcbob->xim->data)
|
||||
{
|
||||
xcbob->xim->data = malloc(xcbob->xim->size);
|
||||
if (!xcbob->xim->data)
|
||||
{
|
||||
xcb_image_destroy(xcbob->xim);
|
||||
free(xcbob);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
xcbob->bpl = xcbob->xim->stride;
|
||||
xcbob->psize = xcbob->xim->size;
|
||||
}
|
||||
|
||||
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)
|
||||
void
|
||||
evas_software_xcb_output_buffer_free(Xcb_Output_Buffer *xcbob, Eina_Bool sync)
|
||||
{
|
||||
if (xcbob->shm_info)
|
||||
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);
|
||||
if (sync) _xcbob_sync(xcbob->connection);
|
||||
xcb_shm_detach(xcbob->connection, xcbob->shm_info->shmseg);
|
||||
xcb_image_destroy(xcbob->xim);
|
||||
shmdt(xcbob->shm_info->shmaddr);
|
||||
shmctl(xcbob->shm_info->shmid, IPC_RMID, 0);
|
||||
free(xcbob->shm_info);
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
if (xcbob->data) xcbob->image->data = NULL;
|
||||
free(xcbob->image->data);
|
||||
xcb_image_destroy(xcbob->image);
|
||||
if (xcbob->data) xcbob->xim->data = NULL;
|
||||
free(xcbob->xim->data);
|
||||
xcb_image_destroy(xcbob->xim);
|
||||
}
|
||||
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)
|
||||
void
|
||||
evas_software_xcb_output_buffer_paste(Xcb_Output_Buffer *xcbob, xcb_drawable_t drawable, xcb_gcontext_t gc, int x, int y, Eina_Bool sync)
|
||||
{
|
||||
if (xcbob->shm_info)
|
||||
if (xcbob->shm_info)
|
||||
{
|
||||
xcb_image_shm_put(xcbob->connection, d, gc,
|
||||
xcbob->image, *xcbob->shm_info,
|
||||
0, 0,
|
||||
x, y,
|
||||
xcbob->w, xcbob->h,
|
||||
0);
|
||||
if (sync)
|
||||
free(xcb_get_input_focus_reply(xcbob->connection,
|
||||
xcb_get_input_focus_unchecked(xcbob->connection),
|
||||
NULL));
|
||||
xcb_image_shm_put(xcbob->connection, drawable, gc, xcbob->xim,
|
||||
*xcbob->shm_info, 0, 0, x, y, xcbob->w, xcbob->h, 0);
|
||||
if (sync) _xcbob_sync(xcbob->connection);
|
||||
}
|
||||
else
|
||||
xcb_image_put(xcbob->connection, d, gc,
|
||||
xcbob->image,
|
||||
x, y, 0);
|
||||
else
|
||||
xcb_image_put(xcbob->connection, drawable, gc, xcbob->xim, x, y, 0);
|
||||
}
|
||||
|
||||
DATA8 *
|
||||
evas_software_xcb_x_output_buffer_data(Xcb_Output_Buffer *xcbob,
|
||||
int *bytes_per_line_ret)
|
||||
evas_software_xcb_output_buffer_data(Xcb_Output_Buffer *xcbob, int *bpl_ret)
|
||||
{
|
||||
if (bytes_per_line_ret) *bytes_per_line_ret = xcbob->image->stride;
|
||||
return xcbob->image->data;
|
||||
if (bpl_ret) *bpl_ret = xcbob->xim->stride;
|
||||
return xcbob->xim->data;
|
||||
}
|
||||
|
||||
int
|
||||
evas_software_xcb_x_output_buffer_depth(Xcb_Output_Buffer *xcbob)
|
||||
int
|
||||
evas_software_xcb_output_buffer_depth(Xcb_Output_Buffer *xcbob)
|
||||
{
|
||||
return xcbob->image->bpp;
|
||||
return xcbob->xim->bpp;
|
||||
}
|
||||
|
||||
int
|
||||
evas_software_xcb_x_output_buffer_byte_order(Xcb_Output_Buffer *xcbob)
|
||||
int
|
||||
evas_software_xcb_output_buffer_byte_order(Xcb_Output_Buffer *xcbob)
|
||||
{
|
||||
return xcbob->image->byte_order;
|
||||
return xcbob->xim->byte_order;
|
||||
}
|
||||
|
||||
int
|
||||
evas_software_xcb_x_output_buffer_bit_order(Xcb_Output_Buffer *xcbob)
|
||||
int
|
||||
evas_software_xcb_output_buffer_bit_order(Xcb_Output_Buffer *xcbob)
|
||||
{
|
||||
return xcbob->image->bit_order;
|
||||
return xcbob->xim->bit_order;
|
||||
}
|
||||
|
||||
/* local functions */
|
||||
static void
|
||||
_xcbob_sync(xcb_connection_t *conn)
|
||||
{
|
||||
free(xcb_get_input_focus_reply(conn,
|
||||
xcb_get_input_focus_unchecked(conn), NULL));
|
||||
}
|
||||
|
||||
static xcb_image_t *
|
||||
_xcbob_create_native(xcb_connection_t *conn, int w, int h, xcb_image_format_t format, uint8_t depth, void *base, uint32_t bytes, uint8_t *data)
|
||||
{
|
||||
const xcb_setup_t *setup;
|
||||
xcb_format_t *fmt = NULL;
|
||||
xcb_image_format_t xif;
|
||||
|
||||
/* NB: We cannot use xcb_image_create_native as it only creates images
|
||||
* using MSB_FIRST, so this routine recreates that function and checks
|
||||
* endian-ness correctly */
|
||||
setup = xcb_get_setup(conn);
|
||||
xif = format;
|
||||
|
||||
if ((xif == XCB_IMAGE_FORMAT_Z_PIXMAP) && (depth == 1))
|
||||
xif = XCB_IMAGE_FORMAT_XY_PIXMAP;
|
||||
|
||||
fmt = _xcbob_find_format(setup, depth);
|
||||
if (!fmt) return 0;
|
||||
|
||||
switch (xif)
|
||||
{
|
||||
case XCB_IMAGE_FORMAT_XY_BITMAP:
|
||||
if (depth != 1) return 0;
|
||||
case XCB_IMAGE_FORMAT_XY_PIXMAP:
|
||||
return xcb_image_create(w, h, xif,
|
||||
fmt->scanline_pad,
|
||||
fmt->depth, fmt->bits_per_pixel,
|
||||
setup->bitmap_format_scanline_unit,
|
||||
setup->image_byte_order,
|
||||
setup->bitmap_format_bit_order,
|
||||
base, bytes, data);
|
||||
case XCB_IMAGE_FORMAT_Z_PIXMAP:
|
||||
return xcb_image_create(w, h, xif,
|
||||
fmt->scanline_pad,
|
||||
fmt->depth, fmt->bits_per_pixel,
|
||||
setup->bitmap_format_scanline_unit,
|
||||
setup->image_byte_order,
|
||||
setup->bitmap_format_bit_order,
|
||||
base, bytes, data);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static xcb_format_t *
|
||||
_xcbob_find_format(const xcb_setup_t *setup, uint8_t depth)
|
||||
{
|
||||
xcb_format_t *fmt, *fmtend;
|
||||
|
||||
fmt = xcb_setup_pixmap_formats(setup);
|
||||
fmtend = fmt + xcb_setup_pixmap_formats_length(setup);
|
||||
for (; fmt != fmtend; ++fmt)
|
||||
if (fmt->depth == depth)
|
||||
return fmt;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1,67 +1,30 @@
|
|||
#ifndef EVAS_XCB_BUFFER_H
|
||||
#define EVAS_XCB_BUFFER_H
|
||||
# define EVAS_XCB_BUFFER_H
|
||||
|
||||
# include "evas_engine.h"
|
||||
|
||||
#include "evas_engine.h"
|
||||
|
||||
|
||||
typedef struct _Xcb_Output_Buffer Xcb_Output_Buffer;
|
||||
|
||||
struct _Xcb_Output_Buffer
|
||||
typedef struct _Xcb_Output_Buffer Xcb_Output_Buffer;
|
||||
struct _Xcb_Output_Buffer
|
||||
{
|
||||
xcb_connection_t *connection;
|
||||
xcb_image_t *image;
|
||||
xcb_connection_t *connection;
|
||||
xcb_visualtype_t *visual;
|
||||
xcb_image_t *xim;
|
||||
xcb_shm_segment_info_t *shm_info;
|
||||
void *data;
|
||||
int w;
|
||||
int h;
|
||||
int bpl;
|
||||
int psize;
|
||||
unsigned char *data;
|
||||
int w, h, bpl, psize;
|
||||
};
|
||||
|
||||
void evas_software_xcb_x_write_mask_line (Outbuf *buf,
|
||||
Xcb_Output_Buffer *xcbob,
|
||||
DATA32 *src,
|
||||
int w,
|
||||
int y);
|
||||
void evas_software_xcb_x_write_mask_line_rev (Outbuf *buf,
|
||||
Xcb_Output_Buffer *xcbob,
|
||||
DATA32 *src,
|
||||
int w,
|
||||
int y);
|
||||
void evas_software_xcb_x_write_mask_line_vert (Outbuf *buf,
|
||||
Xcb_Output_Buffer *xcbob,
|
||||
DATA32 *src,
|
||||
int h,
|
||||
int ym,
|
||||
int w);
|
||||
void evas_software_xcb_x_write_mask_line_vert_rev(Outbuf *buf,
|
||||
Xcb_Output_Buffer *xcbob,
|
||||
DATA32 *src,
|
||||
int h,
|
||||
int ym,
|
||||
int w);
|
||||
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);
|
||||
|
||||
void evas_software_xcb_write_mask_line(Outbuf *buf, Xcb_Output_Buffer *xcbob, DATA32 *src, int w, int y);
|
||||
void evas_software_xcb_write_mask_line_rev(Outbuf *buf, Xcb_Output_Buffer *xcbob, DATA32 *src, int w, int y);
|
||||
void evas_software_xcb_write_mask_line_vert(Outbuf *buf, Xcb_Output_Buffer *xcbob, DATA32 *src, int h, int y, int w);
|
||||
void evas_software_xcb_write_mask_line_vert_rev(Outbuf *buf, Xcb_Output_Buffer *xcbob, DATA32 *src, int h, int y, int w);
|
||||
Eina_Bool evas_software_xcb_can_do_shm(xcb_connection_t *conn, xcb_screen_t *screen);
|
||||
Xcb_Output_Buffer *evas_software_xcb_output_buffer_new(xcb_connection_t *conn, xcb_visualtype_t *vis, int depth, int w, int h, Eina_Bool try_shm, unsigned char *data);
|
||||
void evas_software_xcb_output_buffer_free(Xcb_Output_Buffer *xcbob, Eina_Bool sync);
|
||||
void evas_software_xcb_output_buffer_paste(Xcb_Output_Buffer *xcbob, xcb_drawable_t drawable, xcb_gcontext_t gc, int x, int y, Eina_Bool sync);
|
||||
DATA8 *evas_software_xcb_output_buffer_data(Xcb_Output_Buffer *xcbob, int *bpl_ret);
|
||||
int evas_software_xcb_output_buffer_depth(Xcb_Output_Buffer *xcbob);
|
||||
int evas_software_xcb_output_buffer_byte_order(Xcb_Output_Buffer *xcbob);
|
||||
int evas_software_xcb_output_buffer_bit_order(Xcb_Output_Buffer *xcbob);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -293,7 +293,7 @@ x_color_alloc_mono(xcb_connection_t *conn,
|
|||
}
|
||||
|
||||
void
|
||||
evas_software_xcb_x_color_init(void)
|
||||
evas_software_xcb_color_init(void)
|
||||
{
|
||||
static int initialised = 0;
|
||||
|
||||
|
@ -343,7 +343,7 @@ evas_software_xcb_x_color_init(void)
|
|||
}
|
||||
|
||||
Convert_Pal *
|
||||
evas_software_xcb_x_color_allocate(xcb_connection_t *conn,
|
||||
evas_software_xcb_color_allocate(xcb_connection_t *conn,
|
||||
xcb_colormap_t cmap,
|
||||
xcb_visualtype_t *vis,
|
||||
Convert_Pal_Mode colors)
|
||||
|
@ -401,7 +401,7 @@ evas_software_xcb_x_color_allocate(xcb_connection_t *conn,
|
|||
}
|
||||
|
||||
void
|
||||
evas_software_xcb_x_color_deallocate(xcb_connection_t *conn,
|
||||
evas_software_xcb_color_deallocate(xcb_connection_t *conn,
|
||||
xcb_colormap_t cmap,
|
||||
xcb_visualtype_t *vis __UNUSED__,
|
||||
Convert_Pal *pal)
|
||||
|
|
|
@ -1,15 +1,10 @@
|
|||
#ifndef EVAS_XCB_COLOR_H
|
||||
#define EVAS_XCB_COLOR_H
|
||||
# define EVAS_XCB_COLOR_H
|
||||
|
||||
# include "evas_engine.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);
|
||||
void evas_software_xcb_color_init(void);
|
||||
Convert_Pal *evas_software_xcb_color_allocate(xcb_connection_t *conn, xcb_colormap_t cmap, xcb_visualtype_t *vis, Convert_Pal_Mode colors);
|
||||
void evas_software_xcb_color_deallocate(xcb_connection_t *conn, xcb_colormap_t cmap, xcb_visualtype_t *vis, Convert_Pal *pal);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
#include "evas_common.h"
|
||||
#include "evas_engine.h"
|
||||
|
||||
void
|
||||
evas_software_xcb_x_init(void)
|
||||
void
|
||||
evas_software_xcb_init(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,89 +1,30 @@
|
|||
#ifndef EVAS_XCB_OUTBUF_H
|
||||
#define EVAS_XCB_OUTBUF_H
|
||||
# define EVAS_XCB_OUTBUF_H
|
||||
|
||||
# include "evas_engine.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);
|
||||
|
||||
Eina_Bool evas_software_xcb_outbuf_alpha_get (Outbuf *buf);
|
||||
void evas_software_xcb_outbuf_init(void);
|
||||
void evas_software_xcb_outbuf_free(Outbuf *buf);
|
||||
Outbuf *evas_software_xcb_outbuf_setup(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 xdepth, Eina_Bool grayscale, int max_colors, xcb_drawable_t mask, Eina_Bool shape_dither, Eina_Bool 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_width_get(Outbuf *buf);
|
||||
int evas_software_xcb_outbuf_height_get(Outbuf *buf);
|
||||
Outbuf_Depth evas_software_xcb_outbuf_depth_get(Outbuf *buf);
|
||||
void evas_software_xcb_outbuf_drawable_set(Outbuf *buf, xcb_drawable_t drawable);
|
||||
void evas_software_xcb_outbuf_mask_set(Outbuf *buf, xcb_drawable_t mask);
|
||||
int evas_software_xcb_outbuf_rotation_get(Outbuf *buf);
|
||||
void evas_software_xcb_outbuf_rotation_set(Outbuf *buf, int rotation);
|
||||
Eina_Bool evas_software_xcb_outbuf_alpha_get(Outbuf *buf);
|
||||
void evas_software_xcb_outbuf_debug_set(Outbuf *buf, Eina_Bool debug);
|
||||
void evas_software_xcb_outbuf_debug_show(Outbuf *buf, xcb_drawable_t drawable, int x, int y, int w, int h);
|
||||
|
||||
# ifdef EVAS_FRAME_QUEUING
|
||||
void evas_software_xcb_outbuf_priv_set(Outbuf *buf, void *cur, void *prev);
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue