diff --git a/gfx/common/gl2_common.h b/gfx/common/gl2_common.h index 95a3689ce3..3f5034544e 100644 --- a/gfx/common/gl2_common.h +++ b/gfx/common/gl2_common.h @@ -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]; }; diff --git a/gfx/common/vulkan_common.c b/gfx/common/vulkan_common.c index 7b60e710f8..3c0c4d8aed 100644 --- a/gfx/common/vulkan_common.c +++ b/gfx/common/vulkan_common.c @@ -175,7 +175,7 @@ static void vulkan_emulated_mailbox_loop(void *userdata) { VkFence fence; VkFenceCreateInfo info; - struct vulkan_emulated_mailbox *mailbox = + struct vulkan_emulated_mailbox *mailbox = (struct vulkan_emulated_mailbox*)userdata; if (!mailbox) @@ -190,7 +190,7 @@ static void vulkan_emulated_mailbox_loop(void *userdata) for (;;) { slock_lock(mailbox->lock); - while ( !(mailbox->flags & VK_MAILBOX_FLAG_DEAD) + while ( !(mailbox->flags & VK_MAILBOX_FLAG_DEAD) && !(mailbox->flags & VK_MAILBOX_FLAG_REQUEST_ACQUIRE)) scond_wait(mailbox->cond, mailbox->lock); @@ -207,9 +207,9 @@ static void vulkan_emulated_mailbox_loop(void *userdata) mailbox->device, mailbox->swapchain, UINT64_MAX, VK_NULL_HANDLE, fence, &mailbox->index); #ifdef ANDROID - /* VK_SUBOPTIMAL_KHR can be returned on Android 10 + /* VK_SUBOPTIMAL_KHR can be returned on Android 10 * when prerotate is not dealt with. - * This is not an error we need to care about, + * This is not an error we need to care about, * and we'll treat it as SUCCESS. */ if (mailbox->result == VK_SUBOPTIMAL_KHR) mailbox->result = VK_SUCCESS; @@ -569,7 +569,7 @@ static bool vulkan_context_init_device(gfx_ctx_vulkan_data_t *vk) unsigned enabled_device_extension_count = 0; - struct retro_hw_render_context_negotiation_interface_vulkan + struct retro_hw_render_context_negotiation_interface_vulkan *iface = (struct retro_hw_render_context_negotiation_interface_vulkan*) video_st->hw_render_context_negotiation; @@ -593,7 +593,7 @@ static bool vulkan_context_init_device(gfx_ctx_vulkan_data_t *vk) if (iface) { - if (iface->interface_type != RETRO_HW_RENDER_CONTEXT_NEGOTIATION_INTERFACE_VULKAN) + if (iface->interface_type != RETRO_HW_RENDER_CONTEXT_NEGOTIATION_INTERFACE_VULKAN) { RARCH_WARN("[Vulkan]: Got HW context negotiation interface, but it's the wrong API.\n"); iface = NULL; @@ -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)); - version_str[len ] = '.'; + 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] = '.'; 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); } @@ -1126,7 +1111,7 @@ retry: vkGetDisplayPlaneCapabilitiesKHR(vk->context.gpu, best_mode, i, &plane_caps); - if ( plane_caps.supportedAlpha + if ( plane_caps.supportedAlpha & VK_DISPLAY_PLANE_ALPHA_OPAQUE_BIT_KHR) { best_plane = j; @@ -1257,7 +1242,7 @@ static VkSemaphore vulkan_get_wsi_acquire_semaphore(struct vulkan_context *ctx) if (ctx->num_recycled_acquire_semaphores == 0) { VkSemaphoreCreateInfo sem_info; - + sem_info.sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO; sem_info.pNext = NULL; sem_info.flags = 0; @@ -1756,7 +1741,7 @@ void vulkan_acquire_next_image(gfx_ctx_vulkan_data_t *vk) fence_info.sType = VK_STRUCTURE_TYPE_FENCE_CREATE_INFO; fence_info.pNext = NULL; fence_info.flags = 0; - + sem_info.sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO; sem_info.pNext = NULL; sem_info.flags = 0; @@ -1811,9 +1796,9 @@ retry: vk->swapchain, UINT64_MAX, semaphore, fence, &vk->context.current_swapchain_index); #ifdef ANDROID - /* VK_SUBOPTIMAL_KHR can be returned on Android 10 + /* VK_SUBOPTIMAL_KHR can be returned on Android 10 * when prerotate is not dealt with. - * This is not an error we need to care about, and + * This is not an error we need to care about, and * we'll treat it as SUCCESS. */ if (err == VK_SUBOPTIMAL_KHR) err = VK_SUCCESS; @@ -1973,7 +1958,7 @@ bool vulkan_create_swapchain(gfx_ctx_vulkan_data_t *vk, && (vk->mailbox.swapchain != VK_NULL_HANDLE)) { VkResult res = VK_SUCCESS; - /* We are tearing down, and entering a state + /* We are tearing down, and entering a state * where we are supposed to have * acquired an image, so block until we have acquired. */ if (! (vk->context.flags & VK_CTX_FLAG_HAS_ACQUIRED_SWAPCHAIN)) @@ -2026,7 +2011,7 @@ bool vulkan_create_swapchain(gfx_ctx_vulkan_data_t *vk, vk->context.swap_interval = swap_interval; for (i = 0; i < present_mode_count; i++) { - if ( !swap_interval + if ( !swap_interval && (present_modes[i] == VK_PRESENT_MODE_MAILBOX_KHR)) { swapchain_present_mode = VK_PRESENT_MODE_MAILBOX_KHR; @@ -2038,7 +2023,7 @@ bool vulkan_create_swapchain(gfx_ctx_vulkan_data_t *vk, swapchain_present_mode = VK_PRESENT_MODE_IMMEDIATE_KHR; break; } - else if ( swap_interval + else if ( swap_interval && (present_modes[i] == VK_PRESENT_MODE_FIFO_KHR)) { /* Kind of tautological since FIFO must always be present. */ @@ -2058,7 +2043,7 @@ bool vulkan_create_swapchain(gfx_ctx_vulkan_data_t *vk, vk->vk_surface, &format_count, formats); format.format = VK_FORMAT_UNDEFINED; - if ( format_count == 1 + if ( format_count == 1 && (formats[0].format == VK_FORMAT_UNDEFINED)) { format = formats[0]; @@ -2070,7 +2055,7 @@ bool vulkan_create_swapchain(gfx_ctx_vulkan_data_t *vk, { RARCH_ERR("[Vulkan]: Surface has no formats.\n"); return false; - } + } #ifdef VULKAN_HDR_SWAPCHAIN if (settings->bools.video_hdr_enable) @@ -2206,7 +2191,7 @@ bool vulkan_create_swapchain(gfx_ctx_vulkan_data_t *vk, info.imageExtent.height = swapchain_size.height; info.imageArrayLayers = 1; info.imageUsage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT - | VK_IMAGE_USAGE_TRANSFER_SRC_BIT + | VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT; info.imageSharingMode = VK_SHARING_MODE_EXCLUSIVE; info.queueFamilyIndexCount = 0; @@ -2298,7 +2283,7 @@ bool vulkan_context_init(gfx_ctx_vulkan_data_t *vk, PFN_vkGetInstanceProcAddr GetInstanceProcAddr; const char *prog_name = NULL; video_driver_state_t *video_st = video_state_get_ptr(); - struct retro_hw_render_context_negotiation_interface_vulkan + struct retro_hw_render_context_negotiation_interface_vulkan *iface = (struct retro_hw_render_context_negotiation_interface_vulkan*)video_st->hw_render_context_negotiation; 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, } else { - if ( iface - && iface->interface_version >= 2 + if ( iface + && iface->interface_version >= 2 && iface->create_instance) vk->context.instance = iface->create_instance( GetInstanceProcAddr, &app, @@ -2495,7 +2480,7 @@ void vulkan_context_destroy(gfx_ctx_vulkan_data_t *vk, vulkan_destroy_swapchain(vk); - if ( destroy_surface + if ( destroy_surface && (vk->vk_surface != VK_NULL_HANDLE)) { vkDestroySurfaceKHR(vk->context.instance, @@ -2570,9 +2555,9 @@ void vulkan_present(gfx_ctx_vulkan_data_t *vk, unsigned index) err = vkQueuePresentKHR(vk->context.queue, &present); #ifdef ANDROID - /* VK_SUBOPTIMAL_KHR can be returned on + /* VK_SUBOPTIMAL_KHR can be returned on * Android 10 when prerotate is not dealt with. - * This is not an error we need to care about, + * This is not an error we need to care about, * and we'll treat it as SUCCESS. */ if (result == VK_SUBOPTIMAL_KHR) result = VK_SUCCESS; diff --git a/gfx/drivers/d3d10.c b/gfx/drivers/d3d10.c index bf3fdee4e8..0cb589ac83 100644 --- a/gfx/drivers/d3d10.c +++ b/gfx/drivers/d3d10.c @@ -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 { diff --git a/gfx/drivers/d3d11.c b/gfx/drivers/d3d11.c index 71c33d0e52..81f712714b 100644 --- a/gfx/drivers/d3d11.c +++ b/gfx/drivers/d3d11.c @@ -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 { diff --git a/gfx/drivers/d3d12.c b/gfx/drivers/d3d12.c index 099b604cbb..7055465126 100644 --- a/gfx/drivers/d3d12.c +++ b/gfx/drivers/d3d12.c @@ -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 { diff --git a/gfx/drivers/d3d9cg.c b/gfx/drivers/d3d9cg.c index 12babf29f4..7dce7c0e3e 100644 --- a/gfx/drivers/d3d9cg.c +++ b/gfx/drivers/d3d9cg.c @@ -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); } diff --git a/gfx/drivers/d3d9hlsl.c b/gfx/drivers/d3d9hlsl.c index b1c0b432b3..38d58ab150 100644 --- a/gfx/drivers/d3d9hlsl.c +++ b/gfx/drivers/d3d9hlsl.c @@ -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); } diff --git a/gfx/drivers/gl1.c b/gfx/drivers/gl1.c index e5ff26c47c..2b72b871a1 100644 --- a/gfx/drivers/gl1.c +++ b/gfx/drivers/gl1.c @@ -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 (!string_is_empty(version)) + video_driver_set_gpu_api_version_string(version); if (gl1->ctx_driver->input_driver) { diff --git a/gfx/drivers/gl2.c b/gfx/drivers/gl2.c index cbbc2a7e7c..a1df4665ef 100644 --- a/gfx/drivers/gl2.c +++ b/gfx/drivers/gl2.c @@ -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); diff --git a/gfx/drivers/gl3.c b/gfx/drivers/gl3.c index 21c7727bbb..9e78dd2e2b 100644 --- a/gfx/drivers/gl3.c +++ b/gfx/drivers/gl3.c @@ -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); - } + video_driver_set_gpu_api_version_string(version); #ifdef _WIN32 if ( string_is_equal(vendor, "Microsoft Corporation")) diff --git a/gfx/gfx_thumbnail_path.c b/gfx/gfx_thumbnail_path.c index 65895243a8..7f86173547 100644 --- a/gfx/gfx_thumbnail_path.c +++ b/gfx/gfx_thumbnail_path.c @@ -96,7 +96,7 @@ static const char *gfx_thumbnail_get_type( break; } } - + end: return msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF); } @@ -107,7 +107,7 @@ void gfx_thumbnail_path_reset(gfx_thumbnail_path_data_t *path_data) { if (!path_data) return; - + path_data->system[0] = '\0'; path_data->content_path[0] = '\0'; path_data->content_label[0] = '\0'; @@ -116,7 +116,7 @@ void gfx_thumbnail_path_reset(gfx_thumbnail_path_data_t *path_data) path_data->content_img[0] = '\0'; path_data->right_path[0] = '\0'; path_data->left_path[0] = '\0'; - + path_data->playlist_right_mode = PLAYLIST_THUMBNAIL_MODE_DEFAULT; path_data->playlist_left_mode = PLAYLIST_THUMBNAIL_MODE_DEFAULT; } @@ -135,7 +135,7 @@ gfx_thumbnail_path_data_t *gfx_thumbnail_path_init(void) return NULL; gfx_thumbnail_path_reset(path_data); - + return path_data; } @@ -164,7 +164,7 @@ bool gfx_thumbnail_is_enabled(gfx_thumbnail_path_data_t *path_data, enum gfx_thu break; } } - + return false; } @@ -182,41 +182,36 @@ bool gfx_thumbnail_set_system(gfx_thumbnail_path_data_t *path_data, { if (!path_data) return false; - + /* When system is updated, must regenerate right/left * thumbnail paths */ path_data->right_path[0] = '\0'; path_data->left_path[0] = '\0'; - + /* 'Reset' path_data system string */ path_data->system[0] = '\0'; - + /* Must also reset playlist thumbnail display modes */ path_data->playlist_right_mode = PLAYLIST_THUMBNAIL_MODE_DEFAULT; path_data->playlist_left_mode = PLAYLIST_THUMBNAIL_MODE_DEFAULT; - + if (string_is_empty(system)) return false; - + /* 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)); - + /* Addendum: Now that we have per-playlist thumbnail display * modes, we must extract them here - otherwise * gfx_thumbnail_is_enabled() will go out of sync */ if (playlist) { const char *playlist_path = playlist_get_conf_path(playlist); - + /* Note: This is not considered an error * (just means that input playlist is ignored) */ if (!string_is_empty(playlist_path)) @@ -258,7 +253,7 @@ bool gfx_thumbnail_set_system(gfx_thumbnail_path_data_t *path_data, } } } - + return true; } @@ -268,34 +263,34 @@ bool gfx_thumbnail_set_content(gfx_thumbnail_path_data_t *path_data, const char { if (!path_data) return false; - + /* When content is updated, must regenerate right/left * thumbnail paths */ path_data->right_path[0] = '\0'; path_data->left_path[0] = '\0'; - + /* 'Reset' path_data content strings */ path_data->content_path[0] = '\0'; path_data->content_label[0] = '\0'; path_data->content_core_name[0] = '\0'; path_data->content_db_name[0] = '\0'; path_data->content_img[0] = '\0'; - + /* Must also reset playlist thumbnail display modes */ path_data->playlist_right_mode = PLAYLIST_THUMBNAIL_MODE_DEFAULT; path_data->playlist_left_mode = PLAYLIST_THUMBNAIL_MODE_DEFAULT; path_data->playlist_index = 0; - + if (string_is_empty(label)) return false; - + /* Cache content label */ strlcpy(path_data->content_label, label, sizeof(path_data->content_label)); - + /* Determine content image name */ gfx_thumbnail_fill_content_img(path_data->content_img, sizeof(path_data->content_img), path_data->content_label); - + /* Have to set content path to *something*... * Just use label value (it doesn't matter) */ strlcpy(path_data->content_path, label, sizeof(path_data->content_path)); @@ -311,37 +306,37 @@ bool gfx_thumbnail_set_content_image( const char *img_dir, const char *img_name) { char *content_img_no_ext = NULL; - + if (!path_data) return false; - + /* When content is updated, must regenerate right/left * thumbnail paths */ path_data->right_path[0] = '\0'; path_data->left_path[0] = '\0'; - + /* 'Reset' path_data content strings */ path_data->content_path[0] = '\0'; path_data->content_label[0] = '\0'; path_data->content_core_name[0] = '\0'; path_data->content_db_name[0] = '\0'; path_data->content_img[0] = '\0'; - + /* Must also reset playlist thumbnail display modes */ path_data->playlist_right_mode = PLAYLIST_THUMBNAIL_MODE_DEFAULT; path_data->playlist_left_mode = PLAYLIST_THUMBNAIL_MODE_DEFAULT; path_data->playlist_index = 0; - + if (string_is_empty(img_dir) || string_is_empty(img_name)) return false; - + if (path_is_media_type(img_name) != RARCH_CONTENT_IMAGE) return false; - + /* Cache content image name */ strlcpy(path_data->content_img, img_name, sizeof(path_data->content_img)); - + /* Get image label */ content_img_no_ext = path_remove_extension(path_data->content_img); if (!string_is_empty(content_img_no_ext)) @@ -350,22 +345,22 @@ bool gfx_thumbnail_set_content_image( else strlcpy(path_data->content_label, path_data->content_img, sizeof(path_data->content_label)); - + /* Set file path */ fill_pathname_join_special(path_data->content_path, img_dir, img_name, sizeof(path_data->content_path)); - + /* Set core name to "imageviewer" */ strlcpy( path_data->content_core_name, "imageviewer", sizeof(path_data->content_core_name)); - + /* Set database name (arbitrarily) to "_images_" * (required for compatibility with gfx_thumbnail_update_path(), * but not actually used...) */ strlcpy(path_data->content_db_name, "_images_", sizeof(path_data->content_db_name)); - + /* Redundant error check */ return !string_is_empty(path_data->content_path); } @@ -385,33 +380,33 @@ bool gfx_thumbnail_set_content_playlist( const char *core_name = NULL; const char *db_name = NULL; const struct playlist_entry *entry = NULL; - + if (!path_data) return false; - + /* When content is updated, must regenerate right/left * thumbnail paths */ path_data->right_path[0] = '\0'; path_data->left_path[0] = '\0'; - + /* 'Reset' path_data content strings */ path_data->content_path[0] = '\0'; path_data->content_label[0] = '\0'; path_data->content_core_name[0] = '\0'; path_data->content_db_name[0] = '\0'; path_data->content_img[0] = '\0'; - + /* Must also reset playlist thumbnail display modes */ path_data->playlist_right_mode = PLAYLIST_THUMBNAIL_MODE_DEFAULT; path_data->playlist_left_mode = PLAYLIST_THUMBNAIL_MODE_DEFAULT; path_data->playlist_index = 0; - + if (!playlist) return false; - + if (idx >= playlist_get_size(playlist)) return false; - + /* Read playlist values */ playlist_get_index(playlist, idx, &entry); @@ -426,18 +421,18 @@ bool gfx_thumbnail_set_content_playlist( /* Content without a path is invalid by definition */ if (string_is_empty(content_path)) return false; - + /* Cache content path * (This is required for imageviewer, history and favourites content) */ strlcpy(path_data->content_path, content_path, sizeof(path_data->content_path)); - + /* Cache core name * (This is required for imageviewer content) */ if (!string_is_empty(core_name)) strlcpy(path_data->content_core_name, core_name, sizeof(path_data->content_core_name)); - + /* Get content label */ if (!string_is_empty(content_label)) strlcpy(path_data->content_label, @@ -446,18 +441,18 @@ bool gfx_thumbnail_set_content_playlist( fill_pathname(path_data->content_label, path_basename(content_path), "", sizeof(path_data->content_label)); - + /* Determine content image name */ gfx_thumbnail_fill_content_img(path_data->content_img, sizeof(path_data->content_img), path_data->content_label); /* Store playlist index */ path_data->playlist_index = idx; - + /* Redundant error check... */ if (string_is_empty(path_data->content_img)) return false; - + /* Thumbnail image name is done -> now check if * per-content database name is defined */ if (!string_is_empty(db_name)) @@ -480,7 +475,7 @@ bool gfx_thumbnail_set_content_playlist( * so have to use a temporary buffer... */ strlcpy(tmp_buf, db_name, sizeof(tmp_buf)); db_name_no_ext = path_remove_extension(tmp_buf); - + if (!string_is_empty(db_name_no_ext)) strlcpy(path_data->content_db_name, db_name_no_ext, sizeof(path_data->content_db_name)); @@ -489,7 +484,7 @@ bool gfx_thumbnail_set_content_playlist( tmp_buf, sizeof(path_data->content_db_name)); } } - + /* Playlist entry is valid -> it is now 'safe' to * extract any remaining playlist metadata * (i.e. thumbnail display modes) */ @@ -497,7 +492,7 @@ bool gfx_thumbnail_set_content_playlist( playlist_get_thumbnail_mode(playlist, PLAYLIST_THUMBNAIL_RIGHT); path_data->playlist_left_mode = playlist_get_thumbnail_mode(playlist, PLAYLIST_THUMBNAIL_LEFT); - + return true; } @@ -519,10 +514,10 @@ bool gfx_thumbnail_update_path( const char *system_name = NULL; char *thumbnail_path = NULL; const char *dir_thumbnails = NULL; - + if (!path_data) return false; - + /* Determine which path we are updating... */ switch (thumbnail_id) { @@ -535,28 +530,28 @@ bool gfx_thumbnail_update_path( default: return false; } - + content_dir[0] = '\0'; if (settings) dir_thumbnails = settings->paths.directory_thumbnails; - + /* Sundry error checking */ if (string_is_empty(dir_thumbnails)) return false; - + if (!gfx_thumbnail_is_enabled(path_data, thumbnail_id)) return false; - + /* Generate new path */ - + /* > Check path_data for empty strings */ - if ( string_is_empty(path_data->content_path) + if ( string_is_empty(path_data->content_path) || string_is_empty(path_data->content_img) || ( string_is_empty(path_data->system) && string_is_empty(path_data->content_db_name))) return false; - + /* > Get current system */ if (string_is_empty(path_data->content_db_name)) { @@ -570,7 +565,7 @@ bool gfx_thumbnail_update_path( if (!gfx_thumbnail_get_content_dir( path_data, content_dir, sizeof(content_dir))) return false; - + system_name = content_dir; } else @@ -578,7 +573,7 @@ bool gfx_thumbnail_update_path( } else system_name = path_data->content_db_name; - + /* > Special case: thumbnail for imageviewer content * is the image file itself */ if ( string_is_equal(system_name, "images_history") @@ -595,20 +590,20 @@ bool gfx_thumbnail_update_path( const char *type = gfx_thumbnail_get_type(settings, path_data, thumbnail_id); /* > Normal content: assemble path */ - + /* >> Base + system name */ fill_pathname_join_special(thumbnail_path, dir_thumbnails, system_name, PATH_MAX_LENGTH * sizeof(char)); - + /* >> Add type */ fill_pathname_join_special(tmp_buf, thumbnail_path, type, sizeof(tmp_buf)); - + /* >> Add content image */ thumbnail_path[0] = '\0'; fill_pathname_join_special(thumbnail_path, tmp_buf, path_data->content_img, PATH_MAX_LENGTH * sizeof(char)); } - + /* Final error check - is cached path empty? */ return !string_is_empty(thumbnail_path); } @@ -624,10 +619,10 @@ bool gfx_thumbnail_get_path( const char **path) { char *thumbnail_path = NULL; - + if (!path_data || !path) return false; - + switch (thumbnail_id) { case GFX_THUMBNAIL_RIGHT: @@ -649,7 +644,7 @@ bool gfx_thumbnail_get_path( default: break; } - + return false; } @@ -662,9 +657,9 @@ bool gfx_thumbnail_get_system( return false; if (string_is_empty(path_data->system)) return false; - + *system = path_data->system; - + return true; } @@ -677,9 +672,9 @@ bool gfx_thumbnail_get_label( return false; if (string_is_empty(path_data->content_label)) return false; - + *label = path_data->content_label; - + return true; } @@ -692,9 +687,9 @@ bool gfx_thumbnail_get_core_name( return false; if (string_is_empty(path_data->content_core_name)) return false; - + *core_name = path_data->content_core_name; - + return true; } @@ -708,9 +703,9 @@ bool gfx_thumbnail_get_img_name( return false; if (string_is_empty(path_data->content_img)) return false; - + *img_name = path_data->content_img; - + return true; } @@ -722,20 +717,20 @@ bool gfx_thumbnail_get_content_dir( size_t path_length; char tmp_buf[PATH_MAX_LENGTH]; const char *last_slash = NULL; - + if (!path_data || string_is_empty(path_data->content_path)) return false; - + if (!(last_slash = find_last_slash(path_data->content_path))) return false; - + path_length = last_slash + 1 - path_data->content_path; - + if (!((path_length > 1) && (path_length < PATH_MAX_LENGTH))) return false; strlcpy(tmp_buf, path_data->content_path, path_length * sizeof(char)); strlcpy(content_dir, path_basename_nocompression(tmp_buf), len); - + return !string_is_empty(content_dir); } diff --git a/gfx/video_crt_switch.c b/gfx/video_crt_switch.c index 7e51e0c0f4..f4706c8396 100644 --- a/gfx/video_crt_switch.c +++ b/gfx/video_crt_switch.c @@ -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); diff --git a/gfx/video_driver.c b/gfx/video_driver.c index bf66875688..5f124955cd 100644 --- a/gfx/video_driver.c +++ b/gfx/video_driver.c @@ -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; diff --git a/gfx/video_driver.h b/gfx/video_driver.h index 3a3cbacb20..7755ffc7b2 100644 --- a/gfx/video_driver.h +++ b/gfx/video_driver.h @@ -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);