panvk: use os_get_option instead of getenv

...so that the options work on Android

Reviewed-by: John Anthony <john.anthony@arm.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37591>
This commit is contained in:
Yiwei Zhang 2025-09-25 23:02:36 +00:00 committed by Marge Bot
parent 114666733c
commit 80126bccf8
4 changed files with 9 additions and 4 deletions

View file

@ -30,6 +30,7 @@
#include "drm-uapi/panfrost_drm.h"
#include "drm-uapi/panthor_drm.h"
#include "util/os_misc.h"
#include "util/os_mman.h"
#include "util/u_math.h"
@ -41,7 +42,7 @@ bool drm_shim_driver_prefers_first_render_node = true;
static uint64_t
pan_get_gpu_id(void)
{
char *override_version = getenv("PAN_GPU_ID");
const char *override_version = os_get_option("PAN_GPU_ID");
if (override_version)
return strtol(override_version, NULL, 16);

View file

@ -6,6 +6,8 @@
#include "panvk_utrace.h"
#include "util/os_misc.h"
#include "drm-uapi/panthor_drm.h"
#include "genxml/cs_builder.h"
@ -168,7 +170,7 @@ panvk_utrace_capture_data(struct u_trace *ut, void *cs, void *dst_buffer,
static uint32_t
get_utrace_clone_mem_size()
{
const char *v = getenv("PANVK_UTRACE_CLONE_MEM_SIZE");
const char *v = os_get_option("PANVK_UTRACE_CLONE_MEM_SIZE");
if (v) {
uint32_t size = 0;
sscanf(v, "%u", &size);

View file

@ -12,6 +12,7 @@
#include "util/build_id.h"
#include "util/driconf.h"
#include "util/mesa-sha1.h"
#include "util/os_misc.h"
#include "vk_alloc.h"
#include "vk_log.h"
@ -244,7 +245,7 @@ panvk_CreateInstance(const VkInstanceCreateInfo *pCreateInfo,
instance->vk.physical_devices.destroy = panvk_destroy_physical_device;
instance->debug_flags =
parse_debug_string(getenv("PANVK_DEBUG"), panvk_debug_options);
parse_debug_string(os_get_option("PANVK_DEBUG"), panvk_debug_options);
if (instance->debug_flags & PANVK_DEBUG_STARTUP)
vk_logi(VK_LOG_NO_OBJS(instance), "Created an instance");

View file

@ -13,6 +13,7 @@
#include <sys/sysinfo.h>
#include "util/disk_cache.h"
#include "util/os_misc.h"
#include "git_sha1.h"
#include "vk_android.h"
@ -268,7 +269,7 @@ panvk_physical_device_init(struct panvk_physical_device *device,
switch (arch) {
case 6:
case 7:
if (!getenv("PAN_I_WANT_A_BROKEN_VULKAN_DRIVER")) {
if (!os_get_option("PAN_I_WANT_A_BROKEN_VULKAN_DRIVER")) {
result = panvk_errorf(instance, VK_ERROR_INCOMPATIBLE_DRIVER,
"WARNING: panvk is not well-tested on v%d, "
"pass PAN_I_WANT_A_BROKEN_VULKAN_DRIVER=1 "