mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-18 22:08:53 +08:00
Make HeapIndex and GraphicsAllocation::origin not specific to Windows.
Change-Id: Ie5a26b45c0b5eff0daf047361d8c992bd3c65ba7
This commit is contained in:
@@ -39,7 +39,7 @@ endif()
|
||||
add_definitions(-DCL_USE_DEPRECATED_OPENCL_1_1_APIS -DCL_USE_DEPRECATED_OPENCL_1_2_APIS -DCL_USE_DEPRECATED_OPENCL_2_0_APIS)
|
||||
|
||||
if(WIN32)
|
||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS -DWDDM_VERSION_NUMBER=23)
|
||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS -DWDDM_VERSION_NUMBER=23 -DNOMINMAX)
|
||||
endif()
|
||||
|
||||
set(CMAKE_C_FLAGS_RELEASEINTERNAL "${CMAKE_C_FLAGS_RELEASE}")
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "runtime/helpers/ptr_math.h"
|
||||
#include "runtime/memory_manager/host_ptr_defines.h"
|
||||
#include "runtime/memory_manager/memory_banks.h"
|
||||
#include "runtime/memory_manager/memory_constants.h"
|
||||
#include "runtime/memory_manager/memory_pool.h"
|
||||
#include "runtime/memory_manager/residency_container.h"
|
||||
#include "runtime/utilities/idlist.h"
|
||||
@@ -30,6 +31,19 @@ enum class AllocationOrigin {
|
||||
INTERNAL_ALLOCATION
|
||||
};
|
||||
|
||||
enum class HeapIndex : uint32_t {
|
||||
HEAP_INTERNAL_DEVICE_MEMORY = 0u,
|
||||
HEAP_INTERNAL = 1u,
|
||||
HEAP_EXTERNAL_DEVICE_MEMORY = 2u,
|
||||
HEAP_EXTERNAL = 3u,
|
||||
HEAP_STANDARD,
|
||||
HEAP_STANDARD64Kb,
|
||||
HEAP_SVM,
|
||||
HEAP_LIMITED
|
||||
};
|
||||
|
||||
constexpr auto internalHeapIndex = is32bit ? HeapIndex::HEAP_INTERNAL : HeapIndex::HEAP_INTERNAL_DEVICE_MEMORY;
|
||||
|
||||
namespace Sharing {
|
||||
constexpr auto nonSharedResource = 0u;
|
||||
}
|
||||
@@ -46,6 +60,7 @@ class GraphicsAllocation : public IDNode<GraphicsAllocation> {
|
||||
void *driverAllocatedCpuPointer = nullptr;
|
||||
DevicesBitfield devicesBitfield = 0;
|
||||
bool flushL3Required = false;
|
||||
AllocationOrigin origin = AllocationOrigin::EXTERNAL_ALLOCATION;
|
||||
|
||||
enum class AllocationType {
|
||||
UNKNOWN = 0,
|
||||
|
||||
@@ -119,12 +119,11 @@ bool Wddm::queryAdapterInfo() {
|
||||
}
|
||||
|
||||
bool Wddm::createPagingQueue() {
|
||||
NTSTATUS status = STATUS_UNSUCCESSFUL;
|
||||
D3DKMT_CREATEPAGINGQUEUE CreatePagingQueue = {0};
|
||||
CreatePagingQueue.hDevice = device;
|
||||
CreatePagingQueue.Priority = D3DDDI_PAGINGQUEUE_PRIORITY_NORMAL;
|
||||
|
||||
status = gdi->createPagingQueue(&CreatePagingQueue);
|
||||
NTSTATUS status = gdi->createPagingQueue(&CreatePagingQueue);
|
||||
|
||||
if (status == STATUS_SUCCESS) {
|
||||
pagingQueue = CreatePagingQueue.hPagingQueue;
|
||||
@@ -301,12 +300,11 @@ bool Wddm::mapGpuVirtualAddress(AllocationStorageData *allocationStorageData) {
|
||||
}
|
||||
|
||||
bool Wddm::mapGpuVirtualAddressImpl(Gmm *gmm, D3DKMT_HANDLE handle, void *cpuPtr, D3DGPU_VIRTUAL_ADDRESS &gpuPtr, HeapIndex heapIndex) {
|
||||
NTSTATUS status = STATUS_SUCCESS;
|
||||
D3DDDI_MAPGPUVIRTUALADDRESS MapGPUVA = {0};
|
||||
D3DDDIGPUVIRTUALADDRESS_PROTECTION_TYPE protectionType = {{{0}}};
|
||||
protectionType.Write = TRUE;
|
||||
|
||||
uint64_t size = static_cast<uint64_t>(gmm->gmmResourceInfo->getSizeAllocation());
|
||||
uint64_t size = gmm->gmmResourceInfo->getSizeAllocation();
|
||||
|
||||
MapGPUVA.hPagingQueue = pagingQueue;
|
||||
MapGPUVA.hAllocation = handle;
|
||||
@@ -347,9 +345,9 @@ bool Wddm::mapGpuVirtualAddressImpl(Gmm *gmm, D3DKMT_HANDLE handle, void *cpuPtr
|
||||
UNRECOVERABLE_IF(hardwareInfoTable[productFamily]->capabilityTable.gpuAddressSpace == MemoryConstants::max48BitAddress);
|
||||
MapGPUVA.MaximumAddress = hardwareInfoTable[productFamily]->capabilityTable.gpuAddressSpace;
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
||||
status = gdi->mapGpuVirtualAddress(&MapGPUVA);
|
||||
NTSTATUS status = gdi->mapGpuVirtualAddress(&MapGPUVA);
|
||||
gpuPtr = GmmHelper::canonize(MapGPUVA.VirtualAddress);
|
||||
|
||||
if (status == STATUS_PENDING) {
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#include "runtime/command_stream/preemption_mode.h"
|
||||
#include "runtime/gmm_helper/gmm_lib.h"
|
||||
#include "runtime/helpers/debug_helpers.h"
|
||||
#include "runtime/memory_manager/memory_constants.h"
|
||||
#include "runtime/os_interface/os_context.h"
|
||||
#include "runtime/utilities/spinlock.h"
|
||||
#include "sku_info.h"
|
||||
@@ -32,6 +31,8 @@ struct KmDafListener;
|
||||
struct MonitoredFence;
|
||||
struct OsHandleStorage;
|
||||
|
||||
enum class HeapIndex : uint32_t;
|
||||
|
||||
using OsContextWin = OsContext::OsContextImpl;
|
||||
|
||||
enum class EvictionStatus {
|
||||
@@ -41,19 +42,6 @@ enum class EvictionStatus {
|
||||
UNKNOWN
|
||||
};
|
||||
|
||||
enum class HeapIndex : uint32_t {
|
||||
HEAP_INTERNAL_DEVICE_MEMORY = 0u,
|
||||
HEAP_INTERNAL = 1u,
|
||||
HEAP_EXTERNAL_DEVICE_MEMORY = 2u,
|
||||
HEAP_EXTERNAL = 3u,
|
||||
HEAP_STANDARD,
|
||||
HEAP_STANDARD64Kb,
|
||||
HEAP_SVM,
|
||||
HEAP_LIMITED
|
||||
};
|
||||
|
||||
constexpr auto internalHeapIndex = is32bit ? HeapIndex::HEAP_INTERNAL : HeapIndex::HEAP_INTERNAL_DEVICE_MEMORY;
|
||||
|
||||
class Wddm {
|
||||
public:
|
||||
typedef HRESULT(WINAPI *CreateDXGIFactoryFcn)(REFIID riid, void **ppFactory);
|
||||
@@ -82,7 +70,7 @@ class Wddm {
|
||||
MOCKABLE_VIRTUAL void *lockResource(WddmAllocation &wddmAllocation);
|
||||
MOCKABLE_VIRTUAL void unlockResource(WddmAllocation &wddmAllocation);
|
||||
MOCKABLE_VIRTUAL void kmDafLock(WddmAllocation *wddmAllocation);
|
||||
MOCKABLE_VIRTUAL bool isKmDafEnabled() { return featureTable->ftrKmdDaf; };
|
||||
MOCKABLE_VIRTUAL bool isKmDafEnabled() const { return featureTable->ftrKmdDaf; }
|
||||
|
||||
MOCKABLE_VIRTUAL bool destroyContext(D3DKMT_HANDLE context);
|
||||
MOCKABLE_VIRTUAL bool queryAdapterInfo();
|
||||
|
||||
@@ -82,7 +82,6 @@ class WddmAllocation : public GraphicsAllocation {
|
||||
void setGpuAddress(uint64_t graphicsAddress) { this->gpuAddress = graphicsAddress; }
|
||||
void setCpuAddress(void *cpuPtr) { this->cpuPtr = cpuPtr; }
|
||||
bool needsMakeResidentBeforeLock = false;
|
||||
AllocationOrigin origin = AllocationOrigin::EXTERNAL_ALLOCATION;
|
||||
|
||||
std::string getAllocationInfoString() const {
|
||||
std::stringstream ss;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2017-2018 Intel Corporation
|
||||
* Copyright (C) 2017-2019 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -11,9 +11,6 @@
|
||||
#pragma warning(disable : 4005)
|
||||
#include <ntstatus.h>
|
||||
#pragma warning(pop)
|
||||
// There is a conflict with max/min defined as macro in windows headers with std::max/std::min
|
||||
#undef min
|
||||
#undef max
|
||||
#undef RegOpenKeyExA
|
||||
#undef RegQueryValueExA
|
||||
#pragma warning(disable : 4273)
|
||||
|
||||
@@ -154,7 +154,7 @@ void WddmMock::kmDafLock(WddmAllocation *allocation) {
|
||||
Wddm::kmDafLock(allocation);
|
||||
}
|
||||
|
||||
bool WddmMock::isKmDafEnabled() {
|
||||
bool WddmMock::isKmDafEnabled() const {
|
||||
return kmDafEnabled;
|
||||
}
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ class WddmMock : public Wddm {
|
||||
void *lockResource(WddmAllocation &allocation) override;
|
||||
void unlockResource(WddmAllocation &allocation) override;
|
||||
void kmDafLock(WddmAllocation *allocation) override;
|
||||
bool isKmDafEnabled() override;
|
||||
bool isKmDafEnabled() const override;
|
||||
void setKmDafEnabled(bool state);
|
||||
void setHwContextId(unsigned long hwContextId);
|
||||
bool openAdapter() override;
|
||||
|
||||
Reference in New Issue
Block a user