Ian Romanick works on Mesa, an
open-source implementation of the OpenGL specification. His presentation on
the final day of the 2012 X.Org Developers' Conference looked at what he
hoped would be the future of the OpenGL interfaces on Linux. His talk was
broken into three broad areas: the current status of the OpenGL interfaces,
where they should go in the future, and how to get to that future.
The current OpenGL ABI was defined in 2000. It consists of a number of
pieces. The first of these is libGL, which implements three components: OpenGL 1.2, GLX up to version 1.2 (the
current version of GLX is 1.4), and the ARB multi-texture
extensions. Ian highlighted that libGL on its own is not sufficient for
any useful applications these days. The remaining pieces of the OpenGL ABI
are libEGL, and two separate
libraries, libGLES_CM and libGLESv2, for versions 1.2 and 2.0 of OpenGL ES.
There are many problems with the current situation. Applications that
want to use graphics components beyond OpenGL 1.2 have to "jump through
hoops." It's even more work to use GLES with GLX, or to use
desktop OpenGL with EGL. The
implementation of indirect
rendering, a feature that allows OpenGL commands to be encapsulated in
the X protocol stream and sent over the wire to the X server, is
"completely fail": it performs poorly and supports OpenGL up to only
version 1.4—or 1.5 with a lot of effort. The specification requires
indirect rendering to be supported, but the number of legitimate use cases
is quite small. And the presence of this rarely used feature sometimes
creates problems when applications accidentally trigger indirect rendering
and force OpenGL back to version 1.4, leading to user "rage" and bug
reports.
Ian then went through the proposed solution. The first step is to
split libGL, so that the OpenGL and GLX components are separated into
different libraries, called (say) libOpenGL and libGLX. Andy Ritger has
sent out a detailed proposal to the
mesa-dev mailing list describing how the split could be
accomplished. Splitting the libraries will allow applications to mix and
match components as needed, so that, for example, GLES and GLX can be
easily used together by linking with the right libraries. Using both OpenGL
and EGL together would become similarly straightforward. To maintain
backward compatibility for old binaries that look for libGL, it would still
be necessary to provide a legacy version of libGL that glues libOpenGL and
libGLX together.
Among the problems to be solved during the split are how to version the
libOpenGL library and "get away from at least some of the
GetProcAddress madness." That "madness" exists because the current
ABI forces some applications to make calls to various "GetProcAddress" APIs
(similar in concept to the GNU dynamic linker's dlsym() API) in
order to obtain the addresses of multiple functions in the various
libraries that constitute the OpenGL ABI. How the libOpenGL library would
be versioned is an open question. Ian noted that the possibilities included
ELF library versioning or embedding the version number in the library name,
as is done with GLES. He also speculated about whether it would be possible
to bump up the minimum OpenGL version supported by the ABI. The current
implementation is required to support OpenGL versions as far back as
1.2. However, OpenGL 1.2 is now so old that it is "useless", though Ian
still sees occasional bug reports for version 1.3.
Once the library is split, Ian would like to see GLX deprecated. In
addition to the problems caused by direct rendering, adding new GLX
extensions is painful, because support must be added in both the client
and the server. This can create problems in the cases where support
is not added simultaneously on both sides: the client may end up sending
unsupported protocol requests to the server and "they die in a fire." One
recent fire-starter was the GLX_ARB_create_context feature:
support appeared in the X server only in September, more than a year after
client-side support was added to GLX. By contrast, EGL does not have this
problem because support needs to be added only on the client side. In
other words, getting rid of GLX will allow new features to be shipped to
users much more quickly.
A prerequisite for deprecating GLX is to have Linux distributors ship
EGL by default. Most distributions do provide EGL, but Ian supposed that it
is not generally included in the default install. However, Martin Gräßlin
said that KDE started optionally depending on EGL about two years ago, so
it is now part of the default install in most distributions. Later, Ian
noted that encouraging the move to EGL may require the creation of a
GLX-to-EGL porting guide; while there is independent documentation for both
GLX and EGL, there seems to be none that explains how to port code from one
to the other. A lot of the required source code changes can be accomplished
with some simple scripting, but there are also a few deeper semantic
differences as well as a few GLX features that don't have direct
counterparts in EGL.
Another important step is to make OpenGL ES part of the OpenGL ABI. Bart Massey's XDC2012 presentation bemoaned
the fact that developers are not making applications for X. Ian said that
the reason they are not is that they're too busy making applications for
mobile platforms. So, by enabling the OpenGL ES ABI that every developer
uses on mobile platforms, it becomes possible for developers to use X as a
test bed for mobile applications; it also becomes possible to port
applications from Android and iOS to X.
One final step would be to update the loader/driver interface. This
interface defines the way that libGL or libEGL talks to the client-side
driver that it loads, and the way that the GLX module in the X server talks
to the driver to load and route GL calls to it. This will probably be the
hardest step, and it may take some time to resolve the details. As a side
note, Ian pointed out that if indirect rendering is dropped, it will
probably make the task quite a bit easier, because it won't be necessary to
support the loader/driver interface inside the X server.
Ian's presentation was followed by some audience discussion of various
topics. There were some questions about compatibility with old
applications. Ian thinks that compatibility requirements mean that it will
probably be necessary to ship a legacy version of libGL for the indefinite
future. There was some discussion on how to handle multiple versions of
libOpenGL in the future. Some audience members seemed unclear on what
options were available, but others were confident that ELF symbol
versioning, as used in the GNU C library, would be sufficient. Later,
Chad Versace expressed concerns about ensuring that any proposed solution
also worked when using the Clang
compiler and the gold linker. Ian noted
that there will need to be some more investigation of the requirements and
build environments before any final decisions are made.
Bart Massey expressed concern that indirect rendering seemed to be
going away with no replacement in sight. He noted that he'd had students who had
been happy users of indirect rendering for use in certain environments with
limited hardware. Ian suggested that a VNC "send the pixels across the
wire" type of solution might be the way to go. Later, Eric Anholt suggested
that the loader could detect that it is communicating over the wire with
the X server, open the driver as normal, and then transmit images over the
wire with PutImage, with the application being more or less
unaware of this happening.
There are still many details to be resolved regarding the proposed
reworking of the OpenGL ABI. However, there seemed near unanimous agreement
that the proposal described by Ian was the right direction, and it seems
likely that, once some design details have been resolved, the work will
commence quite soon.
The X.Org wiki has a pointer
to the video of this presentation.
(
Log in to post comments)