mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-11 16:45:25 +08:00
Cleanup Wddm interface 2/n
don't pass the entire WddmAllocation to createAllocation methods Change-Id: Ibd4c684a362edbe3b2c520b73b71246fed5a9399 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
fe07ede28d
commit
4605a48170
@@ -402,20 +402,16 @@ bool Wddm::freeGpuVirtualAddress(D3DGPU_VIRTUAL_ADDRESS &gpuPtr, uint64_t size)
|
||||
return status == STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
NTSTATUS Wddm::createAllocation(WddmAllocation *alloc) {
|
||||
NTSTATUS Wddm::createAllocation(const void *alignedCpuPtr, const Gmm *gmm, D3DKMT_HANDLE &outHandle) {
|
||||
NTSTATUS status = STATUS_UNSUCCESSFUL;
|
||||
D3DDDI_ALLOCATIONINFO AllocationInfo = {0};
|
||||
D3DKMT_CREATEALLOCATION CreateAllocation = {0};
|
||||
size_t size;
|
||||
|
||||
if (alloc == nullptr)
|
||||
return false;
|
||||
size = alloc->getAlignedSize();
|
||||
if (size == 0)
|
||||
if (gmm == nullptr)
|
||||
return false;
|
||||
|
||||
AllocationInfo.pSystemMem = alloc->getAlignedCpuPtr();
|
||||
AllocationInfo.pPrivateDriverData = alloc->gmm->gmmResourceInfo->peekHandle();
|
||||
AllocationInfo.pSystemMem = alignedCpuPtr;
|
||||
AllocationInfo.pPrivateDriverData = gmm->gmmResourceInfo->peekHandle();
|
||||
AllocationInfo.PrivateDriverDataSize = static_cast<unsigned int>(sizeof(GMM_RESOURCE_INFO));
|
||||
AllocationInfo.Flags.Primary = 0;
|
||||
|
||||
@@ -429,7 +425,7 @@ NTSTATUS Wddm::createAllocation(WddmAllocation *alloc) {
|
||||
CreateAllocation.Flags.NonSecure = FALSE;
|
||||
CreateAllocation.Flags.CreateShared = FALSE;
|
||||
CreateAllocation.Flags.RestrictSharedAccess = FALSE;
|
||||
CreateAllocation.Flags.CreateResource = alloc->getAlignedCpuPtr() == 0 ? TRUE : FALSE;
|
||||
CreateAllocation.Flags.CreateResource = alignedCpuPtr ? TRUE : FALSE;
|
||||
CreateAllocation.pAllocationInfo = &AllocationInfo;
|
||||
CreateAllocation.hDevice = device;
|
||||
|
||||
@@ -439,19 +435,19 @@ NTSTATUS Wddm::createAllocation(WddmAllocation *alloc) {
|
||||
return status;
|
||||
}
|
||||
|
||||
alloc->handle = AllocationInfo.hAllocation;
|
||||
kmDafListener->notifyWriteTarget(featureTable->ftrKmdDaf, adapter, device, alloc->handle, gdi->escape);
|
||||
outHandle = AllocationInfo.hAllocation;
|
||||
kmDafListener->notifyWriteTarget(featureTable->ftrKmdDaf, adapter, device, outHandle, gdi->escape);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
bool Wddm::createAllocation64k(WddmAllocation *alloc) {
|
||||
bool Wddm::createAllocation64k(const Gmm *gmm, D3DKMT_HANDLE &outHandle) {
|
||||
NTSTATUS status = STATUS_SUCCESS;
|
||||
D3DDDI_ALLOCATIONINFO AllocationInfo = {0};
|
||||
D3DKMT_CREATEALLOCATION CreateAllocation = {0};
|
||||
|
||||
AllocationInfo.pSystemMem = 0;
|
||||
AllocationInfo.pPrivateDriverData = alloc->gmm->gmmResourceInfo->peekHandle();
|
||||
AllocationInfo.pPrivateDriverData = gmm->gmmResourceInfo->peekHandle();
|
||||
AllocationInfo.PrivateDriverDataSize = static_cast<unsigned int>(sizeof(GMM_RESOURCE_INFO));
|
||||
AllocationInfo.Flags.Primary = 0;
|
||||
|
||||
@@ -469,9 +465,9 @@ bool Wddm::createAllocation64k(WddmAllocation *alloc) {
|
||||
return false;
|
||||
}
|
||||
|
||||
alloc->handle = AllocationInfo.hAllocation;
|
||||
outHandle = AllocationInfo.hAllocation;
|
||||
|
||||
kmDafListener->notifyWriteTarget(featureTable->ftrKmdDaf, adapter, device, alloc->handle, gdi->escape);
|
||||
kmDafListener->notifyWriteTarget(featureTable->ftrKmdDaf, adapter, device, outHandle, gdi->escape);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -63,8 +63,8 @@ class Wddm {
|
||||
MOCKABLE_VIRTUAL bool createContext(OsContextWin &osContext);
|
||||
MOCKABLE_VIRTUAL void applyAdditionalContextFlags(CREATECONTEXT_PVTDATA &privateData, OsContextWin &osContext);
|
||||
MOCKABLE_VIRTUAL bool freeGpuVirtualAddress(D3DGPU_VIRTUAL_ADDRESS &gpuPtr, uint64_t size);
|
||||
MOCKABLE_VIRTUAL NTSTATUS createAllocation(WddmAllocation *alloc);
|
||||
MOCKABLE_VIRTUAL bool createAllocation64k(WddmAllocation *alloc);
|
||||
MOCKABLE_VIRTUAL NTSTATUS createAllocation(const void *alignedCpuPtr, const Gmm *gmm, D3DKMT_HANDLE &outHandle);
|
||||
MOCKABLE_VIRTUAL bool createAllocation64k(const Gmm *gmm, D3DKMT_HANDLE &outHandle);
|
||||
MOCKABLE_VIRTUAL NTSTATUS createAllocationsAndMapGpuVa(OsHandleStorage &osHandles);
|
||||
MOCKABLE_VIRTUAL bool destroyAllocations(const D3DKMT_HANDLE *handles, uint32_t allocationCount, D3DKMT_HANDLE resourceHandle);
|
||||
MOCKABLE_VIRTUAL bool openSharedHandle(D3DKMT_HANDLE handle, WddmAllocation *alloc);
|
||||
|
||||
@@ -67,7 +67,7 @@ GraphicsAllocation *WddmMemoryManager::allocateGraphicsMemory64kb(const Allocati
|
||||
auto gmm = new Gmm(nullptr, sizeAligned, false, allocationData.flags.preferRenderCompressed, true, {});
|
||||
wddmAllocation->gmm = gmm;
|
||||
|
||||
if (!wddm->createAllocation64k(wddmAllocation.get())) {
|
||||
if (!wddm->createAllocation64k(gmm, wddmAllocation->handle)) {
|
||||
delete gmm;
|
||||
return nullptr;
|
||||
}
|
||||
@@ -459,10 +459,10 @@ AlignedMallocRestrictions *WddmMemoryManager::getAlignedMallocRestrictions() {
|
||||
}
|
||||
|
||||
bool WddmMemoryManager::createWddmAllocation(WddmAllocation *allocation) {
|
||||
auto wddmSuccess = wddm->createAllocation(allocation);
|
||||
auto wddmSuccess = wddm->createAllocation(allocation->getAlignedCpuPtr(), allocation->gmm, allocation->handle);
|
||||
if (wddmSuccess == STATUS_GRAPHICS_NO_VIDEO_MEMORY && deferredDeleter) {
|
||||
deferredDeleter->drain(true);
|
||||
wddmSuccess = wddm->createAllocation(allocation);
|
||||
wddmSuccess = wddm->createAllocation(allocation->getAlignedCpuPtr(), allocation->gmm, allocation->handle);
|
||||
}
|
||||
|
||||
if (wddmSuccess == STATUS_SUCCESS) {
|
||||
|
||||
Reference in New Issue
Block a user