Summary: | Wireshark crashes with BadMatch | ||
---|---|---|---|
Product: | cairo | Reporter: | Guy Harris <guy> |
Component: | general | Assignee: | Carl Worth <cworth> |
Status: | RESOLVED NOTOURBUG | QA Contact: | cairo-bugs mailing list <cairo-bugs> |
Severity: | normal | ||
Priority: | medium | CC: | dmacks, freedesktop |
Version: | 1.4.9 | ||
Hardware: | All | ||
OS: | Mac OS X (All) | ||
Whiteboard: | |||
i915 platform: | i915 features: |
Description
Guy Harris
2007-10-29 11:52:52 UTC
Owen Taylor noted in the Pango bug: This is almost certainly not a Pango issue. Hard to say what is going on without knowing what wireshark is doing ... it appears that the cairo surface that it's using got created improperly for the actual drawing it's drawing to. I'm not quite sure how that could happen, since I think GTK+ always should be validating the depth to match that of the drawable. It's conceivable that your libX11 is doing something unusual. The code that creates the cairo surface is in GTK+ gdk_x11_ref_cairo_surface() Check: A) the depth of the visual B) the depth that GTK+ thinks the drawable (most likely a pixmap) has C) the actual depth of the drawable (use XGetGeometry()) and I subsequently noted that It was a bit buried in the middle of the initial bug report, so it's easy to miss, but I hacked up the X server to report the precise problem; it printed ProcRenderCreatePicture: BadMatch due to pformat->depth (24) != pDrawable->depth (32) which means that the failure was in static int ProcRenderCreatePicture (ClientPtr client) { ... if (pFormat->depth != pDrawable->depth) return BadMatch; <-this is the failure So the X server seems to think the drawable has a depth of 32. According to xdpyinfo, the visuals were number of visuals: 4 default visual id: 0x23 visual: visual id: 0x23 class: TrueColor depth: 24 planes available colormap entries: 256 per subfield red, green, blue masks: 0xff0000, 0xff00, 0xff significant bits in color specification: 8 bits visual: visual id: 0x24 class: TrueColor depth: 24 planes available colormap entries: 256 per subfield red, green, blue masks: 0xff0000, 0xff00, 0xff significant bits in color specification: 8 bits visual: visual id: 0x25 class: TrueColor depth: 24 planes available colormap entries: 256 per subfield red, green, blue masks: 0xff0000, 0xff00, 0xff significant bits in color specification: 8 bits visual: visual id: 0x26 class: TrueColor depth: 24 planes available colormap entries: 256 per subfield red, green, blue masks: 0xff0000, 0xff00, 0xff significant bits in color specification: 8 bits so they all appear to be 24-bit. and later, in response to Owen's suggestion, hacked up gdk_x11_ref_cairo_surface() to print the information he mentioned: The following code, stuck after the gdk_drawable_get_visual() call in gdk_x11_ref_cairo_surface(), repeatedly swears on a stack of Bibles that the visual and the drawable are both of depth 24, as is the depth as reported by XGetGeometry(): if (logfile != NULL) { if (visual != NULL) fprintf(logfile, "Visual: depth %d\n", visual->depth); fprintf(logfile, "Drawable: depth %d\n", gdk_drawable_get_depth(drawable)); if (XGetGeometry(GDK_SCREEN_XDISPLAY (impl->screen), impl->xid, &root, &x, &y, &xwidth, &xheight, &border_width, &depth)) fprintf(logfile, "Drawable: X11 depth %u\n", depth); else fprintf(logfile, "XGetGeometry failed\n"); } ("logfile" was opened earlier). From a quick look at _cairo_xlib_surface_ensure_dst_picture() in Cairo 1.4.10's cairo-xlib-surface.c, and from the failure mode on the server (24-bit drawable, 32-bit format), it appears that surface->drawable would be 24-bit and surface->xrender_format would be 32-bit. That would agree with the debug code's insistence that the visual and drawable are 24-bit. Well, now you should be able to trace through a single function _cairo_xlib_surface_create_internal() And figure out what went wrong and why. Oh, my goodness. At the end of _cairo_xlib_surface_create_internal(), I added some fprintfs: if (foo != NULL) { fprintf(foo, "surface %p, dpy %p, drawable 0x%08lx, xrender_format %p\n", surface, surface->dpy, surface->drawable, surface->xrender_format); fclose(foo); } and it printed surface 0x69d1af0, dpy 0x480fe00, drawable 0x0020023e, xrender_format 0x48114e0 In _cairo_xlib_surface_ensure_dst_picture(), I added some fprintfs: FILE *foo; if (!surface->dst_picture) { foo = fopen("/tmp/gtklog", "a"); if (foo != NULL) { Window root; int x, y; unsigned int xwidth, xheight, border_width, depth; fprintf(foo, "ensure_dst_picture: surface %p, dpy %p, drawable 0x%08lx, xrender_format %p\n", surface, surface->dpy, surface->drawable, surface->xrender_format); if (XGetGeometry(surface->dpy, surface->drawable, &root, &x, &y, &xwidth, &xheight, &border_width, &depth)) fprintf(foo, "ensure_dst_picture: drawable depth %u\n", depth); fprintf(foo, "ensure_dst_picture: surface %p\n", surface); if (surface->xrender_format) fprintf(foo, "ensure_dst_picture: xrender_format depth %d\n", surface->xrender_format->depth); fclose(foo); } surface->dst_picture = XRenderCreatePicture (surface->dpy, surface->drawable, surface->xrender_format, 0, NULL); _cairo_xlib_surface_set_picture_clip_rects (surface); } else if (surface->clip_dirty & CAIRO_XLIB_SURFACE_CLIP_DIRTY_PICTURE) _cairo_xlib_surface_set_picture_clip_rects (surface); and it printed ensure_dst_picture: surface 0x69d1af0, dpy 0x480fe00, drawable 0x0020023e, xrender_format 0x48114e0 ensure_dst_picture: drawable depth 24 ensure_dst_picture: xrender_format depth 24 In the X server, I put in code to log information when the CreatePicture op failed, and it printed ProcRenderCreatePicture: BadMatch due to pformat(id 0x0000002c, format 0x00020888)->depth (24) != pDrawable(id 0x0020023e)->depth (32) so I see a bit of a disagreement between Cairo and the X server about the depth of the drawable. Am I missing something? From some debugging code I added to the server, it looks as if the depth of the drawable is somehow getting changed from 24 to 32. If so, this is probably an X server bug (which is already in the Apple bug database). If it gets figured out, I'll close this as NOTOURBUG. Looks like it is Xquartz's fault, after all: http://gitweb.freedesktop.org/?p=xorg/xserver.git;a=commit;h=d2766aeb85cdd80448d5fe4e1aa48e631fff6abc Yup. |
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.