clean up software x11 engine a little. buffer converted pixels and copy to

screen all at once (less "tearing" on updates), minimise syncs, round trips
and remove yet another layer of memcopies if in 24/32bpp and your gfx card
thinks in ARGB. per DWORD. :)


SVN revision: 14704
This commit is contained in:
Carsten Haitzler 2005-05-11 08:52:46 +00:00
parent a63963d14b
commit 17886a3e7b
6 changed files with 649 additions and 985 deletions

View File

@ -243,9 +243,9 @@ evas_engine_software_x11_setup(Evas *e, void *in)
e->engine.func->context_new(e->engine.data.output); e->engine.func->context_new(e->engine.data.output);
re = e->engine.data.output; re = e->engine.data.output;
evas_software_x11_outbuf_software_x11_drawable_set(re->ob, info->info.drawable); evas_software_x11_outbuf_drawable_set(re->ob, info->info.drawable);
evas_software_x11_outbuf_software_x11_mask_set(re->ob, info->info.mask); evas_software_x11_outbuf_mask_set(re->ob, info->info.mask);
evas_software_x11_outbuf_software_x11_rotation_set(re->ob, info->info.rotation); evas_software_x11_outbuf_rotation_set(re->ob, info->info.rotation);
} }
static void * static void *
@ -270,25 +270,24 @@ evas_engine_software_x11_output_setup(int w, int h, int rot, Display *disp, Draw
evas_common_draw_init(); evas_common_draw_init();
evas_common_tilebuf_init(); evas_common_tilebuf_init();
evas_software_x11_x_software_x11_init(); evas_software_x11_x_init();
x_software_x11_color_init(); evas_software_x11_x_color_init();
evas_software_x11_outbuf_software_x11_init(); evas_software_x11_outbuf_init();
/* get any stored performance metrics from device (xserver) */ /* get any stored performance metrics from device (xserver) */
perf = evas_software_x11_outbuf_software_x11_perf_restore_x(disp, draw, vis, cmap, depth); perf = evas_software_x11_outbuf_perf_restore_x(disp, draw, vis, cmap, depth);
re->ob = evas_software_x11_outbuf_software_x11_setup_x(w, h, rot, OUTBUF_DEPTH_INHERIT, disp, draw, vis, cmap, depth, perf, grayscale, max_colors, mask, shape_dither); re->ob = evas_software_x11_outbuf_setup_x(w, h, rot, OUTBUF_DEPTH_INHERIT, disp, draw, vis, cmap, depth, perf, grayscale, max_colors, mask, shape_dither);
if (!re->ob) if (!re->ob)
{ {
evas_software_x11_outbuf_software_x11_perf_free(perf); evas_software_x11_outbuf_perf_free(perf);
free(re); free(re);
return NULL; return NULL;
} }
evas_software_x11_outbuf_software_x11_debug_set(re->ob, debug); evas_software_x11_outbuf_debug_set(re->ob, debug);
evas_software_x11_outbuf_software_x11_set_have_backbuf(re->ob, 0);
re->tb = evas_common_tilebuf_new(w, h); re->tb = evas_common_tilebuf_new(w, h);
if (!re->tb) if (!re->tb)
{ {
evas_software_x11_outbuf_software_x11_free(re->ob); evas_software_x11_outbuf_free(re->ob);
free(re); free(re);
return NULL; return NULL;
} }
@ -303,7 +302,7 @@ evas_engine_software_x11_output_free(void *data)
Render_Engine *re; Render_Engine *re;
re = (Render_Engine *)data; re = (Render_Engine *)data;
evas_software_x11_outbuf_software_x11_free(re->ob); evas_software_x11_outbuf_free(re->ob);
evas_common_tilebuf_free(re->tb); evas_common_tilebuf_free(re->tb);
if (re->rects) evas_common_tilebuf_free_render_rects(re->rects); if (re->rects) evas_common_tilebuf_free_render_rects(re->rects);
free(re); free(re);
@ -318,10 +317,9 @@ evas_engine_software_x11_output_resize(void *data, int w, int h)
Render_Engine *re; Render_Engine *re;
re = (Render_Engine *)data; re = (Render_Engine *)data;
evas_software_x11_outbuf_software_x11_reconfigure(re->ob, w, h, evas_software_x11_outbuf_reconfigure(re->ob, w, h,
evas_software_x11_outbuf_software_x11_get_rot(re->ob), evas_software_x11_outbuf_get_rot(re->ob),
OUTBUF_DEPTH_INHERIT); OUTBUF_DEPTH_INHERIT);
evas_software_x11_outbuf_software_x11_set_have_backbuf(re->ob, 0);
evas_common_tilebuf_free(re->tb); evas_common_tilebuf_free(re->tb);
re->tb = evas_common_tilebuf_new(w, h); re->tb = evas_common_tilebuf_new(w, h);
if (re->tb) if (re->tb)
@ -394,9 +392,8 @@ evas_engine_software_x11_output_redraws_next_update_get(void *data, int *x, int
re->end = 1; re->end = 1;
} }
surface = evas_software_x11_outbuf_software_x11_new_region_for_update(re->ob, surface = evas_software_x11_outbuf_new_region_for_update
ux, uy, uw, uh, (re->ob, ux, uy, uw, uh, cx, cy, cw, ch);
cx, cy, cw, ch);
*x = ux; *y = uy; *w = uw; *h = uh; *x = ux; *y = uy; *w = uw; *h = uh;
return surface; return surface;
} }
@ -408,8 +405,8 @@ evas_engine_software_x11_output_redraws_next_update_push(void *data, void *surfa
Evas_Engine_Info_Software_X11 *info; Evas_Engine_Info_Software_X11 *info;
re = (Render_Engine *)data; re = (Render_Engine *)data;
evas_software_x11_outbuf_software_x11_push_updated_region(re->ob, surface, x, y, w, h); evas_software_x11_outbuf_push_updated_region(re->ob, surface, x, y, w, h);
evas_software_x11_outbuf_software_x11_free_region_for_update(re->ob, surface); evas_software_x11_outbuf_free_region_for_update(re->ob, surface);
evas_common_cpu_end_opt(); evas_common_cpu_end_opt();
} }
@ -419,7 +416,7 @@ evas_engine_software_x11_output_flush(void *data)
Render_Engine *re; Render_Engine *re;
re = (Render_Engine *)data; re = (Render_Engine *)data;
XSync(re->ob->priv.x.disp, False); evas_software_x11_outbuf_flush(re->ob);
} }
static void * static void *
@ -1171,43 +1168,43 @@ evas_engine_software_x11_best_depth_get(Display *disp, int screen)
static Evas_Performance * static Evas_Performance *
evas_engine_software_x11_output_perf_new(Evas *e, Display *disp, Visual *vis, Colormap cmap, Drawable draw, int depth) evas_engine_software_x11_output_perf_new(Evas *e, Display *disp, Visual *vis, Colormap cmap, Drawable draw, int depth)
{ {
return evas_software_x11_outbuf_software_x11_perf_new_x(disp, draw, vis, cmap, depth); return evas_software_x11_outbuf_perf_new_x(disp, draw, vis, cmap, depth);
e = NULL; e = NULL;
} }
static Evas_Performance * static Evas_Performance *
evas_engine_software_x11_output_perf_test(Evas *e, Display *disp, Visual *vis, Colormap cmap, Drawable draw, int depth) evas_engine_software_x11_output_perf_test(Evas *e, Display *disp, Visual *vis, Colormap cmap, Drawable draw, int depth)
{ {
return evas_software_x11_outbuf_software_x11_perf_x(disp, draw, vis, cmap, depth); return evas_software_x11_outbuf_perf_x(disp, draw, vis, cmap, depth);
e = NULL; e = NULL;
} }
static char * static char *
evas_engine_software_x11_output_perf_data(Evas_Performance *perf) evas_engine_software_x11_output_perf_data(Evas_Performance *perf)
{ {
return evas_software_x11_outbuf_software_x11_perf_serialize_x(perf); return evas_software_x11_outbuf_perf_serialize_x(perf);
} }
static char * static char *
evas_engine_software_x11_output_perf_key(Evas_Performance *perf) evas_engine_software_x11_output_perf_key(Evas_Performance *perf)
{ {
return evas_software_x11_outbuf_software_x11_perf_serialize_info_x(perf); return evas_software_x11_outbuf_perf_serialize_info_x(perf);
} }
static void static void
evas_engine_software_x11_output_perf_free(Evas_Performance *perf) evas_engine_software_x11_output_perf_free(Evas_Performance *perf)
{ {
evas_software_x11_outbuf_software_x11_perf_free(perf); evas_software_x11_outbuf_perf_free(perf);
} }
static void static void
evas_engine_software_x11_output_perf_build(Evas_Performance *perf, const char *data) evas_engine_software_x11_output_perf_build(Evas_Performance *perf, const char *data)
{ {
evas_software_x11_outbuf_software_x11_perf_deserialize_x(perf, data); evas_software_x11_outbuf_perf_deserialize_x(perf, data);
} }
static void static void
evas_engine_software_x11_output_perf_device_store(Evas_Performance *perf) evas_engine_software_x11_output_perf_device_store(Evas_Performance *perf)
{ {
evas_software_x11_outbuf_software_x11_perf_store_x(perf); evas_software_x11_outbuf_perf_store_x(perf);
} }

