Move static methods from Gmm to new GmmHelper class
Change-Id: I84fbe94f0e1072324164086b456c71a46ae5040c
This commit is contained in:
parent
a95cca71e4
commit
e18e9fb94e
|
@ -497,7 +497,7 @@ void AUBCommandStreamReceiverHw<GfxFamily>::makeResident(GraphicsAllocation &gfx
|
||||||
template <typename GfxFamily>
|
template <typename GfxFamily>
|
||||||
bool AUBCommandStreamReceiverHw<GfxFamily>::writeMemory(GraphicsAllocation &gfxAllocation) {
|
bool AUBCommandStreamReceiverHw<GfxFamily>::writeMemory(GraphicsAllocation &gfxAllocation) {
|
||||||
auto cpuAddress = gfxAllocation.getUnderlyingBuffer();
|
auto cpuAddress = gfxAllocation.getUnderlyingBuffer();
|
||||||
auto gpuAddress = Gmm::decanonize(gfxAllocation.getGpuAddress());
|
auto gpuAddress = GmmHelper::decanonize(gfxAllocation.getGpuAddress());
|
||||||
auto size = gfxAllocation.getUnderlyingBufferSize();
|
auto size = gfxAllocation.getUnderlyingBufferSize();
|
||||||
auto allocType = gfxAllocation.getAllocationType();
|
auto allocType = gfxAllocation.getAllocationType();
|
||||||
|
|
||||||
|
|
|
@ -41,27 +41,27 @@ CommandStreamReceiver *createCommandStreamImpl(const HardwareInfo *pHwInfo) {
|
||||||
if (csr) {
|
if (csr) {
|
||||||
switch (csr) {
|
switch (csr) {
|
||||||
case CSR_AUB:
|
case CSR_AUB:
|
||||||
Gmm::initContext(pHwInfo->pPlatform,
|
GmmHelper::initContext(pHwInfo->pPlatform,
|
||||||
pHwInfo->pSkuTable,
|
pHwInfo->pSkuTable,
|
||||||
pHwInfo->pWaTable,
|
pHwInfo->pWaTable,
|
||||||
pHwInfo->pSysInfo);
|
pHwInfo->pSysInfo);
|
||||||
commandStreamReceiver = AUBCommandStreamReceiver::create(*pHwInfo, "aubfile", true);
|
commandStreamReceiver = AUBCommandStreamReceiver::create(*pHwInfo, "aubfile", true);
|
||||||
break;
|
break;
|
||||||
case CSR_TBX:
|
case CSR_TBX:
|
||||||
Gmm::initContext(pHwInfo->pPlatform,
|
GmmHelper::initContext(pHwInfo->pPlatform,
|
||||||
pHwInfo->pSkuTable,
|
pHwInfo->pSkuTable,
|
||||||
pHwInfo->pWaTable,
|
pHwInfo->pWaTable,
|
||||||
pHwInfo->pSysInfo);
|
pHwInfo->pSysInfo);
|
||||||
commandStreamReceiver = TbxCommandStreamReceiver::create(*pHwInfo, false);
|
commandStreamReceiver = TbxCommandStreamReceiver::create(*pHwInfo, false);
|
||||||
break;
|
break;
|
||||||
case CSR_HW_WITH_AUB:
|
case CSR_HW_WITH_AUB:
|
||||||
commandStreamReceiver = funcCreate(*pHwInfo, true);
|
commandStreamReceiver = funcCreate(*pHwInfo, true);
|
||||||
break;
|
break;
|
||||||
case CSR_TBX_WITH_AUB:
|
case CSR_TBX_WITH_AUB:
|
||||||
Gmm::initContext(pHwInfo->pPlatform,
|
GmmHelper::initContext(pHwInfo->pPlatform,
|
||||||
pHwInfo->pSkuTable,
|
pHwInfo->pSkuTable,
|
||||||
pHwInfo->pWaTable,
|
pHwInfo->pWaTable,
|
||||||
pHwInfo->pSysInfo);
|
pHwInfo->pSysInfo);
|
||||||
commandStreamReceiver = TbxCommandStreamReceiver::create(*pHwInfo, true);
|
commandStreamReceiver = TbxCommandStreamReceiver::create(*pHwInfo, true);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -26,7 +26,6 @@
|
||||||
#include "runtime/command_stream/command_stream_receiver_with_aub_dump.h"
|
#include "runtime/command_stream/command_stream_receiver_with_aub_dump.h"
|
||||||
#include "runtime/command_stream/device_command_stream.h"
|
#include "runtime/command_stream/device_command_stream.h"
|
||||||
#include "runtime/helpers/debug_helpers.h"
|
#include "runtime/helpers/debug_helpers.h"
|
||||||
#include "runtime/gmm_helper/gmm_helper.h"
|
|
||||||
#include "runtime/os_interface/device_factory.h"
|
#include "runtime/os_interface/device_factory.h"
|
||||||
#include "runtime/helpers/options.h"
|
#include "runtime/helpers/options.h"
|
||||||
#include "runtime/helpers/hw_info.h"
|
#include "runtime/helpers/hw_info.h"
|
||||||
|
|
|
@ -211,7 +211,7 @@ Drm *Drm::create(int32_t deviceOrdinal) {
|
||||||
//turbo patch not present, we are not on custom Kernel, switch to simplified Mocs selection
|
//turbo patch not present, we are not on custom Kernel, switch to simplified Mocs selection
|
||||||
//do this only for GEN9+
|
//do this only for GEN9+
|
||||||
if (device->pHwInfo->pPlatform->eRenderCoreFamily >= IGFX_GEN9_CORE) {
|
if (device->pHwInfo->pPlatform->eRenderCoreFamily >= IGFX_GEN9_CORE) {
|
||||||
Gmm::useSimplifiedMocsTable = true;
|
GmmHelper::useSimplifiedMocsTable = true;
|
||||||
}
|
}
|
||||||
printDebugString(DebugManager.flags.PrintDebugMessages.get(), stderr, "%s", "WARNING: Failed to request OCL Turbo Boost\n");
|
printDebugString(DebugManager.flags.PrintDebugMessages.get(), stderr, "%s", "WARNING: Failed to request OCL Turbo Boost\n");
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,8 @@
|
||||||
|
|
||||||
set(RUNTIME_SRCS_GMM_HELPER_BASE
|
set(RUNTIME_SRCS_GMM_HELPER_BASE
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/gmm.cpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/gmm.h
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/gmm_helper.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/gmm_helper.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/gmm_helper.h
|
${CMAKE_CURRENT_SOURCE_DIR}/gmm_helper.h
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/gmm_lib.h
|
${CMAKE_CURRENT_SOURCE_DIR}/gmm_lib.h
|
||||||
|
|
|
@ -0,0 +1,225 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 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:
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "runtime/gmm_helper/gmm.h"
|
||||||
|
#include "runtime/gmm_helper/gmm_helper.h"
|
||||||
|
#include "runtime/gmm_helper/resource_info.h"
|
||||||
|
#include "runtime/helpers/aligned_memory.h"
|
||||||
|
#include "runtime/helpers/debug_helpers.h"
|
||||||
|
#include "runtime/helpers/ptr_math.h"
|
||||||
|
#include "runtime/helpers/surface_formats.h"
|
||||||
|
#include "runtime/helpers/hw_info.h"
|
||||||
|
|
||||||
|
namespace OCLRT {
|
||||||
|
void Gmm::create() {
|
||||||
|
if (resourceParams.BaseWidth >= GmmHelper::maxPossiblePitch) {
|
||||||
|
resourceParams.Flags.Gpu.NoRestriction = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
gmmResourceInfo.reset(GmmResourceInfo::create(&resourceParams));
|
||||||
|
}
|
||||||
|
|
||||||
|
void Gmm::queryImageParams(ImageInfo &imgInfo, const HardwareInfo &hwInfo) {
|
||||||
|
uint32_t imageWidth = static_cast<uint32_t>(imgInfo.imgDesc->image_width);
|
||||||
|
uint32_t imageHeight = 1;
|
||||||
|
uint32_t imageDepth = 1;
|
||||||
|
uint32_t imageCount = 1;
|
||||||
|
|
||||||
|
switch (imgInfo.imgDesc->image_type) {
|
||||||
|
case CL_MEM_OBJECT_IMAGE1D:
|
||||||
|
case CL_MEM_OBJECT_IMAGE1D_ARRAY:
|
||||||
|
case CL_MEM_OBJECT_IMAGE1D_BUFFER:
|
||||||
|
this->resourceParams.Type = GMM_RESOURCE_TYPE::RESOURCE_1D;
|
||||||
|
break;
|
||||||
|
case CL_MEM_OBJECT_IMAGE2D:
|
||||||
|
case CL_MEM_OBJECT_IMAGE2D_ARRAY:
|
||||||
|
this->resourceParams.Type = GMM_RESOURCE_TYPE::RESOURCE_2D;
|
||||||
|
imageHeight = static_cast<uint32_t>(imgInfo.imgDesc->image_height);
|
||||||
|
break;
|
||||||
|
case CL_MEM_OBJECT_IMAGE3D:
|
||||||
|
this->resourceParams.Type = GMM_RESOURCE_TYPE::RESOURCE_3D;
|
||||||
|
imageHeight = static_cast<uint32_t>(imgInfo.imgDesc->image_height);
|
||||||
|
imageDepth = static_cast<uint32_t>(imgInfo.imgDesc->image_depth);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (imgInfo.imgDesc->image_type == CL_MEM_OBJECT_IMAGE1D_ARRAY ||
|
||||||
|
imgInfo.imgDesc->image_type == CL_MEM_OBJECT_IMAGE2D_ARRAY) {
|
||||||
|
imageCount = static_cast<uint32_t>(imgInfo.imgDesc->image_array_size);
|
||||||
|
}
|
||||||
|
|
||||||
|
this->resourceParams.Flags.Info.Linear = 1;
|
||||||
|
if (GmmHelper::allowTiling(*imgInfo.imgDesc)) {
|
||||||
|
this->resourceParams.Flags.Info.TiledY = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
this->resourceParams.NoGfxMemory = 1; // dont allocate, only query for params
|
||||||
|
|
||||||
|
this->resourceParams.Usage = GMM_RESOURCE_USAGE_TYPE::GMM_RESOURCE_USAGE_OCL_IMAGE;
|
||||||
|
this->resourceParams.Format = imgInfo.surfaceFormat->GMMSurfaceFormat;
|
||||||
|
this->resourceParams.Flags.Gpu.Texture = 1;
|
||||||
|
this->resourceParams.BaseWidth = imageWidth;
|
||||||
|
this->resourceParams.BaseHeight = imageHeight;
|
||||||
|
this->resourceParams.Depth = imageDepth;
|
||||||
|
this->resourceParams.ArraySize = imageCount;
|
||||||
|
this->resourceParams.Flags.Wa.__ForceOtherHVALIGN4 = 1;
|
||||||
|
this->resourceParams.MaxLod = imgInfo.baseMipLevel + imgInfo.mipCount;
|
||||||
|
if (imgInfo.imgDesc->image_row_pitch && imgInfo.imgDesc->mem_object) {
|
||||||
|
this->resourceParams.OverridePitch = (uint32_t)imgInfo.imgDesc->image_row_pitch;
|
||||||
|
this->resourceParams.Flags.Info.AllowVirtualPadding = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
applyAuxFlags(imgInfo, hwInfo);
|
||||||
|
|
||||||
|
this->gmmResourceInfo.reset(GmmResourceInfo::create(&this->resourceParams));
|
||||||
|
|
||||||
|
imgInfo.size = this->gmmResourceInfo->getSizeAllocation();
|
||||||
|
|
||||||
|
imgInfo.rowPitch = this->gmmResourceInfo->getRenderPitch();
|
||||||
|
if (imgInfo.rowPitch == 0) { // WA
|
||||||
|
imgInfo.rowPitch = alignUp(this->gmmResourceInfo->getBaseWidth(), this->gmmResourceInfo->getHAlign());
|
||||||
|
imgInfo.rowPitch = imgInfo.rowPitch * (this->gmmResourceInfo->getBitsPerPixel() >> 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
// calculate slice pitch
|
||||||
|
if ((this->resourceParams.Type == GMM_RESOURCE_TYPE::RESOURCE_2D ||
|
||||||
|
this->resourceParams.Type == GMM_RESOURCE_TYPE::RESOURCE_1D) &&
|
||||||
|
imageCount == 1) {
|
||||||
|
// 2D or 1D or 1Darray with array_size=1
|
||||||
|
imgInfo.slicePitch = imgInfo.size;
|
||||||
|
} else {
|
||||||
|
// 3D Image or 2D-Array or 1D-Arrays (array_size>1)
|
||||||
|
GMM_REQ_OFFSET_INFO reqOffsetInfo = {};
|
||||||
|
reqOffsetInfo.ReqRender = 1;
|
||||||
|
reqOffsetInfo.Slice = 1;
|
||||||
|
reqOffsetInfo.ArrayIndex = (imageCount > 1) ? 1 : 0;
|
||||||
|
|
||||||
|
this->gmmResourceInfo->getOffset(reqOffsetInfo);
|
||||||
|
imgInfo.slicePitch = reqOffsetInfo.Render.Offset;
|
||||||
|
imgInfo.slicePitch += imgInfo.rowPitch * reqOffsetInfo.Render.YOffset;
|
||||||
|
imgInfo.slicePitch += reqOffsetInfo.Render.XOffset;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (imgInfo.plane != GMM_NO_PLANE) {
|
||||||
|
GMM_REQ_OFFSET_INFO reqOffsetInfo = {};
|
||||||
|
reqOffsetInfo.ReqRender = 1;
|
||||||
|
reqOffsetInfo.Slice = 0;
|
||||||
|
reqOffsetInfo.ArrayIndex = 0;
|
||||||
|
reqOffsetInfo.Plane = imgInfo.plane;
|
||||||
|
this->gmmResourceInfo->getOffset(reqOffsetInfo);
|
||||||
|
imgInfo.xOffset = reqOffsetInfo.Render.XOffset / (this->gmmResourceInfo->getBitsPerPixel() / 8);
|
||||||
|
imgInfo.yOffset = reqOffsetInfo.Render.YOffset;
|
||||||
|
imgInfo.offset = reqOffsetInfo.Render.Offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (imgInfo.surfaceFormat->GMMSurfaceFormat == GMM_FORMAT_NV12) {
|
||||||
|
GMM_REQ_OFFSET_INFO reqOffsetInfo = {};
|
||||||
|
reqOffsetInfo.ReqLock = 1;
|
||||||
|
reqOffsetInfo.Slice = 1;
|
||||||
|
reqOffsetInfo.ArrayIndex = 0;
|
||||||
|
reqOffsetInfo.Plane = GMM_PLANE_U;
|
||||||
|
this->gmmResourceInfo->getOffset(reqOffsetInfo);
|
||||||
|
imgInfo.yOffsetForUVPlane = reqOffsetInfo.Lock.Offset / reqOffsetInfo.Lock.Pitch;
|
||||||
|
}
|
||||||
|
|
||||||
|
imgInfo.qPitch = queryQPitch(hwInfo.pPlatform->eRenderCoreFamily, this->resourceParams.Type);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t Gmm::queryQPitch(GFXCORE_FAMILY gfxFamily, GMM_RESOURCE_TYPE resType) {
|
||||||
|
if (gfxFamily == IGFX_GEN8_CORE && resType == GMM_RESOURCE_TYPE::RESOURCE_3D) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return gmmResourceInfo->getQPitch();
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t Gmm::getRenderHAlignment() {
|
||||||
|
return GmmHelper::getRenderAlignment(gmmResourceInfo->getHAlign());
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t Gmm::getRenderVAlignment() {
|
||||||
|
return GmmHelper::getRenderAlignment(gmmResourceInfo->getVAlign());
|
||||||
|
}
|
||||||
|
|
||||||
|
void Gmm::updateImgInfo(ImageInfo &imgInfo, cl_image_desc &imgDesc, cl_uint arrayIndex) {
|
||||||
|
imgDesc.image_width = gmmResourceInfo->getBaseWidth();
|
||||||
|
imgDesc.image_row_pitch = gmmResourceInfo->getRenderPitch();
|
||||||
|
if (imgDesc.image_row_pitch == 0) {
|
||||||
|
size_t width = alignUp(imgDesc.image_width, gmmResourceInfo->getHAlign());
|
||||||
|
imgDesc.image_row_pitch = width * (gmmResourceInfo->getBitsPerPixel() >> 3);
|
||||||
|
}
|
||||||
|
imgDesc.image_height = gmmResourceInfo->getBaseHeight();
|
||||||
|
imgDesc.image_depth = gmmResourceInfo->getBaseDepth();
|
||||||
|
imgDesc.image_array_size = gmmResourceInfo->getArraySize();
|
||||||
|
if (imgDesc.image_depth > 1 || imgDesc.image_array_size > 1) {
|
||||||
|
GMM_REQ_OFFSET_INFO reqOffsetInfo = {};
|
||||||
|
reqOffsetInfo.Slice = imgDesc.image_depth > 1 ? 1 : 0;
|
||||||
|
reqOffsetInfo.ArrayIndex = imgDesc.image_array_size > 1 ? 1 : 0;
|
||||||
|
reqOffsetInfo.ReqLock = 1;
|
||||||
|
gmmResourceInfo->getOffset(reqOffsetInfo);
|
||||||
|
imgDesc.image_slice_pitch = static_cast<size_t>(reqOffsetInfo.Lock.Offset);
|
||||||
|
} else {
|
||||||
|
imgDesc.image_slice_pitch = gmmResourceInfo->getSizeAllocation();
|
||||||
|
}
|
||||||
|
|
||||||
|
GMM_REQ_OFFSET_INFO reqOffsetInfo = {};
|
||||||
|
reqOffsetInfo.ReqRender = 1;
|
||||||
|
reqOffsetInfo.Slice = 0;
|
||||||
|
reqOffsetInfo.ArrayIndex = arrayIndex;
|
||||||
|
reqOffsetInfo.Plane = imgInfo.plane;
|
||||||
|
gmmResourceInfo->getOffset(reqOffsetInfo);
|
||||||
|
imgInfo.xOffset = reqOffsetInfo.Render.XOffset / (gmmResourceInfo->getBitsPerPixel() / 8);
|
||||||
|
imgInfo.yOffset = reqOffsetInfo.Render.YOffset;
|
||||||
|
imgInfo.offset = reqOffsetInfo.Render.Offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t Gmm::resourceCopyBlt(void *sys, void *gpu, uint32_t pitch, uint32_t height, unsigned char upload, OCLPlane plane) {
|
||||||
|
GMM_RES_COPY_BLT gmmResourceCopyBLT = {};
|
||||||
|
|
||||||
|
if (plane == OCLPlane::PLANE_V) {
|
||||||
|
sys = ptrOffset(sys, height * pitch * 2);
|
||||||
|
pitch /= 2;
|
||||||
|
} else if (plane == OCLPlane::PLANE_U) {
|
||||||
|
sys = ptrOffset(sys, height * pitch * 2 + height * pitch / 2);
|
||||||
|
pitch /= 2;
|
||||||
|
} else if (plane == OCLPlane::PLANE_UV) {
|
||||||
|
sys = ptrOffset(sys, height * pitch * 2);
|
||||||
|
}
|
||||||
|
uint32_t size = pitch * height;
|
||||||
|
|
||||||
|
gmmResourceCopyBLT.Sys.pData = sys;
|
||||||
|
gmmResourceCopyBLT.Gpu.pData = gpu;
|
||||||
|
gmmResourceCopyBLT.Sys.RowPitch = pitch;
|
||||||
|
gmmResourceCopyBLT.Blt.Upload = upload;
|
||||||
|
gmmResourceCopyBLT.Sys.BufferSize = size;
|
||||||
|
|
||||||
|
return this->gmmResourceInfo->cpuBlt(&gmmResourceCopyBLT);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Gmm::unifiedAuxTranslationCapable() const {
|
||||||
|
auto gmmFlags = this->gmmResourceInfo->getResourceFlags();
|
||||||
|
return gmmFlags->Gpu.CCS && gmmFlags->Gpu.UnifiedAuxSurface && gmmFlags->Info.RenderCompressed;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace OCLRT
|
|
@ -0,0 +1,58 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 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:
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
#include <cstdint>
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <memory>
|
||||||
|
#include "runtime/gmm_helper/gmm_lib.h"
|
||||||
|
#include "runtime/api/cl_types.h"
|
||||||
|
|
||||||
|
namespace OCLRT {
|
||||||
|
enum class OCLPlane;
|
||||||
|
struct HardwareInfo;
|
||||||
|
struct ImageInfo;
|
||||||
|
class GmmResourceInfo;
|
||||||
|
|
||||||
|
class Gmm {
|
||||||
|
public:
|
||||||
|
virtual ~Gmm() = default;
|
||||||
|
|
||||||
|
void create();
|
||||||
|
void queryImageParams(ImageInfo &imgInfo, const HardwareInfo &hwInfo);
|
||||||
|
|
||||||
|
uint32_t getRenderHAlignment();
|
||||||
|
uint32_t getRenderVAlignment();
|
||||||
|
|
||||||
|
void applyAuxFlags(ImageInfo &imgInfo, const HardwareInfo &hwInfo);
|
||||||
|
bool unifiedAuxTranslationCapable() const;
|
||||||
|
|
||||||
|
uint32_t queryQPitch(GFXCORE_FAMILY gfxFamily, GMM_RESOURCE_TYPE resType);
|
||||||
|
void updateImgInfo(ImageInfo &imgInfo, cl_image_desc &imgDesc, cl_uint arrayIndex);
|
||||||
|
uint8_t resourceCopyBlt(void *sys, void *gpu, uint32_t pitch, uint32_t height, unsigned char upload, OCLPlane plane);
|
||||||
|
|
||||||
|
GMM_RESCREATE_PARAMS resourceParams = {};
|
||||||
|
std::unique_ptr<GmmResourceInfo> gmmResourceInfo;
|
||||||
|
|
||||||
|
bool isRenderCompressed = false;
|
||||||
|
};
|
||||||
|
} // namespace OCLRT
|
|
@ -20,31 +20,23 @@
|
||||||
* OTHER DEALINGS IN THE SOFTWARE.
|
* OTHER DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "runtime/gmm_helper/gmm.h"
|
||||||
#include "runtime/gmm_helper/gmm_helper.h"
|
#include "runtime/gmm_helper/gmm_helper.h"
|
||||||
#include "runtime/gmm_helper/resource_info.h"
|
#include "runtime/gmm_helper/resource_info.h"
|
||||||
#include "runtime/helpers/get_info.h"
|
#include "runtime/helpers/get_info.h"
|
||||||
#include "runtime/helpers/aligned_memory.h"
|
#include "runtime/helpers/aligned_memory.h"
|
||||||
#include "runtime/helpers/debug_helpers.h"
|
#include "runtime/helpers/debug_helpers.h"
|
||||||
#include "runtime/helpers/ptr_math.h"
|
|
||||||
#include "runtime/memory_manager/graphics_allocation.h"
|
#include "runtime/memory_manager/graphics_allocation.h"
|
||||||
#include "runtime/helpers/surface_formats.h"
|
#include "runtime/helpers/surface_formats.h"
|
||||||
#include "runtime/helpers/hw_info.h"
|
#include "runtime/helpers/hw_info.h"
|
||||||
#include "runtime/sku_info/operations/sku_info_transfer.h"
|
#include "runtime/sku_info/operations/sku_info_transfer.h"
|
||||||
|
|
||||||
namespace OCLRT {
|
namespace OCLRT {
|
||||||
void Gmm::create() {
|
bool GmmHelper::initContext(const PLATFORM *pPlatform,
|
||||||
if (resourceParams.BaseWidth >= maxPossiblePitch) {
|
const FeatureTable *pSkuTable,
|
||||||
resourceParams.Flags.Gpu.NoRestriction = 1;
|
const WorkaroundTable *pWaTable,
|
||||||
}
|
const GT_SYSTEM_INFO *pGtSysInfo) {
|
||||||
|
if (!GmmHelper::gmmClientContext) {
|
||||||
gmmResourceInfo.reset(GmmResourceInfo::create(&resourceParams));
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Gmm::initContext(const PLATFORM *pPlatform,
|
|
||||||
const FeatureTable *pSkuTable,
|
|
||||||
const WorkaroundTable *pWaTable,
|
|
||||||
const GT_SYSTEM_INFO *pGtSysInfo) {
|
|
||||||
if (!Gmm::gmmClientContext) {
|
|
||||||
_SKU_FEATURE_TABLE gmmFtrTable = {};
|
_SKU_FEATURE_TABLE gmmFtrTable = {};
|
||||||
_WA_TABLE gmmWaTable = {};
|
_WA_TABLE gmmWaTable = {};
|
||||||
SkuInfoTransfer::transferFtrTableForGmm(&gmmFtrTable, pSkuTable);
|
SkuInfoTransfer::transferFtrTableForGmm(&gmmFtrTable, pSkuTable);
|
||||||
|
@ -54,20 +46,20 @@ bool Gmm::initContext(const PLATFORM *pPlatform,
|
||||||
}
|
}
|
||||||
bool success = GMM_SUCCESS == initGlobalContextFunc(*pPlatform, &gmmFtrTable, &gmmWaTable, pGtSysInfo, GMM_CLIENT::GMM_OCL_VISTA);
|
bool success = GMM_SUCCESS == initGlobalContextFunc(*pPlatform, &gmmFtrTable, &gmmWaTable, pGtSysInfo, GMM_CLIENT::GMM_OCL_VISTA);
|
||||||
UNRECOVERABLE_IF(!success);
|
UNRECOVERABLE_IF(!success);
|
||||||
Gmm::gmmClientContext = createClientContextFunc(GMM_CLIENT::GMM_OCL_VISTA);
|
GmmHelper::gmmClientContext = GmmHelper::createClientContextFunc(GMM_CLIENT::GMM_OCL_VISTA);
|
||||||
}
|
}
|
||||||
return Gmm::gmmClientContext != nullptr;
|
return GmmHelper::gmmClientContext != nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Gmm::destroyContext() {
|
void GmmHelper::destroyContext() {
|
||||||
if (Gmm::gmmClientContext) {
|
if (GmmHelper::gmmClientContext) {
|
||||||
deleteClientContextFunc(Gmm::gmmClientContext);
|
deleteClientContextFunc(GmmHelper::gmmClientContext);
|
||||||
Gmm::gmmClientContext = nullptr;
|
GmmHelper::gmmClientContext = nullptr;
|
||||||
destroyGlobalContextFunc();
|
destroyGlobalContextFunc();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t Gmm::getMOCS(uint32_t type) {
|
uint32_t GmmHelper::getMOCS(uint32_t type) {
|
||||||
if (useSimplifiedMocsTable) {
|
if (useSimplifiedMocsTable) {
|
||||||
if (type == GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED) {
|
if (type == GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED) {
|
||||||
return cacheDisabledIndex;
|
return cacheDisabledIndex;
|
||||||
|
@ -76,12 +68,12 @@ uint32_t Gmm::getMOCS(uint32_t type) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MEMORY_OBJECT_CONTROL_STATE mocs = Gmm::gmmClientContext->CachePolicyGetMemoryObject(nullptr, static_cast<GMM_RESOURCE_USAGE_TYPE>(type));
|
MEMORY_OBJECT_CONTROL_STATE mocs = GmmHelper::gmmClientContext->CachePolicyGetMemoryObject(nullptr, static_cast<GMM_RESOURCE_USAGE_TYPE>(type));
|
||||||
|
|
||||||
return static_cast<uint32_t>(mocs.DwordValue);
|
return static_cast<uint32_t>(mocs.DwordValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
Gmm *Gmm::create(const void *alignedPtr, size_t alignedSize, bool uncacheable) {
|
Gmm *GmmHelper::create(const void *alignedPtr, size_t alignedSize, bool uncacheable) {
|
||||||
auto gmm = new Gmm();
|
auto gmm = new Gmm();
|
||||||
|
|
||||||
gmm->resourceParams.Type = RESOURCE_BUFFER;
|
gmm->resourceParams.Type = RESOURCE_BUFFER;
|
||||||
|
@ -109,128 +101,19 @@ Gmm *Gmm::create(const void *alignedPtr, size_t alignedSize, bool uncacheable) {
|
||||||
return gmm;
|
return gmm;
|
||||||
}
|
}
|
||||||
|
|
||||||
Gmm *Gmm::create(GMM_RESOURCE_INFO *inputGmm) {
|
Gmm *GmmHelper::create(GMM_RESOURCE_INFO *inputGmm) {
|
||||||
auto gmm = new Gmm();
|
auto gmm = new Gmm();
|
||||||
gmm->gmmResourceInfo.reset(GmmResourceInfo::create(inputGmm));
|
gmm->gmmResourceInfo.reset(GmmResourceInfo::create(inputGmm));
|
||||||
return gmm;
|
return gmm;
|
||||||
}
|
}
|
||||||
|
|
||||||
Gmm *Gmm::createGmmAndQueryImgParams(ImageInfo &imgInfo, const HardwareInfo &hwInfo) {
|
Gmm *GmmHelper::createGmmAndQueryImgParams(ImageInfo &imgInfo, const HardwareInfo &hwInfo) {
|
||||||
Gmm *gmm = new Gmm();
|
Gmm *gmm = new Gmm();
|
||||||
gmm->queryImageParams(imgInfo, hwInfo);
|
gmm->queryImageParams(imgInfo, hwInfo);
|
||||||
return gmm;
|
return gmm;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Gmm::queryImageParams(ImageInfo &imgInfo, const HardwareInfo &hwInfo) {
|
void GmmHelper::queryImgFromBufferParams(ImageInfo &imgInfo, GraphicsAllocation *gfxAlloc) {
|
||||||
uint32_t imageWidth = static_cast<uint32_t>(imgInfo.imgDesc->image_width);
|
|
||||||
uint32_t imageHeight = 1;
|
|
||||||
uint32_t imageDepth = 1;
|
|
||||||
uint32_t imageCount = 1;
|
|
||||||
|
|
||||||
switch (imgInfo.imgDesc->image_type) {
|
|
||||||
case CL_MEM_OBJECT_IMAGE1D:
|
|
||||||
case CL_MEM_OBJECT_IMAGE1D_ARRAY:
|
|
||||||
case CL_MEM_OBJECT_IMAGE1D_BUFFER:
|
|
||||||
this->resourceParams.Type = GMM_RESOURCE_TYPE::RESOURCE_1D;
|
|
||||||
break;
|
|
||||||
case CL_MEM_OBJECT_IMAGE2D:
|
|
||||||
case CL_MEM_OBJECT_IMAGE2D_ARRAY:
|
|
||||||
this->resourceParams.Type = GMM_RESOURCE_TYPE::RESOURCE_2D;
|
|
||||||
imageHeight = static_cast<uint32_t>(imgInfo.imgDesc->image_height);
|
|
||||||
break;
|
|
||||||
case CL_MEM_OBJECT_IMAGE3D:
|
|
||||||
this->resourceParams.Type = GMM_RESOURCE_TYPE::RESOURCE_3D;
|
|
||||||
imageHeight = static_cast<uint32_t>(imgInfo.imgDesc->image_height);
|
|
||||||
imageDepth = static_cast<uint32_t>(imgInfo.imgDesc->image_depth);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (imgInfo.imgDesc->image_type == CL_MEM_OBJECT_IMAGE1D_ARRAY ||
|
|
||||||
imgInfo.imgDesc->image_type == CL_MEM_OBJECT_IMAGE2D_ARRAY) {
|
|
||||||
imageCount = static_cast<uint32_t>(imgInfo.imgDesc->image_array_size);
|
|
||||||
}
|
|
||||||
|
|
||||||
this->resourceParams.Flags.Info.Linear = 1;
|
|
||||||
if (allowTiling(*imgInfo.imgDesc)) {
|
|
||||||
this->resourceParams.Flags.Info.TiledY = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
this->resourceParams.NoGfxMemory = 1; // dont allocate, only query for params
|
|
||||||
|
|
||||||
this->resourceParams.Usage = GMM_RESOURCE_USAGE_TYPE::GMM_RESOURCE_USAGE_OCL_IMAGE;
|
|
||||||
this->resourceParams.Format = imgInfo.surfaceFormat->GMMSurfaceFormat;
|
|
||||||
this->resourceParams.Flags.Gpu.Texture = 1;
|
|
||||||
this->resourceParams.BaseWidth = imageWidth;
|
|
||||||
this->resourceParams.BaseHeight = imageHeight;
|
|
||||||
this->resourceParams.Depth = imageDepth;
|
|
||||||
this->resourceParams.ArraySize = imageCount;
|
|
||||||
this->resourceParams.Flags.Wa.__ForceOtherHVALIGN4 = 1;
|
|
||||||
this->resourceParams.MaxLod = imgInfo.baseMipLevel + imgInfo.mipCount;
|
|
||||||
if (imgInfo.imgDesc->image_row_pitch && imgInfo.imgDesc->mem_object) {
|
|
||||||
this->resourceParams.OverridePitch = (uint32_t)imgInfo.imgDesc->image_row_pitch;
|
|
||||||
this->resourceParams.Flags.Info.AllowVirtualPadding = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
applyAuxFlags(imgInfo, hwInfo);
|
|
||||||
|
|
||||||
this->gmmResourceInfo.reset(GmmResourceInfo::create(&this->resourceParams));
|
|
||||||
|
|
||||||
imgInfo.size = this->gmmResourceInfo->getSizeAllocation();
|
|
||||||
|
|
||||||
imgInfo.rowPitch = this->gmmResourceInfo->getRenderPitch();
|
|
||||||
if (imgInfo.rowPitch == 0) { // WA
|
|
||||||
imgInfo.rowPitch = alignUp(this->gmmResourceInfo->getBaseWidth(), this->gmmResourceInfo->getHAlign());
|
|
||||||
imgInfo.rowPitch = imgInfo.rowPitch * (this->gmmResourceInfo->getBitsPerPixel() >> 3);
|
|
||||||
}
|
|
||||||
|
|
||||||
// calculate slice pitch
|
|
||||||
if ((this->resourceParams.Type == GMM_RESOURCE_TYPE::RESOURCE_2D ||
|
|
||||||
this->resourceParams.Type == GMM_RESOURCE_TYPE::RESOURCE_1D) &&
|
|
||||||
imageCount == 1) {
|
|
||||||
// 2D or 1D or 1Darray with array_size=1
|
|
||||||
imgInfo.slicePitch = imgInfo.size;
|
|
||||||
} else {
|
|
||||||
// 3D Image or 2D-Array or 1D-Arrays (array_size>1)
|
|
||||||
GMM_REQ_OFFSET_INFO reqOffsetInfo = {};
|
|
||||||
reqOffsetInfo.ReqRender = 1;
|
|
||||||
reqOffsetInfo.Slice = 1;
|
|
||||||
reqOffsetInfo.ArrayIndex = (imageCount > 1) ? 1 : 0;
|
|
||||||
|
|
||||||
this->gmmResourceInfo->getOffset(reqOffsetInfo);
|
|
||||||
imgInfo.slicePitch = reqOffsetInfo.Render.Offset;
|
|
||||||
imgInfo.slicePitch += imgInfo.rowPitch * reqOffsetInfo.Render.YOffset;
|
|
||||||
imgInfo.slicePitch += reqOffsetInfo.Render.XOffset;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (imgInfo.plane != GMM_NO_PLANE) {
|
|
||||||
GMM_REQ_OFFSET_INFO reqOffsetInfo = {};
|
|
||||||
reqOffsetInfo.ReqRender = 1;
|
|
||||||
reqOffsetInfo.Slice = 0;
|
|
||||||
reqOffsetInfo.ArrayIndex = 0;
|
|
||||||
reqOffsetInfo.Plane = imgInfo.plane;
|
|
||||||
this->gmmResourceInfo->getOffset(reqOffsetInfo);
|
|
||||||
imgInfo.xOffset = reqOffsetInfo.Render.XOffset / (this->gmmResourceInfo->getBitsPerPixel() / 8);
|
|
||||||
imgInfo.yOffset = reqOffsetInfo.Render.YOffset;
|
|
||||||
imgInfo.offset = reqOffsetInfo.Render.Offset;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (imgInfo.surfaceFormat->GMMSurfaceFormat == GMM_FORMAT_NV12) {
|
|
||||||
GMM_REQ_OFFSET_INFO reqOffsetInfo = {};
|
|
||||||
reqOffsetInfo.ReqLock = 1;
|
|
||||||
reqOffsetInfo.Slice = 1;
|
|
||||||
reqOffsetInfo.ArrayIndex = 0;
|
|
||||||
reqOffsetInfo.Plane = GMM_PLANE_U;
|
|
||||||
this->gmmResourceInfo->getOffset(reqOffsetInfo);
|
|
||||||
imgInfo.yOffsetForUVPlane = reqOffsetInfo.Lock.Offset / reqOffsetInfo.Lock.Pitch;
|
|
||||||
}
|
|
||||||
|
|
||||||
imgInfo.qPitch = queryQPitch(hwInfo.pPlatform->eRenderCoreFamily, this->resourceParams.Type);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Gmm::queryImgFromBufferParams(ImageInfo &imgInfo, GraphicsAllocation *gfxAlloc) {
|
|
||||||
// 1D or 2D from buffer
|
// 1D or 2D from buffer
|
||||||
if (imgInfo.imgDesc->image_row_pitch > 0) {
|
if (imgInfo.imgDesc->image_row_pitch > 0) {
|
||||||
imgInfo.rowPitch = imgInfo.imgDesc->image_row_pitch;
|
imgInfo.rowPitch = imgInfo.imgDesc->image_row_pitch;
|
||||||
|
@ -242,7 +125,7 @@ void Gmm::queryImgFromBufferParams(ImageInfo &imgInfo, GraphicsAllocation *gfxAl
|
||||||
imgInfo.qPitch = 0;
|
imgInfo.qPitch = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Gmm::allowTiling(const cl_image_desc &imageDesc) {
|
bool GmmHelper::allowTiling(const cl_image_desc &imageDesc) {
|
||||||
// consider returning tiling type instead of bool
|
// consider returning tiling type instead of bool
|
||||||
if (DebugManager.flags.ForceLinearImages.get()) {
|
if (DebugManager.flags.ForceLinearImages.get()) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -260,30 +143,15 @@ bool Gmm::allowTiling(const cl_image_desc &imageDesc) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t Gmm::canonize(uint64_t address) {
|
uint64_t GmmHelper::canonize(uint64_t address) {
|
||||||
return ((int64_t)((address & 0xFFFFFFFFFFFF) << (64 - 48))) >> (64 - 48);
|
return ((int64_t)((address & 0xFFFFFFFFFFFF) << (64 - 48))) >> (64 - 48);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t Gmm::decanonize(uint64_t address) {
|
uint64_t GmmHelper::decanonize(uint64_t address) {
|
||||||
return (uint64_t)(address & 0xFFFFFFFFFFFF);
|
return (uint64_t)(address & 0xFFFFFFFFFFFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t Gmm::queryQPitch(GFXCORE_FAMILY gfxFamily, GMM_RESOURCE_TYPE resType) {
|
uint32_t GmmHelper::getRenderAlignment(uint32_t alignment) {
|
||||||
if (gfxFamily == IGFX_GEN8_CORE && resType == GMM_RESOURCE_TYPE::RESOURCE_3D) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return gmmResourceInfo->getQPitch();
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t Gmm::getRenderHAlignment() {
|
|
||||||
return getRenderAlignment(gmmResourceInfo->getHAlign());
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t Gmm::getRenderVAlignment() {
|
|
||||||
return getRenderAlignment(gmmResourceInfo->getVAlign());
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t Gmm::getRenderAlignment(uint32_t alignment) {
|
|
||||||
uint32_t returnAlign = 0;
|
uint32_t returnAlign = 0;
|
||||||
if (alignment == 8) {
|
if (alignment == 8) {
|
||||||
returnAlign = 2;
|
returnAlign = 2;
|
||||||
|
@ -295,7 +163,7 @@ uint32_t Gmm::getRenderAlignment(uint32_t alignment) {
|
||||||
return returnAlign;
|
return returnAlign;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t Gmm::getRenderTileMode(uint32_t tileWalk) {
|
uint32_t GmmHelper::getRenderTileMode(uint32_t tileWalk) {
|
||||||
uint32_t tileMode = 0; // TILE_MODE_LINEAR
|
uint32_t tileMode = 0; // TILE_MODE_LINEAR
|
||||||
if (tileWalk == 0) {
|
if (tileWalk == 0) {
|
||||||
tileMode = 2; // TILE_MODE_XMAJOR;
|
tileMode = 2; // TILE_MODE_XMAJOR;
|
||||||
|
@ -307,7 +175,7 @@ uint32_t Gmm::getRenderTileMode(uint32_t tileWalk) {
|
||||||
return tileMode;
|
return tileMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t Gmm::getRenderMultisamplesCount(uint32_t numSamples) {
|
uint32_t GmmHelper::getRenderMultisamplesCount(uint32_t numSamples) {
|
||||||
if (numSamples == 2) {
|
if (numSamples == 2) {
|
||||||
return 1;
|
return 1;
|
||||||
} else if (numSamples == 4) {
|
} else if (numSamples == 4) {
|
||||||
|
@ -320,7 +188,7 @@ uint32_t Gmm::getRenderMultisamplesCount(uint32_t numSamples) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
GMM_YUV_PLANE Gmm::convertPlane(OCLPlane oclPlane) {
|
GMM_YUV_PLANE GmmHelper::convertPlane(OCLPlane oclPlane) {
|
||||||
if (oclPlane == OCLPlane::PLANE_Y) {
|
if (oclPlane == OCLPlane::PLANE_Y) {
|
||||||
return GMM_PLANE_Y;
|
return GMM_PLANE_Y;
|
||||||
} else if (oclPlane == OCLPlane::PLANE_U || oclPlane == OCLPlane::PLANE_UV) {
|
} else if (oclPlane == OCLPlane::PLANE_U || oclPlane == OCLPlane::PLANE_UV) {
|
||||||
|
@ -332,68 +200,8 @@ GMM_YUV_PLANE Gmm::convertPlane(OCLPlane oclPlane) {
|
||||||
return GMM_NO_PLANE;
|
return GMM_NO_PLANE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Gmm::updateImgInfo(ImageInfo &imgInfo, cl_image_desc &imgDesc, cl_uint arrayIndex) {
|
bool GmmHelper::useSimplifiedMocsTable = false;
|
||||||
imgDesc.image_width = gmmResourceInfo->getBaseWidth();
|
GMM_CLIENT_CONTEXT *GmmHelper::gmmClientContext = nullptr;
|
||||||
imgDesc.image_row_pitch = gmmResourceInfo->getRenderPitch();
|
bool GmmHelper::isLoaded = false;
|
||||||
if (imgDesc.image_row_pitch == 0) {
|
|
||||||
size_t width = alignUp(imgDesc.image_width, gmmResourceInfo->getHAlign());
|
|
||||||
imgDesc.image_row_pitch = width * (gmmResourceInfo->getBitsPerPixel() >> 3);
|
|
||||||
}
|
|
||||||
imgDesc.image_height = gmmResourceInfo->getBaseHeight();
|
|
||||||
imgDesc.image_depth = gmmResourceInfo->getBaseDepth();
|
|
||||||
imgDesc.image_array_size = gmmResourceInfo->getArraySize();
|
|
||||||
if (imgDesc.image_depth > 1 || imgDesc.image_array_size > 1) {
|
|
||||||
GMM_REQ_OFFSET_INFO reqOffsetInfo = {};
|
|
||||||
reqOffsetInfo.Slice = imgDesc.image_depth > 1 ? 1 : 0;
|
|
||||||
reqOffsetInfo.ArrayIndex = imgDesc.image_array_size > 1 ? 1 : 0;
|
|
||||||
reqOffsetInfo.ReqLock = 1;
|
|
||||||
gmmResourceInfo->getOffset(reqOffsetInfo);
|
|
||||||
imgDesc.image_slice_pitch = static_cast<size_t>(reqOffsetInfo.Lock.Offset);
|
|
||||||
} else {
|
|
||||||
imgDesc.image_slice_pitch = gmmResourceInfo->getSizeAllocation();
|
|
||||||
}
|
|
||||||
|
|
||||||
GMM_REQ_OFFSET_INFO reqOffsetInfo = {};
|
|
||||||
reqOffsetInfo.ReqRender = 1;
|
|
||||||
reqOffsetInfo.Slice = 0;
|
|
||||||
reqOffsetInfo.ArrayIndex = arrayIndex;
|
|
||||||
reqOffsetInfo.Plane = imgInfo.plane;
|
|
||||||
gmmResourceInfo->getOffset(reqOffsetInfo);
|
|
||||||
imgInfo.xOffset = reqOffsetInfo.Render.XOffset / (gmmResourceInfo->getBitsPerPixel() / 8);
|
|
||||||
imgInfo.yOffset = reqOffsetInfo.Render.YOffset;
|
|
||||||
imgInfo.offset = reqOffsetInfo.Render.Offset;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t Gmm::resourceCopyBlt(void *sys, void *gpu, uint32_t pitch, uint32_t height, unsigned char upload, OCLPlane plane) {
|
|
||||||
GMM_RES_COPY_BLT gmmResourceCopyBLT = {};
|
|
||||||
|
|
||||||
if (plane == OCLPlane::PLANE_V) {
|
|
||||||
sys = ptrOffset(sys, height * pitch * 2);
|
|
||||||
pitch /= 2;
|
|
||||||
} else if (plane == OCLPlane::PLANE_U) {
|
|
||||||
sys = ptrOffset(sys, height * pitch * 2 + height * pitch / 2);
|
|
||||||
pitch /= 2;
|
|
||||||
} else if (plane == OCLPlane::PLANE_UV) {
|
|
||||||
sys = ptrOffset(sys, height * pitch * 2);
|
|
||||||
}
|
|
||||||
uint32_t size = pitch * height;
|
|
||||||
|
|
||||||
gmmResourceCopyBLT.Sys.pData = sys;
|
|
||||||
gmmResourceCopyBLT.Gpu.pData = gpu;
|
|
||||||
gmmResourceCopyBLT.Sys.RowPitch = pitch;
|
|
||||||
gmmResourceCopyBLT.Blt.Upload = upload;
|
|
||||||
gmmResourceCopyBLT.Sys.BufferSize = size;
|
|
||||||
|
|
||||||
return this->gmmResourceInfo->cpuBlt(&gmmResourceCopyBLT);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Gmm::unifiedAuxTranslationCapable() const {
|
|
||||||
auto gmmFlags = this->gmmResourceInfo->getResourceFlags();
|
|
||||||
return gmmFlags->Gpu.CCS && gmmFlags->Gpu.UnifiedAuxSurface && gmmFlags->Info.RenderCompressed;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Gmm::useSimplifiedMocsTable = false;
|
|
||||||
GMM_CLIENT_CONTEXT *Gmm::gmmClientContext = nullptr;
|
|
||||||
bool Gmm::isLoaded = false;
|
|
||||||
|
|
||||||
} // namespace OCLRT
|
} // namespace OCLRT
|
||||||
|
|
|
@ -28,76 +28,46 @@
|
||||||
#include "runtime/api/cl_types.h"
|
#include "runtime/api/cl_types.h"
|
||||||
|
|
||||||
namespace OCLRT {
|
namespace OCLRT {
|
||||||
|
enum class OCLPlane;
|
||||||
struct HardwareInfo;
|
struct HardwareInfo;
|
||||||
struct FeatureTable;
|
struct FeatureTable;
|
||||||
struct WorkaroundTable;
|
struct WorkaroundTable;
|
||||||
struct ImageInfo;
|
struct ImageInfo;
|
||||||
class GraphicsAllocation;
|
class GraphicsAllocation;
|
||||||
class GmmResourceInfo;
|
class Gmm;
|
||||||
|
|
||||||
enum OCLPlane {
|
class GmmHelper {
|
||||||
NO_PLANE = 0,
|
|
||||||
PLANE_Y,
|
|
||||||
PLANE_U,
|
|
||||||
PLANE_V,
|
|
||||||
PLANE_UV
|
|
||||||
};
|
|
||||||
|
|
||||||
constexpr uint32_t cacheDisabledIndex = 0;
|
|
||||||
constexpr uint32_t cacheEnabledIndex = 4;
|
|
||||||
|
|
||||||
class Gmm {
|
|
||||||
public:
|
public:
|
||||||
static const uint32_t maxPossiblePitch = 2147483648;
|
GmmHelper() = delete;
|
||||||
|
static constexpr uint32_t cacheDisabledIndex = 0;
|
||||||
|
static constexpr uint32_t cacheEnabledIndex = 4;
|
||||||
|
static constexpr uint32_t maxPossiblePitch = 2147483648;
|
||||||
|
|
||||||
virtual ~Gmm() = default;
|
static Gmm *createGmmAndQueryImgParams(ImageInfo &imgInfo, const HardwareInfo &hwInfo);
|
||||||
|
|
||||||
void create();
|
|
||||||
static Gmm *create(const void *alignedPtr, size_t alignedSize, bool uncacheable);
|
static Gmm *create(const void *alignedPtr, size_t alignedSize, bool uncacheable);
|
||||||
static Gmm *create(GMM_RESOURCE_INFO *inputGmm);
|
static Gmm *create(GMM_RESOURCE_INFO *inputGmm);
|
||||||
|
|
||||||
static bool initContext(const PLATFORM *pPlatform, const FeatureTable *pSkuTable, const WorkaroundTable *pWaTable, const GT_SYSTEM_INFO *pGtSysInfo);
|
|
||||||
static void loadLib();
|
static void loadLib();
|
||||||
|
static bool initContext(const PLATFORM *pPlatform, const FeatureTable *pSkuTable, const WorkaroundTable *pWaTable, const GT_SYSTEM_INFO *pGtSysInfo);
|
||||||
static void destroyContext();
|
static void destroyContext();
|
||||||
|
|
||||||
static uint32_t getMOCS(uint32_t type);
|
|
||||||
|
|
||||||
void queryImageParams(ImageInfo &imgInfo, const HardwareInfo &hwInfo);
|
|
||||||
|
|
||||||
static Gmm *createGmmAndQueryImgParams(ImageInfo &imgInfo, const HardwareInfo &hwInfo);
|
|
||||||
|
|
||||||
static void queryImgFromBufferParams(ImageInfo &imgInfo, GraphicsAllocation *gfxAlloc);
|
|
||||||
|
|
||||||
static bool allowTiling(const cl_image_desc &imageDesc);
|
|
||||||
|
|
||||||
static uint64_t canonize(uint64_t address);
|
static uint64_t canonize(uint64_t address);
|
||||||
static uint64_t decanonize(uint64_t address);
|
static uint64_t decanonize(uint64_t address);
|
||||||
|
|
||||||
|
static uint32_t getMOCS(uint32_t type);
|
||||||
|
static void queryImgFromBufferParams(ImageInfo &imgInfo, GraphicsAllocation *gfxAlloc);
|
||||||
static GMM_CUBE_FACE_ENUM getCubeFaceIndex(uint32_t target);
|
static GMM_CUBE_FACE_ENUM getCubeFaceIndex(uint32_t target);
|
||||||
|
static bool allowTiling(const cl_image_desc &imageDesc);
|
||||||
static uint32_t getRenderTileMode(uint32_t tileWalk);
|
static uint32_t getRenderTileMode(uint32_t tileWalk);
|
||||||
|
static uint32_t getRenderAlignment(uint32_t alignment);
|
||||||
static uint32_t getRenderMultisamplesCount(uint32_t numSamples);
|
static uint32_t getRenderMultisamplesCount(uint32_t numSamples);
|
||||||
static GMM_YUV_PLANE convertPlane(OCLPlane oclPlane);
|
static GMM_YUV_PLANE convertPlane(OCLPlane oclPlane);
|
||||||
|
|
||||||
uint32_t getRenderHAlignment();
|
|
||||||
uint32_t getRenderVAlignment();
|
|
||||||
static uint32_t getRenderAlignment(uint32_t alignment);
|
|
||||||
void applyAuxFlags(ImageInfo &imgInfo, const HardwareInfo &hwInfo);
|
|
||||||
bool unifiedAuxTranslationCapable() const;
|
|
||||||
|
|
||||||
uint32_t queryQPitch(GFXCORE_FAMILY gfxFamily, GMM_RESOURCE_TYPE resType);
|
|
||||||
|
|
||||||
void updateImgInfo(ImageInfo &imgInfo, cl_image_desc &imgDesc, cl_uint arrayIndex);
|
|
||||||
uint8_t resourceCopyBlt(void *sys, void *gpu, uint32_t pitch, uint32_t height, unsigned char upload, OCLPlane plane);
|
|
||||||
|
|
||||||
GMM_RESCREATE_PARAMS resourceParams = {};
|
|
||||||
std::unique_ptr<GmmResourceInfo> gmmResourceInfo;
|
|
||||||
|
|
||||||
static decltype(&GmmInitGlobalContext) initGlobalContextFunc;
|
static decltype(&GmmInitGlobalContext) initGlobalContextFunc;
|
||||||
static decltype(&GmmDestroyGlobalContext) destroyGlobalContextFunc;
|
static decltype(&GmmDestroyGlobalContext) destroyGlobalContextFunc;
|
||||||
static decltype(&GmmCreateClientContext) createClientContextFunc;
|
static decltype(&GmmCreateClientContext) createClientContextFunc;
|
||||||
static decltype(&GmmDeleteClientContext) deleteClientContextFunc;
|
static decltype(&GmmDeleteClientContext) deleteClientContextFunc;
|
||||||
|
|
||||||
bool isRenderCompressed = false;
|
|
||||||
static bool useSimplifiedMocsTable;
|
static bool useSimplifiedMocsTable;
|
||||||
static GMM_CLIENT_CONTEXT *gmmClientContext;
|
static GMM_CLIENT_CONTEXT *gmmClientContext;
|
||||||
static bool isLoaded;
|
static bool isLoaded;
|
||||||
|
|
|
@ -33,7 +33,7 @@ bool GmmMemoryBase::configureDeviceAddressSpace(GMM_ESCAPE_HANDLE hAdapter,
|
||||||
BOOLEAN BDWL3Coherency,
|
BOOLEAN BDWL3Coherency,
|
||||||
GMM_GFX_SIZE_T SizeOverride,
|
GMM_GFX_SIZE_T SizeOverride,
|
||||||
GMM_GFX_SIZE_T SlmGfxSpaceReserve) {
|
GMM_GFX_SIZE_T SlmGfxSpaceReserve) {
|
||||||
return Gmm::gmmClientContext->ConfigureDeviceAddressSpace(
|
return GmmHelper::gmmClientContext->ConfigureDeviceAddressSpace(
|
||||||
{hAdapter},
|
{hAdapter},
|
||||||
{hDevice},
|
{hDevice},
|
||||||
{pfnEscape},
|
{pfnEscape},
|
||||||
|
@ -46,7 +46,7 @@ bool GmmMemoryBase::configureDeviceAddressSpace(GMM_ESCAPE_HANDLE hAdapter,
|
||||||
}
|
}
|
||||||
|
|
||||||
uintptr_t GmmMemoryBase::getInternalGpuVaRangeLimit() {
|
uintptr_t GmmMemoryBase::getInternalGpuVaRangeLimit() {
|
||||||
return static_cast<uintptr_t>(Gmm::gmmClientContext->GetInternalGpuVaRangeLimit());
|
return static_cast<uintptr_t>(GmmHelper::gmmClientContext->GetInternalGpuVaRangeLimit());
|
||||||
}
|
}
|
||||||
|
|
||||||
}; // namespace OCLRT
|
}; // namespace OCLRT
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
* OTHER DEALINGS IN THE SOFTWARE.
|
* OTHER DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "runtime/gmm_helper/gmm_helper.h"
|
#include "runtime/gmm_helper/gmm.h"
|
||||||
#include "runtime/helpers/hw_info.h"
|
#include "runtime/helpers/hw_info.h"
|
||||||
#include "runtime/helpers/surface_formats.h"
|
#include "runtime/helpers/surface_formats.h"
|
||||||
|
|
||||||
|
|
|
@ -25,11 +25,11 @@
|
||||||
|
|
||||||
namespace OCLRT {
|
namespace OCLRT {
|
||||||
void GmmPageTableMngr::customDeleter(GMM_PAGETABLE_MGR *gmmPageTableManager) {
|
void GmmPageTableMngr::customDeleter(GMM_PAGETABLE_MGR *gmmPageTableManager) {
|
||||||
Gmm::gmmClientContext->DestroyPageTblMgrObject(gmmPageTableManager);
|
GmmHelper::gmmClientContext->DestroyPageTblMgrObject(gmmPageTableManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
GmmPageTableMngr::GmmPageTableMngr(GMM_DEVICE_CALLBACKS_INT *deviceCb, unsigned int translationTableFlags, GMM_TRANSLATIONTABLE_CALLBACKS *translationTableCb) {
|
GmmPageTableMngr::GmmPageTableMngr(GMM_DEVICE_CALLBACKS_INT *deviceCb, unsigned int translationTableFlags, GMM_TRANSLATIONTABLE_CALLBACKS *translationTableCb) {
|
||||||
auto pageTableMngrPtr = Gmm::gmmClientContext->CreatePageTblMgrObject(deviceCb, translationTableCb, translationTableFlags);
|
auto pageTableMngrPtr = GmmHelper::gmmClientContext->CreatePageTblMgrObject(deviceCb, translationTableCb, translationTableFlags);
|
||||||
this->pageTableManager = UniquePtrType(pageTableMngrPtr, GmmPageTableMngr::customDeleter);
|
this->pageTableManager = UniquePtrType(pageTableMngrPtr, GmmPageTableMngr::customDeleter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,16 +25,16 @@
|
||||||
|
|
||||||
namespace OCLRT {
|
namespace OCLRT {
|
||||||
void GmmResourceInfo::customDeleter(GMM_RESOURCE_INFO *gmmResourceInfo) {
|
void GmmResourceInfo::customDeleter(GMM_RESOURCE_INFO *gmmResourceInfo) {
|
||||||
Gmm::gmmClientContext->DestroyResInfoObject(gmmResourceInfo);
|
GmmHelper::gmmClientContext->DestroyResInfoObject(gmmResourceInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
GmmResourceInfo::GmmResourceInfo(GMM_RESCREATE_PARAMS *resourceCreateParams) {
|
GmmResourceInfo::GmmResourceInfo(GMM_RESCREATE_PARAMS *resourceCreateParams) {
|
||||||
auto resourceInfoPtr = Gmm::gmmClientContext->CreateResInfoObject(resourceCreateParams);
|
auto resourceInfoPtr = GmmHelper::gmmClientContext->CreateResInfoObject(resourceCreateParams);
|
||||||
this->resourceInfo = UniquePtrType(resourceInfoPtr, GmmResourceInfo::customDeleter);
|
this->resourceInfo = UniquePtrType(resourceInfoPtr, GmmResourceInfo::customDeleter);
|
||||||
}
|
}
|
||||||
|
|
||||||
GmmResourceInfo::GmmResourceInfo(GMM_RESOURCE_INFO *inputGmmResourceInfo) {
|
GmmResourceInfo::GmmResourceInfo(GMM_RESOURCE_INFO *inputGmmResourceInfo) {
|
||||||
auto resourceInfoPtr = Gmm::gmmClientContext->CopyResInfoObject(inputGmmResourceInfo);
|
auto resourceInfoPtr = GmmHelper::gmmClientContext->CopyResInfoObject(inputGmmResourceInfo);
|
||||||
this->resourceInfo = UniquePtrType(resourceInfoPtr, GmmResourceInfo::customDeleter);
|
this->resourceInfo = UniquePtrType(resourceInfoPtr, GmmResourceInfo::customDeleter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
#include "runtime/helpers/mipmap.h"
|
#include "runtime/helpers/mipmap.h"
|
||||||
|
|
||||||
#include "runtime/gmm_helper/gmm_helper.h"
|
#include "runtime/gmm_helper/gmm.h"
|
||||||
#include "runtime/gmm_helper/resource_info.h"
|
#include "runtime/gmm_helper/resource_info.h"
|
||||||
#include "runtime/mem_obj/image.h"
|
#include "runtime/mem_obj/image.h"
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,7 @@ void StateBaseAddressHelper<GfxFamily>::programStateBaseAddress(
|
||||||
pCmd->setInstructionBufferSize(MemoryConstants::sizeOf4GBinPageEntities);
|
pCmd->setInstructionBufferSize(MemoryConstants::sizeOf4GBinPageEntities);
|
||||||
|
|
||||||
//set cache settings
|
//set cache settings
|
||||||
pCmd->setStatelessDataPortAccessMemoryObjectControlState(Gmm::getMOCS(statelessMocsIndex));
|
pCmd->setStatelessDataPortAccessMemoryObjectControlState(GmmHelper::getMOCS(statelessMocsIndex));
|
||||||
pCmd->setInstructionMemoryObjectControlState(Gmm::getMOCS(GMM_RESOURCE_USAGE_OCL_STATE_HEAP_BUFFER));
|
pCmd->setInstructionMemoryObjectControlState(GmmHelper::getMOCS(GMM_RESOURCE_USAGE_OCL_STATE_HEAP_BUFFER));
|
||||||
}
|
}
|
||||||
} // namespace OCLRT
|
} // namespace OCLRT
|
||||||
|
|
|
@ -201,6 +201,14 @@ enum GFX3DSTATE_SURFACEFORMAT : unsigned short {
|
||||||
NUM_GFX3DSTATE_SURFACEFORMATS
|
NUM_GFX3DSTATE_SURFACEFORMATS
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum class OCLPlane {
|
||||||
|
NO_PLANE = 0,
|
||||||
|
PLANE_Y,
|
||||||
|
PLANE_U,
|
||||||
|
PLANE_V,
|
||||||
|
PLANE_UV
|
||||||
|
};
|
||||||
|
|
||||||
struct SurfaceFormatInfo {
|
struct SurfaceFormatInfo {
|
||||||
cl_image_format OCLImageFormat;
|
cl_image_format OCLImageFormat;
|
||||||
GMM_RESOURCE_FORMAT GMMSurfaceFormat;
|
GMM_RESOURCE_FORMAT GMMSurfaceFormat;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2017, Intel Corporation
|
* Copyright (c) 2017 - 2018, Intel Corporation
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
|
@ -73,9 +73,9 @@ void BufferHw<GfxFamily>::setArgStateful(void *memory) {
|
||||||
|
|
||||||
if ((isAligned<MemoryConstants::cacheLineSize>(bufferAddress) && isAligned<MemoryConstants::cacheLineSize>(bufferSize)) ||
|
if ((isAligned<MemoryConstants::cacheLineSize>(bufferAddress) && isAligned<MemoryConstants::cacheLineSize>(bufferSize)) ||
|
||||||
((getFlags() & CL_MEM_READ_ONLY)) != 0) {
|
((getFlags() & CL_MEM_READ_ONLY)) != 0) {
|
||||||
surfaceState->setMemoryObjectControlState(Gmm::getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER));
|
surfaceState->setMemoryObjectControlState(GmmHelper::getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER));
|
||||||
} else {
|
} else {
|
||||||
surfaceState->setMemoryObjectControlState(Gmm::getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED));
|
surfaceState->setMemoryObjectControlState(GmmHelper::getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED));
|
||||||
}
|
}
|
||||||
|
|
||||||
surfaceState->setCoherencyType(RENDER_SURFACE_STATE::COHERENCY_TYPE_IA_COHERENT);
|
surfaceState->setCoherencyType(RENDER_SURFACE_STATE::COHERENCY_TYPE_IA_COHERENT);
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
#include "runtime/mem_obj/buffer.h"
|
#include "runtime/mem_obj/buffer.h"
|
||||||
#include "runtime/memory_manager/memory_manager.h"
|
#include "runtime/memory_manager/memory_manager.h"
|
||||||
#include "runtime/os_interface/debug_settings_manager.h"
|
#include "runtime/os_interface/debug_settings_manager.h"
|
||||||
|
#include "runtime/gmm_helper/gmm.h"
|
||||||
#include "runtime/gmm_helper/gmm_helper.h"
|
#include "runtime/gmm_helper/gmm_helper.h"
|
||||||
#include "runtime/gmm_helper/resource_info.h"
|
#include "runtime/gmm_helper/resource_info.h"
|
||||||
#include "igfxfmid.h"
|
#include "igfxfmid.h"
|
||||||
|
@ -190,7 +191,7 @@ Image *Image::create(Context *context,
|
||||||
|
|
||||||
auto hostPtrRowPitch = imageDesc->image_row_pitch ? imageDesc->image_row_pitch : imageWidth * surfaceFormat->ImageElementSizeInBytes;
|
auto hostPtrRowPitch = imageDesc->image_row_pitch ? imageDesc->image_row_pitch : imageWidth * surfaceFormat->ImageElementSizeInBytes;
|
||||||
auto hostPtrSlicePitch = imageDesc->image_slice_pitch ? imageDesc->image_slice_pitch : hostPtrRowPitch * imageHeight;
|
auto hostPtrSlicePitch = imageDesc->image_slice_pitch ? imageDesc->image_slice_pitch : hostPtrRowPitch * imageHeight;
|
||||||
auto isTilingAllowed = context->isSharedContext ? false : Gmm::allowTiling(*imageDesc);
|
auto isTilingAllowed = context->isSharedContext ? false : GmmHelper::allowTiling(*imageDesc);
|
||||||
imgInfo.preferRenderCompression = isTilingAllowed;
|
imgInfo.preferRenderCompression = isTilingAllowed;
|
||||||
|
|
||||||
bool zeroCopy = false;
|
bool zeroCopy = false;
|
||||||
|
@ -205,7 +206,7 @@ Image *Image::create(Context *context,
|
||||||
hostPtr = parentBuffer->getHostPtr();
|
hostPtr = parentBuffer->getHostPtr();
|
||||||
hostPtrToSet = const_cast<void *>(hostPtr);
|
hostPtrToSet = const_cast<void *>(hostPtr);
|
||||||
parentBuffer->incRefInternal();
|
parentBuffer->incRefInternal();
|
||||||
Gmm::queryImgFromBufferParams(imgInfo, memory);
|
GmmHelper::queryImgFromBufferParams(imgInfo, memory);
|
||||||
|
|
||||||
UNRECOVERABLE_IF(imgInfo.offset != 0);
|
UNRECOVERABLE_IF(imgInfo.offset != 0);
|
||||||
imgInfo.offset = parentBuffer->getOffset();
|
imgInfo.offset = parentBuffer->getOffset();
|
||||||
|
@ -213,7 +214,7 @@ Image *Image::create(Context *context,
|
||||||
if (memoryManager->peekVirtualPaddingSupport() && (imageDesc->image_type == CL_MEM_OBJECT_IMAGE2D)) {
|
if (memoryManager->peekVirtualPaddingSupport() && (imageDesc->image_type == CL_MEM_OBJECT_IMAGE2D)) {
|
||||||
// Retrieve sizes from GMM and apply virtual padding if buffer storage is not big enough
|
// Retrieve sizes from GMM and apply virtual padding if buffer storage is not big enough
|
||||||
auto queryGmmImgInfo(imgInfo);
|
auto queryGmmImgInfo(imgInfo);
|
||||||
std::unique_ptr<Gmm> gmm(Gmm::createGmmAndQueryImgParams(queryGmmImgInfo, hwInfo));
|
std::unique_ptr<Gmm> gmm(GmmHelper::createGmmAndQueryImgParams(queryGmmImgInfo, hwInfo));
|
||||||
auto gmmAllocationSize = gmm->gmmResourceInfo->getSizeAllocation();
|
auto gmmAllocationSize = gmm->gmmResourceInfo->getSizeAllocation();
|
||||||
if (gmmAllocationSize > memory->getUnderlyingBufferSize()) {
|
if (gmmAllocationSize > memory->getUnderlyingBufferSize()) {
|
||||||
memory = memoryManager->createGraphicsAllocationWithPadding(memory, gmmAllocationSize);
|
memory = memoryManager->createGraphicsAllocationWithPadding(memory, gmmAllocationSize);
|
||||||
|
@ -399,7 +400,7 @@ Image *Image::createSharedImage(Context *context, SharingHandler *sharingHandler
|
||||||
GraphicsAllocation *graphicsAllocation, GraphicsAllocation *mcsAllocation,
|
GraphicsAllocation *graphicsAllocation, GraphicsAllocation *mcsAllocation,
|
||||||
cl_mem_flags flags, ImageInfo &imgInfo, uint32_t cubeFaceIndex, uint32_t baseMipLevel, uint32_t mipCount) {
|
cl_mem_flags flags, ImageInfo &imgInfo, uint32_t cubeFaceIndex, uint32_t baseMipLevel, uint32_t mipCount) {
|
||||||
auto tileWalk = graphicsAllocation->gmm->gmmResourceInfo->getTileType();
|
auto tileWalk = graphicsAllocation->gmm->gmmResourceInfo->getTileType();
|
||||||
auto tileMode = Gmm::getRenderTileMode(tileWalk);
|
auto tileMode = GmmHelper::getRenderTileMode(tileWalk);
|
||||||
bool isTiledImage = tileMode ? true : false;
|
bool isTiledImage = tileMode ? true : false;
|
||||||
|
|
||||||
auto sharedImage = createImageHw(context, flags, graphicsAllocation->getUnderlyingBufferSize(),
|
auto sharedImage = createImageHw(context, flags, graphicsAllocation->getUnderlyingBufferSize(),
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include "runtime/helpers/surface_formats.h"
|
#include "runtime/helpers/surface_formats.h"
|
||||||
#include "runtime/helpers/aligned_memory.h"
|
#include "runtime/helpers/aligned_memory.h"
|
||||||
#include "runtime/mem_obj/image.h"
|
#include "runtime/mem_obj/image.h"
|
||||||
|
#include "runtime/gmm_helper/gmm.h"
|
||||||
#include "runtime/gmm_helper/gmm_helper.h"
|
#include "runtime/gmm_helper/gmm_helper.h"
|
||||||
#include "runtime/gmm_helper/resource_info.h"
|
#include "runtime/gmm_helper/resource_info.h"
|
||||||
|
|
||||||
|
@ -148,11 +149,11 @@ void ImageHw<GfxFamily>::setImageArg(void *memory, bool setAsMediaBlockImage, ui
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
auto tileWalk = gmm->gmmResourceInfo->getTileType();
|
auto tileWalk = gmm->gmmResourceInfo->getTileType();
|
||||||
tileMode = static_cast<typename RENDER_SURFACE_STATE::TILE_MODE>(Gmm::getRenderTileMode(tileWalk));
|
tileMode = static_cast<typename RENDER_SURFACE_STATE::TILE_MODE>(GmmHelper::getRenderTileMode(tileWalk));
|
||||||
}
|
}
|
||||||
surfaceState->setTileMode(tileMode);
|
surfaceState->setTileMode(tileMode);
|
||||||
|
|
||||||
surfaceState->setMemoryObjectControlState(Gmm::getMOCS(GMM_RESOURCE_USAGE_OCL_IMAGE));
|
surfaceState->setMemoryObjectControlState(GmmHelper::getMOCS(GMM_RESOURCE_USAGE_OCL_IMAGE));
|
||||||
|
|
||||||
surfaceState->setXOffset(this->surfaceOffsets.xOffset);
|
surfaceState->setXOffset(this->surfaceOffsets.xOffset);
|
||||||
surfaceState->setYOffset(this->surfaceOffsets.yOffset);
|
surfaceState->setYOffset(this->surfaceOffsets.yOffset);
|
||||||
|
@ -240,7 +241,7 @@ void ImageHw<GfxFamily>::setMediaImageArg(void *memory) {
|
||||||
|
|
||||||
setSurfaceMemoryObjectControlStateIndexToMocsTable(
|
setSurfaceMemoryObjectControlStateIndexToMocsTable(
|
||||||
reinterpret_cast<void *>(surfaceState),
|
reinterpret_cast<void *>(surfaceState),
|
||||||
Gmm::getMOCS(GMM_RESOURCE_USAGE_OCL_IMAGE));
|
GmmHelper::getMOCS(GMM_RESOURCE_USAGE_OCL_IMAGE));
|
||||||
|
|
||||||
if (IsNV12Image(&this->getImageFormat())) {
|
if (IsNV12Image(&this->getImageFormat())) {
|
||||||
surfaceState->setInterleaveChroma(true);
|
surfaceState->setInterleaveChroma(true);
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
* OTHER DEALINGS IN THE SOFTWARE.
|
* OTHER DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "runtime/gmm_helper/gmm_helper.h"
|
#include "runtime/gmm_helper/gmm.h"
|
||||||
#include "runtime/gmm_helper/resource_info.h"
|
#include "runtime/gmm_helper/resource_info.h"
|
||||||
#include "runtime/memory_manager/deferred_deleter.h"
|
#include "runtime/memory_manager/deferred_deleter.h"
|
||||||
#include "runtime/memory_manager/memory_manager.h"
|
#include "runtime/memory_manager/memory_manager.h"
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
|
|
||||||
#include "runtime/helpers/basic_math.h"
|
#include "runtime/helpers/basic_math.h"
|
||||||
#include "runtime/helpers/aligned_memory.h"
|
#include "runtime/helpers/aligned_memory.h"
|
||||||
|
#include "runtime/gmm_helper/gmm.h"
|
||||||
#include "runtime/gmm_helper/gmm_helper.h"
|
#include "runtime/gmm_helper/gmm_helper.h"
|
||||||
#include "runtime/memory_manager/os_agnostic_memory_manager.h"
|
#include "runtime/memory_manager/os_agnostic_memory_manager.h"
|
||||||
#include "runtime/helpers/options.h"
|
#include "runtime/helpers/options.h"
|
||||||
|
@ -75,9 +76,9 @@ GraphicsAllocation *OsAgnosticMemoryManager::allocate32BitGraphicsMemory(size_t
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
uint64_t offset = static_cast<uint64_t>(reinterpret_cast<uintptr_t>(ptr) & MemoryConstants::pageMask);
|
uint64_t offset = static_cast<uint64_t>(reinterpret_cast<uintptr_t>(ptr) & MemoryConstants::pageMask);
|
||||||
MemoryAllocation *memAlloc = new MemoryAllocation(false, reinterpret_cast<void *>(ptr), Gmm::canonize(gpuVirtualAddress + offset), size, counter);
|
MemoryAllocation *memAlloc = new MemoryAllocation(false, reinterpret_cast<void *>(ptr), GmmHelper::canonize(gpuVirtualAddress + offset), size, counter);
|
||||||
memAlloc->is32BitAllocation = true;
|
memAlloc->is32BitAllocation = true;
|
||||||
memAlloc->gpuBaseAddress = Gmm::canonize(allocator32Bit->getBase());
|
memAlloc->gpuBaseAddress = GmmHelper::canonize(allocator32Bit->getBase());
|
||||||
memAlloc->sizeToFree = allocationSize;
|
memAlloc->sizeToFree = allocationSize;
|
||||||
|
|
||||||
counter++;
|
counter++;
|
||||||
|
@ -93,9 +94,9 @@ GraphicsAllocation *OsAgnosticMemoryManager::allocate32BitGraphicsMemory(size_t
|
||||||
|
|
||||||
MemoryAllocation *memoryAllocation = nullptr;
|
MemoryAllocation *memoryAllocation = nullptr;
|
||||||
if (ptrAlloc != nullptr) {
|
if (ptrAlloc != nullptr) {
|
||||||
memoryAllocation = new MemoryAllocation(true, ptrAlloc, Gmm::canonize(gpuAddress), size, counter);
|
memoryAllocation = new MemoryAllocation(true, ptrAlloc, GmmHelper::canonize(gpuAddress), size, counter);
|
||||||
memoryAllocation->is32BitAllocation = true;
|
memoryAllocation->is32BitAllocation = true;
|
||||||
memoryAllocation->gpuBaseAddress = Gmm::canonize(allocator32Bit->getBase());
|
memoryAllocation->gpuBaseAddress = GmmHelper::canonize(allocator32Bit->getBase());
|
||||||
memoryAllocation->sizeToFree = allocationSize;
|
memoryAllocation->sizeToFree = allocationSize;
|
||||||
memoryAllocation->cpuPtrAllocated = true;
|
memoryAllocation->cpuPtrAllocated = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,8 +75,8 @@ bool DeviceFactory::getDevices(HardwareInfo **pHWInfos, size_t &numDevices) {
|
||||||
DeviceFactory::numDevices = devNum;
|
DeviceFactory::numDevices = devNum;
|
||||||
DeviceFactory::hwInfos = ptr;
|
DeviceFactory::hwInfos = ptr;
|
||||||
|
|
||||||
return Gmm::initContext(hwInfos->pPlatform, hwInfos->pSkuTable,
|
return GmmHelper::initContext(hwInfos->pPlatform, hwInfos->pSkuTable,
|
||||||
hwInfos->pWaTable, hwInfos->pSysInfo);
|
hwInfos->pWaTable, hwInfos->pSysInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeviceFactory::releaseDevices() {
|
void DeviceFactory::releaseDevices() {
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
#include "drm/i915_drm.h"
|
#include "drm/i915_drm.h"
|
||||||
#include "drm/drm.h"
|
#include "drm/drm.h"
|
||||||
|
|
||||||
|
#include "runtime/gmm_helper/gmm.h"
|
||||||
#include "runtime/gmm_helper/gmm_helper.h"
|
#include "runtime/gmm_helper/gmm_helper.h"
|
||||||
#include "runtime/gmm_helper/resource_info.h"
|
#include "runtime/gmm_helper/resource_info.h"
|
||||||
|
|
||||||
|
@ -209,7 +210,7 @@ DrmAllocation *DrmMemoryManager::allocateGraphicsMemory64kb(size_t size, size_t
|
||||||
}
|
}
|
||||||
|
|
||||||
GraphicsAllocation *DrmMemoryManager::allocateGraphicsMemoryForImage(ImageInfo &imgInfo, Gmm *gmm) {
|
GraphicsAllocation *DrmMemoryManager::allocateGraphicsMemoryForImage(ImageInfo &imgInfo, Gmm *gmm) {
|
||||||
if (!Gmm::allowTiling(*imgInfo.imgDesc)) {
|
if (!GmmHelper::allowTiling(*imgInfo.imgDesc)) {
|
||||||
auto alloc = allocateGraphicsMemory(imgInfo.size, MemoryConstants::preferredAlignment);
|
auto alloc = allocateGraphicsMemory(imgInfo.size, MemoryConstants::preferredAlignment);
|
||||||
if (alloc) {
|
if (alloc) {
|
||||||
alloc->gmm = gmm;
|
alloc->gmm = gmm;
|
||||||
|
|
|
@ -24,16 +24,16 @@
|
||||||
|
|
||||||
namespace OCLRT {
|
namespace OCLRT {
|
||||||
|
|
||||||
decltype(Gmm::initGlobalContextFunc) Gmm::initGlobalContextFunc = nullptr;
|
decltype(GmmHelper::initGlobalContextFunc) GmmHelper::initGlobalContextFunc = nullptr;
|
||||||
decltype(Gmm::destroyGlobalContextFunc) Gmm::destroyGlobalContextFunc = nullptr;
|
decltype(GmmHelper::destroyGlobalContextFunc) GmmHelper::destroyGlobalContextFunc = nullptr;
|
||||||
decltype(Gmm::createClientContextFunc) Gmm::createClientContextFunc = nullptr;
|
decltype(GmmHelper::createClientContextFunc) GmmHelper::createClientContextFunc = nullptr;
|
||||||
decltype(Gmm::deleteClientContextFunc) Gmm::deleteClientContextFunc = nullptr;
|
decltype(GmmHelper::deleteClientContextFunc) GmmHelper::deleteClientContextFunc = nullptr;
|
||||||
|
|
||||||
void Gmm::loadLib() {
|
void GmmHelper::loadLib() {
|
||||||
Gmm::initGlobalContextFunc = GmmInitGlobalContext;
|
GmmHelper::initGlobalContextFunc = GmmInitGlobalContext;
|
||||||
Gmm::destroyGlobalContextFunc = GmmDestroyGlobalContext;
|
GmmHelper::destroyGlobalContextFunc = GmmDestroyGlobalContext;
|
||||||
Gmm::createClientContextFunc = GmmCreateClientContext;
|
GmmHelper::createClientContextFunc = GmmCreateClientContext;
|
||||||
Gmm::deleteClientContextFunc = GmmDeleteClientContext;
|
GmmHelper::deleteClientContextFunc = GmmDeleteClientContext;
|
||||||
isLoaded = true;
|
isLoaded = true;
|
||||||
}
|
}
|
||||||
} // namespace OCLRT
|
} // namespace OCLRT
|
||||||
|
|
|
@ -34,13 +34,13 @@ GMM_STATUS(GMM_STDCALL *myPfnCreateSingletonContext)
|
||||||
GMM_STATUS GMM_STDCALL myGmmInitGlobalContext(const PLATFORM Platform, const SKU_FEATURE_TABLE *pSkuTable, const WA_TABLE *pWaTable, const GT_SYSTEM_INFO *pGtSysInfo, GMM_CLIENT ClientType) {
|
GMM_STATUS GMM_STDCALL myGmmInitGlobalContext(const PLATFORM Platform, const SKU_FEATURE_TABLE *pSkuTable, const WA_TABLE *pWaTable, const GT_SYSTEM_INFO *pGtSysInfo, GMM_CLIENT ClientType) {
|
||||||
return myPfnCreateSingletonContext(Platform, pSkuTable, pWaTable, pGtSysInfo);
|
return myPfnCreateSingletonContext(Platform, pSkuTable, pWaTable, pGtSysInfo);
|
||||||
}
|
}
|
||||||
decltype(Gmm::initGlobalContextFunc) Gmm::initGlobalContextFunc = &myGmmInitGlobalContext;
|
decltype(GmmHelper::initGlobalContextFunc) GmmHelper::initGlobalContextFunc = &myGmmInitGlobalContext;
|
||||||
decltype(Gmm::destroyGlobalContextFunc) Gmm::destroyGlobalContextFunc = nullptr;
|
decltype(GmmHelper::destroyGlobalContextFunc) GmmHelper::destroyGlobalContextFunc = nullptr;
|
||||||
decltype(Gmm::createClientContextFunc) Gmm::createClientContextFunc = nullptr;
|
decltype(GmmHelper::createClientContextFunc) GmmHelper::createClientContextFunc = nullptr;
|
||||||
decltype(Gmm::deleteClientContextFunc) Gmm::deleteClientContextFunc = nullptr;
|
decltype(GmmHelper::deleteClientContextFunc) GmmHelper::deleteClientContextFunc = nullptr;
|
||||||
|
|
||||||
std::unique_ptr<OsLibrary> gmmLib;
|
std::unique_ptr<OsLibrary> gmmLib;
|
||||||
void Gmm::loadLib() {
|
void GmmHelper::loadLib() {
|
||||||
gmmLib.reset(OsLibrary::load(Os::gmmDllName));
|
gmmLib.reset(OsLibrary::load(Os::gmmDllName));
|
||||||
|
|
||||||
UNRECOVERABLE_IF(!gmmLib);
|
UNRECOVERABLE_IF(!gmmLib);
|
||||||
|
@ -50,10 +50,10 @@ void Gmm::loadLib() {
|
||||||
auto status = openGmmFunc(&entries);
|
auto status = openGmmFunc(&entries);
|
||||||
if (status == GMM_SUCCESS) {
|
if (status == GMM_SUCCESS) {
|
||||||
myPfnCreateSingletonContext = entries.pfnCreateSingletonContext;
|
myPfnCreateSingletonContext = entries.pfnCreateSingletonContext;
|
||||||
Gmm::destroyGlobalContextFunc = entries.pfnDestroySingletonContext;
|
GmmHelper::destroyGlobalContextFunc = entries.pfnDestroySingletonContext;
|
||||||
Gmm::createClientContextFunc = entries.pfnCreateClientContext;
|
GmmHelper::createClientContextFunc = entries.pfnCreateClientContext;
|
||||||
Gmm::deleteClientContextFunc = entries.pfnDeleteClientContext;
|
GmmHelper::deleteClientContextFunc = entries.pfnDeleteClientContext;
|
||||||
isLoaded = myPfnCreateSingletonContext && Gmm::destroyGlobalContextFunc && Gmm::createClientContextFunc && Gmm::deleteClientContextFunc;
|
isLoaded = myPfnCreateSingletonContext && GmmHelper::destroyGlobalContextFunc && GmmHelper::createClientContextFunc && GmmHelper::deleteClientContextFunc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
UNRECOVERABLE_IF(!isLoaded);
|
UNRECOVERABLE_IF(!isLoaded);
|
||||||
|
|
|
@ -24,16 +24,16 @@
|
||||||
|
|
||||||
namespace OCLRT {
|
namespace OCLRT {
|
||||||
|
|
||||||
decltype(Gmm::initGlobalContextFunc) Gmm::initGlobalContextFunc = nullptr;
|
decltype(GmmHelper::initGlobalContextFunc) GmmHelper::initGlobalContextFunc = nullptr;
|
||||||
decltype(Gmm::destroyGlobalContextFunc) Gmm::destroyGlobalContextFunc = nullptr;
|
decltype(GmmHelper::destroyGlobalContextFunc) GmmHelper::destroyGlobalContextFunc = nullptr;
|
||||||
decltype(Gmm::createClientContextFunc) Gmm::createClientContextFunc = nullptr;
|
decltype(GmmHelper::createClientContextFunc) GmmHelper::createClientContextFunc = nullptr;
|
||||||
decltype(Gmm::deleteClientContextFunc) Gmm::deleteClientContextFunc = nullptr;
|
decltype(GmmHelper::deleteClientContextFunc) GmmHelper::deleteClientContextFunc = nullptr;
|
||||||
|
|
||||||
void Gmm::loadLib() {
|
void GmmHelper::loadLib() {
|
||||||
Gmm::initGlobalContextFunc = GmmInitGlobalContext;
|
GmmHelper::initGlobalContextFunc = GmmInitGlobalContext;
|
||||||
Gmm::destroyGlobalContextFunc = GmmDestroyGlobalContext;
|
GmmHelper::destroyGlobalContextFunc = GmmDestroyGlobalContext;
|
||||||
Gmm::createClientContextFunc = GmmCreateClientContext;
|
GmmHelper::createClientContextFunc = GmmCreateClientContext;
|
||||||
Gmm::deleteClientContextFunc = GmmDeleteClientContext;
|
GmmHelper::deleteClientContextFunc = GmmDeleteClientContext;
|
||||||
isLoaded = true;
|
isLoaded = true;
|
||||||
}
|
}
|
||||||
} // namespace OCLRT
|
} // namespace OCLRT
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include "runtime/helpers/options.h"
|
#include "runtime/helpers/options.h"
|
||||||
#include "runtime/os_interface/windows/gdi_interface.h"
|
#include "runtime/os_interface/windows/gdi_interface.h"
|
||||||
#include "runtime/os_interface/windows/kmdaf_listener.h"
|
#include "runtime/os_interface/windows/kmdaf_listener.h"
|
||||||
|
#include "runtime/gmm_helper/gmm.h"
|
||||||
#include "runtime/gmm_helper/gmm_helper.h"
|
#include "runtime/gmm_helper/gmm_helper.h"
|
||||||
#include "runtime/gmm_helper/resource_info.h"
|
#include "runtime/gmm_helper/resource_info.h"
|
||||||
#include "runtime/gmm_helper/page_table_mngr.h"
|
#include "runtime/gmm_helper/page_table_mngr.h"
|
||||||
|
@ -395,7 +396,7 @@ bool Wddm::mapGpuVirtualAddressImpl(Gmm *gmm, D3DKMT_HANDLE handle, void *cpuPtr
|
||||||
}
|
}
|
||||||
|
|
||||||
status = gdi->mapGpuVirtualAddress(&MapGPUVA);
|
status = gdi->mapGpuVirtualAddress(&MapGPUVA);
|
||||||
gpuPtr = Gmm::canonize(MapGPUVA.VirtualAddress);
|
gpuPtr = GmmHelper::canonize(MapGPUVA.VirtualAddress);
|
||||||
|
|
||||||
if (status == STATUS_PENDING) {
|
if (status == STATUS_PENDING) {
|
||||||
interlockedMax(currentPagingFenceValue, MapGPUVA.PagingFenceValue);
|
interlockedMax(currentPagingFenceValue, MapGPUVA.PagingFenceValue);
|
||||||
|
@ -420,7 +421,7 @@ bool Wddm::freeGpuVirtualAddres(D3DGPU_VIRTUAL_ADDRESS &gpuPtr, uint64_t size) {
|
||||||
NTSTATUS status = STATUS_SUCCESS;
|
NTSTATUS status = STATUS_SUCCESS;
|
||||||
D3DKMT_FREEGPUVIRTUALADDRESS FreeGPUVA = {0};
|
D3DKMT_FREEGPUVIRTUALADDRESS FreeGPUVA = {0};
|
||||||
FreeGPUVA.hAdapter = adapter;
|
FreeGPUVA.hAdapter = adapter;
|
||||||
FreeGPUVA.BaseAddress = Gmm::decanonize(gpuPtr);
|
FreeGPUVA.BaseAddress = GmmHelper::decanonize(gpuPtr);
|
||||||
FreeGPUVA.Size = size;
|
FreeGPUVA.Size = size;
|
||||||
|
|
||||||
status = gdi->freeGpuVirtualAddress(&FreeGPUVA);
|
status = gdi->freeGpuVirtualAddress(&FreeGPUVA);
|
||||||
|
@ -632,7 +633,7 @@ bool Wddm::openSharedHandle(D3DKMT_HANDLE handle, WddmAllocation *alloc) {
|
||||||
alloc->handle = allocationInfo[0].hAllocation;
|
alloc->handle = allocationInfo[0].hAllocation;
|
||||||
alloc->resourceHandle = OpenResource.hResource;
|
alloc->resourceHandle = OpenResource.hResource;
|
||||||
|
|
||||||
alloc->gmm = Gmm::create((PGMM_RESOURCE_INFO)(allocationInfo[0].pPrivateDriverData));
|
alloc->gmm = GmmHelper::create((PGMM_RESOURCE_INFO)(allocationInfo[0].pPrivateDriverData));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -668,7 +669,7 @@ bool Wddm::openNTHandle(HANDLE handle, WddmAllocation *alloc) {
|
||||||
alloc->handle = allocationInfo2[0].hAllocation;
|
alloc->handle = allocationInfo2[0].hAllocation;
|
||||||
alloc->resourceHandle = openResourceFromNtHandle.hResource;
|
alloc->resourceHandle = openResourceFromNtHandle.hResource;
|
||||||
|
|
||||||
alloc->gmm = Gmm::create((PGMM_RESOURCE_INFO)(allocationInfo2[0].pPrivateDriverData));
|
alloc->gmm = GmmHelper::create((PGMM_RESOURCE_INFO)(allocationInfo2[0].pPrivateDriverData));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,6 @@
|
||||||
#include "runtime/memory_manager/host_ptr_defines.h"
|
#include "runtime/memory_manager/host_ptr_defines.h"
|
||||||
#include "runtime/utilities/debug_settings_reader.h"
|
#include "runtime/utilities/debug_settings_reader.h"
|
||||||
#include "runtime/gmm_helper/gmm_lib.h"
|
#include "runtime/gmm_helper/gmm_lib.h"
|
||||||
#include "runtime/gmm_helper/gmm_helper.h"
|
|
||||||
#include "runtime/helpers/hw_info.h"
|
#include "runtime/helpers/hw_info.h"
|
||||||
#include "gmm_memory.h"
|
#include "gmm_memory.h"
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
|
@ -42,13 +42,13 @@ Wddm::VirtualAllocFcn getVirtualAlloc() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Wddm::initGmmContext() {
|
bool Wddm::initGmmContext() {
|
||||||
return Gmm::initContext(gfxPlatform.get(),
|
return GmmHelper::initContext(gfxPlatform.get(),
|
||||||
featureTable.get(),
|
featureTable.get(),
|
||||||
waTable.get(),
|
waTable.get(),
|
||||||
gtSystemInfo.get());
|
gtSystemInfo.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Wddm::destroyGmmContext() {
|
void Wddm::destroyGmmContext() {
|
||||||
Gmm::destroyContext();
|
GmmHelper::destroyContext();
|
||||||
}
|
}
|
||||||
} // namespace OCLRT
|
} // namespace OCLRT
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include "runtime/device/device.h"
|
#include "runtime/device/device.h"
|
||||||
#include "runtime/helpers/aligned_memory.h"
|
#include "runtime/helpers/aligned_memory.h"
|
||||||
#include "runtime/helpers/ptr_math.h"
|
#include "runtime/helpers/ptr_math.h"
|
||||||
|
#include "runtime/gmm_helper/gmm.h"
|
||||||
#include "runtime/gmm_helper/gmm_helper.h"
|
#include "runtime/gmm_helper/gmm_helper.h"
|
||||||
#include "runtime/gmm_helper/resource_info.h"
|
#include "runtime/gmm_helper/resource_info.h"
|
||||||
#include "runtime/helpers/surface_formats.h"
|
#include "runtime/helpers/surface_formats.h"
|
||||||
|
@ -60,7 +61,7 @@ void APIENTRY WddmMemoryManager::trimCallback(_Inout_ D3DKMT_TRIMNOTIFICATION *t
|
||||||
}
|
}
|
||||||
|
|
||||||
GraphicsAllocation *WddmMemoryManager::allocateGraphicsMemoryForImage(ImageInfo &imgInfo, Gmm *gmm) {
|
GraphicsAllocation *WddmMemoryManager::allocateGraphicsMemoryForImage(ImageInfo &imgInfo, Gmm *gmm) {
|
||||||
if (!Gmm::allowTiling(*imgInfo.imgDesc) && imgInfo.mipCount == 0) {
|
if (!GmmHelper::allowTiling(*imgInfo.imgDesc) && imgInfo.mipCount == 0) {
|
||||||
delete gmm;
|
delete gmm;
|
||||||
return allocateGraphicsMemory(imgInfo.size, MemoryConstants::preferredAlignment);
|
return allocateGraphicsMemory(imgInfo.size, MemoryConstants::preferredAlignment);
|
||||||
}
|
}
|
||||||
|
@ -80,7 +81,7 @@ GraphicsAllocation *WddmMemoryManager::allocateGraphicsMemory64kb(size_t size, s
|
||||||
|
|
||||||
auto wddmAllocation = new WddmAllocation(nullptr, sizeAligned, nullptr, sizeAligned, nullptr);
|
auto wddmAllocation = new WddmAllocation(nullptr, sizeAligned, nullptr, sizeAligned, nullptr);
|
||||||
|
|
||||||
gmm = Gmm::create(nullptr, sizeAligned, false);
|
gmm = GmmHelper::create(nullptr, sizeAligned, false);
|
||||||
wddmAllocation->gmm = gmm;
|
wddmAllocation->gmm = gmm;
|
||||||
|
|
||||||
if (!wddm->createAllocation64k(wddmAllocation)) {
|
if (!wddm->createAllocation64k(wddmAllocation)) {
|
||||||
|
@ -114,7 +115,7 @@ GraphicsAllocation *WddmMemoryManager::allocateGraphicsMemory(size_t size, size_
|
||||||
auto wddmAllocation = new WddmAllocation(pSysMem, sizeAligned, pSysMem, sizeAligned, nullptr);
|
auto wddmAllocation = new WddmAllocation(pSysMem, sizeAligned, pSysMem, sizeAligned, nullptr);
|
||||||
wddmAllocation->cpuPtrAllocated = true;
|
wddmAllocation->cpuPtrAllocated = true;
|
||||||
|
|
||||||
gmm = Gmm::create(pSysMem, sizeAligned, uncacheable);
|
gmm = GmmHelper::create(pSysMem, sizeAligned, uncacheable);
|
||||||
|
|
||||||
wddmAllocation->gmm = gmm;
|
wddmAllocation->gmm = gmm;
|
||||||
|
|
||||||
|
@ -149,7 +150,7 @@ GraphicsAllocation *WddmMemoryManager::allocateGraphicsMemory(size_t size, const
|
||||||
auto allocation = new WddmAllocation(ptr, size, ptrAligned, sizeAligned, reserve);
|
auto allocation = new WddmAllocation(ptr, size, ptrAligned, sizeAligned, reserve);
|
||||||
allocation->allocationOffset = offset;
|
allocation->allocationOffset = offset;
|
||||||
|
|
||||||
Gmm *gmm = Gmm::create(ptrAligned, sizeAligned, false);
|
Gmm *gmm = GmmHelper::create(ptrAligned, sizeAligned, false);
|
||||||
allocation->gmm = gmm;
|
allocation->gmm = gmm;
|
||||||
if (createWddmAllocation(allocation, AllocationOrigin::EXTERNAL_ALLOCATION)) {
|
if (createWddmAllocation(allocation, AllocationOrigin::EXTERNAL_ALLOCATION)) {
|
||||||
return allocation;
|
return allocation;
|
||||||
|
@ -188,7 +189,7 @@ GraphicsAllocation *WddmMemoryManager::allocate32BitGraphicsMemory(size_t size,
|
||||||
wddmAllocation->is32BitAllocation = true;
|
wddmAllocation->is32BitAllocation = true;
|
||||||
wddmAllocation->allocationOffset = offset;
|
wddmAllocation->allocationOffset = offset;
|
||||||
|
|
||||||
gmm = Gmm::create(ptrAligned, sizeAligned, false);
|
gmm = GmmHelper::create(ptrAligned, sizeAligned, false);
|
||||||
wddmAllocation->gmm = gmm;
|
wddmAllocation->gmm = gmm;
|
||||||
|
|
||||||
if (!createWddmAllocation(wddmAllocation, allocationOrigin)) {
|
if (!createWddmAllocation(wddmAllocation, allocationOrigin)) {
|
||||||
|
@ -200,7 +201,7 @@ GraphicsAllocation *WddmMemoryManager::allocate32BitGraphicsMemory(size_t size,
|
||||||
|
|
||||||
wddmAllocation->is32BitAllocation = true;
|
wddmAllocation->is32BitAllocation = true;
|
||||||
auto baseAddress = allocationOrigin == AllocationOrigin::EXTERNAL_ALLOCATION ? allocator32Bit->getBase() : this->wddm->getGfxPartition().Heap32[1].Base;
|
auto baseAddress = allocationOrigin == AllocationOrigin::EXTERNAL_ALLOCATION ? allocator32Bit->getBase() : this->wddm->getGfxPartition().Heap32[1].Base;
|
||||||
wddmAllocation->gpuBaseAddress = Gmm::canonize(baseAddress);
|
wddmAllocation->gpuBaseAddress = GmmHelper::canonize(baseAddress);
|
||||||
|
|
||||||
return wddmAllocation;
|
return wddmAllocation;
|
||||||
}
|
}
|
||||||
|
@ -231,7 +232,7 @@ GraphicsAllocation *WddmMemoryManager::createAllocationFromHandle(osHandle handl
|
||||||
} else if (requireSpecificBitness && this->force32bitAllocations) {
|
} else if (requireSpecificBitness && this->force32bitAllocations) {
|
||||||
is32BitAllocation = true;
|
is32BitAllocation = true;
|
||||||
allocation->is32BitAllocation = true;
|
allocation->is32BitAllocation = true;
|
||||||
allocation->gpuBaseAddress = Gmm::canonize(allocator32Bit->getBase());
|
allocation->gpuBaseAddress = GmmHelper::canonize(allocator32Bit->getBase());
|
||||||
}
|
}
|
||||||
status = wddm->mapGpuVirtualAddress(allocation, ptr, size, is32BitAllocation, false, false);
|
status = wddm->mapGpuVirtualAddress(allocation, ptr, size, is32BitAllocation, false, false);
|
||||||
DEBUG_BREAK_IF(!status);
|
DEBUG_BREAK_IF(!status);
|
||||||
|
@ -363,7 +364,7 @@ MemoryManager::AllocationStatus WddmMemoryManager::populateOsHandles(OsHandleSto
|
||||||
handleStorage.fragmentStorageData[i].osHandleStorage = new OsHandle();
|
handleStorage.fragmentStorageData[i].osHandleStorage = new OsHandle();
|
||||||
handleStorage.fragmentStorageData[i].residency = new ResidencyData();
|
handleStorage.fragmentStorageData[i].residency = new ResidencyData();
|
||||||
|
|
||||||
handleStorage.fragmentStorageData[i].osHandleStorage->gmm = Gmm::create(handleStorage.fragmentStorageData[i].cpuPtr, handleStorage.fragmentStorageData[i].fragmentSize, false);
|
handleStorage.fragmentStorageData[i].osHandleStorage->gmm = GmmHelper::create(handleStorage.fragmentStorageData[i].cpuPtr, handleStorage.fragmentStorageData[i].fragmentSize, false);
|
||||||
allocatedFragmentIndexes[allocatedFragmentsCounter] = i;
|
allocatedFragmentIndexes[allocatedFragmentsCounter] = i;
|
||||||
allocatedFragmentsCounter++;
|
allocatedFragmentsCounter++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
#include "runtime/sharings/d3d/d3d_sharing.h"
|
#include "runtime/sharings/d3d/d3d_sharing.h"
|
||||||
#include "runtime/context/context.h"
|
#include "runtime/context/context.h"
|
||||||
#include "runtime/mem_obj/image.h"
|
#include "runtime/mem_obj/image.h"
|
||||||
#include "runtime/gmm_helper/gmm_helper.h"
|
#include "runtime/gmm_helper/gmm.h"
|
||||||
|
|
||||||
using namespace OCLRT;
|
using namespace OCLRT;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2017, Intel Corporation
|
* Copyright (c) 2017 - 2018, Intel Corporation
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
|
@ -26,11 +26,11 @@
|
||||||
|
|
||||||
enum GMM_RESOURCE_FORMAT_ENUM;
|
enum GMM_RESOURCE_FORMAT_ENUM;
|
||||||
namespace OCLRT {
|
namespace OCLRT {
|
||||||
|
enum class OCLPlane;
|
||||||
class Context;
|
class Context;
|
||||||
class Gmm;
|
class Gmm;
|
||||||
struct SurfaceFormatInfo;
|
struct SurfaceFormatInfo;
|
||||||
struct ImageInfo;
|
struct ImageInfo;
|
||||||
enum OCLPlane;
|
|
||||||
|
|
||||||
template <typename D3D>
|
template <typename D3D>
|
||||||
class D3DSharing : public SharingHandler {
|
class D3DSharing : public SharingHandler {
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
#include "runtime/helpers/get_info.h"
|
#include "runtime/helpers/get_info.h"
|
||||||
#include "runtime/memory_manager/memory_manager.h"
|
#include "runtime/memory_manager/memory_manager.h"
|
||||||
#include "runtime/gmm_helper/gmm_helper.h"
|
#include "runtime/gmm_helper/gmm_helper.h"
|
||||||
|
#include "runtime/gmm_helper/gmm.h"
|
||||||
#include "mmsystem.h"
|
#include "mmsystem.h"
|
||||||
|
|
||||||
using namespace OCLRT;
|
using namespace OCLRT;
|
||||||
|
@ -81,7 +82,7 @@ Image *D3DSurface::create(Context *context, cl_dx9_surface_info_khr *surfaceInfo
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
imgInfo.plane = Gmm::convertPlane(oclPlane);
|
imgInfo.plane = GmmHelper::convertPlane(oclPlane);
|
||||||
imgInfo.surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imgFormat);
|
imgInfo.surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imgFormat);
|
||||||
|
|
||||||
bool isSharedResource = false;
|
bool isSharedResource = false;
|
||||||
|
@ -101,7 +102,7 @@ Image *D3DSurface::create(Context *context, cl_dx9_surface_info_khr *surfaceInfo
|
||||||
imgDesc.image_width /= 2;
|
imgDesc.image_width /= 2;
|
||||||
imgDesc.image_height /= 2;
|
imgDesc.image_height /= 2;
|
||||||
}
|
}
|
||||||
Gmm *gmm = Gmm::createGmmAndQueryImgParams(imgInfo, context->getDevice(0)->getHardwareInfo());
|
Gmm *gmm = GmmHelper::createGmmAndQueryImgParams(imgInfo, context->getDevice(0)->getHardwareInfo());
|
||||||
imgDesc.image_row_pitch = imgInfo.rowPitch;
|
imgDesc.image_row_pitch = imgInfo.rowPitch;
|
||||||
imgDesc.image_slice_pitch = imgInfo.slicePitch;
|
imgDesc.image_slice_pitch = imgInfo.slicePitch;
|
||||||
|
|
||||||
|
|
|
@ -25,9 +25,9 @@
|
||||||
|
|
||||||
struct ErrorCodeHelper;
|
struct ErrorCodeHelper;
|
||||||
namespace OCLRT {
|
namespace OCLRT {
|
||||||
|
enum class OCLPlane;
|
||||||
class Image;
|
class Image;
|
||||||
class Context;
|
class Context;
|
||||||
enum OCLPlane;
|
|
||||||
|
|
||||||
class D3DSurface : public D3DSharing<D3DTypesHelper::D3D9> {
|
class D3DSurface : public D3DSharing<D3DTypesHelper::D3D9> {
|
||||||
typedef typename D3DTypesHelper::D3D9::D3DTexture2dDesc D3D9SurfaceDesc;
|
typedef typename D3DTypesHelper::D3D9::D3DTexture2dDesc D3D9SurfaceDesc;
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
|
|
||||||
#include "runtime/context/context.h"
|
#include "runtime/context/context.h"
|
||||||
#include "runtime/device/device.h"
|
#include "runtime/device/device.h"
|
||||||
|
#include "runtime/gmm_helper/gmm.h"
|
||||||
#include "runtime/gmm_helper/gmm_helper.h"
|
#include "runtime/gmm_helper/gmm_helper.h"
|
||||||
#include "runtime/gmm_helper/resource_info.h"
|
#include "runtime/gmm_helper/resource_info.h"
|
||||||
#include "runtime/helpers/get_info.h"
|
#include "runtime/helpers/get_info.h"
|
||||||
|
@ -57,7 +58,7 @@ Image *D3DTexture<D3D>::create2d(Context *context, D3DTexture2d *d3dTexture, cl_
|
||||||
} else {
|
} else {
|
||||||
oclPlane = OCLPlane::PLANE_UV;
|
oclPlane = OCLPlane::PLANE_UV;
|
||||||
}
|
}
|
||||||
imgInfo.plane = Gmm::convertPlane(oclPlane);
|
imgInfo.plane = GmmHelper::convertPlane(oclPlane);
|
||||||
arrayIndex = subresource / 2u;
|
arrayIndex = subresource / 2u;
|
||||||
} else if (subresource >= textureDesc.MipLevels * textureDesc.ArraySize) {
|
} else if (subresource >= textureDesc.MipLevels * textureDesc.ArraySize) {
|
||||||
err.set(CL_INVALID_VALUE);
|
err.set(CL_INVALID_VALUE);
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
#include "runtime/memory_manager/memory_manager.h"
|
#include "runtime/memory_manager/memory_manager.h"
|
||||||
#include "runtime/helpers/get_info.h"
|
#include "runtime/helpers/get_info.h"
|
||||||
#include "runtime/helpers/hw_info.h"
|
#include "runtime/helpers/hw_info.h"
|
||||||
|
#include "runtime/gmm_helper/gmm.h"
|
||||||
#include "runtime/gmm_helper/gmm_helper.h"
|
#include "runtime/gmm_helper/gmm_helper.h"
|
||||||
|
|
||||||
namespace OCLRT {
|
namespace OCLRT {
|
||||||
|
@ -75,7 +76,7 @@ Image *VASurface::createSharedVaSurface(Context *context, VASharingFunctions *sh
|
||||||
|
|
||||||
auto alloc = memoryManager->createGraphicsAllocationFromSharedHandle(sharedHandle, false, true);
|
auto alloc = memoryManager->createGraphicsAllocationFromSharedHandle(sharedHandle, false, true);
|
||||||
|
|
||||||
Gmm *gmm = Gmm::createGmmAndQueryImgParams(imgInfo, hwInfo);
|
Gmm *gmm = GmmHelper::createGmmAndQueryImgParams(imgInfo, hwInfo);
|
||||||
DEBUG_BREAK_IF(alloc->gmm != nullptr);
|
DEBUG_BREAK_IF(alloc->gmm != nullptr);
|
||||||
alloc->gmm = gmm;
|
alloc->gmm = gmm;
|
||||||
|
|
||||||
|
|
|
@ -103,7 +103,7 @@ struct MultipleMapImageTest : public DeviceFixture, public ::testing::Test {
|
||||||
template <typename Traits, typename FamilyType>
|
template <typename Traits, typename FamilyType>
|
||||||
std::unique_ptr<MockImage<FamilyType>> createMockImage() {
|
std::unique_ptr<MockImage<FamilyType>> createMockImage() {
|
||||||
auto mockAlloc = pDevice->getMemoryManager()->allocateGraphicsMemory(1024);
|
auto mockAlloc = pDevice->getMemoryManager()->allocateGraphicsMemory(1024);
|
||||||
auto tiledImage = Gmm::allowTiling(Traits::imageDesc);
|
auto tiledImage = GmmHelper::allowTiling(Traits::imageDesc);
|
||||||
|
|
||||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(Traits::flags, &Traits::imageFormat);
|
auto surfaceFormat = Image::getSurfaceFormatFromTable(Traits::flags, &Traits::imageFormat);
|
||||||
auto img = new MockImage<FamilyType>(context, Traits::flags, 1024, Traits::hostPtr,
|
auto img = new MockImage<FamilyType>(context, Traits::flags, 1024, Traits::hostPtr,
|
||||||
|
|
|
@ -52,7 +52,6 @@
|
||||||
#include "test.h"
|
#include "test.h"
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "runtime/utilities/linux/debug_env_reader.h"
|
#include "runtime/utilities/linux/debug_env_reader.h"
|
||||||
#include "runtime/gmm_helper/gmm_helper.h"
|
|
||||||
#include "runtime/command_queue/gpgpu_walker.h"
|
#include "runtime/command_queue/gpgpu_walker.h"
|
||||||
|
|
||||||
using namespace OCLRT;
|
using namespace OCLRT;
|
||||||
|
|
|
@ -435,8 +435,8 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, stateBaseAddressTracking) {
|
||||||
|
|
||||||
HWCMDTEST_F(IGFX_GEN8_CORE, CommandStreamReceiverFlushTaskTests, stateBaseAddressProgrammingShouldMatchTracking) {
|
HWCMDTEST_F(IGFX_GEN8_CORE, CommandStreamReceiverFlushTaskTests, stateBaseAddressProgrammingShouldMatchTracking) {
|
||||||
typedef typename FamilyType::STATE_BASE_ADDRESS STATE_BASE_ADDRESS;
|
typedef typename FamilyType::STATE_BASE_ADDRESS STATE_BASE_ADDRESS;
|
||||||
auto stateHeapMocs = Gmm::getMOCS(GMM_RESOURCE_USAGE_OCL_STATE_HEAP_BUFFER);
|
auto stateHeapMocs = GmmHelper::getMOCS(GMM_RESOURCE_USAGE_OCL_STATE_HEAP_BUFFER);
|
||||||
auto l3CacheOnMocs = Gmm::getMOCS(CacheSettings::l3CacheOn);
|
auto l3CacheOnMocs = GmmHelper::getMOCS(CacheSettings::l3CacheOn);
|
||||||
auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver<FamilyType>();
|
auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver<FamilyType>();
|
||||||
flushTask(commandStreamReceiver);
|
flushTask(commandStreamReceiver);
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,6 @@
|
||||||
#include "unit_tests/libult/create_command_stream.h"
|
#include "unit_tests/libult/create_command_stream.h"
|
||||||
#include "test.h"
|
#include "test.h"
|
||||||
#include "runtime/utilities/linux/debug_env_reader.h"
|
#include "runtime/utilities/linux/debug_env_reader.h"
|
||||||
#include "runtime/gmm_helper/gmm_helper.h"
|
|
||||||
#include "runtime/command_queue/gpgpu_walker.h"
|
#include "runtime/command_queue/gpgpu_walker.h"
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include "runtime/helpers/options.h"
|
#include "runtime/helpers/options.h"
|
||||||
#include "runtime/helpers/ptr_math.h"
|
#include "runtime/helpers/ptr_math.h"
|
||||||
#include "runtime/memory_manager/os_agnostic_memory_manager.h"
|
#include "runtime/memory_manager/os_agnostic_memory_manager.h"
|
||||||
|
#include "runtime/gmm_helper/gmm.h"
|
||||||
#include "runtime/gmm_helper/gmm_helper.h"
|
#include "runtime/gmm_helper/gmm_helper.h"
|
||||||
#include "unit_tests/mocks/mock_device.h"
|
#include "unit_tests/mocks/mock_device.h"
|
||||||
#include "unit_tests/mocks/mock_gmm.h"
|
#include "unit_tests/mocks/mock_gmm.h"
|
||||||
|
@ -39,7 +40,7 @@ class GmmTests : public ::testing::Test {
|
||||||
TEST_F(GmmTests, resourceCreation) {
|
TEST_F(GmmTests, resourceCreation) {
|
||||||
std::unique_ptr<MemoryManager> mm(new OsAgnosticMemoryManager);
|
std::unique_ptr<MemoryManager> mm(new OsAgnosticMemoryManager);
|
||||||
void *pSysMem = mm->allocateSystemMemory(4096, 4096);
|
void *pSysMem = mm->allocateSystemMemory(4096, 4096);
|
||||||
std::unique_ptr<Gmm> gmm(Gmm::create(pSysMem, 4096, false));
|
std::unique_ptr<Gmm> gmm(GmmHelper::create(pSysMem, 4096, false));
|
||||||
|
|
||||||
ASSERT_TRUE(gmm->gmmResourceInfo.get() != nullptr);
|
ASSERT_TRUE(gmm->gmmResourceInfo.get() != nullptr);
|
||||||
|
|
||||||
|
@ -54,7 +55,7 @@ TEST_F(GmmTests, resourceCreationUncacheable) {
|
||||||
std::unique_ptr<MemoryManager> mm(new OsAgnosticMemoryManager);
|
std::unique_ptr<MemoryManager> mm(new OsAgnosticMemoryManager);
|
||||||
void *pSysMem = mm->allocateSystemMemory(4096, 4096);
|
void *pSysMem = mm->allocateSystemMemory(4096, 4096);
|
||||||
|
|
||||||
std::unique_ptr<Gmm> gmm(Gmm::create(pSysMem, 4096, true));
|
std::unique_ptr<Gmm> gmm(GmmHelper::create(pSysMem, 4096, true));
|
||||||
|
|
||||||
ASSERT_TRUE(gmm->gmmResourceInfo.get() != nullptr);
|
ASSERT_TRUE(gmm->gmmResourceInfo.get() != nullptr);
|
||||||
|
|
||||||
|
@ -70,7 +71,7 @@ TEST_F(GmmTests, resourceCleanupOnDelete) {
|
||||||
std::unique_ptr<MemoryManager> mm(new OsAgnosticMemoryManager);
|
std::unique_ptr<MemoryManager> mm(new OsAgnosticMemoryManager);
|
||||||
void *pSysMem = mm->allocateSystemMemory(4096, 4096);
|
void *pSysMem = mm->allocateSystemMemory(4096, 4096);
|
||||||
|
|
||||||
std::unique_ptr<Gmm> gmm(Gmm::create(pSysMem, 4096, false));
|
std::unique_ptr<Gmm> gmm(GmmHelper::create(pSysMem, 4096, false));
|
||||||
|
|
||||||
ASSERT_TRUE(gmm->gmmResourceInfo.get() != nullptr);
|
ASSERT_TRUE(gmm->gmmResourceInfo.get() != nullptr);
|
||||||
|
|
||||||
|
@ -78,12 +79,12 @@ TEST_F(GmmTests, resourceCleanupOnDelete) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(GmmTests, GivenBufferSizeLargerThenMaxPitchWhenAskedForGmmCreationThenGMMResourceIsCreatedWithNoRestrictionsFlag) {
|
TEST_F(GmmTests, GivenBufferSizeLargerThenMaxPitchWhenAskedForGmmCreationThenGMMResourceIsCreatedWithNoRestrictionsFlag) {
|
||||||
auto maxSize = Gmm::maxPossiblePitch;
|
auto maxSize = GmmHelper::maxPossiblePitch;
|
||||||
|
|
||||||
MemoryManager *mm = new OsAgnosticMemoryManager;
|
MemoryManager *mm = new OsAgnosticMemoryManager;
|
||||||
void *pSysMem = mm->allocateSystemMemory(4096, 4096);
|
void *pSysMem = mm->allocateSystemMemory(4096, 4096);
|
||||||
|
|
||||||
auto gmmRes = Gmm::create(pSysMem, maxSize, false);
|
auto gmmRes = GmmHelper::create(pSysMem, maxSize, false);
|
||||||
|
|
||||||
ASSERT_TRUE(gmmRes->gmmResourceInfo.get() != nullptr);
|
ASSERT_TRUE(gmmRes->gmmResourceInfo.get() != nullptr);
|
||||||
|
|
||||||
|
@ -96,8 +97,8 @@ TEST_F(GmmTests, GivenBufferSizeLargerThenMaxPitchWhenAskedForGmmCreationThenGMM
|
||||||
TEST_F(GmmTests, givenGmmCreatedFromExistingGmmThenHelperDoesNotReleaseParentGmm) {
|
TEST_F(GmmTests, givenGmmCreatedFromExistingGmmThenHelperDoesNotReleaseParentGmm) {
|
||||||
auto size = 4096u;
|
auto size = 4096u;
|
||||||
void *incomingPtr = (void *)0x1000;
|
void *incomingPtr = (void *)0x1000;
|
||||||
auto gmmRes = Gmm::create(incomingPtr, size, false);
|
auto gmmRes = GmmHelper::create(incomingPtr, size, false);
|
||||||
auto gmmRes2 = Gmm::create(gmmRes->gmmResourceInfo->peekHandle());
|
auto gmmRes2 = GmmHelper::create(gmmRes->gmmResourceInfo->peekHandle());
|
||||||
|
|
||||||
//copy is being made
|
//copy is being made
|
||||||
EXPECT_NE(gmmRes2->gmmResourceInfo->peekHandle(), gmmRes->gmmResourceInfo->peekHandle());
|
EXPECT_NE(gmmRes2->gmmResourceInfo->peekHandle(), gmmRes->gmmResourceInfo->peekHandle());
|
||||||
|
@ -249,7 +250,7 @@ TEST_F(GmmTests, givenZeroRowPitchWhenQueryImgFromBufferParamsThenCalculate) {
|
||||||
|
|
||||||
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
|
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
|
||||||
size_t expectedRowPitch = imgDesc.image_width * imgInfo.surfaceFormat->ImageElementSizeInBytes;
|
size_t expectedRowPitch = imgDesc.image_width * imgInfo.surfaceFormat->ImageElementSizeInBytes;
|
||||||
MockGmm::queryImgFromBufferParams(imgInfo, &bufferAllocation);
|
GmmHelper::queryImgFromBufferParams(imgInfo, &bufferAllocation);
|
||||||
|
|
||||||
EXPECT_EQ(imgInfo.rowPitch, expectedRowPitch);
|
EXPECT_EQ(imgInfo.rowPitch, expectedRowPitch);
|
||||||
}
|
}
|
||||||
|
@ -265,7 +266,7 @@ TEST_F(GmmTests, givenNonZeroRowPitchWhenQueryImgFromBufferParamsThenUseUserValu
|
||||||
size_t expectedRowPitch = imgDesc.image_row_pitch;
|
size_t expectedRowPitch = imgDesc.image_row_pitch;
|
||||||
|
|
||||||
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
|
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
|
||||||
MockGmm::queryImgFromBufferParams(imgInfo, &bufferAllocation);
|
GmmHelper::queryImgFromBufferParams(imgInfo, &bufferAllocation);
|
||||||
|
|
||||||
EXPECT_EQ(imgInfo.rowPitch, expectedRowPitch);
|
EXPECT_EQ(imgInfo.rowPitch, expectedRowPitch);
|
||||||
}
|
}
|
||||||
|
@ -273,34 +274,34 @@ TEST_F(GmmTests, givenNonZeroRowPitchWhenQueryImgFromBufferParamsThenUseUserValu
|
||||||
TEST_F(GmmTests, canonize) {
|
TEST_F(GmmTests, canonize) {
|
||||||
uint64_t addr1 = 0x7777777777777777;
|
uint64_t addr1 = 0x7777777777777777;
|
||||||
uint64_t addrExpected1 = 0x0000777777777777;
|
uint64_t addrExpected1 = 0x0000777777777777;
|
||||||
EXPECT_EQ(Gmm::canonize(addr1), addrExpected1);
|
EXPECT_EQ(GmmHelper::canonize(addr1), addrExpected1);
|
||||||
|
|
||||||
uint64_t addr2 = 0x7FFFFFFFFFFFFFFF;
|
uint64_t addr2 = 0x7FFFFFFFFFFFFFFF;
|
||||||
uint64_t addrExpected2 = 0xFFFFFFFFFFFFFFFF;
|
uint64_t addrExpected2 = 0xFFFFFFFFFFFFFFFF;
|
||||||
EXPECT_EQ(Gmm::canonize(addr2), addrExpected2);
|
EXPECT_EQ(GmmHelper::canonize(addr2), addrExpected2);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(GmmTests, decanonize) {
|
TEST_F(GmmTests, decanonize) {
|
||||||
uint64_t addr1 = 0x7777777777777777;
|
uint64_t addr1 = 0x7777777777777777;
|
||||||
uint64_t addrExpected1 = 0x0000777777777777;
|
uint64_t addrExpected1 = 0x0000777777777777;
|
||||||
EXPECT_EQ(Gmm::decanonize(addr1), addrExpected1);
|
EXPECT_EQ(GmmHelper::decanonize(addr1), addrExpected1);
|
||||||
|
|
||||||
uint64_t addr2 = 0x7FFFFFFFFFFFFFFF;
|
uint64_t addr2 = 0x7FFFFFFFFFFFFFFF;
|
||||||
uint64_t addrExpected2 = 0x0000FFFFFFFFFFFF;
|
uint64_t addrExpected2 = 0x0000FFFFFFFFFFFF;
|
||||||
EXPECT_EQ(Gmm::decanonize(addr2), addrExpected2);
|
EXPECT_EQ(GmmHelper::decanonize(addr2), addrExpected2);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(GmmTests, returnRenderAlignment) {
|
TEST_F(GmmTests, returnRenderAlignment) {
|
||||||
uint32_t tileModes[4][2] = {{0, 2}, {1, 3}, {2, 1}, {3, 0}}; // {given, expected}
|
uint32_t tileModes[4][2] = {{0, 2}, {1, 3}, {2, 1}, {3, 0}}; // {given, expected}
|
||||||
for (uint32_t i = 0; i < 4; i++) {
|
for (uint32_t i = 0; i < 4; i++) {
|
||||||
EXPECT_EQ(Gmm::getRenderTileMode(tileModes[i][0]), tileModes[i][1]);
|
EXPECT_EQ(GmmHelper::getRenderTileMode(tileModes[i][0]), tileModes[i][1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(GmmTests, returnRenderTileMode) {
|
TEST_F(GmmTests, returnRenderTileMode) {
|
||||||
uint32_t alignments[5][2] = {{0, 1}, {4, 1}, {8, 2}, {16, 3}, {20, 1}}; // {given, expected}
|
uint32_t alignments[5][2] = {{0, 1}, {4, 1}, {8, 2}, {16, 3}, {20, 1}}; // {given, expected}
|
||||||
for (uint32_t i = 0; i < 5; i++) {
|
for (uint32_t i = 0; i < 5; i++) {
|
||||||
EXPECT_EQ(Gmm::getRenderAlignment(alignments[i][0]), alignments[i][1]);
|
EXPECT_EQ(GmmHelper::getRenderAlignment(alignments[i][0]), alignments[i][1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -322,7 +323,7 @@ TEST_F(GmmTests, givenMipmapedInputWhenAskedForHalingThenNonDefaultValueIsReturn
|
||||||
TEST_F(GmmTests, givenNumSamplesWhenAskedForMultisamplesCountThenReturnValue) {
|
TEST_F(GmmTests, givenNumSamplesWhenAskedForMultisamplesCountThenReturnValue) {
|
||||||
uint32_t numSamples[5][2] = {{0, 0}, {2, 1}, {4, 2}, {8, 3}, {16, 4}}; //{given, expected}
|
uint32_t numSamples[5][2] = {{0, 0}, {2, 1}, {4, 2}, {8, 3}, {16, 4}}; //{given, expected}
|
||||||
for (int i = 0; i < 5; i++) {
|
for (int i = 0; i < 5; i++) {
|
||||||
auto result = Gmm::getRenderMultisamplesCount(numSamples[i][0]);
|
auto result = GmmHelper::getRenderMultisamplesCount(numSamples[i][0]);
|
||||||
EXPECT_EQ(numSamples[i][1], result);
|
EXPECT_EQ(numSamples[i][1], result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -345,7 +346,7 @@ class GmmTiling : public GmmTests,
|
||||||
public ::testing::WithParamInterface<uint32_t /*cl_mem_object_type*/> {
|
public ::testing::WithParamInterface<uint32_t /*cl_mem_object_type*/> {
|
||||||
public:
|
public:
|
||||||
void checkTiling(cl_image_desc &imgDesc, bool forceLinear) {
|
void checkTiling(cl_image_desc &imgDesc, bool forceLinear) {
|
||||||
bool allowTiling = Gmm::allowTiling(imgDesc);
|
bool allowTiling = GmmHelper::allowTiling(imgDesc);
|
||||||
if (forceLinear) {
|
if (forceLinear) {
|
||||||
EXPECT_FALSE(allowTiling);
|
EXPECT_FALSE(allowTiling);
|
||||||
} else {
|
} else {
|
||||||
|
@ -413,7 +414,7 @@ TEST_F(GmmTests, converOclPlaneToGmmPlane) {
|
||||||
{OCLPlane::PLANE_V, GMM_YUV_PLANE::GMM_PLANE_V}};
|
{OCLPlane::PLANE_V, GMM_YUV_PLANE::GMM_PLANE_V}};
|
||||||
|
|
||||||
for (auto p : v) {
|
for (auto p : v) {
|
||||||
EXPECT_TRUE(p.second == Gmm::convertPlane(p.first));
|
EXPECT_TRUE(p.second == GmmHelper::convertPlane(p.first));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -569,7 +570,7 @@ TEST_F(GmmTests, copyResourceBlt) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(GmmTest, givenAllValidFlagsWhenAskedForUnifiedAuxTranslationCapabilityThenReturnTrue) {
|
TEST(GmmTest, givenAllValidFlagsWhenAskedForUnifiedAuxTranslationCapabilityThenReturnTrue) {
|
||||||
auto gmm = std::unique_ptr<Gmm>(Gmm::create(nullptr, 1, false));
|
auto gmm = std::unique_ptr<Gmm>(GmmHelper::create(nullptr, 1, false));
|
||||||
auto mockResource = reinterpret_cast<MockGmmResourceInfo *>(gmm->gmmResourceInfo.get());
|
auto mockResource = reinterpret_cast<MockGmmResourceInfo *>(gmm->gmmResourceInfo.get());
|
||||||
|
|
||||||
mockResource->setUnifiedAuxTranslationCapable();
|
mockResource->setUnifiedAuxTranslationCapable();
|
||||||
|
@ -581,7 +582,7 @@ TEST(GmmTest, givenAllValidFlagsWhenAskedForUnifiedAuxTranslationCapabilityThenR
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(GmmTest, givenInvalidFlagsSetWhenAskedForUnifiedAuxTranslationCapabilityThenReturnFalse) {
|
TEST(GmmTest, givenInvalidFlagsSetWhenAskedForUnifiedAuxTranslationCapabilityThenReturnFalse) {
|
||||||
auto gmm = std::unique_ptr<Gmm>(Gmm::create(nullptr, 1, false));
|
auto gmm = std::unique_ptr<Gmm>(GmmHelper::create(nullptr, 1, false));
|
||||||
auto mockResource = reinterpret_cast<MockGmmResourceInfo *>(gmm->gmmResourceInfo.get());
|
auto mockResource = reinterpret_cast<MockGmmResourceInfo *>(gmm->gmmResourceInfo.get());
|
||||||
|
|
||||||
mockResource->mockResourceCreateParams.Flags.Gpu.CCS = 0;
|
mockResource->mockResourceCreateParams.Flags.Gpu.CCS = 0;
|
||||||
|
@ -600,23 +601,23 @@ TEST(GmmTest, givenInvalidFlagsSetWhenAskedForUnifiedAuxTranslationCapabilityThe
|
||||||
|
|
||||||
TEST(GmmTest, whenContextIsInitializedMultipleTimesThenDontOverride) {
|
TEST(GmmTest, whenContextIsInitializedMultipleTimesThenDontOverride) {
|
||||||
const HardwareInfo *hwinfo = *platformDevices;
|
const HardwareInfo *hwinfo = *platformDevices;
|
||||||
EXPECT_TRUE(Gmm::initContext(hwinfo->pPlatform, hwinfo->pSkuTable, hwinfo->pWaTable, hwinfo->pSysInfo));
|
EXPECT_TRUE(GmmHelper::initContext(hwinfo->pPlatform, hwinfo->pSkuTable, hwinfo->pWaTable, hwinfo->pSysInfo));
|
||||||
auto currentClientContext = Gmm::gmmClientContext;
|
auto currentClientContext = GmmHelper::gmmClientContext;
|
||||||
|
|
||||||
EXPECT_TRUE(Gmm::initContext(hwinfo->pPlatform, hwinfo->pSkuTable, hwinfo->pWaTable, hwinfo->pSysInfo));
|
EXPECT_TRUE(GmmHelper::initContext(hwinfo->pPlatform, hwinfo->pSkuTable, hwinfo->pWaTable, hwinfo->pSysInfo));
|
||||||
|
|
||||||
EXPECT_EQ(currentClientContext, Gmm::gmmClientContext);
|
EXPECT_EQ(currentClientContext, GmmHelper::gmmClientContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(GmmTest, whenContextIsDestroyedMultimpleTimesThenDontCrash) {
|
TEST(GmmTest, whenContextIsDestroyedMultimpleTimesThenDontCrash) {
|
||||||
const HardwareInfo *hwinfo = *platformDevices;
|
const HardwareInfo *hwinfo = *platformDevices;
|
||||||
EXPECT_TRUE(Gmm::initContext(hwinfo->pPlatform, hwinfo->pSkuTable, hwinfo->pWaTable, hwinfo->pSysInfo));
|
EXPECT_TRUE(GmmHelper::initContext(hwinfo->pPlatform, hwinfo->pSkuTable, hwinfo->pWaTable, hwinfo->pSysInfo));
|
||||||
|
|
||||||
Gmm::destroyContext();
|
GmmHelper::destroyContext();
|
||||||
EXPECT_EQ(nullptr, Gmm::gmmClientContext);
|
EXPECT_EQ(nullptr, GmmHelper::gmmClientContext);
|
||||||
Gmm::destroyContext();
|
GmmHelper::destroyContext();
|
||||||
|
|
||||||
EXPECT_TRUE(Gmm::initContext(hwinfo->pPlatform, hwinfo->pSkuTable, hwinfo->pWaTable, hwinfo->pSysInfo));
|
EXPECT_TRUE(GmmHelper::initContext(hwinfo->pPlatform, hwinfo->pSkuTable, hwinfo->pWaTable, hwinfo->pSysInfo));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(GmmTest, whenResourceIsCreatedThenHandleItsOwnership) {
|
TEST(GmmTest, whenResourceIsCreatedThenHandleItsOwnership) {
|
||||||
|
@ -648,19 +649,19 @@ TEST(GmmTest, whenResourceIsCreatedThenHandleItsOwnership) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(GmmSimplifiedCacheSelectionPolicy, givenGmmInSimplifiedCacheSelectionPolicyWhenItIsAskedForUncachedIndexThen0IsReturned) {
|
TEST(GmmSimplifiedCacheSelectionPolicy, givenGmmInSimplifiedCacheSelectionPolicyWhenItIsAskedForUncachedIndexThen0IsReturned) {
|
||||||
Gmm::useSimplifiedMocsTable = true;
|
GmmHelper::useSimplifiedMocsTable = true;
|
||||||
auto index = Gmm::getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED);
|
auto index = GmmHelper::getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED);
|
||||||
auto expectedIndex = cacheDisabledIndex;
|
auto expectedIndex = GmmHelper::cacheDisabledIndex;
|
||||||
EXPECT_EQ(expectedIndex, index);
|
EXPECT_EQ(expectedIndex, index);
|
||||||
Gmm::useSimplifiedMocsTable = false;
|
GmmHelper::useSimplifiedMocsTable = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(GmmSimplifiedCacheSelectionPolicy, givenGmmInSimplifiedCacheSelectionPolicyWhenItIsAskedForCachedIndexThen4IsReturned) {
|
TEST(GmmSimplifiedCacheSelectionPolicy, givenGmmInSimplifiedCacheSelectionPolicyWhenItIsAskedForCachedIndexThen4IsReturned) {
|
||||||
Gmm::useSimplifiedMocsTable = true;
|
GmmHelper::useSimplifiedMocsTable = true;
|
||||||
auto index = Gmm::getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER);
|
auto index = GmmHelper::getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER);
|
||||||
auto expectedIndex = cacheEnabledIndex;
|
auto expectedIndex = GmmHelper::cacheEnabledIndex;
|
||||||
EXPECT_EQ(expectedIndex, index);
|
EXPECT_EQ(expectedIndex, index);
|
||||||
Gmm::useSimplifiedMocsTable = false;
|
GmmHelper::useSimplifiedMocsTable = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace OCLRT
|
} // namespace OCLRT
|
||||||
|
|
|
@ -200,7 +200,7 @@ TEST_F(DrmTests, failOnSoftPin) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(DrmTests, failOnParamBoost) {
|
TEST_F(DrmTests, failOnParamBoost) {
|
||||||
VariableBackup<bool> useSimplifiedMocsTableBckp(&Gmm::useSimplifiedMocsTable);
|
VariableBackup<bool> useSimplifiedMocsTableBckp(&GmmHelper::useSimplifiedMocsTable);
|
||||||
failOnParamBoost = -1;
|
failOnParamBoost = -1;
|
||||||
|
|
||||||
auto ptr = DrmWrap::createDrm(0);
|
auto ptr = DrmWrap::createDrm(0);
|
||||||
|
@ -210,76 +210,76 @@ TEST_F(DrmTests, failOnParamBoost) {
|
||||||
|
|
||||||
#ifdef SUPPORT_BDW
|
#ifdef SUPPORT_BDW
|
||||||
TEST_F(DrmTests, givenKernelNotSupportingTurboPatchWhenBdwDeviceIsCreatedThenSimplifiedMocsSelectionIsFalse) {
|
TEST_F(DrmTests, givenKernelNotSupportingTurboPatchWhenBdwDeviceIsCreatedThenSimplifiedMocsSelectionIsFalse) {
|
||||||
VariableBackup<bool> useSimplifiedMocsTableBckp(&Gmm::useSimplifiedMocsTable);
|
VariableBackup<bool> useSimplifiedMocsTableBckp(&GmmHelper::useSimplifiedMocsTable);
|
||||||
useSimplifiedMocsTableBckp = false;
|
useSimplifiedMocsTableBckp = false;
|
||||||
deviceId = IBDW_GT3_WRK_DEVICE_F0_ID;
|
deviceId = IBDW_GT3_WRK_DEVICE_F0_ID;
|
||||||
failOnParamBoost = -1;
|
failOnParamBoost = -1;
|
||||||
auto ptr = DrmWrap::createDrm(0);
|
auto ptr = DrmWrap::createDrm(0);
|
||||||
EXPECT_NE(ptr, nullptr);
|
EXPECT_NE(ptr, nullptr);
|
||||||
EXPECT_FALSE(Gmm::useSimplifiedMocsTable);
|
EXPECT_FALSE(GmmHelper::useSimplifiedMocsTable);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SUPPORT_SKL
|
#ifdef SUPPORT_SKL
|
||||||
TEST_F(DrmTests, givenKernelNotSupportingTurboPatchWhenSklDeviceIsCreatedThenSimplifiedMocsSelectionIsTrue) {
|
TEST_F(DrmTests, givenKernelNotSupportingTurboPatchWhenSklDeviceIsCreatedThenSimplifiedMocsSelectionIsTrue) {
|
||||||
VariableBackup<bool> useSimplifiedMocsTableBckp(&Gmm::useSimplifiedMocsTable);
|
VariableBackup<bool> useSimplifiedMocsTableBckp(&GmmHelper::useSimplifiedMocsTable);
|
||||||
useSimplifiedMocsTableBckp = false;
|
useSimplifiedMocsTableBckp = false;
|
||||||
deviceId = ISKL_GT2_DT_DEVICE_F0_ID;
|
deviceId = ISKL_GT2_DT_DEVICE_F0_ID;
|
||||||
failOnParamBoost = -1;
|
failOnParamBoost = -1;
|
||||||
auto ptr = DrmWrap::createDrm(0);
|
auto ptr = DrmWrap::createDrm(0);
|
||||||
EXPECT_NE(ptr, nullptr);
|
EXPECT_NE(ptr, nullptr);
|
||||||
EXPECT_TRUE(Gmm::useSimplifiedMocsTable);
|
EXPECT_TRUE(GmmHelper::useSimplifiedMocsTable);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef SUPPORT_KBL
|
#ifdef SUPPORT_KBL
|
||||||
TEST_F(DrmTests, givenKernelNotSupportingTurboPatchWhenKblDeviceIsCreatedThenSimplifiedMocsSelectionIsTrue) {
|
TEST_F(DrmTests, givenKernelNotSupportingTurboPatchWhenKblDeviceIsCreatedThenSimplifiedMocsSelectionIsTrue) {
|
||||||
VariableBackup<bool> useSimplifiedMocsTableBckp(&Gmm::useSimplifiedMocsTable);
|
VariableBackup<bool> useSimplifiedMocsTableBckp(&GmmHelper::useSimplifiedMocsTable);
|
||||||
useSimplifiedMocsTableBckp = false;
|
useSimplifiedMocsTableBckp = false;
|
||||||
deviceId = IKBL_GT1_ULT_DEVICE_F0_ID;
|
deviceId = IKBL_GT1_ULT_DEVICE_F0_ID;
|
||||||
failOnParamBoost = -1;
|
failOnParamBoost = -1;
|
||||||
auto ptr = DrmWrap::createDrm(0);
|
auto ptr = DrmWrap::createDrm(0);
|
||||||
EXPECT_NE(ptr, nullptr);
|
EXPECT_NE(ptr, nullptr);
|
||||||
EXPECT_TRUE(Gmm::useSimplifiedMocsTable);
|
EXPECT_TRUE(GmmHelper::useSimplifiedMocsTable);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef SUPPORT_BXT
|
#ifdef SUPPORT_BXT
|
||||||
TEST_F(DrmTests, givenKernelNotSupportingTurboPatchWhenBxtDeviceIsCreatedThenSimplifiedMocsSelectionIsTrue) {
|
TEST_F(DrmTests, givenKernelNotSupportingTurboPatchWhenBxtDeviceIsCreatedThenSimplifiedMocsSelectionIsTrue) {
|
||||||
VariableBackup<bool> useSimplifiedMocsTableBckp(&Gmm::useSimplifiedMocsTable);
|
VariableBackup<bool> useSimplifiedMocsTableBckp(&GmmHelper::useSimplifiedMocsTable);
|
||||||
useSimplifiedMocsTableBckp = false;
|
useSimplifiedMocsTableBckp = false;
|
||||||
deviceId = IBXT_X_DEVICE_F0_ID;
|
deviceId = IBXT_X_DEVICE_F0_ID;
|
||||||
failOnParamBoost = -1;
|
failOnParamBoost = -1;
|
||||||
auto ptr = DrmWrap::createDrm(0);
|
auto ptr = DrmWrap::createDrm(0);
|
||||||
EXPECT_NE(ptr, nullptr);
|
EXPECT_NE(ptr, nullptr);
|
||||||
EXPECT_TRUE(Gmm::useSimplifiedMocsTable);
|
EXPECT_TRUE(GmmHelper::useSimplifiedMocsTable);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef SUPPORT_GLK
|
#ifdef SUPPORT_GLK
|
||||||
TEST_F(DrmTests, givenKernelNotSupportingTurboPatchWhenGlkDeviceIsCreatedThenSimplifiedMocsSelectionIsTrue) {
|
TEST_F(DrmTests, givenKernelNotSupportingTurboPatchWhenGlkDeviceIsCreatedThenSimplifiedMocsSelectionIsTrue) {
|
||||||
VariableBackup<bool> useSimplifiedMocsTableBckp(&Gmm::useSimplifiedMocsTable);
|
VariableBackup<bool> useSimplifiedMocsTableBckp(&GmmHelper::useSimplifiedMocsTable);
|
||||||
useSimplifiedMocsTableBckp = false;
|
useSimplifiedMocsTableBckp = false;
|
||||||
deviceId = IGLK_GT2_ULT_18EU_DEVICE_F0_ID;
|
deviceId = IGLK_GT2_ULT_18EU_DEVICE_F0_ID;
|
||||||
failOnParamBoost = -1;
|
failOnParamBoost = -1;
|
||||||
auto ptr = DrmWrap::createDrm(0);
|
auto ptr = DrmWrap::createDrm(0);
|
||||||
EXPECT_NE(ptr, nullptr);
|
EXPECT_NE(ptr, nullptr);
|
||||||
EXPECT_TRUE(Gmm::useSimplifiedMocsTable);
|
EXPECT_TRUE(GmmHelper::useSimplifiedMocsTable);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef SUPPORT_CFL
|
#ifdef SUPPORT_CFL
|
||||||
TEST_F(DrmTests, givenKernelNotSupportingTurboPatchWhenCflDeviceIsCreatedThenSimplifiedMocsSelectionIsTrue) {
|
TEST_F(DrmTests, givenKernelNotSupportingTurboPatchWhenCflDeviceIsCreatedThenSimplifiedMocsSelectionIsTrue) {
|
||||||
VariableBackup<bool> useSimplifiedMocsTableBckp(&Gmm::useSimplifiedMocsTable);
|
VariableBackup<bool> useSimplifiedMocsTableBckp(&GmmHelper::useSimplifiedMocsTable);
|
||||||
useSimplifiedMocsTableBckp = false;
|
useSimplifiedMocsTableBckp = false;
|
||||||
deviceId = ICFL_GT1_S61_DT_DEVICE_F0_ID;
|
deviceId = ICFL_GT1_S61_DT_DEVICE_F0_ID;
|
||||||
failOnParamBoost = -1;
|
failOnParamBoost = -1;
|
||||||
auto ptr = DrmWrap::createDrm(0);
|
auto ptr = DrmWrap::createDrm(0);
|
||||||
EXPECT_NE(ptr, nullptr);
|
EXPECT_NE(ptr, nullptr);
|
||||||
EXPECT_TRUE(Gmm::useSimplifiedMocsTable);
|
EXPECT_TRUE(GmmHelper::useSimplifiedMocsTable);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
TEST_F(DrmTests, givenKernelSupportingTurboPatchWhenDeviceIsCreatedThenSimplifiedMocsSelectionIsFalse) {
|
TEST_F(DrmTests, givenKernelSupportingTurboPatchWhenDeviceIsCreatedThenSimplifiedMocsSelectionIsFalse) {
|
||||||
auto ptr = DrmWrap::createDrm(0);
|
auto ptr = DrmWrap::createDrm(0);
|
||||||
EXPECT_NE(ptr, nullptr);
|
EXPECT_NE(ptr, nullptr);
|
||||||
EXPECT_FALSE(Gmm::useSimplifiedMocsTable);
|
EXPECT_FALSE(GmmHelper::useSimplifiedMocsTable);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(I915_PARAM_HAS_PREEMPTION)
|
#if defined(I915_PARAM_HAS_PREEMPTION)
|
||||||
|
|
|
@ -142,15 +142,15 @@ LONG WINAPI UltExceptionFilter(
|
||||||
|
|
||||||
void initializeTestHelpers() {
|
void initializeTestHelpers() {
|
||||||
const HardwareInfo *hwinfo = *platformDevices;
|
const HardwareInfo *hwinfo = *platformDevices;
|
||||||
auto initialized = Gmm::initContext(hwinfo->pPlatform, hwinfo->pSkuTable,
|
auto initialized = GmmHelper::initContext(hwinfo->pPlatform, hwinfo->pSkuTable,
|
||||||
hwinfo->pWaTable, hwinfo->pSysInfo);
|
hwinfo->pWaTable, hwinfo->pSysInfo);
|
||||||
ASSERT_TRUE(initialized);
|
ASSERT_TRUE(initialized);
|
||||||
GlobalMockSipProgram::initSipProgram();
|
GlobalMockSipProgram::initSipProgram();
|
||||||
}
|
}
|
||||||
|
|
||||||
void cleanTestHelpers() {
|
void cleanTestHelpers() {
|
||||||
GlobalMockSipProgram::shutDownSipProgram();
|
GlobalMockSipProgram::shutDownSipProgram();
|
||||||
Gmm::destroyContext();
|
GmmHelper::destroyContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string getHardwarePrefix() {
|
std::string getHardwarePrefix() {
|
||||||
|
|
|
@ -789,7 +789,7 @@ HWTEST_F(BufferSetSurfaceTests, givenBufferSetSurfaceThatMemoryPtrAndSizeIsAlign
|
||||||
ptr);
|
ptr);
|
||||||
|
|
||||||
auto mocs = surfaceState.getMemoryObjectControlState();
|
auto mocs = surfaceState.getMemoryObjectControlState();
|
||||||
EXPECT_EQ(Gmm::getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER), mocs);
|
EXPECT_EQ(GmmHelper::getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER), mocs);
|
||||||
|
|
||||||
alignedFree(ptr);
|
alignedFree(ptr);
|
||||||
}
|
}
|
||||||
|
@ -811,7 +811,7 @@ HWTEST_F(BufferSetSurfaceTests, givenBufferSetSurfaceThatMemoryPtrIsUnalignedToC
|
||||||
offsetedPtr);
|
offsetedPtr);
|
||||||
|
|
||||||
auto mocs = surfaceState.getMemoryObjectControlState();
|
auto mocs = surfaceState.getMemoryObjectControlState();
|
||||||
EXPECT_EQ(Gmm::getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED), mocs);
|
EXPECT_EQ(GmmHelper::getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED), mocs);
|
||||||
|
|
||||||
alignedFree(ptr);
|
alignedFree(ptr);
|
||||||
}
|
}
|
||||||
|
@ -833,7 +833,7 @@ HWTEST_F(BufferSetSurfaceTests, givenBufferSetSurfaceThatMemorySizeIsUnalignedTo
|
||||||
ptr);
|
ptr);
|
||||||
|
|
||||||
auto mocs = surfaceState.getMemoryObjectControlState();
|
auto mocs = surfaceState.getMemoryObjectControlState();
|
||||||
EXPECT_EQ(Gmm::getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED), mocs);
|
EXPECT_EQ(GmmHelper::getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED), mocs);
|
||||||
|
|
||||||
alignedFree(ptr);
|
alignedFree(ptr);
|
||||||
}
|
}
|
||||||
|
@ -857,7 +857,7 @@ HWTEST_F(BufferSetSurfaceTests, givenBufferSetSurfaceThatMemoryIsUnalignedToCach
|
||||||
CL_MEM_READ_ONLY);
|
CL_MEM_READ_ONLY);
|
||||||
|
|
||||||
auto mocs = surfaceState.getMemoryObjectControlState();
|
auto mocs = surfaceState.getMemoryObjectControlState();
|
||||||
EXPECT_EQ(Gmm::getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER), mocs);
|
EXPECT_EQ(GmmHelper::getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER), mocs);
|
||||||
|
|
||||||
alignedFree(ptr);
|
alignedFree(ptr);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "hw_cmds.h"
|
#include "hw_cmds.h"
|
||||||
|
#include "runtime/gmm_helper/gmm.h"
|
||||||
#include "runtime/gmm_helper/gmm_helper.h"
|
#include "runtime/gmm_helper/gmm_helper.h"
|
||||||
#include "runtime/helpers/surface_formats.h"
|
#include "runtime/helpers/surface_formats.h"
|
||||||
#include "runtime/helpers/ptr_math.h"
|
#include "runtime/helpers/ptr_math.h"
|
||||||
|
@ -250,7 +251,7 @@ HWTEST_F(ImageSetArgTest, givenOffsetedBufferWhenSetKernelArgImageIscalledThenFu
|
||||||
}
|
}
|
||||||
|
|
||||||
HWTEST_F(ImageSetArgTest, clSetKernelArgImage) {
|
HWTEST_F(ImageSetArgTest, clSetKernelArgImage) {
|
||||||
auto imageMocs = Gmm::getMOCS(GMM_RESOURCE_USAGE_OCL_IMAGE);
|
auto imageMocs = GmmHelper::getMOCS(GMM_RESOURCE_USAGE_OCL_IMAGE);
|
||||||
typedef typename FamilyType::RENDER_SURFACE_STATE RENDER_SURFACE_STATE;
|
typedef typename FamilyType::RENDER_SURFACE_STATE RENDER_SURFACE_STATE;
|
||||||
cl_mem memObj = srcImage;
|
cl_mem memObj = srcImage;
|
||||||
|
|
||||||
|
@ -416,7 +417,7 @@ HWTEST_F(ImageSetArgTest, givenMcsAllocationWhenSetArgIsCalledWithoutUnifiedAuxC
|
||||||
typedef typename FamilyType::RENDER_SURFACE_STATE RENDER_SURFACE_STATE;
|
typedef typename FamilyType::RENDER_SURFACE_STATE RENDER_SURFACE_STATE;
|
||||||
McsSurfaceInfo msi = {10, 20, 3};
|
McsSurfaceInfo msi = {10, 20, 3};
|
||||||
auto mcsAlloc = context->getMemoryManager()->allocateGraphicsMemory(4096);
|
auto mcsAlloc = context->getMemoryManager()->allocateGraphicsMemory(4096);
|
||||||
mcsAlloc->gmm = Gmm::create(nullptr, 1, false);
|
mcsAlloc->gmm = GmmHelper::create(nullptr, 1, false);
|
||||||
cl_image_desc imgDesc = Image2dDefaults::imageDesc;
|
cl_image_desc imgDesc = Image2dDefaults::imageDesc;
|
||||||
imgDesc.num_samples = 8;
|
imgDesc.num_samples = 8;
|
||||||
|
|
||||||
|
@ -513,7 +514,7 @@ HWTEST_F(ImageSetArgTest, givenMcsAllocationAndRenderCompressionWhenSetArgOnMult
|
||||||
typedef typename FamilyType::RENDER_SURFACE_STATE RENDER_SURFACE_STATE;
|
typedef typename FamilyType::RENDER_SURFACE_STATE RENDER_SURFACE_STATE;
|
||||||
McsSurfaceInfo msi = {10, 20, 3};
|
McsSurfaceInfo msi = {10, 20, 3};
|
||||||
auto mcsAlloc = context->getMemoryManager()->allocateGraphicsMemory(4096);
|
auto mcsAlloc = context->getMemoryManager()->allocateGraphicsMemory(4096);
|
||||||
mcsAlloc->gmm = Gmm::create(nullptr, 1, false);
|
mcsAlloc->gmm = GmmHelper::create(nullptr, 1, false);
|
||||||
cl_image_desc imgDesc = Image2dDefaults::imageDesc;
|
cl_image_desc imgDesc = Image2dDefaults::imageDesc;
|
||||||
imgDesc.num_samples = 8;
|
imgDesc.num_samples = 8;
|
||||||
|
|
||||||
|
@ -570,7 +571,7 @@ HWTEST_F(ImageSetArgTest, givenMcsAllocationWhenSetArgIsCalledWithUnifiedAuxCapa
|
||||||
typedef typename FamilyType::RENDER_SURFACE_STATE RENDER_SURFACE_STATE;
|
typedef typename FamilyType::RENDER_SURFACE_STATE RENDER_SURFACE_STATE;
|
||||||
McsSurfaceInfo msi = {10, 20, 3};
|
McsSurfaceInfo msi = {10, 20, 3};
|
||||||
auto mcsAlloc = context->getMemoryManager()->allocateGraphicsMemory(4096);
|
auto mcsAlloc = context->getMemoryManager()->allocateGraphicsMemory(4096);
|
||||||
mcsAlloc->gmm = Gmm::create(nullptr, 1, false);
|
mcsAlloc->gmm = GmmHelper::create(nullptr, 1, false);
|
||||||
cl_image_desc imgDesc = Image2dDefaults::imageDesc;
|
cl_image_desc imgDesc = Image2dDefaults::imageDesc;
|
||||||
imgDesc.num_samples = 8;
|
imgDesc.num_samples = 8;
|
||||||
|
|
||||||
|
@ -793,7 +794,7 @@ class ImageMediaBlockSetArgTest : public ImageSetArgTest {
|
||||||
};
|
};
|
||||||
|
|
||||||
HWTEST_F(ImageMediaBlockSetArgTest, clSetKernelArgImage) {
|
HWTEST_F(ImageMediaBlockSetArgTest, clSetKernelArgImage) {
|
||||||
auto imageMocs = Gmm::getMOCS(GMM_RESOURCE_USAGE_OCL_IMAGE);
|
auto imageMocs = GmmHelper::getMOCS(GMM_RESOURCE_USAGE_OCL_IMAGE);
|
||||||
typedef typename FamilyType::RENDER_SURFACE_STATE RENDER_SURFACE_STATE;
|
typedef typename FamilyType::RENDER_SURFACE_STATE RENDER_SURFACE_STATE;
|
||||||
cl_mem memObj = srcImage;
|
cl_mem memObj = srcImage;
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
#include "runtime/helpers/surface_formats.h"
|
#include "runtime/helpers/surface_formats.h"
|
||||||
#include "runtime/helpers/aligned_memory.h"
|
#include "runtime/helpers/aligned_memory.h"
|
||||||
#include "runtime/gmm_helper/gmm_helper.h"
|
#include "runtime/gmm_helper/gmm.h"
|
||||||
#include "runtime/mem_obj/image.h"
|
#include "runtime/mem_obj/image.h"
|
||||||
#include "unit_tests/fixtures/device_fixture.h"
|
#include "unit_tests/fixtures/device_fixture.h"
|
||||||
#include "unit_tests/helpers/debug_manager_state_restore.h"
|
#include "unit_tests/helpers/debug_manager_state_restore.h"
|
||||||
|
|
|
@ -834,7 +834,7 @@ TEST(OsAgnosticMemoryManager, givenDefaultMemoryManagerWhenAllocateGraphicsMemor
|
||||||
TEST(OsAgnosticMemoryManager, givenDefaultMemoryManagerAndUnifiedAuxCapableAllocationWhenMappingThenReturnFalse) {
|
TEST(OsAgnosticMemoryManager, givenDefaultMemoryManagerAndUnifiedAuxCapableAllocationWhenMappingThenReturnFalse) {
|
||||||
OsAgnosticMemoryManager memoryManager;
|
OsAgnosticMemoryManager memoryManager;
|
||||||
|
|
||||||
auto gmm = Gmm::create(nullptr, 123, false);
|
auto gmm = GmmHelper::create(nullptr, 123, false);
|
||||||
auto allocation = memoryManager.allocateGraphicsMemory(123);
|
auto allocation = memoryManager.allocateGraphicsMemory(123);
|
||||||
allocation->gmm = gmm;
|
allocation->gmm = gmm;
|
||||||
|
|
||||||
|
@ -1215,7 +1215,7 @@ TEST(OsAgnosticMemoryManager, givenDefaultOsAgnosticMemoryManagerWhenItIsQueried
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(MemoryAllocatorTest, GivenSizeWhenGmmIsCreatedThenSuccess) {
|
TEST_F(MemoryAllocatorTest, GivenSizeWhenGmmIsCreatedThenSuccess) {
|
||||||
Gmm *gmm = Gmm::create(nullptr, 65536, false);
|
Gmm *gmm = GmmHelper::create(nullptr, 65536, false);
|
||||||
EXPECT_NE(nullptr, gmm);
|
EXPECT_NE(nullptr, gmm);
|
||||||
delete gmm;
|
delete gmm;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
#include "runtime/gmm_helper/gmm.h"
|
||||||
#include "runtime/gmm_helper/gmm_helper.h"
|
#include "runtime/gmm_helper/gmm_helper.h"
|
||||||
#include "unit_tests/mocks/mock_device.h"
|
#include "unit_tests/mocks/mock_device.h"
|
||||||
#include "runtime/helpers/options.h"
|
#include "runtime/helpers/options.h"
|
||||||
|
@ -39,7 +40,7 @@ class MockGmm : public Gmm {
|
||||||
if (!queryHwInfo) {
|
if (!queryHwInfo) {
|
||||||
queryHwInfo = *platformDevices;
|
queryHwInfo = *platformDevices;
|
||||||
}
|
}
|
||||||
return std::unique_ptr<Gmm>(Gmm::createGmmAndQueryImgParams(imgInfo, *queryHwInfo));
|
return std::unique_ptr<Gmm>(GmmHelper::createGmmAndQueryImgParams(imgInfo, *queryHwInfo));
|
||||||
}
|
}
|
||||||
|
|
||||||
static ImageInfo initImgInfo(cl_image_desc &imgDesc, int baseMipLevel, const SurfaceFormatInfo *surfaceFormat) {
|
static ImageInfo initImgInfo(cl_image_desc &imgDesc, int baseMipLevel, const SurfaceFormatInfo *surfaceFormat) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2017, Intel Corporation
|
* Copyright (c) 2017 - 2018, Intel Corporation
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
|
@ -21,7 +21,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "runtime/memory_manager/deferred_deleter.h"
|
#include "runtime/memory_manager/deferred_deleter.h"
|
||||||
#include "runtime/gmm_helper/gmm_helper.h"
|
#include "runtime/gmm_helper/gmm.h"
|
||||||
#include "runtime/helpers/surface_formats.h"
|
#include "runtime/helpers/surface_formats.h"
|
||||||
#include "unit_tests/mocks/mock_memory_manager.h"
|
#include "unit_tests/mocks/mock_memory_manager.h"
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
|
@ -27,6 +27,8 @@
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|
||||||
namespace OCLRT {
|
namespace OCLRT {
|
||||||
|
class GraphicsAllocation;
|
||||||
|
|
||||||
namespace WddmMockHelpers {
|
namespace WddmMockHelpers {
|
||||||
struct CallResult {
|
struct CallResult {
|
||||||
uint32_t called = 0;
|
uint32_t called = 0;
|
||||||
|
|
|
@ -1858,7 +1858,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerAndUnifiedAuxCapableAllocation
|
||||||
mock->ioctl_expected.gemWait = 1;
|
mock->ioctl_expected.gemWait = 1;
|
||||||
mock->ioctl_expected.gemClose = 1;
|
mock->ioctl_expected.gemClose = 1;
|
||||||
|
|
||||||
auto gmm = Gmm::create(nullptr, 123, false);
|
auto gmm = GmmHelper::create(nullptr, 123, false);
|
||||||
auto allocation = memoryManager->allocateGraphicsMemory(123, 123);
|
auto allocation = memoryManager->allocateGraphicsMemory(123, 123);
|
||||||
allocation->gmm = gmm;
|
allocation->gmm = gmm;
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,8 @@
|
||||||
|
|
||||||
#include "unit_tests/os_interface/windows/wddm_fixture.h"
|
#include "unit_tests/os_interface/windows/wddm_fixture.h"
|
||||||
|
|
||||||
|
#include "runtime/gmm_helper/gmm.h"
|
||||||
|
#include "runtime/gmm_helper/gmm_helper.h"
|
||||||
#include "runtime/helpers/hw_info.h"
|
#include "runtime/helpers/hw_info.h"
|
||||||
#include "runtime/helpers/options.h"
|
#include "runtime/helpers/options.h"
|
||||||
#include "runtime/memory_manager/os_agnostic_memory_manager.h"
|
#include "runtime/memory_manager/os_agnostic_memory_manager.h"
|
||||||
|
@ -105,7 +107,7 @@ TEST_F(Wddm20Tests, givenNullPageTableManagerWhenUpdateAuxTableCalledThenReturnF
|
||||||
wddm->resetPageTableManager(nullptr);
|
wddm->resetPageTableManager(nullptr);
|
||||||
EXPECT_EQ(nullptr, wddm->getPageTableManager());
|
EXPECT_EQ(nullptr, wddm->getPageTableManager());
|
||||||
|
|
||||||
auto gmm = std::unique_ptr<Gmm>(Gmm::create(nullptr, 1, false));
|
auto gmm = std::unique_ptr<Gmm>(GmmHelper::create(nullptr, 1, false));
|
||||||
auto mockGmmRes = reinterpret_cast<MockGmmResourceInfo *>(gmm->gmmResourceInfo.get());
|
auto mockGmmRes = reinterpret_cast<MockGmmResourceInfo *>(gmm->gmmResourceInfo.get());
|
||||||
mockGmmRes->setUnifiedAuxTranslationCapable();
|
mockGmmRes->setUnifiedAuxTranslationCapable();
|
||||||
|
|
||||||
|
@ -301,8 +303,8 @@ HWTEST_F(Wddm20Tests, givenGraphicsAllocationWhenItIsMappedInHeap1ThenItHasGpuAd
|
||||||
bool ret = wddm->mapGpuVirtualAddress(&allocation, allocation.getAlignedCpuPtr(), allocation.getAlignedSize(), false, false, true);
|
bool ret = wddm->mapGpuVirtualAddress(&allocation, allocation.getAlignedCpuPtr(), allocation.getAlignedSize(), false, false, true);
|
||||||
EXPECT_TRUE(ret);
|
EXPECT_TRUE(ret);
|
||||||
|
|
||||||
auto cannonizedHeapBase = Gmm::canonize(this->wddm->getGfxPartition().Heap32[1].Base);
|
auto cannonizedHeapBase = GmmHelper::canonize(this->wddm->getGfxPartition().Heap32[1].Base);
|
||||||
auto cannonizedHeapEnd = Gmm::canonize(this->wddm->getGfxPartition().Heap32[1].Limit);
|
auto cannonizedHeapEnd = GmmHelper::canonize(this->wddm->getGfxPartition().Heap32[1].Limit);
|
||||||
|
|
||||||
EXPECT_GE(allocation.gpuPtr, cannonizedHeapBase);
|
EXPECT_GE(allocation.gpuPtr, cannonizedHeapBase);
|
||||||
EXPECT_LE(allocation.gpuPtr, cannonizedHeapEnd);
|
EXPECT_LE(allocation.gpuPtr, cannonizedHeapEnd);
|
||||||
|
@ -386,7 +388,7 @@ HWTEST_F(Wddm20Tests, givenNullAllocationWhenCreateThenAllocateAndMap) {
|
||||||
EXPECT_TRUE(ret);
|
EXPECT_TRUE(ret);
|
||||||
|
|
||||||
EXPECT_NE(0u, allocation.gpuPtr);
|
EXPECT_NE(0u, allocation.gpuPtr);
|
||||||
EXPECT_EQ(allocation.gpuPtr, Gmm::canonize(allocation.gpuPtr));
|
EXPECT_EQ(allocation.gpuPtr, GmmHelper::canonize(allocation.gpuPtr));
|
||||||
|
|
||||||
delete gmm;
|
delete gmm;
|
||||||
mm.freeSystemMemory(allocation.getUnderlyingBuffer());
|
mm.freeSystemMemory(allocation.getUnderlyingBuffer());
|
||||||
|
@ -466,7 +468,7 @@ TEST_F(Wddm20Tests, GetCpuGpuTime) {
|
||||||
|
|
||||||
HWTEST_F(Wddm20WithMockGdiDllTests, givenSharedHandleWhenCreateGraphicsAllocationFromSharedHandleIsCalledThenGraphicsAllocationWithSharedPropertiesIsCreated) {
|
HWTEST_F(Wddm20WithMockGdiDllTests, givenSharedHandleWhenCreateGraphicsAllocationFromSharedHandleIsCalledThenGraphicsAllocationWithSharedPropertiesIsCreated) {
|
||||||
void *pSysMem = (void *)0x1000;
|
void *pSysMem = (void *)0x1000;
|
||||||
std::unique_ptr<Gmm> gmm(Gmm::create(pSysMem, 4096u, false));
|
std::unique_ptr<Gmm> gmm(GmmHelper::create(pSysMem, 4096u, false));
|
||||||
auto status = setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
|
auto status = setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
|
||||||
EXPECT_EQ(0u, status);
|
EXPECT_EQ(0u, status);
|
||||||
|
|
||||||
|
@ -504,7 +506,7 @@ HWTEST_F(Wddm20WithMockGdiDllTests, givenSharedHandleWhenCreateGraphicsAllocatio
|
||||||
|
|
||||||
HWTEST_F(Wddm20WithMockGdiDllTests, givenSharedHandleWhenCreateGraphicsAllocationFromSharedHandleIsCalledThenMapGpuVaWithCpuPtrDepensOnBitness) {
|
HWTEST_F(Wddm20WithMockGdiDllTests, givenSharedHandleWhenCreateGraphicsAllocationFromSharedHandleIsCalledThenMapGpuVaWithCpuPtrDepensOnBitness) {
|
||||||
void *pSysMem = (void *)0x1000;
|
void *pSysMem = (void *)0x1000;
|
||||||
std::unique_ptr<Gmm> gmm(Gmm::create(pSysMem, 4096u, false));
|
std::unique_ptr<Gmm> gmm(GmmHelper::create(pSysMem, 4096u, false));
|
||||||
auto status = setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
|
auto status = setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
|
||||||
EXPECT_EQ(0u, status);
|
EXPECT_EQ(0u, status);
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,8 @@
|
||||||
* OTHER DEALINGS IN THE SOFTWARE.
|
* OTHER DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "runtime/gmm_helper/gmm.h"
|
||||||
|
#include "runtime/gmm_helper/gmm_helper.h"
|
||||||
#include "runtime/os_interface/windows/wddm/wddm.h"
|
#include "runtime/os_interface/windows/wddm/wddm.h"
|
||||||
#include "runtime/os_interface/windows/wddm_allocation.h"
|
#include "runtime/os_interface/windows/wddm_allocation.h"
|
||||||
#include "unit_tests/os_interface/windows/mock_kmdaf_listener.h"
|
#include "unit_tests/os_interface/windows/mock_kmdaf_listener.h"
|
||||||
|
@ -93,7 +95,7 @@ HWTEST_F(WddmKmDafListenerTest, givenWddmWhenUnlockResourceIsCalledThenKmDafList
|
||||||
HWTEST_F(WddmKmDafListenerTest, givenWddmWhenMapGpuVirtualAddressIsCalledThenKmDafListenerNotifyMapGpuVAIsFedWithCorrectParams) {
|
HWTEST_F(WddmKmDafListenerTest, givenWddmWhenMapGpuVirtualAddressIsCalledThenKmDafListenerNotifyMapGpuVAIsFedWithCorrectParams) {
|
||||||
WddmAllocation allocation((void *)0x23000, 0x1000, nullptr);
|
WddmAllocation allocation((void *)0x23000, 0x1000, nullptr);
|
||||||
allocation.handle = ALLOCATION_HANDLE;
|
allocation.handle = ALLOCATION_HANDLE;
|
||||||
auto gmm = std::unique_ptr<Gmm>(Gmm::create(nullptr, 1, false));
|
auto gmm = std::unique_ptr<Gmm>(GmmHelper::create(nullptr, 1, false));
|
||||||
allocation.gmm = gmm.get();
|
allocation.gmm = gmm.get();
|
||||||
|
|
||||||
wddmWithKmDafMock->mapGpuVirtualAddressImpl(allocation.gmm, allocation.handle, allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize(), allocation.gpuPtr, false, false, false);
|
wddmWithKmDafMock->mapGpuVirtualAddressImpl(allocation.gmm, allocation.handle, allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize(), allocation.gpuPtr, false, false, false);
|
||||||
|
@ -102,7 +104,7 @@ HWTEST_F(WddmKmDafListenerTest, givenWddmWhenMapGpuVirtualAddressIsCalledThenKmD
|
||||||
EXPECT_EQ(wddmWithKmDafMock->getAdapter(), wddmWithKmDafMock->getKmDafListenerMock().notifyMapGpuVAParametrization.hAdapter);
|
EXPECT_EQ(wddmWithKmDafMock->getAdapter(), wddmWithKmDafMock->getKmDafListenerMock().notifyMapGpuVAParametrization.hAdapter);
|
||||||
EXPECT_EQ(wddmWithKmDafMock->getDevice(), wddmWithKmDafMock->getKmDafListenerMock().notifyMapGpuVAParametrization.hDevice);
|
EXPECT_EQ(wddmWithKmDafMock->getDevice(), wddmWithKmDafMock->getKmDafListenerMock().notifyMapGpuVAParametrization.hDevice);
|
||||||
EXPECT_EQ(allocation.handle, wddmWithKmDafMock->getKmDafListenerMock().notifyMapGpuVAParametrization.hAllocation);
|
EXPECT_EQ(allocation.handle, wddmWithKmDafMock->getKmDafListenerMock().notifyMapGpuVAParametrization.hAllocation);
|
||||||
EXPECT_EQ(Gmm::decanonize(allocation.gpuPtr), wddmWithKmDafMock->getKmDafListenerMock().notifyMapGpuVAParametrization.GpuVirtualAddress);
|
EXPECT_EQ(GmmHelper::decanonize(allocation.gpuPtr), wddmWithKmDafMock->getKmDafListenerMock().notifyMapGpuVAParametrization.GpuVirtualAddress);
|
||||||
EXPECT_EQ(wddmWithKmDafMock->getGdi()->escape, wddmWithKmDafMock->getKmDafListenerMock().notifyMapGpuVAParametrization.pfnEscape);
|
EXPECT_EQ(wddmWithKmDafMock->getGdi()->escape, wddmWithKmDafMock->getKmDafListenerMock().notifyMapGpuVAParametrization.pfnEscape);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,7 +150,7 @@ HWTEST_F(WddmKmDafListenerTest, givenWddmWhenEvictIsCalledThenKmDafListenerNotif
|
||||||
|
|
||||||
HWTEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocationIsCalledThenKmDafListenerNotifyWriteTargetIsFedWithCorrectParams) {
|
HWTEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocationIsCalledThenKmDafListenerNotifyWriteTargetIsFedWithCorrectParams) {
|
||||||
WddmAllocation allocation((void *)0x23000, 0x1000, nullptr);
|
WddmAllocation allocation((void *)0x23000, 0x1000, nullptr);
|
||||||
auto gmm = std::unique_ptr<Gmm>(Gmm::create(nullptr, 1, false));
|
auto gmm = std::unique_ptr<Gmm>(GmmHelper::create(nullptr, 1, false));
|
||||||
allocation.gmm = gmm.get();
|
allocation.gmm = gmm.get();
|
||||||
|
|
||||||
wddmWithKmDafMock->createAllocation(&allocation);
|
wddmWithKmDafMock->createAllocation(&allocation);
|
||||||
|
@ -162,7 +164,7 @@ HWTEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocationIsCalledThenKmDafLi
|
||||||
|
|
||||||
HWTEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocation64IsCalledThenKmDafListenerNotifyWriteTargetIsFedWithCorrectParams) {
|
HWTEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocation64IsCalledThenKmDafListenerNotifyWriteTargetIsFedWithCorrectParams) {
|
||||||
WddmAllocation allocation((void *)0x23000, 0x1000, nullptr);
|
WddmAllocation allocation((void *)0x23000, 0x1000, nullptr);
|
||||||
auto gmm = std::unique_ptr<Gmm>(Gmm::create(nullptr, 1, false));
|
auto gmm = std::unique_ptr<Gmm>(GmmHelper::create(nullptr, 1, false));
|
||||||
allocation.gmm = gmm.get();
|
allocation.gmm = gmm.get();
|
||||||
|
|
||||||
wddmWithKmDafMock->createAllocation64k(&allocation);
|
wddmWithKmDafMock->createAllocation64k(&allocation);
|
||||||
|
@ -177,7 +179,7 @@ HWTEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocation64IsCalledThenKmDaf
|
||||||
HWTEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocationsAndMapGpuVaIsCalledThenKmDafListenerNotifyWriteTargetAndMapGpuVAIsFedWithCorrectParams) {
|
HWTEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocationsAndMapGpuVaIsCalledThenKmDafListenerNotifyWriteTargetAndMapGpuVAIsFedWithCorrectParams) {
|
||||||
OsHandleStorage storage;
|
OsHandleStorage storage;
|
||||||
OsHandle osHandle = {0};
|
OsHandle osHandle = {0};
|
||||||
auto gmm = std::unique_ptr<Gmm>(Gmm::create(nullptr, 1, false));
|
auto gmm = std::unique_ptr<Gmm>(GmmHelper::create(nullptr, 1, false));
|
||||||
storage.fragmentStorageData[0].osHandleStorage = &osHandle;
|
storage.fragmentStorageData[0].osHandleStorage = &osHandle;
|
||||||
storage.fragmentStorageData[0].fragmentSize = 100;
|
storage.fragmentStorageData[0].fragmentSize = 100;
|
||||||
storage.fragmentStorageData[0].osHandleStorage->gmm = gmm.get();
|
storage.fragmentStorageData[0].osHandleStorage->gmm = gmm.get();
|
||||||
|
@ -194,7 +196,7 @@ HWTEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocationsAndMapGpuVaIsCalle
|
||||||
EXPECT_EQ(wddmWithKmDafMock->getAdapter(), wddmWithKmDafMock->getKmDafListenerMock().notifyMapGpuVAParametrization.hAdapter);
|
EXPECT_EQ(wddmWithKmDafMock->getAdapter(), wddmWithKmDafMock->getKmDafListenerMock().notifyMapGpuVAParametrization.hAdapter);
|
||||||
EXPECT_EQ(wddmWithKmDafMock->getDevice(), wddmWithKmDafMock->getKmDafListenerMock().notifyMapGpuVAParametrization.hDevice);
|
EXPECT_EQ(wddmWithKmDafMock->getDevice(), wddmWithKmDafMock->getKmDafListenerMock().notifyMapGpuVAParametrization.hDevice);
|
||||||
EXPECT_EQ(osHandle.handle, wddmWithKmDafMock->getKmDafListenerMock().notifyMapGpuVAParametrization.hAllocation);
|
EXPECT_EQ(osHandle.handle, wddmWithKmDafMock->getKmDafListenerMock().notifyMapGpuVAParametrization.hAllocation);
|
||||||
EXPECT_EQ(Gmm::decanonize(osHandle.gpuPtr), wddmWithKmDafMock->getKmDafListenerMock().notifyMapGpuVAParametrization.GpuVirtualAddress);
|
EXPECT_EQ(GmmHelper::decanonize(osHandle.gpuPtr), wddmWithKmDafMock->getKmDafListenerMock().notifyMapGpuVAParametrization.GpuVirtualAddress);
|
||||||
EXPECT_EQ(wddmWithKmDafMock->getGdi()->escape, wddmWithKmDafMock->getKmDafListenerMock().notifyMapGpuVAParametrization.pfnEscape);
|
EXPECT_EQ(wddmWithKmDafMock->getGdi()->escape, wddmWithKmDafMock->getKmDafListenerMock().notifyMapGpuVAParametrization.pfnEscape);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
* OTHER DEALINGS IN THE SOFTWARE.
|
* OTHER DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "runtime/gmm_helper/gmm.h"
|
||||||
#include "runtime/gmm_helper/gmm_helper.h"
|
#include "runtime/gmm_helper/gmm_helper.h"
|
||||||
#include "runtime/helpers/aligned_memory.h"
|
#include "runtime/helpers/aligned_memory.h"
|
||||||
#include "runtime/mem_obj/buffer.h"
|
#include "runtime/mem_obj/buffer.h"
|
||||||
|
@ -151,7 +152,7 @@ HWTEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenCreateFromSharedHandle
|
||||||
auto size = 4096u;
|
auto size = 4096u;
|
||||||
void *pSysMem = reinterpret_cast<void *>(0x1000);
|
void *pSysMem = reinterpret_cast<void *>(0x1000);
|
||||||
|
|
||||||
std::unique_ptr<Gmm> gmm(Gmm::create(pSysMem, 4096u, false));
|
std::unique_ptr<Gmm> gmm(GmmHelper::create(pSysMem, 4096u, false));
|
||||||
auto status = setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
|
auto status = setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
|
||||||
|
|
||||||
auto *gpuAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(osHandle, false);
|
auto *gpuAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(osHandle, false);
|
||||||
|
@ -168,7 +169,7 @@ HWTEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenCreateFromNTHandleIsCa
|
||||||
auto size = 4096u;
|
auto size = 4096u;
|
||||||
void *pSysMem = reinterpret_cast<void *>(0x1000);
|
void *pSysMem = reinterpret_cast<void *>(0x1000);
|
||||||
|
|
||||||
std::unique_ptr<Gmm> gmm(Gmm::create(pSysMem, 4096u, false));
|
std::unique_ptr<Gmm> gmm(GmmHelper::create(pSysMem, 4096u, false));
|
||||||
auto status = setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
|
auto status = setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
|
||||||
|
|
||||||
auto *gpuAllocation = memoryManager->createGraphicsAllocationFromNTHandle(reinterpret_cast<void *>(1));
|
auto *gpuAllocation = memoryManager->createGraphicsAllocationFromNTHandle(reinterpret_cast<void *>(1));
|
||||||
|
@ -202,7 +203,7 @@ HWTEST_F(WddmMemoryManagerTest, createAllocationFromSharedHandleReturns32BitAllo
|
||||||
auto size = 4096u;
|
auto size = 4096u;
|
||||||
void *pSysMem = reinterpret_cast<void *>(0x1000);
|
void *pSysMem = reinterpret_cast<void *>(0x1000);
|
||||||
|
|
||||||
std::unique_ptr<Gmm> gmm(Gmm::create(pSysMem, 4096u, false));
|
std::unique_ptr<Gmm> gmm(GmmHelper::create(pSysMem, 4096u, false));
|
||||||
auto status = setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
|
auto status = setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
|
||||||
|
|
||||||
memoryManager->setForce32BitAllocations(true);
|
memoryManager->setForce32BitAllocations(true);
|
||||||
|
@ -213,7 +214,7 @@ HWTEST_F(WddmMemoryManagerTest, createAllocationFromSharedHandleReturns32BitAllo
|
||||||
EXPECT_TRUE(gpuAllocation->is32BitAllocation);
|
EXPECT_TRUE(gpuAllocation->is32BitAllocation);
|
||||||
|
|
||||||
uint64_t base = memoryManager->allocator32Bit->getBase();
|
uint64_t base = memoryManager->allocator32Bit->getBase();
|
||||||
EXPECT_EQ(Gmm::canonize(base), gpuAllocation->gpuBaseAddress);
|
EXPECT_EQ(GmmHelper::canonize(base), gpuAllocation->gpuBaseAddress);
|
||||||
}
|
}
|
||||||
|
|
||||||
memoryManager->freeGraphicsMemory(gpuAllocation);
|
memoryManager->freeGraphicsMemory(gpuAllocation);
|
||||||
|
@ -225,7 +226,7 @@ HWTEST_F(WddmMemoryManagerTest, createAllocationFromSharedHandleDoesNotReturn32B
|
||||||
auto size = 4096u;
|
auto size = 4096u;
|
||||||
void *pSysMem = reinterpret_cast<void *>(0x1000);
|
void *pSysMem = reinterpret_cast<void *>(0x1000);
|
||||||
|
|
||||||
std::unique_ptr<Gmm> gmm(Gmm::create(pSysMem, 4096u, false));
|
std::unique_ptr<Gmm> gmm(GmmHelper::create(pSysMem, 4096u, false));
|
||||||
auto status = setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
|
auto status = setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
|
||||||
|
|
||||||
memoryManager->setForce32BitAllocations(true);
|
memoryManager->setForce32BitAllocations(true);
|
||||||
|
@ -248,7 +249,7 @@ HWTEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenFreeAllocFromSharedHan
|
||||||
auto size = 4096u;
|
auto size = 4096u;
|
||||||
void *pSysMem = reinterpret_cast<void *>(0x1000);
|
void *pSysMem = reinterpret_cast<void *>(0x1000);
|
||||||
|
|
||||||
std::unique_ptr<Gmm> gmm(Gmm::create(pSysMem, 4096u, false));
|
std::unique_ptr<Gmm> gmm(GmmHelper::create(pSysMem, 4096u, false));
|
||||||
auto status = setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
|
auto status = setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
|
||||||
|
|
||||||
auto gpuAllocation = (WddmAllocation *)memoryManager->createGraphicsAllocationFromSharedHandle(osHandle, false);
|
auto gpuAllocation = (WddmAllocation *)memoryManager->createGraphicsAllocationFromSharedHandle(osHandle, false);
|
||||||
|
@ -270,7 +271,7 @@ HWTEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerSizeZeroWhenCreateFromShar
|
||||||
auto size = 4096u;
|
auto size = 4096u;
|
||||||
void *pSysMem = reinterpret_cast<void *>(0x1000);
|
void *pSysMem = reinterpret_cast<void *>(0x1000);
|
||||||
|
|
||||||
std::unique_ptr<Gmm> gmm(Gmm::create(pSysMem, size, false));
|
std::unique_ptr<Gmm> gmm(GmmHelper::create(pSysMem, size, false));
|
||||||
auto status = setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
|
auto status = setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
|
||||||
|
|
||||||
auto *gpuAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(osHandle, false);
|
auto *gpuAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(osHandle, false);
|
||||||
|
@ -285,7 +286,7 @@ HWTEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenCreateFromSharedHandle
|
||||||
auto size = 4096u;
|
auto size = 4096u;
|
||||||
void *pSysMem = reinterpret_cast<void *>(0x1000);
|
void *pSysMem = reinterpret_cast<void *>(0x1000);
|
||||||
|
|
||||||
std::unique_ptr<Gmm> gmm(Gmm::create(pSysMem, size, false));
|
std::unique_ptr<Gmm> gmm(GmmHelper::create(pSysMem, size, false));
|
||||||
auto status = setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
|
auto status = setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
|
||||||
|
|
||||||
wddm->failOpenSharedHandle = true;
|
wddm->failOpenSharedHandle = true;
|
||||||
|
@ -562,8 +563,8 @@ HWTEST_F(WddmMemoryManagerTest, Allocate32BitMemoryWithNullptr) {
|
||||||
auto *gpuAllocation = memoryManager->allocate32BitGraphicsMemory(3 * MemoryConstants::pageSize, nullptr, AllocationOrigin::EXTERNAL_ALLOCATION);
|
auto *gpuAllocation = memoryManager->allocate32BitGraphicsMemory(3 * MemoryConstants::pageSize, nullptr, AllocationOrigin::EXTERNAL_ALLOCATION);
|
||||||
|
|
||||||
ASSERT_NE(nullptr, gpuAllocation);
|
ASSERT_NE(nullptr, gpuAllocation);
|
||||||
EXPECT_LE(Gmm::canonize(wddm->getHeap32Base()), gpuAllocation->getGpuAddress());
|
EXPECT_LE(GmmHelper::canonize(wddm->getHeap32Base()), gpuAllocation->getGpuAddress());
|
||||||
EXPECT_GT(Gmm::canonize(wddm->getHeap32Base()) + wddm->getHeap32Size() - 1, gpuAllocation->getGpuAddress());
|
EXPECT_GT(GmmHelper::canonize(wddm->getHeap32Base()) + wddm->getHeap32Size() - 1, gpuAllocation->getGpuAddress());
|
||||||
|
|
||||||
EXPECT_EQ(0u, gpuAllocation->fragmentsStorage.fragmentCount);
|
EXPECT_EQ(0u, gpuAllocation->fragmentsStorage.fragmentCount);
|
||||||
memoryManager->freeGraphicsMemory(gpuAllocation);
|
memoryManager->freeGraphicsMemory(gpuAllocation);
|
||||||
|
@ -580,8 +581,8 @@ HWTEST_F(WddmMemoryManagerTest, Allocate32BitMemoryWithMisalignedHostPtrDoesNotD
|
||||||
|
|
||||||
EXPECT_EQ(alignSizeWholePage(misalignedPtr, misalignedSize), gpuAllocation->getUnderlyingBufferSize());
|
EXPECT_EQ(alignSizeWholePage(misalignedPtr, misalignedSize), gpuAllocation->getUnderlyingBufferSize());
|
||||||
|
|
||||||
EXPECT_LE(Gmm::canonize(wddm->getHeap32Base()), gpuAllocation->getGpuAddress());
|
EXPECT_LE(GmmHelper::canonize(wddm->getHeap32Base()), gpuAllocation->getGpuAddress());
|
||||||
EXPECT_GT(Gmm::canonize(wddm->getHeap32Base()) + wddm->getHeap32Size() - 1, gpuAllocation->getGpuAddress());
|
EXPECT_GT(GmmHelper::canonize(wddm->getHeap32Base()) + wddm->getHeap32Size() - 1, gpuAllocation->getGpuAddress());
|
||||||
|
|
||||||
EXPECT_EQ(0u, gpuAllocation->fragmentsStorage.fragmentCount);
|
EXPECT_EQ(0u, gpuAllocation->fragmentsStorage.fragmentCount);
|
||||||
|
|
||||||
|
@ -598,7 +599,7 @@ HWTEST_F(WddmMemoryManagerTest, Allocate32BitMemorySetsCannonizedGpuBaseAddress)
|
||||||
|
|
||||||
ASSERT_NE(nullptr, gpuAllocation);
|
ASSERT_NE(nullptr, gpuAllocation);
|
||||||
|
|
||||||
uint64_t cannonizedAddress = Gmm::canonize(wddm->getHeap32Base());
|
uint64_t cannonizedAddress = GmmHelper::canonize(wddm->getHeap32Base());
|
||||||
EXPECT_EQ(cannonizedAddress, gpuAllocation->gpuBaseAddress);
|
EXPECT_EQ(cannonizedAddress, gpuAllocation->gpuBaseAddress);
|
||||||
|
|
||||||
memoryManager->freeGraphicsMemory(gpuAllocation);
|
memoryManager->freeGraphicsMemory(gpuAllocation);
|
||||||
|
@ -614,7 +615,7 @@ HWTEST_F(WddmMemoryManagerTest, GivenThreeOsHandlesWhenAskedForDestroyAllocation
|
||||||
|
|
||||||
storage.fragmentStorageData[0].osHandleStorage->handle = ALLOCATION_HANDLE;
|
storage.fragmentStorageData[0].osHandleStorage->handle = ALLOCATION_HANDLE;
|
||||||
storage.fragmentStorageData[0].freeTheFragment = true;
|
storage.fragmentStorageData[0].freeTheFragment = true;
|
||||||
storage.fragmentStorageData[0].osHandleStorage->gmm = Gmm::create(pSysMem, 4096u, false);
|
storage.fragmentStorageData[0].osHandleStorage->gmm = GmmHelper::create(pSysMem, 4096u, false);
|
||||||
|
|
||||||
storage.fragmentStorageData[1].osHandleStorage = new OsHandle;
|
storage.fragmentStorageData[1].osHandleStorage = new OsHandle;
|
||||||
storage.fragmentStorageData[1].osHandleStorage->handle = ALLOCATION_HANDLE;
|
storage.fragmentStorageData[1].osHandleStorage->handle = ALLOCATION_HANDLE;
|
||||||
|
@ -625,7 +626,7 @@ HWTEST_F(WddmMemoryManagerTest, GivenThreeOsHandlesWhenAskedForDestroyAllocation
|
||||||
storage.fragmentStorageData[2].osHandleStorage = new OsHandle;
|
storage.fragmentStorageData[2].osHandleStorage = new OsHandle;
|
||||||
storage.fragmentStorageData[2].osHandleStorage->handle = ALLOCATION_HANDLE;
|
storage.fragmentStorageData[2].osHandleStorage->handle = ALLOCATION_HANDLE;
|
||||||
storage.fragmentStorageData[2].freeTheFragment = true;
|
storage.fragmentStorageData[2].freeTheFragment = true;
|
||||||
storage.fragmentStorageData[2].osHandleStorage->gmm = Gmm::create(pSysMem, 4096u, false);
|
storage.fragmentStorageData[2].osHandleStorage->gmm = GmmHelper::create(pSysMem, 4096u, false);
|
||||||
storage.fragmentStorageData[2].residency = new ResidencyData;
|
storage.fragmentStorageData[2].residency = new ResidencyData;
|
||||||
|
|
||||||
memoryManager->cleanOsHandles(storage);
|
memoryManager->cleanOsHandles(storage);
|
||||||
|
@ -675,7 +676,7 @@ HWTEST_F(WddmMemoryManagerTest, givenManagerWithDisabledDeferredDeleterWhenMapGp
|
||||||
SetUpMm<FamilyType>();
|
SetUpMm<FamilyType>();
|
||||||
void *ptr = reinterpret_cast<void *>(0x1000);
|
void *ptr = reinterpret_cast<void *>(0x1000);
|
||||||
size_t size = 0x1000;
|
size_t size = 0x1000;
|
||||||
std::unique_ptr<Gmm> gmm(Gmm::create(ptr, size, false));
|
std::unique_ptr<Gmm> gmm(GmmHelper::create(ptr, size, false));
|
||||||
|
|
||||||
memoryManager->setDeferredDeleter(nullptr);
|
memoryManager->setDeferredDeleter(nullptr);
|
||||||
setMapGpuVaFailConfigFcn(0, 1);
|
setMapGpuVaFailConfigFcn(0, 1);
|
||||||
|
@ -690,7 +691,7 @@ HWTEST_F(WddmMemoryManagerTest, givenManagerWithEnabledDeferredDeleterWhenFirstM
|
||||||
SetUpMm<FamilyType>();
|
SetUpMm<FamilyType>();
|
||||||
void *ptr = reinterpret_cast<void *>(0x1000);
|
void *ptr = reinterpret_cast<void *>(0x1000);
|
||||||
size_t size = 0x1000;
|
size_t size = 0x1000;
|
||||||
std::unique_ptr<Gmm> gmm(Gmm::create(ptr, size, false));
|
std::unique_ptr<Gmm> gmm(GmmHelper::create(ptr, size, false));
|
||||||
|
|
||||||
MockDeferredDeleter *deleter = new MockDeferredDeleter;
|
MockDeferredDeleter *deleter = new MockDeferredDeleter;
|
||||||
memoryManager->setDeferredDeleter(deleter);
|
memoryManager->setDeferredDeleter(deleter);
|
||||||
|
@ -708,7 +709,7 @@ HWTEST_F(WddmMemoryManagerTest, givenManagerWithEnabledDeferredDeleterWhenFirstA
|
||||||
SetUpMm<FamilyType>();
|
SetUpMm<FamilyType>();
|
||||||
void *ptr = reinterpret_cast<void *>(0x1000);
|
void *ptr = reinterpret_cast<void *>(0x1000);
|
||||||
size_t size = 0x1000;
|
size_t size = 0x1000;
|
||||||
std::unique_ptr<Gmm> gmm(Gmm::create(ptr, size, false));
|
std::unique_ptr<Gmm> gmm(GmmHelper::create(ptr, size, false));
|
||||||
|
|
||||||
MockDeferredDeleter *deleter = new MockDeferredDeleter;
|
MockDeferredDeleter *deleter = new MockDeferredDeleter;
|
||||||
memoryManager->setDeferredDeleter(deleter);
|
memoryManager->setDeferredDeleter(deleter);
|
||||||
|
@ -725,12 +726,12 @@ HWTEST_F(WddmMemoryManagerTest, givenNullPtrAndSizePassedToCreateInternalAllocat
|
||||||
SetUpMm<FamilyType>();
|
SetUpMm<FamilyType>();
|
||||||
auto wddmAllocation = static_cast<WddmAllocation *>(memoryManager->allocate32BitGraphicsMemory(MemoryConstants::pageSize, nullptr, AllocationOrigin::INTERNAL_ALLOCATION));
|
auto wddmAllocation = static_cast<WddmAllocation *>(memoryManager->allocate32BitGraphicsMemory(MemoryConstants::pageSize, nullptr, AllocationOrigin::INTERNAL_ALLOCATION));
|
||||||
ASSERT_NE(nullptr, wddmAllocation);
|
ASSERT_NE(nullptr, wddmAllocation);
|
||||||
EXPECT_EQ(wddmAllocation->gpuBaseAddress, Gmm::canonize(this->wddm->getGfxPartition().Heap32[1].Base));
|
EXPECT_EQ(wddmAllocation->gpuBaseAddress, GmmHelper::canonize(this->wddm->getGfxPartition().Heap32[1].Base));
|
||||||
EXPECT_NE(nullptr, wddmAllocation->getUnderlyingBuffer());
|
EXPECT_NE(nullptr, wddmAllocation->getUnderlyingBuffer());
|
||||||
EXPECT_EQ(4096u, wddmAllocation->getUnderlyingBufferSize());
|
EXPECT_EQ(4096u, wddmAllocation->getUnderlyingBufferSize());
|
||||||
EXPECT_NE((uint64_t)wddmAllocation->getUnderlyingBuffer(), wddmAllocation->getGpuAddress());
|
EXPECT_NE((uint64_t)wddmAllocation->getUnderlyingBuffer(), wddmAllocation->getGpuAddress());
|
||||||
auto cannonizedHeapBase = Gmm::canonize(this->wddm->getGfxPartition().Heap32[1].Base);
|
auto cannonizedHeapBase = GmmHelper::canonize(this->wddm->getGfxPartition().Heap32[1].Base);
|
||||||
auto cannonizedHeapEnd = Gmm::canonize(this->wddm->getGfxPartition().Heap32[1].Limit);
|
auto cannonizedHeapEnd = GmmHelper::canonize(this->wddm->getGfxPartition().Heap32[1].Limit);
|
||||||
|
|
||||||
EXPECT_GE(wddmAllocation->getGpuAddress(), cannonizedHeapBase);
|
EXPECT_GE(wddmAllocation->getGpuAddress(), cannonizedHeapBase);
|
||||||
EXPECT_LE(wddmAllocation->getGpuAddress(), cannonizedHeapEnd);
|
EXPECT_LE(wddmAllocation->getGpuAddress(), cannonizedHeapEnd);
|
||||||
|
@ -745,12 +746,12 @@ HWTEST_F(WddmMemoryManagerTest, givenPtrAndSizePassedToCreateInternalAllocationW
|
||||||
auto ptr = reinterpret_cast<void *>(0x1000000);
|
auto ptr = reinterpret_cast<void *>(0x1000000);
|
||||||
auto wddmAllocation = static_cast<WddmAllocation *>(memoryManager->allocate32BitGraphicsMemory(MemoryConstants::pageSize, ptr, AllocationOrigin::INTERNAL_ALLOCATION));
|
auto wddmAllocation = static_cast<WddmAllocation *>(memoryManager->allocate32BitGraphicsMemory(MemoryConstants::pageSize, ptr, AllocationOrigin::INTERNAL_ALLOCATION));
|
||||||
ASSERT_NE(nullptr, wddmAllocation);
|
ASSERT_NE(nullptr, wddmAllocation);
|
||||||
EXPECT_EQ(wddmAllocation->gpuBaseAddress, Gmm::canonize(this->wddm->getGfxPartition().Heap32[1].Base));
|
EXPECT_EQ(wddmAllocation->gpuBaseAddress, GmmHelper::canonize(this->wddm->getGfxPartition().Heap32[1].Base));
|
||||||
EXPECT_EQ(ptr, wddmAllocation->getUnderlyingBuffer());
|
EXPECT_EQ(ptr, wddmAllocation->getUnderlyingBuffer());
|
||||||
EXPECT_EQ(4096u, wddmAllocation->getUnderlyingBufferSize());
|
EXPECT_EQ(4096u, wddmAllocation->getUnderlyingBufferSize());
|
||||||
EXPECT_NE((uint64_t)wddmAllocation->getUnderlyingBuffer(), wddmAllocation->getGpuAddress());
|
EXPECT_NE((uint64_t)wddmAllocation->getUnderlyingBuffer(), wddmAllocation->getGpuAddress());
|
||||||
auto cannonizedHeapBase = Gmm::canonize(this->wddm->getGfxPartition().Heap32[1].Base);
|
auto cannonizedHeapBase = GmmHelper::canonize(this->wddm->getGfxPartition().Heap32[1].Base);
|
||||||
auto cannonizedHeapEnd = Gmm::canonize(this->wddm->getGfxPartition().Heap32[1].Limit);
|
auto cannonizedHeapEnd = GmmHelper::canonize(this->wddm->getGfxPartition().Heap32[1].Limit);
|
||||||
|
|
||||||
EXPECT_GE(wddmAllocation->getGpuAddress(), cannonizedHeapBase);
|
EXPECT_GE(wddmAllocation->getGpuAddress(), cannonizedHeapBase);
|
||||||
EXPECT_LE(wddmAllocation->getGpuAddress(), cannonizedHeapEnd);
|
EXPECT_LE(wddmAllocation->getGpuAddress(), cannonizedHeapEnd);
|
||||||
|
@ -1953,7 +1954,7 @@ HWTEST_F(MockWddmMemoryManagerTest, givenPageTableManagerWhenMapAuxGpuVaCalledTh
|
||||||
}
|
}
|
||||||
|
|
||||||
HWTEST_F(MockWddmMemoryManagerTest, givenRenderCompressedAllocationWhenMappedGpuVaThenMapAuxVa) {
|
HWTEST_F(MockWddmMemoryManagerTest, givenRenderCompressedAllocationWhenMappedGpuVaThenMapAuxVa) {
|
||||||
std::unique_ptr<Gmm> gmm(Gmm::create(reinterpret_cast<void *>(123), 4096u, false));
|
std::unique_ptr<Gmm> gmm(GmmHelper::create(reinterpret_cast<void *>(123), 4096u, false));
|
||||||
gmm->isRenderCompressed = true;
|
gmm->isRenderCompressed = true;
|
||||||
D3DGPU_VIRTUAL_ADDRESS gpuVa = 0;
|
D3DGPU_VIRTUAL_ADDRESS gpuVa = 0;
|
||||||
WddmMock wddm;
|
WddmMock wddm;
|
||||||
|
@ -1964,7 +1965,7 @@ HWTEST_F(MockWddmMemoryManagerTest, givenRenderCompressedAllocationWhenMappedGpu
|
||||||
|
|
||||||
GMM_DDI_UPDATEAUXTABLE givenDdiUpdateAuxTable = {};
|
GMM_DDI_UPDATEAUXTABLE givenDdiUpdateAuxTable = {};
|
||||||
GMM_DDI_UPDATEAUXTABLE expectedDdiUpdateAuxTable = {};
|
GMM_DDI_UPDATEAUXTABLE expectedDdiUpdateAuxTable = {};
|
||||||
expectedDdiUpdateAuxTable.BaseGpuVA = Gmm::canonize(wddm.getGfxPartition().Standard.Base);
|
expectedDdiUpdateAuxTable.BaseGpuVA = GmmHelper::canonize(wddm.getGfxPartition().Standard.Base);
|
||||||
expectedDdiUpdateAuxTable.BaseResInfo = gmm->gmmResourceInfo->peekHandle();
|
expectedDdiUpdateAuxTable.BaseResInfo = gmm->gmmResourceInfo->peekHandle();
|
||||||
expectedDdiUpdateAuxTable.DoNotWait = true;
|
expectedDdiUpdateAuxTable.DoNotWait = true;
|
||||||
expectedDdiUpdateAuxTable.Map = true;
|
expectedDdiUpdateAuxTable.Map = true;
|
||||||
|
@ -1973,7 +1974,7 @@ HWTEST_F(MockWddmMemoryManagerTest, givenRenderCompressedAllocationWhenMappedGpu
|
||||||
|
|
||||||
auto result = wddm.mapGpuVirtualAddressImpl(gmm.get(), ALLOCATION_HANDLE, nullptr, 3, gpuVa, false, false, false);
|
auto result = wddm.mapGpuVirtualAddressImpl(gmm.get(), ALLOCATION_HANDLE, nullptr, 3, gpuVa, false, false, false);
|
||||||
ASSERT_TRUE(result);
|
ASSERT_TRUE(result);
|
||||||
EXPECT_EQ(Gmm::canonize(wddm.getGfxPartition().Standard.Base), gpuVa);
|
EXPECT_EQ(GmmHelper::canonize(wddm.getGfxPartition().Standard.Base), gpuVa);
|
||||||
|
|
||||||
EXPECT_TRUE(memcmp(&expectedDdiUpdateAuxTable, &givenDdiUpdateAuxTable, sizeof(GMM_DDI_UPDATEAUXTABLE)) == 0);
|
EXPECT_TRUE(memcmp(&expectedDdiUpdateAuxTable, &givenDdiUpdateAuxTable, sizeof(GMM_DDI_UPDATEAUXTABLE)) == 0);
|
||||||
}
|
}
|
||||||
|
@ -2021,7 +2022,7 @@ HWTEST_F(MockWddmMemoryManagerTest, givenNonRenderCompressedAllocationWhenReleas
|
||||||
}
|
}
|
||||||
|
|
||||||
HWTEST_F(MockWddmMemoryManagerTest, givenNonRenderCompressedAllocationWhenMappedGpuVaThenDontMapAuxVa) {
|
HWTEST_F(MockWddmMemoryManagerTest, givenNonRenderCompressedAllocationWhenMappedGpuVaThenDontMapAuxVa) {
|
||||||
std::unique_ptr<Gmm> gmm(Gmm::create(reinterpret_cast<void *>(123), 4096u, false));
|
std::unique_ptr<Gmm> gmm(GmmHelper::create(reinterpret_cast<void *>(123), 4096u, false));
|
||||||
gmm->isRenderCompressed = false;
|
gmm->isRenderCompressed = false;
|
||||||
D3DGPU_VIRTUAL_ADDRESS gpuVa = 0;
|
D3DGPU_VIRTUAL_ADDRESS gpuVa = 0;
|
||||||
WddmMock wddm;
|
WddmMock wddm;
|
||||||
|
@ -2037,7 +2038,7 @@ HWTEST_F(MockWddmMemoryManagerTest, givenNonRenderCompressedAllocationWhenMapped
|
||||||
}
|
}
|
||||||
|
|
||||||
HWTEST_F(MockWddmMemoryManagerTest, givenFailingAllocationWhenMappedGpuVaThenReturnFalse) {
|
HWTEST_F(MockWddmMemoryManagerTest, givenFailingAllocationWhenMappedGpuVaThenReturnFalse) {
|
||||||
std::unique_ptr<Gmm> gmm(Gmm::create(reinterpret_cast<void *>(123), 4096u, false));
|
std::unique_ptr<Gmm> gmm(GmmHelper::create(reinterpret_cast<void *>(123), 4096u, false));
|
||||||
gmm->isRenderCompressed = false;
|
gmm->isRenderCompressed = false;
|
||||||
D3DGPU_VIRTUAL_ADDRESS gpuVa = 0;
|
D3DGPU_VIRTUAL_ADDRESS gpuVa = 0;
|
||||||
WddmMock wddm;
|
WddmMock wddm;
|
||||||
|
@ -2056,7 +2057,7 @@ HWTEST_F(MockWddmMemoryManagerTest, givenRenderCompressedFlagSetWhenInternalIsUn
|
||||||
auto mockMngr = new NiceMock<MockGmmPageTableMngr>();
|
auto mockMngr = new NiceMock<MockGmmPageTableMngr>();
|
||||||
wddm->resetPageTableManager(mockMngr);
|
wddm->resetPageTableManager(mockMngr);
|
||||||
|
|
||||||
auto myGmm = Gmm::create(reinterpret_cast<void *>(123), 4096u, false);
|
auto myGmm = GmmHelper::create(reinterpret_cast<void *>(123), 4096u, false);
|
||||||
myGmm->isRenderCompressed = false;
|
myGmm->isRenderCompressed = false;
|
||||||
myGmm->gmmResourceInfo->getResourceFlags()->Info.RenderCompressed = 1;
|
myGmm->gmmResourceInfo->getResourceFlags()->Info.RenderCompressed = 1;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue