pass the default screen to the info, as it is not stored by XCB itself. Speed up a bit evas_software_xcb_x_can_do_shm

SVN revision: 28494
This commit is contained in:
doursse 2007-02-27 16:08:41 +00:00 committed by doursse
parent a8129d063b
commit 22d230e851
5 changed files with 37 additions and 30 deletions

View File

@ -14,6 +14,7 @@ struct _Evas_Engine_Info_Software_Xcb
/* engine specific data & parameters it needs to set up */
struct {
xcb_connection_t *conn;
xcb_screen_t *screen;
xcb_drawable_t drawable;
xcb_drawable_t mask;
xcb_visualtype_t *visual;
@ -38,6 +39,7 @@ struct _Evas_Engine_Info_Software_Xcb
Evas_Performance *(*performance_test) (Evas *e,
xcb_connection_t *conn,
xcb_screen_t *screen,
xcb_visualtype_t *vis,
xcb_colormap_t cmap,
xcb_drawable_t draw,
@ -47,6 +49,7 @@ struct _Evas_Engine_Info_Software_Xcb
char * (*performance_key_get) (Evas_Performance *perf);
Evas_Performance *(*performance_new) (Evas *e,
xcb_connection_t *conn,
xcb_screen_t *screen,
xcb_visualtype_t *vis,
xcb_colormap_t cmap,
xcb_drawable_t draw,

View File

@ -20,12 +20,12 @@ struct _Render_Engine
};
/* prototypes we will use here */
static void *_output_setup(int w, int h, int rot, xcb_connection_t *conn, 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);
static void *_output_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);
static xcb_visualtype_t *_best_visual_get(xcb_connection_t *conn, int screen);
static xcb_colormap_t _best_colormap_get(xcb_connection_t *conn, int screen);
static int _best_depth_get(xcb_connection_t *conn, int screen);
static Evas_Performance *_output_perf_new(Evas *e, xcb_connection_t *conn, xcb_visualtype_t *vis, xcb_colormap_t cmap, xcb_drawable_t draw, int depth);
static Evas_Performance *_output_perf_test(Evas *e, xcb_connection_t *conn, xcb_visualtype_t *vis, xcb_colormap_t cmap, xcb_drawable_t draw, int depth);
static Evas_Performance *_output_perf_new(Evas *e, xcb_connection_t *conn, xcb_screen_t *screen, xcb_visualtype_t *vis, xcb_colormap_t cmap, xcb_drawable_t draw, int depth);
static Evas_Performance *_output_perf_test(Evas *e, xcb_connection_t *conn, xcb_screen_t *screen, xcb_visualtype_t *vis, xcb_colormap_t cmap, xcb_drawable_t draw, int depth);
static char *_output_perf_data(Evas_Performance *perf);
static char *_output_perf_key(Evas_Performance *perf);
static void _output_perf_free(Evas_Performance *perf);
@ -50,6 +50,7 @@ _output_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,
@ -85,10 +86,11 @@ _output_setup(int w,
evas_software_xcb_outbuf_init();
/* get any stored performance metrics from device (xserver) */
perf = evas_software_xcb_outbuf_perf_restore_x(conn, draw, vis, cmap, depth);
perf = evas_software_xcb_outbuf_perf_restore_x(conn, screen, draw, vis, cmap, depth);
re->ob = evas_software_xcb_outbuf_setup_x(w, h, rot,
OUTBUF_DEPTH_INHERIT,
conn,
screen,
draw,
vis,
cmap,
@ -184,16 +186,16 @@ _best_depth_get(xcb_connection_t *conn, int screen)
}
static Evas_Performance *
_output_perf_new(Evas *e, xcb_connection_t *conn, xcb_visualtype_t *vis, xcb_colormap_t cmap, xcb_drawable_t draw, int depth)
_output_perf_new(Evas *e, xcb_connection_t *conn, xcb_screen_t *screen, xcb_visualtype_t *vis, xcb_colormap_t cmap, xcb_drawable_t draw, int depth)
{
return evas_software_xcb_outbuf_perf_x(conn, draw, vis, cmap, depth);
return evas_software_xcb_outbuf_perf_x(conn, screen, draw, vis, cmap, depth);
e = NULL;
}
static Evas_Performance *
_output_perf_test(Evas *e, xcb_connection_t *conn, xcb_visualtype_t *vis, xcb_colormap_t cmap, xcb_drawable_t draw, int depth)
_output_perf_test(Evas *e, xcb_connection_t *conn, xcb_screen_t *screen, xcb_visualtype_t *vis, xcb_colormap_t cmap, xcb_drawable_t draw, int depth)
{
return evas_software_xcb_outbuf_perf_x(conn, draw, vis, cmap, depth);
return evas_software_xcb_outbuf_perf_x(conn, screen, draw, vis, cmap, depth);
e = NULL;
}
@ -275,6 +277,7 @@ eng_setup(Evas *e, void *in)
e->output.h,
info->info.rotation,
info->info.conn,
info->info.screen,
info->info.drawable,
info->info.visual,
info->info.colormap,
@ -294,11 +297,12 @@ eng_setup(Evas *e, void *in)
info->info.rotation,
OUTBUF_DEPTH_INHERIT,
info->info.conn,
info->info.screen,
info->info.drawable,
info->info.visual,
info->info.colormap,
info->info.depth,
evas_software_xcb_outbuf_perf_restore_x(info->info.conn, info->info.drawable, info->info.visual, info->info.colormap, info->info.depth),
evas_software_xcb_outbuf_perf_restore_x(info->info.conn, 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,

View File

@ -37,6 +37,7 @@ struct _Outbuf
Convert_Pal *pal;
struct {
xcb_connection_t *conn;
xcb_screen_t *screen;
xcb_drawable_t win;
xcb_drawable_t mask;
xcb_visualtype_t *vis;
@ -117,7 +118,8 @@ void evas_software_xcb_x_write_mask_line (Outbuf
DATA32 *src,
int w,
int y);
int evas_software_xcb_x_can_do_shm (xcb_connection_t *c);
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,
@ -158,6 +160,7 @@ Outbuf *evas_software_xcb_outbuf_setup_x (int
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,
@ -173,6 +176,7 @@ char *evas_software_xcb_outbuf_perf_serialize_x (Outbuf_Perf *perf)
void evas_software_xcb_outbuf_perf_deserialize_x (Outbuf_Perf *perf,
const char *data);
Outbuf_Perf *evas_software_xcb_outbuf_perf_new_x (xcb_connection_t *conn,
xcb_screen_t *screen,
xcb_drawable_t draw,
xcb_visualtype_t *vis,
xcb_colormap_t cmap,
@ -181,12 +185,14 @@ Outbuf_Perf *evas_software_xcb_outbuf_perf_new_x (xcb_connection_t *
char *evas_software_xcb_outbuf_perf_serialize_info_x (Outbuf_Perf *perf);
void evas_software_xcb_outbuf_perf_store_x (Outbuf_Perf *perf);
Outbuf_Perf *evas_software_xcb_outbuf_perf_restore_x (xcb_connection_t *conn,
xcb_screen_t *screen,
xcb_drawable_t draw,
xcb_visualtype_t *vis,
xcb_colormap_t cmap,
int x_depth);
void evas_software_xcb_outbuf_perf_free (Outbuf_Perf *perf);
Outbuf_Perf *evas_software_xcb_outbuf_perf_x (xcb_connection_t *conn,
xcb_screen_t *screen,
xcb_drawable_t draw,
xcb_visualtype_t *vis,
xcb_colormap_t cmap,

View File

@ -40,6 +40,7 @@ evas_software_xcb_outbuf_setup_x(int w,
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,
@ -63,6 +64,7 @@ evas_software_xcb_outbuf_setup_x(int w,
buf->rot = rot;
buf->priv.x.conn = conn;
buf->priv.x.screen = screen;
buf->priv.x.vis = vis;
buf->priv.x.cmap = cmap;
buf->priv.x.depth = x_depth;
@ -74,7 +76,7 @@ evas_software_xcb_outbuf_setup_x(int w,
Gfx_Func_Convert conv_func;
Xcb_Output_Buffer *xcbob;
buf->priv.x.shm = evas_software_xcb_x_can_do_shm(buf->priv.x.conn);
buf->priv.x.shm = evas_software_xcb_x_can_do_shm(buf->priv.x.conn, buf->priv.x.screen);
xcbob = evas_software_xcb_x_output_buffer_new(buf->priv.x.conn,
buf->priv.x.depth,
1, 1,
@ -765,6 +767,7 @@ evas_software_xcb_outbuf_perf_deserialize_x(Outbuf_Perf *perf,
Outbuf_Perf *
evas_software_xcb_outbuf_perf_new_x(xcb_connection_t *conn,
xcb_screen_t *screen,
xcb_drawable_t draw,
xcb_visualtype_t *vis,
xcb_colormap_t cmap,
@ -785,8 +788,7 @@ evas_software_xcb_outbuf_perf_new_x(xcb_connection_t *conn,
perf->min_shm_image_pixel_count = 200 * 200; /* default hard-coded */
#if 0
/* FIXME: should use the default screen */
root = xcb_setup_roots_iterator ((xcb_setup_t *)xcb_get_setup (conn)).data->root;
root = screen->root;
if (draw)
{
xcb_get_geometry_reply_t *geom;
@ -812,7 +814,7 @@ evas_software_xcb_outbuf_perf_new_x(xcb_connection_t *conn,
}
perf->x.root = root;
perf->x.display = strdup (":0"); /* FIXME: strdup(DisplayString(disp)); in XCB ? */
perf->x.display = strdup (":0"); /* FIXME: there's no way to get the display value with XCB */
perf->x.vendor = strdup(xcb_setup_vendor((xcb_setup_t *)xcb_get_setup(conn)));
perf->x.version = (int)((xcb_setup_t *)xcb_get_setup(conn))->protocol_major_version;
perf->x.revision = (int)((xcb_setup_t *)xcb_get_setup(conn))->protocol_minor_version;
@ -964,6 +966,7 @@ evas_software_xcb_outbuf_perf_store_x(Outbuf_Perf *perf)
Outbuf_Perf *
evas_software_xcb_outbuf_perf_restore_x(xcb_connection_t *conn,
xcb_screen_t *screen,
xcb_drawable_t draw,
xcb_visualtype_t *vis,
xcb_colormap_t cmap,
@ -979,7 +982,7 @@ evas_software_xcb_outbuf_perf_restore_x(xcb_connection_t *conn,
#endif
Outbuf_Perf *perf;
perf = evas_software_xcb_outbuf_perf_new_x(conn, draw, vis, cmap, x_depth);
perf = evas_software_xcb_outbuf_perf_new_x(conn, screen, draw, vis, cmap, x_depth);
return perf;
#if 0
@ -1040,6 +1043,7 @@ evas_software_xcb_outbuf_perf_free(Outbuf_Perf *perf)
Outbuf_Perf *
evas_software_xcb_outbuf_perf_x(xcb_connection_t *conn,
xcb_screen_t *screen,
xcb_drawable_t draw,
xcb_visualtype_t *vis,
xcb_colormap_t cmap,
@ -1054,7 +1058,7 @@ evas_software_xcb_outbuf_perf_x(xcb_connection_t *conn,
int w, h;
int do_shm = 0;
perf = evas_software_xcb_outbuf_perf_new_x(conn, draw, vis, cmap, x_depth);
perf = evas_software_xcb_outbuf_perf_new_x(conn, screen, draw, vis, cmap, x_depth);
mask = XCB_CW_BACK_PIXMAP | XCB_CW_BORDER_PIXEL |
XCB_CW_BIT_GRAVITY | XCB_CW_BACKING_STORE |
@ -1087,7 +1091,7 @@ evas_software_xcb_outbuf_perf_x(xcb_connection_t *conn,
xcb_configure_window (conn, win, mask, value2);
xcb_map_window (conn, win);
do_shm = evas_software_xcb_x_can_do_shm(conn);
do_shm = evas_software_xcb_x_can_do_shm(conn, screen);
/* set it to something ridiculous to start */
perf->min_shm_image_pixel_count = w * w;

View File

@ -60,31 +60,21 @@ evas_software_xcb_x_write_mask_line(Outbuf *buf,
}
int
evas_software_xcb_x_can_do_shm(xcb_connection_t *c)
evas_software_xcb_x_can_do_shm(xcb_connection_t *c,
xcb_screen_t *screen)
{
static xcb_connection_t *cached_c = NULL;
static int cached_result = 0;
xcb_get_geometry_reply_t *geom;
xcb_drawable_t drawable;
int depth;
if (c == cached_c) return cached_result;
cached_c = c;
/* FIXME: get the corect screen */
drawable = xcb_setup_roots_iterator (xcb_get_setup(c)).data->root;
geom = xcb_get_geometry_reply (c, xcb_get_geometry_unchecked(c, drawable), 0);
if(!geom)
return 0;
depth = geom->depth;
free (geom);
if (xcb_get_extension_data(c, &xcb_shm_id))
{
Xcb_Output_Buffer *xcbob;
xcbob = evas_software_xcb_x_output_buffer_new(c,
depth,
screen->root_depth,
16,
16,
2,