Evas: Make evas xcb engine match xlib engine almost exactly.

NB: Next is to fine-tooth the ecore code.



SVN revision: 62167
This commit is contained in:
Christopher Michael 2011-08-06 03:32:27 +00:00
parent e2e7f28c61
commit f7359f74c9
2 changed files with 49 additions and 56 deletions

View File

@ -234,7 +234,7 @@ evas_software_xcb_can_do_shm(xcb_connection_t *conn, xcb_screen_t *screen)
xcbob =
evas_software_xcb_output_buffer_new(conn, visual, screen->root_depth,
16, 16, 2, NULL); // 1, 1 EINA_TRUE
16, 16, 2, NULL);
if (!xcbob)
cached_result = 0;
else
@ -260,7 +260,6 @@ evas_software_xcb_output_buffer_new(xcb_connection_t *conn, xcb_visualtype_t *vi
xcbob->shm_info = NULL;
xcbob->w = w;
xcbob->h = h;
xcbob->data = data;
if (try_shm > 0)
{
@ -273,9 +272,12 @@ evas_software_xcb_output_buffer_new(xcb_connection_t *conn, xcb_visualtype_t *vi
depth, NULL, ~0, NULL);
if (xcbob->xim)
{
/* was 0666 */
xcbob->shm_info->shmid =
shmget(IPC_PRIVATE, xcbob->xim->size, (IPC_CREAT | 0777));
shmget(IPC_PRIVATE,
xcbob->xim->stride * xcbob->xim->height,
(IPC_CREAT | 0777));
/* xcbob->shm_info->shmid = */
/* shmget(IPC_PRIVATE, xcbob->xim->size, (IPC_CREAT | 0777)); */
if (xcbob->shm_info->shmid == (uint32_t)-1)
{
xcb_image_destroy(xcbob->xim);
@ -283,14 +285,14 @@ evas_software_xcb_output_buffer_new(xcb_connection_t *conn, xcb_visualtype_t *vi
free(xcbob);
return NULL;
}
xcbob->shm_info->shmaddr =
xcbob->shm_info->shmaddr = xcbob->xim->data =
shmat(xcbob->shm_info->shmid, 0, 0);
if (xcbob->shm_info->shmaddr != ((void *)-1))
{
/* Sync only needed for testing */
if (try_shm == 2) _xcbob_sync(conn);
xcbob->xim->data = xcbob->shm_info->shmaddr;
// xcbob->xim->data = xcbob->shm_info->shmaddr;
#if defined(EVAS_FRAME_QUEUING) && defined(LIBXEXT_VERSION_LOW)
if (evas_common_frameq_enabled())
xcb_grab_server(conn);
@ -307,28 +309,14 @@ evas_software_xcb_output_buffer_new(xcb_connection_t *conn, xcb_visualtype_t *vi
xcbob->psize = (xcbob->bpl * xcbob->h);
return xcbob;
}
else
{
shmdt(xcbob->shm_info->shmaddr);
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;
shmdt(xcbob->shm_info->shmaddr);
shmctl(xcbob->shm_info->shmid, IPC_RMID, 0);
}
if (xcbob->xim) xcb_image_destroy(xcbob->xim);
xcbob->xim = NULL;
}
else
{
free(xcbob);
return NULL;
}
if (xcbob->shm_info) free(xcbob->shm_info);
xcbob->shm_info = NULL;
}
if (try_shm > 1) return NULL;
@ -343,9 +331,11 @@ evas_software_xcb_output_buffer_new(xcb_connection_t *conn, xcb_visualtype_t *vi
return NULL;
}
xcbob->data = data;
if (!xcbob->xim->data)
{
xcbob->xim->data = malloc(xcbob->xim->size);
xcbob->xim->data = malloc(xcbob->xim->stride * xcbob->xim->height);
if (!xcbob->xim->data)
{
xcb_image_destroy(xcbob->xim);
@ -354,7 +344,7 @@ evas_software_xcb_output_buffer_new(xcb_connection_t *conn, xcb_visualtype_t *vi
}
}
xcbob->bpl = xcbob->xim->stride;
xcbob->psize = xcbob->xim->size;
xcbob->psize = (xcbob->bpl * xcbob->h);
return xcbob;
}
@ -373,7 +363,7 @@ evas_software_xcb_output_buffer_free(Xcb_Output_Buffer *xcbob, Eina_Bool sync)
else
{
if (xcbob->data) xcbob->xim->data = NULL;
free(xcbob->xim->data);
// free(xcbob->xim->data);
xcb_image_destroy(xcbob->xim);
}
free(xcbob);
@ -396,7 +386,7 @@ DATA8 *
evas_software_xcb_output_buffer_data(Xcb_Output_Buffer *xcbob, int *bpl_ret)
{
if (bpl_ret) *bpl_ret = xcbob->xim->stride;
return xcbob->xim->data;
return (DATA8 *)xcbob->xim->data;
}
int
@ -433,8 +423,8 @@ _xcbob_create_native(xcb_connection_t *conn, int w, int h, xcb_image_format_t fo
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 */
* using MSB_FIRST, so this routine recreates that function and uses
* the endian-ness of the server setup */
setup = xcb_get_setup(conn);
xif = format;
@ -449,13 +439,13 @@ _xcbob_create_native(xcb_connection_t *conn, int w, int h, xcb_image_format_t fo
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);
/* 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,

View File

@ -254,10 +254,11 @@ evas_software_xcb_outbuf_new_region_for_update(Outbuf *buf, int x, int y, int w,
{
Eina_Rectangle *rect;
RECTS_CLIP_TO_RECT(x, y, w, h, 0, 0, buf->w, buf->h);
if (!(obr = calloc(1, sizeof(Outbuf_Region))))
return NULL;
RECTS_CLIP_TO_RECT(x, y, w, h, 0, 0, buf->w, buf->h);
if (!(rect = eina_rectangle_new(x, y, w, h)))
{
free(obr);
@ -287,10 +288,12 @@ evas_software_xcb_outbuf_new_region_for_update(Outbuf *buf, int x, int y, int w,
if (cy) *cy = y;
if (cw) *cw = w;
if (ch) *ch = h;
alpha = ((buf->priv.x11.xcb.mask) || (buf->priv.destination_alpha));
use_shm = buf->priv.x11.xcb.shm;
if ((buf->rot == 0) && (buf->priv.mask.r == 0xff0000) &&
(buf->priv.mask.g == 0x00ff00) && (buf->priv.mask.b == 0x0000ff))
(buf->priv.mask.g == 0x00ff00) && (buf->priv.mask.b == 0x0000ff))
{
obr->xcbob =
evas_software_xcb_output_buffer_new(buf->priv.x11.xcb.conn,
@ -393,7 +396,7 @@ evas_software_xcb_outbuf_new_region_for_update(Outbuf *buf, int x, int y, int w,
use_shm = buf->priv.x11.xcb.shm;
alpha = ((buf->priv.x11.xcb.mask) || (buf->priv.destination_alpha));
if ((buf->rot == 0) && (buf->priv.mask.r == 0xff0000) &&
(buf->priv.mask.g == 0x00ff00) && (buf->priv.mask.b == 0x0000ff))
(buf->priv.mask.g == 0x00ff00) && (buf->priv.mask.b == 0x0000ff))
{
obr->xcbob =
_find_xcbob(buf->priv.x11.xcb.conn, buf->priv.x11.xcb.visual,
@ -622,7 +625,7 @@ evas_software_xcb_outbuf_flush(Outbuf *buf)
if (obr->xcbob) _unfind_xcbob(obr->xcbob, EINA_FALSE);
if (obr->mask) _unfind_xcbob(obr->mask, EINA_FALSE);
free(obr);
evas_cache_image_drop(&im->cache_entry);
// evas_cache_image_drop(&im->cache_entry);
}
#endif
}
@ -640,12 +643,12 @@ evas_software_xcb_outbuf_idle_flush(Outbuf *buf)
im = buf->priv.onebuf;
buf->priv.onebuf = NULL;
obr = im->extended_info;
evas_cache_image_drop(&im->cache_entry);
if (obr->xcbob)
evas_software_xcb_output_buffer_free(obr->xcbob, EINA_FALSE);
if (obr->mask)
evas_software_xcb_output_buffer_free(obr->mask, EINA_FALSE);
free(obr);
evas_cache_image_drop(&im->cache_entry);
}
else
{
@ -822,14 +825,12 @@ evas_software_xcb_outbuf_push_updated_region(Outbuf *buf, RGBA_Image *update, in
}
#if 1
#else
/* Async Push */
if (!((buf->priv.onebuf) && (buf->priv.onebuf_regions)))
{
evas_software_xcb_output_buffer_paste(obr->xcbob,
buf->priv.x11.xcb.mask,
buf->priv.x11.xcb.gcm,
obr->x, obr->y, 0);
}
/* Async Push */
if (!((buf->priv.onebuf) && (buf->priv.onebuf_regions)))
evas_software_xcb_output_buffer_paste(obr->xcbob,
buf->priv.x11.xcb.mask,
buf->priv.x11.xcb.gcm,
obr->x, obr->y, 0);
#endif
}
#if 1
@ -938,7 +939,7 @@ evas_software_xcb_outbuf_debug_show(Outbuf *buf, xcb_drawable_t drawable, int x,
xcb_get_geometry_unchecked(buf->priv.x11.xcb.conn,
drawable), 0);
root = geom->root;
free (geom);
free(geom);
geom =
xcb_get_geometry_reply(buf->priv.x11.xcb.conn,
xcb_get_geometry_unchecked(buf->priv.x11.xcb.conn,
@ -953,7 +954,7 @@ evas_software_xcb_outbuf_debug_show(Outbuf *buf, xcb_drawable_t drawable, int x,
break;
}
}
free (geom);
free(geom);
for (i = 0; i < 20; i++)
{
@ -969,6 +970,7 @@ evas_software_xcb_outbuf_debug_show(Outbuf *buf, xcb_drawable_t drawable, int x,
xcb_poly_fill_rectangle(buf->priv.x11.xcb.conn, drawable,
buf->priv.x11.xcb.gc, 1, &rect);
_xcbob_sync(buf->priv.x11.xcb.conn);
_xcbob_sync(buf->priv.x11.xcb.conn);
mask = XCB_GC_FOREGROUND | XCB_GC_GRAPHICS_EXPOSURES;
value[0] = screen->white_pixel;
@ -978,16 +980,17 @@ evas_software_xcb_outbuf_debug_show(Outbuf *buf, xcb_drawable_t drawable, int x,
xcb_poly_fill_rectangle(buf->priv.x11.xcb.conn, drawable,
buf->priv.x11.xcb.gc, 1, &rect);
_xcbob_sync(buf->priv.x11.xcb.conn);
_xcbob_sync(buf->priv.x11.xcb.conn);
}
}
# ifdef EVAS_FRAME_QUEUING
#ifdef EVAS_FRAME_QUEUING
void
evas_software_xcb_outbuf_priv_set(Outbuf *buf, void *cur, void *prev __UNUSED__)
{
buf->priv.pending_writes = (Eina_List *)cur;
}
# endif
#endif
/* local functions */
static Xcb_Output_Buffer *