Skip to content
  • Keith Packard's avatar
    mi: Draw multiple lines in one FillSpans call in miZeroLine · 3ac481c9
    Keith Packard authored and Emma Anholt's avatar Emma Anholt committed
    
    
    miZeroLine allocates enough space to draw a line spanning the entire
    width/height of the target drawable. When drawing multiple shorter
    lines, this leaves most of the space in that buffer unfilled. Let
    multiple lines be drawn into the buffer if there is plenty of space.
    
    Speeds up glamor fallback zero-width lines:
    
    Before
        6000000 trep @   0.0020 msec (508000.0/sec): 1-pixel line
        6000000 trep @   0.0020 msec (492000.0/sec): 10-pixel line
        6000000 trep @   0.0023 msec (427000.0/sec): 100-pixel line
        4000000 trep @   0.0035 msec (282000.0/sec): 500-pixel line
    
    After:
      600000000 trep @   0.0000 msec (43400000.0/sec): 1-pixel line
      140000000 trep @   0.0001 msec (13000000.0/sec): 10-pixel line
       16000000 trep @   0.0008 msec (1300000.0/sec): 100-pixel line
        4000000 trep @   0.0038 msec (261000.0/sec): 500-pixel line
    
    (500 pixel lines do not change in performance because the buffer can
    only one one of them.)
    
    Signed-off-by: default avatarKeith Packard <keithp@keithp.com>
    Reviewed-by: default avatarEric Anholt <eric@anholt.net>
    3ac481c9