[cairo] PATCH: GL: Create glyph mask surface only once per context, enlarge on demand

Mikko Strandborg Mikko.Strandborg at symbio.com
Fri Feb 15 07:08:32 PST 2013


I don't think it is reasonable to expect GPU resources to be cheap to
create and/or destroy. That's why newer OpenGL specifications add more and
more ways to buffer such GPU resources on the GPU hardware, rather than
requiring them to be transferred over non-uniform memory and relatively
slow buses to the GPU hardware on every frame. Of course in this case we
weren't transferring data over the bus, but the situation is similar to
having a malloc/free pair in the inner loop of a computation.

I understand that cairo is immediate in nature, but we should aim towards
making it as GPU-friendly as possible in order to extract maximum
performance. Any GPU performance guide will tell you that creating and
releasing resources on-the-fly is A Bad Thing, so it should be avoided as
much as possible.

I wish we were in the position where cairo's fundamental requirements
would have a say in GPU HW architectures, but I just do not think it is
the case (at least not quite yet), so we'll have to adapt to whatever is
available =). The patch is fairly simple and straightforward, so there
should be no unintended side-effects.

--Mikko

On 2/15/13 4:26 PM, "Chris Wilson" <chris at chris-wilson.co.uk> wrote:

>On Fri, Feb 15, 2013 at 02:15:41PM +0000, Mikko Strandborg wrote:
>> Hi,
>> 
>> I'm not quite sure what you mean. Is the mask currently allocated and
>> released every draw call in order to work around a driver bug?
>>Generally,
>> allocating new textures (or other GPU resources) every frame is
>>considered
>> ineffective.
>
>Hah. It is a fundamental requirement of the immediate mode nature of
>cairo that GPU resources need to be extremely to cheap to create and
>destroy. The current GL drivers are comparatively extremely poor in this
>area.
>-Chris
>
>-- 
>Chris Wilson, Intel Open Source Technology Centre



More information about the cairo mailing list