sna/glyphs: Add DBG option to force use of the glyph image mask

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2014-06-16 10:33:07 +01:00
parent 8f0fc2ed4c
commit 10cb36e1dd
1 changed files with 13 additions and 4 deletions

View File

@ -71,7 +71,7 @@
#define NO_GLYPH_CACHE 0
#define NO_GLYPHS_TO_DST 0
#define NO_GLYPHS_VIA_MASK 0
#define NO_SMALL_MASK 0
#define FORCE_SMALL_MASK 0 /* -1 = never, 1 = always */
#define NO_GLYPHS_SLOW 0
#define NO_DISCARD_MASK 0
@ -1087,6 +1087,17 @@ sna_glyph_get_image(GlyphPtr g, ScreenPtr s)
return image;
}
static inline bool use_small_mask(struct sna *sna, int16_t width, int16_t height, int depth)
{
if (FORCE_SMALL_MASK)
return FORCE_SMALL_MASK > 0;
if (depth * width * height < 8 * 4096)
return true;
return too_large(sna, width, height);
}
flatten static bool
glyphs_via_mask(struct sna *sna,
CARD8 op,
@ -1147,9 +1158,7 @@ glyphs_via_mask(struct sna *sna,
}
component_alpha = NeedsComponent(format->format);
if (!NO_SMALL_MASK &&
((uint32_t)width * height * format->depth < 8 * 4096 ||
too_large(sna, width, height))) {
if (use_small_mask(sna, width, height, format->depth)) {
pixman_image_t *mask_image;
DBG(("%s: small mask [format=%lx, depth=%d, size=%d], rendering glyphs to upload buffer\n",