[cairo] how to substitute CAIRO_CLIP_PATH_IS_BOX ?

Chris Wilson chris at chris-wilson.co.uk
Wed Dec 16 07:21:06 PST 2015


On Wed, Dec 16, 2015 at 04:03:49PM +0100, Enrico Weigelt, metux IT consult wrote:
> On 16.12.2015 13:45, Chris Wilson wrote:
> 
> > This basically was replace by cairo_clip_t managing boxes explicitly.
> > However, in this case what you want to convert over to is
> > _cairo_clip_get_polygon(). The intention is that we can reduce complex
> > clips very often to a single polygon and that even do geometric
> > intersection of clip paths with shapes (to avoid the fill overhead of
> > rendering multiple passes).
> 
> Okay, I see one use of it in i915_surface_paint_with_alpha(). It seems
> that we're testing whether the clip is made of boxes - if not, use
> an i915-specific function (i915_surface_fill_with_alpha(), which then
> seem to use the GPU), otherwise use generic
> _cairo_clip_and_composite_boxes().
> 
> The interesting question for me now is: how should we do that decision
> instead ?

We basically only send boxes to the GPU, the larger the better. Given
that we have an arbitrary path with an even more arbitrary set of clip
paths, the challenge is to reduce that to a set of boxes as quick as
possible.

(For a more programmable GPU, passing the complete path representation
and getting subpixel perfect coverage masks would be a fun challenge.)

But for the basic i915, we just want boxes and as cheaply as possible.
So, the code just asks 10: "is it a box" then draw else reduce; goto 10;
 
> Another user is i915_surface_fill_with_alpha() .. I haven't really
> understood, whats going on here, but it seems that we're testing
> whether the fill path is is affected by the clip path (or maybe
> even equal to it).

Right, it tries to discard the clip path. I think that was superseded by
the geometric intersection between clip and fill.

> Could anymore give me some more insights ?

Boxes; with alpha!
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the cairo mailing list