View File

@ -1,12 +1,20 @@
#ifndef EVAS_ENGINE_H #ifndef EVAS_ENGINE_H
#define EVAS_ENGINE_H #define EVAS_ENGINE_H
/* PERF:
* # EVAS BENCH: 4.072
*/
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include <X11/Xutil.h> #include <X11/Xutil.h>
#include <X11/Xatom.h> #include <X11/Xatom.h>
#include <X11/extensions/XShm.h>
#include <sys/ipc.h>
#include <sys/shm.h>
typedef struct _Outbuf Outbuf; typedef struct _Outbuf Outbuf;
typedef struct _Outbuf_Perf Outbuf_Perf; typedef struct _Outbuf_Perf Outbuf_Perf;
typedef struct _Outbuf_Region Outbuf_Region;
typedef struct _X_Output_Buffer X_Output_Buffer; typedef struct _X_Output_Buffer X_Output_Buffer;
typedef enum _Outbuf_Depth Outbuf_Depth; typedef enum _Outbuf_Depth Outbuf_Depth;
@ -47,7 +55,11 @@ struct _Outbuf
struct { struct {
DATA32 r, g, b; DATA32 r, g, b;
} mask; } mask;
RGBA_Image *back_buf; /* lets not do back buf for now */
/* RGBA_Image *back_buf; */
/* a list of pending regions to write to the target */
Evas_List *pending_writes;
int mask_dither : 1; int mask_dither : 1;
@ -83,53 +95,64 @@ struct _Outbuf_Perf
int min_shm_image_pixel_count; int min_shm_image_pixel_count;
}; };
struct _Outbuf_Region
{
X_Output_Buffer *xob, *mxob;
int x, y, w, h;
};
struct _X_Output_Buffer
{
Display *display;
XImage *xim;
XShmSegmentInfo *shm_info;
void *data;
};
/****/ /****/
void evas_software_x11_x_software_x11_init (void); void evas_software_x11_x_init (void);
void evas_software_x11_x_software_x11_write_mask_line (X_Output_Buffer *xob, DATA32 *src, int w, int y); void evas_software_x11_x_write_mask_line (X_Output_Buffer *xob, DATA32 *src, int w, int y);
int evas_software_x11_x_software_x11_can_do_shm (Display *d); int evas_software_x11_x_can_do_shm (Display *d);
X_Output_Buffer *evas_software_x11_x_software_x11_output_buffer_new (Display *d, Visual *v, int depth, int w, int h, int try_shm, void *data); X_Output_Buffer *evas_software_x11_x_output_buffer_new (Display *d, Visual *v, int depth, int w, int h, int try_shm, void *data);
void evas_software_x11_x_software_x11_output_buffer_free (X_Output_Buffer *xob); void evas_software_x11_x_output_buffer_free (X_Output_Buffer *xob, int sync);
void evas_software_x11_x_software_x11_output_buffer_paste (X_Output_Buffer *xob, Drawable d, GC gc, int x, int y); void evas_software_x11_x_output_buffer_paste (X_Output_Buffer *xob, Drawable d, GC gc, int x, int y, int sync);
DATA8 *evas_software_x11_x_software_x11_output_buffer_data (X_Output_Buffer *xob, int *bytes_per_line_ret); DATA8 *evas_software_x11_x_output_buffer_data (X_Output_Buffer *xob, int *bytes_per_line_ret);
int evas_software_x11_x_software_x11_output_buffer_depth (X_Output_Buffer *xob); int evas_software_x11_x_output_buffer_depth (X_Output_Buffer *xob);
int evas_software_x11_x_software_x11_output_buffer_byte_order(X_Output_Buffer *xob); int evas_software_x11_x_output_buffer_byte_order (X_Output_Buffer *xob);
void x_software_x11_color_init (void); void evas_software_x11_x_color_init (void);
Convert_Pal *evas_software_x11_x_software_x11_color_allocate (Display *disp, Colormap cmap, Visual *vis, Convert_Pal_Mode colors); Convert_Pal *evas_software_x11_x_color_allocate (Display *disp, Colormap cmap, Visual *vis, Convert_Pal_Mode colors);
void evas_software_x11_x_software_x11_color_deallocate (Display *disp, Colormap cmap, Visual *vis, Convert_Pal *pal); void evas_software_x11_x_color_deallocate (Display *disp, Colormap cmap, Visual *vis, Convert_Pal *pal);
void evas_software_x11_outbuf_software_x11_init (void); void evas_software_x11_outbuf_init (void);
void evas_software_x11_outbuf_software_x11_free (Outbuf *buf); void evas_software_x11_outbuf_free (Outbuf *buf);
Outbuf *evas_software_x11_outbuf_software_x11_setup_x (int w, int h, int rot, Outbuf_Depth depth, Display *disp, Drawable draw, Visual *vis, Colormap cmap, int x_depth, Outbuf_Perf *perf, int grayscale, int max_colors, Pixmap mask, int shape_dither); Outbuf *evas_software_x11_outbuf_setup_x (int w, int h, int rot, Outbuf_Depth depth, Display *disp, Drawable draw, Visual *vis, Colormap cmap, int x_depth, Outbuf_Perf *perf, int grayscale, int max_colors, Pixmap mask, int shape_dither);
char *evas_software_x11_outbuf_software_x11_perf_serialize_x (Outbuf_Perf *perf); char *evas_software_x11_outbuf_perf_serialize_x (Outbuf_Perf *perf);
void evas_software_x11_outbuf_software_x11_perf_deserialize_x (Outbuf_Perf *perf, const char *data); void evas_software_x11_outbuf_perf_deserialize_x (Outbuf_Perf *perf, const char *data);
Outbuf_Perf *evas_software_x11_outbuf_software_x11_perf_new_x (Display *disp, Window draw, Visual *vis, Colormap cmap, int x_depth); Outbuf_Perf *evas_software_x11_outbuf_perf_new_x (Display *disp, Window draw, Visual *vis, Colormap cmap, int x_depth);
char *evas_software_x11_outbuf_software_x11_perf_serialize_info_x (Outbuf_Perf *perf); char *evas_software_x11_outbuf_perf_serialize_info_x (Outbuf_Perf *perf);
void evas_software_x11_outbuf_software_x11_perf_store_x (Outbuf_Perf *perf); void evas_software_x11_outbuf_perf_store_x (Outbuf_Perf *perf);
Outbuf_Perf *evas_software_x11_outbuf_software_x11_perf_restore_x (Display *disp, Window draw, Visual *vis, Colormap cmap, int x_depth); Outbuf_Perf *evas_software_x11_outbuf_perf_restore_x (Display *disp, Window draw, Visual *vis, Colormap cmap, int x_depth);
void evas_software_x11_outbuf_software_x11_perf_free (Outbuf_Perf *perf); void evas_software_x11_outbuf_perf_free (Outbuf_Perf *perf);
Outbuf_Perf *evas_software_x11_outbuf_software_x11_perf_x (Display *disp, Window draw, Visual *vis, Colormap cmap, int x_depth); Outbuf_Perf *evas_software_x11_outbuf_perf_x (Display *disp, Window draw, Visual *vis, Colormap cmap, int x_depth);
void evas_software_x11_outbuf_software_x11_blit (Outbuf *buf, int src_x, int src_y, int w, int h, int dst_x, int dst_y); RGBA_Image *evas_software_x11_outbuf_new_region_for_update (Outbuf *buf, int x, int y, int w, int h, int *cx, int *cy, int *cw, int *ch);
void evas_software_x11_outbuf_software_x11_update (Outbuf *buf, int x, int y, int w, int h); void evas_software_x11_outbuf_free_region_for_update (Outbuf *buf, RGBA_Image *update);
RGBA_Image *evas_software_x11_outbuf_software_x11_new_region_for_update (Outbuf *buf, int x, int y, int w, int h, int *cx, int *cy, int *cw, int *ch); void evas_software_x11_outbuf_flush (Outbuf *buf);
void evas_software_x11_outbuf_software_x11_free_region_for_update (Outbuf *buf, RGBA_Image *update); void evas_software_x11_outbuf_push_updated_region (Outbuf *buf, RGBA_Image *update, int x, int y, int w, int h);
void evas_software_x11_outbuf_software_x11_push_updated_region (Outbuf *buf, RGBA_Image *update, int x, int y, int w, int h); void evas_software_x11_outbuf_reconfigure (Outbuf *buf, int w, int h, int rot, Outbuf_Depth depth);
void evas_software_x11_outbuf_software_x11_reconfigure (Outbuf *buf, int w, int h, int rot, Outbuf_Depth depth); int evas_software_x11_outbuf_get_width (Outbuf *buf);
int evas_software_x11_outbuf_software_x11_get_width (Outbuf *buf); int evas_software_x11_outbuf_get_height (Outbuf *buf);
int evas_software_x11_outbuf_software_x11_get_height (Outbuf *buf); Outbuf_Depth evas_software_x11_outbuf_get_depth (Outbuf *buf);
Outbuf_Depth evas_software_x11_outbuf_software_x11_get_depth (Outbuf *buf); int evas_software_x11_outbuf_get_rot (Outbuf *buf);
int evas_software_x11_outbuf_software_x11_get_rot (Outbuf *buf); void evas_software_x11_outbuf_drawable_set (Outbuf *buf, Drawable draw);
int evas_software_x11_outbuf_software_x11_get_have_backbuf (Outbuf *buf); void evas_software_x11_outbuf_mask_set (Outbuf *buf, Pixmap mask);
void evas_software_x11_outbuf_software_x11_set_have_backbuf (Outbuf *buf, int have_backbuf); void evas_software_x11_outbuf_rotation_set (Outbuf *buf, int rot);
void evas_software_x11_outbuf_software_x11_drawable_set (Outbuf *buf, Drawable draw);
void evas_software_x11_outbuf_software_x11_mask_set (Outbuf *buf, Pixmap mask);
void evas_software_x11_outbuf_software_x11_rotation_set (Outbuf *buf, int rot);
void evas_software_x11_outbuf_software_x11_debug_set (Outbuf *buf, int debug); void evas_software_x11_outbuf_debug_set (Outbuf *buf, int debug);
void evas_software_x11_outbuf_software_x11_debug_show (Outbuf *buf, Drawable draw, int x, int y, int w, int h); void evas_software_x11_outbuf_debug_show (Outbuf *buf, Drawable draw, int x, int y, int w, int h);
#endif #endif

