Skip to content

Commit

Permalink
android: look for debug/vendor prefixed options
Browse files Browse the repository at this point in the history
Properties from the vendor partition must use a "vendor." prefix from
Android T+. Meanwhile the "debug." prefix can be used for local
overrides.

The order of precedence thus becomes:
1. getenv
2. debug.mesa.*
3. vendor.mesa.*
4. mesa.* (as a fallback for older versions)

Tracked-On: OAM-126014
Signed-off-by: Juston Li <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31584>
  • Loading branch information
juston-li authored and JeevakaPrabu committed Nov 26, 2024
1 parent dce356d commit e4b15e3
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/util/os_misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,10 @@ os_log_message(const char *message)
*
* 1) convert to lowercase
* 2) replace '_' with '.'
* 3) if necessary, prepend "mesa."
* 3) replace "MESA_" or prepend with "mesa."
* 4) look for "debug.mesa." prefix
* 5) look for "vendor.mesa." prefix
* 6) look for "mesa." prefix
*
* For example:
* - MESA_EXTENSION_OVERRIDE -> mesa.extension.override
Expand All @@ -167,9 +170,16 @@ os_get_android_option(const char *name)
}
}

int len = property_get(key, os_android_option_value, NULL);
if (len > 1) {
return os_android_option_value;
/* prefixes to search sorted by preference */
const char *prefices[] = { "debug.", "vendor.", "" };
char full_key[PROPERTY_KEY_MAX];
int len = 0;
for (int i = 0; i < ARRAY_SIZE(prefices); i++) {
strlcpy(full_key, prefices[i], PROPERTY_KEY_MAX);
strlcat(full_key, key, PROPERTY_KEY_MAX);
len = property_get(full_key, os_android_option_value, NULL);
if (len > 0)
return os_android_option_value;
}
return NULL;
}
Expand Down

0 comments on commit e4b15e3

Please sign in to comment.