xcbob =
evas_software_xcb_output_buffer_new(conn, visual, screen->root_depth,
- 1, 1, EINA_TRUE, NULL);
+ 16, 16, 2, NULL); // 1, 1 EINA_TRUE
if (!xcbob)
cached_result = 0;
else
}
Xcb_Output_Buffer *
-evas_software_xcb_output_buffer_new(xcb_connection_t *conn, xcb_visualtype_t *vis, int depth, int w, int h, Eina_Bool try_shm, unsigned char *data)
+evas_software_xcb_output_buffer_new(xcb_connection_t *conn, xcb_visualtype_t *vis, int depth, int w, int h, int try_shm, unsigned char *data)
{
Xcb_Output_Buffer *xcbob = NULL;
xcbob->h = h;
xcbob->data = data;
- if (try_shm)
+ if (try_shm > 0)
{
xcbob->shm_info = malloc(sizeof(xcb_shm_segment_info_t));
if (xcbob->shm_info)
depth, NULL, ~0, NULL);
if (xcbob->xim)
{
+ /* was 0666 */
xcbob->shm_info->shmid =
- shmget(IPC_PRIVATE, xcbob->xim->size, (IPC_CREAT | 0666));
+ shmget(IPC_PRIVATE, xcbob->xim->size, (IPC_CREAT | 0777));
if (xcbob->shm_info->shmid == (uint32_t)-1)
{
xcb_image_destroy(xcbob->xim);
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;
+#if defined(EVAS_FRAME_QUEING) && defined(LIBXEXT_VERSION_LOW)
+ if (evas_common_frameq_enabled())
+ xcb_grab_server(conn);
+#endif
xcb_shm_attach(conn, xcbob->shm_info->shmseg,
xcbob->shm_info->shmid, 0);
+#if defined(EVAS_FRAME_QUEING) && defined(LIBXEXT_VERSION_LOW)
+ if (evas_common_frameq_enabled())
+ xcb_ungrab_server(conn);
+#endif
+ if (try_shm == 2) _xcbob_sync(conn);
+
xcbob->bpl = xcbob->xim->stride;
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);
return NULL;
}
}
- else
+
+ if (try_shm > 1) return NULL;
+
+ /* no shm */
+ xcbob->xim =
+ _xcbob_create_native(conn, w, h, XCB_IMAGE_FORMAT_Z_PIXMAP,
+ depth, NULL, ~0, NULL);
+ if (!xcbob->xim)
+ {
+ free(xcbob);
+ return NULL;
+ }
+
+ if (!xcbob->xim->data)
{
- /* no shm */
- xcbob->xim =
- _xcbob_create_native(conn, w, h, XCB_IMAGE_FORMAT_Z_PIXMAP,
- depth, NULL, ~0, NULL);
- if (!xcbob->xim)
+ xcbob->xim->data = malloc(xcbob->xim->size);
+ if (!xcbob->xim->data)
{
+ xcb_image_destroy(xcbob->xim);
free(xcbob);
return NULL;
}
- if (!xcbob->xim->data)
- {
- xcbob->xim->data = malloc(xcbob->xim->size);
- if (!xcbob->xim->data)
- {
- xcb_image_destroy(xcbob->xim);
- free(xcbob);
- return NULL;
- }
- }
- xcbob->bpl = xcbob->xim->stride;
- xcbob->psize = xcbob->xim->size;
}
+ xcbob->bpl = xcbob->xim->stride;
+ xcbob->psize = xcbob->xim->size;
return xcbob;
}
void evas_software_xcb_write_mask_line_vert(Outbuf *buf, Xcb_Output_Buffer *xcbob, DATA32 *src, int h, int y, int w);
void evas_software_xcb_write_mask_line_vert_rev(Outbuf *buf, Xcb_Output_Buffer *xcbob, DATA32 *src, int h, int y, int w);
Eina_Bool evas_software_xcb_can_do_shm(xcb_connection_t *conn, xcb_screen_t *screen);
-Xcb_Output_Buffer *evas_software_xcb_output_buffer_new(xcb_connection_t *conn, xcb_visualtype_t *vis, int depth, int w, int h, Eina_Bool try_shm, unsigned char *data);
+Xcb_Output_Buffer *evas_software_xcb_output_buffer_new(xcb_connection_t *conn, xcb_visualtype_t *vis, int depth, int w, int h, int try_shm, unsigned char *data);
void evas_software_xcb_output_buffer_free(Xcb_Output_Buffer *xcbob, Eina_Bool sync);
void evas_software_xcb_output_buffer_paste(Xcb_Output_Buffer *xcbob, xcb_drawable_t drawable, xcb_gcontext_t gc, int x, int y, Eina_Bool sync);
DATA8 *evas_software_xcb_output_buffer_data(Xcb_Output_Buffer *xcbob, int *bpl_ret);
static Eina_List *_shmpool = NULL;
static int _shmsize = 0;
static int _shmlimit = (10 * 1024 * 1024);
-static int _shmcountlimit = 32;
+static const unsigned int _shmcountlimit = 32;
#ifdef EVAS_FRAME_QUEUING
static LK(lock_shmpool);
else
pm = PAL_MODE_MONO;
}
+ /* FIXME: Only allocate once per display & colormap */
buf->priv.pal =
evas_software_xcb_color_allocate(conn, cmap, vis, pm);
if (!buf->priv.pal)
_xcbob_sync(buf->priv.x11.xcb.conn);
buf->priv.synced = EINA_TRUE;
}
- eina_rectangle_free(rect);
return buf->priv.onebuf;
}
obr->x = 0;
NULL);
if (!obr->xcbob)
{
- eina_rectangle_free(rect);
free(obr);
return NULL;
}
if (!im)
{
evas_software_xcb_output_buffer_free(obr->xcbob, EINA_FALSE);
- eina_rectangle_free(rect);
free(obr);
return NULL;
}
(RGBA_Image *)evas_cache_image_empty(evas_common_image_cache_get());
if (!im)
{
- eina_rectangle_free(rect);
free(obr);
return NULL;
}
if (!obr->xcbob)
{
evas_cache_image_drop(&im->cache_entry);
- eina_rectangle_free(rect);
free(obr);
return NULL;
}
NULL);
}
}
- /* FIXME: */
+ /* FIXME: We should be able to remove this memset. */
if ((alpha) && (im->image.data))
{
/* FIXME: Faster memset */
bw, bh, use_shm, NULL);
}
}
- /* FIXME: */
+ /* FIXME: We should be able to remove this memset. */
if (((buf->priv.x11.xcb.mask) || (buf->priv.destination_alpha)) &&
(im->image.data))
{
{
Eina_Rectangle *rect, xr = { 0, 0, 0, 0 };
+ rect = buf->priv.onebuf_regions->data;
+ buf->priv.onebuf_regions =
+ eina_list_remove_list(buf->priv.onebuf_regions,
+ buf->priv.onebuf_regions);
if (buf->rot == 0)
{
xr.x = rect->x;
xr.w = rect->h;
xr.h = rect->w;
}
- rect = buf->priv.onebuf_regions->data;
- buf->priv.onebuf_regions =
- eina_list_remove_list(buf->priv.onebuf_regions,
- buf->priv.onebuf_regions);
pixman_region_union_rect(&tmpr, &tmpr, xr.x, xr.y, xr.w, xr.h);
if (buf->priv.debug)
evas_software_xcb_outbuf_debug_show(buf, buf->priv.x11.xcb.win,
xcb_flush(buf->priv.x11.xcb.conn);
#else
/* FIXME: Async Push Disabled */
+
_xcbob_sync(buf->priv.x11.xcb.conn);
+
while (buf->priv.pending_writes)
{
im = eina_list_data_get(buf->priv.pending_writes);
}
#if 1
#else
- /* FIXME: Add async push code */
+ /* Async Push */
+ if (!((buf->priv.onebuf) && (buf->priv.onebuf_regions)))
+ {
+ if (buf->priv.debug)
+ evas_software_xcb_outbuf_debug_show(buf, buf->priv.x11.xcb.win,
+ obr->x, obr->y, obr->w, obr->h);
+ if (obr->xcbob)
+ evas_software_xcb_output_buffer_paste(obr->xcbob,
+ buf->priv.x11.xcb.win,
+ buf->priv.x11.xcb.gc,
+ obr->x, obr->y, 0);
+ }
#endif
if (obr->mask)
{
}
#if 1
#else
- /* FIXME: Add Async Push */
+ /* 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