File diff suppressed because it is too large Load Diff

View File

@ -1,63 +1,66 @@
#include "evas_common.h" #include "evas_common.h"
#include "evas_engine.h" #include "evas_engine.h"
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/extensions/XShm.h>
#include <sys/ipc.h>
#include <sys/shm.h>
struct _X_Output_Buffer
{
Display *display;
XImage *xim;
XShmSegmentInfo *shm_info;
void *data;
};
static int _x_err = 0; static int _x_err = 0;
void void
evas_software_x11_x_software_x11_write_mask_line(X_Output_Buffer *xob, DATA32 *src, int w, int y) evas_software_x11_x_write_mask_line(X_Output_Buffer *xob, DATA32 *src, int w, int y)
{ {
int x; int x;
DATA32 *src_ptr;
DATA8 *dst_ptr;
int bpl = 0;
for (x = 0; x < w; x++) src_ptr = src;
dst_ptr = evas_software_x11_x_output_buffer_data(xob, &bpl);
dst_ptr = dst_ptr + (bpl * y);
for (x = 0; x < w; x += 8)
{ {
XPutPixel(xob->xim, x, y, A_VAL(&(src[x])) >> 7); *dst_ptr =
((A_VAL(&(src_ptr[0])) >> 7) << 0) |
((A_VAL(&(src_ptr[1])) >> 7) << 1) |
((A_VAL(&(src_ptr[2])) >> 7) << 2) |
((A_VAL(&(src_ptr[3])) >> 7) << 3) |
((A_VAL(&(src_ptr[4])) >> 7) << 4) |
((A_VAL(&(src_ptr[5])) >> 7) << 5) |
((A_VAL(&(src_ptr[6])) >> 7) << 6) |
((A_VAL(&(src_ptr[7])) >> 7) << 7);
src_ptr += 8;
dst_ptr++;
}
for (; x < w; x ++)
{
XPutPixel(xob->xim, x, y, A_VAL(src_ptr) >> 7);
src_ptr++;
} }
} }
int int
evas_software_x11_x_software_x11_can_do_shm(Display *d) evas_software_x11_x_can_do_shm(Display *d)
{ {
if (XShmQueryExtension(d)) if (XShmQueryExtension(d))
{ {
X_Output_Buffer *xob; X_Output_Buffer *xob;
xob = evas_software_x11_x_software_x11_output_buffer_new(d, xob = evas_software_x11_x_output_buffer_new
DefaultVisual(d, DefaultScreen(d)), (d, DefaultVisual(d, DefaultScreen(d)),
DefaultDepth(d, DefaultScreen(d)), DefaultDepth(d, DefaultScreen(d)), 16, 16, 2, NULL);
16, 16, 2, NULL); if (!xob) return 0;
if (!xob) evas_software_x11_x_output_buffer_free(xob, 1);
return 0;
evas_software_x11_x_software_x11_output_buffer_free(xob);
return 1; return 1;
} }
return 0; return 0;
} }
static void static void
x_software_x11_output_tmp_x_err(Display * d, XErrorEvent * ev) x_output_tmp_x_err(Display * d, XErrorEvent * ev)
{ {
_x_err = 1; _x_err = 1;
return; return;
d = NULL;
ev = NULL;
} }
X_Output_Buffer * X_Output_Buffer *
evas_software_x11_x_software_x11_output_buffer_new(Display *d, Visual *v, int depth, int w, int h, int try_shm, void *data) evas_software_x11_x_output_buffer_new(Display *d, Visual *v, int depth, int w, int h, int try_shm, void *data)
{ {
X_Output_Buffer *xob; X_Output_Buffer *xob;
@ -73,7 +76,8 @@ evas_software_x11_x_software_x11_output_buffer_new(Display *d, Visual *v, int de
xob->shm_info = malloc(sizeof(XShmSegmentInfo)); xob->shm_info = malloc(sizeof(XShmSegmentInfo));
if (xob->shm_info) if (xob->shm_info)
{ {
xob->xim = XShmCreateImage(d, v, depth, ZPixmap, NULL, xob->shm_info, w, h); xob->xim = XShmCreateImage(d, v, depth, ZPixmap, NULL,
xob->shm_info, w, h);
if (xob->xim) if (xob->xim)
{ {
xob->shm_info->shmid = shmget(IPC_PRIVATE, xob->shm_info->shmid = shmget(IPC_PRIVATE,
@ -92,7 +96,7 @@ evas_software_x11_x_software_x11_output_buffer_new(Display *d, Visual *v, int de
XSync(d, False); XSync(d, False);
_x_err = 0; _x_err = 0;
ph = XSetErrorHandler((XErrorHandler) ph = XSetErrorHandler((XErrorHandler)
x_software_x11_output_tmp_x_err); x_output_tmp_x_err);
XShmAttach(d, xob->shm_info); XShmAttach(d, xob->shm_info);
XSync(d, False); XSync(d, False);
XSetErrorHandler((XErrorHandler)ph); XSetErrorHandler((XErrorHandler)ph);
@ -137,11 +141,11 @@ evas_software_x11_x_software_x11_output_buffer_new(Display *d, Visual *v, int de
} }
void void
evas_software_x11_x_software_x11_output_buffer_free(X_Output_Buffer *xob) evas_software_x11_x_output_buffer_free(X_Output_Buffer *xob, int sync)
{ {
if (xob->shm_info) if (xob->shm_info)
{ {
XSync(xob->display, False); if (sync) XSync(xob->display, False);
XShmDetach(xob->display, xob->shm_info); XShmDetach(xob->display, xob->shm_info);
XDestroyImage(xob->xim); XDestroyImage(xob->xim);
shmdt(xob->shm_info->shmaddr); shmdt(xob->shm_info->shmaddr);
@ -157,34 +161,34 @@ evas_software_x11_x_software_x11_output_buffer_free(X_Output_Buffer *xob)
} }
void void
evas_software_x11_x_software_x11_output_buffer_paste(X_Output_Buffer *xob, Drawable d, GC gc, int x, int y) evas_software_x11_x_output_buffer_paste(X_Output_Buffer *xob, Drawable d, GC gc, int x, int y, int sync)
{ {
if (xob->shm_info) if (xob->shm_info)
{ {
XShmPutImage(xob->display, d, gc, xob->xim, 0, 0, x, y, xob->xim->width, xob->xim->height, False); XShmPutImage(xob->display, d, gc, xob->xim, 0, 0, x, y,
XSync(xob->display, False); xob->xim->width, xob->xim->height, False);
if (sync) XSync(xob->display, False);
} }
else else
{ XPutImage(xob->display, d, gc, xob->xim, 0, 0, x, y,
XPutImage(xob->display, d, gc, xob->xim, 0, 0, x, y, xob->xim->width, xob->xim->height); xob->xim->width, xob->xim->height);
}
} }
DATA8 * DATA8 *
evas_software_x11_x_software_x11_output_buffer_data(X_Output_Buffer *xob, int *bytes_per_line_ret) evas_software_x11_x_output_buffer_data(X_Output_Buffer *xob, int *bytes_per_line_ret)
{ {
if (bytes_per_line_ret) *bytes_per_line_ret = xob->xim->bytes_per_line; if (bytes_per_line_ret) *bytes_per_line_ret = xob->xim->bytes_per_line;
return xob->xim->data; return xob->xim->data;
} }
int int
evas_software_x11_x_software_x11_output_buffer_depth(X_Output_Buffer *xob) evas_software_x11_x_output_buffer_depth(X_Output_Buffer *xob)
{ {
return xob->xim->bits_per_pixel; return xob->xim->bits_per_pixel;
} }
int int
evas_software_x11_x_software_x11_output_buffer_byte_order(X_Output_Buffer *xob) evas_software_x11_x_output_buffer_byte_order(X_Output_Buffer *xob)
{ {
return xob->xim->byte_order; return xob->xim->byte_order;
} }

View File

@ -15,28 +15,28 @@ struct _Convert_Pal_Priv
typedef DATA8 * (*X_Func_Alloc_Colors) (Display *d, Colormap cmap, Visual *v); typedef DATA8 * (*X_Func_Alloc_Colors) (Display *d, Colormap cmap, Visual *v);
static X_Func_Alloc_Colors x_software_x11_color_alloc[PAL_MODE_LAST + 1]; static X_Func_Alloc_Colors x_color_alloc[PAL_MODE_LAST + 1];
static int x_software_x11_color_count[PAL_MODE_LAST + 1]; static int x_color_count[PAL_MODE_LAST + 1];
static Evas_List *palettes = NULL; static Evas_List *palettes = NULL;
static DATA8 * x_software_x11_color_alloc_rgb(int nr, int ng, int nb, Display *d, Colormap cmap, Visual *v); static DATA8 * x_color_alloc_rgb(int nr, int ng, int nb, Display *d, Colormap cmap, Visual *v);
static DATA8 * x_software_x11_color_alloc_gray(int ng, Display *d, Colormap cmap, Visual *v); static DATA8 * x_color_alloc_gray(int ng, Display *d, Colormap cmap, Visual *v);
static DATA8 * x_software_x11_color_alloc_rgb_332(Display *d, Colormap cmap, Visual *v); static DATA8 * x_color_alloc_rgb_332(Display *d, Colormap cmap, Visual *v);
static DATA8 * x_software_x11_color_alloc_rgb_666(Display *d, Colormap cmap, Visual *v); static DATA8 * x_color_alloc_rgb_666(Display *d, Colormap cmap, Visual *v);
static DATA8 * x_software_x11_color_alloc_rgb_232(Display *d, Colormap cmap, Visual *v); static DATA8 * x_color_alloc_rgb_232(Display *d, Colormap cmap, Visual *v);
static DATA8 * x_software_x11_color_alloc_rgb_222(Display *d, Colormap cmap, Visual *v); static DATA8 * x_color_alloc_rgb_222(Display *d, Colormap cmap, Visual *v);
static DATA8 * x_software_x11_color_alloc_rgb_221(Display *d, Colormap cmap, Visual *v); static DATA8 * x_color_alloc_rgb_221(Display *d, Colormap cmap, Visual *v);
static DATA8 * x_software_x11_color_alloc_rgb_121(Display *d, Colormap cmap, Visual *v); static DATA8 * x_color_alloc_rgb_121(Display *d, Colormap cmap, Visual *v);
static DATA8 * x_software_x11_color_alloc_rgb_111(Display *d, Colormap cmap, Visual *v); static DATA8 * x_color_alloc_rgb_111(Display *d, Colormap cmap, Visual *v);
static DATA8 * x_software_x11_color_alloc_gray_256(Display *d, Colormap cmap, Visual *v); static DATA8 * x_color_alloc_gray_256(Display *d, Colormap cmap, Visual *v);
static DATA8 * x_software_x11_color_alloc_gray_64(Display *d, Colormap cmap, Visual *v); static DATA8 * x_color_alloc_gray_64(Display *d, Colormap cmap, Visual *v);
static DATA8 * x_software_x11_color_alloc_gray_16(Display *d, Colormap cmap, Visual *v); static DATA8 * x_color_alloc_gray_16(Display *d, Colormap cmap, Visual *v);
static DATA8 * x_software_x11_color_alloc_gray_4(Display *d, Colormap cmap, Visual *v); static DATA8 * x_color_alloc_gray_4(Display *d, Colormap cmap, Visual *v);
static DATA8 * x_software_x11_color_alloc_mono(Display *d, Colormap cmap, Visual *v); static DATA8 * x_color_alloc_mono(Display *d, Colormap cmap, Visual *v);
static DATA8 * static DATA8 *
x_software_x11_color_alloc_rgb(int nr, int ng, int nb, Display *d, Colormap cmap, Visual *v) x_color_alloc_rgb(int nr, int ng, int nb, Display *d, Colormap cmap, Visual *v)
{ {
int r, g, b, i; int r, g, b, i;
DATA8 *color_lut; DATA8 *color_lut;
@ -92,7 +92,7 @@ x_software_x11_color_alloc_rgb(int nr, int ng, int nb, Display *d, Colormap cmap
} }
static DATA8 * static DATA8 *
x_software_x11_color_alloc_gray(int ng, Display *d, Colormap cmap, Visual *v) x_color_alloc_gray(int ng, Display *d, Colormap cmap, Visual *v)
{ {
int g, i; int g, i;
DATA8 *color_lut; DATA8 *color_lut;
@ -140,129 +140,129 @@ x_software_x11_color_alloc_gray(int ng, Display *d, Colormap cmap, Visual *v)
} }
static DATA8 * static DATA8 *
x_software_x11_color_alloc_rgb_332(Display *d, Colormap cmap, Visual *v) x_color_alloc_rgb_332(Display *d, Colormap cmap, Visual *v)
{ {
return x_software_x11_color_alloc_rgb(8, 8, 4, d, cmap, v); return x_color_alloc_rgb(8, 8, 4, d, cmap, v);
} }
static DATA8 * static DATA8 *
x_software_x11_color_alloc_rgb_666(Display *d, Colormap cmap, Visual *v) x_color_alloc_rgb_666(Display *d, Colormap cmap, Visual *v)
{ {
return x_software_x11_color_alloc_rgb(6, 6, 6, d, cmap, v); return x_color_alloc_rgb(6, 6, 6, d, cmap, v);
} }
static DATA8 * static DATA8 *
x_software_x11_color_alloc_rgb_232(Display *d, Colormap cmap, Visual *v) x_color_alloc_rgb_232(Display *d, Colormap cmap, Visual *v)
{ {
return x_software_x11_color_alloc_rgb(4, 8, 4, d, cmap, v); return x_color_alloc_rgb(4, 8, 4, d, cmap, v);
} }
static DATA8 * static DATA8 *
x_software_x11_color_alloc_rgb_222(Display *d, Colormap cmap, Visual *v) x_color_alloc_rgb_222(Display *d, Colormap cmap, Visual *v)
{ {
return x_software_x11_color_alloc_rgb(4, 4, 4, d, cmap, v); return x_color_alloc_rgb(4, 4, 4, d, cmap, v);
} }
static DATA8 * static DATA8 *
x_software_x11_color_alloc_rgb_221(Display *d, Colormap cmap, Visual *v) x_color_alloc_rgb_221(Display *d, Colormap cmap, Visual *v)
{ {
return x_software_x11_color_alloc_rgb(4, 4, 2, d, cmap, v); return x_color_alloc_rgb(4, 4, 2, d, cmap, v);
} }
static DATA8 * static DATA8 *
x_software_x11_color_alloc_rgb_121(Display *d, Colormap cmap, Visual *v) x_color_alloc_rgb_121(Display *d, Colormap cmap, Visual *v)
{ {
return x_software_x11_color_alloc_rgb(2, 4, 2, d, cmap, v); return x_color_alloc_rgb(2, 4, 2, d, cmap, v);
} }
static DATA8 * static DATA8 *
x_software_x11_color_alloc_rgb_111(Display *d, Colormap cmap, Visual *v) x_color_alloc_rgb_111(Display *d, Colormap cmap, Visual *v)
{ {
return x_software_x11_color_alloc_rgb(2, 2, 2, d, cmap, v); return x_color_alloc_rgb(2, 2, 2, d, cmap, v);
} }
static DATA8 * static DATA8 *
x_software_x11_color_alloc_gray_256(Display *d, Colormap cmap, Visual *v) x_color_alloc_gray_256(Display *d, Colormap cmap, Visual *v)
{ {
return x_software_x11_color_alloc_gray(256, d, cmap, v); return x_color_alloc_gray(256, d, cmap, v);
} }
static DATA8 * static DATA8 *
x_software_x11_color_alloc_gray_64(Display *d, Colormap cmap, Visual *v) x_color_alloc_gray_64(Display *d, Colormap cmap, Visual *v)
{ {
return x_software_x11_color_alloc_gray(64, d, cmap, v); return x_color_alloc_gray(64, d, cmap, v);
} }
static DATA8 * static DATA8 *
x_software_x11_color_alloc_gray_16(Display *d, Colormap cmap, Visual *v) x_color_alloc_gray_16(Display *d, Colormap cmap, Visual *v)
{ {
return x_software_x11_color_alloc_gray(32, d, cmap, v); return x_color_alloc_gray(32, d, cmap, v);
} }
static DATA8 * static DATA8 *
x_software_x11_color_alloc_gray_4(Display *d, Colormap cmap, Visual *v) x_color_alloc_gray_4(Display *d, Colormap cmap, Visual *v)
{ {
return x_software_x11_color_alloc_gray(16, d, cmap, v); return x_color_alloc_gray(16, d, cmap, v);
} }
static DATA8 * static DATA8 *
x_software_x11_color_alloc_mono(Display *d, Colormap cmap, Visual *v) x_color_alloc_mono(Display *d, Colormap cmap, Visual *v)
{ {
return x_software_x11_color_alloc_gray(2, d, cmap, v); return x_color_alloc_gray(2, d, cmap, v);
} }
void void
x_software_x11_color_init(void) evas_software_x11_x_color_init(void)
{ {
static int initialised = 0; static int initialised = 0;
if (initialised) return; if (initialised) return;
x_software_x11_color_alloc[PAL_MODE_NONE] = NULL; x_color_alloc[PAL_MODE_NONE] = NULL;
x_software_x11_color_count[PAL_MODE_NONE] = 0; x_color_count[PAL_MODE_NONE] = 0;
x_software_x11_color_alloc[PAL_MODE_MONO] = x_software_x11_color_alloc_mono; x_color_alloc[PAL_MODE_MONO] = x_color_alloc_mono;
x_software_x11_color_count[PAL_MODE_MONO] = 2; x_color_count[PAL_MODE_MONO] = 2;
x_software_x11_color_alloc[PAL_MODE_GRAY4] = x_software_x11_color_alloc_gray_4; x_color_alloc[PAL_MODE_GRAY4] = x_color_alloc_gray_4;
x_software_x11_color_count[PAL_MODE_GRAY4] = 4; x_color_count[PAL_MODE_GRAY4] = 4;
x_software_x11_color_alloc[PAL_MODE_GRAY16] = x_software_x11_color_alloc_gray_16; x_color_alloc[PAL_MODE_GRAY16] = x_color_alloc_gray_16;
x_software_x11_color_count[PAL_MODE_GRAY16] = 16; x_color_count[PAL_MODE_GRAY16] = 16;
x_software_x11_color_alloc[PAL_MODE_GRAY64] = x_software_x11_color_alloc_gray_64; x_color_alloc[PAL_MODE_GRAY64] = x_color_alloc_gray_64;
x_software_x11_color_count[PAL_MODE_GRAY64] = 64; x_color_count[PAL_MODE_GRAY64] = 64;
x_software_x11_color_alloc[PAL_MODE_GRAY256] = x_software_x11_color_alloc_gray_256; x_color_alloc[PAL_MODE_GRAY256] = x_color_alloc_gray_256;
x_software_x11_color_count[PAL_MODE_GRAY256] = 256; x_color_count[PAL_MODE_GRAY256] = 256;
x_software_x11_color_alloc[PAL_MODE_RGB111] = x_software_x11_color_alloc_rgb_111; x_color_alloc[PAL_MODE_RGB111] = x_color_alloc_rgb_111;
x_software_x11_color_count[PAL_MODE_RGB111] = 2 * 2 * 2; x_color_count[PAL_MODE_RGB111] = 2 * 2 * 2;
x_software_x11_color_alloc[PAL_MODE_RGB121] = x_software_x11_color_alloc_rgb_121; x_color_alloc[PAL_MODE_RGB121] = x_color_alloc_rgb_121;
x_software_x11_color_count[PAL_MODE_RGB121] = 2 * 4 * 2; x_color_count[PAL_MODE_RGB121] = 2 * 4 * 2;
x_software_x11_color_alloc[PAL_MODE_RGB221] = x_software_x11_color_alloc_rgb_221; x_color_alloc[PAL_MODE_RGB221] = x_color_alloc_rgb_221;
x_software_x11_color_count[PAL_MODE_RGB221] = 4 * 4 * 2; x_color_count[PAL_MODE_RGB221] = 4 * 4 * 2;
x_software_x11_color_alloc[PAL_MODE_RGB222] = x_software_x11_color_alloc_rgb_222; x_color_alloc[PAL_MODE_RGB222] = x_color_alloc_rgb_222;
x_software_x11_color_count[PAL_MODE_RGB222] = 4 * 4 * 4; x_color_count[PAL_MODE_RGB222] = 4 * 4 * 4;
x_software_x11_color_alloc[PAL_MODE_RGB232] = x_software_x11_color_alloc_rgb_232; x_color_alloc[PAL_MODE_RGB232] = x_color_alloc_rgb_232;
x_software_x11_color_count[PAL_MODE_RGB232] = 4 * 8 * 4; x_color_count[PAL_MODE_RGB232] = 4 * 8 * 4;
x_software_x11_color_alloc[PAL_MODE_RGB666] = x_software_x11_color_alloc_rgb_666; x_color_alloc[PAL_MODE_RGB666] = x_color_alloc_rgb_666;
x_software_x11_color_count[PAL_MODE_RGB666] = 6 * 6 * 6; x_color_count[PAL_MODE_RGB666] = 6 * 6 * 6;
x_software_x11_color_alloc[PAL_MODE_RGB332] = x_software_x11_color_alloc_rgb_332; x_color_alloc[PAL_MODE_RGB332] = x_color_alloc_rgb_332;
x_software_x11_color_count[PAL_MODE_RGB332] = 8 * 8 * 4; x_color_count[PAL_MODE_RGB332] = 8 * 8 * 4;
x_software_x11_color_alloc[PAL_MODE_LAST] = NULL; x_color_alloc[PAL_MODE_LAST] = NULL;
x_software_x11_color_count[PAL_MODE_LAST] = 0; x_color_count[PAL_MODE_LAST] = 0;
initialised = 1; initialised = 1;
} }
Convert_Pal * Convert_Pal *
evas_software_x11_x_software_x11_color_allocate(Display *disp, Colormap cmap, Visual *vis, Convert_Pal_Mode colors) evas_software_x11_x_color_allocate(Display *disp, Colormap cmap, Visual *vis, Convert_Pal_Mode colors)
{ {
Convert_Pal_Priv *palpriv; Convert_Pal_Priv *palpriv;
Convert_Pal *pal; Convert_Pal *pal;
@ -285,15 +285,15 @@ evas_software_x11_x_software_x11_color_allocate(Display *disp, Colormap cmap, Vi
if (!pal) return NULL; if (!pal) return NULL;
for (c = colors; c > PAL_MODE_NONE; c--) for (c = colors; c > PAL_MODE_NONE; c--)
{ {
if (x_software_x11_color_alloc[c]) if (x_color_alloc[c])
{ {
pal->lookup = (x_software_x11_color_alloc[c])(disp, cmap, vis); pal->lookup = (x_color_alloc[c])(disp, cmap, vis);
if (pal->lookup) break; if (pal->lookup) break;
} }
} }
pal->references = 1; pal->references = 1;
pal->colors = c; pal->colors = c;
pal->count = x_software_x11_color_count[c]; pal->count = x_color_count[c];
palpriv = calloc(1, sizeof(Convert_Pal_Priv)); palpriv = calloc(1, sizeof(Convert_Pal_Priv));
pal->data = palpriv; pal->data = palpriv;
if (!palpriv) if (!palpriv)
@ -316,8 +316,7 @@ evas_software_x11_x_software_x11_color_allocate(Display *disp, Colormap cmap, Vi
} }
void void
evas_software_x11_x_software_x11_color_deallocate(Display *disp, Colormap cmap, Visual *vis, evas_software_x11_x_color_deallocate(Display *disp, Colormap cmap, Visual *vis, Convert_Pal *pal)
Convert_Pal *pal)
{ {
unsigned long pixels[256]; unsigned long pixels[256];
int j; int j;

View File

@ -5,6 +5,6 @@
#include <X11/Xutil.h> #include <X11/Xutil.h>
void void
evas_software_x11_x_software_x11_init(void) evas_software_x11_x_init(void)
{ {
} }