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 = xcbob =
evas_software_xcb_output_buffer_new(conn, visual, screen->root_depth, 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) if (!xcbob)
cached_result = 0; cached_result = 0;
else else
@ -260,7 +260,6 @@ evas_software_xcb_output_buffer_new(xcb_connection_t *conn, xcb_visualtype_t *vi
xcbob->shm_info = NULL; xcbob->shm_info = NULL;
xcbob->w = w; xcbob->w = w;
xcbob->h = h; xcbob->h = h;
xcbob->data = data;
if (try_shm > 0) 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); depth, NULL, ~0, NULL);
if (xcbob->xim) if (xcbob->xim)
{ {
/* was 0666 */
xcbob->shm_info->shmid = 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) if (xcbob->shm_info->shmid == (uint32_t)-1)
{ {
xcb_image_destroy(xcbob->xim); 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); free(xcbob);
return NULL; return NULL;
} }
xcbob->shm_info->shmaddr = xcbob->shm_info->shmaddr = xcbob->xim->data =
shmat(xcbob->shm_info->shmid, 0, 0); shmat(xcbob->shm_info->shmid, 0, 0);
if (xcbob->shm_info->shmaddr != ((void *)-1)) if (xcbob->shm_info->shmaddr != ((void *)-1))
{ {
/* Sync only needed for testing */ /* Sync only needed for testing */
if (try_shm == 2) _xcbob_sync(conn); 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 defined(EVAS_FRAME_QUEUING) && defined(LIBXEXT_VERSION_LOW)
if (evas_common_frameq_enabled()) if (evas_common_frameq_enabled())
xcb_grab_server(conn); 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); xcbob->psize = (xcbob->bpl * xcbob->h);
return xcbob; return xcbob;
} }
else
{
shmdt(xcbob->shm_info->shmaddr); shmdt(xcbob->shm_info->shmaddr);
shmctl(xcbob->shm_info->shmid, IPC_RMID, 0); shmctl(xcbob->shm_info->shmid, IPC_RMID, 0);
xcb_image_destroy(xcbob->xim);
free(xcbob->shm_info);
free(xcbob);
return NULL;
} }
if (xcbob->xim) xcb_image_destroy(xcbob->xim);
xcbob->xim = NULL;
} }
else if (xcbob->shm_info) free(xcbob->shm_info);
{ xcbob->shm_info = NULL;
free(xcbob->shm_info);
free(xcbob);
return NULL;
}
}
else
{
free(xcbob);
return NULL;
}
} }
if (try_shm > 1) return 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; return NULL;
} }
xcbob->data = data;
if (!xcbob->xim->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) if (!xcbob->xim->data)
{ {
xcb_image_destroy(xcbob->xim); 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->bpl = xcbob->xim->stride;
xcbob->psize = xcbob->xim->size; xcbob->psize = (xcbob->bpl * xcbob->h);
return xcbob; return xcbob;
} }
@ -373,7 +363,7 @@ evas_software_xcb_output_buffer_free(Xcb_Output_Buffer *xcbob, Eina_Bool sync)
else else
{ {
if (xcbob->data) xcbob->xim->data = NULL; if (xcbob->data) xcbob->xim->data = NULL;
free(xcbob->xim->data); // free(xcbob->xim->data);
xcb_image_destroy(xcbob->xim); xcb_image_destroy(xcbob->xim);
} }
free(xcbob); free(xcbob);
@ -396,7 +386,7 @@ DATA8 *
evas_software_xcb_output_buffer_data(Xcb_Output_Buffer *xcbob, int *bpl_ret) evas_software_xcb_output_buffer_data(Xcb_Output_Buffer *xcbob, int *bpl_ret)
{ {
if (bpl_ret) *bpl_ret = xcbob->xim->stride; if (bpl_ret) *bpl_ret = xcbob->xim->stride;
return xcbob->xim->data; return (DATA8 *)xcbob->xim->data;
} }
int 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; xcb_image_format_t xif;
/* NB: We cannot use xcb_image_create_native as it only creates images /* NB: We cannot use xcb_image_create_native as it only creates images
* using MSB_FIRST, so this routine recreates that function and checks * using MSB_FIRST, so this routine recreates that function and uses
* endian-ness correctly */ * the endian-ness of the server setup */
setup = xcb_get_setup(conn); setup = xcb_get_setup(conn);
xif = format; 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: case XCB_IMAGE_FORMAT_XY_BITMAP:
if (depth != 1) return 0; if (depth != 1) return 0;
case XCB_IMAGE_FORMAT_XY_PIXMAP: case XCB_IMAGE_FORMAT_XY_PIXMAP:
return xcb_image_create(w, h, xif, /* return xcb_image_create(w, h, xif, */
fmt->scanline_pad, /* fmt->scanline_pad, */
fmt->depth, fmt->bits_per_pixel, /* fmt->depth, fmt->bits_per_pixel, */
setup->bitmap_format_scanline_unit, /* setup->bitmap_format_scanline_unit, */
setup->image_byte_order, /* setup->image_byte_order, */
setup->bitmap_format_bit_order, /* setup->bitmap_format_bit_order, */
base, bytes, data); /* base, bytes, data); */
case XCB_IMAGE_FORMAT_Z_PIXMAP: case XCB_IMAGE_FORMAT_Z_PIXMAP:
return xcb_image_create(w, h, xif, return xcb_image_create(w, h, xif,
fmt->scanline_pad, 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; Eina_Rectangle *rect;
RECTS_CLIP_TO_RECT(x, y, w, h, 0, 0, buf->w, buf->h);
if (!(obr = calloc(1, sizeof(Outbuf_Region)))) if (!(obr = calloc(1, sizeof(Outbuf_Region))))
return NULL; 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))) if (!(rect = eina_rectangle_new(x, y, w, h)))
{ {
free(obr); free(obr);
@ -287,8 +288,10 @@ evas_software_xcb_outbuf_new_region_for_update(Outbuf *buf, int x, int y, int w,
if (cy) *cy = y; if (cy) *cy = y;
if (cw) *cw = w; if (cw) *cw = w;
if (ch) *ch = h; if (ch) *ch = h;
alpha = ((buf->priv.x11.xcb.mask) || (buf->priv.destination_alpha)); alpha = ((buf->priv.x11.xcb.mask) || (buf->priv.destination_alpha));
use_shm = buf->priv.x11.xcb.shm; use_shm = buf->priv.x11.xcb.shm;
if ((buf->rot == 0) && (buf->priv.mask.r == 0xff0000) && 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))
{ {
@ -622,7 +625,7 @@ evas_software_xcb_outbuf_flush(Outbuf *buf)
if (obr->xcbob) _unfind_xcbob(obr->xcbob, EINA_FALSE); if (obr->xcbob) _unfind_xcbob(obr->xcbob, EINA_FALSE);
if (obr->mask) _unfind_xcbob(obr->mask, EINA_FALSE); if (obr->mask) _unfind_xcbob(obr->mask, EINA_FALSE);
free(obr); free(obr);
evas_cache_image_drop(&im->cache_entry); // evas_cache_image_drop(&im->cache_entry);
} }
#endif #endif
} }
@ -640,12 +643,12 @@ evas_software_xcb_outbuf_idle_flush(Outbuf *buf)
im = buf->priv.onebuf; im = buf->priv.onebuf;
buf->priv.onebuf = NULL; buf->priv.onebuf = NULL;
obr = im->extended_info; obr = im->extended_info;
evas_cache_image_drop(&im->cache_entry);
if (obr->xcbob) if (obr->xcbob)
evas_software_xcb_output_buffer_free(obr->xcbob, EINA_FALSE); evas_software_xcb_output_buffer_free(obr->xcbob, EINA_FALSE);
if (obr->mask) if (obr->mask)
evas_software_xcb_output_buffer_free(obr->mask, EINA_FALSE); evas_software_xcb_output_buffer_free(obr->mask, EINA_FALSE);
free(obr); free(obr);
evas_cache_image_drop(&im->cache_entry);
} }
else else
{ {
@ -824,12 +827,10 @@ evas_software_xcb_outbuf_push_updated_region(Outbuf *buf, RGBA_Image *update, in
#else #else
/* Async Push */ /* Async Push */
if (!((buf->priv.onebuf) && (buf->priv.onebuf_regions))) if (!((buf->priv.onebuf) && (buf->priv.onebuf_regions)))
{
evas_software_xcb_output_buffer_paste(obr->xcbob, evas_software_xcb_output_buffer_paste(obr->xcbob,
buf->priv.x11.xcb.mask, buf->priv.x11.xcb.mask,
buf->priv.x11.xcb.gcm, buf->priv.x11.xcb.gcm,
obr->x, obr->y, 0); obr->x, obr->y, 0);
}
#endif #endif
} }
#if 1 #if 1
@ -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, xcb_poly_fill_rectangle(buf->priv.x11.xcb.conn, drawable,
buf->priv.x11.xcb.gc, 1, &rect); buf->priv.x11.xcb.gc, 1, &rect);
_xcbob_sync(buf->priv.x11.xcb.conn); _xcbob_sync(buf->priv.x11.xcb.conn);
_xcbob_sync(buf->priv.x11.xcb.conn);
mask = XCB_GC_FOREGROUND | XCB_GC_GRAPHICS_EXPOSURES; mask = XCB_GC_FOREGROUND | XCB_GC_GRAPHICS_EXPOSURES;
value[0] = screen->white_pixel; value[0] = screen->white_pixel;
@ -978,6 +980,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, xcb_poly_fill_rectangle(buf->priv.x11.xcb.conn, drawable,
buf->priv.x11.xcb.gc, 1, &rect); buf->priv.x11.xcb.gc, 1, &rect);
_xcbob_sync(buf->priv.x11.xcb.conn); _xcbob_sync(buf->priv.x11.xcb.conn);
_xcbob_sync(buf->priv.x11.xcb.conn);
} }
} }