plugins: expose I420 format for interop with SW elements.
authorGwenole Beauchesne <gwenole.beauchesne@intel.com>
Wed, 23 Jul 2014 08:23:06 +0000 (10:23 +0200)
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>
Wed, 23 Jul 2014 14:25:08 +0000 (16:25 +0200)
Always expose I420 format by default when the VA surface could be
mapped for interoperability with non harware accelerated elements.
However, the default behaviour remains the auto-plugging of vaapi
elements, down to the sink.

Side effect: "direct-rendering" mode is also disabled most of the
times as plain memcpy() from uncached speculative write combining
memory is not going to be efficient enough.

gst/vaapi/gstvaapidecode.c
gst/vaapi/gstvaapipluginutil.c
gst/vaapi/gstvaapivideomemory.c

index 1e94561..848290f 100644 (file)
@@ -77,10 +77,10 @@ static const char gst_vaapidecode_sink_caps_str[] =
 static const char gst_vaapidecode_src_caps_str[] =
 #if GST_CHECK_VERSION(1,1,0)
     GST_VIDEO_CAPS_MAKE_WITH_FEATURES(
-        GST_CAPS_FEATURE_MEMORY_VAAPI_SURFACE, "{ ENCODED, NV12, I420, YV12 }") ";"
+        GST_CAPS_FEATURE_MEMORY_VAAPI_SURFACE, "{ ENCODED, I420, YV12, NV12 }") ";"
     GST_VIDEO_CAPS_MAKE_WITH_FEATURES(
         GST_CAPS_FEATURE_META_GST_VIDEO_GL_TEXTURE_UPLOAD_META, "RGBA") ";"
-    GST_VIDEO_CAPS_MAKE("{ NV12, I420, YV12 }");
+    GST_VIDEO_CAPS_MAKE("{ I420, YV12, NV12 }");
 #else
     GST_VAAPI_SURFACE_CAPS;
 #endif
@@ -176,15 +176,7 @@ gst_vaapidecode_update_src_caps(GstVaapiDecode *decode,
     vi = &state->info;
     out_format = format;
     if (format == GST_VIDEO_FORMAT_ENCODED) {
-#if GST_CHECK_VERSION(1,1,0)
-        out_format = GST_VIDEO_FORMAT_NV12;
-        if (feature == GST_VAAPI_CAPS_FEATURE_SYSTEM_MEMORY) {
-            /* XXX: intercept with the preferred output format.
-               Anyway, I420 is the minimum format that drivers
-               should support to be useful */
-            out_format = GST_VIDEO_FORMAT_I420;
-        }
-#endif
+        out_format = GST_VIDEO_FORMAT_I420;
         gst_video_info_init(&vis);
         gst_video_info_set_format(&vis, out_format,
             GST_VIDEO_INFO_WIDTH(vi), GST_VIDEO_INFO_HEIGHT(vi));
@@ -571,7 +563,7 @@ gst_vaapidecode_decide_allocation(GstVideoDecoder *vdec, GstQuery *query)
     gst_video_info_init(&vi);
     gst_video_info_from_caps(&vi, caps);
     if (GST_VIDEO_INFO_FORMAT(&vi) == GST_VIDEO_FORMAT_ENCODED)
-        gst_video_info_set_format(&vi, GST_VIDEO_FORMAT_NV12,
+        gst_video_info_set_format(&vi, GST_VIDEO_FORMAT_I420,
             GST_VIDEO_INFO_WIDTH(&vi), GST_VIDEO_INFO_HEIGHT(&vi));
 
     g_return_val_if_fail(GST_VAAPI_PLUGIN_BASE_DISPLAY(decode) != NULL, FALSE);
index b53e359..fe84771 100644 (file)
@@ -521,7 +521,7 @@ gst_vaapi_find_preferred_caps_feature (GstPad * pad, GstVideoFormat format)
     goto cleanup;
 
   if (format == GST_VIDEO_FORMAT_ENCODED)
-    format = GST_VIDEO_FORMAT_NV12;
+    format = GST_VIDEO_FORMAT_I420;
 
   vaapi_caps =
       gst_vaapi_video_format_new_template_caps_with_features (format,
index 38049b0..b3f702a 100644 (file)
@@ -540,7 +540,7 @@ gst_vaapi_video_allocator_new(GstVaapiDisplay *display, const GstVideoInfo *vip)
 
     allocator->image_info = *vip;
     if (GST_VIDEO_INFO_FORMAT(vip) == GST_VIDEO_FORMAT_ENCODED)
-        gst_video_info_set_format(&allocator->image_info, GST_VIDEO_FORMAT_NV12,
+        gst_video_info_set_format(&allocator->image_info, GST_VIDEO_FORMAT_I420,
             GST_VIDEO_INFO_WIDTH(vip), GST_VIDEO_INFO_HEIGHT(vip));
 
     if (allocator->has_direct_rendering)