2018-11-27 15:31:00 +08:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2018 Intel Corporation
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "third_party/aub_stream/headers/aub_manager.h"
|
|
|
|
#include "third_party/aub_stream/headers/hardware_context.h"
|
|
|
|
|
|
|
|
using namespace AubDump;
|
|
|
|
|
|
|
|
struct MockHardwareContext : public HardwareContext {
|
|
|
|
MockHardwareContext(){};
|
|
|
|
~MockHardwareContext() override{};
|
|
|
|
|
|
|
|
void initialize() override { initializeCalled = true; }
|
|
|
|
void pollForCompletion() override { pollForCompletionCalled = true; };
|
|
|
|
void submit(uint64_t gfxAddress, const void *batchBuffer, size_t size, uint32_t memoryBank) override { submitCalled = true; }
|
|
|
|
void writeMemory(uint64_t gfxAddress, const void *memory, size_t size, uint32_t memoryBanks, int hint, size_t pageSize = 4096) override { writeMemoryCalled = true; }
|
|
|
|
void freeMemory(uint64_t gfxAddress, size_t size) override { freeMemoryCalled = true; }
|
2018-12-05 04:03:36 +08:00
|
|
|
void expectMemory(uint64_t gfxAddress, const void *memory, size_t size, uint32_t compareOperation) override { expectMemoryCalled = true; }
|
2018-12-19 20:15:14 +08:00
|
|
|
void readMemory(uint64_t gfxAddress, void *memory, size_t size) override { readMemoryCalled = true; };
|
2018-11-27 15:31:00 +08:00
|
|
|
|
|
|
|
bool initializeCalled = false;
|
|
|
|
bool pollForCompletionCalled = false;
|
|
|
|
bool submitCalled = false;
|
|
|
|
bool writeMemoryCalled = false;
|
|
|
|
bool freeMemoryCalled = false;
|
2018-12-05 04:03:36 +08:00
|
|
|
bool expectMemoryCalled = false;
|
2018-12-19 20:15:14 +08:00
|
|
|
bool readMemoryCalled = false;
|
2018-11-27 15:31:00 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class MockAubManager : public AubManager {
|
|
|
|
public:
|
|
|
|
MockAubManager(){};
|
|
|
|
~MockAubManager() override {}
|
|
|
|
|
|
|
|
HardwareContext *createHardwareContext(uint32_t device, uint32_t engine) override { return new MockHardwareContext(); }
|
|
|
|
|
|
|
|
protected:
|
|
|
|
HardwareContext *hardwareContext = nullptr;
|
|
|
|
};
|