[ZenFone 2 General] ycavan:
Update: LLVM & GLES

In order to get GLES( 1 & 2 ) working, you will need to recompile LLVM, Gold & Mesa.

Explanation of the issue:

Without hardware accelerated video drivers, modern linux distros fall back to the software renderer. The current Mesa software renderer tries to make use of all possible intrinsic instructions ( SSE, SSE2, SSE3, SSE4, etc.. ) at link time (LTO). Here's the rub: LLVM doesn't recognize our cpu, so it returns generic x86_64; which doesn't support.. you guessed it, SSE4.1; even though cpuinfo will show that we have SSE4.1 support.

Here's the process:

I. Prepare binutils following this guide: http://llvm.org/docs/GoldPlugin.html

1. download binutils: git clone --depth 1 git://sourceware.org/git/binutils-gdb.git binutils

2. create a separate build directory since you're only going to use the binutils source files. I called mine: mybuild

3. from your build directory: $ ../binutils/configure --enable-gold --enable-plugins --disable-werror

4. from your build directory: $ make all-gold

II. Prepare & Build LLVM following this guide: http://www.linuxfromscratch.org/blfs/view/svn/general/llvm.html

1. Download LLVM 3.6.2: http://llvm.org/releases/3.6.2/llvm-3.6.2.src.tar.xz

2. Download Clang: http://llvm.org/releases/3.6.2/cfe-3.6.2.src.tar.xz

3. Download Compiler RT: http://llvm.org/releases/3.6.2/compiler-rt-3.6.2.src.tar.xz

4. extract LLVM: $ tar xvf llvm-3.6.2.src.tar.xz

5. extract Clang inside the llvm directory -> tools directory: tar xvf cfe-3.6.2.tar.xz

6. rename the directory: $ mv cfe-3.6.2 clang

7. extract Compiler-RT inside the llvm directory -> projects directory: tar xvf compiler-rt-3.6.2.tar.xz

8. rename the directory: $ mv compiler-rt-3.6.2 compiler-rt

III. Modify lib/LTO/LTOCodeGenerator.cpp

1. do a quick search for "yonah", it should appear in bool LTOCodeGenerator::determineTarget

2. After the Darwin check, add the following line: Mcpu = "silvermont";

3. ( Explanation ) Even though our processor is a Moorefield ( Medfield ) processor, it falls under the Silvermont sub-family. Basically, we're telling LTO ( Link Time Optimization ) that it doesn't matter what we're detected as, we're a Silvermont processor.

IV. Modify lib/Support/Host.cpp for Intel processors

1. ( explanation ) if you do a $ cat /proc/cpuinfo you'll see that our family is 6 and our model is 90. So we need to add that to the Atom Silvermont section of StringRef sys::getHostCPUName. Cpuid, though, also detects our model as model 10, so we need to comment out that model under family 6.

2. comment out the case statement under family 6 w/ model 10: // case 10: // Pentium III Xeon processor, model 0Ah ( here we add 2 slashes in front of case 10 )

3. Add 90 and 10 to the Silvermont section of family 6 ( "slm" is shorthand for silvermont ):

// Atom Silvermont codes from the Intel software optimization guide.

case 55:

case 74:

case 77:

case 90:

case 10:

return "slm";

4. To make sure we make LLVM aware of what processor we are, comment out all of the "default: return x86_64..." 's with:

default: return "slm";

// default: return (Em64T) ? "x86-64" : "i686";

5. Comment out "generic" and return "slm" again:

default:

return "slm";

// return "generic";

V. Prepare the LLVM configuration in the llvm directory

1. $ sed -e "s:/docs/llvm:/share/doc/llvm-3.6.2:" -i Makefile.config.in

2. $ sh configure --with-binutils-include=[full downloaded binutils path]/include --prefix=/usr --enable-shared

3. make -j2

4. Go have dinner, watch a movie, drink some coffee; it's going to take a LONG time

5. DO NOT INSTALL IT YET

VI. Prepare Mesa

1. Download Mesa 10.6.2 from mesa: ftp://ftp.freedesktop.org/pub/mesa/10.6.2/mesa-10.6.2.tar.xz

2. extract mesa $ tar xvf mesa-10.6.2.tar.xz

3. inside the mesa directory: $ sh configure --host=x86_64-pc-linux --prefix=/usr CFLAGS=-march=silvermont --enable-gles1 --enable-gles2 --enable-nine --enable-opencl --with-llvm-prefix=[full path to downloaded LLM]/llvm-3.6.2.src/Release+Asserts

4. $make -j2

VII. Install LLVM & Mesa

1. from the llvm directory: $ sudo make install

2. from the mesa directory: $ sudo make install

If everything works, you can download the mesa demo's package from your favorite package manager and be able to run es2gears_x11 w/ XServer-XSDL ( from the App Store ).

On average, I get just shy of 60 fps this way.

You should be able to download virtualgl & turbovnc to get quite a performance boost. VirtualGL uses a fake X environment to render the 3D and passes that on to the 2D X environment. TurboVNC is built on top of VirtualGL, so it's a vncserver that supports pretty snappy gles on and off the phone. I was able to hit around 112 fps w/ es2gears_x11 in a TurboVNC environment. YMMV

At the moment, there is still no GLX support and I'm looking into it, but having our quad core processor w/ SSE4.1 helps w/ the software rendering a LOT.