[PATCH 14/20] glamor: stub out lines

Markus Wick markus at selfnet.de
Thu Mar 20 16:00:17 PDT 2014


Am 2014-03-20 23:22, schrieb Keith Packard:
>> I think this functions are worth to reimplement. eg horizontal lines 
>> are
>> used a lot and very slow on mi.
> 
> Having sped up the underlying functions, they're not terrible at this
> point:
> 
>     2000000 reps @   0.0035 msec (288000.0/sec): 500-pixel horizontal
> line segment
> 
> But, yeah, doing a 'real' implementation would be awesome. For
> comparison, fbdev does:
> 
>    30000000 reps @   0.0002 msec (4850000.0/sec): 500-pixel horizontal
> line segment

Sorry, my bad, I wanted to talk about vertical lines:
10000000 trep @   0.0046 msec (219000.0/sec): 500-pixel horizontal line 
segment
2500000 trep @   0.0119 msec ( 84100.0/sec): 500-pixel vertical line 
segment

>> How are the interpolation requirement for a line? Is it possible to
>> achive them with an opengl quad?
> 
> zero-width line pixelization semantics are pretty weak and we should be
> able to hit them with GL quads. Getting the 'notlast' cap semantic
> working is about the only trick necessary.

It shouldn't be that hard:

in vec4 pos //x1,y1,x2,y2
in int notlast;
const float line_width = 1.0;

void main() {
   vec2 direction = 0.5 * normalize(vec2(x2,y2) - vec2(x1,y1));
   vec2 normal = vec2(-direction.y, direction.x) * line_width;
   vec2 pos = (gl_VertexId&1==0) ? pos.xy - direction : notlast ? pos.zw 
- direction : pos.zw + direction;
   pos += (gl_VertexId&2==0) ? -normal : normal;
   gl_Position = vec4(pos, 0.0, 1.0);
}



More information about the xorg-devel mailing list