Minor clean-up.

Change-Id: Id1523930fc8aedf85506e254c67f6b1ca8dd020d
Signed-off-by: Piotr Fusik <piotr.fusik@intel.com>
This commit is contained in:
Piotr Fusik
2019-07-29 16:11:51 +02:00
committed by sys_ocldev
parent edc6366374
commit 2548bea71d
20 changed files with 55 additions and 68 deletions

View File

@ -59,7 +59,7 @@ class BufferObject {
uint64_t peekUnmapSize() const { return unmapSize; }
StorageAllocatorType peekAllocationType() const { return storageAllocatorType; }
void setAllocationType(StorageAllocatorType allocatorType) { this->storageAllocatorType = allocatorType; }
bool peekIsReusableAllocation() { return this->isReused; }
bool peekIsReusableAllocation() const { return this->isReused; }
protected:
BufferObject(Drm *drm, int handle, bool isAllocated);

View File

@ -42,7 +42,7 @@ class DrmCommandStreamReceiver : public DeviceCommandStreamReceiver<GfxFamily> {
void makeNonResident(GraphicsAllocation &gfxAllocation) override;
bool waitForFlushStamp(FlushStamp &flushStampToWait) override;
DrmMemoryManager *getMemoryManager();
DrmMemoryManager *getMemoryManager() const;
gemCloseWorkerMode peekGemCloseWorkerOperationMode() {
return this->gemCloseWorkerOperationMode;

View File

@ -104,7 +104,7 @@ void DrmCommandStreamReceiver<GfxFamily>::makeResident(BufferObject *bo) {
template <typename GfxFamily>
void DrmCommandStreamReceiver<GfxFamily>::processResidency(ResidencyContainer &inputAllocationsForResidency) {
for (auto &alloc : inputAllocationsForResidency) {
auto drmAlloc = static_cast<DrmAllocation *>(alloc);
auto drmAlloc = static_cast<const DrmAllocation *>(alloc);
if (drmAlloc->fragmentsStorage.fragmentCount) {
for (unsigned int f = 0; f < drmAlloc->fragmentsStorage.fragmentCount; f++) {
const auto osContextId = osContext->getContextId();
@ -129,18 +129,16 @@ void DrmCommandStreamReceiver<GfxFamily>::makeNonResident(GraphicsAllocation &gf
if (this->residency.size() != 0) {
this->residency.clear();
}
if (gfxAllocation.fragmentsStorage.fragmentCount) {
for (auto fragmentId = 0u; fragmentId < gfxAllocation.fragmentsStorage.fragmentCount; fragmentId++) {
gfxAllocation.fragmentsStorage.fragmentStorageData[fragmentId].residency->resident[osContext->getContextId()] = false;
}
for (auto fragmentId = 0u; fragmentId < gfxAllocation.fragmentsStorage.fragmentCount; fragmentId++) {
gfxAllocation.fragmentsStorage.fragmentStorageData[fragmentId].residency->resident[osContext->getContextId()] = false;
}
}
gfxAllocation.releaseResidencyInOsContext(this->osContext->getContextId());
}
template <typename GfxFamily>
DrmMemoryManager *DrmCommandStreamReceiver<GfxFamily>::getMemoryManager() {
return (DrmMemoryManager *)CommandStreamReceiver::getMemoryManager();
DrmMemoryManager *DrmCommandStreamReceiver<GfxFamily>::getMemoryManager() const {
return static_cast<DrmMemoryManager *>(CommandStreamReceiver::getMemoryManager());
}
template <typename GfxFamily>

View File

@ -412,7 +412,7 @@ DrmAllocation *DrmMemoryManager::allocate32BitGraphicsMemoryImpl(const Allocatio
BufferObject *DrmMemoryManager::findAndReferenceSharedBufferObject(int boHandle) {
BufferObject *bo = nullptr;
for (const auto &i : sharingBufferObjects) {
if (i->handle == static_cast<int>(boHandle)) {
if (i->handle == boHandle) {
bo = i;
bo->reference();
break;
@ -547,8 +547,7 @@ void DrmMemoryManager::removeAllocationFromHostPtrManager(GraphicsAllocation *gf
}
void DrmMemoryManager::freeGraphicsMemoryImpl(GraphicsAllocation *gfxAllocation) {
DrmAllocation *input;
input = static_cast<DrmAllocation *>(gfxAllocation);
auto input = static_cast<DrmAllocation *>(gfxAllocation);
for (auto handleId = 0u; handleId < maxHandleCount; handleId++) {
if (gfxAllocation->getGmm(handleId)) {
delete gfxAllocation->getGmm(handleId);

View File

@ -30,8 +30,8 @@ class WddmCommandStreamReceiver : public DeviceCommandStreamReceiver<GfxFamily>
void processEviction() override;
bool waitForFlushStamp(FlushStamp &flushStampToWait) override;
WddmMemoryManager *getMemoryManager();
Wddm *peekWddm() {
WddmMemoryManager *getMemoryManager() const;
Wddm *peekWddm() const {
return wddm;
}
GmmPageTableMngr *createPageTableManager() override;

View File

@ -103,13 +103,13 @@ FlushStamp WddmCommandStreamReceiver<GfxFamily>::flush(BatchBuffer &batchBuffer,
template <typename GfxFamily>
void WddmCommandStreamReceiver<GfxFamily>::makeResident(GraphicsAllocation &gfxAllocation) {
DBG_LOG(ResidencyDebugEnable, "Residency:", __FUNCTION__, "allocation =", static_cast<WddmAllocation *>(&gfxAllocation));
DBG_LOG(ResidencyDebugEnable, "Residency:", __FUNCTION__, "allocation =", &gfxAllocation);
if (gfxAllocation.fragmentsStorage.fragmentCount == 0) {
DBG_LOG(ResidencyDebugEnable, "Residency:", __FUNCTION__, "allocation default handle =", static_cast<WddmAllocation *>(&gfxAllocation)->getDefaultHandle());
DBG_LOG(ResidencyDebugEnable, "Residency:", __FUNCTION__, "allocation default handle =", static_cast<WddmAllocation &>(gfxAllocation).getDefaultHandle());
} else {
for (uint32_t allocationId = 0; allocationId < static_cast<WddmAllocation *>(&gfxAllocation)->fragmentsStorage.fragmentCount; allocationId++) {
DBG_LOG(ResidencyDebugEnable, "Residency:", __FUNCTION__, "fragment handle =", static_cast<WddmAllocation *>(&gfxAllocation)->fragmentsStorage.fragmentStorageData[allocationId].osHandleStorage->handle);
for (uint32_t allocationId = 0; allocationId < gfxAllocation.fragmentsStorage.fragmentCount; allocationId++) {
DBG_LOG(ResidencyDebugEnable, "Residency:", __FUNCTION__, "fragment handle =", gfxAllocation.fragmentsStorage.fragmentStorageData[allocationId].osHandleStorage->handle);
}
}
@ -129,7 +129,7 @@ void WddmCommandStreamReceiver<GfxFamily>::processEviction() {
}
template <typename GfxFamily>
WddmMemoryManager *WddmCommandStreamReceiver<GfxFamily>::getMemoryManager() {
WddmMemoryManager *WddmCommandStreamReceiver<GfxFamily>::getMemoryManager() const {
return static_cast<WddmMemoryManager *>(CommandStreamReceiver::getMemoryManager());
}