Lines Matching defs:hwfc
456 AVHWFramesContext *hwfc = opaque;
457 AVVAAPIDeviceContext *hwctx = hwfc->device_ctx->hwctx;
465 av_log(hwfc, AV_LOG_ERROR, "Failed to destroy surface %#x: "
472 AVHWFramesContext *hwfc = opaque;
473 VAAPIFramesContext *ctx = hwfc->internal->priv;
474 AVVAAPIDeviceContext *hwctx = hwfc->device_ctx->hwctx;
475 AVVAAPIFramesContext *avfc = hwfc->hwctx;
480 if (hwfc->initial_pool_size > 0 &&
481 avfc->nb_surfaces >= hwfc->initial_pool_size)
485 hwfc->width, hwfc->height,
489 av_log(hwfc, AV_LOG_ERROR, "Failed to create surface: "
493 av_log(hwfc, AV_LOG_DEBUG, "Created surface %#x.\n", surface_id);
497 hwfc, AV_BUFFER_FLAG_READONLY);
503 if (hwfc->initial_pool_size > 0) {
506 av_assert0(avfc->nb_surfaces < hwfc->initial_pool_size);
514 static int vaapi_frames_init(AVHWFramesContext *hwfc)
516 AVVAAPIFramesContext *avfc = hwfc->hwctx;
517 VAAPIFramesContext *ctx = hwfc->internal->priv;
518 AVVAAPIDeviceContext *hwctx = hwfc->device_ctx->hwctx;
527 desc = vaapi_format_from_pix_fmt(hwfc->sw_format);
529 av_log(hwfc, AV_LOG_ERROR, "Unsupported format: %s.\n",
530 av_get_pix_fmt_name(hwfc->sw_format));
534 if (!hwfc->pool) {
580 if (hwfc->initial_pool_size > 0) {
585 avfc->surface_ids = av_malloc(hwfc->initial_pool_size *
598 hwfc->internal->pool_internal =
599 av_buffer_pool_init2(sizeof(VASurfaceID), hwfc,
601 if (!hwfc->internal->pool_internal) {
602 av_log(hwfc, AV_LOG_ERROR, "Failed to create VAAPI surface pool.\n");
610 if (hwfc->pool) {
611 test_surface = av_buffer_pool_get(hwfc->pool);
613 av_log(hwfc, AV_LOG_ERROR, "Unable to allocate a surface from "
619 test_surface = av_buffer_pool_get(hwfc->internal->pool_internal);
621 av_log(hwfc, AV_LOG_ERROR, "Unable to allocate a surface from "
631 err = vaapi_get_image_format(hwfc->device_ctx,
632 hwfc->sw_format, &expected_format);
637 av_log(hwfc, AV_LOG_DEBUG, "Direct mapping possible.\n");
640 av_log(hwfc, AV_LOG_DEBUG, "Direct mapping disabled: "
647 av_log(hwfc, AV_LOG_DEBUG, "Direct mapping disabled: "
652 av_log(hwfc, AV_LOG_DEBUG, "Direct mapping disabled: "
666 static void vaapi_frames_uninit(AVHWFramesContext *hwfc)
668 AVVAAPIFramesContext *avfc = hwfc->hwctx;
669 VAAPIFramesContext *ctx = hwfc->internal->priv;
675 static int vaapi_get_buffer(AVHWFramesContext *hwfc, AVFrame *frame)
677 frame->buf[0] = av_buffer_pool_get(hwfc->pool);
683 frame->width = hwfc->width;
684 frame->height = hwfc->height;
689 static int vaapi_transfer_get_formats(AVHWFramesContext *hwfc,
693 VAAPIDeviceContext *ctx = hwfc->device_ctx->internal->priv;
699 if (ctx->formats[i].pix_fmt == hwfc->sw_format)
708 pix_fmts[0] = hwfc->sw_format;
714 if (ctx->formats[i].pix_fmt == hwfc->sw_format)
725 static void vaapi_unmap_frame(AVHWFramesContext *hwfc,
728 AVVAAPIDeviceContext *hwctx = hwfc->device_ctx->hwctx;
734 av_log(hwfc, AV_LOG_DEBUG, "Unmap surface %#x.\n", surface_id);
738 av_log(hwfc, AV_LOG_ERROR, "Failed to unmap image from surface "
745 0, 0, hwfc->width, hwfc->height,
746 0, 0, hwfc->width, hwfc->height);
748 av_log(hwfc, AV_LOG_ERROR, "Failed to write image to surface "
755 av_log(hwfc, AV_LOG_ERROR, "Failed to destroy image from surface "
762 static int vaapi_map_frame(AVHWFramesContext *hwfc,
765 AVVAAPIDeviceContext *hwctx = hwfc->device_ctx->hwctx;
766 VAAPIFramesContext *ctx = hwfc->internal->priv;
776 av_log(hwfc, AV_LOG_DEBUG, "Map surface %#x.\n", surface_id);
783 dst->format = hwfc->sw_format;
784 if (dst->format != hwfc->sw_format && (flags & AV_HWFRAME_MAP_DIRECT)) {
789 err = vaapi_get_image_format(hwfc->device_ctx, dst->format, &image_format);
803 av_log(hwfc, AV_LOG_ERROR, "Failed to sync surface "
816 if (ctx->derive_works && dst->format == hwfc->sw_format &&
820 av_log(hwfc, AV_LOG_ERROR, "Failed to derive image from "
827 av_log(hwfc, AV_LOG_ERROR, "Derive image of surface %#x "
836 hwfc->width, hwfc->height, &map->image);
838 av_log(hwfc, AV_LOG_ERROR, "Failed to create image for "
846 hwfc->width, hwfc->height, map->image.image_id);
848 av_log(hwfc, AV_LOG_ERROR, "Failed to read image from "
859 av_log(hwfc, AV_LOG_ERROR, "Failed to map image from surface "
897 static int vaapi_transfer_data_from(AVHWFramesContext *hwfc,
903 if (dst->width > hwfc->width || dst->height > hwfc->height)
911 err = vaapi_map_frame(hwfc, map, src, AV_HWFRAME_MAP_READ);
928 static int vaapi_transfer_data_to(AVHWFramesContext *hwfc,
934 if (src->width > hwfc->width || src->height > hwfc->height)
942 err = vaapi_map_frame(hwfc, map, dst, AV_HWFRAME_MAP_WRITE | AV_HWFRAME_MAP_OVERWRITE);
959 static int vaapi_map_to_memory(AVHWFramesContext *hwfc, AVFrame *dst,
965 err = vaapi_get_image_format(hwfc->device_ctx, dst->format, NULL);
970 err = vaapi_map_frame(hwfc, dst, src, flags);
1265 static void vaapi_unmap_to_drm_esh(AVHWFramesContext *hwfc,
1277 static int vaapi_map_to_drm_esh(AVHWFramesContext *hwfc, AVFrame *dst,
1280 AVVAAPIDeviceContext *hwctx = hwfc->device_ctx->hwctx;
1302 av_log(hwfc, AV_LOG_ERROR, "Failed to export surface %#x: "
1362 static void vaapi_unmap_to_drm_abh(AVHWFramesContext *hwfc,
1365 AVVAAPIDeviceContext *hwctx = hwfc->device_ctx->hwctx;
1371 av_log(hwfc, AV_LOG_DEBUG, "Unmap VAAPI surface %#x from DRM.\n",
1379 av_log(hwfc, AV_LOG_ERROR, "Failed to release buffer "
1387 av_log(hwfc, AV_LOG_ERROR, "Failed to destroy image "
1395 static int vaapi_map_to_drm_abh(AVHWFramesContext *hwfc, AVFrame *dst,
1398 AVVAAPIDeviceContext *hwctx = hwfc->device_ctx->hwctx;
1405 av_log(hwfc, AV_LOG_DEBUG, "Map VAAPI surface %#x to DRM.\n",
1415 av_log(hwfc, AV_LOG_ERROR, "Failed to derive image from "
1428 av_log(hwfc, AV_LOG_ERROR, "No matching DRM format for "
1441 av_log(hwfc, AV_LOG_ERROR, "Image properties do not match "
1475 av_log(hwfc, AV_LOG_ERROR, "Failed to get buffer "
1483 av_log(hwfc, AV_LOG_DEBUG, "DRM PRIME fd is %ld.\n",
1516 static int vaapi_map_to_drm(AVHWFramesContext *hwfc, AVFrame *dst,
1521 err = vaapi_map_to_drm_esh(hwfc, dst, src, flags);
1526 return vaapi_map_to_drm_abh(hwfc, dst, src, flags);
1533 static int vaapi_map_to(AVHWFramesContext *hwfc, AVFrame *dst,
1539 return vaapi_map_from_drm(hwfc, dst, src, flags);
1546 static int vaapi_map_from(AVHWFramesContext *hwfc, AVFrame *dst,
1552 return vaapi_map_to_drm(hwfc, dst, src, flags);
1555 return vaapi_map_to_memory(hwfc, dst, src, flags);