[Mesa-dev] [PATCH 8/8] r600/radeonsi: enable glsl/tgsion-diskcache
Marc Dietrich
marvin24 at gmx.de
Thu Feb 23 09:39:28 UTC 2017
Am Donnerstag, 23. Februar 2017, 04:10:23 CET schrieb Timothy Arceri:
> On 23/02/17 09:44, Marc Dietrich wrote:
> > Am Mittwoch, 22. Februar 2017, 22:27:42 CET schrieb Timothy Arceri:
> >> On 23/02/17 01:57, Marc Dietrich wrote:
> >>> Am Mittwoch, 22. Februar 2017, 15:48:18 CET schrieb Emil Velikov:
> >>>> On 22 February 2017 at 13:31, Marc Dietrich <marvin24 at gmx.de> wrote:
> >>>>> Am Mittwoch, 22. Februar 2017, 04:45:46 CET schrieb Timothy Arceri:
> >>>>>> For gpu generations that use LLVM we create a timestamp string
> >>>>>> containing both the LLVM and Mesa build times, otherwise we just
> >>>>>> use the Mesa build time.
> >>>>>>
> >>>>>> Reviewed-by: Marek Olšák <marek.olsak at amd.com>
> >>>>>> Reviewed-by: Edward O'Callaghan <funfunctor at folklore1984.net>
> >>>>>> ---
> >>>>>>
> >>>>>> src/gallium/drivers/radeon/r600_pipe_common.c | 43
> >>>>>>
> >>>>>> +++++++++++++++++++++++++++
> >>>>>> src/gallium/drivers/radeon/r600_pipe_common.h
> >>>>>>
> >>>>>> 3 ++
> >>>>>> 2 files changed, 46 insertions(+)
> >>>>>>
> >>>>>> diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c
> >>>>>> b/src/gallium/drivers/radeon/r600_pipe_common.c index
> >>>>>> 1781584..bae6d6f
> >>>>>> 100644
> >>>>>> --- a/src/gallium/drivers/radeon/r600_pipe_common.c
> >>>>>> +++ b/src/gallium/drivers/radeon/r600_pipe_common.c
> >>>>>> @@ -43,6 +43,10 @@
> >>>>>>
> >>>>>> #define HAVE_LLVM 0
> >>>>>> #endif
> >>>>>>
> >>>>>> +#if HAVE_LLVM
> >>>>>> +#include <llvm-c/TargetMachine.h>
> >>>>>> +#endif
> >>>>>> +
> >>>>>>
> >>>>>> #ifndef MESA_LLVM_VERSION_PATCH
> >>>>>> #define MESA_LLVM_VERSION_PATCH 0
> >>>>>> #endif
> >>>>>>
> >>>>>> @@ -779,6 +783,41 @@ static const char* r600_get_chip_name(struct
> >>>>>> r600_common_screen *rscreen) }
> >>>>>>
> >>>>>> }
> >>>>>>
> >>>>>> +static void r600_disk_cache_create(struct r600_common_screen
> >>>>>> *rscreen)
> >>>>>> +{
> >>>>>> + uint32_t mesa_timestamp;
> >>>>>> + if (disk_cache_get_function_timestamp(r600_disk_cache_create,
> >>>>>> + &mesa_timestamp)) {
> >>>>>> + char *timestamp_str;
> >>>>>> + int res = -1;
> >>>>>> + if (rscreen->chip_class < SI) {
> >>>>>> + res = asprintf(×tamp_str,
> >>>>>> "%u",mesa_timestamp);
> >>>>>> + }
> >>>>>> +#if HAVE_LLVM
> >>>>>> + else {
> >>>>>> + uint32_t llvm_timestamp;
> >>>>>> + if
> >>>>>> (disk_cache_get_function_timestamp(LLVMInitializeAMDGPUTargetInfo, +
> >>>>>>
> >>>>>> &llvm_timestamp
> >>>>>> ))
> >>>>>>
> >>>>>> { + res = asprintf(×tamp_str,
> >>>>>> "%u_%u",
> >>>>>> + mesa_timestamp,
> >>>>>> llvm_timestamp); + }
> >>>>>> + }
> >>>>>> +#endif
> >>>>>
> >>>>> maybe this fails to link later in omx with r600 only compile.
> >>>>>
> >>>>> make[4]: Verzeichnis
> >>>>> „/usr/src/dri-project/mesa/src/gallium/targets/omx“
> >>>>> wird betreten
> >>>>>
> >>>>> CXXLD libomx_mesa.la
> >>>>>
> >>>>> ../../../../src/gallium/drivers/radeon/.libs/libradeon.a(r600_pipe_com
> >>>>> mo
> >>>>> n.
> >>>>> o): In function `r600_disk_cache_create':
> >>>>> r600_pipe_common.c:(.text+0x2000): undefined reference to
> >>>>> `LLVMInitializeAMDGPUTargetInfo'
> >>>>> collect2: error: ld returned 1 exit status
> >>>>> make[4]: *** [Makefile:791: libomx_mesa.la] Fehler 1
> >>>>> make[4]: Verzeichnis
> >>>>> „/usr/src/dri-project/mesa/src/gallium/targets/omx“
> >>>>> wird verlassen
> >>>>
> >>>> That should not happen since
> >>>>
> >>>> - Compile guard HAVE_LLVM is defined when --enable-llvm is set
> >>>>
> >>>> (explicitly or not)
> >>>>
> >>>> - Makefile/link guard HAVE_GALLIUM_LLVM is set when the --enable-llvm
> >>>> is
> >>>>
> >>>> Please make clean/git clean and report the output of make V=1 if the
> >>>> final link still fails.
> >>>
> >>> still same. I added -lLLVMAMDGPUInfo to LLVM_{LDFLAGS|LIBS}. Now it
> >>> compiles, but GL apps crash during context creation. I also tested the
> >>> initial version posted and this worked just fine. I have llvm enabled.
> >>
> >> I just built it with omx and only r600 without any issues. Did you do
> >> 'git clean -xfd' of just make clean?
> >
> > yes - I always do.
> >
> >> If it's still failing with a git clean then please post the params you
> >> are using to build mesa.
> >
> > #!/bin/sh -x
> >
> > git clean -fdx --exclude b.sh --exclude "0*" --exclude b2.sh
> >
> > COMMON_FLAGS="--prefix=/usr \
> >
> > --enable-texture-float \
> > --enable-gles1 \
> > --enable-gles2 \
> > --enable-egl \
> > --enable-opengl \
> > --enable-shared-glapi \
> > --enable-gbm \
> > --enable-xa \
> > --enable-xvmc \
> > --enable-vdpau \
> > --enable-omx \
> > --enable-va \
> > --enable-nine \
> > --enable-gallium-osmesa \
> > --enable-dri3 \
> > --enable-gallium-llvm \
> > --disable-opencl-icd \
> > --disable-debug \
> > --enable-glx-tls \
> > --disable-opencl \
> > --with-gallium-drivers=r600,swrast \
> > --with-egl-platforms=drm,wayland,x11 \
> > --with-dri-drivers=no"
> >
> > ./autogen.sh \
> >
> > $COMMON_FLAGS \
> > CFLAGS="$OPT_FLAGS $LTO_GCC" \
> > CXXFLAGS="$OPT_FLAGS $LTO_GCC" \
> > LDFLAGS="$OPT_FLAGS $LTO_GCC" \
> > CC="gcc$GCC_VER" \
> > CXX="g++$GCC_VER" \
> > LD="ld.gold" \
> > AR="gcc-ar$GCC_VER" \
> > NM="gcc-nm$GCC_VER" \
> > RANLIB="gcc-ranlib$GCC_VER" \
> > && \
> >
> > make -j2 && make install
>
> I've pushed a fix for building with an old version of llvm. Hopefully
> this will resolve your problem.
I have a pretty current version of llvm (3.9.1), so the problem is not fixed
by this patch :-) From the fact that it works for you and others, I guess it
must be some distro packaging problem (suse thumbleweed here). llvm is using
shared libs.
I tried to understand how the required llvm libs get assembled, but that's
hard to find out. I ended up adding 'llvm_add_component "amdgpuinfo"
$driver_name' to configure.ac to the defaults components. Now it compiles and
also works fine - it seems you also fixed some other problem which made mesa
crash here before.
So the remaining question is what actually pulls in LLVMAMDGPUInfo, and why
isn't it pulled here?
Marc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: This is a digitally signed message part.
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170223/33112bca/attachment.sig>
More information about the mesa-dev
mailing list