radv: Stop using radv_get_int_debug_option

We can use debug_get_num_option instead. Bool options are changed to use
debug_get_bool_option.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23146>
This commit is contained in:
Konstantin Seurer
2023-05-20 14:18:04 +02:00
committed by Marge Bot
parent 4cdd85517d
commit 2fbf13085a
5 changed files with 7 additions and 32 deletions
+1 -23
View File
@@ -81,28 +81,6 @@ typedef void *drmDevicePtr;
#include "ac_llvm_util.h"
#endif
int
radv_get_int_debug_option(const char *name, int default_value)
{
const char *str;
int result;
str = getenv(name);
if (!str) {
result = default_value;
} else {
char *endptr;
result = strtol(str, &endptr, 0);
if (str == endptr) {
/* No digits founs. */
result = default_value;
}
}
return result;
}
static bool
radv_spm_trace_enabled()
{
@@ -1057,7 +1035,7 @@ radv_CreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCr
if (!device->mem_cache)
goto fail_meta;
device->force_aniso = MIN2(16, radv_get_int_debug_option("RADV_TEX_ANISO", -1));
device->force_aniso = MIN2(16, (int)debug_get_num_option("RADV_TEX_ANISO", -1));
if (device->force_aniso >= 0) {
fprintf(stderr, "radv: Forcing anisotropy filter to %ix\n",
1 << util_logbase2(device->force_aniso));
+1 -2
View File
@@ -56,8 +56,7 @@ typedef void *drmDevicePtr;
bool
radv_sqtt_enabled(void)
{
return radv_get_int_debug_option("RADV_THREAD_TRACE", -1) >= 0 ||
getenv("RADV_THREAD_TRACE_TRIGGER");
return debug_get_num_option("RADV_THREAD_TRACE", -1) >= 0 || getenv("RADV_THREAD_TRACE_TRIGGER");
}
static bool
-2
View File
@@ -1462,8 +1462,6 @@ const char *radv_get_debug_option_name(int id);
const char *radv_get_perftest_option_name(int id);
int radv_get_int_debug_option(const char *name, int default_value);
struct radv_color_buffer_info {
uint64_t cb_color_base;
uint64_t cb_color_cmask;
+3 -3
View File
@@ -899,7 +899,7 @@ exit:
int
radv_rra_trace_frame()
{
return radv_get_int_debug_option("RADV_RRA_TRACE", -1);
return (int)debug_get_num_option("RADV_RRA_TRACE", -1);
}
char *
@@ -920,9 +920,9 @@ radv_rra_trace_init(struct radv_device *device)
device->rra_trace.trace_frame = radv_rra_trace_frame();
device->rra_trace.elapsed_frames = 0;
device->rra_trace.trigger_file = radv_rra_trace_trigger_file();
device->rra_trace.validate_as = radv_get_int_debug_option("RADV_RRA_TRACE_VALIDATE", 0) != 0;
device->rra_trace.validate_as = debug_get_bool_option("RADV_RRA_TRACE_VALIDATE", false);
device->rra_trace.copy_after_build =
radv_get_int_debug_option("RADV_RRA_TRACE_COPY_AFTER_BUILD", 0) != 0;
debug_get_bool_option("RADV_RRA_TRACE_COPY_AFTER_BUILD", false);
device->rra_trace.accel_structs = _mesa_pointer_hash_table_create(NULL);
device->rra_trace.accel_struct_vas = _mesa_hash_table_u64_create(NULL);
simple_mtx_init(&device->rra_trace.data_mtx, mtx_plain);
+2 -2
View File
@@ -608,8 +608,8 @@ radv_sqtt_init(struct radv_device *device)
/* Default buffer size set to 32MB per SE. */
device->sqtt.buffer_size =
radv_get_int_debug_option("RADV_THREAD_TRACE_BUFFER_SIZE", 32 * 1024 * 1024);
device->sqtt.start_frame = radv_get_int_debug_option("RADV_THREAD_TRACE", -1);
(uint32_t)debug_get_num_option("RADV_THREAD_TRACE_BUFFER_SIZE", 32 * 1024 * 1024);
device->sqtt.start_frame = (int)debug_get_num_option("RADV_THREAD_TRACE", -1);
const char *trigger_file = getenv("RADV_THREAD_TRACE_TRIGGER");
if (trigger_file)