libdrm: just git rebase freedesktop/master on top of current external/libdrm
Work In Progress
I have managed to complete the build of 11.2.0devel with both x86 and x86_64 target,
with current list of BoardConfig.mk drivers and radeonsi.
I though I had my mesa 11.2.0devel branch in good shape, but the current mesa 11.0.x solution to sse4.1 linking problem (which as adding libmesa_dricore to the list of static libraries when building gallium_dri) is causing me problems with the use of LOCAL_WHOLE_STATIC_LIBRARIES (method applied until now to build with new libmesa_pipe_loader module).
There may be other ways to link libmesa_pipe_loader, but I could not find one, I even tried in the last weeks to position the library in any place in the list of LOCAL_STATIC_LIBRARIES, but there was no place that could solve to complete the build.
out/target/product/x86/obj/STATIC_LIBRARIES/libmesa_pipe_loader_intermediates/libmesa_pipe_loader.a(pipe_loader_sw.o)(.data.rel.ro+0x8):error:undefinedreferenceto'dri_create_sw_winsys'collect2:error:ldreturned1exitstatusbuild/core/shared_library_internal.mk:80:recipefortarget'out/target/product/x86/obj/SHARED_LIBRARIES/gallium_dri_intermediates/LINKED/gallium_dri.so'failedmake:***[out/target/product/x86/obj/SHARED_LIBRARIES/gallium_dri_intermediates/LINKED/gallium_dri.so]Error1#### make failed to build some targets (09:52 (mm:ss)) ####
PROPOSED SOLUTION: commit "targets/dri: android: use WHOLE static
libraries"
targetC++:libmesa_pipe_nouveau_32<=external/mesa/src/gallium/drivers/nouveau/codegen/nv50_ir.cppexternal/mesa/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c:Attoplevel:external/mesa/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c:16:24:fatalerror:nvif/class.h:Nosuchfileordirectory#include<nvif/class.h>^compilationterminated.build/core/binary.mk:801:recipefortarget'out/target/product/x86_64/obj_x86/STATIC_LIBRARIES/libmesa_winsys_nouveau_intermediates/nouveau_drm_winsys.o'failedmake:***[out/target/product/x86_64/obj_x86/STATIC_LIBRARIES/libmesa_winsys_nouveau_intermediates/nouveau_drm_winsys.o]Error1make:***Waitingforunfinishedjobs....#### make failed to build some targets (03:28 (mm:ss)) ####
SOLUTION: git rebase of current external/libdrm to latest libdrm 2.4.66
drm_gralloc induced building error, only with vmwgfx
SOLUTION: apply the following commit that corrects drm_gralloc according to new specifications.
Since mesa 11.1 context:create allows to specify PIPE_* flags to create compute-only and debug contexts, setting this new flag to 0 will create the usual contexts.
Important news is that the patch using LOCAL_WHOLE_STATIC_LIBRARIES to build gallium_dri was accepted in mesa 11.2.0devel branch.
NOTE: This change does not allow anymore to add libmesa_dricore to the list of static libraries as per 11.0.7 android-x86 repo, because this would cause errors due to duplicate symbols.
Talking about vmwgfx the building errors, we have more than 2 hundreds 'missing in action' symbols and this seems to be related to some gigantic problem in linking libLLVM as a shared library, that could potentially also affect future attempts to build llvmpipe.
One liner example of the 2 hundreds missing symbols when building vmwgxf on lollipop-x86 or marshamallow-x86:
external/mesa/src/gallium/auxiliary/draw/draw_llvm.c:120: error: undefined reference to 'LLVM*'
This week there were significant changes to glsl, nir, compile static library modules,
that require updates to all related dependencies.
The following commit supersedes the previous "android: libmesa_glsl: add support for GLSL_TO_NIR_FILES", not needed anymore:
android: clean gallium_dri_intermediates in incremental builds
The clean steps are not correct. The concept of clean steps is it's always
incremental. The build system will compare the current clean steps with
the previous build clean steps and only run the newly added steps.
Therefore Newer clean steps must be add to the end of the list.
DO NOT MERGE: workaraound to build radeonsi x86_64 targets
Should be fixed by including the correct headers or prototypes.
DO NOT MERGE: android: remove old glsl include path
why "do not merge"?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
android: clean gallium_dri_intermediates in incremental builds
The clean steps are not correct. The concept of clean steps is it's
always
incremental. The build system will compare the current clean steps with
the previous build clean steps and only run the newly added steps.
Therefore Newer clean steps must be add to the end of the list.
Thanks, I'll correct that
DO NOT MERGE: workaraound to build radeonsi x86_64 targets
Should be fixed by including the correct headers or prototypes.
At the beginning I suspected the fact that the folders are still named
R600, but mesa expects the LLVMInitialize() as LLVMInitializeAMDGPU() for
llvm 3.7 and later., so I renamed also the static libraries and the name of
the target in LLVM to amdgpu,
but the problem was not solved
In my understanding this error happens because at compilation of
src/gallium/drivers/radeon/radeon_llvm_emit.c
line 36:
include <llvm-c target.h=""></llvm-c>
the Target.h headers are not evaluated correctly as they should,
the necessary include path should be already there, in gallium
Android.common.mk
What I do not understand is why the LLVMInitializeAMDGPU*() symbols are
apparently visible for x86 build,
and they are not for x86_64.
I have to say that I suspect Android build system on this...
In my understanding exporting the include path shouldn't be necessary,
especially for a statically linked library,
but I could give it a try by adding this line to llvm
lib/Target/R600/Android.mk
LOCAL_EXPORT_C_INCLUDE_DIRS += \
external/llvm/includes
What do you think?
-
DO NOT MERGE: android: remove old glsl include path
why "do not merge"?
This is DO NOT MERGE as a reminder, because Rob has already submitted an
equivalent patch to remove old gsls include paths to mesa-dev
Also my former "android: fix building with new glsl, nir, compiler
libraries" commit was preceded by Rod's one, which is equivalent,
and will be soon merged to master, it is not mentioned but it is a DO NOT
MERGE
"android: libmesa_st_mesa: use SSE4.1 optimizations" is also a DO NOT
MERGE, because Rob has followed Emil's indications to create a standalone
static library for SSE4.1 (as it is in mesa for linux targets, more clean
than mine) in order to avoid double static library linking.
PS: One last question, I'm clueless about how to solve missing symbols for
libLLVM shared libraries,
should we explicitly set some flag like -lLLVM somewhere...but where?
branch) so we can integrate the virgl support? Thanks!
Most of specific virgl patches were already integrated in mesa master,
I'll merge the additional interesting robh patches.
Question: Should virgl also work without drm_hw_composer enabled?
Another thing I've tried is to build drm_gralloc_nouveau as
drm_gralloc_pipe, by simply enabling the nouveau pipe -D definition,
and using the libmesa_winsys_nouveau and libmesa_pipe_nouveau static
libraries, but it does not work.
Some initialization error leads to a SIG_ABORT
What drives me mad, so to speak, is that libLLVM shared library is
completely invisible to mesa when building vmwgfx
and I don't know how to force the shared library linking, even if it seams
a trivial task,
should we move to using libLLVM static libraries to build vmwgfx on
marshmallow-x86
Mauro
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The llvm missing symbols issue is because the function prototypes are not defined.
It could be fixed on the mesa or llvm side.
I'll try to propose a patch to mesa-dev first.
The vmwgfx linking issue is easy to be fixed.
I'm preparing the patch.
Status and next steps
radeonsi can be built as a BoadConfig.mk build option for now, because radeonsi with x86_64 requires still some checks.
TO-DO: Investigate why x86_64 radeonsi targets still require CFLAG
-Wno-error=implicit-function-declaration
TO-DO: Solve remaining building errors on vmwgfx (linking of libLLVM shared library)
TO-DO: Find someone with a AMDGPU GCN 1.2 (e.g. R9 285)
TO-DO: Perform tests
Latest working branches:
mesa: https://github.com/maurossi/mesa/commits/11.2.0devel_marshmallow-x86_31-jan-2016
drm_gralloc: https://github.com/maurossi/hardware_drm_gralloc/commits/marshmallow-x86_mesa_11.1
llvm: https://github.com/maurossi/llvm/commits/marshmallow-x86_11-dec-2015
libdrm: just git rebase freedesktop/master on top of current external/libdrm
Work In Progress
I have managed to complete the build of 11.2.0devel with both x86 and x86_64 target,
with current list of BoardConfig.mk drivers and radeonsi.
I though I had my mesa 11.2.0devel branch in good shape, but the current mesa 11.0.x solution to sse4.1 linking problem (which as adding libmesa_dricore to the list of static libraries when building gallium_dri) is causing me problems with the use of LOCAL_WHOLE_STATIC_LIBRARIES (method applied until now to build with new libmesa_pipe_loader module).
There may be other ways to link libmesa_pipe_loader, but I could not find one, I even tried in the last weeks to position the library in any place in the list of LOCAL_STATIC_LIBRARIES, but there was no place that could solve to complete the build.
Latest mesa working branch is here:
https://github.com/maurossi/mesa/commits/11.2.0devel_marshmallow-x86_04-jan-2016
Build Errors Log
Here follows the other errors and related solutions to build 11.2.0devel with marshmallow.
Linking error with gallium_dri
PROPOSED SOLUTION: '_mesa_uint_array_min_max' provided also by libmesa_st_mesa (explanations in the commit message)
commit "android: libmesa_st_mesa: use SSE4.1 optimizations"
https://github.com/maurossi/mesa/commit/b5cba3e4f57a04a6dc2218d014a5cd9df2752892
Linking error with libmesa_pipe_loader
PROPOSED SOLUTION: commit "targets/dri: android: use WHOLE static
libraries"
https://github.com/maurossi/mesa/commit/982e56fc20647c0469a1efcc44e111033e7b7b2c
libdrm not updated induced error
SOLUTION: git rebase of current external/libdrm to latest libdrm 2.4.66
drm_gralloc induced building error, only with vmwgfx
SOLUTION: apply the following commit that corrects drm_gralloc according to new specifications.
Since mesa 11.1 context:create allows to specify PIPE_* flags to create compute-only and debug contexts, setting this new flag to 0 will create the usual contexts.
As a reference:
http://cgit.freedesktop.org/mesa/mesa/commit/?h=11.1&id=0fc21ecfc0891d239f20bf7724e51bc75503570c
Patch for external/drm_gralloc (needed as a prerequisite to enable vmwgfx):
https://github.com/maurossi/hardware_drm_gralloc/commit/88e6d269f37bf0c017d16d69b8972e18897903d7
Last edit: Mauro Rossi 2016-01-31
Work In Progress as of January, 24th
Three new building errors were corrected with the following commits.
The building errors are described in the commit messages.
"android: radeonsi: fix building error in si_shader.c"
https://github.com/maurossi/mesa/commit/0504c0994c97bb2a2aeea816d596e1171c5ec076
"android: nouveau_vp3_video_bsp: wrap assertion within #ifndef NDEBUG"
https://github.com/maurossi/mesa/commit/166bbd663826dd386deef3881b754b57e3c5070f
"android: libmesa_glsl: add support for GLSL_TO_NIR_FILES"
https://github.com/maurossi/mesa/commit/d264898aaaaa849a3199548d235df5e2023f833b
The following commit is not due to a building error, but to keep in android the same macro defined for linux builds:
"android: always define _ _STDC_CONSTANT_MACROS"
https://github.com/maurossi/mesa/commit/3b6b308779265fe30692b880fb8f9c654ca46bcc
Important news is that the patch using LOCAL_WHOLE_STATIC_LIBRARIES to build gallium_dri was accepted in mesa 11.2.0devel branch.
NOTE: This change does not allow anymore to add libmesa_dricore to the list of static libraries as per 11.0.7 android-x86 repo, because this would cause errors due to duplicate symbols.
Talking about vmwgfx the building errors, we have more than 2 hundreds 'missing in action' symbols and this seems to be related to some gigantic problem in linking libLLVM as a shared library, that could potentially also affect future attempts to build llvmpipe.
One liner example of the 2 hundreds missing symbols when building vmwgxf on lollipop-x86 or marshamallow-x86:
external/mesa/src/gallium/auxiliary/draw/draw_llvm.c:120: error: undefined reference to 'LLVM*'
The full list of LLVM linking errors is here:
http://www.mediafire.com/view/kza2wfmbu0375i5/build_errors.txt
Work In Progress as of January, 31st
This week there were significant changes to glsl, nir, compile static library modules,
that require updates to all related dependencies.
The following commit supersedes the previous "android: libmesa_glsl: add support for GLSL_TO_NIR_FILES", not needed anymore:
"android: fix building with new glsl, nir, compiler libraries"
https://github.com/maurossi/mesa/commit/d819858c1fb946cfe3292495fdfb4091901b51f5
The following commit tackles with building error in virgl, due to missing support of virgl vtest:
"android: add support for virgl vtest"
https://github.com/maurossi/mesa/commit/6e8651c60e3d172296c7a4c123460fffce937c01
The repetition in commit message of "android: nouveau_vp3_video_bsp: wrap assertion within #ifndef NDEBUG" was corrected:
https://github.com/maurossi/mesa/commit/6e1e8d34de0e7c5047c8c460c3e45939a35f3c64
Build is successful with all current marshmallow-x86 BoardConfig.mk drivers and also for freedreno, vc4 and virgl.
Still no clue about how to build vmwgfx with its libLLVM shared library dependency
Thank you for the update.
Some comments:
android: clean gallium_dri_intermediates in incremental builds
The clean steps are not correct. The concept of clean steps is it's always
incremental. The build system will compare the current clean steps with
the previous build clean steps and only run the newly added steps.
Therefore Newer clean steps must be add to the end of the list.
DO NOT MERGE: workaraound to build radeonsi x86_64 targets
Should be fixed by including the correct headers or prototypes.
DO NOT MERGE: android: remove old glsl include path
why "do not merge"?
At the beginning I suspected the fact that the folders are still named
R600, but mesa expects the LLVMInitialize() as LLVMInitializeAMDGPU() for
llvm 3.7 and later., so I renamed also the static libraries and the name of
the target in LLVM to amdgpu,
but the problem was not solved
In my understanding this error happens because at compilation of
src/gallium/drivers/radeon/radeon_llvm_emit.c
line 36:
include <llvm-c target.h=""></llvm-c>
the Target.h headers are not evaluated correctly as they should,
the necessary include path should be already there, in gallium
Android.common.mk
ifeq ($(MESA_ENABLE_LLVM),true)
LOCAL_C_INCLUDES += \
*external/llvm/include *
external/llvm/device/include \
external/libcxx/include \
external/elfutils/$(if $(filter 5,$(MESA_ANDROID_MAJOR_VERSION))
,0.153/,src/)libelf
endif
What I do not understand is why the LLVMInitializeAMDGPU*() symbols are
apparently visible for x86 build,
and they are not for x86_64.
I have to say that I suspect Android build system on this...
In my understanding exporting the include path shouldn't be necessary,
especially for a statically linked library,
but I could give it a try by adding this line to llvm
lib/Target/R600/Android.mk
LOCAL_EXPORT_C_INCLUDE_DIRS += \
external/llvm/includes
What do you think?
Also my former "android: fix building with new glsl, nir, compiler
libraries" commit was preceded by Rod's one, which is equivalent,
and will be soon merged to master, it is not mentioned but it is a DO NOT
MERGE
"android: libmesa_st_mesa: use SSE4.1 optimizations" is also a DO NOT
MERGE, because Rob has followed Emil's indications to create a standalone
static library for SSE4.1 (as it is in mesa for linux targets, more clean
than mine) in order to avoid double static library linking.
PS: One last question, I'm clueless about how to solve missing symbols for
libLLVM shared libraries,
should we explicitly set some flag like -lLLVM somewhere...but where?
Could you also merge RobH's patches (
https://github.com/robherring/mesa android-m
Most of specific virgl patches were already integrated in mesa master,
I'll merge the additional interesting robh patches.
Question: Should virgl also work without drm_hw_composer enabled?
Another thing I've tried is to build drm_gralloc_nouveau as
drm_gralloc_pipe, by simply enabling the nouveau pipe -D definition,
and using the libmesa_winsys_nouveau and libmesa_pipe_nouveau static
libraries, but it does not work.
Some initialization error leads to a SIG_ABORT
What drives me mad, so to speak, is that libLLVM shared library is
completely invisible to mesa when building vmwgfx
and I don't know how to force the shared library linking, even if it seams
a trivial task,
should we move to using libLLVM static libraries to build vmwgfx on
marshmallow-x86
Mauro
Could you also merge RobH's patches ( https://github.com/robherring/mesa android-m branch) so we can integrate the virgl support? Thanks!
The llvm missing symbols issue is because the function prototypes are not defined.
It could be fixed on the mesa or llvm side.
I'll try to propose a patch to mesa-dev first.
The vmwgfx linking issue is easy to be fixed.
I'm preparing the patch.
BTW, I just found the latest master branch (or android-n-preview-1) of
AOSP llvm contains the AMDGPU parts.
https://android.googlesource.com/platform/external/llvm
Mauro, could you try this branch to see if we can use it with marshmallow-x86?
Done.