Skip to content

Commit

Permalink
Fix[build]: re-add os_misc and trace patches
Browse files Browse the repository at this point in the history
  • Loading branch information
artdeell authored Nov 27, 2023
1 parent 2ca3b7a commit 2c10439
Showing 1 changed file with 91 additions and 0 deletions.
91 changes: 91 additions & 0 deletions mesa-zink.diff
Original file line number Diff line number Diff line change
Expand Up @@ -151,3 +151,94 @@ index d16e785..0652936 100644
version : '8.0.0',
darwin_versions : '9.0.0',
install : true,
diff --git a/src/util/os_misc.c b/src/util/os_misc.c
index 6ae97b9..6898db0 100644
--- a/src/util/os_misc.c
+++ b/src/util/os_misc.c
@@ -128,62 +128,10 @@ os_log_message(const char *message)
#endif
}

-#if DETECT_OS_ANDROID
-# include <ctype.h>
-# include "c11/threads.h"
-
-/**
- * Get an option value from android's property system, as a fallback to
- * getenv() (which is generally less useful on android due to processes
- * typically being forked from the zygote.
- *
- * The option name used for getenv is translated into a property name
- * by:
- *
- * 1) convert to lowercase
- * 2) replace '_' with '.'
- * 3) if necessary, prepend "mesa."
- *
- * For example:
- * - MESA_EXTENSION_OVERRIDE -> mesa.extension.override
- * - GALLIUM_HUD -> mesa.gallium.hud
- *
- */
-static char *
-os_get_android_option(const char *name)
-{
- static thread_local char os_android_option_value[PROPERTY_VALUE_MAX];
- char key[PROPERTY_KEY_MAX];
- char *p = key, *end = key + PROPERTY_KEY_MAX;
- /* add "mesa." prefix if necessary: */
- if (strstr(name, "MESA_") != name)
- p += strlcpy(p, "mesa.", end - p);
- p += strlcpy(p, name, end - p);
- for (int i = 0; key[i]; i++) {
- if (key[i] == '_') {
- key[i] = '.';
- } else {
- key[i] = tolower(key[i]);
- }
- }
-
- int len = property_get(key, os_android_option_value, NULL);
- if (len > 1) {
- return os_android_option_value;
- }
- return NULL;
-}
-#endif
-
const char *
os_get_option(const char *name)
{
const char *opt = getenv(name);
-#if DETECT_OS_ANDROID
- if (!opt) {
- opt = os_get_android_option(name);
- }
-#endif
return opt;
}

diff --git a/src/util/perf/cpu_trace.h b/src/util/perf/cpu_trace.h
index a4ba4d7..4dbc30c 100644
--- a/src/util/perf/cpu_trace.h
+++ b/src/util/perf/cpu_trace.h
@@ -27,19 +27,6 @@
util_perfetto_trace_end(category); \
} while (0)

-/* NOTE: for now disable atrace for C++ to workaround a ndk bug with ordering
- * between stdatomic.h and atomic.h. See:
- *
- * https://github.com/android/ndk/issues/1178
- */
-#elif defined(ANDROID) && !defined(__cplusplus)
-
-#include <cutils/trace.h>
-
-#define _MESA_TRACE_BEGIN(category, name) \
- atrace_begin(ATRACE_TAG_GRAPHICS, name)
-#define _MESA_TRACE_END(category) atrace_end(ATRACE_TAG_GRAPHICS)
-
#else

#define _MESA_TRACE_BEGIN(category, name)

0 comments on commit 2c10439

Please sign in to comment.