Skip to content

Commit 06287af

Browse files
DrmGemCloseWorker - remove not used modes of operation.
Change-Id: Ie8524a8411f1022785536a523aad3e4ebea3a349
1 parent f90ced1 commit 06287af

File tree

9 files changed

+105
-216
lines changed

9 files changed

+105
-216
lines changed

runtime/memory_manager/memory_manager.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ class MemoryManager {
220220
return deferredDeleter.get();
221221
}
222222

223-
virtual void waitForDeletions();
223+
void waitForDeletions();
224224

225225
bool isAsyncDeleterEnabled() const;
226226
virtual bool isMemoryBudgetExhausted() const;

runtime/os_interface/linux/drm_command_stream.inl

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -78,16 +78,7 @@ FlushStamp DrmCommandStreamReceiver<GfxFamily>::flush(BatchBuffer &batchBuffer,
7878
batchBuffer.requiresCoherency,
7979
batchBuffer.low_priority);
8080

81-
if (this->gemCloseWorkerOperationMode == gemCloseWorkerMode::gemCloseWorkerConsumingCommandBuffers) {
82-
// Consume all space in CS to force new allocation
83-
batchBuffer.stream->replaceBuffer(nullptr, 0);
84-
batchBuffer.stream->replaceGraphicsAllocation(nullptr);
85-
86-
// Push for asynchronous cleanup
87-
getMemoryManager()->push(alloc);
88-
} else {
89-
bb->getResidency()->clear();
90-
}
81+
bb->getResidency()->clear();
9182
}
9283

