plugins: direct rendering on memory:VASurface

As buffers negotiated with memory:VASurface caps feature can also be
mapped, they can also be configured to use VA derived images, in other
words "direct rendering".

Also, because of the changes in dmabuf allocator as default allocator,
the code for configuring the direct rendering was not clear.

This patch cleans up the code and enables direct rendering when the
environment variable GST_VAAPI_ENABLE_DIRECT_RENDERING is defined,
even then the memory:VASurface cap feature is negotiated.

https://bugzilla.gnome.org/show_bug.cgi?id=786054
This commit is contained in:
Víctor Manuel Jáquez Leal 2017-10-31 13:10:50 +01:00
parent 0a36a707ba
commit 72362e1063

View file

@ -600,8 +600,6 @@ ensure_srcpad_allocator (GstVaapiPluginBase * plugin, GstVideoInfo * vinfo,
{
gboolean different_caps;
const GstVideoInfo *image_info;
GstVaapiImageUsageFlags usage_flag =
GST_VAAPI_IMAGE_USAGE_FLAG_NATIVE_FORMATS;
if (!reset_allocator (plugin->srcpad_allocator, vinfo))
goto valid_allocator;
@ -610,10 +608,6 @@ ensure_srcpad_allocator (GstVaapiPluginBase * plugin, GstVideoInfo * vinfo,
if (caps && gst_caps_is_video_raw (caps)) {
GstAllocator *allocator = create_dmabuf_srcpad_allocator (plugin, vinfo,
!plugin->srcpad_can_dmabuf);
if (!allocator && plugin->enable_direct_rendering) {
usage_flag = GST_VAAPI_IMAGE_USAGE_FLAG_DIRECT_RENDER;
GST_INFO_OBJECT (plugin, "enabling direct rendering in source allocator");
}
plugin->srcpad_allocator = allocator;
} else if (caps && gst_vaapi_caps_feature_contains (caps,
GST_VAAPI_CAPS_FEATURE_DMABUF)) {
@ -624,6 +618,14 @@ ensure_srcpad_allocator (GstVaapiPluginBase * plugin, GstVideoInfo * vinfo,
}
if (!plugin->srcpad_allocator) {
GstVaapiImageUsageFlags usage_flag =
GST_VAAPI_IMAGE_USAGE_FLAG_NATIVE_FORMATS;
if (plugin->enable_direct_rendering) {
usage_flag = GST_VAAPI_IMAGE_USAGE_FLAG_DIRECT_RENDER;
GST_INFO_OBJECT (plugin, "enabling direct rendering in source allocator");
}
plugin->srcpad_allocator =
gst_vaapi_video_allocator_new (plugin->display, vinfo, 0, usage_flag);
}