DrmGemCloseWorker - remove not used modes of operation.

Change-Id: Ie8524a8411f1022785536a523aad3e4ebea3a349
This commit is contained in:
Mrozek, Michal
2018-05-10 10:16:22 +02:00
committed by sys_ocldev
parent f90ced1452
commit 06287af541
9 changed files with 105 additions and 216 deletions

View File

@@ -220,7 +220,7 @@ class MemoryManager {
return deferredDeleter.get();
}
virtual void waitForDeletions();
void waitForDeletions();
bool isAsyncDeleterEnabled() const;
virtual bool isMemoryBudgetExhausted() const;

View File

@@ -78,16 +78,7 @@ FlushStamp DrmCommandStreamReceiver<GfxFamily>::flush(BatchBuffer &batchBuffer,
batchBuffer.requiresCoherency,
batchBuffer.low_priority);
if (this->gemCloseWorkerOperationMode == gemCloseWorkerMode::gemCloseWorkerConsumingCommandBuffers) {
// Consume all space in CS to force new allocation
batchBuffer.stream->replaceBuffer(nullptr, 0);
batchBuffer.stream->replaceGraphicsAllocation(nullptr);
// Push for asynchronous cleanup
getMemoryManager()->push(alloc);
} else {
bb->getResidency()->clear();
}
bb->getResidency()->clear();
}
return flushStamp;
@@ -105,9 +96,6 @@ void DrmCommandStreamReceiver<GfxFamily>::makeResident(GraphicsAllocation &gfxAl
template <typename GfxFamily>
void DrmCommandStreamReceiver<GfxFamily>::makeResident(BufferObject *bo) {
if (bo) {
if (this->gemCloseWorkerOperationMode == gemCloseWorkerMode::gemCloseWorkerConsumingCommandBuffers) {
bo->reference();
}
residency.push_back(bo);
}
}
@@ -138,11 +126,6 @@ void DrmCommandStreamReceiver<GfxFamily>::makeNonResident(GraphicsAllocation &gf
// If makeNonResident is called before flush, vector will be cleared.
if (gfxAllocation.residencyTaskCount != ObjectNotResident) {
if (this->residency.size() != 0) {
if (this->gemCloseWorkerOperationMode == gemCloseWorkerMode::gemCloseWorkerConsumingCommandBuffers) {
for (auto it : residency) {
getMemoryManager()->unreference(it);
}
}
this->residency.clear();
}
if (gfxAllocation.fragmentsStorage.fragmentCount) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, Intel Corporation
* Copyright (c) 2017 - 2018, Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -35,9 +35,8 @@ class DrmMemoryManager;
class DrmAllocation;
enum gemCloseWorkerMode {
gemCloseWorkerConsumingCommandBuffers,
gemCloseWorkerInactive,
gemCloseWorkerConsumingResources
gemCloseWorkerActive
};
class DrmGemCloseWorker {
@@ -53,7 +52,7 @@ class DrmGemCloseWorker {
bool isEmpty();
private:
protected:
void close(DrmAllocation *workItem);
void closeThread();
void worker();

View File

@@ -77,10 +77,6 @@ DrmMemoryManager::~DrmMemoryManager() {
}
}
void DrmMemoryManager::push(DrmAllocation *alloc) {
gemCloseWorker->push(alloc);
}
void DrmMemoryManager::eraseSharedBufferObject(OCLRT::BufferObject *bo) {
std::lock_guard<decltype(mtx)> lock(mtx);
@@ -109,9 +105,6 @@ uint32_t DrmMemoryManager::unreference(OCLRT::BufferObject *bo, bool synchronous
uint32_t r = bo->refCount.fetch_sub(1);
if (r == 1) {
for (auto it : *bo->getResidency()) {
unreference(it);
}
auto unmapSize = bo->peekUnmapSize();
auto address = bo->isAllocated || unmapSize > 0 ? bo->address : nullptr;
auto allocatorType = bo->peekAllocationType();
@@ -537,14 +530,6 @@ BufferObject *DrmMemoryManager::getPinBB() const {
return pinBB;
}
void DrmMemoryManager::waitForDeletions() {
if (gemCloseWorker.get()) {
while (!gemCloseWorker->isEmpty())
;
}
MemoryManager::waitForDeletions();
}
bool DrmMemoryManager::setDomainCpu(GraphicsAllocation &graphicsAllocation, bool writeEnable) {
DEBUG_BREAK_IF(writeEnable); //unsupported path (for CPU writes call SW_FINISH ioctl in unlockResource)

View File

@@ -70,11 +70,7 @@ class DrmMemoryManager : public MemoryManager {
// drm/i915 ioctl wrappers
uint32_t unreference(BufferObject *bo, bool synchronousDestroy = false);
// CloseWorker delegate
void push(DrmAllocation *alloc);
DrmAllocation *createGraphicsAllocation(OsHandleStorage &handleStorage, size_t hostPtrSize, const void *hostPtr) override;
void waitForDeletions() override;
bool isValidateHostMemoryEnabled() const {
return validateHostPtrMemory;
}