ZhaoXin is a company selling x86 SoCs in the Chinese market. Let’s see for a bit what their GPU drivers look like.
Where does the GPU IP come from?
The GPU IP comes from S3 Graphics.
Where to get the drivers?
They’re available on the Windows Update catalog, you can use the ZhaoXin keyword to search for them.
What APIs do they implement?
D3D9(Ex), D3D11 and OpenCL are the supported APIs.
The OpenGL implementation shipped is really odd, but despite that still installed as an OpenGL ICD for Windows (!):
$ strings ZXELDMICD_64.dll | grep OpenGL
OpenGL ES-CM 1.1
OpenGL ES 2.0 37.00.29
[...]
What external codebases do they use?
This is where things get really fun. Upstream GCC doesn’t support GLSL or OpenCL C as input languages… but this does use just that!
OpenCL
Configuration settings
../../OpenCLCC/configure --prefix=/home/JenniferWu/gcc_debug --enable-universal --without-stdlib --exec-prefix=/home/JenniferWu/gcc_debug --disable-bootstrap --target=s3exc-pc-mingw32 --program-prefix= --enable-languages=c,opencl --disable-nls --disable-werror --enable-sjlj-exceptions --disable-symvers --disable-libstdcxx-pch --enable-version-specific-runtime-libs --enable-cxx-flags='-fno-function-sections -fno-data-sections' --enable-fully-dynamic-string --disable-libssp
The target triplet used is s3exc-pc-mingw32
. Pretty intriguing choice.
Having a guess at which GCC version it is…
$ strings zxexgcc.exe | grep gcc-
--print-libgcc-file-name
-print-libgcc-file-name
-gcc-
-print-libgcc-file-name Display the name of the compiler's companion library
-frecord-gcc-switches
../../gcc-3.4.5/gcc/config/i386/w32-shared-ptr.c
This might be based on a GCC 3.4.5 code base, but there’s no way to be certain on that one.
OpenGL
No configuration information was kept for this one…
Trying to guess which GCC version it is…
$ strings ZXGLSL_64.dll | grep GCC
.GCC.command.line
GCC supports only %u nested scopes
type of bit-field %qs is a GCC extension
%<long long long%> is too long for GCC
#pragma GCC optimize is not allowed inside functions
%<#pragma GCC optimize%> is not a string or number
%<#pragma GCC optimize (string [,string]...)%> does not have a final %<)%>.
#pragma GCC optimize string... is badly formed
Offset of packed bit-field %qD has changed in GCC 4.4
#pragma GCC target is not supported for this machine
#%s is a GCC extension
#%s is a deprecated GCC extension
style of line directive is a GCC extension
fixed-point constants are a GCC extension
decimal float constants are a GCC extension
imaginary constants are a GCC extension
binary constants are a GCC extension
assertions are a GCC extension
This would place it as at least GCC 4.5, which does seem to be a quite different GCC codebase from the one used beforehand.
But which GLSL parser does it use?
List of filenames
fe\config\crx\crx.c
fe\sl_Alias.c
fe\sl_Builtin.c
fe\sl_Calls.c
fe\sl_Dojump.c
fe\sl_Dump_rtl.c
fe\sl_Emit_rtl.c
fe\sl_Expand.c
fe\sl_Explow.c
fe\sl_Expmed.c
fe\sl_Expr.c
fe\sl_Fe_common.c
fe\sl_Fold_const.c
fe\sl_Function.c
fe\sl_Ggc_common.c
fe\sl_Ggc_page.c
fe\sl_Gimple.c
fe\sl_Gimple_low.c
fe\sl_Glsl_common.c
fe\sl_Glsl_decl.c
fe\sl_Glsl_function_name.c
fe\sl_Glsl_gimplify.c
fe\sl_Glsl_lex.c
fe\sl_Glsl_pragma.c
fe\sl_Glsl_pretty_print.c
fe\sl_Glsl_sematics.c
fe\sl_Glsl_Typeck.c
fe\sl_Graph.c
fe\sl_Graphunit.c
fe\sl_Insn_emit.c
fe\sl_Jump.c
fe\sl_Langhooks.c
fe\sl_Lists.c
fe\sl_Optabs.c
fe\sl_Options.c
fe\sl_Parser.c
fe\sl_Pretty_print.c
fe\sl_Print_rtl.c
fe\sl_Print_tree.c
fe\sl_Real.c
fe\sl_Reload.c
fe\sl_Rtl.c
fe\sl_Rtlanal.c
fe\sl_Rtlhooks.c
fe\sl_Simplify_rtx.c
fe\sl_Stmt.c
fe\sl_Stor_layout.c
fe\sl_Targhooks.c
fe\sl_Tree.c
fe\sl_Tree_expand.c
fe\sl_Tree_iterator.c
fe\sl_Varasm.c
fe\sl_Varpool.c
fe\sl_Vec.c
interface\GLSLInterfaceImpl.c
interface\MS_Encode.c
interface\OGL_Interface.c
d:\p4_code\sw2666\sw\s3gdrv\source_x86\glslcompiler\glslang\fe\sl_Tree.h
What could it be?
It doesn’t seem to match a glslang version that I know about.
Any other particularities to note?
The OpenCL C compiler is spawned as a subprocess, instead of the compilation being done within the same address space. This is relatively unexpected.
The help information for the assembler:
S3 Graphics Assembler Tool v0.0
(note: It distinguishes between uppercase and lowercase)
S3ASM Command Format: S3ASM.exe -A target [-FP] -o out_name in_name
-A translate txt file into bin file
-CL OpenCL S3ASM
target target machine: -E2UMA
-FP FPmode in Elite series
-o/-O out_name in_name output file name and input file name
S3ASM Command Example: S3ASM.exe -A -E2UMA -o target.bin targetsource.s
Disambler Command Format: S3ASM.exe -D target -I in_name -O out_name [-SPC startAddress] [-CTX dumpINSContext] [-APD]
-D translate bin file into txt file
-I in_name input file name
-o/-O out_name output file name
-SPC startAddress start pc value
-CTX dumpINSContext context value
-APD file open mode: append
Disambler Command Example:S3ASM.exe -D -E2UMA -I target.bin -O targetsource.txt
Where is the source code?
It doesn’t seem to be present anywhere.