]> git.sesse.net Git - ffmpeg/blobdiff - libavutil/hwcontext_qsv.c
pthread_frame: make sure ff_thread_release_buffer always cleans the frame
[ffmpeg] / libavutil / hwcontext_qsv.c
index 8f9838d7d819b64db7e5251988a6c77d871451ef..b1b67400de7e670dc608f0e2c929d021ad130e59 100644 (file)
@@ -892,8 +892,7 @@ static int qsv_transfer_data_to(AVHWFramesContext *ctx, AVFrame *dst,
     if (ret < 0)
         return ret;
 
-
-    if (src->height & 16 || src->linesize[0] & 16) {
+    if (src->height & 15 || src->linesize[0] & 15) {
         realigned = 1;
         memset(&tmp_frame, 0, sizeof(tmp_frame));
         tmp_frame.format         = src->format;
@@ -1181,11 +1180,6 @@ static int qsv_device_derive_from_child(AVHWDeviceContext *ctx,
         goto fail;
     }
 
-    ret = MFXQueryVersion(hwctx->session,&ver);
-    if (ret == MFX_ERR_NONE) {
-        av_log(ctx, AV_LOG_VERBOSE, "MFX compile/runtime API: %d.%d/%d.%d\n",
-               MFX_VERSION_MAJOR, MFX_VERSION_MINOR, ver.Major, ver.Minor);
-    }
     return 0;
 
 fail:
@@ -1207,6 +1201,7 @@ static int qsv_device_create(AVHWDeviceContext *ctx, const char *device,
     QSVDevicePriv *priv;
     enum AVHWDeviceType child_device_type;
     AVHWDeviceContext *child_device;
+    AVDictionary *child_device_opts;
     AVDictionaryEntry *e;
 
     mfxIMPL impl;
@@ -1221,9 +1216,17 @@ static int qsv_device_create(AVHWDeviceContext *ctx, const char *device,
 
     e = av_dict_get(opts, "child_device", NULL, 0);
 
-    if (CONFIG_VAAPI)
+    child_device_opts = NULL;
+    if (CONFIG_VAAPI) {
         child_device_type = AV_HWDEVICE_TYPE_VAAPI;
-    else if (CONFIG_DXVA2)
+        // libmfx does not actually implement VAAPI properly, rather it
+        // depends on the specific behaviour of a matching iHD driver when
+        // used on recent Intel hardware.  Set options to the VAAPI device
+        // creation so that we should pick a usable setup by default if
+        // possible, even when multiple devices and drivers are available.
+        av_dict_set(&child_device_opts, "kernel_driver", "i915", 0);
+        av_dict_set(&child_device_opts, "driver",        "iHD",  0);
+    } else if (CONFIG_DXVA2)
         child_device_type = AV_HWDEVICE_TYPE_DXVA2;
     else {
         av_log(ctx, AV_LOG_ERROR, "No supported child device type is enabled\n");
@@ -1231,7 +1234,9 @@ static int qsv_device_create(AVHWDeviceContext *ctx, const char *device,
     }
 
     ret = av_hwdevice_ctx_create(&priv->child_device_ctx, child_device_type,
-                                 e ? e->value : NULL, NULL, 0);
+                                 e ? e->value : NULL, child_device_opts, 0);
+
+    av_dict_free(&child_device_opts);
     if (ret < 0)
         return ret;