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:
Szymon Morek 2022-02-24 15:41:49 +00:00 committed by Compute-Runtime-Automation
parent ca7d47598a
commit 205571999e
3 changed files with 19 additions and 7 deletions

View File

@ -154,10 +154,12 @@ Image *VASurface::createSharedVaSurface(Context *context, VASharingFunctions *sh
}
void VASurface::synchronizeObject(UpdateData &updateData) {
if (!interopUserSync) {
sharingFunctions->syncSurface(*surfaceId);
}
updateData.synchronizationStatus = SynchronizeStatus::ACQUIRE_SUCCESFUL;
if (!interopUserSync) {
if (sharingFunctions->syncSurface(*surfaceId) != VA_STATUS_SUCCESS) {
updateData.synchronizationStatus = SYNCHRONIZE_ERROR;
}
}
}
void VASurface::getMemObjectInfo(size_t &paramValueSize, void *&paramValue) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
* Copyright (C) 2018-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -27,6 +27,7 @@ class VASharingFunctionsMock : public VASharingFunctions {
uint16_t derivedImageHeight = 256;
uint16_t derivedImageWidth = 256;
VAStatus queryImageFormatsReturnStatus = VA_STATUS_SUCCESS;
VAStatus syncSurfaceReturnStatus = VA_STATUS_SUCCESS;
bool isValidDisplayCalled = false;
bool deriveImageCalled = false;
@ -109,7 +110,7 @@ class VASharingFunctionsMock : public VASharingFunctions {
VAStatus syncSurface(VASurfaceID vaSurface) override {
syncSurfaceCalled = true;
return VA_STATUS_SUCCESS;
return syncSurfaceReturnStatus;
}
VAStatus queryImageFormats(VADisplay vaDisplay, VAImageFormat *formatList, int *numFormats) override {

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
* Copyright (C) 2018-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -513,8 +513,9 @@ TEST_F(VaSharingTests, givenNonInteropUserSyncContextWhenAcquireIsCalledThenSync
auto memObj = castToObject<MemObj>(sharedClMem);
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_EQ(CL_SUCCESS, ret);
}
TEST_F(VaSharingTests, givenInteropUserSyncContextWhenAcquireIsCalledThenDontSyncSurface) {
@ -527,6 +528,14 @@ TEST_F(VaSharingTests, givenInteropUserSyncContextWhenAcquireIsCalledThenDontSyn
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) {
cl_uint planeTypes[] = {
0, //Y