[PATCH] cache glyphs in the destination format requested to make sure the hardware can use the cached glyphs

Michel Dänzer michel at daenzer.net
Fri Jan 13 02:14:47 UTC 2017


[ Re-adding the xorg-devel list to Cc ]

On 12/01/17 02:01 AM, Michael wrote:
> On Tue, 10 Jan 2017 16:46:35 +0900
> Michel Dänzer <michel at daenzer.net> wrote:
>> On 09/01/17 07:36 AM, Michael Lorenz wrote:
>>> From: Michael Lorenz <macallan at netbsd.org>
>>>
>>> Signed-off-by: Michael Lorenz <macallan at netbsd.org>
>>> ---
>>>  exa/exa_glyphs.c | 6 +-----
>>>  1 file changed, 1 insertion(+), 5 deletions(-)
>>>
>>> diff --git a/exa/exa_glyphs.c b/exa/exa_glyphs.c
>>> index 192a643cc..7386d05e9 100644
>>> --- a/exa/exa_glyphs.c
>>> +++ b/exa/exa_glyphs.c
>>> @@ -544,7 +544,6 @@ exaBufferGlyph(ScreenPtr pScreen,
>>>                 INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst)
>>>  {
>>>      ExaScreenPriv(pScreen);
>>> -    unsigned int format = (GetGlyphPicture(pGlyph, pScreen))->format;
>>>      int width = pGlyph->info.width;
>>>      int height = pGlyph->info.height;
>>>      ExaCompositeRectPtr rect;
>>> @@ -554,13 +553,10 @@ exaBufferGlyph(ScreenPtr pScreen,
>>>      if (buffer->count == GLYPH_BUFFER_SIZE)
>>>          return ExaGlyphNeedFlush;
>>>  
>>> -    if (PICT_FORMAT_BPP(format) == 1)
>>> -        format = PICT_a8;
>>> -
>>>      for (i = 0; i < EXA_NUM_GLYPH_CACHES; i++) {
>>>          ExaGlyphCachePtr cache = &pExaScr->glyphCaches[i];
>>>  
>>> -        if (format == cache->format &&
>>> +        if (pDst->format == cache->format &&
>>>              width <= cache->glyphWidth && height <= cache->glyphHeight) {
>>>              ExaGlyphCacheResult result = exaGlyphCacheBufferGlyph(pScreen,
>>>                                                                    &pExaScr->
>>>   
>>
>> Unfortunately, testing reveals that this doesn't work correctly in
>> general when exaGlyphs is called with maskFormat == NULL, I suspect
>> because pDst->format may not have any alpha bits here in that case. This
>> results e.g. in some missing text in xfce4-terminal for me.
> 
> Hmm, I tested this with a whole lot of gtk2 applications and didn't see
> this - I'll build xfce4 now.
> That looks like the case in exaGlyphs() where exaBufferGlyphs() is
> called to render directly to the destination, not into an intermediate
> mask, which then may not find an appropriate glyph cache if the
> destination is something like XRGB. Maybe it should fall back to A8
> ( or the glyph's format ) in that case.

I tried that quickly, but couldn't get it to work correctly. I might
have missed something silly in my attempt though.


> Or maybe the check which format the driver likes its glyphs in should
> be done early and exaBufferGlyphs() should use that instead of
> pDst->format, that way all glyphs would be cacheable, we wouldn't
> allocate an A8 pixmap in exaGlyphs() just to throw it away immediately
> every time it's called etc.

Something like that might be nice.


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer


More information about the xorg-devel mailing list