plugins: enable memory maps for read & write with direct-rendering.

Enable read and write mappings only if direct-rendering is supported.
Otherwise, this means that we may need to download data from the VA
surface first for correctness, even if the VA surface doesn't need to
be read at all. i.e. sometimes, READWRITE mappings are meant for
surfaces that are written to first, and read afterwards for further
processing.

https://bugzilla.gnome.org/show_bug.cgi?id=704078
This commit is contained in:
Gwenole Beauchesne 2013-10-09 10:33:55 +02:00
parent 847e3efb4d
commit 77b2d88452

View file

@ -132,8 +132,6 @@ gst_video_meta_map_vaapi_memory(GstVideoMeta *meta, guint plane,
if (mem->map_type &&
mem->map_type != GST_VAAPI_VIDEO_MEMORY_MAP_TYPE_PLANAR)
goto error_incompatible_map;
if ((flags & GST_MAP_READWRITE) != GST_MAP_WRITE)
goto error_unsupported_map;
/* Map for writing */
if (++mem->map_count == 1) {
@ -141,6 +139,12 @@ gst_video_meta_map_vaapi_memory(GstVideoMeta *meta, guint plane,
goto error_ensure_surface;
if (!ensure_image(mem))
goto error_ensure_image;
// Check that we can actually map the surface, or image
if ((flags & GST_MAP_READWRITE) != GST_MAP_WRITE &&
!mem->use_direct_rendering)
goto error_unsupported_map;
if (!gst_vaapi_image_map(mem->image))
goto error_map_image;
mem->map_type = GST_VAAPI_VIDEO_MEMORY_MAP_TYPE_PLANAR;