mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Revert "Modifications to cl_intel_va_api_media_sharing"
This reverts commit 4c27d46de3
.
Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:

committed by
Compute-Runtime-Automation

parent
4c27d46de3
commit
ccf9d72019
@ -17,8 +17,7 @@ namespace NEO {
|
||||
|
||||
class VASharingFunctionsMock : public VASharingFunctions {
|
||||
public:
|
||||
using VASharingFunctions::supported2PlaneFormats;
|
||||
using VASharingFunctions::supported3PlaneFormats;
|
||||
using VASharingFunctions::supportedFormats;
|
||||
|
||||
VAImage mockVaImage = {};
|
||||
int32_t derivedImageFormatFourCC = VA_FOURCC_NV12;
|
||||
@ -116,7 +115,7 @@ class VASharingFunctionsMock : public VASharingFunctions {
|
||||
return queryImageFormatsReturnStatus;
|
||||
}
|
||||
if (numFormats) {
|
||||
*numFormats = 4;
|
||||
*numFormats = 2;
|
||||
}
|
||||
|
||||
if (formatList) {
|
||||
@ -125,22 +124,14 @@ class VASharingFunctionsMock : public VASharingFunctions {
|
||||
formatList[0].byte_order = VA_LSB_FIRST;
|
||||
|
||||
formatList[1].fourcc = VA_FOURCC_P010;
|
||||
formatList[1].bits_per_pixel = 10;
|
||||
formatList[1].bits_per_pixel = 24;
|
||||
formatList[1].byte_order = VA_LSB_FIRST;
|
||||
|
||||
formatList[2].fourcc = VA_FOURCC_P016;
|
||||
formatList[2].bits_per_pixel = 16;
|
||||
formatList[2].byte_order = VA_LSB_FIRST;
|
||||
|
||||
formatList[3].fourcc = VA_FOURCC_RGBP;
|
||||
formatList[3].bits_per_pixel = 8;
|
||||
formatList[3].byte_order = VA_LSB_FIRST;
|
||||
}
|
||||
return VA_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
int maxNumImageFormats(VADisplay vaDisplay) override {
|
||||
return 4;
|
||||
return 2;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -188,19 +188,13 @@ TEST(VASharingFunctions, givenEnabledExtendedVaFormatsWhenQueryingSupportedForma
|
||||
|
||||
sharingFunctions.querySupportedVaImageFormats(VADisplay(1));
|
||||
|
||||
EXPECT_EQ(3u, sharingFunctions.supported2PlaneFormats.size());
|
||||
EXPECT_EQ(1u, sharingFunctions.supported3PlaneFormats.size());
|
||||
EXPECT_EQ(2u, sharingFunctions.supportedFormats.size());
|
||||
|
||||
size_t allFormatsFound = 0;
|
||||
for (const auto &supported2PlaneFormat : sharingFunctions.supported2PlaneFormats) {
|
||||
if (supported2PlaneFormat.fourcc == VA_FOURCC_NV12 || supported2PlaneFormat.fourcc == VA_FOURCC_P010 || supported2PlaneFormat.fourcc == VA_FOURCC_P016) {
|
||||
for (const auto &supportedFormat : sharingFunctions.supportedFormats) {
|
||||
if (supportedFormat.fourcc == VA_FOURCC_NV12 || supportedFormat.fourcc == VA_FOURCC_P010) {
|
||||
allFormatsFound++;
|
||||
}
|
||||
}
|
||||
for (const auto &supported3PlaneFormat : sharingFunctions.supported3PlaneFormats) {
|
||||
if (supported3PlaneFormat.fourcc == VA_FOURCC_RGBP) {
|
||||
allFormatsFound++;
|
||||
}
|
||||
}
|
||||
EXPECT_EQ(4u, allFormatsFound);
|
||||
EXPECT_EQ(2u, allFormatsFound);
|
||||
}
|
||||
|
@ -785,31 +785,22 @@ TEST_F(ApiVaSharingTests, givenSupportedImageTypeWhenGettingSupportedVAApiFormat
|
||||
VAImageFormat vaApiFormats[10] = {};
|
||||
cl_uint numImageFormats = 0;
|
||||
|
||||
std::vector<std::unique_ptr<VAImageFormat>> supportedFormats;
|
||||
supportedFormats.push_back(std::make_unique<VAImageFormat>(VAImageFormat{VA_FOURCC_NV12, VA_LSB_FIRST, 0, 0, 0, 0, 0, 0}));
|
||||
supportedFormats.push_back(std::make_unique<VAImageFormat>(VAImageFormat{VA_FOURCC_P010, VA_LSB_FIRST, 0, 0, 0, 0, 0, 0}));
|
||||
supportedFormats.push_back(std::make_unique<VAImageFormat>(VAImageFormat{VA_FOURCC_P016, VA_LSB_FIRST, 0, 0, 0, 0, 0, 0}));
|
||||
VAImageFormat supportedFormat = {VA_FOURCC_NV12, VA_LSB_FIRST, 8, 0, 0, 0, 0, 0};
|
||||
|
||||
for (auto flag : flags) {
|
||||
|
||||
for (auto plane : {0, 1}) {
|
||||
cl_int result = clGetSupportedVA_APIMediaSurfaceFormatsINTEL(
|
||||
&context,
|
||||
flag,
|
||||
image_type,
|
||||
arrayCount(vaApiFormats),
|
||||
vaApiFormats,
|
||||
&numImageFormats);
|
||||
|
||||
cl_int result = clGetSupportedVA_APIMediaSurfaceFormatsINTEL(
|
||||
&context,
|
||||
flag,
|
||||
image_type,
|
||||
plane,
|
||||
arrayCount(vaApiFormats),
|
||||
vaApiFormats,
|
||||
&numImageFormats);
|
||||
EXPECT_EQ(CL_SUCCESS, result);
|
||||
EXPECT_EQ(1u, numImageFormats);
|
||||
|
||||
EXPECT_EQ(CL_SUCCESS, result);
|
||||
EXPECT_EQ(3u, numImageFormats);
|
||||
int i = 0;
|
||||
for (auto &format : supportedFormats) {
|
||||
EXPECT_EQ(format->fourcc, vaApiFormats[i++].fourcc);
|
||||
}
|
||||
}
|
||||
EXPECT_EQ(supportedFormat.fourcc, vaApiFormats[0].fourcc);
|
||||
}
|
||||
}
|
||||
|
||||
@ -818,20 +809,16 @@ TEST_F(ApiVaSharingTests, givenZeroNumEntriesWhenGettingSupportedVAApiFormatsThe
|
||||
cl_mem_object_type image_type = CL_MEM_OBJECT_IMAGE2D;
|
||||
cl_uint numImageFormats = 0;
|
||||
|
||||
for (auto plane : {0, 1}) {
|
||||
cl_int result = clGetSupportedVA_APIMediaSurfaceFormatsINTEL(
|
||||
&context,
|
||||
flags,
|
||||
image_type,
|
||||
0,
|
||||
nullptr,
|
||||
&numImageFormats);
|
||||
|
||||
cl_int result = clGetSupportedVA_APIMediaSurfaceFormatsINTEL(
|
||||
&context,
|
||||
flags,
|
||||
image_type,
|
||||
plane,
|
||||
0,
|
||||
nullptr,
|
||||
&numImageFormats);
|
||||
|
||||
EXPECT_EQ(CL_SUCCESS, result);
|
||||
EXPECT_EQ(3u, numImageFormats);
|
||||
}
|
||||
EXPECT_EQ(CL_SUCCESS, result);
|
||||
EXPECT_EQ(1u, numImageFormats);
|
||||
}
|
||||
|
||||
TEST_F(ApiVaSharingTests, givenNullNumImageFormatsWhenGettingSupportedVAApiFormatsThenNumFormatsIsNotDereferenced) {
|
||||
@ -843,7 +830,6 @@ TEST_F(ApiVaSharingTests, givenNullNumImageFormatsWhenGettingSupportedVAApiForma
|
||||
flags,
|
||||
image_type,
|
||||
0,
|
||||
0,
|
||||
nullptr,
|
||||
nullptr);
|
||||
|
||||
@ -860,7 +846,6 @@ TEST_F(ApiVaSharingTests, givenInvalidImageTypeWhenGettingSupportedVAApiFormatsT
|
||||
&context,
|
||||
flags,
|
||||
image_type,
|
||||
0,
|
||||
arrayCount(vaApiFormats),
|
||||
vaApiFormats,
|
||||
&numImageFormats);
|
||||
@ -879,7 +864,6 @@ TEST_F(ApiVaSharingTests, givenInvalidFlagsWhenGettingSupportedVAApiFormatsThenI
|
||||
&context,
|
||||
flags,
|
||||
image_type,
|
||||
0,
|
||||
arrayCount(vaApiFormats),
|
||||
vaApiFormats,
|
||||
&numImageFormats);
|
||||
@ -899,7 +883,6 @@ TEST_F(ApiVaSharingTests, givenInvalidContextWhenGettingSupportedVAApiFormatsThe
|
||||
&contextWihtoutVASharing,
|
||||
flags,
|
||||
image_type,
|
||||
0,
|
||||
arrayCount(vaApiFormats),
|
||||
vaApiFormats,
|
||||
&numImageFormats);
|
||||
@ -923,10 +906,10 @@ TEST(VaSurface, givenInValidPlaneOrFlagsWhenValidatingInputsThenTrueIsReturned)
|
||||
}
|
||||
|
||||
TEST(VaSurface, givenNotSupportedVaFormatsWhenCheckingIfSupportedThenFalseIsReturned) {
|
||||
EXPECT_FALSE(VASurface::isSupportedFourCCTwoPlaneFormat(VA_FOURCC_NV11));
|
||||
EXPECT_FALSE(VASurface::isSupportedFourCC(VA_FOURCC_NV11));
|
||||
DebugManagerStateRestore restore;
|
||||
DebugManager.flags.EnableExtendedVaFormats.set(true);
|
||||
EXPECT_FALSE(VASurface::isSupportedFourCCThreePlaneFormat(VA_FOURCC_NV11));
|
||||
EXPECT_FALSE(VASurface::isSupportedFourCC(VA_FOURCC_NV11));
|
||||
EXPECT_EQ(nullptr, VASurface::getExtendedSurfaceFormatInfo(VA_FOURCC_NV11));
|
||||
}
|
||||
|
||||
@ -936,14 +919,13 @@ TEST(VaSharingFunctions, givenErrorReturnedFromVaLibWhenQuerySupportedVaImageFor
|
||||
|
||||
sharingFunctions.querySupportedVaImageFormats(VADisplay(1));
|
||||
|
||||
EXPECT_EQ(0u, sharingFunctions.supported2PlaneFormats.size());
|
||||
EXPECT_EQ(0u, sharingFunctions.supported3PlaneFormats.size());
|
||||
EXPECT_EQ(0u, sharingFunctions.supportedFormats.size());
|
||||
}
|
||||
|
||||
TEST(VaSharingFunctions, givenNoSupportedFormatsWhenQuerySupportedVaImageFormatsThenSupportedFormatsAreNotSet) {
|
||||
VASharingFunctionsMock sharingFunctions;
|
||||
EXPECT_EQ(0u, sharingFunctions.supported2PlaneFormats.size());
|
||||
EXPECT_EQ(0u, sharingFunctions.supported3PlaneFormats.size());
|
||||
EXPECT_EQ(0u, sharingFunctions.supportedFormats.size());
|
||||
|
||||
cl_mem_flags flags = CL_MEM_READ_WRITE;
|
||||
cl_mem_object_type image_type = CL_MEM_OBJECT_IMAGE2D;
|
||||
cl_uint numImageFormats = 0;
|
||||
@ -952,7 +934,6 @@ TEST(VaSharingFunctions, givenNoSupportedFormatsWhenQuerySupportedVaImageFormats
|
||||
sharingFunctions.getSupportedFormats(
|
||||
flags,
|
||||
image_type,
|
||||
0,
|
||||
10,
|
||||
vaApiFormats,
|
||||
&numImageFormats);
|
||||
@ -963,11 +944,11 @@ TEST(VaSharingFunctions, givenNoSupportedFormatsWhenQuerySupportedVaImageFormats
|
||||
TEST(VaSharingFunctions, givenNumEntriesLowerThanSupportedFormatsWhenGettingSupportedFormatsThenOnlyNumEntiresAreReturned) {
|
||||
VASharingFunctionsMock sharingFunctions;
|
||||
VAImageFormat imageFormat = {VA_FOURCC_NV12, 1, 12};
|
||||
sharingFunctions.supported2PlaneFormats.emplace_back(imageFormat);
|
||||
imageFormat.fourcc = VA_FOURCC_P010;
|
||||
sharingFunctions.supported2PlaneFormats.emplace_back(imageFormat);
|
||||
sharingFunctions.supportedFormats.emplace_back(imageFormat);
|
||||
imageFormat.fourcc = VA_FOURCC_NV21;
|
||||
sharingFunctions.supportedFormats.emplace_back(imageFormat);
|
||||
|
||||
EXPECT_EQ(2u, sharingFunctions.supported2PlaneFormats.size());
|
||||
EXPECT_EQ(2u, sharingFunctions.supportedFormats.size());
|
||||
|
||||
cl_mem_flags flags = CL_MEM_READ_WRITE;
|
||||
cl_mem_object_type image_type = CL_MEM_OBJECT_IMAGE2D;
|
||||
@ -977,7 +958,6 @@ TEST(VaSharingFunctions, givenNumEntriesLowerThanSupportedFormatsWhenGettingSupp
|
||||
sharingFunctions.getSupportedFormats(
|
||||
flags,
|
||||
image_type,
|
||||
0,
|
||||
1,
|
||||
vaApiFormats,
|
||||
&numImageFormats);
|
||||
@ -1018,212 +998,3 @@ TEST_F(VaSharingTests, givenInteropUserSyncIsNotSpecifiedDuringContextCreationWh
|
||||
EXPECT_EQ(!specifyInteropUseSync, mockCommandQueue.finishCalled);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(VaSharingTests, givenPlaneArgumentEquals2WithEmptySupported3PlaneFormatsVectorThentNoFormatIsReturned) {
|
||||
VASharingFunctionsMock sharingFunctions;
|
||||
EXPECT_EQ(sharingFunctions.supported3PlaneFormats.size(), 0u);
|
||||
|
||||
cl_mem_flags flags = CL_MEM_READ_WRITE;
|
||||
cl_mem_object_type image_type = CL_MEM_OBJECT_IMAGE2D;
|
||||
cl_uint numImageFormats = 4;
|
||||
VAImageFormat vaApiFormats[4] = {};
|
||||
|
||||
sharingFunctions.getSupportedFormats(
|
||||
flags,
|
||||
image_type,
|
||||
2,
|
||||
1,
|
||||
vaApiFormats,
|
||||
&numImageFormats);
|
||||
|
||||
EXPECT_EQ(0u, vaApiFormats[0].fourcc);
|
||||
}
|
||||
|
||||
TEST_F(VaSharingTests, givenPlaneArgumentGreaterThan2ThenNoFormatIsReturned) {
|
||||
VASharingFunctionsMock sharingFunctions;
|
||||
EXPECT_EQ(sharingFunctions.supported2PlaneFormats.size(), 0u);
|
||||
EXPECT_EQ(sharingFunctions.supported3PlaneFormats.size(), 0u);
|
||||
VAImageFormat imageFormat = {VA_FOURCC_RGBP, 1, 12};
|
||||
sharingFunctions.supported3PlaneFormats.emplace_back(imageFormat);
|
||||
imageFormat = {VA_FOURCC_NV12, 1, 12};
|
||||
sharingFunctions.supported2PlaneFormats.emplace_back(imageFormat);
|
||||
|
||||
cl_mem_flags flags = CL_MEM_READ_WRITE;
|
||||
cl_mem_object_type image_type = CL_MEM_OBJECT_IMAGE2D;
|
||||
cl_uint numImageFormats = 2;
|
||||
VAImageFormat vaApiFormats[2] = {};
|
||||
|
||||
sharingFunctions.getSupportedFormats(
|
||||
flags,
|
||||
image_type,
|
||||
3,
|
||||
1,
|
||||
vaApiFormats,
|
||||
&numImageFormats);
|
||||
|
||||
EXPECT_EQ(0u, vaApiFormats[0].fourcc);
|
||||
EXPECT_EQ(0u, vaApiFormats[1].fourcc);
|
||||
}
|
||||
|
||||
TEST_F(VaSharingTests, givenPlaneArgumentEquals2ThenOnlyRGBPFormatIsReturned) {
|
||||
VASharingFunctionsMock sharingFunctions;
|
||||
EXPECT_EQ(sharingFunctions.supported2PlaneFormats.size(), 0u);
|
||||
EXPECT_EQ(sharingFunctions.supported3PlaneFormats.size(), 0u);
|
||||
VAImageFormat imageFormat = {VA_FOURCC_RGBP, 1, 12};
|
||||
sharingFunctions.supported3PlaneFormats.emplace_back(imageFormat);
|
||||
|
||||
cl_mem_flags flags = CL_MEM_READ_WRITE;
|
||||
cl_mem_object_type image_type = CL_MEM_OBJECT_IMAGE2D;
|
||||
cl_uint numImageFormats = 1;
|
||||
VAImageFormat vaApiFormats[3] = {};
|
||||
|
||||
sharingFunctions.getSupportedFormats(
|
||||
flags,
|
||||
image_type,
|
||||
2,
|
||||
1,
|
||||
vaApiFormats,
|
||||
&numImageFormats);
|
||||
|
||||
EXPECT_EQ(static_cast<uint32_t>(VA_FOURCC_RGBP), vaApiFormats[0].fourcc);
|
||||
}
|
||||
|
||||
TEST_F(VaSharingTests, givenPlaneArgumentLessThan2WithProperFormatsAndEmptySupportedFormatsVectorsThenNoFormatIsReturned) {
|
||||
VASharingFunctionsMock sharingFunctions;
|
||||
EXPECT_EQ(sharingFunctions.supported2PlaneFormats.size(), 0u);
|
||||
EXPECT_EQ(sharingFunctions.supported3PlaneFormats.size(), 0u);
|
||||
|
||||
cl_mem_flags flags = CL_MEM_READ_WRITE;
|
||||
cl_mem_object_type image_type = CL_MEM_OBJECT_IMAGE2D;
|
||||
cl_uint numImageFormats = 1;
|
||||
VAImageFormat vaApiFormats[3] = {};
|
||||
|
||||
sharingFunctions.getSupportedFormats(
|
||||
flags,
|
||||
image_type,
|
||||
0,
|
||||
1,
|
||||
vaApiFormats,
|
||||
&numImageFormats);
|
||||
|
||||
EXPECT_EQ(0u, vaApiFormats[0].fourcc);
|
||||
|
||||
VAImageFormat imageFormat = {VA_FOURCC_NV12, 1, 12};
|
||||
sharingFunctions.supported2PlaneFormats.emplace_back(imageFormat);
|
||||
sharingFunctions.supported3PlaneFormats.emplace_back(imageFormat);
|
||||
|
||||
sharingFunctions.getSupportedFormats(
|
||||
flags,
|
||||
image_type,
|
||||
0,
|
||||
1,
|
||||
nullptr,
|
||||
&numImageFormats);
|
||||
|
||||
EXPECT_EQ(0u, vaApiFormats[0].fourcc);
|
||||
}
|
||||
|
||||
TEST_F(VaSharingTests, givenPlaneArgumentLessThan2WithProperFormatsAndSupportedFormatsVectorsThenAll2And3PlaneFormatsAreReturned) {
|
||||
VASharingFunctionsMock sharingFunctions;
|
||||
EXPECT_EQ(sharingFunctions.supported2PlaneFormats.size(), 0u);
|
||||
EXPECT_EQ(sharingFunctions.supported3PlaneFormats.size(), 0u);
|
||||
|
||||
cl_mem_flags flags = CL_MEM_READ_WRITE;
|
||||
cl_mem_object_type image_type = CL_MEM_OBJECT_IMAGE2D;
|
||||
cl_uint numImageFormats = 4;
|
||||
VAImageFormat vaApiFormats[4] = {};
|
||||
|
||||
sharingFunctions.supported2PlaneFormats.push_back(VAImageFormat{VA_FOURCC_NV12, VA_LSB_FIRST, 0, 0, 0, 0, 0, 0});
|
||||
sharingFunctions.supported2PlaneFormats.push_back(VAImageFormat{VA_FOURCC_P010, VA_LSB_FIRST, 0, 0, 0, 0, 0, 0});
|
||||
sharingFunctions.supported2PlaneFormats.push_back(VAImageFormat{VA_FOURCC_P016, VA_LSB_FIRST, 0, 0, 0, 0, 0, 0});
|
||||
sharingFunctions.supported3PlaneFormats.push_back(VAImageFormat{VA_FOURCC_RGBP, VA_LSB_FIRST, 0, 0, 0, 0, 0, 0});
|
||||
|
||||
sharingFunctions.getSupportedFormats(
|
||||
flags,
|
||||
image_type,
|
||||
0,
|
||||
4,
|
||||
vaApiFormats,
|
||||
&numImageFormats);
|
||||
|
||||
EXPECT_EQ(static_cast<uint32_t>(VA_FOURCC_NV12), vaApiFormats[0].fourcc);
|
||||
EXPECT_EQ(static_cast<uint32_t>(VA_FOURCC_P010), vaApiFormats[1].fourcc);
|
||||
EXPECT_EQ(static_cast<uint32_t>(VA_FOURCC_P016), vaApiFormats[2].fourcc);
|
||||
EXPECT_EQ(static_cast<uint32_t>(VA_FOURCC_RGBP), vaApiFormats[3].fourcc);
|
||||
}
|
||||
|
||||
TEST_F(VaSharingTests, givenPlaneArgumentLessThan2WithProperFormatsAndOnly3PlaneSupportedFormatsVectorThen3PlaneFormatIsReturned) {
|
||||
VASharingFunctionsMock sharingFunctions;
|
||||
EXPECT_EQ(sharingFunctions.supported2PlaneFormats.size(), 0u);
|
||||
|
||||
cl_mem_flags flags = CL_MEM_READ_WRITE;
|
||||
cl_mem_object_type image_type = CL_MEM_OBJECT_IMAGE2D;
|
||||
cl_uint numImageFormats = 4;
|
||||
VAImageFormat vaApiFormats[4] = {};
|
||||
|
||||
sharingFunctions.supported3PlaneFormats.push_back(VAImageFormat{VA_FOURCC_RGBP, VA_LSB_FIRST, 0, 0, 0, 0, 0, 0});
|
||||
EXPECT_EQ(sharingFunctions.supported2PlaneFormats.size(), 0u);
|
||||
|
||||
sharingFunctions.getSupportedFormats(
|
||||
flags,
|
||||
image_type,
|
||||
0,
|
||||
4,
|
||||
vaApiFormats,
|
||||
&numImageFormats);
|
||||
|
||||
EXPECT_EQ(static_cast<uint32_t>(VA_FOURCC_RGBP), vaApiFormats[0].fourcc);
|
||||
EXPECT_EQ(0u, vaApiFormats[1].fourcc);
|
||||
EXPECT_EQ(0u, vaApiFormats[2].fourcc);
|
||||
EXPECT_EQ(0u, vaApiFormats[3].fourcc);
|
||||
}
|
||||
|
||||
TEST_F(VaSharingTests, givenPlaneArgumentLessThan2WithProperFormatsAndOnly2PlaneSupportedFormatsVectorThen2PlaneFormatsAreReturned) {
|
||||
VASharingFunctionsMock sharingFunctions;
|
||||
EXPECT_EQ(sharingFunctions.supported2PlaneFormats.size(), 0u);
|
||||
|
||||
cl_mem_flags flags = CL_MEM_READ_WRITE;
|
||||
cl_mem_object_type image_type = CL_MEM_OBJECT_IMAGE2D;
|
||||
cl_uint numImageFormats = 4;
|
||||
VAImageFormat vaApiFormats[4] = {};
|
||||
|
||||
sharingFunctions.supported2PlaneFormats.push_back(VAImageFormat{VA_FOURCC_NV12, VA_LSB_FIRST, 0, 0, 0, 0, 0, 0});
|
||||
sharingFunctions.supported2PlaneFormats.push_back(VAImageFormat{VA_FOURCC_P010, VA_LSB_FIRST, 0, 0, 0, 0, 0, 0});
|
||||
sharingFunctions.supported2PlaneFormats.push_back(VAImageFormat{VA_FOURCC_P016, VA_LSB_FIRST, 0, 0, 0, 0, 0, 0});
|
||||
EXPECT_EQ(sharingFunctions.supported3PlaneFormats.size(), 0u);
|
||||
|
||||
sharingFunctions.getSupportedFormats(
|
||||
flags,
|
||||
image_type,
|
||||
0,
|
||||
4,
|
||||
vaApiFormats,
|
||||
&numImageFormats);
|
||||
|
||||
EXPECT_EQ(static_cast<uint32_t>(VA_FOURCC_NV12), vaApiFormats[0].fourcc);
|
||||
EXPECT_EQ(static_cast<uint32_t>(VA_FOURCC_P010), vaApiFormats[1].fourcc);
|
||||
EXPECT_EQ(static_cast<uint32_t>(VA_FOURCC_P016), vaApiFormats[2].fourcc);
|
||||
EXPECT_EQ(0u, vaApiFormats[3].fourcc);
|
||||
}
|
||||
|
||||
TEST_F(VaSharingTests, givenPlaneArgumentEquals2WithoutNoProperFormatsThenReturn) {
|
||||
VASharingFunctionsMock sharingFunctions;
|
||||
EXPECT_EQ(sharingFunctions.supported2PlaneFormats.size(), 0u);
|
||||
EXPECT_EQ(sharingFunctions.supported3PlaneFormats.size(), 0u);
|
||||
|
||||
cl_mem_flags flags = CL_MEM_READ_WRITE;
|
||||
cl_mem_object_type image_type = CL_MEM_OBJECT_IMAGE2D;
|
||||
cl_uint numImageFormats = 1;
|
||||
|
||||
sharingFunctions.supported3PlaneFormats.push_back(VAImageFormat{VA_FOURCC_RGBP, VA_LSB_FIRST, 0, 0, 0, 0, 0, 0});
|
||||
|
||||
cl_int result = sharingFunctions.getSupportedFormats(
|
||||
flags,
|
||||
image_type,
|
||||
2,
|
||||
4,
|
||||
nullptr,
|
||||
&numImageFormats);
|
||||
|
||||
EXPECT_EQ(result, CL_SUCCESS);
|
||||
}
|
||||
|
Reference in New Issue
Block a user