11 Apr 2013



Newsletter 95


The ReactOS project has relied on the Mesa Project for OpenGL 3D graphics for a long time, but unfortunately the code needed by ReactOS is no longer maintained by Mesa. Actual rendering involves a chain of components, one of which is the called the installable client driver. The ICD is for the most part bundled with the graphics card driver, though it can also be a driver that performs rendering completely in software. Mesa for a long time maintained a Windows software ICD that ReactOS could use, but a major architectural shift occurred that saw the driver deprecated. That shift was Gallium3D. Gallium3D acts as an intermediary interface between a graphics API and a graphics card driver. This layer of abstraction makes it theoretically easier to develop graphics drivers and implement graphics APIs by providing a uniform interface for both to plug into. Previously, Mesa needed to create separate backends for each platform, such as a graphics card, that they wanted to fully exploit for hardware acceleration. With Gallium, the responsibility could be decoupled somewhat. Any graphics driver that could plug into Gallium's interface could be used by Mesa to provide hardware accelerated rendering. Of course, the fact remains that one still needs to write those drivers in the first place, but the separation allowed better isolation of responsibility in the code, and hence a separation of responsibility for developers working on the code. This is ultimately a programmer productivity issue, not necessarily a performance decision. However, with the shift, the old ICD was deprecated by Mesa and the ReactOS project had to reconsider its options.

The instinctive direction to take was attempt to migrate to the new ICD , but this is not without further complication. The ICD relies on a rasterizer to perform the actual rendering and without a hardware driver has two options, a purely software rasterizer and one using LLVM for its rendering pipeline. Unfortunately, the software rasterizer's performance was significantly inferior to the older Mesa driver it replaced, not to mention being somewhat incomplete. The LLVM pipeline rasterizer had decent performance, but only when run on a relatively modern multi-core processor. Building it would also have entailed significant effort and the majority of developers and testers objected to trying to add it to the build process.

Faced with these difficulties, Jérôme Gardou decided to reconsider the problem from the ground up. Jérôme noted that if the only goal was ensuring compatibility with Windows, ReactOS did not need to support OpenGL higher than version 1.2. From that angle, Jérôme created a rasterizer using off-screen mesa as a reference and embedded it into the OpenGL library. This proved surprisingly easy and resulted in working support for OpenGL 1.2, including the ability to render to bitmaps, a rarely exercised functionality that nevertheless is present on Windows. As with all software, there are consequences with this decision. The first is that Jérôme is relying on Mesa 3.5, a much older version of that project. That version has long been deprecated and thus ReactOS would need to effectively take responsibility for maintaining the code. At the same time, this means that the project does not need to jump through hoops trying to stay up to date with Mesa if that project undergoes another architectural shift. The other issue, albeit one that is less serious than it appears, is that ReactOS will only have support for OpenGL 1.2 built in. This is for the most part irrelevant as anyone that actually wants OpenGL support and has a graphics card would have to rely on the driver provided by the card vendor in the first place. Long term, the only viable path for OpenGL support is to get graphics card drivers working in ReactOS.

Regression Fixing

One of the bugs that cropped up during regression testing for 0.3.15 involved Notepad Lite and broken icons. Thomas Faber traced the issue to two causes, one in ReactOS and the other in Notepad Lite's own packaging. Notepad Lite uses a utility called UPX to compress its executable so that it is very small on disk. The version they were using however had a bug that incorrectly relocated the icon resource in the executable. When ReactOS tried to load the binary, it was handed invalid pointers to the icons and tried to access them, causing a crash. This highlighted an issue in ReactOS wherein the loader was not properly validating pointers and simply assumed everything handed it was valid. The responsible code was from an older version of WINE, and Thomas rectified the issue by importing the fix from a newer version. As Notepad Lite's latest release is rather old, Thomas surmises that the UPX version it used was also fairly old. If a newer version of UPX causes the same problem, then there is a bug in that project as well.


Giannis Adamopoulos has continued his work with desktops, completing the ability to switch between different desktops. This work now allows ReactOS to run the Sysinternals desktops utility. The next step is to have winlogon actually use multiple desktops, important for the security of the OS. In addition, Giannis has been working with Thomas to validate the tests he had written for the desktop API, as different versions of Windows have slightly different behavior. So far most of his tests have proven themselves functionally correct albeit with slightly different behavior.

News Type: