[cairo] [patch] gl: do not force flush everytime uploading a glyph image to glyph cache
Henry (Yu) Song - SISA
hsong at sisa.samsung.com
Tue Jan 29 16:37:11 PST 2013
Thanks for review and comment. I will reformat the message.
Each glyph uploading causes a flush of previous glDrawXXX(). A single glyph uploading is done by
_cairo_gl_surface_draw_image(), in which _cairo_gl_composite_flush() is called.
If I understand correctly, the question is how to ensure all glyph drawings are flushed before we start draw
something else. correct me if I am wrong.
_cairo_gl_composite_flush () is called in multiple points, for example when mask surface has changed.
In glyph rendering, we uses two particular mask surface - one is the glyph cache that stores alpha-only
glyphs, the second one is the rgba-glyph cache that stores lcd/subpixel images. It is ensured all
glyphs will be glDraw() before we switch to draw something else in _cairo_gl_operand_needs_setup(),
where it checks the new mask vs the ctx->mask.
It is possible that it will combine two consecutive cairo_show_text() into one glDrawArrays() if both
show texts using the same operator. But such squashing should produce correct result and reduces
number of glDrawArray().
From: Eric Anholt [eric at anholt.net]
Sent: Tuesday, January 29, 2013 4:06 PM
To: Henry (Yu) Song - SISA; cairo at cairographics.org
Subject: Re: [cairo] [patch] gl: do not force flush everytime uploading a glyph image to glyph cache
"Henry (Yu) Song - SISA" <hsong at sisa.samsung.com> writes:
> From fc3c82cf6a2dd706a97aea2b34c4ddd23eb6e939 Mon Sep 17 00:00:00 2001
> From: Henry Song <henry.song at samsung.com>
> Date: Wed, 23 Jan 2013 11:55:44 -0800
> Subject: [PATCH] gl: add a force_flush flag in _cairo_gl_surface_draw_image.
> In normal cases, we want to flush everytime we call this
> function. But during uploading glyph to glyph cache, we
> don't want to flush it everytime it uploads glyph images.
What are you using to ensure that flushes actually happen when updating
a piece of the glyph cache that has been used in the queued rendering?
The commit message could use some work. The whole commit message is in
one line in the subject. Generally commit messages start with one short
line describing what the change is, that fits on an 80-character-wide
terminal when you look at it with "git show". After that, start a new
paragraph that explains why. An example update of your commit message
gl: Skip flushing queued rendering when adding a glyph to the cache.
We flush every time we change state that would change the result of the
drawing with the queued up vertices. Typically when we call draw_image
on the current surface, we need to flush those verts because we don't
know what portion of the surface has been used in the queued drawing so
far. But for adding glyphs to the cache, there is a a separate flush
when updating space in the cache that contains a used glyph, so we can
skip the flush in draw_image.
I have no idea if this is true or not, but it's an example of something
that would have explained to me why this change is expected to work.
More information about the cairo