2018-07-25 00:36:26 +08:00
|
|
|
/*
|
2019-01-02 04:14:17 +08:00
|
|
|
* Copyright (C) 2018-2019 Intel Corporation
|
2018-07-25 00:36:26 +08:00
|
|
|
*
|
2018-09-19 04:37:39 +08:00
|
|
|
* SPDX-License-Identifier: MIT
|
2018-07-25 00:36:26 +08:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2018-09-26 03:44:36 +08:00
|
|
|
#pragma once
|
2019-01-14 17:31:06 +08:00
|
|
|
#include "runtime/gen_common/aub_mapper_base.h"
|
2018-12-12 22:39:02 +08:00
|
|
|
#include "runtime/helpers/hw_info.h"
|
2018-09-19 04:37:39 +08:00
|
|
|
#include "runtime/helpers/properties_helper.h"
|
2018-07-25 00:36:26 +08:00
|
|
|
#include "runtime/memory_manager/graphics_allocation.h"
|
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
namespace NEO {
|
2018-07-25 00:36:26 +08:00
|
|
|
|
2018-09-19 04:37:39 +08:00
|
|
|
class AubHelper : public NonCopyableOrMovableClass {
|
2018-07-25 00:36:26 +08:00
|
|
|
public:
|
|
|
|
static bool isOneTimeAubWritableAllocationType(const GraphicsAllocation::AllocationType &type) {
|
|
|
|
switch (type) {
|
|
|
|
case GraphicsAllocation::AllocationType::BUFFER:
|
|
|
|
case GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY:
|
|
|
|
case GraphicsAllocation::AllocationType::BUFFER_COMPRESSED:
|
|
|
|
case GraphicsAllocation::AllocationType::IMAGE:
|
2019-02-08 17:27:48 +08:00
|
|
|
case GraphicsAllocation::AllocationType::TIMESTAMP_PACKET_TAG_BUFFER:
|
2018-07-25 00:36:26 +08:00
|
|
|
return true;
|
|
|
|
default:
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
2019-02-12 20:37:39 +08:00
|
|
|
|
|
|
|
static uint64_t getTotalMemBankSize();
|
2018-08-20 21:54:20 +08:00
|
|
|
static int getMemTrace(uint64_t pdEntryBits);
|
2018-09-11 16:26:39 +08:00
|
|
|
static uint64_t getPTEntryBits(uint64_t pdEntryBits);
|
2018-11-10 15:00:58 +08:00
|
|
|
static uint32_t getMemType(uint32_t addressSpace);
|
2019-02-12 20:37:39 +08:00
|
|
|
static uint64_t getMemBankSize(const HardwareInfo *pHwInfo);
|
2019-01-14 17:31:06 +08:00
|
|
|
static MMIOList getAdditionalMmioList();
|
2018-09-14 20:31:37 +08:00
|
|
|
|
|
|
|
virtual int getDataHintForPml4Entry() const = 0;
|
|
|
|
virtual int getDataHintForPdpEntry() const = 0;
|
|
|
|
virtual int getDataHintForPdEntry() const = 0;
|
|
|
|
virtual int getDataHintForPtEntry() const = 0;
|
|
|
|
|
|
|
|
virtual int getMemTraceForPml4Entry() const = 0;
|
|
|
|
virtual int getMemTraceForPdpEntry() const = 0;
|
|
|
|
virtual int getMemTraceForPdEntry() const = 0;
|
|
|
|
virtual int getMemTraceForPtEntry() const = 0;
|
2019-01-14 17:31:06 +08:00
|
|
|
|
|
|
|
protected:
|
|
|
|
static MMIOList splitMMIORegisters(const std::string ®isters, char delimiter);
|
2018-07-25 00:36:26 +08:00
|
|
|
};
|
2018-09-14 20:31:37 +08:00
|
|
|
|
|
|
|
template <typename GfxFamily>
|
|
|
|
class AubHelperHw : public AubHelper {
|
|
|
|
public:
|
|
|
|
AubHelperHw(bool localMemoryEnabled) : localMemoryEnabled(localMemoryEnabled){};
|
|
|
|
|
|
|
|
int getDataHintForPml4Entry() const override;
|
|
|
|
int getDataHintForPdpEntry() const override;
|
|
|
|
int getDataHintForPdEntry() const override;
|
|
|
|
int getDataHintForPtEntry() const override;
|
|
|
|
|
|
|
|
int getMemTraceForPml4Entry() const override;
|
|
|
|
int getMemTraceForPdpEntry() const override;
|
|
|
|
int getMemTraceForPdEntry() const override;
|
|
|
|
int getMemTraceForPtEntry() const override;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
bool localMemoryEnabled;
|
|
|
|
};
|
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
} // namespace NEO
|