msdk: allocator: libva: check if it's already using dmabuf when mapping
authorHyunjun Ko <zzoon@igalia.com>
Mon, 2 Apr 2018 23:49:32 +0000 (15:49 -0800)
committerSreerenj Balachandran <sreerenj.balachandran@intel.com>
Mon, 2 Apr 2018 23:49:32 +0000 (15:49 -0800)
As long as we negotiate the "DMABuf" capsfeatures for now, map can't be
working. So we need to confirm not to do it if using DMABuf memory.

https://bugzilla.gnome.org/show_bug.cgi?id=793707

sys/msdk/gstmsdkallocator_libva.c

index 275e01b..63d81b2 100644 (file)
@@ -239,6 +239,11 @@ gst_msdk_frame_lock (mfxHDL pthis, mfxMemId mid, mfxFrameData * data)
   va_surface = mem_id->surface;
   dpy = gst_msdk_context_get_handle (context);
 
+  if (mem_id->info.mem_type == VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME) {
+    GST_WARNING ("Couldn't map the buffer since dmabuf is already in use");
+    return MFX_ERR_LOCK_MEMORY;
+  }
+
   if (mem_id->fourcc != MFX_FOURCC_P8) {
     va_status = vaDeriveImage (dpy, *va_surface, &mem_id->image);
     status = gst_msdk_get_mfx_status_from_va_status (va_status);