[Xorg] X on OpenGL

Adam Jackson ajax at nwnk.net
Fri Jul 9 20:20:15 PDT 2004

Hash: SHA1

On Friday 09 July 2004 20:49, Andy Sy wrote:
> Adam Jackson wrote:
> >>The one big problem I see with the OpenGL API is that it does not give
> >>you any direct pixel-level access to the frame buffer and wouldn't it
> >>be extremely kludgy to build a windowing system without such?
> >
> > man glReadPixels.
> Right... glReadPixels, glCopyPixels and glDrawPixels... however
> everyone says that implementations of these are dog-slow (abuse
> of the hardware) and you're better off writing to a texture (which
> is kludgy in many contexts)...
> <snip>
> Why is it that OpenGL drivers seem to universally have this behaviour?

I suspect that, in order to get consistent results, the gl*Pixels calls are 
implicitly preceeded by a glFinish call, which would impose a synchronization 
penalty.  So the Pixel function itself could be fast in terms of bandwidth 
but not in terms of latency, and calling it in a loop from 1 to 2000 would 
hurt.  This might not be true for glDrawPixels since the results would be 
drawn in sequence with other GL commands, but Read and Copy might need to 
wait for drawing to finish before reading.  (If this is a real problem it 
might be possible to design an async Read API that allows the app to request 
the pixels early and only block on the results when it really needs them.)

Several of the DRI drivers have DMA-accelerated gl*Pixels functions, with 
something on the order of 1GB/sec bandwidth not being uncommon.  Perhaps 
that's not fast enough.  At any rate the DRI drivers know where the 
framebuffer is, and could be extended to enable direct access to the 

DRI is quite flexible, things like DGA and XV could be implemented in terms of 
the DRI framework.  DRI just happens to get used to implement fast GL 
drivers.  It might be more accurate to say that the goal is to make the X 
server a DRI client rather than an OpenGL app.

- - ajax
Version: GnuPG v1.2.4 (GNU/Linux)


More information about the xorg mailing list