2017-12-21 07:45:38 +08:00
|
|
|
/*
|
2024-08-22 22:11:12 +08:00
|
|
|
* Copyright (C) 2018-2024 Intel Corporation
|
2018-09-18 15:11:08 +08:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*
|
|
|
|
*/
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2021-05-21 18:22:13 +08:00
|
|
|
#include "shared/test/common/mocks/mock_gmm_client_context_base.h"
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2021-09-08 07:30:06 +08:00
|
|
|
#include "gtest/gtest.h"
|
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
namespace NEO {
|
2018-07-06 15:07:42 +08:00
|
|
|
GMM_RESOURCE_INFO *MockGmmClientContextBase::createResInfoObject(GMM_RESCREATE_PARAMS *pCreateParams) {
|
2024-08-22 22:11:12 +08:00
|
|
|
return reinterpret_cast<GMM_RESOURCE_INFO *>(new char[sizeof(GMM_RESOURCE_INFO)]);
|
2018-07-06 15:07:42 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
GMM_RESOURCE_INFO *MockGmmClientContextBase::copyResInfoObject(GMM_RESOURCE_INFO *pSrcRes) {
|
2024-08-22 22:11:12 +08:00
|
|
|
return reinterpret_cast<GMM_RESOURCE_INFO *>(new char[sizeof(GMM_RESOURCE_INFO)]);
|
2018-07-06 15:07:42 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void MockGmmClientContextBase::destroyResInfoObject(GMM_RESOURCE_INFO *pResInfo) {
|
|
|
|
delete[] reinterpret_cast<char *>(pResInfo);
|
2017-12-21 07:45:38 +08:00
|
|
|
}
|
2019-10-09 23:32:35 +08:00
|
|
|
|
|
|
|
uint8_t MockGmmClientContextBase::getSurfaceStateCompressionFormat(GMM_RESOURCE_FORMAT format) {
|
|
|
|
capturedFormat = format;
|
|
|
|
getSurfaceStateCompressionFormatCalled++;
|
|
|
|
return compressionFormatToReturn;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint8_t MockGmmClientContextBase::getMediaSurfaceStateCompressionFormat(GMM_RESOURCE_FORMAT format) {
|
|
|
|
capturedFormat = format;
|
|
|
|
getMediaSurfaceStateCompressionFormatCalled++;
|
|
|
|
return compressionFormatToReturn;
|
|
|
|
}
|
|
|
|
|
2021-09-08 07:30:06 +08:00
|
|
|
void MockGmmClientContextBase::setGmmDeviceInfo(GMM_DEVICE_INFO *deviceInfo) {
|
|
|
|
EXPECT_NE(deviceInfo, nullptr);
|
|
|
|
|
|
|
|
GMM_DEVICE_CALLBACKS_INT emptyStruct{};
|
|
|
|
EXPECT_EQ(0, memcmp(deviceInfo->pDeviceCb, &emptyStruct, sizeof(GMM_DEVICE_CALLBACKS_INT)));
|
|
|
|
}
|
2023-05-19 00:27:44 +08:00
|
|
|
uint64_t MockGmmClientContextBase::freeGpuVirtualAddress(FreeGpuVirtualAddressGmm *pFreeGpuVa) {
|
|
|
|
freeGpuVirtualAddressCalled++;
|
|
|
|
return 0;
|
|
|
|
}
|
2019-03-26 18:59:46 +08:00
|
|
|
} // namespace NEO
|