Skip to content

Commit bef29c4

Browse files
committed
Remove unneeded video_driver_set_gpu_device_string/get_gpu_device_string
1 parent 89376e3 commit bef29c4

14 files changed

Lines changed: 119 additions & 208 deletions

gfx/common/gl2_common.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@ struct gl2
254254
struct video_tex_info prev_info[GFX_MAX_TEXTURES]; /* unsigned alignment */
255255
struct video_fbo_rect fbo_rect[GFX_MAX_SHADERS]; /* unsigned alignment */
256256

257+
char device_str[128];
257258
bool pbo_readback_valid[4];
258259
};
259260

gfx/common/vulkan_common.c

Lines changed: 26 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ static void vulkan_emulated_mailbox_loop(void *userdata)
175175
{
176176
VkFence fence;
177177
VkFenceCreateInfo info;
178-
struct vulkan_emulated_mailbox *mailbox =
178+
struct vulkan_emulated_mailbox *mailbox =
179179
(struct vulkan_emulated_mailbox*)userdata;
180180

181181
if (!mailbox)
@@ -190,7 +190,7 @@ static void vulkan_emulated_mailbox_loop(void *userdata)
190190
for (;;)
191191
{
192192
slock_lock(mailbox->lock);
193-
while ( !(mailbox->flags & VK_MAILBOX_FLAG_DEAD)
193+
while ( !(mailbox->flags & VK_MAILBOX_FLAG_DEAD)
194194
&& !(mailbox->flags & VK_MAILBOX_FLAG_REQUEST_ACQUIRE))
195195
scond_wait(mailbox->cond, mailbox->lock);
196196

@@ -207,9 +207,9 @@ static void vulkan_emulated_mailbox_loop(void *userdata)
207207
mailbox->device, mailbox->swapchain, UINT64_MAX,
208208
VK_NULL_HANDLE, fence, &mailbox->index);
209209
#ifdef ANDROID
210-
/* VK_SUBOPTIMAL_KHR can be returned on Android 10
210+
/* VK_SUBOPTIMAL_KHR can be returned on Android 10
211211
* when prerotate is not dealt with.
212-
* This is not an error we need to care about,
212+
* This is not an error we need to care about,
213213
* and we'll treat it as SUCCESS. */
214214
if (mailbox->result == VK_SUBOPTIMAL_KHR)
215215
mailbox->result = VK_SUCCESS;
@@ -569,7 +569,7 @@ static bool vulkan_context_init_device(gfx_ctx_vulkan_data_t *vk)
569569

570570
unsigned enabled_device_extension_count = 0;
571571

572-
struct retro_hw_render_context_negotiation_interface_vulkan
572+
struct retro_hw_render_context_negotiation_interface_vulkan
573573
*iface = (struct retro_hw_render_context_negotiation_interface_vulkan*)
574574
video_st->hw_render_context_negotiation;
575575

@@ -593,7 +593,7 @@ static bool vulkan_context_init_device(gfx_ctx_vulkan_data_t *vk)
593593

594594
if (iface)
595595
{
596-
if (iface->interface_type != RETRO_HW_RENDER_CONTEXT_NEGOTIATION_INTERFACE_VULKAN)
596+
if (iface->interface_type != RETRO_HW_RENDER_CONTEXT_NEGOTIATION_INTERFACE_VULKAN)
597597
{
598598
RARCH_WARN("[Vulkan]: Got HW context negotiation interface, but it's the wrong API.\n");
599599
iface = NULL;
@@ -713,29 +713,14 @@ static bool vulkan_context_init_device(gfx_ctx_vulkan_data_t *vk)
713713
RARCH_LOG("[Vulkan]: Using GPU: \"%s\".\n", vk->context.gpu_properties.deviceName);
714714

715715
{
716-
char device_str[128];
717716
char version_str[128];
718-
size_t len = strlcpy(device_str, vk->context.gpu_properties.deviceName, sizeof(device_str));
719-
device_str[len ] = ' ';
720-
device_str[++len] = '\0';
721-
722-
len += snprintf(device_str + len, sizeof(device_str) - len, "%u", VK_VERSION_MAJOR(vk->context.gpu_properties.driverVersion));
723-
device_str[len ] = '.';
724-
device_str[++len] = '\0';
725-
len += snprintf(device_str + len, sizeof(device_str) - len, "%u", VK_VERSION_MINOR(vk->context.gpu_properties.driverVersion));
726-
device_str[len ] = '.';
727-
device_str[++len] = '\0';
728-
snprintf(device_str + len, sizeof(device_str) - len, "%u", VK_VERSION_PATCH(vk->context.gpu_properties.driverVersion));
729-
730-
len = snprintf(version_str , sizeof(version_str) , "%u", VK_VERSION_MAJOR(vk->context.gpu_properties.apiVersion));
731-
version_str[len ] = '.';
717+
size_t len = snprintf(version_str , sizeof(version_str) , "%u", VK_VERSION_MAJOR(vk->context.gpu_properties.apiVersion));
718+
version_str[ len] = '.';
732719
version_str[++len] = '\0';
733720
len += snprintf(version_str + len, sizeof(version_str) - len, "%u", VK_VERSION_MINOR(vk->context.gpu_properties.apiVersion));
734-
version_str[len ] = '.';
721+
version_str[ len] = '.';
735722
version_str[++len] = '\0';
736723
snprintf(version_str + len, sizeof(version_str) - len, "%u", VK_VERSION_PATCH(vk->context.gpu_properties.apiVersion));
737-
738-
video_driver_set_gpu_device_string(device_str);
739724
video_driver_set_gpu_api_version_string(version_str);
740725
}
741726

@@ -1126,7 +1111,7 @@ static bool vulkan_create_display_surface(gfx_ctx_vulkan_data_t *vk,
11261111
vkGetDisplayPlaneCapabilitiesKHR(vk->context.gpu,
11271112
best_mode, i, &plane_caps);
11281113

1129-
if ( plane_caps.supportedAlpha
1114+
if ( plane_caps.supportedAlpha
11301115
& VK_DISPLAY_PLANE_ALPHA_OPAQUE_BIT_KHR)
11311116
{
11321117
best_plane = j;
@@ -1257,7 +1242,7 @@ static VkSemaphore vulkan_get_wsi_acquire_semaphore(struct vulkan_context *ctx)
12571242
if (ctx->num_recycled_acquire_semaphores == 0)
12581243
{
12591244
VkSemaphoreCreateInfo sem_info;
1260-
1245+
12611246
sem_info.sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO;
12621247
sem_info.pNext = NULL;
12631248
sem_info.flags = 0;
@@ -1756,7 +1741,7 @@ void vulkan_acquire_next_image(gfx_ctx_vulkan_data_t *vk)
17561741
fence_info.sType = VK_STRUCTURE_TYPE_FENCE_CREATE_INFO;
17571742
fence_info.pNext = NULL;
17581743
fence_info.flags = 0;
1759-
1744+
17601745
sem_info.sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO;
17611746
sem_info.pNext = NULL;
17621747
sem_info.flags = 0;
@@ -1811,9 +1796,9 @@ void vulkan_acquire_next_image(gfx_ctx_vulkan_data_t *vk)
18111796
vk->swapchain, UINT64_MAX,
18121797
semaphore, fence, &vk->context.current_swapchain_index);
18131798
#ifdef ANDROID
1814-
/* VK_SUBOPTIMAL_KHR can be returned on Android 10
1799+
/* VK_SUBOPTIMAL_KHR can be returned on Android 10
18151800
* when prerotate is not dealt with.
1816-
* This is not an error we need to care about, and
1801+
* This is not an error we need to care about, and
18171802
* we'll treat it as SUCCESS. */
18181803
if (err == VK_SUBOPTIMAL_KHR)
18191804
err = VK_SUCCESS;
@@ -1973,7 +1958,7 @@ bool vulkan_create_swapchain(gfx_ctx_vulkan_data_t *vk,
19731958
&& (vk->mailbox.swapchain != VK_NULL_HANDLE))
19741959
{
19751960
VkResult res = VK_SUCCESS;
1976-
/* We are tearing down, and entering a state
1961+
/* We are tearing down, and entering a state
19771962
* where we are supposed to have
19781963
* acquired an image, so block until we have acquired. */
19791964
if (! (vk->context.flags & VK_CTX_FLAG_HAS_ACQUIRED_SWAPCHAIN))
@@ -2026,7 +2011,7 @@ bool vulkan_create_swapchain(gfx_ctx_vulkan_data_t *vk,
20262011
vk->context.swap_interval = swap_interval;
20272012
for (i = 0; i < present_mode_count; i++)
20282013
{
2029-
if ( !swap_interval
2014+
if ( !swap_interval
20302015
&& (present_modes[i] == VK_PRESENT_MODE_MAILBOX_KHR))
20312016
{
20322017
swapchain_present_mode = VK_PRESENT_MODE_MAILBOX_KHR;
@@ -2038,7 +2023,7 @@ bool vulkan_create_swapchain(gfx_ctx_vulkan_data_t *vk,
20382023
swapchain_present_mode = VK_PRESENT_MODE_IMMEDIATE_KHR;
20392024
break;
20402025
}
2041-
else if ( swap_interval
2026+
else if ( swap_interval
20422027
&& (present_modes[i] == VK_PRESENT_MODE_FIFO_KHR))
20432028
{
20442029
/* Kind of tautological since FIFO must always be present. */
@@ -2058,7 +2043,7 @@ bool vulkan_create_swapchain(gfx_ctx_vulkan_data_t *vk,
20582043
vk->vk_surface, &format_count, formats);
20592044

20602045
format.format = VK_FORMAT_UNDEFINED;
2061-
if ( format_count == 1
2046+
if ( format_count == 1
20622047
&& (formats[0].format == VK_FORMAT_UNDEFINED))
20632048
{
20642049
format = formats[0];
@@ -2070,7 +2055,7 @@ bool vulkan_create_swapchain(gfx_ctx_vulkan_data_t *vk,
20702055
{
20712056
RARCH_ERR("[Vulkan]: Surface has no formats.\n");
20722057
return false;
2073-
}
2058+
}
20742059

20752060
#ifdef VULKAN_HDR_SWAPCHAIN
20762061
if (settings->bools.video_hdr_enable)
@@ -2206,7 +2191,7 @@ bool vulkan_create_swapchain(gfx_ctx_vulkan_data_t *vk,
22062191
info.imageExtent.height = swapchain_size.height;
22072192
info.imageArrayLayers = 1;
22082193
info.imageUsage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT
2209-
| VK_IMAGE_USAGE_TRANSFER_SRC_BIT
2194+
| VK_IMAGE_USAGE_TRANSFER_SRC_BIT
22102195
| VK_IMAGE_USAGE_TRANSFER_DST_BIT;
22112196
info.imageSharingMode = VK_SHARING_MODE_EXCLUSIVE;
22122197
info.queueFamilyIndexCount = 0;
@@ -2298,7 +2283,7 @@ bool vulkan_context_init(gfx_ctx_vulkan_data_t *vk,
22982283
PFN_vkGetInstanceProcAddr GetInstanceProcAddr;
22992284
const char *prog_name = NULL;
23002285
video_driver_state_t *video_st = video_state_get_ptr();
2301-
struct retro_hw_render_context_negotiation_interface_vulkan
2286+
struct retro_hw_render_context_negotiation_interface_vulkan
23022287
*iface = (struct retro_hw_render_context_negotiation_interface_vulkan*)video_st->hw_render_context_negotiation;
23032288

23042289
if (iface && iface->interface_type != RETRO_HW_RENDER_CONTEXT_NEGOTIATION_INTERFACE_VULKAN)
@@ -2418,8 +2403,8 @@ bool vulkan_context_init(gfx_ctx_vulkan_data_t *vk,
24182403
}
24192404
else
24202405
{
2421-
if ( iface
2422-
&& iface->interface_version >= 2
2406+
if ( iface
2407+
&& iface->interface_version >= 2
24232408
&& iface->create_instance)
24242409
vk->context.instance = iface->create_instance(
24252410
GetInstanceProcAddr, &app,
@@ -2495,7 +2480,7 @@ void vulkan_context_destroy(gfx_ctx_vulkan_data_t *vk,
24952480

24962481
vulkan_destroy_swapchain(vk);
24972482

2498-
if ( destroy_surface
2483+
if ( destroy_surface
24992484
&& (vk->vk_surface != VK_NULL_HANDLE))
25002485
{
25012486
vkDestroySurfaceKHR(vk->context.instance,
@@ -2570,9 +2555,9 @@ void vulkan_present(gfx_ctx_vulkan_data_t *vk, unsigned index)
25702555
err = vkQueuePresentKHR(vk->context.queue, &present);
25712556

25722557
#ifdef ANDROID
2573-
/* VK_SUBOPTIMAL_KHR can be returned on
2558+
/* VK_SUBOPTIMAL_KHR can be returned on
25742559
* Android 10 when prerotate is not dealt with.
2575-
* This is not an error we need to care about,
2560+
* This is not an error we need to care about,
25762561
* and we'll treat it as SUCCESS. */
25772562
if (result == VK_SUBOPTIMAL_KHR)
25782563
result = VK_SUCCESS;

gfx/drivers/d3d10.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2011,7 +2011,6 @@ static void *d3d10_gfx_init(const video_info_t* video,
20112011
d3d10->current_adapter = d3d10->adapters[gpu_index];
20122012
d3d10->adapter = d3d10->current_adapter;
20132013
RARCH_LOG("[D3D10]: Using GPU index %d.\n", gpu_index);
2014-
video_driver_set_gpu_device_string(d3d10->gpu_list->elems[gpu_index].data);
20152014
}
20162015
else
20172016
{

gfx/drivers/d3d11.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2620,7 +2620,6 @@ static void *d3d11_gfx_init(const video_info_t* video,
26202620
d3d11->current_adapter = d3d11->adapters[gpu_index];
26212621
d3d11->adapter = d3d11->current_adapter;
26222622
RARCH_LOG("[D3D11]: Using GPU index %d.\n", gpu_index);
2623-
video_driver_set_gpu_device_string(d3d11->gpu_list->elems[gpu_index].data);
26242623
}
26252624
else
26262625
{

gfx/drivers/d3d12.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2506,8 +2506,6 @@ static void d3d12_init_base(d3d12_video_t* d3d12)
25062506
d3d12->adapter = d3d12->adapters[gpu_index];
25072507
AddRef(d3d12->adapter);
25082508
RARCH_LOG("[D3D12]: Using GPU index %d.\n", gpu_index);
2509-
video_driver_set_gpu_device_string(
2510-
d3d12->gpu_list->elems[gpu_index].data);
25112509
}
25122510
else
25132511
{

gfx/drivers/d3d9cg.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1929,11 +1929,8 @@ static bool d3d9_cg_init_internal(d3d9_video_t *d3d,
19291929
LOWORD(ident.DriverVersion.HighPart),
19301930
HIWORD(ident.DriverVersion.LowPart),
19311931
LOWORD(ident.DriverVersion.LowPart));
1932-
19331932
RARCH_LOG("[D3D9]: Using GPU: \"%s\".\n", ident.Description);
19341933
RARCH_LOG("[D3D9]: GPU API Version: %s\n", version_str);
1935-
1936-
video_driver_set_gpu_device_string(ident.Description);
19371934
video_driver_set_gpu_api_version_string(version_str);
19381935
}
19391936

gfx/drivers/d3d9hlsl.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1516,8 +1516,6 @@ static bool d3d9_hlsl_init_internal(d3d9_video_t *d3d,
15161516

15171517
RARCH_LOG("[D3D9]: Using GPU: \"%s\".\n", ident.Description);
15181518
RARCH_LOG("[D3D9]: GPU API Version: %s\n", version_str);
1519-
1520-
video_driver_set_gpu_device_string(ident.Description);
15211519
video_driver_set_gpu_api_version_string(version_str);
15221520
}
15231521

gfx/drivers/gl1.c

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1115,26 +1115,8 @@ static void *gl1_init(const video_info_t *video,
11151115
RARCH_LOG("[GL1]: Version: %s.\n", version);
11161116
RARCH_LOG("[GL1]: Extensions: %s\n", extensions);
11171117

1118-
{
1119-
char device_str[128];
1120-
size_t len = 0;
1121-
device_str[0] = '\0';
1122-
1123-
if (!string_is_empty(vendor))
1124-
{
1125-
len = strlcpy(device_str, vendor, sizeof(device_str));
1126-
device_str[ len] = ' ';
1127-
device_str[++len] = '\0';
1128-
}
1129-
1130-
if (!string_is_empty(renderer))
1131-
strlcpy(device_str + len, renderer, sizeof(device_str) - len);
1132-
1133-
video_driver_set_gpu_device_string(device_str);
1134-
1135-
if (!string_is_empty(version))
1136-
video_driver_set_gpu_api_version_string(version);
1137-
}
1118+
if (!string_is_empty(version))
1119+
video_driver_set_gpu_api_version_string(version);
11381120

11391121
if (gl1->ctx_driver->input_driver)
11401122
{

gfx/drivers/gl2.c

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,8 @@ static void gfx_display_gl2_blend_end(void *data)
420420

421421
#ifdef MALI_BUG
422422
static bool
423-
gfx_display_gl2_discard_draw_rectangle(gfx_display_ctx_draw_t *draw,
423+
gfx_display_gl2_discard_draw_rectangle(gl2_t *gl,
424+
gfx_display_ctx_draw_t *draw,
424425
unsigned width, unsigned height)
425426
{
426427
static bool mali_4xx_detected = false;
@@ -431,20 +432,15 @@ gfx_display_gl2_discard_draw_rectangle(gfx_display_ctx_draw_t *draw,
431432
if (!scissor_inited)
432433
{
433434
unsigned i;
434-
const char *gpu_device_string = NULL;
435435
scissor_inited = true;
436+
const char *gpu_device_string = gl->device_string;
436437

437438
scissor_set_rectangle(0,
438439
width - 1,
439440
0,
440441
height - 1,
441442
0);
442443

443-
/* TODO/FIXME - This might be thread unsafe in the long run -
444-
* preferably call this once outside of the menu display driver
445-
* and then just pass this string as a parameter */
446-
gpu_device_string = video_driver_get_gpu_device_string();
447-
448444
if (gpu_device_string)
449445
{
450446
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,
503499
return;
504500

505501
#ifdef MALI_BUG
506-
if (gfx_display_gl2_discard_draw_rectangle(draw, video_width,
502+
if (gfx_display_gl2_discard_draw_rectangle(gl, draw, video_width,
507503
video_height))
508504
{
509505
/*RARCH_WARN("[Menu]: discarded draw rect: %.4i %.4i %.4i %.4i\n",
@@ -4323,21 +4319,17 @@ static void *gl2_init(const video_info_t *video,
43234319
sscanf(version, "%d.%d", &gl->version_major, &gl->version_minor);
43244320

43254321
{
4326-
char device_str[128];
43274322
size_t len = 0;
4328-
device_str[0] = '\0';
43294323

43304324
if (!string_is_empty(vendor))
43314325
{
4332-
len = strlcpy(device_str, vendor, sizeof(device_str));
4333-
device_str[ len] = ' ';
4334-
device_str[++len] = '\0';
4326+
len = strlcpy(gl->device_str, vendor, sizeof(gl->device_str));
4327+
gl->device_str[ len] = ' ';
4328+
gl->device_str[++len] = '\0';
43354329
}
43364330

43374331
if (!string_is_empty(renderer))
4338-
strlcpy(device_str + len, renderer, sizeof(device_str) - len);
4339-
4340-
video_driver_set_gpu_device_string(device_str);
4332+
strlcpy(gl->device_str + len, renderer, sizeof(gl->device_str) - len);
43414333

43424334
if (!string_is_empty(version))
43434335
video_driver_set_gpu_api_version_string(version);

gfx/drivers/gl3.c

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1875,16 +1875,7 @@ static void *gl3_init(const video_info_t *video,
18751875
if (!string_is_empty(version))
18761876
sscanf(version, "%u.%u", &gl->version_major, &gl->version_minor);
18771877

1878-
{
1879-
char device_str[128];
1880-
size_t len = strlcpy(device_str, vendor, sizeof(device_str));
1881-
device_str[ len] = ' ';
1882-
device_str[++len] = '\0';
1883-
strlcpy(device_str + len, renderer, sizeof(device_str) - len);
1884-
1885-
video_driver_set_gpu_device_string(device_str);
1886-
video_driver_set_gpu_api_version_string(version);
1887-
}
1878+
video_driver_set_gpu_api_version_string(version);
18881879

18891880
#ifdef _WIN32
18901881
if ( string_is_equal(vendor, "Microsoft Corporation"))

0 commit comments

Comments
 (0)