aboutsummaryrefslogtreecommitdiffstats
path: root/libavutil/hwcontext_vaapi.c
diff options
context:
space:
mode:
authorMark Thompson <sw@jkqxz.net>2017-10-15 12:45:15 +0100
committerMark Thompson <sw@jkqxz.net>2017-10-15 12:45:15 +0100
commit01e291a592452f27b3a4e811536aaaf94096e244 (patch)
tree02a0d689e78e228c06c51b2bb88e9153a9760335 /libavutil/hwcontext_vaapi.c
parent03351cce88434f9a4ef3c7cc29e2bc5449c4646e (diff)
downloadffmpeg-3a44fe99b874b0d2f1c6b6def88efd02acbb80e2.tar.gz
hwcontext_vaapi: Remove use of vaExportSurfaceHandle()n3.4
It is not present in libva 2.0.
Diffstat (limited to 'libavutil/hwcontext_vaapi.c')
-rw-r--r--libavutil/hwcontext_vaapi.c69
1 files changed, 0 insertions, 69 deletions
diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c
index 40a85d288c..cc961f12f8 100644
--- a/libavutil/hwcontext_vaapi.c
+++ b/libavutil/hwcontext_vaapi.c
@@ -1076,80 +1076,11 @@ static void vaapi_unmap_to_drm(AVHWFramesContext *dst_fc,
static int vaapi_map_to_drm(AVHWFramesContext *hwfc, AVFrame *dst,
const AVFrame *src, int flags)
{
-#if CONFIG_VAAPI_1
- AVVAAPIDeviceContext *hwctx = hwfc->device_ctx->hwctx;
- VASurfaceID surface_id;
- VAStatus vas;
- VADRMPRIMESurfaceDescriptor va_desc;
- AVDRMFrameDescriptor *drm_desc = NULL;
- int err, i, j;
-
- surface_id = (VASurfaceID)(uintptr_t)src->data[3];
-
- vas = vaExportSurfaceHandle(hwctx->display, surface_id,
- VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_2,
- VA_EXPORT_SURFACE_READ_ONLY |
- VA_EXPORT_SURFACE_SEPARATE_LAYERS,
- &va_desc);
- if (vas != VA_STATUS_SUCCESS) {
- if (vas == VA_STATUS_ERROR_UNIMPLEMENTED)
- return AVERROR(ENOSYS);
- av_log(hwfc, AV_LOG_ERROR, "Failed to export surface %#x: "
- "%d (%s).\n", surface_id, vas, vaErrorStr(vas));
- return AVERROR(EIO);
- }
-
- drm_desc = av_mallocz(sizeof(*drm_desc));
- if (!drm_desc) {
- err = AVERROR(ENOMEM);
- goto fail;
- }
-
- // By some bizarre coincidence, these structures are very similar...
- drm_desc->nb_objects = va_desc.num_objects;
- for (i = 0; i < va_desc.num_objects; i++) {
- drm_desc->objects[i].fd = va_desc.objects[i].fd;
- drm_desc->objects[i].size = va_desc.objects[i].size;
- drm_desc->objects[i].format_modifier =
- va_desc.objects[i].drm_format_modifier;
- }
- drm_desc->nb_layers = va_desc.num_layers;
- for (i = 0; i < va_desc.num_layers; i++) {
- drm_desc->layers[i].format = va_desc.layers[i].drm_format;
- drm_desc->layers[i].nb_planes = va_desc.layers[i].num_planes;
- for (j = 0; j < va_desc.layers[i].num_planes; j++) {
- drm_desc->layers[i].planes[j].object_index =
- va_desc.layers[i].object_index[j];
- drm_desc->layers[i].planes[j].offset =
- va_desc.layers[i].offset[j];
- drm_desc->layers[i].planes[j].pitch =
- va_desc.layers[i].pitch[j];
- }
- }
-
- err = ff_hwframe_map_create(src->hw_frames_ctx, dst, src,
- &vaapi_unmap_to_drm, drm_desc);
- if (err < 0)
- goto fail;
-
- dst->width = src->width;
- dst->height = src->height;
- dst->data[0] = (uint8_t*)drm_desc;
-
- return 0;
-
-fail:
- for (i = 0; i < va_desc.num_objects; i++)
- close(va_desc.objects[i].fd);
- av_freep(&drm_desc);
- return err;
-#else
// Older versions without vaExportSurfaceHandle() are not supported -
// in theory this is possible with a combination of vaDeriveImage()
// and vaAcquireBufferHandle(), but it doesn't carry enough metadata
// to actually use the result in a generic way.
return AVERROR(ENOSYS);
-#endif
}
#endif