Mesa (master): venus: implement vn_debug_init_once with os_get_option

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Apr 8 18:56:44 UTC 2021


Module: Mesa
Branch: master
Commit: a049cff2414c772d4bc03012ff4e0ee0247c64e2
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a049cff2414c772d4bc03012ff4e0ee0247c64e2

Author: Yiwei Zhang <zzyiwei at chromium.org>
Date:   Tue Apr  6 00:50:36 2021 +0000

venus: implement vn_debug_init_once with os_get_option

getenv is not working well with Android VM. Instead, use os_get_option
to read Android system property.

e.g. adb shell setprop mesa.vn.debug drm

Signed-off-by: Yiwei Zhang <zzyiwei at chromium.org>
Reviewed-by: Chia-I Wu <olvaffe at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10112>

---

 src/virtio/vulkan/vn_common.c | 3 ++-
 src/virtio/vulkan/vn_common.h | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/virtio/vulkan/vn_common.c b/src/virtio/vulkan/vn_common.c
index 61aea98c41b..9d6be361b57 100644
--- a/src/virtio/vulkan/vn_common.c
+++ b/src/virtio/vulkan/vn_common.c
@@ -14,6 +14,7 @@
 
 #include "util/debug.h"
 #include "util/log.h"
+#include "util/os_misc.h"
 #include "vk_enum_to_str.h"
 
 #if __STDC_VERSION__ >= 201112L
@@ -35,7 +36,7 @@ uint64_t vn_debug;
 static void
 vn_debug_init_once(void)
 {
-   vn_debug = parse_debug_string(getenv("VN_DEBUG"), vn_debug_options);
+   vn_debug = parse_debug_string(os_get_option("VN_DEBUG"), vn_debug_options);
 }
 
 void
diff --git a/src/virtio/vulkan/vn_common.h b/src/virtio/vulkan/vn_common.h
index ca2195b1d83..40d08b2049e 100644
--- a/src/virtio/vulkan/vn_common.h
+++ b/src/virtio/vulkan/vn_common.h
@@ -41,7 +41,7 @@
 
 #define VN_DEFAULT_ALIGN 8
 
-#define VN_DEBUG(category) unlikely(vn_debug &VN_DEBUG_##category)
+#define VN_DEBUG(category) unlikely(vn_debug & VN_DEBUG_##category)
 
 #define vn_error(instance, error)                                            \
    (VN_DEBUG(RESULT) ? vn_log_result((instance), (error), __func__) : (error))



More information about the mesa-commit mailing list