Mesa (master): aco: fix printing ASM on GFX6-7 again
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Jun 23 08:21:02 UTC 2020
Module: Mesa
Branch: master
Commit: 0aca04afa585e87bc900fb3b9c19c92d78b3e8f7
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=0aca04afa585e87bc900fb3b9c19c92d78b3e8f7
Author: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Date: Mon Jun 22 13:33:21 2020 +0200
aco: fix printing ASM on GFX6-7 again
Checking errno is actually wrong because it's only updated if
popen() fails (ie. NULL). One solution is to check if the first
line is empty.
Fixes: c95d258d1bc ("aco: fix printing ASM on GFX6-7 if clrxdisasm is not found")
Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Reviewed-by: Daniel Schürmann <daniel at schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5591>
---
src/amd/compiler/aco_print_asm.cpp | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/src/amd/compiler/aco_print_asm.cpp b/src/amd/compiler/aco_print_asm.cpp
index 2e6519fe57b..d4b0e0edbcf 100644
--- a/src/amd/compiler/aco_print_asm.cpp
+++ b/src/amd/compiler/aco_print_asm.cpp
@@ -69,11 +69,17 @@ void print_asm_gfx6_gfx7(Program *program, std::vector<uint32_t>& binary,
sprintf(command, "clrxdisasm --gpuType=%s -r %s", gpu_type, path);
p = popen(command, "r");
- if (!p || errno == ENOENT) {
- out << "clrxdisasm not found\n";
- } else {
- while (fgets(line, sizeof(line), p))
+ if (p) {
+ if (!fgets(line, sizeof(line), p)) {
+ out << "clrxdisasm not found\n";
+ pclose(p);
+ goto fail;
+ }
+
+ do {
out << line;
+ } while (fgets(line, sizeof(line), p));
+
pclose(p);
}
More information about the mesa-commit
mailing list