Add surfaceId variable to VASurface

Related-To: NEO-6693

Currently if clCreateFromVA and clEnqueueAcquireVA
are called from different scopes (i.e. surfaceID
passed to clCreate is destroyed when called
clEnqueueAcquired) enqueue results in undefined
behaviour. This PR fixes that.

Signed-off-by: Szymon Morek <szymon.morek@intel.com>
This commit is contained in:
Szymon Morek
2022-02-24 15:25:03 +00:00
committed by Compute-Runtime-Automation
parent 43b17a69f0
commit 107db3a372
4 changed files with 17 additions and 9 deletions

View File

@@ -156,15 +156,15 @@ Image *VASurface::createSharedVaSurface(Context *context, VASharingFunctions *sh
void VASurface::synchronizeObject(UpdateData &updateData) {
updateData.synchronizationStatus = SynchronizeStatus::ACQUIRE_SUCCESFUL;
if (!interopUserSync) {
if (sharingFunctions->syncSurface(*surfaceId) != VA_STATUS_SUCCESS) {
if (sharingFunctions->syncSurface(surfaceId) != VA_STATUS_SUCCESS) {
updateData.synchronizationStatus = SYNCHRONIZE_ERROR;
}
}
}
void VASurface::getMemObjectInfo(size_t &paramValueSize, void *&paramValue) {
paramValueSize = sizeof(surfaceId);
paramValue = &surfaceId;
paramValueSize = sizeof(surfaceIdPtr);
paramValue = &surfaceIdPtr;
}
bool VASurface::validate(cl_mem_flags flags, cl_uint plane) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
* Copyright (C) 2018-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -31,10 +31,13 @@ class VASurface : VASharing {
protected:
VASurface(VASharingFunctions *sharingFunctions, VAImageID imageId,
cl_uint plane, VASurfaceID *surfaceId, bool interopUserSync)
: VASharing(sharingFunctions, imageId), plane(plane), surfaceId(surfaceId), interopUserSync(interopUserSync){};
: VASharing(sharingFunctions, imageId), plane(plane), surfaceId(*surfaceId), interopUserSync(interopUserSync) {
surfaceIdPtr = &this->surfaceId;
};
cl_uint plane;
VASurfaceID *surfaceId;
VASurfaceID surfaceId;
VASurfaceID *surfaceIdPtr;
bool interopUserSync;
};
} // namespace NEO