Improve renderCompressed flags usage

Change-Id: Ib5fd8e078dba0f19dd65bc8cdc6cded771e559a2
This commit is contained in:
Dunajski, Bartosz
2018-07-18 14:11:05 +02:00
committed by sys_ocldev
parent d683467708
commit 1c0f90b194
16 changed files with 129 additions and 106 deletions

View File

@@ -20,8 +20,8 @@
* OTHER DEALINGS IN THE SOFTWARE. * OTHER DEALINGS IN THE SOFTWARE.
*/ */
#include "hw_info.h"
#include "hw_cmds.h" #include "hw_cmds.h"
#include "hw_info.h"
#include "runtime/aub_mem_dump/aub_services.h" #include "runtime/aub_mem_dump/aub_services.h"
#include "runtime/helpers/engine_node.h" #include "runtime/helpers/engine_node.h"
#include "runtime/memory_manager/memory_constants.h" #include "runtime/memory_manager/memory_constants.h"
@@ -61,9 +61,10 @@ const RuntimeCapabilityTable CNL::capabilityTable{
true, true,
true, true,
true, true,
true, // ftrSupportsVmeAvcTextureSampler true, // ftrSupportsVmeAvcTextureSampler
true, // ftrSupportsVmeAvcPreemption true, // ftrSupportsVmeAvcPreemption
false, false, // ftrRenderCompressedBuffers
false, // ftrRenderCompressedImages
PreemptionMode::MidThread, PreemptionMode::MidThread,
{true, true}, {true, true},
&isSimulationCNL, &isSimulationCNL,

View File

@@ -20,8 +20,8 @@
* OTHER DEALINGS IN THE SOFTWARE. * OTHER DEALINGS IN THE SOFTWARE.
*/ */
#include "hw_info.h"
#include "hw_cmds.h" #include "hw_cmds.h"
#include "hw_info.h"
#include "runtime/aub_mem_dump/aub_services.h" #include "runtime/aub_mem_dump/aub_services.h"
#include "runtime/helpers/engine_node.h" #include "runtime/helpers/engine_node.h"
#include "runtime/memory_manager/memory_constants.h" #include "runtime/memory_manager/memory_constants.h"
@@ -64,7 +64,8 @@ const RuntimeCapabilityTable BDW::capabilityTable{
true, true,
false, // ftrSupportsVmeAvcTextureSampler false, // ftrSupportsVmeAvcTextureSampler
false, // ftrSupportsVmeAvcPreemption false, // ftrSupportsVmeAvcPreemption
false, false, // ftrRenderCompressedBuffers
false, // ftrRenderCompressedImages
PreemptionMode::Disabled, PreemptionMode::Disabled,
{false, false}, {false, false},
&isSimulationBDW, &isSimulationBDW,

View File

@@ -20,8 +20,8 @@
* OTHER DEALINGS IN THE SOFTWARE. * OTHER DEALINGS IN THE SOFTWARE.
*/ */
#include "hw_info_bxt.h"
#include "hw_cmds.h" #include "hw_cmds.h"
#include "hw_info_bxt.h"
#include "runtime/aub_mem_dump/aub_services.h" #include "runtime/aub_mem_dump/aub_services.h"
#include "runtime/helpers/engine_node.h" #include "runtime/helpers/engine_node.h"
#include "runtime/memory_manager/memory_constants.h" #include "runtime/memory_manager/memory_constants.h"
@@ -61,7 +61,8 @@ const RuntimeCapabilityTable BXT::capabilityTable{
true, true,
true, // ftrSupportsVmeAvcTextureSampler true, // ftrSupportsVmeAvcTextureSampler
false, // ftrSupportsVmeAvcPreemption false, // ftrSupportsVmeAvcPreemption
false, false, // ftrRenderCompressedBuffers
false, // ftrRenderCompressedImages
PreemptionMode::MidThread, PreemptionMode::MidThread,
{true, false}, {true, false},
&isSimulationBXT, &isSimulationBXT,

View File

@@ -20,8 +20,8 @@
* OTHER DEALINGS IN THE SOFTWARE. * OTHER DEALINGS IN THE SOFTWARE.
*/ */
#include "hw_info_cfl.h"
#include "hw_cmds.h" #include "hw_cmds.h"
#include "hw_info_cfl.h"
#include "runtime/aub_mem_dump/aub_services.h" #include "runtime/aub_mem_dump/aub_services.h"
#include "runtime/helpers/engine_node.h" #include "runtime/helpers/engine_node.h"
#include "runtime/memory_manager/memory_constants.h" #include "runtime/memory_manager/memory_constants.h"
@@ -56,7 +56,8 @@ const RuntimeCapabilityTable CFL::capabilityTable{
true, true,
true, // ftrSupportsVmeAvcTextureSampler true, // ftrSupportsVmeAvcTextureSampler
false, // ftrSupportsVmeAvcPreemption false, // ftrSupportsVmeAvcPreemption
false, false, // ftrRenderCompressedBuffers
false, // ftrRenderCompressedImages
PreemptionMode::MidThread, PreemptionMode::MidThread,
{true, false}, {true, false},
&isSimulationCFL, &isSimulationCFL,

View File

@@ -20,8 +20,8 @@
* OTHER DEALINGS IN THE SOFTWARE. * OTHER DEALINGS IN THE SOFTWARE.
*/ */
#include "hw_info_glk.h"
#include "hw_cmds.h" #include "hw_cmds.h"
#include "hw_info_glk.h"
#include "runtime/aub_mem_dump/aub_services.h" #include "runtime/aub_mem_dump/aub_services.h"
#include "runtime/helpers/engine_node.h" #include "runtime/helpers/engine_node.h"
#include "runtime/memory_manager/memory_constants.h" #include "runtime/memory_manager/memory_constants.h"
@@ -56,7 +56,8 @@ const RuntimeCapabilityTable GLK::capabilityTable{
true, true,
true, // ftrSupportsVmeAvcTextureSampler true, // ftrSupportsVmeAvcTextureSampler
false, // ftrSupportsVmeAvcPreemption false, // ftrSupportsVmeAvcPreemption
false, false, // ftrRenderCompressedBuffers
false, // ftrRenderCompressedImages
PreemptionMode::MidThread, PreemptionMode::MidThread,
{true, false}, {true, false},
&isSimulationGLK, &isSimulationGLK,

View File

@@ -20,8 +20,8 @@
* OTHER DEALINGS IN THE SOFTWARE. * OTHER DEALINGS IN THE SOFTWARE.
*/ */
#include "hw_info_kbl.h"
#include "hw_cmds.h" #include "hw_cmds.h"
#include "hw_info_kbl.h"
#include "runtime/aub_mem_dump/aub_services.h" #include "runtime/aub_mem_dump/aub_services.h"
#include "runtime/helpers/engine_node.h" #include "runtime/helpers/engine_node.h"
#include "runtime/memory_manager/memory_constants.h" #include "runtime/memory_manager/memory_constants.h"
@@ -56,7 +56,8 @@ const RuntimeCapabilityTable KBL::capabilityTable{
true, true,
true, // ftrSupportsVmeAvcTextureSampler true, // ftrSupportsVmeAvcTextureSampler
false, // ftrSupportsVmeAvcPreemption false, // ftrSupportsVmeAvcPreemption
false, false, // ftrRenderCompressedBuffers
false, // ftrRenderCompressedImages
PreemptionMode::MidThread, PreemptionMode::MidThread,
{true, false}, {true, false},
&isSimulationKBL, &isSimulationKBL,

View File

@@ -20,8 +20,8 @@
* OTHER DEALINGS IN THE SOFTWARE. * OTHER DEALINGS IN THE SOFTWARE.
*/ */
#include "hw_info_skl.h"
#include "hw_cmds.h" #include "hw_cmds.h"
#include "hw_info_skl.h"
#include "runtime/aub_mem_dump/aub_services.h" #include "runtime/aub_mem_dump/aub_services.h"
#include "runtime/helpers/engine_node.h" #include "runtime/helpers/engine_node.h"
#include "runtime/memory_manager/memory_constants.h" #include "runtime/memory_manager/memory_constants.h"
@@ -64,7 +64,8 @@ const RuntimeCapabilityTable SKL::capabilityTable{
true, true,
true, // ftrSupportsVmeAvcTextureSampler true, // ftrSupportsVmeAvcTextureSampler
false, // ftrSupportsVmeAvcPreemption false, // ftrSupportsVmeAvcPreemption
false, false, // ftrRenderCompressedBuffers
false, // ftrRenderCompressedImages
PreemptionMode::MidThread, PreemptionMode::MidThread,
{true, false}, {true, false},
&isSimulationSKL, &isSimulationSKL,

View File

@@ -21,8 +21,8 @@
*/ */
#pragma once #pragma once
#include "igfxfmid.h"
#include "gtsysinfo.h" #include "gtsysinfo.h"
#include "igfxfmid.h"
#include "sku_info.h" #include "sku_info.h"
#include "runtime/helpers/engine_node.h" #include "runtime/helpers/engine_node.h"
@@ -56,7 +56,8 @@ struct RuntimeCapabilityTable {
bool ftrSupportsCoherency; bool ftrSupportsCoherency;
bool ftrSupportsVmeAvcTextureSampler; bool ftrSupportsVmeAvcTextureSampler;
bool ftrSupportsVmeAvcPreemption; bool ftrSupportsVmeAvcPreemption;
bool ftrCompression; bool ftrRenderCompressedBuffers;
bool ftrRenderCompressedImages;
PreemptionMode defaultPreemptionMode; PreemptionMode defaultPreemptionMode;
WhitelistedRegisters whitelistedRegisters; WhitelistedRegisters whitelistedRegisters;

View File

@@ -20,16 +20,16 @@
* OTHER DEALINGS IN THE SOFTWARE. * OTHER DEALINGS IN THE SOFTWARE.
*/ */
#include "runtime/command_stream/preemption.h"
#include "runtime/helpers/hw_info.h"
#include "runtime/helpers/hw_helper.h"
#include "runtime/os_interface/linux/drm_neo.h"
#include "runtime/os_interface/hw_info_config.h" #include "runtime/os_interface/hw_info_config.h"
#include "runtime/os_interface/linux/os_interface.h" #include "runtime/command_stream/preemption.h"
#include "runtime/os_interface/debug_settings_manager.h"
#include "runtime/utilities/cpu_info.h"
#include "runtime/memory_manager/memory_constants.h"
#include "runtime/gen_common/hw_cmds.h" #include "runtime/gen_common/hw_cmds.h"
#include "runtime/helpers/hw_helper.h"
#include "runtime/helpers/hw_info.h"
#include "runtime/memory_manager/memory_constants.h"
#include "runtime/os_interface/debug_settings_manager.h"
#include "runtime/os_interface/linux/drm_neo.h"
#include "runtime/os_interface/linux/os_interface.h"
#include "runtime/utilities/cpu_info.h"
#include <cstring> #include <cstring>
@@ -172,7 +172,8 @@ int HwInfoConfig::configureHwInfo(const HardwareInfo *inHwInfo, HardwareInfo *ou
: static_cast<EngineType>(DebugManager.flags.NodeOrdinal.get()); : static_cast<EngineType>(DebugManager.flags.NodeOrdinal.get());
outHwInfo->capabilityTable.instrumentationEnabled = false; outHwInfo->capabilityTable.instrumentationEnabled = false;
outHwInfo->capabilityTable.ftrCompression = false; outHwInfo->capabilityTable.ftrRenderCompressedBuffers = false;
outHwInfo->capabilityTable.ftrRenderCompressedImages = false;
bool preemption = drm->hasPreemption(); bool preemption = drm->hasPreemption();
preemption = hwHelper.setupPreemptionRegisters(outHwInfo, preemption); preemption = hwHelper.setupPreemptionRegisters(outHwInfo, preemption);

View File

@@ -27,21 +27,21 @@
#include "hw_cmds.h" #include "hw_cmds.h"
#include "runtime/command_stream/linear_stream.h" #include "runtime/command_stream/linear_stream.h"
#include "runtime/command_stream/preemption.h" #include "runtime/command_stream/preemption.h"
#include "runtime/mem_obj/mem_obj.h"
#include "runtime/device/device.h" #include "runtime/device/device.h"
#include "runtime/os_interface/windows/wddm/wddm.h" #include "runtime/gmm_helper/page_table_mngr.h"
#include "runtime/os_interface/windows/wddm_device_command_stream.h"
#include "runtime/helpers/ptr_math.h" #include "runtime/helpers/ptr_math.h"
#include "runtime/helpers/translationtable_callbacks.h" #include "runtime/helpers/translationtable_callbacks.h"
#include "runtime/gmm_helper/page_table_mngr.h" #include "runtime/mem_obj/mem_obj.h"
#include "runtime/os_interface/windows/wddm/wddm.h"
#include "runtime/os_interface/windows/wddm_device_command_stream.h"
#pragma warning(pop) #pragma warning(pop)
#undef max #undef max
#include "runtime/os_interface/windows/wddm_memory_manager.h"
#include "runtime/os_interface/windows/wddm_engine_mapper.h"
#include "runtime/os_interface/windows/os_interface.h"
#include "runtime/os_interface/windows/gdi_interface.h" #include "runtime/os_interface/windows/gdi_interface.h"
#include "runtime/os_interface/windows/os_interface.h"
#include "runtime/os_interface/windows/wddm_engine_mapper.h"
#include "runtime/os_interface/windows/wddm_memory_manager.h"
namespace OCLRT { namespace OCLRT {
// Initialize COMMAND_BUFFER_HEADER Type PatchList Streamer Perf Tag // Initialize COMMAND_BUFFER_HEADER Type PatchList Streamer Perf Tag
@@ -72,7 +72,7 @@ WddmCommandStreamReceiver<GfxFamily>::WddmCommandStreamReceiver(const HardwareIn
bool success = this->wddm->init<GfxFamily>(); bool success = this->wddm->init<GfxFamily>();
DEBUG_BREAK_IF(!success); DEBUG_BREAK_IF(!success);
if (hwInfoIn.capabilityTable.ftrCompression) { if (hwInfoIn.capabilityTable.ftrRenderCompressedBuffers || hwInfoIn.capabilityTable.ftrRenderCompressedImages) {
this->wddm->resetPageTableManager(createPageTableManager()); this->wddm->resetPageTableManager(createPageTableManager());
} }
} }

View File

@@ -21,8 +21,8 @@
*/ */
#include "runtime/helpers/hw_helper.h" #include "runtime/helpers/hw_helper.h"
#include "unit_tests/fixtures/device_fixture.h"
#include "test.h" #include "test.h"
#include "unit_tests/fixtures/device_fixture.h"
using namespace OCLRT; using namespace OCLRT;
@@ -62,7 +62,8 @@ GEN10TEST_F(Gen10DeviceCaps, profilingTimerResolution) {
} }
GEN10TEST_F(Gen10DeviceCaps, compression) { GEN10TEST_F(Gen10DeviceCaps, compression) {
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.ftrCompression); EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.ftrRenderCompressedBuffers);
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.ftrRenderCompressedImages);
} }
GEN10TEST_F(Gen10DeviceCaps, givenHwInfoWhenRequestedComputeUnitsUsedForScratchThenReturnValidValue) { GEN10TEST_F(Gen10DeviceCaps, givenHwInfoWhenRequestedComputeUnitsUsedForScratchThenReturnValidValue) {

View File

@@ -21,8 +21,8 @@
*/ */
#include "runtime/helpers/hw_helper.h" #include "runtime/helpers/hw_helper.h"
#include "unit_tests/fixtures/device_fixture.h"
#include "test.h" #include "test.h"
#include "unit_tests/fixtures/device_fixture.h"
using namespace OCLRT; using namespace OCLRT;
@@ -47,7 +47,8 @@ GEN8TEST_F(Gen8DeviceCaps, kmdNotifyMechanism) {
} }
GEN8TEST_F(Gen8DeviceCaps, compression) { GEN8TEST_F(Gen8DeviceCaps, compression) {
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.ftrCompression); EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.ftrRenderCompressedBuffers);
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.ftrRenderCompressedImages);
} }
GEN8TEST_F(Gen8DeviceCaps, image3DDimensions) { GEN8TEST_F(Gen8DeviceCaps, image3DDimensions) {

View File

@@ -56,7 +56,8 @@ GEN9TEST_F(Gen9DeviceCaps, whitelistedRegisters) {
} }
GEN9TEST_F(Gen9DeviceCaps, compression) { GEN9TEST_F(Gen9DeviceCaps, compression) {
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.ftrCompression); EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.ftrRenderCompressedBuffers);
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.ftrRenderCompressedImages);
} }
GEN9TEST_F(Gen9DeviceCaps, givenHwInfoWhenRequestedComputeUnitsUsedForScratchThenReturnValidValue) { GEN9TEST_F(Gen9DeviceCaps, givenHwInfoWhenRequestedComputeUnitsUsedForScratchThenReturnValidValue) {

View File

@@ -24,8 +24,8 @@
#include "runtime/helpers/options.h" #include "runtime/helpers/options.h"
#include "runtime/os_interface/linux/os_interface.h" #include "runtime/os_interface/linux/os_interface.h"
#include "unit_tests/os_interface/linux/hw_info_config_linux_tests.h"
#include "unit_tests/libult/mock_gfx_family.h" #include "unit_tests/libult/mock_gfx_family.h"
#include "unit_tests/os_interface/linux/hw_info_config_linux_tests.h"
#include <cstring> #include <cstring>
@@ -342,10 +342,12 @@ TEST_F(HwInfoConfigTestLinuxDummy, dummyConfigPreemptionDrmEnabledAllPreemptionD
} }
TEST_F(HwInfoConfigTestLinuxDummy, givenPlatformEnabledFtrCompressionWhenInitializingThenForceDisable) { TEST_F(HwInfoConfigTestLinuxDummy, givenPlatformEnabledFtrCompressionWhenInitializingThenForceDisable) {
pInHwInfo->capabilityTable.ftrCompression = true; pInHwInfo->capabilityTable.ftrRenderCompressedBuffers = true;
pInHwInfo->capabilityTable.ftrRenderCompressedImages = true;
int ret = hwConfig.configureHwInfo(pInHwInfo, &outHwInfo, osInterface); int ret = hwConfig.configureHwInfo(pInHwInfo, &outHwInfo, osInterface);
EXPECT_EQ(0, ret); EXPECT_EQ(0, ret);
EXPECT_FALSE(outHwInfo.capabilityTable.ftrCompression); EXPECT_FALSE(outHwInfo.capabilityTable.ftrRenderCompressedBuffers);
EXPECT_FALSE(outHwInfo.capabilityTable.ftrRenderCompressedImages);
} }
TEST_F(HwInfoConfigTestLinuxDummy, givenPointerToHwInfoWhenConfigureHwInfoCalledThenRequiedSurfaceSizeIsSettedProperly) { TEST_F(HwInfoConfigTestLinuxDummy, givenPointerToHwInfoWhenConfigureHwInfoCalledThenRequiedSurfaceSizeIsSettedProperly) {

View File

@@ -780,16 +780,17 @@ HWTEST_F(WddmDefaultTest, givenFtrWddmHwQueuesFlagWhenCreatingCsrThenPickWddmVer
} }
struct WddmCsrCompressionTests : WddmCommandStreamMockGdiTest { struct WddmCsrCompressionTests : WddmCommandStreamMockGdiTest {
void setCompressionEnabled(bool enabled) { void setCompressionEnabled(bool enableForBuffer, bool enableForImages) {
RuntimeCapabilityTable capabilityTable = platformDevices[0]->capabilityTable; RuntimeCapabilityTable capabilityTable = platformDevices[0]->capabilityTable;
capabilityTable.ftrCompression = enabled; capabilityTable.ftrRenderCompressedBuffers = enableForBuffer;
capabilityTable.ftrRenderCompressedImages = enableForImages;
hwInfo = {*platformDevices[0]}; hwInfo = {*platformDevices[0]};
hwInfo.capabilityTable = capabilityTable; hwInfo.capabilityTable = capabilityTable;
} }
void SetUp() override { void SetUp() override {
WddmCommandStreamMockGdiTest::SetUp(); WddmCommandStreamMockGdiTest::SetUp();
setCompressionEnabled(true); setCompressionEnabled(true, true);
} }
void createMockWddm() { void createMockWddm() {
@@ -801,92 +802,100 @@ struct WddmCsrCompressionTests : WddmCommandStreamMockGdiTest {
}; };
HWTEST_F(WddmCsrCompressionTests, givenEnabledCompressionWhenInitializedThenCreatePagetableMngr) { HWTEST_F(WddmCsrCompressionTests, givenEnabledCompressionWhenInitializedThenCreatePagetableMngr) {
createMockWddm(); bool compressionEnabled[2][2] = {{true, false}, {false, true}};
EXPECT_EQ(nullptr, myMockWddm->getPageTableManager()); for (size_t i = 0; i < 2; i++) {
MockWddmCsr<FamilyType> mockWddmCsr(hwInfo, myMockWddm.get()); setCompressionEnabled(compressionEnabled[i][0], compressionEnabled[i][1]);
ASSERT_NE(nullptr, myMockWddm->getPageTableManager()); createMockWddm();
EXPECT_EQ(nullptr, myMockWddm->getPageTableManager());
MockWddmCsr<FamilyType> mockWddmCsr(hwInfo, myMockWddm.get());
ASSERT_NE(nullptr, myMockWddm->getPageTableManager());
auto mockMngr = reinterpret_cast<MockGmmPageTableMngr *>(myMockWddm->getPageTableManager()); auto mockMngr = reinterpret_cast<MockGmmPageTableMngr *>(myMockWddm->getPageTableManager());
GMM_DEVICE_CALLBACKS_INT expectedDeviceCb = {}; GMM_DEVICE_CALLBACKS_INT expectedDeviceCb = {};
GMM_TRANSLATIONTABLE_CALLBACKS expectedTTCallbacks = {}; GMM_TRANSLATIONTABLE_CALLBACKS expectedTTCallbacks = {};
unsigned int expectedFlags = (TT_TYPE::TRTT | TT_TYPE::AUXTT); unsigned int expectedFlags = (TT_TYPE::TRTT | TT_TYPE::AUXTT);
auto myGdi = myMockWddm->getGdi(); auto myGdi = myMockWddm->getGdi();
// clang-format off // clang-format off
expectedDeviceCb.Adapter.KmtHandle = myMockWddm->getAdapter(); expectedDeviceCb.Adapter.KmtHandle = myMockWddm->getAdapter();
expectedDeviceCb.hDevice.KmtHandle = myMockWddm->getDevice(); expectedDeviceCb.hDevice.KmtHandle = myMockWddm->getDevice();
expectedDeviceCb.PagingQueue = myMockWddm->getPagingQueue(); expectedDeviceCb.PagingQueue = myMockWddm->getPagingQueue();
expectedDeviceCb.PagingFence = myMockWddm->getPagingQueueSyncObject(); expectedDeviceCb.PagingFence = myMockWddm->getPagingQueueSyncObject();
expectedDeviceCb.DevCbPtrs.KmtCbPtrs.pfnAllocate = myGdi->createAllocation; expectedDeviceCb.DevCbPtrs.KmtCbPtrs.pfnAllocate = myGdi->createAllocation;
expectedDeviceCb.DevCbPtrs.KmtCbPtrs.pfnDeallocate = myGdi->destroyAllocation; expectedDeviceCb.DevCbPtrs.KmtCbPtrs.pfnDeallocate = myGdi->destroyAllocation;
expectedDeviceCb.DevCbPtrs.KmtCbPtrs.pfnMapGPUVA = myGdi->mapGpuVirtualAddress; expectedDeviceCb.DevCbPtrs.KmtCbPtrs.pfnMapGPUVA = myGdi->mapGpuVirtualAddress;
expectedDeviceCb.DevCbPtrs.KmtCbPtrs.pfnMakeResident = myGdi->makeResident; expectedDeviceCb.DevCbPtrs.KmtCbPtrs.pfnMakeResident = myGdi->makeResident;
expectedDeviceCb.DevCbPtrs.KmtCbPtrs.pfnEvict = myGdi->evict; expectedDeviceCb.DevCbPtrs.KmtCbPtrs.pfnEvict = myGdi->evict;
expectedDeviceCb.DevCbPtrs.KmtCbPtrs.pfnReserveGPUVA = myGdi->reserveGpuVirtualAddress; expectedDeviceCb.DevCbPtrs.KmtCbPtrs.pfnReserveGPUVA = myGdi->reserveGpuVirtualAddress;
expectedDeviceCb.DevCbPtrs.KmtCbPtrs.pfnUpdateGPUVA = myGdi->updateGpuVirtualAddress; expectedDeviceCb.DevCbPtrs.KmtCbPtrs.pfnUpdateGPUVA = myGdi->updateGpuVirtualAddress;
expectedDeviceCb.DevCbPtrs.KmtCbPtrs.pfnWaitFromCpu = myGdi->waitForSynchronizationObjectFromCpu; expectedDeviceCb.DevCbPtrs.KmtCbPtrs.pfnWaitFromCpu = myGdi->waitForSynchronizationObjectFromCpu;
expectedDeviceCb.DevCbPtrs.KmtCbPtrs.pfnLock = myGdi->lock2; expectedDeviceCb.DevCbPtrs.KmtCbPtrs.pfnLock = myGdi->lock2;
expectedDeviceCb.DevCbPtrs.KmtCbPtrs.pfnUnLock = myGdi->unlock2; expectedDeviceCb.DevCbPtrs.KmtCbPtrs.pfnUnLock = myGdi->unlock2;
expectedDeviceCb.DevCbPtrs.KmtCbPtrs.pfnEscape = myGdi->escape; expectedDeviceCb.DevCbPtrs.KmtCbPtrs.pfnEscape = myGdi->escape;
expectedTTCallbacks.pfWriteL3Adr = TTCallbacks<FamilyType>::writeL3Address; expectedTTCallbacks.pfWriteL3Adr = TTCallbacks<FamilyType>::writeL3Address;
// clang-format on // clang-format on
EXPECT_TRUE(memcmp(&expectedDeviceCb, &mockMngr->deviceCb, sizeof(GMM_DEVICE_CALLBACKS_INT)) == 0); EXPECT_TRUE(memcmp(&expectedDeviceCb, &mockMngr->deviceCb, sizeof(GMM_DEVICE_CALLBACKS_INT)) == 0);
EXPECT_TRUE(memcmp(&expectedDeviceCb.Adapter, &mockMngr->deviceCb.Adapter, sizeof(GMM_HANDLE_EXT)) == 0); EXPECT_TRUE(memcmp(&expectedDeviceCb.Adapter, &mockMngr->deviceCb.Adapter, sizeof(GMM_HANDLE_EXT)) == 0);
EXPECT_TRUE(memcmp(&expectedDeviceCb.hDevice, &mockMngr->deviceCb.hDevice, sizeof(GMM_HANDLE_EXT)) == 0); EXPECT_TRUE(memcmp(&expectedDeviceCb.hDevice, &mockMngr->deviceCb.hDevice, sizeof(GMM_HANDLE_EXT)) == 0);
EXPECT_TRUE(memcmp(&expectedDeviceCb.DevCbPtrs.KmtCbPtrs, &mockMngr->deviceCb.DevCbPtrs.KmtCbPtrs, sizeof(GMM_DEVICE_CB_PTRS::KmtCbPtrs)) == 0); EXPECT_TRUE(memcmp(&expectedDeviceCb.DevCbPtrs.KmtCbPtrs, &mockMngr->deviceCb.DevCbPtrs.KmtCbPtrs, sizeof(GMM_DEVICE_CB_PTRS::KmtCbPtrs)) == 0);
EXPECT_TRUE(memcmp(&expectedTTCallbacks, &mockMngr->translationTableCb, sizeof(GMM_TRANSLATIONTABLE_CALLBACKS)) == 0); EXPECT_TRUE(memcmp(&expectedTTCallbacks, &mockMngr->translationTableCb, sizeof(GMM_TRANSLATIONTABLE_CALLBACKS)) == 0);
EXPECT_TRUE(memcmp(&expectedFlags, &mockMngr->translationTableFlags, sizeof(unsigned int)) == 0); EXPECT_TRUE(memcmp(&expectedFlags, &mockMngr->translationTableFlags, sizeof(unsigned int)) == 0);
}
} }
HWTEST_F(WddmCsrCompressionTests, givenDisabledCompressionWhenInitializedThenDontCreatePagetableMngr) { HWTEST_F(WddmCsrCompressionTests, givenDisabledCompressionWhenInitializedThenDontCreatePagetableMngr) {
setCompressionEnabled(false); setCompressionEnabled(false, false);
createMockWddm(); createMockWddm();
MockWddmCsr<FamilyType> mockWddmCsr(hwInfo, myMockWddm.get()); MockWddmCsr<FamilyType> mockWddmCsr(hwInfo, myMockWddm.get());
EXPECT_EQ(nullptr, myMockWddm->getPageTableManager()); EXPECT_EQ(nullptr, myMockWddm->getPageTableManager());
} }
HWTEST_F(WddmCsrCompressionTests, givenEnabledCompressionWhenFlushingThenInitTranslationTableOnce) { HWTEST_F(WddmCsrCompressionTests, givenEnabledCompressionWhenFlushingThenInitTranslationTableOnce) {
createMockWddm(); bool compressionEnabled[2][2] = {{true, false}, {false, true}};
auto mockWddmCsr = new MockWddmCsr<FamilyType>(hwInfo, myMockWddm.get()); for (size_t i = 0; i < 2; i++) {
mockWddmCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch); setCompressionEnabled(compressionEnabled[i][0], compressionEnabled[i][1]);
createMockWddm();
auto mockWddmCsr = new MockWddmCsr<FamilyType>(hwInfo, myMockWddm.get());
mockWddmCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);
auto mockMngr = reinterpret_cast<MockGmmPageTableMngr *>(myMockWddm->getPageTableManager()); auto mockMngr = reinterpret_cast<MockGmmPageTableMngr *>(myMockWddm->getPageTableManager());
mockWddmCsr->setMemoryManager(memManager); mockWddmCsr->setMemoryManager(memManager);
this->device->resetCommandStreamReceiver(mockWddmCsr); this->device->resetCommandStreamReceiver(mockWddmCsr);
mockWddmCsr->setPreemptionCsrAllocation(preemptionAllocation); mockWddmCsr->setPreemptionCsrAllocation(preemptionAllocation);
auto &csrCS = mockWddmCsr->getCS(); auto &csrCS = mockWddmCsr->getCS();
auto graphicsAllocation = memManager->allocateGraphicsMemory(1024); auto graphicsAllocation = memManager->allocateGraphicsMemory(1024);
IndirectHeap cs(graphicsAllocation); IndirectHeap cs(graphicsAllocation);
EXPECT_FALSE(mockWddmCsr->pageTableManagerInitialized); EXPECT_FALSE(mockWddmCsr->pageTableManagerInitialized);
EXPECT_CALL(*mockMngr, initContextAuxTableRegister(mockWddmCsr, GMM_ENGINE_TYPE::ENGINE_TYPE_RCS)) EXPECT_CALL(*mockMngr, initContextAuxTableRegister(mockWddmCsr, GMM_ENGINE_TYPE::ENGINE_TYPE_RCS))
.Times(1) .Times(1)
.WillOnce(Return(GMM_SUCCESS)); .WillOnce(Return(GMM_SUCCESS));
EXPECT_CALL(*mockMngr, initContextTRTableRegister(mockWddmCsr, GMM_ENGINE_TYPE::ENGINE_TYPE_RCS)) EXPECT_CALL(*mockMngr, initContextTRTableRegister(mockWddmCsr, GMM_ENGINE_TYPE::ENGINE_TYPE_RCS))
.Times(1) .Times(1)
.WillOnce(Return(GMM_SUCCESS)); .WillOnce(Return(GMM_SUCCESS));
DispatchFlags dispatchFlags; DispatchFlags dispatchFlags;
mockWddmCsr->flushTask(cs, 0u, cs, cs, cs, 0u, dispatchFlags); mockWddmCsr->flushTask(cs, 0u, cs, cs, cs, 0u, dispatchFlags);
EXPECT_TRUE(mockWddmCsr->pageTableManagerInitialized); EXPECT_TRUE(mockWddmCsr->pageTableManagerInitialized);
// flush again to check if PT manager was initialized once // flush again to check if PT manager was initialized once
mockWddmCsr->flushTask(cs, 0u, cs, cs, cs, 0u, dispatchFlags); mockWddmCsr->flushTask(cs, 0u, cs, cs, cs, 0u, dispatchFlags);
mockWddmCsr->flushBatchedSubmissions(); mockWddmCsr->flushBatchedSubmissions();
memManager->freeGraphicsMemory(graphicsAllocation); memManager->freeGraphicsMemory(graphicsAllocation);
}
} }
HWTEST_F(WddmCsrCompressionTests, givenDisabledCompressionWhenFlushingThenDontInitTranslationTable) { HWTEST_F(WddmCsrCompressionTests, givenDisabledCompressionWhenFlushingThenDontInitTranslationTable) {
setCompressionEnabled(false); setCompressionEnabled(false, false);
createMockWddm(); createMockWddm();
auto mockWddmCsr = new MockWddmCsr<FamilyType>(hwInfo, myMockWddm.get()); auto mockWddmCsr = new MockWddmCsr<FamilyType>(hwInfo, myMockWddm.get());
mockWddmCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch); mockWddmCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);

View File

@@ -39,7 +39,7 @@ void WddmMemoryManagerFixture::SetUp() {
GdiDllFixture::SetUp(); GdiDllFixture::SetUp();
wddm = static_cast<WddmMock *>(Wddm::createWddm(WddmInterfaceVersion::Wddm20)); wddm = static_cast<WddmMock *>(Wddm::createWddm(WddmInterfaceVersion::Wddm20));
ASSERT_NE(nullptr, wddm); ASSERT_NE(nullptr, wddm);
if (platformDevices[0]->capabilityTable.ftrCompression) { if (platformDevices[0]->capabilityTable.ftrRenderCompressedBuffers || platformDevices[0]->capabilityTable.ftrRenderCompressedImages) {
GMM_DEVICE_CALLBACKS_INT dummyDeviceCallbacks = {}; GMM_DEVICE_CALLBACKS_INT dummyDeviceCallbacks = {};
GMM_TRANSLATIONTABLE_CALLBACKS dummyTTCallbacks = {}; GMM_TRANSLATIONTABLE_CALLBACKS dummyTTCallbacks = {};
wddm->resetPageTableManager(GmmPageTableMngr::create(&dummyDeviceCallbacks, 0, &dummyTTCallbacks)); wddm->resetPageTableManager(GmmPageTableMngr::create(&dummyDeviceCallbacks, 0, &dummyTTCallbacks));