Enlightenment CVS committal Author : doursse Project : e17 Module : libs/evas
Dir : e17/libs/evas/src/modules/engines/software_xcb Modified Files: evas_outbuf.c evas_xcb_buffer.c evas_xcb_color.c Log Message: fix xrender xcb engine, add old stuff committed to the Xlib engines and not to the XCB ones, replace deprecated XCBSync call by a call of GetInputFocus, fix some round trips but a complete review of the engines must be done to fix them all, first part of a cleanup, first part of XCB error management =================================================================== RCS file: /cvs/e/e17/libs/evas/src/modules/engines/software_xcb/evas_outbuf.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -3 -r1.6 -r1.7 --- evas_outbuf.c 4 May 2006 06:51:30 -0000 1.6 +++ evas_outbuf.c 9 Sep 2006 08:10:23 -0000 1.7 @@ -97,8 +97,10 @@ if (evas_software_xcb_x_output_buffer_bit_order(xcbob) == XCBImageOrderMSBFirst) buf->priv.x.bit_swap = 1; #endif - if ((vis->_class == XCBVisualClassTrueColor) || - (vis->_class == XCBVisualClassDirectColor)) + if (((vis->_class == XCBVisualClassTrueColor) || + (vis->_class == XCBVisualClassDirectColor)) && + (x_depth > 8)) + { buf->priv.mask.r = (DATA32) vis->red_mask; buf->priv.mask.g = (DATA32) vis->green_mask; @@ -113,7 +115,8 @@ else if ((vis->_class == XCBVisualClassStaticGray) || (vis->_class == XCBVisualClassGrayScale) || (vis->_class == XCBVisualClassStaticColor) || - (vis->_class == XCBVisualClassPseudoColor)) + (vis->_class == XCBVisualClassPseudoColor) || + (x_depth > 8)) { Convert_Pal_Mode pm = PAL_MODE_RGB332; @@ -366,7 +369,8 @@ void evas_software_xcb_outbuf_flush(Outbuf *buf) { - Evas_List *l; + Evas_List *l; + XCBGetInputFocusRep *reply; for (l = buf->priv.pending_writes; l; l = l->next) { @@ -395,7 +399,9 @@ obr->x, obr->y, 0); } - XCBSync(buf->priv.x.conn, 0); + /* we sync */ + reply = XCBGetInputFocusReply(buf->priv.x.conn, XCBGetInputFocusUnchecked(buf->priv.x.conn), NULL); + free(reply); while (buf->priv.pending_writes) { RGBA_Image *im; @@ -632,18 +638,18 @@ int w, int h) { - int i; - XCBSCREEN *screen = NULL; - + int i; + XCBSCREEN *screen = NULL; + XCBGetInputFocusRep *reply; { XCBGetGeometryRep *geom; XCBDRAWABLE root; XCBSCREENIter i; - geom = XCBGetGeometryReply (buf->priv.x.conn, XCBGetGeometry (buf->priv.x.conn, draw), 0); + geom = XCBGetGeometryReply (buf->priv.x.conn, XCBGetGeometryUnchecked(buf->priv.x.conn, draw), 0); root.window = geom->root; free (geom); - geom = XCBGetGeometryReply (buf->priv.x.conn, XCBGetGeometry (buf->priv.x.conn, root), 0); + geom = XCBGetGeometryReply (buf->priv.x.conn, XCBGetGeometryUnchecked(buf->priv.x.conn, root), 0); i = XCBSetupRootsIter((XCBSetup *)XCBGetSetup(buf->priv.x.conn)); for (; i.rem; XCBSCREENNext(&i)) @@ -666,21 +672,29 @@ value[1] = XCBExposuresNotAllowed; /* no graphics exposures allowed */ XCBChangeGC(buf->priv.x.conn, buf->priv.x.gc, mask, value); XCBPolyFillRectangle (buf->priv.x.conn, draw, buf->priv.x.gc, 1, &rect); - XCBSync(buf->priv.x.conn, 0); + /* we sync */ + reply = XCBGetInputFocusReply(buf->priv.x.conn, XCBGetInputFocusUnchecked(buf->priv.x.conn), NULL); + free(reply); image = XCBImageGet(buf->priv.x.conn, draw, x, y, w, h, XCBAllPlanes, XCBImageFormatZPixmap); if (image) XCBImageDestroy(image); - XCBSync(buf->priv.x.conn, 0); + /* we sync */ + reply = XCBGetInputFocusReply(buf->priv.x.conn, XCBGetInputFocusUnchecked(buf->priv.x.conn), NULL); + free(reply); mask = XCBGCForeground | XCBGCGraphicsExposures; value[0] = screen->white_pixel; value[1] = XCBExposuresNotAllowed; /* no graphics exposures allowed */ XCBChangeGC(buf->priv.x.conn, buf->priv.x.gc, mask, value); XCBPolyFillRectangle (buf->priv.x.conn, draw, buf->priv.x.gc, 1, &rect); - XCBSync(buf->priv.x.conn, 0); + /* we sync */ + reply = XCBGetInputFocusReply(buf->priv.x.conn, XCBGetInputFocusUnchecked(buf->priv.x.conn), NULL); + free(reply); image = XCBImageGet(buf->priv.x.conn, draw, x, y, w, h, XCBAllPlanes, XCBImageFormatZPixmap); if (image) XCBImageDestroy(image); - XCBSync(buf->priv.x.conn, 0); + /* we sync */ + reply = XCBGetInputFocusReply(buf->priv.x.conn, XCBGetInputFocusUnchecked(buf->priv.x.conn), NULL); + free(reply); } } @@ -771,10 +785,10 @@ XCBSCREENIter i; int cur; - geom = XCBGetGeometryReply (conn, XCBGetGeometry (conn, draw), NULL); + geom = XCBGetGeometryReply (conn, XCBGetGeometryUnchecked(conn, draw), NULL); root.window = geom->root; free (geom); - geom = XCBGetGeometryReply (conn, XCBGetGeometry (conn, root), 0); + geom = XCBGetGeometryReply (conn, XCBGetGeometryUnchecked(conn, root), 0); perf->x.w = (int)geom->width; perf->x.h = (int)geom->height; @@ -902,30 +916,38 @@ evas_software_xcb_outbuf_perf_store_x(Outbuf_Perf *perf) { /* write performance results to x root property */ - XCBInternAtomRep *rep; - XCBATOM type, format; - char *type_str; - char *str; + XCBInternAtomCookie cookie_atom; + XCBGetInputFocusCookie cookie_focus; + XCBInternAtomRep *reply_atom; + XCBGetInputFocusRep *reply_focus; + XCBATOM type, format; + char *type_str; + char *str; type_str = "__EVAS_PERF_ENGINE_SOFTWARE"; - rep = XCBInternAtomReply(perf->x.conn, - XCBInternAtom(perf->x.conn, - 0, - strlen (type_str), - type_str), + cookie_atom = XCBInternAtomUnchecked(perf->x.conn, + 0, + strlen (type_str), + type_str); + cookie_focus = XCBGetInputFocusUnchecked(perf->x.conn); + + reply_atom = XCBInternAtomReply(perf->x.conn, + cookie_atom, NULL); - if (!rep) return; + if (!reply_atom) return; - type = rep->atom; + type = reply_atom->atom; format = STRING; str = evas_software_xcb_outbuf_perf_serialize_x(perf); XCBChangeProperty(perf->x.conn, XCBPropModeReplace, perf->x.root.window, type, format, 8, strlen(str), str); - XCBSync(perf->x.conn, 0); + /* we sync */ + reply_focus = XCBGetInputFocusReply(perf->x.conn, cookie_focus, NULL); + free(reply_focus); free(str); - free (rep); + free (reply_atom); } Outbuf_Perf * @@ -947,10 +969,10 @@ type_str = "__EVAS_PERF_ENGINE_SOFTWARE"; type_rep = XCBInternAtomReply(conn, - XCBInternAtom(conn, - 0, - strlen (type_str), - type_str), + XCBInternAtomUnchecked(conn, + 0, + strlen (type_str), + type_str), NULL); if (!type_rep) return perf; @@ -959,9 +981,9 @@ format = STRING; free(type_rep); - cookie = XCBGetProperty(conn, 0, perf->x.root.window, - type, format, - 0, 16384); + cookie = XCBGetPropertyUnchecked(conn, 0, perf->x.root.window, + type, format, + 0, 16384); prop_rep = XCBGetPropertyReply(conn, cookie, NULL); if ((prop_rep) && @@ -1003,13 +1025,14 @@ XCBCOLORMAP cmap, int x_depth) { - Outbuf_Perf *perf; - XCBDRAWABLE win; - CARD32 mask; - CARD32 value[7]; - CARD32 value2[1]; - int w, h; - int do_shm = 0; + Outbuf_Perf *perf; + XCBGetInputFocusRep *reply; + XCBDRAWABLE win; + CARD32 mask; + CARD32 value[7]; + CARD32 value2[1]; + int w, h; + int do_shm = 0; perf = evas_software_xcb_outbuf_perf_new_x(conn, draw, vis, cmap, x_depth); @@ -1034,7 +1057,11 @@ XCBWindowClassInputOutput, vis->visual_id, mask, value); - XCBSync(conn, 0); + /* we sync */ + reply = XCBGetInputFocusReply(conn, + XCBGetInputFocusUnchecked(conn), + NULL); + free(reply); mask = XCBConfigWindowStackMode; value[0] = XCBStackModeAbove; XCBConfigureWindow (conn, win.window, mask, value2); @@ -1088,7 +1115,11 @@ evas_software_xcb_x_output_buffer_free(xcbob, 1); } } - XCBSync(conn, 0); + /* we sync */ + reply = XCBGetInputFocusReply(conn, + XCBGetInputFocusUnchecked(conn), + NULL); + free(reply); t1 = _evas_get_time() - t0; t0 = _evas_get_time(); for (l = 0; l < loops; l++) @@ -1110,7 +1141,11 @@ evas_software_xcb_x_output_buffer_free(xcbob, 1); } } - XCBSync(conn, 0); + /* we sync */ + reply = XCBGetInputFocusReply(conn, + XCBGetInputFocusUnchecked(conn), + NULL); + free(reply); t2 = _evas_get_time() - t0; if ((!chosen) && (!error)) { =================================================================== RCS file: /cvs/e/e17/libs/evas/src/modules/engines/software_xcb/evas_xcb_buffer.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -3 -r1.4 -r1.5 --- evas_xcb_buffer.c 4 May 2006 06:51:30 -0000 1.4 +++ evas_xcb_buffer.c 9 Sep 2006 08:10:24 -0000 1.5 @@ -67,7 +67,7 @@ int depth; drawable.window = XCBSetupRootsIter (XCBGetSetup(c)).data->root; - geom = XCBGetGeometryReply (c, XCBGetGeometry(c, drawable), 0); + geom = XCBGetGeometryReply (c, XCBGetGeometryUnchecked(c, drawable), 0); if(!geom) return 0; @@ -200,7 +200,14 @@ { if (xcbob->shm_info) { - if (sync) XCBSync(xcbob->connection, 0); + if (sync) + { + XCBGetInputFocusRep *reply; + + reply = XCBGetInputFocusReply(xcbob->connection, + XCBGetInputFocusUnchecked(xcbob->connection), + NULL); + } XCBShmDetach(xcbob->connection, xcbob->shm_info->shmseg); XCBImageSHMDestroy(xcbob->image); shmdt(xcbob->shm_info->shmaddr); @@ -231,7 +238,14 @@ x, y, xcbob->image->width, xcbob->image->height, 0); - if (sync) XCBSync(xcbob->connection, 0); + if (sync) + { + XCBGetInputFocusRep *reply; + + reply = XCBGetInputFocusReply(xcbob->connection, + XCBGetInputFocusUnchecked(xcbob->connection), + NULL); + } } else XCBImagePut(xcbob->connection, =================================================================== RCS file: /cvs/e/e17/libs/evas/src/modules/engines/software_xcb/evas_xcb_color.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -3 -r1.3 -r1.4 --- evas_xcb_color.c 2 May 2006 22:00:51 -0000 1.3 +++ evas_xcb_color.c 9 Sep 2006 08:10:24 -0000 1.4 @@ -45,51 +45,78 @@ int r, g, b, i; DATA8 *color_lut; int sig_mask = 0; + int delt = 0; for (i = 0; i < v->bits_per_rgb_value; i++) sig_mask |= (0x1 << i); sig_mask <<= (16 - v->bits_per_rgb_value); i = 0; color_lut = malloc((nr) * (ng) * (nb)); if (!color_lut) return NULL; - /* FIXME: remove the round-trip */ + delt = 0x0101 * 3; + /* FIXME: remove the round-trip ? */ for (r = 0; r < (nr); r++) { for (g = 0; g < (ng); g++) { for (b = 0; b < (nb); b++) { - XCBCOLORITEM xcl; - XCBCOLORITEM xcl_in; - int val; + XCBCOLORITEM xcl; + XCBCOLORITEM xcl_in; XCBAllocColorRep *rep; + int val; + int dr, dg, db; - val = (int)((((double)r) / ((nr) - 1)) * 65535); + val = (int)((((double)r) / ((nr) - 1)) * 255); + val = (val << 8) | val; xcl.red = (CARD16)(val); - val = (int)((((double)g) / ((ng) - 1)) * 65535); + val = (int)((((double)g) / ((ng) - 1)) * 255); + val = (val << 8) | val; xcl.green = (CARD16)(val); - val = (int)((((double)b) / ((nb) - 1)) * 65535); + val = (int)((((double)b) / ((nb) - 1)) * 255); + val = (val << 8) | val; xcl.blue = (CARD16)(val); xcl_in = xcl; rep = XCBAllocColorReply(conn, - XCBAllocColor(conn, cmap, - xcl.red, xcl.green, xcl.blue), + XCBAllocColorUnchecked(conn, + cmap, + xcl.red, + xcl.green, + xcl.blue), 0); + dr = (int)xcl_in.red - (int)xcl.red; + if (dr < 0) dr = -dr; + dg = (int)xcl_in.green - (int)xcl.green; + if (dg < 0) dg = -dg; + db = (int)xcl_in.blue - (int)xcl.blue; + if (db < 0) db = -db; +/* + printf("ASK [%i]: %04x %04x %04x = %04x %04x %04x | dif = %04x / %04x\n", + ret, + xcl_in.red, xcl_in.green, xcl_in.blue, + xcl.red, xcl.green, xcl.blue, + (dr + dg +db), delt); + */ + /* TODO: XAllocColor tries to approach the color */ /* in case the allocation fails */ /* XCB does not that (i think). It should be done */ /* So if rep == NULL, the other following tests */ /* should be always satisfied */ if ((!rep) || + ((dr + dg + db) > delt) + /* ((xcl_in.red & sig_mask) != (xcl.red & sig_mask)) || ((xcl_in.green & sig_mask) != (xcl.green & sig_mask)) || - ((xcl_in.blue & sig_mask) != (xcl.blue & sig_mask))) + ((xcl_in.blue & sig_mask) != (xcl.blue & sig_mask)) + */ + ) { CARD32 pixels[256]; int j; if (i > 0) { - for(j = 0; j < i; j++) + for (j = 0; j < i; j++) pixels[j] = (CARD32)color_lut[j]; XCBFreeColors(conn, cmap, 0, i, pixels); } @@ -120,6 +147,7 @@ i = 0; color_lut = malloc(ng); if (!color_lut) return NULL; + /* FIXME: remove the round-trip ? */ for (g = 0; g < (ng); g++) { XCBCOLORITEM xcl; @@ -127,14 +155,18 @@ int val; XCBAllocColorRep *rep; - val = (int)((((double)g) / ((ng) - 1)) * 65535); + val = (int)((((double)g) / ((ng) - 1)) * 255); + val = (val << 8) | val; xcl.red = (CARD16)(val); xcl.green = (CARD16)(val); xcl.blue = (CARD16)(val); xcl_in = xcl; rep = XCBAllocColorReply(conn, - XCBAllocColor(conn, cmap, - xcl.red, xcl.green, xcl.blue), + XCBAllocColorUnchecked(conn, + cmap, + xcl.red, + xcl.green, + xcl.blue), 0); /* FIXME: XAllocColor tries to approach the color */ /* in case the allocation fails */ @@ -151,7 +183,7 @@ if (i > 0) { - for(j = 0; j < i; j++) + for (j = 0; j < i; j++) pixels[j] = (CARD32) color_lut[j]; XCBFreeColors(conn, cmap, 0, i, pixels); } @@ -322,6 +354,7 @@ Convert_Pal_Mode c; Evas_List *l; +/* printf("ALLOC cmap=%i vis=%p\n", cmap, vis);*/ for (l = palettes; l; l = l->next) { pal = l->data; @@ -340,6 +373,7 @@ { if (x_color_alloc[c]) { +/* printf("TRY PAL %i\n", c);*/ pal->lookup = (x_color_alloc[c])(conn, cmap, vis); if (pal->lookup) break; } ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs