2017-12-21 07:45:38 +08:00
|
|
|
/*
|
2024-08-05 22:02:25 +08:00
|
|
|
* Copyright (C) 2020-2024 Intel Corporation
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
2018-09-18 15:11:08 +08:00
|
|
|
* SPDX-License-Identifier: MIT
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2020-02-24 05:44:01 +08:00
|
|
|
#include "shared/source/helpers/dirty_state_helpers.h"
|
2019-02-27 18:39:32 +08:00
|
|
|
|
2020-02-24 05:44:01 +08:00
|
|
|
#include "shared/source/indirect_heap/indirect_heap.h"
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
using namespace NEO;
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2018-05-11 20:20:32 +08:00
|
|
|
bool HeapDirtyState::updateAndCheck(const IndirectHeap *heap) {
|
|
|
|
if (!heap->getGraphicsAllocation()) {
|
|
|
|
sizeInPages = 0llu;
|
|
|
|
return true;
|
|
|
|
}
|
2024-08-05 22:02:25 +08:00
|
|
|
|
|
|
|
return updateAndCheck(heap, heap->getHeapGpuBase(), heap->getHeapSizeInPages());
|
|
|
|
}
|
|
|
|
|
|
|
|
bool HeapDirtyState::updateAndCheck(const IndirectHeap *heap, const uint64_t comparedGpuAddress, const size_t comparedSize) {
|
|
|
|
bool dirty = gpuBaseAddress != comparedGpuAddress || sizeInPages != comparedSize;
|
|
|
|
|
2017-12-21 07:45:38 +08:00
|
|
|
if (dirty) {
|
2024-08-05 22:02:25 +08:00
|
|
|
gpuBaseAddress = comparedGpuAddress;
|
|
|
|
sizeInPages = comparedSize;
|
2017-12-21 07:45:38 +08:00
|
|
|
}
|
2024-08-05 22:02:25 +08:00
|
|
|
|
2017-12-21 07:45:38 +08:00
|
|
|
return dirty;
|
2024-08-05 22:02:25 +08:00
|
|
|
}
|