2002-11-08 00:02:15 -08:00
|
|
|
#include "evas_common.h"
|
|
|
|
#include "evas_private.h"
|
2008-12-17 00:13:49 -08:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
#include "Evas_Engine_Software_X11.h"
|
|
|
|
|
2008-12-17 00:13:49 -08:00
|
|
|
#include "evas_engine.h"
|
2009-07-14 14:16:08 -07:00
|
|
|
|
|
|
|
#ifdef BUILD_ENGINE_SOFTWARE_XLIB
|
|
|
|
# include "evas_xlib_outbuf.h"
|
|
|
|
# include "evas_xlib_color.h"
|
|
|
|
#endif
|
2008-12-17 00:13:49 -08:00
|
|
|
|
|
|
|
#ifdef BUILD_ENGINE_SOFTWARE_XCB
|
|
|
|
# include "evas_xcb_outbuf.h"
|
|
|
|
# include "evas_xcb_color.h"
|
|
|
|
#endif
|
|
|
|
|
2009-10-22 08:22:22 -07:00
|
|
|
int _evas_engine_soft_x11_log_dom = -1;
|
|
|
|
int test ;
|
2006-03-02 01:16:46 -08:00
|
|
|
/* function tables - filled in later (func and parent func) */
|
|
|
|
static Evas_Func func, pfunc;
|
|
|
|
|
2010-04-29 08:32:47 -07:00
|
|
|
#ifdef BUILD_ENGINE_SOFTWARE_XLIB
|
|
|
|
struct xrdb_user
|
|
|
|
{
|
|
|
|
time_t last_stat;
|
|
|
|
time_t last_mtime;
|
|
|
|
XrmDatabase db;
|
|
|
|
};
|
|
|
|
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);
|
|
|
|
|
|
|
|
xrdb_user.last_stat = now;
|
|
|
|
if (last != now) /* don't stat() more than once every second */
|
|
|
|
{
|
|
|
|
struct stat st;
|
|
|
|
const char *home = getenv("HOME");
|
|
|
|
char tmp[PATH_MAX];
|
|
|
|
|
|
|
|
if (!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)
|
|
|
|
{
|
|
|
|
if (xrdb_user.db) XrmDestroyDatabase(xrdb_user.db);
|
|
|
|
xrdb_user.db = XrmGetFileDatabase(tmp);
|
|
|
|
if (!xrdb_user.db) goto failed;
|
|
|
|
xrdb_user.last_mtime = st.st_mtime;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!xrdb_user.db) return EINA_FALSE;
|
|
|
|
return XrmGetResource(xrdb_user.db, name, cls, type, val);
|
|
|
|
|
|
|
|
failed:
|
|
|
|
if (xrdb_user.db)
|
|
|
|
{
|
|
|
|
XrmDestroyDatabase(xrdb_user.db);
|
|
|
|
xrdb_user.db = NULL;
|
|
|
|
}
|
|
|
|
xrdb_user.last_mtime = 0;
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2006-03-02 00:06:10 -08:00
|
|
|
/* engine struct data */
|
|
|
|
typedef struct _Render_Engine Render_Engine;
|
|
|
|
|
|
|
|
struct _Render_Engine
|
|
|
|
{
|
2008-12-17 00:13:49 -08:00
|
|
|
Tilebuf *tb;
|
|
|
|
Outbuf *ob;
|
|
|
|
Tilebuf_Rect *rects;
|
|
|
|
Eina_Inlist *cur_rect;
|
|
|
|
int end : 1;
|
2010-01-07 23:10:53 -08:00
|
|
|
|
|
|
|
#ifdef BUILD_ENGINE_SOFTWARE_XLIB
|
2010-04-29 08:32:47 -07:00
|
|
|
XrmDatabase xrdb; // xres - dpi
|
2010-01-07 23:10:53 -08:00
|
|
|
struct { // xres - dpi
|
|
|
|
int dpi; // xres - dpi
|
|
|
|
} xr; // xres - dpi
|
|
|
|
#endif
|
2010-05-21 00:10:45 -07:00
|
|
|
#ifdef EVAS_FRAME_QUEUING
|
|
|
|
Evas_Engine_Render_Mode render_mode;
|
|
|
|
#endif
|
|
|
|
|
2008-12-17 00:13:49 -08:00
|
|
|
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);
|
2009-06-26 06:26:52 -07:00
|
|
|
Eina_Bool (*outbuf_alpha_get)(Outbuf *ob);
|
2010-05-21 00:10:45 -07:00
|
|
|
#ifdef EVAS_FRAME_QUEUING
|
|
|
|
void (*outbuf_set_priv)(Outbuf *ob, void *cur, void *prev);
|
|
|
|
#endif
|
2006-03-02 00:06:10 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
/* prototypes we will use here */
|
2008-12-17 00:13:49 -08:00
|
|
|
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);
|
2006-03-02 00:06:10 -08:00
|
|
|
|
2006-02-27 20:07:49 -08:00
|
|
|
static void *eng_info(Evas *e);
|
|
|
|
static void eng_info_free(Evas *e, void *info);
|
2009-03-24 02:05:32 -07:00
|
|
|
static int eng_setup(Evas *e, void *info);
|
2006-02-27 20:07:49 -08:00
|
|
|
static void eng_output_free(void *data);
|
|
|
|
static void eng_output_resize(void *data, int w, int h);
|
|
|
|
static void eng_output_tile_size_set(void *data, int w, int h);
|
|
|
|
static void eng_output_redraws_rect_add(void *data, int x, int y, int w, int h);
|
|
|
|
static void eng_output_redraws_rect_del(void *data, int x, int y, int w, int h);
|
|
|
|
static void eng_output_redraws_clear(void *data);
|
|
|
|
static void *eng_output_redraws_next_update_get(void *data, int *x, int *y, int *w, int *h, int *cx, int *cy, int *cw, int *ch);
|
|
|
|
static void eng_output_redraws_next_update_push(void *data, void *surface, int x, int y, int w, int h);
|
|
|
|
static void eng_output_flush(void *data);
|
2007-06-16 19:56:59 -07:00
|
|
|
static void eng_output_idle_flush(void *data);
|
2006-02-27 20:07:49 -08:00
|
|
|
|
2008-12-17 00:13:49 -08:00
|
|
|
|
2006-03-02 00:06:10 -08:00
|
|
|
/* internal engine routines */
|
2008-12-17 00:13:49 -08:00
|
|
|
|
2009-07-14 14:16:08 -07:00
|
|
|
#ifdef BUILD_ENGINE_SOFTWARE_XLIB
|
2008-12-17 00:13:49 -08:00
|
|
|
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));
|
2009-03-24 02:05:32 -07:00
|
|
|
if (!re)
|
|
|
|
return NULL;
|
2008-12-17 00:13:49 -08:00
|
|
|
|
|
|
|
evas_software_xlib_x_init();
|
|
|
|
evas_software_xlib_x_color_init();
|
|
|
|
evas_software_xlib_outbuf_init();
|
|
|
|
|
2010-01-07 23:10:53 -08:00
|
|
|
{
|
2010-04-29 08:32:47 -07:00
|
|
|
int status;
|
2010-01-07 23:10:53 -08:00
|
|
|
char *type = NULL;
|
|
|
|
XrmValue val;
|
|
|
|
|
|
|
|
re->xr.dpi = 75000; // dpy * 1000
|
Load Xft.dpi from ~/.Xdefaults as well.
Do this for consistency with other applications, some people just set
.Xdefaults but do not have xrdb to load it to screen. This works with
most of the systems, like Gtk and Qt, but not in Evas, so we get
different font sizes as they calculate based on DPI.
HOWEVER, and this may be a big thing, so RASTERMAN take a look, this
might impose a performance hit on window creation... remember that
every E17 popup/tooltip will hit this process of reading the file (if
exists) and then query X server (round trip).
I'd rather make this a global resource, loaded just once for all
created windows, we can store the mtime to know when it changed and
invalidate the pointer... but as Raster did not keep the
XrmGetDatabase() result as global, I'm not doing it here either.
SVN revision: 48403
2010-04-28 13:26:04 -07:00
|
|
|
|
2010-04-29 08:32:47 -07:00
|
|
|
status = xrdb_user_query("Xft.dpi", "Xft.Dpi", &type, &val);
|
Load Xft.dpi from ~/.Xdefaults as well.
Do this for consistency with other applications, some people just set
.Xdefaults but do not have xrdb to load it to screen. This works with
most of the systems, like Gtk and Qt, but not in Evas, so we get
different font sizes as they calculate based on DPI.
HOWEVER, and this may be a big thing, so RASTERMAN take a look, this
might impose a performance hit on window creation... remember that
every E17 popup/tooltip will hit this process of reading the file (if
exists) and then query X server (round trip).
I'd rather make this a global resource, loaded just once for all
created windows, we can store the mtime to know when it changed and
invalidate the pointer... but as Raster did not keep the
XrmGetDatabase() result as global, I'm not doing it here either.
SVN revision: 48403
2010-04-28 13:26:04 -07:00
|
|
|
if ((!status) || (!type))
|
|
|
|
{
|
2010-04-29 08:32:47 -07:00
|
|
|
if (!re->xrdb) re->xrdb = XrmGetDatabase(disp);
|
|
|
|
if (re->xrdb)
|
|
|
|
status = XrmGetResource(re->xrdb,
|
Load Xft.dpi from ~/.Xdefaults as well.
Do this for consistency with other applications, some people just set
.Xdefaults but do not have xrdb to load it to screen. This works with
most of the systems, like Gtk and Qt, but not in Evas, so we get
different font sizes as they calculate based on DPI.
HOWEVER, and this may be a big thing, so RASTERMAN take a look, this
might impose a performance hit on window creation... remember that
every E17 popup/tooltip will hit this process of reading the file (if
exists) and then query X server (round trip).
I'd rather make this a global resource, loaded just once for all
created windows, we can store the mtime to know when it changed and
invalidate the pointer... but as Raster did not keep the
XrmGetDatabase() result as global, I'm not doing it here either.
SVN revision: 48403
2010-04-28 13:26:04 -07:00
|
|
|
"Xft.dpi", "Xft.Dpi", &type, &val);
|
|
|
|
}
|
|
|
|
|
2010-01-07 23:10:53 -08:00
|
|
|
if ((status) && (type))
|
|
|
|
{
|
|
|
|
if (!strcmp(type, "String"))
|
|
|
|
{
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
re->xr.dpi = atoi(str) * 1000;
|
2010-01-30 18:50:01 -08:00
|
|
|
evas_common_font_dpi_set(re->xr.dpi / 1000);
|
2010-01-07 23:10:53 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-12-17 00:13:49 -08:00
|
|
|
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;
|
|
|
|
}
|
2009-07-14 14:16:08 -07:00
|
|
|
#endif
|
2008-12-17 00:13:49 -08:00
|
|
|
|
|
|
|
#ifdef BUILD_ENGINE_SOFTWARE_XCB
|
2006-03-02 00:06:10 -08:00
|
|
|
static void *
|
2008-12-17 00:13:49 -08:00
|
|
|
_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)
|
2006-03-02 00:06:10 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
2006-02-27 20:07:49 -08:00
|
|
|
|
2006-03-02 00:06:10 -08:00
|
|
|
re = calloc(1, sizeof(Render_Engine));
|
2009-03-24 02:05:32 -07:00
|
|
|
if (!re)
|
|
|
|
return NULL;
|
2008-12-17 00:13:49 -08:00
|
|
|
|
|
|
|
evas_software_xcb_x_init();
|
|
|
|
evas_software_xcb_x_color_init();
|
|
|
|
evas_software_xcb_outbuf_init();
|
|
|
|
|
2010-04-29 08:32:47 -07:00
|
|
|
// FIXME: re->xrdb
|
2010-01-07 23:10:53 -08:00
|
|
|
|
2008-12-17 00:13:49 -08:00
|
|
|
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);
|
2006-03-02 00:06:10 -08:00
|
|
|
if (!re->ob)
|
|
|
|
{
|
|
|
|
free(re);
|
|
|
|
return NULL;
|
|
|
|
}
|
2008-12-17 00:13:49 -08:00
|
|
|
|
2007-10-01 20:40:14 -07:00
|
|
|
/* 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;
|
|
|
|
*/
|
2008-12-17 00:13:49 -08:00
|
|
|
|
|
|
|
evas_software_xcb_outbuf_debug_set(re->ob, debug);
|
2006-03-02 00:06:10 -08:00
|
|
|
re->tb = evas_common_tilebuf_new(w, h);
|
|
|
|
if (!re->tb)
|
|
|
|
{
|
2008-12-17 00:13:49 -08:00
|
|
|
evas_software_xcb_outbuf_free(re->ob);
|
2006-03-02 00:06:10 -08:00
|
|
|
free(re);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
/* in preliminary tests 16x16 gave highest framerates */
|
|
|
|
evas_common_tilebuf_set_tile_size(re->tb, TILESIZE, TILESIZE);
|
|
|
|
return re;
|
|
|
|
}
|
2008-12-17 00:13:49 -08:00
|
|
|
#endif
|
2006-03-02 00:06:10 -08:00
|
|
|
|
2008-12-17 00:13:49 -08:00
|
|
|
static void *
|
|
|
|
_best_visual_get(int backend, void *connection, int screen)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
2008-12-17 00:13:49 -08:00
|
|
|
if (!connection) return NULL;
|
|
|
|
|
2009-07-14 14:16:08 -07:00
|
|
|
#ifdef BUILD_ENGINE_SOFTWARE_XLIB
|
|
|
|
if (backend == EVAS_ENGINE_INFO_SOFTWARE_X11_BACKEND_XLIB)
|
2008-12-17 00:13:49 -08:00
|
|
|
{
|
|
|
|
return DefaultVisual((Display *)connection, screen);
|
|
|
|
}
|
2009-07-14 14:16:08 -07:00
|
|
|
#endif
|
2008-12-17 00:13:49 -08:00
|
|
|
|
|
|
|
#ifdef BUILD_ENGINE_SOFTWARE_XCB
|
2009-07-14 14:16:08 -07:00
|
|
|
if (backend == EVAS_ENGINE_INFO_SOFTWARE_X11_BACKEND_XCB)
|
2008-12-17 00:13:49 -08:00
|
|
|
{
|
|
|
|
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;
|
2006-03-02 00:06:10 -08:00
|
|
|
}
|
|
|
|
|
2008-12-17 00:13:49 -08:00
|
|
|
static unsigned int
|
|
|
|
_best_colormap_get(int backend, void *connection, int screen)
|
2006-03-02 00:06:10 -08:00
|
|
|
{
|
2008-12-17 00:13:49 -08:00
|
|
|
if (!connection) return 0;
|
|
|
|
|
2009-07-14 14:16:08 -07:00
|
|
|
#ifdef BUILD_ENGINE_SOFTWARE_XLIB
|
|
|
|
if (backend == EVAS_ENGINE_INFO_SOFTWARE_X11_BACKEND_XLIB)
|
2008-12-17 00:13:49 -08:00
|
|
|
{
|
|
|
|
return DefaultColormap((Display *)connection, screen);
|
|
|
|
}
|
2009-07-14 14:16:08 -07:00
|
|
|
#endif
|
2008-12-17 00:13:49 -08:00
|
|
|
|
|
|
|
#ifdef BUILD_ENGINE_SOFTWARE_XCB
|
2009-07-14 14:16:08 -07:00
|
|
|
if (backend == EVAS_ENGINE_INFO_SOFTWARE_X11_BACKEND_XCB)
|
2008-12-17 00:13:49 -08:00
|
|
|
{
|
|
|
|
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;
|
2006-03-02 00:06:10 -08:00
|
|
|
}
|
2002-11-08 00:02:15 -08:00
|
|
|
|
2006-03-02 00:06:10 -08:00
|
|
|
static int
|
2008-12-17 00:13:49 -08:00
|
|
|
_best_depth_get(int backend, void *connection, int screen)
|
2006-02-27 20:07:49 -08:00
|
|
|
{
|
2008-12-17 00:13:49 -08:00
|
|
|
if (!connection) return 0;
|
|
|
|
|
2009-07-14 14:16:08 -07:00
|
|
|
#ifdef BUILD_ENGINE_SOFTWARE_XLIB
|
|
|
|
if (backend == EVAS_ENGINE_INFO_SOFTWARE_X11_BACKEND_XLIB)
|
2008-12-17 00:13:49 -08:00
|
|
|
{
|
|
|
|
return DefaultDepth((Display *)connection, screen);
|
|
|
|
}
|
2009-07-14 14:16:08 -07:00
|
|
|
#endif
|
2008-12-17 00:13:49 -08:00
|
|
|
|
|
|
|
#ifdef BUILD_ENGINE_SOFTWARE_XCB
|
2009-07-14 14:16:08 -07:00
|
|
|
if (backend == EVAS_ENGINE_INFO_SOFTWARE_X11_BACKEND_XCB)
|
2008-12-17 00:13:49 -08:00
|
|
|
{
|
|
|
|
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;
|
2006-03-02 00:06:10 -08:00
|
|
|
}
|
2006-02-27 20:07:49 -08:00
|
|
|
|
2006-03-02 00:06:10 -08:00
|
|
|
/* engine api this module provides */
|
2002-11-08 00:02:15 -08:00
|
|
|
static void *
|
2009-03-06 22:56:42 -08:00
|
|
|
eng_info(Evas *e __UNUSED__)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Evas_Engine_Info_Software_X11 *info;
|
|
|
|
info = calloc(1, sizeof(Evas_Engine_Info_Software_X11));
|
|
|
|
if (!info) return NULL;
|
|
|
|
info->magic.magic = rand();
|
|
|
|
info->info.debug = 0;
|
|
|
|
info->info.alloc_grayscale = 0;
|
|
|
|
info->info.alloc_colors_max = 216;
|
2006-03-02 00:06:10 -08:00
|
|
|
info->func.best_visual_get = _best_visual_get;
|
|
|
|
info->func.best_colormap_get = _best_colormap_get;
|
|
|
|
info->func.best_depth_get = _best_depth_get;
|
2010-05-21 00:10:45 -07:00
|
|
|
info->render_mode = EVAS_RENDER_MODE_BLOCKING;
|
2002-11-08 00:02:15 -08:00
|
|
|
return info;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-02-28 02:08:45 -08:00
|
|
|
eng_info_free(Evas *e __UNUSED__, void *info)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Evas_Engine_Info_Software_X11 *in;
|
|
|
|
in = (Evas_Engine_Info_Software_X11 *)info;
|
|
|
|
free(in);
|
|
|
|
}
|
|
|
|
|
2009-03-24 02:05:32 -07:00
|
|
|
static int
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_setup(Evas *e, void *in)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Evas_Engine_Info_Software_X11 *info;
|
2009-10-07 05:47:01 -07:00
|
|
|
Render_Engine *re = NULL;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
info = (Evas_Engine_Info_Software_X11 *)in;
|
|
|
|
if (!e->engine.data.output)
|
2008-12-17 00:13:49 -08:00
|
|
|
{
|
|
|
|
/* 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_polygon_init();
|
|
|
|
evas_common_line_init();
|
|
|
|
evas_common_font_init();
|
|
|
|
evas_common_draw_init();
|
|
|
|
evas_common_tilebuf_init();
|
|
|
|
|
2009-07-14 14:16:08 -07:00
|
|
|
#ifdef BUILD_ENGINE_SOFTWARE_XLIB
|
|
|
|
if (info->info.backend == EVAS_ENGINE_INFO_SOFTWARE_X11_BACKEND_XLIB)
|
2008-12-17 00:13:49 -08:00
|
|
|
{
|
|
|
|
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;
|
2009-06-26 06:26:52 -07:00
|
|
|
re->outbuf_alpha_get = evas_software_xlib_outbuf_alpha_get;
|
2010-05-21 00:10:45 -07:00
|
|
|
#ifdef EVAS_FRAME_QUEUING
|
|
|
|
re->outbuf_set_priv = evas_software_xlib_outbuf_set_priv;
|
|
|
|
re->render_mode = info->render_mode;
|
|
|
|
#endif
|
2008-12-17 00:13:49 -08:00
|
|
|
}
|
2009-07-14 14:16:08 -07:00
|
|
|
#endif
|
2008-12-17 00:13:49 -08:00
|
|
|
|
2009-03-24 02:05:32 -07:00
|
|
|
#ifdef BUILD_ENGINE_SOFTWARE_XCB
|
2009-07-14 14:16:08 -07:00
|
|
|
if (info->info.backend == EVAS_ENGINE_INFO_SOFTWARE_X11_BACKEND_XCB)
|
2008-12-17 00:13:49 -08:00
|
|
|
{
|
|
|
|
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;
|
2009-06-26 06:26:52 -07:00
|
|
|
re->outbuf_alpha_get = evas_software_xcb_outbuf_alpha_get;
|
2008-12-17 00:13:49 -08:00
|
|
|
}
|
2009-03-24 02:05:32 -07:00
|
|
|
#endif
|
2008-12-17 00:13:49 -08:00
|
|
|
|
|
|
|
e->engine.data.output = re;
|
|
|
|
}
|
2006-03-08 19:51:27 -08:00
|
|
|
else
|
|
|
|
{
|
2008-12-17 00:13:49 -08:00
|
|
|
int ponebuf = 0;
|
|
|
|
|
2010-05-21 00:10:45 -07:00
|
|
|
#ifdef EVAS_FRAME_QUEUING
|
|
|
|
evas_common_frameq_flush ();
|
|
|
|
#endif
|
2006-03-08 19:51:27 -08:00
|
|
|
re = e->engine.data.output;
|
2007-10-01 20:40:14 -07:00
|
|
|
ponebuf = re->ob->onebuf;
|
2008-12-17 00:13:49 -08:00
|
|
|
|
2009-07-14 14:16:08 -07:00
|
|
|
#ifdef BUILD_ENGINE_SOFTWARE_XLIB
|
|
|
|
if (info->info.backend == EVAS_ENGINE_INFO_SOFTWARE_X11_BACKEND_XLIB)
|
2008-12-17 00:13:49 -08:00
|
|
|
{
|
|
|
|
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);
|
2010-05-21 00:10:45 -07:00
|
|
|
#ifdef EVAS_FRAME_QUEUING
|
|
|
|
re->render_mode = info->render_mode;
|
|
|
|
#endif
|
2008-12-17 00:13:49 -08:00
|
|
|
}
|
2009-07-14 14:16:08 -07:00
|
|
|
#endif
|
2008-12-17 00:13:49 -08:00
|
|
|
|
2009-03-24 02:05:32 -07:00
|
|
|
#ifdef BUILD_ENGINE_SOFTWARE_XCB
|
2009-07-14 14:16:08 -07:00
|
|
|
if (info->info.backend == EVAS_ENGINE_INFO_SOFTWARE_X11_BACKEND_XCB)
|
2008-12-17 00:13:49 -08:00
|
|
|
{
|
|
|
|
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);
|
|
|
|
}
|
2009-03-24 02:05:32 -07:00
|
|
|
#endif
|
2007-10-01 20:40:14 -07:00
|
|
|
re->ob->onebuf = ponebuf;
|
2006-03-08 19:51:27 -08:00
|
|
|
}
|
2009-03-24 02:05:32 -07:00
|
|
|
if (!e->engine.data.output) return 0;
|
2002-11-08 00:02:15 -08:00
|
|
|
if (!e->engine.data.context)
|
2005-05-21 19:49:50 -07:00
|
|
|
e->engine.data.context =
|
|
|
|
e->engine.func->context_new(e->engine.data.output);
|
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
re = e->engine.data.output;
|
2009-03-24 02:05:32 -07:00
|
|
|
|
|
|
|
return 1;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_output_free(void *data)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2007-04-29 21:23:47 -07:00
|
|
|
if (!data) return;
|
|
|
|
|
2010-01-07 23:48:18 -08:00
|
|
|
re = (Render_Engine *)data;
|
2010-04-29 08:32:47 -07:00
|
|
|
|
2010-01-07 23:10:53 -08:00
|
|
|
#ifdef BUILD_ENGINE_SOFTWARE_XLIB
|
2010-04-29 08:32:47 -07:00
|
|
|
// NOTE: XrmGetDatabase() result is shared per connection, do not free it.
|
|
|
|
// if (re->xrdb) XrmDestroyDatabase(re->xrdb);
|
|
|
|
#endif
|
|
|
|
|
2008-12-17 00:13:49 -08:00
|
|
|
re->outbuf_free(re->ob);
|
2002-11-13 21:38:10 -08:00
|
|
|
evas_common_tilebuf_free(re->tb);
|
|
|
|
if (re->rects) evas_common_tilebuf_free_render_rects(re->rects);
|
2002-11-08 00:02:15 -08:00
|
|
|
free(re);
|
2004-01-12 10:12:41 -08:00
|
|
|
|
|
|
|
evas_common_font_shutdown();
|
2004-01-17 08:27:58 -08:00
|
|
|
evas_common_image_shutdown();
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_output_resize(void *data, int w, int h)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
re = (Render_Engine *)data;
|
2008-12-17 00:13:49 -08:00
|
|
|
re->outbuf_reconfigure(re->ob, w, h,
|
|
|
|
re->outbuf_get_rot(re->ob),
|
|
|
|
OUTBUF_DEPTH_INHERIT);
|
2002-11-13 21:38:10 -08:00
|
|
|
evas_common_tilebuf_free(re->tb);
|
|
|
|
re->tb = evas_common_tilebuf_new(w, h);
|
2002-11-08 00:02:15 -08:00
|
|
|
if (re->tb)
|
2005-02-04 20:21:25 -08:00
|
|
|
evas_common_tilebuf_set_tile_size(re->tb, TILESIZE, TILESIZE);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_output_tile_size_set(void *data, int w, int h)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
re = (Render_Engine *)data;
|
2005-05-21 19:49:50 -07:00
|
|
|
evas_common_tilebuf_set_tile_size(re->tb, w, h);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_output_redraws_rect_add(void *data, int x, int y, int w, int h)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
re = (Render_Engine *)data;
|
2002-11-13 21:38:10 -08:00
|
|
|
evas_common_tilebuf_add_redraw(re->tb, x, y, w, h);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_output_redraws_rect_del(void *data, int x, int y, int w, int h)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
re = (Render_Engine *)data;
|
2002-11-13 21:38:10 -08:00
|
|
|
evas_common_tilebuf_del_redraw(re->tb, x, y, w, h);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_output_redraws_clear(void *data)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
re = (Render_Engine *)data;
|
2002-11-13 21:38:10 -08:00
|
|
|
evas_common_tilebuf_clear(re->tb);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void *
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_output_redraws_next_update_get(void *data, int *x, int *y, int *w, int *h, int *cx, int *cy, int *cw, int *ch)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
RGBA_Image *surface;
|
|
|
|
Tilebuf_Rect *rect;
|
|
|
|
int ux, uy, uw, uh;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
re = (Render_Engine *)data;
|
|
|
|
if (re->end)
|
|
|
|
{
|
|
|
|
re->end = 0;
|
|
|
|
return NULL;
|
|
|
|
}
|
2005-05-21 19:49:50 -07:00
|
|
|
if (!re->rects)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
2002-11-13 21:38:10 -08:00
|
|
|
re->rects = evas_common_tilebuf_get_render_rects(re->tb);
|
2008-10-17 04:23:18 -07:00
|
|
|
re->cur_rect = EINA_INLIST_GET(re->rects);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
if (!re->cur_rect) return NULL;
|
|
|
|
rect = (Tilebuf_Rect *)re->cur_rect;
|
|
|
|
ux = rect->x; uy = rect->y; uw = rect->w; uh = rect->h;
|
|
|
|
re->cur_rect = re->cur_rect->next;
|
2005-05-21 19:49:50 -07:00
|
|
|
if (!re->cur_rect)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
2002-11-13 21:38:10 -08:00
|
|
|
evas_common_tilebuf_free_render_rects(re->rects);
|
2002-11-08 00:02:15 -08:00
|
|
|
re->rects = NULL;
|
|
|
|
re->end = 1;
|
|
|
|
}
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2008-12-17 00:13:49 -08:00
|
|
|
surface = re->outbuf_new_region_for_update (re->ob, ux, uy, uw, uh, cx, cy, cw, ch);
|
2002-11-08 00:02:15 -08:00
|
|
|
*x = ux; *y = uy; *w = uw; *h = uh;
|
|
|
|
return surface;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2006-02-27 20:07:49 -08:00
|
|
|
eng_output_redraws_next_update_push(void *data, void *surface, int x, int y, int w, int h)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
2010-05-21 00:10:45 -07:00
|
|
|
#ifdef EVAS_FRAME_QUEUING
|
|
|
|
Evas_Surface *e_surface;
|
|
|
|
#endif
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
re = (Render_Engine *)data;
|
2010-05-21 00:10:45 -07:00
|
|
|
#if defined(BUILD_PIPE_RENDER) && !defined(EVAS_FRAME_QUEUING)
|
2010-03-24 09:39:39 -07:00
|
|
|
evas_common_pipe_map4_begin(surface);
|
2010-05-21 00:10:45 -07:00
|
|
|
#endif /* BUILD_PIPE_RENDER && !EVAS_FRAME_QUEUING*/
|
|
|
|
|
|
|
|
#ifdef EVAS_FRAME_QUEUING
|
|
|
|
if (re->render_mode == EVAS_RENDER_MODE_NONBLOCKING)
|
|
|
|
{
|
|
|
|
/* create a new frame if this is the first surface of this frame */
|
|
|
|
evas_common_frameq_prepare_frame();
|
|
|
|
/* add surface into the frame */
|
|
|
|
e_surface = evas_common_frameq_new_surface(surface, x, y, w, h);
|
|
|
|
evas_common_frameq_add_surface(e_surface);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2008-12-17 00:13:49 -08:00
|
|
|
re->outbuf_push_updated_region(re->ob, surface, x, y, w, h);
|
|
|
|
re->outbuf_free_region_for_update(re->ob, surface);
|
2002-11-13 21:38:10 -08:00
|
|
|
evas_common_cpu_end_opt();
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
2010-05-21 00:10:45 -07:00
|
|
|
#ifdef EVAS_FRAME_QUEUING
|
|
|
|
static void *
|
|
|
|
eng_image_map_surface_new(void *data , int w, int h, int alpha)
|
|
|
|
{
|
|
|
|
void *surface;
|
|
|
|
DATA32 *pixels;
|
|
|
|
Render_Engine *re;
|
|
|
|
Evas_Surface *e_surface;
|
|
|
|
|
|
|
|
re = (Render_Engine *)data;
|
|
|
|
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
/* create a new frame if this is the first surface of this frame */
|
|
|
|
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
|
|
|
|
evas_common_frameq_add_surface(e_surface);
|
|
|
|
}
|
|
|
|
return surface;
|
|
|
|
}
|
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
static void
|
2010-05-21 00:10:45 -07:00
|
|
|
eng_output_frameq_redraws_next_update_push(void *data, void *surface, int x, int y, int w, int h)
|
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
|
|
|
|
re = (Render_Engine *)data;
|
|
|
|
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();
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
eng_output_frameq_flush(void *data)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
re = (Render_Engine *)data;
|
2008-12-17 00:13:49 -08:00
|
|
|
re->outbuf_flush(re->ob);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
2010-05-21 00:10:45 -07:00
|
|
|
static void
|
|
|
|
eng_output_frameq_set_priv(void *data, void *cur, void *prev)
|
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
|
|
|
|
re = (Render_Engine *)data;
|
|
|
|
re->outbuf_set_priv(re->ob, cur, prev);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
static void
|
|
|
|
eng_output_flush(void *data)
|
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
|
|
|
|
re = (Render_Engine *)data;
|
|
|
|
#ifdef EVAS_FRAME_QUEUING
|
|
|
|
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);
|
|
|
|
evas_common_frameq_ready_frame();
|
|
|
|
evas_common_frameq_begin();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
{
|
|
|
|
re->outbuf_flush(re->ob);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-06-16 19:56:59 -07:00
|
|
|
static void
|
|
|
|
eng_output_idle_flush(void *data)
|
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
|
|
|
|
re = (Render_Engine *)data;
|
2008-12-17 00:13:49 -08:00
|
|
|
re->outbuf_idle_flush(re->ob);
|
2007-06-16 19:56:59 -07:00
|
|
|
}
|
|
|
|
|
2009-06-26 06:26:52 -07:00
|
|
|
static Eina_Bool
|
2009-08-25 09:21:09 -07:00
|
|
|
eng_canvas_alpha_get(void *data, void *context __UNUSED__)
|
2009-06-26 06:26:52 -07:00
|
|
|
{
|
|
|
|
Render_Engine *re;
|
|
|
|
|
|
|
|
re = (Render_Engine *)data;
|
|
|
|
return (re->ob->priv.destination_alpha) || (re->outbuf_alpha_get(re->ob));
|
|
|
|
}
|
2002-11-08 00:02:15 -08:00
|
|
|
|
2010-05-21 00:10:45 -07:00
|
|
|
|
2006-03-02 00:06:10 -08:00
|
|
|
/* module advertising code */
|
2009-06-16 06:01:36 -07:00
|
|
|
static int
|
2006-03-02 00:06:10 -08:00
|
|
|
module_open(Evas_Module *em)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
2010-04-29 08:32:47 -07:00
|
|
|
#ifdef BUILD_ENGINE_SOFTWARE_XLIB
|
|
|
|
static Eina_Bool xrm_inited = EINA_FALSE;
|
|
|
|
if (!xrm_inited)
|
|
|
|
{
|
|
|
|
xrm_inited = EINA_TRUE;
|
|
|
|
XrmInitialize();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2006-03-02 00:06:10 -08:00
|
|
|
if (!em) return 0;
|
2010-04-29 08:32:47 -07:00
|
|
|
|
2006-03-02 00:06:10 -08:00
|
|
|
/* get whatever engine module we inherit from */
|
|
|
|
if (!_evas_module_engine_inherit(&pfunc, "software_generic")) return 0;
|
2009-10-22 08:22:22 -07:00
|
|
|
_evas_engine_soft_x11_log_dom = eina_log_domain_register("EvasSoftX11", EVAS_DEFAULT_LOG_COLOR);
|
|
|
|
if(_evas_engine_soft_x11_log_dom < 0)
|
|
|
|
{
|
|
|
|
EINA_LOG_ERR("Impossible to create a log domain for the SoftX11 engine.\n");
|
|
|
|
return 0;
|
|
|
|
}
|
2006-03-02 00:06:10 -08:00
|
|
|
/* store it for later use */
|
|
|
|
func = pfunc;
|
|
|
|
/* now to override methods */
|
|
|
|
#define ORD(f) EVAS_API_OVERRIDE(f, &func, eng_)
|
|
|
|
ORD(info);
|
|
|
|
ORD(info_free);
|
|
|
|
ORD(setup);
|
2009-06-26 06:26:52 -07:00
|
|
|
ORD(canvas_alpha_get);
|
2006-03-02 00:06:10 -08:00
|
|
|
ORD(output_free);
|
|
|
|
ORD(output_resize);
|
|
|
|
ORD(output_tile_size_set);
|
|
|
|
ORD(output_redraws_rect_add);
|
|
|
|
ORD(output_redraws_rect_del);
|
|
|
|
ORD(output_redraws_clear);
|
|
|
|
ORD(output_redraws_next_update_get);
|
|
|
|
ORD(output_redraws_next_update_push);
|
|
|
|
ORD(output_flush);
|
2007-06-16 19:56:59 -07:00
|
|
|
ORD(output_idle_flush);
|
2006-03-02 00:06:10 -08:00
|
|
|
/* now advertise out own api */
|
2010-05-21 00:10:45 -07:00
|
|
|
#ifdef EVAS_FRAME_QUEUING
|
|
|
|
ORD(image_map_surface_new);
|
|
|
|
#endif
|
|
|
|
|
2006-03-02 00:06:10 -08:00
|
|
|
em->functions = (void *)(&func);
|
2002-11-08 00:02:15 -08:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2009-06-16 06:01:36 -07:00
|
|
|
static void
|
2009-08-25 09:21:09 -07:00
|
|
|
module_close(Evas_Module *em __UNUSED__)
|
2005-12-03 01:27:53 -08:00
|
|
|
{
|
2009-10-22 08:22:22 -07:00
|
|
|
eina_log_domain_unregister(_evas_engine_soft_x11_log_dom);
|
2010-04-29 08:32:47 -07:00
|
|
|
#ifdef BUILD_ENGINE_SOFTWARE_XLIB
|
|
|
|
if (xrdb_user.db)
|
|
|
|
{
|
|
|
|
XrmDestroyDatabase(xrdb_user.db);
|
|
|
|
xrdb_user.last_stat = 0;
|
|
|
|
xrdb_user.last_mtime = 0;
|
|
|
|
xrdb_user.db = NULL;
|
|
|
|
}
|
|
|
|
#endif
|
2005-12-03 01:27:53 -08:00
|
|
|
}
|
|
|
|
|
2009-06-16 06:01:36 -07:00
|
|
|
static Evas_Module_Api evas_modapi =
|
2006-01-14 04:13:38 -08:00
|
|
|
{
|
2009-03-06 23:00:29 -08:00
|
|
|
EVAS_MODULE_API_VERSION,
|
2009-06-16 06:01:36 -07:00
|
|
|
"software_x11",
|
|
|
|
"none",
|
|
|
|
{
|
|
|
|
module_open,
|
|
|
|
module_close
|
|
|
|
}
|
2006-01-14 04:13:38 -08:00
|
|
|
};
|
2009-06-16 06:01:36 -07:00
|
|
|
|
|
|
|
EVAS_MODULE_DEFINE(EVAS_MODULE_TYPE_ENGINE, engine, software_x11);
|
|
|
|
|
|
|
|
#ifndef EVAS_STATIC_BUILD_SOFTWARE_X11
|
|
|
|
EVAS_EINA_MODULE_DEFINE(engine, software_x11);
|
|
|
|
#endif
|
|
|
|
|