summaryrefslogtreecommitdiffstats
path: root/video/out/vulkan/context.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 01:13:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 01:13:14 +0000
commit60e8a3d404f0640fa5a3f834eae54b4f1fb9127d (patch)
tree1da89a218d0ecf010c67a87cb2f625c4cb18e7d7 /video/out/vulkan/context.c
parentAdding upstream version 0.37.0. (diff)
downloadmpv-60e8a3d404f0640fa5a3f834eae54b4f1fb9127d.tar.xz
mpv-60e8a3d404f0640fa5a3f834eae54b4f1fb9127d.zip
Adding upstream version 0.38.0.upstream/0.38.0upstream
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.c49
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,