intel: Convert getenv() to os_get_option()

os_get_option() is a wrapper for getenv() that checks properties in
Android. It should be a no-op for other OS but will allow full use of
env vars in Android.

The environment variable names are automatically renamed by
os_get_option() and the order of precedence thus becomes:

1. getenv (non-Android)
2. debug.mesa.* (Android)
3. vendor.mesa.* (Android)
4. mesa.* (Android, as a fallback for older versions)

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37587>
This commit is contained in:
Tim Van Patten
2025-09-25 15:15:24 -06:00
parent 75292ae7e4
commit f90e0f0797
21 changed files with 31 additions and 30 deletions
+2 -2
View File
@@ -61,7 +61,7 @@ intel_batch_decode_ctx_init(struct intel_batch_decode_ctx *ctx,
ctx->get_state_size = get_state_size;
ctx->user_data = user_data;
ctx->fp = fp;
ctx->flags = parse_enable_string(getenv("INTEL_DECODE"), flags, debug_control);
ctx->flags = parse_enable_string(os_get_option("INTEL_DECODE"), flags, debug_control);
ctx->max_vbo_decoded_lines = -1; /* No limit! */
ctx->engine = INTEL_ENGINE_CLASS_RENDER;
@@ -75,7 +75,7 @@ intel_batch_decode_ctx_init(struct intel_batch_decode_ctx *ctx,
ctx->stats =
_mesa_hash_table_create(NULL, _mesa_hash_string, _mesa_key_string_equal);
const char *filters = getenv("INTEL_DECODE_FILTERS");
const char *filters = os_get_option("INTEL_DECODE_FILTERS");
if (filters != NULL) {
ctx->filters =
_mesa_hash_table_create(NULL, _mesa_hash_string, _mesa_key_string_equal);