mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-06 10:26:29 +08:00
Add synchronization for VA sharing in multi-thread scenarios
Signed-off-by: Slawomir Milczarek <slawomir.milczarek@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
07b651ccb8
commit
0f2683074d
@@ -10,6 +10,7 @@
|
||||
#include "opencl/source/sharings/va/va_sharing_defines.h"
|
||||
|
||||
#include <functional>
|
||||
#include <mutex>
|
||||
#include <vector>
|
||||
|
||||
namespace NEO {
|
||||
@@ -82,6 +83,8 @@ class VASharingFunctions : public SharingFunctions {
|
||||
|
||||
static bool isVaLibraryAvailable();
|
||||
|
||||
std::mutex mutex;
|
||||
|
||||
protected:
|
||||
void *libHandle = nullptr;
|
||||
VADisplay vaDisplay = nullptr;
|
||||
|
||||
@@ -41,6 +41,8 @@ Image *VASurface::createSharedVaSurface(Context *context, VASharingFunctions *sh
|
||||
size_t imageOffset = 0;
|
||||
size_t imagePitch = 0;
|
||||
|
||||
std::unique_lock<std::mutex> lock(sharingFunctions->mutex);
|
||||
|
||||
vaStatus = sharingFunctions->exportSurfaceHandle(*surface,
|
||||
VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_2,
|
||||
VA_EXPORT_SURFACE_READ_WRITE | VA_EXPORT_SURFACE_SEPARATE_LAYERS,
|
||||
@@ -118,6 +120,8 @@ Image *VASurface::createSharedVaSurface(Context *context, VASharingFunctions *sh
|
||||
|
||||
memoryManager->closeSharedHandle(sharedHandle);
|
||||
|
||||
lock.unlock();
|
||||
|
||||
imgDesc.image_row_pitch = imgInfo.rowPitch;
|
||||
imgDesc.image_slice_pitch = 0u;
|
||||
imgInfo.slicePitch = 0u;
|
||||
|
||||
Reference in New Issue
Block a user