Propagate VA syncSurface failure to API call
Currently, if syncSurface method fails, driver will result in CL_SUCCESS. This PR fixes that. Signed-off-by: Szymon Morek <szymon.morek@intel.com>
This commit is contained in:
parent
ca7d47598a
commit
205571999e
|
@ -154,10 +154,12 @@ Image *VASurface::createSharedVaSurface(Context *context, VASharingFunctions *sh
|
||||||
}
|
}
|
||||||
|
|
||||||
void VASurface::synchronizeObject(UpdateData &updateData) {
|
void VASurface::synchronizeObject(UpdateData &updateData) {
|
||||||
if (!interopUserSync) {
|
|
||||||
sharingFunctions->syncSurface(*surfaceId);
|
|
||||||
}
|
|
||||||
updateData.synchronizationStatus = SynchronizeStatus::ACQUIRE_SUCCESFUL;
|
updateData.synchronizationStatus = SynchronizeStatus::ACQUIRE_SUCCESFUL;
|
||||||
|
if (!interopUserSync) {
|
||||||
|
if (sharingFunctions->syncSurface(*surfaceId) != VA_STATUS_SUCCESS) {
|
||||||
|
updateData.synchronizationStatus = SYNCHRONIZE_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void VASurface::getMemObjectInfo(size_t ¶mValueSize, void *¶mValue) {
|
void VASurface::getMemObjectInfo(size_t ¶mValueSize, void *¶mValue) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2018-2021 Intel Corporation
|
* Copyright (C) 2018-2022 Intel Corporation
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*
|
*
|
||||||
|
@ -27,6 +27,7 @@ class VASharingFunctionsMock : public VASharingFunctions {
|
||||||
uint16_t derivedImageHeight = 256;
|
uint16_t derivedImageHeight = 256;
|
||||||
uint16_t derivedImageWidth = 256;
|
uint16_t derivedImageWidth = 256;
|
||||||
VAStatus queryImageFormatsReturnStatus = VA_STATUS_SUCCESS;
|
VAStatus queryImageFormatsReturnStatus = VA_STATUS_SUCCESS;
|
||||||
|
VAStatus syncSurfaceReturnStatus = VA_STATUS_SUCCESS;
|
||||||
|
|
||||||
bool isValidDisplayCalled = false;
|
bool isValidDisplayCalled = false;
|
||||||
bool deriveImageCalled = false;
|
bool deriveImageCalled = false;
|
||||||
|
@ -109,7 +110,7 @@ class VASharingFunctionsMock : public VASharingFunctions {
|
||||||
|
|
||||||
VAStatus syncSurface(VASurfaceID vaSurface) override {
|
VAStatus syncSurface(VASurfaceID vaSurface) override {
|
||||||
syncSurfaceCalled = true;
|
syncSurfaceCalled = true;
|
||||||
return VA_STATUS_SUCCESS;
|
return syncSurfaceReturnStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
VAStatus queryImageFormats(VADisplay vaDisplay, VAImageFormat *formatList, int *numFormats) override {
|
VAStatus queryImageFormats(VADisplay vaDisplay, VAImageFormat *formatList, int *numFormats) override {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2018-2021 Intel Corporation
|
* Copyright (C) 2018-2022 Intel Corporation
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*
|
*
|
||||||
|
@ -513,8 +513,9 @@ TEST_F(VaSharingTests, givenNonInteropUserSyncContextWhenAcquireIsCalledThenSync
|
||||||
auto memObj = castToObject<MemObj>(sharedClMem);
|
auto memObj = castToObject<MemObj>(sharedClMem);
|
||||||
|
|
||||||
EXPECT_FALSE(vaSharing->sharingFunctions.syncSurfaceCalled);
|
EXPECT_FALSE(vaSharing->sharingFunctions.syncSurfaceCalled);
|
||||||
memObj->peekSharingHandler()->acquire(sharedImg, context.getDevice(0)->getRootDeviceIndex());
|
auto ret = memObj->peekSharingHandler()->acquire(sharedImg, context.getDevice(0)->getRootDeviceIndex());
|
||||||
EXPECT_TRUE(vaSharing->sharingFunctions.syncSurfaceCalled);
|
EXPECT_TRUE(vaSharing->sharingFunctions.syncSurfaceCalled);
|
||||||
|
EXPECT_EQ(CL_SUCCESS, ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(VaSharingTests, givenInteropUserSyncContextWhenAcquireIsCalledThenDontSyncSurface) {
|
TEST_F(VaSharingTests, givenInteropUserSyncContextWhenAcquireIsCalledThenDontSyncSurface) {
|
||||||
|
@ -527,6 +528,14 @@ TEST_F(VaSharingTests, givenInteropUserSyncContextWhenAcquireIsCalledThenDontSyn
|
||||||
EXPECT_FALSE(vaSharing->sharingFunctions.syncSurfaceCalled);
|
EXPECT_FALSE(vaSharing->sharingFunctions.syncSurfaceCalled);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F(VaSharingTests, whenSyncSurfaceFailedThenReturnOutOfResource) {
|
||||||
|
vaSharing->sharingFunctions.syncSurfaceReturnStatus = VA_STATUS_ERROR_INVALID_SURFACE;
|
||||||
|
createMediaSurface();
|
||||||
|
|
||||||
|
auto ret = sharedImg->peekSharingHandler()->acquire(sharedImg, context.getDevice(0)->getRootDeviceIndex());
|
||||||
|
EXPECT_EQ(CL_OUT_OF_RESOURCES, ret);
|
||||||
|
}
|
||||||
|
|
||||||
TEST_F(VaSharingTests, givenYuvPlaneWhenCreateIsCalledThenChangeWidthAndHeight) {
|
TEST_F(VaSharingTests, givenYuvPlaneWhenCreateIsCalledThenChangeWidthAndHeight) {
|
||||||
cl_uint planeTypes[] = {
|
cl_uint planeTypes[] = {
|
||||||
0, //Y
|
0, //Y
|
||||||
|
|
Loading…
Reference in New Issue