Make all gmm helper members non-static

Change-Id: Idb399aa275d66905040b6317d3888c94ffb98c55
This commit is contained in:
Mateusz Jablonski
2018-07-27 13:59:39 +02:00
committed by sys_ocldev
parent 1bc7275de7
commit 89cf7532ea
12 changed files with 137 additions and 128 deletions

View File

@@ -211,7 +211,7 @@ Drm *Drm::create(int32_t deviceOrdinal) {
//turbo patch not present, we are not on custom Kernel, switch to simplified Mocs selection
//do this only for GEN9+
if (device->pHwInfo->pPlatform->eRenderCoreFamily >= IGFX_GEN9_CORE) {
GmmHelper::useSimplifiedMocsTable = true;
drmObject->setSimplifiedMocsTableUsage(true);
}
printDebugString(DebugManager.flags.PrintDebugMessages.get(), stderr, "%s", "WARNING: Failed to request OCL Turbo Boost\n");
}

View File

@@ -180,7 +180,7 @@ void Gmm::queryImageParams(ImageInfo &imgInfo) {
}
uint32_t Gmm::queryQPitch(GMM_RESOURCE_TYPE resType) {
if (GmmHelper::hwInfo->pPlatform->eRenderCoreFamily == IGFX_GEN8_CORE && resType == GMM_RESOURCE_TYPE::RESOURCE_3D) {
if (GmmHelper::getInstance()->getHardwareInfo()->pPlatform->eRenderCoreFamily == IGFX_GEN8_CORE && resType == GMM_RESOURCE_TYPE::RESOURCE_3D) {
return 0;
}
return gmmResourceInfo->getQPitch();

View File

@@ -41,10 +41,18 @@ GmmClientContext *GmmHelper::getClientContext() {
return getInstance()->gmmClientContext.get();
}
const HardwareInfo *GmmHelper::getHardwareInfo() {
return hwInfo;
}
GmmHelper *GmmHelper::getInstance() {
return platform()->peekExecutionEnvironment()->getGmmHelper();
}
void GmmHelper::setSimplifiedMocsTableUsage(bool value) {
useSimplifiedMocsTable = value;
}
void GmmHelper::initContext(const PLATFORM *pPlatform,
const FeatureTable *pSkuTable,
const WorkaroundTable *pWaTable,
@@ -159,15 +167,11 @@ GMM_YUV_PLANE GmmHelper::convertPlane(OCLPlane oclPlane) {
return GMM_NO_PLANE;
}
GmmHelper::GmmHelper(const HardwareInfo *pHwInfo) {
GmmHelper::hwInfo = pHwInfo;
GmmHelper::GmmHelper(const HardwareInfo *pHwInfo) : hwInfo(pHwInfo) {
initContext(pHwInfo->pPlatform, pHwInfo->pSkuTable, pHwInfo->pWaTable, pHwInfo->pSysInfo);
}
GmmHelper::~GmmHelper() {
gmmEntries.pfnDestroySingletonContext();
};
bool GmmHelper::useSimplifiedMocsTable = false;
decltype(GmmHelper::createGmmContextWrapperFunc) GmmHelper::createGmmContextWrapperFunc = GmmClientContextBase::create<GmmClientContext>;
const HardwareInfo *GmmHelper::hwInfo = nullptr;
} // namespace OCLRT

View File

@@ -44,7 +44,9 @@ class GmmHelper {
GmmHelper(const HardwareInfo *hwInfo);
MOCKABLE_VIRTUAL ~GmmHelper();
const HardwareInfo *getHardwareInfo();
uint32_t getMOCS(uint32_t type);
void setSimplifiedMocsTableUsage(bool value);
static constexpr uint32_t cacheDisabledIndex = 0;
static constexpr uint32_t cacheEnabledIndex = 4;
@@ -55,6 +57,7 @@ class GmmHelper {
static GmmClientContext *getClientContext();
static GmmHelper *getInstance();
static void queryImgFromBufferParams(ImageInfo &imgInfo, GraphicsAllocation *gfxAlloc);
static GMM_CUBE_FACE_ENUM getCubeFaceIndex(uint32_t target);
static bool allowTiling(const cl_image_desc &imageDesc);
@@ -65,13 +68,12 @@ class GmmHelper {
static std::unique_ptr<GmmClientContext> (*createGmmContextWrapperFunc)(GMM_CLIENT, GmmExportEntries &);
static bool useSimplifiedMocsTable;
static const HardwareInfo *hwInfo;
protected:
void loadLib();
void initContext(const PLATFORM *pPlatform, const FeatureTable *pSkuTable, const WorkaroundTable *pWaTable, const GT_SYSTEM_INFO *pGtSysInfo);
bool useSimplifiedMocsTable = false;
const HardwareInfo *hwInfo = nullptr;
std::unique_ptr<OsLibrary> gmmLib;
std::unique_ptr<GmmClientContext> gmmClientContext;
GmmExportEntries gmmEntries = {};

View File

@@ -96,8 +96,10 @@ Buffer *Buffer::create(Context *context,
bool alignementSatisfied = true;
bool allocateMemory = true;
bool copyMemoryFromHostPtr = false;
GraphicsAllocation::AllocationType allocationType = getGraphicsAllocationType(flags, context->isSharedContext, GmmHelper::hwInfo->capabilityTable.ftrRenderCompressedBuffers);
GraphicsAllocation::AllocationType allocationType = getGraphicsAllocationType(
flags,
context->isSharedContext,
context->getDevice(0)->getHardwareInfo().capabilityTable.ftrRenderCompressedBuffers);
MemoryManager *memoryManager = context->getMemoryManager();
UNRECOVERABLE_IF(!memoryManager);

View File

@@ -22,6 +22,8 @@
#include "runtime/command_stream/linear_stream.h"
#include "hw_cmds.h"
#include "runtime/execution_environment/execution_environment.h"
#include "runtime/gmm_helper/gmm_helper.h"
#include "runtime/helpers/aligned_memory.h"
#include "runtime/helpers/preamble.h"
#include "runtime/mem_obj/buffer.h"
@@ -31,6 +33,7 @@
#include "runtime/os_interface/linux/drm_memory_manager.h"
#include "runtime/os_interface/linux/drm_neo.h"
#include "runtime/os_interface/linux/os_interface.h"
#include "runtime/platform/platform.h"
#include <cstdlib>
#include <cstring>
@@ -45,6 +48,8 @@ DrmCommandStreamReceiver<GfxFamily>::DrmCommandStreamReceiver(const HardwareInfo
execObjectsStorage.reserve(512);
CommandStreamReceiver::osInterface = std::unique_ptr<OSInterface>(new OSInterface());
CommandStreamReceiver::osInterface.get()->get()->setDrm(this->drm);
auto gmmHelper = platform()->peekExecutionEnvironment()->getGmmHelper();
gmmHelper->setSimplifiedMocsTableUsage(this->drm->getSimplifiedMocsTableUsage());
}
template <typename GfxFamily>

View File

@@ -223,4 +223,12 @@ int Drm::getErrno() {
return errno;
}
bool Drm::getSimplifiedMocsTableUsage() const {
return useSimplifiedMocsTable;
}
void Drm::setSimplifiedMocsTableUsage(bool value) {
useSimplifiedMocsTable = value;
}
} // namespace OCLRT

View File

@@ -77,8 +77,11 @@ class Drm {
void setGtType(GTTYPE eGtType) { this->eGtType = eGtType; }
GTTYPE getGtType() const { return this->eGtType; }
MOCKABLE_VIRTUAL int getErrno();
void setSimplifiedMocsTableUsage(bool value);
bool getSimplifiedMocsTableUsage() const;
protected:
bool useSimplifiedMocsTable = false;
int fd;
int deviceId;
int revisionId;