Lines Matching defs:ctx
298 static int load_libvulkan(AVHWDeviceContext *ctx)
300 AVVulkanDeviceContext *hwctx = ctx->hwctx;
301 VulkanDevicePriv *p = ctx->internal->priv;
323 av_log(ctx, AV_LOG_ERROR, "Unable to open the libvulkan library!\n");
406 AVHWDeviceContext *ctx = priv;
416 av_log(ctx, l, "%s\n", data->pMessage);
418 av_log(ctx, l, "\t%i: %s\n", i, data->pCmdBufLabels[i].pLabelName);
423 static int check_extensions(AVHWDeviceContext *ctx, int dev, AVDictionary *opts,
428 VulkanDevicePriv *p = ctx->internal->priv;
430 AVVulkanDeviceContext *hwctx = ctx->hwctx;
491 av_log(ctx, AV_LOG_VERBOSE, "Using %s extension %s\n", mod, tstr);
506 av_log(ctx, AV_LOG_VERBOSE, "Using %s extension %s\n", mod, tstr);
510 av_log(ctx, AV_LOG_ERROR, "Debug extension \"%s\" not found!\n",
528 av_log(ctx, AV_LOG_VERBOSE, "Using %s extension \"%s\"\n", mod, token);
531 av_log(ctx, AV_LOG_WARNING, "%s extension \"%s\" not found, excluding.\n",
552 static int check_validation_layers(AVHWDeviceContext *ctx, AVDictionary *opts,
559 VulkanDevicePriv *priv = ctx->internal->priv;
585 av_log(ctx, AV_LOG_VERBOSE, "Supported validation layers:\n");
587 av_log(ctx, AV_LOG_VERBOSE, "\t%s\n", sup_layers[i].layerName);
595 av_log(ctx, AV_LOG_VERBOSE, "Default validation layer %s is enabled\n",
633 av_log(ctx, AV_LOG_VERBOSE, "Requested Validation Layer: %s\n", token);
636 av_log(ctx, AV_LOG_ERROR,
662 static int create_instance(AVHWDeviceContext *ctx, AVDictionary *opts)
666 VulkanDevicePriv *p = ctx->internal->priv;
668 AVVulkanDeviceContext *hwctx = ctx->hwctx;
683 err = load_libvulkan(ctx);
688 err = ff_vk_load_functions(ctx, vk, p->extensions, 0, 0);
690 av_log(ctx, AV_LOG_ERROR, "Unable to load instance enumeration functions!\n");
694 err = check_validation_layers(ctx, opts, &inst_props.ppEnabledLayerNames,
700 err = check_extensions(ctx, 0, opts, &inst_props.ppEnabledExtensionNames,
712 av_log(ctx, AV_LOG_ERROR, "Instance creation failure: %s\n",
718 err = ff_vk_load_functions(ctx, vk, p->extensions, 1, 0);
720 av_log(ctx, AV_LOG_ERROR, "Unable to load instance functions!\n");
735 .pUserData = ctx,
770 static int find_device(AVHWDeviceContext *ctx, VulkanDeviceSelection *select)
775 VulkanDevicePriv *p = ctx->internal->priv;
780 AVVulkanDeviceContext *hwctx = ctx->hwctx;
784 av_log(ctx, AV_LOG_ERROR, "No devices found: %s!\n", vk_ret2str(ret));
794 av_log(ctx, AV_LOG_ERROR, "Failed enumerating devices: %s\n",
812 av_log(ctx, AV_LOG_VERBOSE, "GPU listing:\n");
819 av_log(ctx, AV_LOG_VERBOSE, " %d: %s (%s) (0x%x)\n", i,
832 av_log(ctx, AV_LOG_ERROR, "Unable to find device by given UUID!\n");
836 av_log(ctx, AV_LOG_VERBOSE, "Requested device: %s\n", select->name);
843 av_log(ctx, AV_LOG_ERROR, "Unable to find device \"%s\"!\n",
848 av_log(ctx, AV_LOG_VERBOSE, "Requested device: 0x%x\n", select->pci_device);
855 av_log(ctx, AV_LOG_ERROR, "Unable to find device with PCI ID 0x%x!\n",
860 av_log(ctx, AV_LOG_VERBOSE, "Requested vendor: 0x%x\n", select->vendor_id);
867 av_log(ctx, AV_LOG_ERROR, "Unable to find device with Vendor ID 0x%x!\n",
876 av_log(ctx, AV_LOG_ERROR, "Unable to find device with index %i!\n",
884 av_log(ctx, AV_LOG_VERBOSE, "Device %d selected: %s (%s) (0x%x)\n",
922 static int setup_queue_families(AVHWDeviceContext *ctx, VkDeviceCreateInfo *cd)
927 VulkanDevicePriv *p = ctx->internal->priv;
929 AVVulkanDeviceContext *hwctx = ctx->hwctx;
935 av_log(ctx, AV_LOG_ERROR, "Failed to get queues!\n");
947 av_log(ctx, AV_LOG_VERBOSE, "Queue families:\n");
949 av_log(ctx, AV_LOG_VERBOSE, " %i:%s%s%s%s%s%s%s (queues: %i)\n", i,
1283 static void vulkan_device_free(AVHWDeviceContext *ctx)
1285 VulkanDevicePriv *p = ctx->internal->priv;
1287 AVVulkanDeviceContext *hwctx = ctx->hwctx;
1306 static int vulkan_device_create_internal(AVHWDeviceContext *ctx,
1313 VulkanDevicePriv *p = ctx->internal->priv;
1315 AVVulkanDeviceContext *hwctx = ctx->hwctx;
1348 ctx->free = vulkan_device_free;
1351 if ((err = create_instance(ctx, opts)))
1355 if ((err = find_device(ctx, dev_select)))
1372 av_log(ctx, AV_LOG_ERROR, "Device does not support timeline semaphores!\n");
1379 if ((err = setup_queue_families(ctx, &dev_info)))
1382 if ((err = check_extensions(ctx, 1, opts, &dev_info.ppEnabledExtensionNames,
1398 av_log(ctx, AV_LOG_ERROR, "Device creation failure: %s\n",
1425 static int vulkan_device_init(AVHWDeviceContext *ctx)
1429 AVVulkanDeviceContext *hwctx = ctx->hwctx;
1430 VulkanDevicePriv *p = ctx->internal->priv;
1445 err = ff_vk_load_functions(ctx, vk, p->extensions, 1, 1);
1447 av_log(ctx, AV_LOG_ERROR, "Unable to load functions!\n");
1456 av_log(ctx, AV_LOG_VERBOSE, "Using device: %s\n",
1458 av_log(ctx, AV_LOG_VERBOSE, "Alignments:\n");
1459 av_log(ctx, AV_LOG_VERBOSE, " optimalBufferCopyRowPitchAlignment: %"PRIu64"\n",
1461 av_log(ctx, AV_LOG_VERBOSE, " minMemoryMapAlignment: %"SIZE_SPECIFIER"\n",
1464 av_log(ctx, AV_LOG_VERBOSE, " minImportedHostPointerAlignment: %"PRIu64"\n",
1472 av_log(ctx, AV_LOG_ERROR, "Failed to get queues!\n");
1485 av_log(ctx, AV_LOG_ERROR, "%s queue family is required, but marked as missing" \
1491 av_log(ctx, AV_LOG_ERROR, "Invalid %s family index %i (device has %i families)!\n", \
1496 av_log(ctx, AV_LOG_VERBOSE, "Using queue family %i (queues: %i)" \
1526 static int vulkan_device_create(AVHWDeviceContext *ctx, const char *device,
1539 return vulkan_device_create_internal(ctx, &dev_select, opts, flags);
1542 static int vulkan_device_derive(AVHWDeviceContext *ctx,
1559 av_log(ctx, AV_LOG_ERROR, "Unable to get device info from VAAPI!\n");
1568 return vulkan_device_create_internal(ctx, &dev_select, opts, flags);
1577 av_log(ctx, AV_LOG_ERROR, "Unable to get device info from DRM fd!\n");
1586 return vulkan_device_create_internal(ctx, &dev_select, opts, flags);
1599 av_log(ctx, AV_LOG_ERROR, "Unable to get UUID from CUDA!\n");
1605 return vulkan_device_create_internal(ctx, &dev_select, opts, flags);
1613 static int vulkan_frames_get_constraints(AVHWDeviceContext *ctx,
1618 VulkanDevicePriv *p = ctx->internal->priv;
1621 count += pixfmt_is_supported(ctx, i, p->use_linear_images);
1635 if (pixfmt_is_supported(ctx, i, p->use_linear_images))
1659 static int alloc_mem(AVHWDeviceContext *ctx, VkMemoryRequirements *req,
1665 VulkanDevicePriv *p = ctx->internal->priv;
1667 AVVulkanDeviceContext *dev_hwctx = ctx->hwctx;
1697 av_log(ctx, AV_LOG_ERROR, "No memory type found for flags 0x%x\n",
1707 av_log(ctx, AV_LOG_ERROR, "Failed to allocate memory: %s\n",
1784 AVHWDeviceContext *ctx = hwfc->device_ctx;
1785 VulkanDevicePriv *p = ctx->internal->priv;
1795 AVVulkanDeviceContext *hwctx = ctx->hwctx;
1849 if ((err = alloc_mem(ctx, &req.memoryRequirements,
1867 if ((err = alloc_mem(ctx, &cont_memory_requirements,
1891 av_log(ctx, AV_LOG_ERROR, "Failed to bind memory: %s\n",
2023 AVHWDeviceContext *ctx = hwfc->device_ctx;
2024 VulkanDevicePriv *p = ctx->internal->priv;
2026 AVVulkanDeviceContext *hwctx = ctx->hwctx;
2060 av_log(ctx, AV_LOG_ERROR, "Unable to allocate memory for AVVkFrame!\n");
2091 av_log(ctx, AV_LOG_ERROR, "Image creation failure: %s\n",
2641 AVHWDeviceContext *ctx = hwfc->device_ctx;
2642 AVVulkanDeviceContext *hwctx = ctx->hwctx;
2643 VulkanDevicePriv *p = ctx->internal->priv;
2652 av_log(ctx, AV_LOG_ERROR, "Unsupported DMABUF layer format %#08x!\n",
2659 av_log(ctx, AV_LOG_ERROR, "Unable to allocate memory for AVVkFrame!\n");
2747 av_log(ctx, AV_LOG_ERROR, "Cannot map DRM frame to Vulkan: %s\n",
2770 av_log(ctx, AV_LOG_ERROR, "Image creation failure: %s\n",
2840 err = alloc_mem(ctx, &req2.memoryRequirements,
2880 av_log(ctx, AV_LOG_ERROR, "Failed to bind memory: %s\n",
2981 AVHWDeviceContext *ctx = hwfc->device_ctx;
2982 AVVulkanDeviceContext *hwctx = ctx->hwctx;
2985 VulkanDevicePriv *p = ctx->internal->priv;
3124 av_log(ctx, AV_LOG_ERROR, "Failed to export semaphore: %s\n",
3465 AVHWDeviceContext *ctx = opaque;
3466 AVVulkanDeviceContext *hwctx = ctx->hwctx;
3467 VulkanDevicePriv *p = ctx->internal->priv;
3488 static int create_buf(AVHWDeviceContext *ctx, AVBufferRef **buf,
3496 AVVulkanDeviceContext *hwctx = ctx->hwctx;
3497 VulkanDevicePriv *p = ctx->internal->priv;
3531 av_log(ctx, AV_LOG_ERROR, "Failed to create buffer: %s\n",
3551 err = alloc_mem(ctx, &req.memoryRequirements, flags,
3559 av_log(ctx, AV_LOG_ERROR, "Failed to bind memory to buffer: %s\n",
3565 *buf = av_buffer_create((uint8_t *)vkbuf, sizeof(*vkbuf), free_buf, ctx, 0);
3574 free_buf(ctx, (uint8_t *)vkbuf);
3579 static int map_buffers(AVHWDeviceContext *ctx, AVBufferRef **bufs, uint8_t *mem[],
3583 AVVulkanDeviceContext *hwctx = ctx->hwctx;
3584 VulkanDevicePriv *p = ctx->internal->priv;
3597 av_log(ctx, AV_LOG_ERROR, "Failed to map buffer memory: %s\n",
3630 av_log(ctx, AV_LOG_WARNING, "Failed to invalidate memory: %s\n",
3637 static int unmap_buffers(AVHWDeviceContext *ctx, AVBufferRef **bufs,
3642 AVVulkanDeviceContext *hwctx = ctx->hwctx;
3643 VulkanDevicePriv *p = ctx->internal->priv;
3667 av_log(ctx, AV_LOG_ERROR, "Failed to flush memory: %s\n",