Re: [Mesa-dev] [PATCH] amd/addrlib: Fix include path for c99_compat.h
Oh, ok, no problem ;) I just sent v2. On 22 August 2018 at 21:44, Dylan Baker wrote: > Quoting Kai Wasserbäch (2018-08-22 14:23:07) >> Hey Mariusz, >> Mariusz Ceier wrote on 8/22/18 10:16 PM: >> > Without this patch mesa doesn't compile: >> > >> > In file included from ../mesa-/src/amd/addrlib/addrinterface.cpp:39: >> > ../mesa-/src/util/macros.h:29:10: fatal error: c99_compat.h: No such >> > file or directory >> > #include "c99_compat.h" >> > ^~ >> > compilation terminated. >> > >> > Signed-off-by: Mariusz Ceier >> >> please add: >> Fixes 15ca5ce99a (amd/addrlib: mark returnCode as MAYBE_UNUSED in) >> and you can have my >> Acked-by: Kai Wasserbäch >> >> No R-b from me, because I have never used meson to build Mesa and don't plan >> to >> do so before Debian's packaging switches to it. >> >> Cheers, >> Kai > > I've added the relevant Fixes and a-b tag, plus my r-b and pushed. > > Reviewed-by: Dylan Baker > > Dylan ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v2] amd/addrlib: Fix include path for c99_compat.h
Without this patch mesa doesn't compile: In file included from ../mesa-/src/amd/addrlib/addrinterface.cpp:39: ../mesa-/src/util/macros.h:29:10: fatal error: c99_compat.h: No such file or directory #include "c99_compat.h" ^~ compilation terminated. Fixes 15ca5ce99a (amd/addrlib: mark returnCode as MAYBE_UNUSED in ElemGetExportNorm) Signed-off-by: Mariusz Ceier Acked-by: Kai Wasserbäch --- src/amd/addrlib/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/amd/addrlib/meson.build b/src/amd/addrlib/meson.build index a7e9dc8c18..b9550afd2a 100644 --- a/src/amd/addrlib/meson.build +++ b/src/amd/addrlib/meson.build @@ -57,7 +57,7 @@ libamdgpu_addrlib = static_library( include_directories( 'core', 'inc/chip/gfx9', 'inc/chip/r800', 'gfx9/chip', 'r800/chip', ), -inc_amd_common, inc_src, +inc_amd_common, inc_common, inc_src, ], cpp_args : cpp_vis_args, ) -- 2.18.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] amd/addrlib: Fix include path for c99_compat.h
Without this patch mesa doesn't compile: In file included from ../mesa-/src/amd/addrlib/addrinterface.cpp:39: ../mesa-/src/util/macros.h:29:10: fatal error: c99_compat.h: No such file or directory #include "c99_compat.h" ^~ compilation terminated. Signed-off-by: Mariusz Ceier --- src/amd/addrlib/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/amd/addrlib/meson.build b/src/amd/addrlib/meson.build index a7e9dc8c18..b9550afd2a 100644 --- a/src/amd/addrlib/meson.build +++ b/src/amd/addrlib/meson.build @@ -57,7 +57,7 @@ libamdgpu_addrlib = static_library( include_directories( 'core', 'inc/chip/gfx9', 'inc/chip/r800', 'gfx9/chip', 'r800/chip', ), -inc_amd_common, inc_src, +inc_amd_common, inc_common, inc_src, ], cpp_args : cpp_vis_args, ) -- 2.18.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] xf86drm: Fix error path in drmGetDevice2
On 30 July 2018 at 11:31, Michel Dänzer wrote: > On 2018-07-29 10:20 AM, Mariusz Ceier wrote: >> In drmGetDevice2 when no local device is found or when >> drm_device_has_rdev filters out all devices, *device might be left >> uninitialized causing drmGetDevice2 to not return error - since >> it's only returned when *device == NULL. >> >> Above leads to crash in the firefox in system with amdgpu. >> >> With this change firefox displays: >> >> libGL error: MESA-LOADER: failed to retrieve device information >> libGL error: unable to load driver: amdgpu_dri.so >> libGL error: driver pointer missing >> libGL error: failed to load driver: amdgpu >> libGL error: MESA-LOADER: failed to retrieve device information >> libGL error: unable to load driver: amdgpu_dri.so >> libGL error: driver pointer missing >> libGL error: failed to load driver: amdgpu >> >> and doesn't crash. >> >> Signed-off-by: Mariusz Ceier > > Good catch. Please add: > > Bugzilla: https://bugs.freedesktop.org/107384 > Reviewed-by: Michel Dänzer > > Do you need somebody to push this for you? Yes, I don't have push access :) Also should I send v2 patch with the Bugzilla and Reviewed-by tags ? > > > -- > Earthling Michel Dänzer | http://www.amd.com > Libre software enthusiast | Mesa and X developer ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] xf86drm: Fix error path in drmGetDevice2
I think chasing all the invocations of drmGetDevice2 is wrong - since it's drmGetDevice2 that's broken, not the code that uses it. Code that uses drmGetDevice2 expects it to return error when device has not been found. If setting *device in error path is not good, the patch can be modified to not set *device to NULL and return error when it was never assigned in the drmGetDevice2 function - it should also work, though I have not tried it. On 29 July 2018 at 19:20, Christoph Haag wrote: > I've reported this here: > https://bugs.freedesktop.org/show_bug.cgi?id=107384 > > The patch in the comments initializing drmDevicePtr device to NULL makes > it work properly for me. > > I don't think the patch is on the mailing list yet. It's probably a good > idea to check if there are more places where this initialization needs > to be done... > > > On 29.07.2018 10:20, Mariusz Ceier wrote: >> In drmGetDevice2 when no local device is found or when >> drm_device_has_rdev filters out all devices, *device might be left >> uninitialized causing drmGetDevice2 to not return error - since >> it's only returned when *device == NULL. >> >> Above leads to crash in the firefox in system with amdgpu. >> >> With this change firefox displays: >> >> libGL error: MESA-LOADER: failed to retrieve device information >> libGL error: unable to load driver: amdgpu_dri.so >> libGL error: driver pointer missing >> libGL error: failed to load driver: amdgpu >> libGL error: MESA-LOADER: failed to retrieve device information >> libGL error: unable to load driver: amdgpu_dri.so >> libGL error: driver pointer missing >> libGL error: failed to load driver: amdgpu >> >> and doesn't crash. >> >> Signed-off-by: Mariusz Ceier >> --- >> xf86drm.c | 2 ++ >> 1 file changed, 2 insertions(+) >> >> diff --git a/xf86drm.c b/xf86drm.c >> index 1e621e99..336d64de 100644 >> --- a/xf86drm.c >> +++ b/xf86drm.c >> @@ -3935,6 +3935,8 @@ int drmGetDevice2(int fd, uint32_t flags, drmDevicePtr >> *device) >> >> drmFoldDuplicatedDevices(local_devices, node_count); >> >> +*device = NULL; >> + >> for (i = 0; i < node_count; i++) { >> if (!local_devices[i]) >> continue; >> > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] xf86drm: Fix error path in drmGetDevice2
In drmGetDevice2 when no local device is found or when drm_device_has_rdev filters out all devices, *device might be left uninitialized causing drmGetDevice2 to not return error - since it's only returned when *device == NULL. Above leads to crash in the firefox in system with amdgpu. With this change firefox displays: libGL error: MESA-LOADER: failed to retrieve device information libGL error: unable to load driver: amdgpu_dri.so libGL error: driver pointer missing libGL error: failed to load driver: amdgpu libGL error: MESA-LOADER: failed to retrieve device information libGL error: unable to load driver: amdgpu_dri.so libGL error: driver pointer missing libGL error: failed to load driver: amdgpu and doesn't crash. Signed-off-by: Mariusz Ceier --- xf86drm.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/xf86drm.c b/xf86drm.c index 1e621e99..336d64de 100644 --- a/xf86drm.c +++ b/xf86drm.c @@ -3935,6 +3935,8 @@ int drmGetDevice2(int fd, uint32_t flags, drmDevicePtr *device) drmFoldDuplicatedDevices(local_devices, node_count); +*device = NULL; + for (i = 0; i < node_count; i++) { if (!local_devices[i]) continue; -- 2.18.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [RFC PATCH] Replace an flock with a random filename to evade some very ugly system dependent code
On 20 May 2018 at 14:16, Benedikt Schemmerwrote: > There is exactly one flock in mesa and it caused mesa not to build > on windows when shader cache was enabled. > > It should be possible to revert 9f8dc3bf03ec825bae7041858dda6ca2e9a34363 > "utils: build sha1/disk cache only with Android/Autoconf" currently > guarding the offending code with ENABLE_SHADER_CACHE > > This would allow shader cache to work on windows I think. > > I dont have a test system with windows though. > This builds on linux and is tested with Deus Ex:MD and Metro 2033 Redux > both with cold shader cache. > > Really > Fixes: d1efa09d342bff3e5def2978a0bef748d74f9c82 > > CC: Tapani Pälli > CC: "Marek Olšák" > CC: Emil Velikov > CC: Timothy Arceri > CC: Samuel Pitoiset > --- > This enables the patch > [PATCH 1/3] mesa/main/shaderapi: Use generate_sha1() unconditionally > > src/util/disk_cache.c | 48 +++- > 1 file changed, 35 insertions(+), 13 deletions(-) > > diff --git a/src/util/disk_cache.c b/src/util/disk_cache.c > index 4a762eff20..ca47bb15fb 100644 > --- a/src/util/disk_cache.c > +++ b/src/util/disk_cache.c > @@ -28,7 +28,6 @@ > #include > #include > #include > -#include > #include > #include > #include > @@ -848,6 +847,29 @@ struct cache_entry_file_data { > uint32_t uncompressed_size; > }; > > +static char * > +generate_random_string(int length) { > + static const char a[] = "0123456789abcdef"; > + > + if (length > 16) > + return NULL; > + > + char buf[16]; > + char *rndstr; > + > + for (int i = 0; i < length - 1; ++i) { > + // assign a random element from the lookup table > + buf[i] = a[rand() % (sizeof(a) - 1)]; > + } > + > + buf[length - 1] = 0; > + > + if (asprintf(, "%s", buf) == -1) > + return NULL; > + > + return rndstr; > +} > + > static void > cache_put(void *job, int thread_index) > { > @@ -855,7 +877,7 @@ cache_put(void *job, int thread_index) > > int fd = -1, fd_final = -1, err, ret; > unsigned i = 0; > - char *filename = NULL, *filename_tmp = NULL; > + char *filename = NULL, *filename_tmp = NULL, *random = NULL; > struct disk_cache_put_job *dc_job = (struct disk_cache_put_job *) job; > > filename = get_cache_file(dc_job->cache, dc_job->key); > @@ -873,7 +895,16 @@ cache_put(void *job, int thread_index) > * final destination filename, (to prevent any readers from seeing > * a partially written file). > */ > - if (asprintf(_tmp, "%s.tmp", filename) == -1) > + > + /* This next part used to be an flock(), which would prevent windows > systems > +* to build. 4 hex characters should be enough to prevent filename race > +* conditions for now. > + */ > + random = generate_random_string(4); > + if (random == NULL) > + goto done; > + > + if (asprintf(_tmp, "%s_%s.tmp", filename, random) == -1) >goto done; > You forgot to free the random string. > fd = open(filename_tmp, O_WRONLY | O_CLOEXEC | O_CREAT, 0644); > @@ -890,16 +921,7 @@ cache_put(void *job, int thread_index) > goto done; > } > > - /* With the temporary file open, we take an exclusive flock on > -* it. If the flock fails, then another process still has the file > -* open with the flock held. So just let that file be responsible > -* for writing the file. > -*/ > - err = flock(fd, LOCK_EX | LOCK_NB); > - if (err == -1) > - goto done; > - > - /* Now that we have the lock on the open temporary file, we can > + /* Now that we have the open temporary file, we can > * check to see if the destination file already exists. If so, > * another process won the race between when we saw that the file > * didn't exist and now. In this case, we don't do anything more, > -- > 2.14.1 > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev