[Xcb] Where's XCBRenderFindStandardFormat ?

Jamey Sharp jamey at minilop.net
Tue May 17 11:07:30 PDT 2005


On Tue, 2005-05-17 at 04:23 -0700, Carl Worth wrote:
> I'm looking for an XCB function to perform the same role as
> XRenderFindStandardFormat. I've got some horribly complex
> re-implementation of it inside of cairo, but I don't really trust
> it. And then, the first test program I try to write needs the same
> functionality.

Yeah, I wrote that. Had to copy Keith's code out of the XRender library.
It wasn't really what I would call "fun".

> So, Xrender ends up being really hard to use without this.
> 
> Is there a good reason I can't find something like this inside XCB's
> bindings for the Render extension already?

Yes. It's not in the protocol. Also, as I recall, it's mapped pretty
arbitrarily[1] to the protocol, hiding a lot of underlying flexibility.

I'm not really sure what to do about it. It seems to me that both the
caching and the interpretation that's needed for that data is best
performed at as high of a level as possible.

In Cairo's XCB backend there's currently a format_from_cairo call for
every composite_trapezoids invocation, which has got to be pathetic for
performance. But it's always looking up CAIRO_FORMAT_A8, which should be
constant for a given server (I think). This can at least be cached
per-surface. And if RENDER is supported at all, Cairo is always going to
look up the available RENDER formats on surface creation. So it
obviously just needs to get two PICTFORMATs out at that point; and it
doesn't need any other cached data.

The array of format templates in format_from_cairo is small compared to
the array in the XRender library, I believe. And I would hate to assume
that the one in Cairo will always be a subset of the one in some client
binding for RENDER (whether based on XCB or Xlib). If there were going
to be a convenience function for this, I think I'd base it on format
templates rather than some predefined list of format names. (I suppose a
toy API with names, built on top of templates, would be OK, if it
actually would help real apps.) But I don't think any such function is
going in libXCB.so: this is higher-layer convenience functionality.

--Jamey

[1] My word of the day, apparently:
http://www.livejournal.com/users/solair/1537.html



More information about the xcb mailing list