diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 01:13:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 01:13:14 +0000 |
commit | 5a3b54c78ce63d899f76dbb3db72e4894b40bd53 (patch) | |
tree | 50693d13eeefc4d683bdf5417f0861b0ef274a0c /video/out/vulkan/context.c | |
parent | Adding debian version 0.37.0-1. (diff) | |
download | mpv-5a3b54c78ce63d899f76dbb3db72e4894b40bd53.tar.xz mpv-5a3b54c78ce63d899f76dbb3db72e4894b40bd53.zip |
Merging upstream version 0.38.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'video/out/vulkan/context.c')
-rw-r--r-- | video/out/vulkan/context.c | 49 |
1 files changed, 19 insertions, 30 deletions
diff --git a/video/out/vulkan/context.c b/video/out/vulkan/context.c index 5087403..82c878a 100644 --- a/video/out/vulkan/context.c +++ b/video/out/vulkan/context.c @@ -25,6 +25,7 @@ #include "options/m_config.h" #include "video/out/placebo/ra_pl.h" +#include "video/out/placebo/utils.h" #include "context.h" #include "utils.h" @@ -37,39 +38,32 @@ struct vulkan_opts { bool async_compute; }; -static int vk_validate_dev(struct mp_log *log, const struct m_option *opt, - struct bstr name, const char **value) +static inline OPT_STRING_VALIDATE_FUNC(vk_validate_dev) { - struct bstr param = bstr0(*value); int ret = M_OPT_INVALID; - VkResult res; + void *ta_ctx = talloc_new(NULL); + pl_log pllog = mppl_log_create(ta_ctx, log); + if (!pllog) + goto done; // Create a dummy instance to validate/list the devices - VkInstanceCreateInfo info = { - .sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO, - .pApplicationInfo = &(VkApplicationInfo) { - .sType = VK_STRUCTURE_TYPE_APPLICATION_INFO, - .apiVersion = VK_API_VERSION_1_1, - } - }; - - VkInstance inst; - VkPhysicalDevice *devices = NULL; - uint32_t num = 0; - - res = vkCreateInstance(&info, NULL, &inst); - if (res != VK_SUCCESS) + mppl_log_set_probing(pllog, true); + pl_vk_inst inst = pl_vk_inst_create(pllog, pl_vk_inst_params()); + mppl_log_set_probing(pllog, false); + if (!inst) goto done; - res = vkEnumeratePhysicalDevices(inst, &num, NULL); + uint32_t num = 0; + VkResult res = vkEnumeratePhysicalDevices(inst->instance, &num, NULL); if (res != VK_SUCCESS) goto done; - devices = talloc_array(NULL, VkPhysicalDevice, num); - res = vkEnumeratePhysicalDevices(inst, &num, devices); + VkPhysicalDevice *devices = talloc_array(ta_ctx, VkPhysicalDevice, num); + res = vkEnumeratePhysicalDevices(inst->instance, &num, devices); if (res != VK_SUCCESS) goto done; + struct bstr param = bstr0(*value); bool help = bstr_equals0(param, "help"); if (help) { mp_info(log, "Available vulkan devices:\n"); @@ -111,7 +105,9 @@ static int vk_validate_dev(struct mp_log *log, const struct m_option *opt, BSTR_P(param)); done: - talloc_free(devices); + pl_vk_inst_destroy(&inst); + pl_log_destroy(&pllog); + talloc_free(ta_ctx); return ret; } @@ -207,8 +203,7 @@ bool ra_vk_ctx_init(struct ra_ctx *ctx, struct mpvk_ctx *vk, VK_KHR_VIDEO_DECODE_H264_EXTENSION_NAME, VK_KHR_VIDEO_DECODE_H265_EXTENSION_NAME, VK_KHR_VIDEO_QUEUE_EXTENSION_NAME, - // This is a literal string as it's not in the official headers yet. - "VK_MESA_video_decode_av1", + "VK_KHR_video_decode_av1", /* VK_KHR_VIDEO_DECODE_AV1_EXTENSION_NAME */ }; VkPhysicalDeviceDescriptorBufferFeaturesEXT descriptor_buffer_feature = { @@ -310,11 +305,6 @@ char *ra_vk_ctx_get_device_name(struct ra_ctx *ctx) return device_name; } -static int color_depth(struct ra_swapchain *sw) -{ - return 0; // TODO: implement this somehow? -} - static bool start_frame(struct ra_swapchain *sw, struct ra_fbo *out_fbo) { struct priv *p = sw->priv; @@ -364,7 +354,6 @@ static void get_vsync(struct ra_swapchain *sw, } static const struct ra_swapchain_fns vulkan_swapchain = { - .color_depth = color_depth, .start_frame = start_frame, .submit_frame = submit_frame, .swap_buffers = swap_buffers, |