Unified · Split
| @@ -442,19 +442,20 @@ err: · 441 unmodified lines | |||
| 442 | 442 | ||
| 443 | static bool try_format_upload(void *priv, enum mp_imgfmt src_fmt, enum mp_imgfmt dst_fmt) | 443 | static bool try_format_upload(void *priv, enum mp_imgfmt src_fmt, enum mp_imgfmt dst_fmt) |
| 444 | { | 444 | { |
| 445 | struct priv_owner *p = priv; | ||
| 446 | |||
| 447 | if (IMGFMT_IS_HWACCEL(src_fmt)) | 445 | if (IMGFMT_IS_HWACCEL(src_fmt)) |
| 448 | return true; | 446 | return true; |
| 449 | 447 | ||
| 450 | bool ret = false; | 448 | bool ret = false; |
| 449 | struct mp_image *src = NULL; | ||
| 450 | struct mp_image *dst = NULL; | ||
| 451 | AVBufferRef *hw_pool = NULL; | ||
| 452 | VADRMPRIMESurfaceDescriptor desc = {0}; | ||
| 451 | 453 | ||
| 452 | struct mp_image *src = mp_image_alloc(src_fmt, 16, 16); | 454 | if (!(src = mp_image_alloc(src_fmt, 16, 16))) |
| 453 | if (!src) | ||
| 454 | goto end; | 455 | goto end; |
| 455 | 456 | ||
| 456 | AVBufferRef *hw_pool = av_hwframe_ctx_alloc(p->ctx->av_device_ref); | 457 | struct priv_owner *p = priv; |
| 457 | if (!hw_pool) | 458 | if (!(hw_pool = av_hwframe_ctx_alloc(p->ctx->av_device_ref))) |
| 458 | goto end; | 459 | goto end; |
| 459 | 460 | ||
| 460 | if (!mp_update_av_hw_frames_pool(&hw_pool, p->ctx->av_device_ref, IMGFMT_VAAPI, | 461 | if (!mp_update_av_hw_frames_pool(&hw_pool, p->ctx->av_device_ref, IMGFMT_VAAPI, |
| @@ -463,17 +464,13 @@ static bool try_format_upload(void *priv, enum mp_imgfmt src_fmt, enum mp_imgfmt · 2 unmodified lines | |||
| 463 | goto end; | 464 | goto end; |
| 464 | } | 465 | } |
| 465 | 466 | ||
| 466 | struct mp_image *dst = mp_av_pool_image_hw_upload(hw_pool, src); | 467 | if (!(dst = mp_av_pool_image_hw_upload(hw_pool, src))) |
| 467 | if (!dst) | ||
| 468 | goto end; | 468 | goto end; |
| 469 | 469 | ||
| 470 | VADisplay *display = p->display; | ||
| 471 | VADRMPRIMESurfaceDescriptor desc = {0}; | ||
| 472 | VASurfaceID id = va_surface_id(dst); | ||
| 473 | |||
| 474 | uint32_t flags = p->dmabuf_interop.composed_layers ? | 470 | uint32_t flags = p->dmabuf_interop.composed_layers ? |
| 475 | VA_EXPORT_SURFACE_COMPOSED_LAYERS : VA_EXPORT_SURFACE_SEPARATE_LAYERS; | 471 | VA_EXPORT_SURFACE_COMPOSED_LAYERS : VA_EXPORT_SURFACE_SEPARATE_LAYERS; |
| 476 | VAStatus status = vaExportSurfaceHandle(display, id, VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_2, | 472 | VAStatus status = vaExportSurfaceHandle(p->display, va_surface_id(dst), |
| 473 | VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_2, | ||
| 477 | flags | VA_EXPORT_SURFACE_READ_ONLY, &desc); | 474 | flags | VA_EXPORT_SURFACE_READ_ONLY, &desc); |
| 478 | 475 | ||
| 479 | if (status != VA_STATUS_SUCCESS) | 476 | if (status != VA_STATUS_SUCCESS) |