Remove unneeded video_driver_set_gpu_device_string/get_gpu_device_string

This commit is contained in:
libretroadmin 2023-09-06 03:08:48 +02:00
parent 89376e3c41
commit bef29c466b
14 changed files with 119 additions and 208 deletions

View File

@ -254,6 +254,7 @@ struct gl2
struct video_tex_info prev_info[GFX_MAX_TEXTURES]; /* unsigned alignment */
struct video_fbo_rect fbo_rect[GFX_MAX_SHADERS]; /* unsigned alignment */
char device_str[128];
bool pbo_readback_valid[4];
};

View File

@ -713,29 +713,14 @@ static bool vulkan_context_init_device(gfx_ctx_vulkan_data_t *vk)
RARCH_LOG("[Vulkan]: Using GPU: \"%s\".\n", vk->context.gpu_properties.deviceName);
{
char device_str[128];
char version_str[128];
size_t len = strlcpy(device_str, vk->context.gpu_properties.deviceName, sizeof(device_str));
device_str[len ] = ' ';
device_str[++len] = '\0';
len += snprintf(device_str + len, sizeof(device_str) - len, "%u", VK_VERSION_MAJOR(vk->context.gpu_properties.driverVersion));
device_str[len ] = '.';
device_str[++len] = '\0';
len += snprintf(device_str + len, sizeof(device_str) - len, "%u", VK_VERSION_MINOR(vk->context.gpu_properties.driverVersion));
device_str[len ] = '.';
device_str[++len] = '\0';
snprintf(device_str + len, sizeof(device_str) - len, "%u", VK_VERSION_PATCH(vk->context.gpu_properties.driverVersion));
len = snprintf(version_str , sizeof(version_str) , "%u", VK_VERSION_MAJOR(vk->context.gpu_properties.apiVersion));
size_t len = snprintf(version_str , sizeof(version_str) , "%u", VK_VERSION_MAJOR(vk->context.gpu_properties.apiVersion));
version_str[ len] = '.';
version_str[++len] = '\0';
len += snprintf(version_str + len, sizeof(version_str) - len, "%u", VK_VERSION_MINOR(vk->context.gpu_properties.apiVersion));
version_str[ len] = '.';
version_str[++len] = '\0';
snprintf(version_str + len, sizeof(version_str) - len, "%u", VK_VERSION_PATCH(vk->context.gpu_properties.apiVersion));
video_driver_set_gpu_device_string(device_str);
video_driver_set_gpu_api_version_string(version_str);
}

View File

@ -2011,7 +2011,6 @@ static void *d3d10_gfx_init(const video_info_t* video,
d3d10->current_adapter = d3d10->adapters[gpu_index];
d3d10->adapter = d3d10->current_adapter;
RARCH_LOG("[D3D10]: Using GPU index %d.\n", gpu_index);
video_driver_set_gpu_device_string(d3d10->gpu_list->elems[gpu_index].data);
}
else
{

View File

@ -2620,7 +2620,6 @@ static void *d3d11_gfx_init(const video_info_t* video,
d3d11->current_adapter = d3d11->adapters[gpu_index];
d3d11->adapter = d3d11->current_adapter;
RARCH_LOG("[D3D11]: Using GPU index %d.\n", gpu_index);
video_driver_set_gpu_device_string(d3d11->gpu_list->elems[gpu_index].data);
}
else
{

View File

@ -2506,8 +2506,6 @@ static void d3d12_init_base(d3d12_video_t* d3d12)
d3d12->adapter = d3d12->adapters[gpu_index];
AddRef(d3d12->adapter);
RARCH_LOG("[D3D12]: Using GPU index %d.\n", gpu_index);
video_driver_set_gpu_device_string(
d3d12->gpu_list->elems[gpu_index].data);
}
else
{

View File

@ -1929,11 +1929,8 @@ static bool d3d9_cg_init_internal(d3d9_video_t *d3d,
LOWORD(ident.DriverVersion.HighPart),
HIWORD(ident.DriverVersion.LowPart),
LOWORD(ident.DriverVersion.LowPart));
RARCH_LOG("[D3D9]: Using GPU: \"%s\".\n", ident.Description);
RARCH_LOG("[D3D9]: GPU API Version: %s\n", version_str);
video_driver_set_gpu_device_string(ident.Description);
video_driver_set_gpu_api_version_string(version_str);
}

View File

@ -1516,8 +1516,6 @@ static bool d3d9_hlsl_init_internal(d3d9_video_t *d3d,
RARCH_LOG("[D3D9]: Using GPU: \"%s\".\n", ident.Description);
RARCH_LOG("[D3D9]: GPU API Version: %s\n", version_str);
video_driver_set_gpu_device_string(ident.Description);
video_driver_set_gpu_api_version_string(version_str);
}

View File

@ -1115,26 +1115,8 @@ static void *gl1_init(const video_info_t *video,
RARCH_LOG("[GL1]: Version: %s.\n", version);
RARCH_LOG("[GL1]: Extensions: %s\n", extensions);
{
char device_str[128];
size_t len = 0;
device_str[0] = '\0';
if (!string_is_empty(vendor))
{
len = strlcpy(device_str, vendor, sizeof(device_str));
device_str[ len] = ' ';
device_str[++len] = '\0';
}
if (!string_is_empty(renderer))
strlcpy(device_str + len, renderer, sizeof(device_str) - len);
video_driver_set_gpu_device_string(device_str);
if (!string_is_empty(version))
video_driver_set_gpu_api_version_string(version);
}
if (gl1->ctx_driver->input_driver)
{

View File

@ -420,7 +420,8 @@ static void gfx_display_gl2_blend_end(void *data)
#ifdef MALI_BUG
static bool
gfx_display_gl2_discard_draw_rectangle(gfx_display_ctx_draw_t *draw,
gfx_display_gl2_discard_draw_rectangle(gl2_t *gl,
gfx_display_ctx_draw_t *draw,
unsigned width, unsigned height)
{
static bool mali_4xx_detected = false;
@ -431,8 +432,8 @@ gfx_display_gl2_discard_draw_rectangle(gfx_display_ctx_draw_t *draw,
if (!scissor_inited)
{
unsigned i;
const char *gpu_device_string = NULL;
scissor_inited = true;
const char *gpu_device_string = gl->device_string;
scissor_set_rectangle(0,
width - 1,
@ -440,11 +441,6 @@ gfx_display_gl2_discard_draw_rectangle(gfx_display_ctx_draw_t *draw,
height - 1,
0);
/* TODO/FIXME - This might be thread unsafe in the long run -
* preferably call this once outside of the menu display driver
* and then just pass this string as a parameter */
gpu_device_string = video_driver_get_gpu_device_string();
if (gpu_device_string)
{
for (i = 0; scissor_device_strings[i].len; ++i)
@ -503,7 +499,7 @@ static void gfx_display_gl2_draw(gfx_display_ctx_draw_t *draw,
return;
#ifdef MALI_BUG
if (gfx_display_gl2_discard_draw_rectangle(draw, video_width,
if (gfx_display_gl2_discard_draw_rectangle(gl, draw, video_width,
video_height))
{
/*RARCH_WARN("[Menu]: discarded draw rect: %.4i %.4i %.4i %.4i\n",
@ -4323,21 +4319,17 @@ static void *gl2_init(const video_info_t *video,
sscanf(version, "%d.%d", &gl->version_major, &gl->version_minor);
{
char device_str[128];
size_t len = 0;
device_str[0] = '\0';
if (!string_is_empty(vendor))
{
len = strlcpy(device_str, vendor, sizeof(device_str));
device_str[ len] = ' ';
device_str[++len] = '\0';
len = strlcpy(gl->device_str, vendor, sizeof(gl->device_str));
gl->device_str[ len] = ' ';
gl->device_str[++len] = '\0';
}
if (!string_is_empty(renderer))
strlcpy(device_str + len, renderer, sizeof(device_str) - len);
video_driver_set_gpu_device_string(device_str);
strlcpy(gl->device_str + len, renderer, sizeof(gl->device_str) - len);
if (!string_is_empty(version))
video_driver_set_gpu_api_version_string(version);

View File

@ -1875,16 +1875,7 @@ static void *gl3_init(const video_info_t *video,
if (!string_is_empty(version))
sscanf(version, "%u.%u", &gl->version_major, &gl->version_minor);
{
char device_str[128];
size_t len = strlcpy(device_str, vendor, sizeof(device_str));
device_str[ len] = ' ';
device_str[++len] = '\0';
strlcpy(device_str + len, renderer, sizeof(device_str) - len);
video_driver_set_gpu_device_string(device_str);
video_driver_set_gpu_api_version_string(version);
}
#ifdef _WIN32
if ( string_is_equal(vendor, "Microsoft Corporation"))

View File

@ -201,12 +201,7 @@ bool gfx_thumbnail_set_system(gfx_thumbnail_path_data_t *path_data,
/* Hack: There is only one MAME thumbnail repo,
* so filter any input starting with 'MAME...' */
if (strncmp(system, "MAME", 4) == 0)
{
path_data->system[0] = path_data->system[2] = 'M';
path_data->system[1] = 'A';
path_data->system[3] = 'E';
path_data->system[4] = '\0';
}
strlcpy(path_data->system, "MAME", sizeof(path_data->system));
else
strlcpy(path_data->system, system, sizeof(path_data->system));

View File

@ -335,18 +335,11 @@ static void switch_res_crt(
RARCH_ERR("[CRT]: SR failed to add mode\n");
if (p_switch->kms_ctx)
{
#if 0
settings_t *settings = config_get_ptr();
#endif
get_modeline_for_kms(p_switch, &srm);
video_driver_set_video_mode(srm.width, srm.height, true);
}
else if (p_switch->khr_ctx)
{
RARCH_WARN("[CRT]: Vulkan -> Can't modeswitch for now\n");
/*crt_switch_driver_refresh();
video_driver_set_video_mode(srm.width, srm.height, true);*/
}
else
ret = sr_set_mode(srm.id);
if (!p_switch->kms_ctx && !ret)
@ -524,7 +517,6 @@ static void crt_rpi_switch(videocrt_switch_t *p_switch,
char buffer[1024];
VCHI_INSTANCE_T vchi_instance;
VCHI_CONNECTION_T *vchi_connection = NULL;
static char output[250] = {0};
static char output1[250] = {0};
static char output2[250] = {0};
static char set_hdmi[250] = {0};
@ -637,7 +629,7 @@ static void crt_rpi_switch(videocrt_switch_t *p_switch,
snprintf(output1, sizeof(output1),
"tvservice -e \"DMT 87\" > /dev/null");
system(output1);
snprintf(output2, sizeof(output1),
snprintf(output2, sizeof(output2),
"fbset -g %d %d %d %d 24 > /dev/null",
width, height, width, height);
system(output2);

View File

@ -2948,19 +2948,6 @@ float video_driver_get_refresh_rate(void)
return 0.0f;
}
void video_driver_set_gpu_device_string(const char *str)
{
video_driver_state_t *video_st = &video_driver_st;
strlcpy(video_st->gpu_device_string, str,
sizeof(video_st->gpu_device_string));
}
const char* video_driver_get_gpu_device_string(void)
{
video_driver_state_t *video_st = &video_driver_st;
return video_st->gpu_device_string;
}
void video_driver_set_gpu_api_version_string(const char *str)
{
video_driver_state_t *video_st = &video_driver_st;

View File

@ -855,7 +855,6 @@ typedef struct
char cli_shader_path[PATH_MAX_LENGTH];
char window_title[512];
char window_title_prev[512];
char gpu_device_string[128];
char gpu_api_version_string[128];
char title_buf[64];
char cached_driver_id[32];
@ -1163,10 +1162,6 @@ bool video_driver_test_all_flags(enum display_flags testflag);
gfx_ctx_flags_t video_driver_get_flags_wrapper(void);
void video_driver_set_gpu_device_string(const char *str);
const char* video_driver_get_gpu_device_string(void);
void video_driver_set_gpu_api_version_string(const char *str);
const char* video_driver_get_gpu_api_version_string(void);