9384
return flushStamp;
@@ -105,9 +96,6 @@ void DrmCommandStreamReceiver<GfxFamily>::makeResident(GraphicsAllocation &gfxAl
10596
template <typename GfxFamily>
10697
void DrmCommandStreamReceiver<GfxFamily>::makeResident(BufferObject *bo) {
10798
if (bo) {
108-
if (this->gemCloseWorkerOperationMode == gemCloseWorkerMode::gemCloseWorkerConsumingCommandBuffers) {
109-
bo->reference();
110-
}
11199
residency.push_back(bo);
112100
}
113101
}
@@ -138,11 +126,6 @@ void DrmCommandStreamReceiver<GfxFamily>::makeNonResident(GraphicsAllocation &gf
138126
// If makeNonResident is called before flush, vector will be cleared.
139127
if (gfxAllocation.residencyTaskCount != ObjectNotResident) {
140128
if (this->residency.size() != 0) {
141-
if (this->gemCloseWorkerOperationMode == gemCloseWorkerMode::gemCloseWorkerConsumingCommandBuffers) {
142-
for (auto it : residency) {
143-
getMemoryManager()->unreference(it);
144-
}
145-
}
146129
this->residency.clear();
147130
}
148131
if (gfxAllocation.fragmentsStorage.fragmentCount) {

runtime/os_interface/linux/drm_gem_close_worker.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, Intel Corporation
2+
* Copyright (c) 2017 - 2018, Intel Corporation
33
*
44
* Permission is hereby granted, free of charge, to any person obtaining a
55
* copy of this software and associated documentation files (the "Software"),
@@ -35,9 +35,8 @@ class DrmMemoryManager;
3535
class DrmAllocation;
3636

3737
enum gemCloseWorkerMode {
38-
gemCloseWorkerConsumingCommandBuffers,
3938
gemCloseWorkerInactive,
40-
gemCloseWorkerConsumingResources
39+
gemCloseWorkerActive
4140
};
4241

4342
class DrmGemCloseWorker {
@@ -53,7 +52,7 @@ class DrmGemCloseWorker {
5352

5453
bool isEmpty();
5554

56-
private:
55+
protected:
5756
void close(DrmAllocation *workItem);
5857
void closeThread();
5958
void worker();

runtime/os_interface/linux/drm_memory_manager.cpp

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,6 @@ DrmMemoryManager::~DrmMemoryManager() {
7777
}
7878
}
7979

80-
void DrmMemoryManager::push(DrmAllocation *alloc) {
81-
gemCloseWorker->push(alloc);
82-
}
83-
8480
void DrmMemoryManager::eraseSharedBufferObject(OCLRT::BufferObject *bo) {
8581
std::lock_guard<decltype(mtx)> lock(mtx);
8682

@@ -109,9 +105,6 @@ uint32_t DrmMemoryManager::unreference(OCLRT::BufferObject *bo, bool synchronous
109105
uint32_t r = bo->refCount.fetch_sub(1);
110106

111107
if (r == 1) {
112-
for (auto it : *bo->getResidency()) {
113-
unreference(it);
114-
}
115108
auto unmapSize = bo->peekUnmapSize();
116109
auto address = bo->isAllocated || unmapSize > 0 ? bo->address : nullptr;
117110
auto allocatorType = bo->peekAllocationType();
@@ -537,14 +530,6 @@ BufferObject *DrmMemoryManager::getPinBB() const {
537530
return pinBB;
538531
}
539532

540-
void DrmMemoryManager::waitForDeletions() {
541-
if (gemCloseWorker.get()) {
542-
while (!gemCloseWorker->isEmpty())
543-
;
544-
}
545-
MemoryManager::waitForDeletions();
546-
}
547-
548533
bool DrmMemoryManager::setDomainCpu(GraphicsAllocation &graphicsAllocation, bool writeEnable) {
549534
DEBUG_BREAK_IF(writeEnable); //unsupported path (for CPU writes call SW_FINISH ioctl in unlockResource)
550535

runtime/os_interface/linux/drm_memory_manager.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,7 @@ class DrmMemoryManager : public MemoryManager {
7070
// drm/i915 ioctl wrappers
7171
uint32_t unreference(BufferObject *bo, bool synchronousDestroy = false);
7272

73-
// CloseWorker delegate
74-
void push(DrmAllocation *alloc);
75-
7673
DrmAllocation *createGraphicsAllocation(OsHandleStorage &handleStorage, size_t hostPtrSize, const void *hostPtr) override;
77-
void waitForDeletions() override;
7874
bool isValidateHostMemoryEnabled() const {
7975
return validateHostPtrMemory;
8076
}

unit_tests/os_interface/linux/drm_command_stream_mm_tests.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ HWTEST_F(DrmCommandStreamMMTest, MMwithPinBB) {
3939
std::unique_ptr<DrmMockCustom> mock(new DrmMockCustom());
4040
ASSERT_NE(nullptr, mock);
4141

42-
DrmCommandStreamReceiver<FamilyType> csr(*platformDevices[0], mock.get(), gemCloseWorkerMode::gemCloseWorkerConsumingCommandBuffers);
42+
DrmCommandStreamReceiver<FamilyType> csr(*platformDevices[0], mock.get(), gemCloseWorkerMode::gemCloseWorkerInactive);
4343

4444
auto mm = (DrmMemoryManager *)csr.createMemoryManager(false);
4545
ASSERT_NE(nullptr, mm);
@@ -58,7 +58,7 @@ HWTEST_F(DrmCommandStreamMMTest, givenForcePinDisabledWhenMemoryManagerIsCreated
5858
std::unique_ptr<DrmMockCustom> mock(new DrmMockCustom());
5959
ASSERT_NE(nullptr, mock);
6060

61-
DrmCommandStreamReceiver<FamilyType> csr(*platformDevices[0], mock.get(), gemCloseWorkerMode::gemCloseWorkerConsumingCommandBuffers);
61+
DrmCommandStreamReceiver<FamilyType> csr(*platformDevices[0], mock.get(), gemCloseWorkerMode::gemCloseWorkerInactive);
6262

6363
auto mm = (DrmMemoryManager *)csr.createMemoryManager(false);
6464
csr.setMemoryManager(nullptr);

0 commit comments

Comments
 (0)