fix: Use virtual map calls to gmm only for compressed formats
Signed-off-by: Maciej Plewka <maciej.plewka@intel.com>
This commit is contained in:
parent
0cf975605b
commit
4e91c4b08f
|
@ -7,15 +7,29 @@
|
||||||
|
|
||||||
#include "shared/source/gmm_helper/client_context/gmm_client_context.h"
|
#include "shared/source/gmm_helper/client_context/gmm_client_context.h"
|
||||||
#include "shared/source/gmm_helper/client_context/map_gpu_va_gmm.h"
|
#include "shared/source/gmm_helper/client_context/map_gpu_va_gmm.h"
|
||||||
|
#include "shared/source/gmm_helper/resource_info.h"
|
||||||
|
#include "shared/source/os_interface/windows/gdi_interface.h"
|
||||||
|
|
||||||
namespace NEO {
|
namespace NEO {
|
||||||
uint64_t GmmClientContext::mapGpuVirtualAddress(MapGpuVirtualAddressGmm *pMapGpuVa) {
|
uint64_t GmmClientContext::mapGpuVirtualAddress(MapGpuVirtualAddressGmm *pMapGpuVa) {
|
||||||
GMM_MAPGPUVIRTUALADDRESS gmmMapAddress = {pMapGpuVa->mapGpuVirtualAddressParams, 1, pMapGpuVa->resourceInfoHandle, pMapGpuVa->outVirtualAddress};
|
auto gmmResourceFlags = pMapGpuVa->resourceInfoHandle->getResourceFlags()->Info;
|
||||||
return clientContext->MapGpuVirtualAddress(&gmmMapAddress);
|
if (gmmResourceFlags.MediaCompressed || gmmResourceFlags.RenderCompressed) {
|
||||||
|
auto gmmResourceInfo = pMapGpuVa->resourceInfoHandle->peekGmmResourceInfo();
|
||||||
|
GMM_MAPGPUVIRTUALADDRESS gmmMapAddress = {pMapGpuVa->mapGpuVirtualAddressParams, 1, &gmmResourceInfo, pMapGpuVa->outVirtualAddress};
|
||||||
|
return clientContext->MapGpuVirtualAddress(&gmmMapAddress);
|
||||||
|
} else {
|
||||||
|
return pMapGpuVa->gdi->mapGpuVirtualAddress(pMapGpuVa->mapGpuVirtualAddressParams);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
uint64_t GmmClientContext::freeGpuVirtualAddress(FreeGpuVirtualAddressGmm *pFreeGpuVa) {
|
uint64_t GmmClientContext::freeGpuVirtualAddress(FreeGpuVirtualAddressGmm *pFreeGpuVa) {
|
||||||
GMM_FREEGPUVIRTUALADDRESS gmmFreeAddress = {pFreeGpuVa->hAdapter, pFreeGpuVa->baseAddress, pFreeGpuVa->size, 1, pFreeGpuVa->resourceInfoHandle};
|
auto gmmResourceFlags = pFreeGpuVa->resourceInfoHandle->getResourceFlags()->Info;
|
||||||
return clientContext->FreeGpuVirtualAddress(&gmmFreeAddress);
|
if (gmmResourceFlags.MediaCompressed || gmmResourceFlags.RenderCompressed) {
|
||||||
|
auto gmmResourceInfo = pFreeGpuVa->resourceInfoHandle->peekGmmResourceInfo();
|
||||||
|
GMM_FREEGPUVIRTUALADDRESS gmmFreeAddress = {pFreeGpuVa->hAdapter, pFreeGpuVa->baseAddress, pFreeGpuVa->size, 1, &gmmResourceInfo};
|
||||||
|
return clientContext->FreeGpuVirtualAddress(&gmmFreeAddress);
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace NEO
|
} // namespace NEO
|
||||||
|
|
|
@ -10,23 +10,24 @@
|
||||||
|
|
||||||
namespace NEO {
|
namespace NEO {
|
||||||
class Gdi;
|
class Gdi;
|
||||||
|
class GmmResourceInfo;
|
||||||
|
|
||||||
class MapGpuVirtualAddressGmm {
|
class MapGpuVirtualAddressGmm {
|
||||||
public:
|
public:
|
||||||
MapGpuVirtualAddressGmm(D3DDDI_MAPGPUVIRTUALADDRESS *mapGpuVirtualAddressParams, GMM_RESOURCE_INFO **resourceInfoHandle, D3DGPU_VIRTUAL_ADDRESS *outVirtualAddress, Gdi *gdi) : mapGpuVirtualAddressParams(mapGpuVirtualAddressParams), resourceInfoHandle(resourceInfoHandle), outVirtualAddress(outVirtualAddress), gdi(gdi) {}
|
MapGpuVirtualAddressGmm(D3DDDI_MAPGPUVIRTUALADDRESS *mapGpuVirtualAddressParams, GmmResourceInfo *resourceInfoHandle, D3DGPU_VIRTUAL_ADDRESS *outVirtualAddress, Gdi *gdi) : mapGpuVirtualAddressParams(mapGpuVirtualAddressParams), resourceInfoHandle(resourceInfoHandle), outVirtualAddress(outVirtualAddress), gdi(gdi) {}
|
||||||
D3DDDI_MAPGPUVIRTUALADDRESS *mapGpuVirtualAddressParams;
|
D3DDDI_MAPGPUVIRTUALADDRESS *mapGpuVirtualAddressParams;
|
||||||
GMM_RESOURCE_INFO **resourceInfoHandle;
|
GmmResourceInfo *resourceInfoHandle;
|
||||||
D3DGPU_VIRTUAL_ADDRESS *outVirtualAddress;
|
D3DGPU_VIRTUAL_ADDRESS *outVirtualAddress;
|
||||||
Gdi *gdi;
|
Gdi *gdi;
|
||||||
};
|
};
|
||||||
|
|
||||||
class FreeGpuVirtualAddressGmm {
|
class FreeGpuVirtualAddressGmm {
|
||||||
public:
|
public:
|
||||||
FreeGpuVirtualAddressGmm(D3DKMT_HANDLE hAdapter, D3DGPU_VIRTUAL_ADDRESS baseAddress, D3DGPU_SIZE_T size, GMM_RESOURCE_INFO **resourceInfoHandle, Gdi *gdi) : hAdapter(hAdapter), baseAddress(baseAddress), size(size), resourceInfoHandle(resourceInfoHandle), gdi(gdi) {}
|
FreeGpuVirtualAddressGmm(D3DKMT_HANDLE hAdapter, D3DGPU_VIRTUAL_ADDRESS baseAddress, D3DGPU_SIZE_T size, GmmResourceInfo *resourceInfoHandle, Gdi *gdi) : hAdapter(hAdapter), baseAddress(baseAddress), size(size), resourceInfoHandle(resourceInfoHandle), gdi(gdi) {}
|
||||||
D3DKMT_HANDLE hAdapter;
|
D3DKMT_HANDLE hAdapter;
|
||||||
D3DGPU_VIRTUAL_ADDRESS baseAddress;
|
D3DGPU_VIRTUAL_ADDRESS baseAddress;
|
||||||
D3DGPU_SIZE_T size;
|
D3DGPU_SIZE_T size;
|
||||||
GMM_RESOURCE_INFO **resourceInfoHandle;
|
GmmResourceInfo *resourceInfoHandle;
|
||||||
Gdi *gdi;
|
Gdi *gdi;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -542,8 +542,8 @@ bool Wddm::mapGpuVirtualAddress(Gmm *gmm, D3DKMT_HANDLE handle, D3DGPU_VIRTUAL_A
|
||||||
mapGPUVA.MaximumAddress = maximumAddress;
|
mapGPUVA.MaximumAddress = maximumAddress;
|
||||||
|
|
||||||
applyAdditionalMapGPUVAFields(mapGPUVA, gmm);
|
applyAdditionalMapGPUVAFields(mapGPUVA, gmm);
|
||||||
auto resourceInfo = gmm->gmmResourceInfo->peekGmmResourceInfo();
|
|
||||||
MapGpuVirtualAddressGmm gmmMapGpuVa = {&mapGPUVA, &resourceInfo, &gpuPtr, getGdi()};
|
MapGpuVirtualAddressGmm gmmMapGpuVa = {&mapGPUVA, gmm->gmmResourceInfo.get(), &gpuPtr, getGdi()};
|
||||||
auto status = gmm->getGmmHelper()->getClientContext()->mapGpuVirtualAddress(&gmmMapGpuVa);
|
auto status = gmm->getGmmHelper()->getClientContext()->mapGpuVirtualAddress(&gmmMapGpuVa);
|
||||||
|
|
||||||
auto gmmHelper = gmm->getGmmHelper();
|
auto gmmHelper = gmm->getGmmHelper();
|
||||||
|
@ -597,8 +597,7 @@ NTSTATUS Wddm::reserveGpuVirtualAddress(D3DGPU_VIRTUAL_ADDRESS baseAddress,
|
||||||
|
|
||||||
uint64_t Wddm::freeGmmGpuVirtualAddress(Gmm *gmm, D3DGPU_VIRTUAL_ADDRESS &gpuPtr, uint64_t size) {
|
uint64_t Wddm::freeGmmGpuVirtualAddress(Gmm *gmm, D3DGPU_VIRTUAL_ADDRESS &gpuPtr, uint64_t size) {
|
||||||
uint64_t status = STATUS_SUCCESS;
|
uint64_t status = STATUS_SUCCESS;
|
||||||
auto resourceInfo = gmm->gmmResourceInfo->peekGmmResourceInfo();
|
FreeGpuVirtualAddressGmm freeGpuva = {getAdapter(), rootDeviceEnvironment.getGmmHelper()->decanonize(gpuPtr), size, gmm->gmmResourceInfo.get(), getGdi()};
|
||||||
FreeGpuVirtualAddressGmm freeGpuva = {getAdapter(), rootDeviceEnvironment.getGmmHelper()->decanonize(gpuPtr), size, &resourceInfo, getGdi()};
|
|
||||||
status = gmm->getGmmHelper()->getClientContext()->freeGpuVirtualAddress(&freeGpuva);
|
status = gmm->getGmmHelper()->getClientContext()->freeGpuVirtualAddress(&freeGpuva);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue