mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-08 14:02:58 +08:00
Make residency in graphics allocation OsContext dependent.
- Graphics Allocation now holds residency control per OsContext. Change-Id: Ie0a0d3aa9fdaf542fdd42dee3aba236a5af635c7
This commit is contained in:
committed by
sys_ocldev
parent
c39f9c0c66
commit
78f828fcd1
@@ -1,23 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2017 - 2018, 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"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
@@ -39,6 +24,7 @@ namespace Sharing {
|
||||
constexpr auto nonSharedResource = 0u;
|
||||
}
|
||||
|
||||
constexpr uint32_t maxOsContextCount = 4u;
|
||||
const int ObjectNotResident = -1;
|
||||
const uint32_t ObjectNotUsed = (uint32_t)-1;
|
||||
|
||||
@@ -63,7 +49,7 @@ class GraphicsAllocation : public IDNode<GraphicsAllocation> {
|
||||
uint64_t gpuBaseAddress = 0;
|
||||
Gmm *gmm = nullptr;
|
||||
uint64_t allocationOffset = 0u;
|
||||
int residencyTaskCount = ObjectNotResident;
|
||||
int residencyTaskCount[maxOsContextCount] = {ObjectNotResident};
|
||||
bool cpuPtrAllocated = false; // flag indicating if cpuPtr is driver-allocated
|
||||
|
||||
enum class AllocationType {
|
||||
@@ -145,7 +131,7 @@ class GraphicsAllocation : public IDNode<GraphicsAllocation> {
|
||||
void setEvictable(bool evictable) { this->evictable = evictable; }
|
||||
bool peekEvictable() const { return evictable; }
|
||||
|
||||
bool isResident() const { return residencyTaskCount != ObjectNotResident; }
|
||||
bool isResident(uint32_t contextId) const { return residencyTaskCount[contextId] != ObjectNotResident; }
|
||||
void setLocked(bool locked) { this->locked = locked; }
|
||||
bool isLocked() const { return locked; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user