2019-03-12 21:19:01 +08:00
|
|
|
/*
|
2020-01-14 21:32:11 +08:00
|
|
|
* Copyright (C) 2019-2020 Intel Corporation
|
2019-03-12 21:19:01 +08:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2020-02-24 08:01:38 +08:00
|
|
|
#include "shared/test/unit_test/utilities/base_object_utils.h"
|
2020-02-24 17:22:30 +08:00
|
|
|
|
2020-02-23 05:50:57 +08:00
|
|
|
#include "opencl/source/helpers/surface_formats.h"
|
2020-02-23 22:20:22 +08:00
|
|
|
#include "opencl/test/unit_test/mocks/mock_context.h"
|
|
|
|
#include "opencl/test/unit_test/mocks/mock_device.h"
|
|
|
|
#include "opencl/test/unit_test/mocks/mock_memory_manager.h"
|
2019-03-12 21:19:01 +08:00
|
|
|
#include "test.h"
|
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
using namespace NEO;
|
2019-03-12 21:19:01 +08:00
|
|
|
|
|
|
|
class ImageCompressionTests : public ::testing::Test {
|
|
|
|
public:
|
|
|
|
class MyMemoryManager : public MockMemoryManager {
|
|
|
|
public:
|
|
|
|
using MockMemoryManager::MockMemoryManager;
|
|
|
|
GraphicsAllocation *allocateGraphicsMemoryForImage(const AllocationData &allocationData) override {
|
|
|
|
mockMethodCalled = true;
|
|
|
|
capturedImgInfo = *allocationData.imgInfo;
|
|
|
|
return OsAgnosticMemoryManager::allocateGraphicsMemoryForImage(allocationData);
|
|
|
|
}
|
|
|
|
ImageInfo capturedImgInfo = {};
|
|
|
|
bool mockMethodCalled = false;
|
|
|
|
};
|
|
|
|
|
|
|
|
void SetUp() override {
|
2020-01-14 21:32:11 +08:00
|
|
|
mockDevice = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(*platformDevices));
|
2019-03-12 21:19:01 +08:00
|
|
|
myMemoryManager = new MyMemoryManager(*mockDevice->getExecutionEnvironment());
|
|
|
|
mockDevice->injectMemoryManager(myMemoryManager);
|
|
|
|
mockContext = make_releaseable<MockContext>(mockDevice.get());
|
|
|
|
}
|
|
|
|
|
2020-01-14 21:32:11 +08:00
|
|
|
std::unique_ptr<MockClDevice> mockDevice;
|
2019-03-12 21:19:01 +08:00
|
|
|
ReleaseableObjectPtr<MockContext> mockContext;
|
|
|
|
MyMemoryManager *myMemoryManager = nullptr;
|
|
|
|
|
|
|
|
cl_image_desc imageDesc = {};
|
2020-02-10 22:05:12 +08:00
|
|
|
cl_image_format imageFormat{CL_R, CL_UNSIGNED_INT8};
|
2019-03-12 21:19:01 +08:00
|
|
|
cl_mem_flags flags = CL_MEM_READ_WRITE;
|
|
|
|
cl_int retVal = CL_SUCCESS;
|
|
|
|
};
|