Menu

#1 Mesa 11.2 porting

1.0
closed
mesa (5)
2016-08-19
2016-01-02
No

Port Mesa 11.2-devel to Android-x86

Related

OpenGLES: #1

Discussion

  • Mauro Rossi

    Mauro Rossi - 2016-01-04

    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

    out/target/product/x86/obj/STATIC_LIBRARIES/libmesa_pipe_loader_intermediates/libmesa_pipe_loader.a(pipe_loader_sw.o)(.
    data.rel.ro+0x8): error: undefined reference to 'dri_create_sw_winsys'
    collect2: error: ld returned 1 exit status
    build/core/shared_library_internal.mk:80: recipe for target
    'out/target/product/x86/obj/SHARED_LIBRARIES/gallium_dri_intermediates/LINKED/gallium_dri.so'
    failed
    make: ***
    [out/target/product/x86/obj/SHARED_LIBRARIES/gallium_dri_intermediates/LINKED/gallium_dri.so]
    Error 1
    
    #### make failed to build some targets (09:52 (mm:ss)) ####
    

    PROPOSED SOLUTION: commit "targets/dri: android: use WHOLE static
    libraries"

    https://github.com/maurossi/mesa/commit/982e56fc20647c0469a1efcc44e111033e7b7b2c

    libdrm not updated induced error

    target  C++: libmesa_pipe_nouveau_32 <=
    external/mesa/src/gallium/drivers/nouveau/codegen/nv50_ir.cpp
    external/mesa/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c: At top level:
    external/mesa/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c:16:24:
    fatal error: nvif/class.h: No such file or directory
     #include <nvif/class.h>
                            ^
    compilation terminated.
    build/core/binary.mk:801: recipe for target
    'out/target/product/x86_64/obj_x86/STATIC_LIBRARIES/libmesa_winsys_nouveau_intermediates/nouveau_drm_winsys.o'
    failed
    make: *** [out/target/product/x86_64/obj_x86/STATIC_LIBRARIES/libmesa_winsys_nouveau_intermediates/nouveau_drm_winsys.o]
    Error 1
    make: *** Waiting for unfinished jobs....
    
    #### 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

    external/drm_gralloc/gralloc_drm_pipe.c: In function 'pipe_map':
    external/drm_gralloc/gralloc_drm_pipe.c:235:17: error: too few arguments to
    function 'pm->screen->context_create'
       pm->context = pm->screen->context_create(pm->screen, NULL);
                     ^
    
    external/drm_gralloc/gralloc_drm_pipe.c: In function 'pipe_blit':
    external/drm_gralloc/gralloc_drm_pipe.c:321:17: error: too few arguments to
    function 'pm->screen->context_create'
       pm->context = pm->screen->context_create(pm->screen, NULL);
                     ^
    build/core/binary.mk:801: recipe for target
    'out/target/product/x86_64/obj_x86/SHARED_LIBRARIES/libgralloc_drm_intermediates/gralloc_drm_pipe.o'
    failed
    make: ***
    [out/target/product/x86_64/obj_x86/SHARED_LIBRARIES/libgralloc_drm_intermediates/gralloc_drm_pipe.o]
    Error 1
    make: *** Waiting for unfinished jobs....
    

    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
  • Mauro Rossi

    Mauro Rossi - 2016-01-24
    • status: open --> accepted
     
  • Mauro Rossi

    Mauro Rossi - 2016-01-31

    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

     
  • Chih-Wei Huang

    Chih-Wei Huang - 2016-02-15

    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"?

     
    • Mauro Rossi

      Mauro Rossi - 2016-02-15

      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.

      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

      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?

      -

      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?

      Could you also merge RobH's patches (
      https://github.com/robherring/mesa android-m

      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

       
  • Chih-Wei Huang

    Chih-Wei Huang - 2016-02-15

    Could you also merge RobH's patches ( https://github.com/robherring/mesa android-m branch) so we can integrate the virgl support? Thanks!

     
  • Chih-Wei Huang

    Chih-Wei Huang - 2016-03-10

    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?

     
  • Chih-Wei Huang

    Chih-Wei Huang - 2016-08-19
    • status: accepted --> closed
     
  • Chih-Wei Huang

    Chih-Wei Huang - 2016-08-19

    Done.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.