@@ -1844,7 +1844,9 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCommandStreamReceiverWhenFlus
1844
1844
pDevice->resetCommandStreamReceiver (csr);
1845
1845
1846
1846
MockGmmPageTableMngr *pageTableManager = new MockGmmPageTableMngr ();
1847
- pDevice->getExecutionEnvironment ()->rootDeviceEnvironments [pDevice->getRootDeviceIndex ()]->pageTableManager .reset (pageTableManager);
1847
+ csr->pageTableManager .reset (pageTableManager);
1848
+ MockGmmPageTableMngr *pageTableManager2 = new MockGmmPageTableMngr ();
1849
+ csr2->pageTableManager .reset (pageTableManager2);
1848
1850
1849
1851
EXPECT_CALL (*pageTableManager, initContextAuxTableRegister (csr, ::testing::_)).Times (1 );
1850
1852
EXPECT_CALL (*pageTableManager, initContextAuxTableRegister (csr2, ::testing::_)).Times (0 );
@@ -1865,20 +1867,149 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCommandStreamReceiverWhenFlus
1865
1867
1866
1868
csr->flushTask (cs, 0u , cs, cs, cs, 0u , dispatchFlags, *pDevice);
1867
1869
1868
- EXPECT_CALL (*pageTableManager , initContextAuxTableRegister (csr2, ::testing::_)).Times (1 );
1870
+ EXPECT_CALL (*pageTableManager2 , initContextAuxTableRegister (csr2, ::testing::_)).Times (1 );
1869
1871
pDevice->resetCommandStreamReceiver (csr2);
1870
1872
csr2->flushTask (cs, 0u , cs, cs, cs, 0u , dispatchFlags, *pDevice);
1871
1873
EXPECT_TRUE (csr2->pageTableManagerInitialized );
1872
1874
1873
1875
memoryManager->freeGraphicsMemory (graphicsAllocation);
1874
1876
}
1875
1877
1878
+ HWTEST_F (CommandStreamReceiverFlushTaskTests, givenPageTableManagerPointerWhenCallBlitBufferThenPageTableManagerInitializedForProperCsr) {
1879
+ auto bcsCsr = new MockCsrHw2<FamilyType>(*pDevice->executionEnvironment , pDevice->getRootDeviceIndex (), pDevice->getDeviceBitfield ());
1880
+ auto bcsCsr2 = new MockCsrHw2<FamilyType>(*pDevice->executionEnvironment , pDevice->getRootDeviceIndex (), pDevice->getDeviceBitfield ());
1881
+ pDevice->resetCommandStreamReceiver (bcsCsr);
1882
+
1883
+ MockGmmPageTableMngr *pageTableManager = new MockGmmPageTableMngr ();
1884
+ bcsCsr->pageTableManager .reset (pageTableManager);
1885
+ MockGmmPageTableMngr *pageTableManager2 = new MockGmmPageTableMngr ();
1886
+ bcsCsr2->pageTableManager .reset (pageTableManager2);
1887
+
1888
+ EXPECT_CALL (*pageTableManager, initContextAuxTableRegister (bcsCsr, ::testing::_)).Times (1 );
1889
+ EXPECT_CALL (*pageTableManager2, initContextAuxTableRegister (bcsCsr2, ::testing::_)).Times (0 );
1890
+
1891
+ auto memoryManager = pDevice->getMemoryManager ();
1892
+ auto graphicsAllocation = memoryManager->allocateGraphicsMemoryWithProperties (MockAllocationProperties{pDevice->getRootDeviceIndex (), MemoryConstants::pageSize});
1893
+
1894
+ EXPECT_FALSE (bcsCsr->pageTableManagerInitialized );
1895
+ EXPECT_FALSE (bcsCsr2->pageTableManagerInitialized );
1896
+
1897
+ auto blitProperties = BlitProperties::constructPropertiesForCopy (graphicsAllocation, // dstAllocation
1898
+ graphicsAllocation, // srcAllocation
1899
+ 0 , // dstOffset
1900
+ 0 , // srcOffset
1901
+ 0 , // copySize
1902
+ 0 , // srcRowPitch
1903
+ 0 , // srcSlicePitch
1904
+ 0 , // dstRowPitch
1905
+ 0 , // dstSlicePitch
1906
+ bcsCsr->getClearColorAllocation () // clearColorAllocation
1907
+ );
1908
+ BlitPropertiesContainer container;
1909
+ container.push_back (blitProperties);
1910
+
1911
+ bcsCsr->blitBuffer (container, true , false , *pDevice);
1912
+
1913
+ EXPECT_TRUE (bcsCsr->pageTableManagerInitialized );
1914
+ EXPECT_FALSE (bcsCsr2->pageTableManagerInitialized );
1915
+
1916
+ EXPECT_CALL (*pageTableManager2, initContextAuxTableRegister (bcsCsr2, ::testing::_)).Times (1 );
1917
+ pDevice->resetCommandStreamReceiver (bcsCsr2);
1918
+ bcsCsr2->blitBuffer (container, true , false , *pDevice);
1919
+
1920
+ EXPECT_TRUE (bcsCsr2->pageTableManagerInitialized );
1921
+
1922
+ memoryManager->freeGraphicsMemory (graphicsAllocation);
1923
+ }
1924
+
1925
+ HWTEST_F (CommandStreamReceiverFlushTaskTests, givenPageTableManagerPointerWhenCallBlitBufferAndPageTableManagerInitializedThenNotInitializeAgain) {
1926
+ auto bcsCsr = new MockCsrHw2<FamilyType>(*pDevice->executionEnvironment , pDevice->getRootDeviceIndex (), pDevice->getDeviceBitfield ());
1927
+ pDevice->resetCommandStreamReceiver (bcsCsr);
1928
+
1929
+ MockGmmPageTableMngr *pageTableManager = new MockGmmPageTableMngr ();
1930
+ bcsCsr->pageTableManager .reset (pageTableManager);
1931
+
1932
+ EXPECT_CALL (*pageTableManager, initContextAuxTableRegister (bcsCsr, ::testing::_)).Times (1 );
1933
+
1934
+ auto memoryManager = pDevice->getMemoryManager ();
1935
+ auto graphicsAllocation = memoryManager->allocateGraphicsMemoryWithProperties (MockAllocationProperties{pDevice->getRootDeviceIndex (), MemoryConstants::pageSize});
1936
+
1937
+ EXPECT_FALSE (bcsCsr->pageTableManagerInitialized );
1938
+
1939
+ auto blitProperties = BlitProperties::constructPropertiesForCopy (graphicsAllocation, // dstAllocation
1940
+ graphicsAllocation, // srcAllocation
1941
+ 0 , // dstOffset
1942
+ 0 , // srcOffset
1943
+ 0 , // copySize
1944
+ 0 , // srcRowPitch
1945
+ 0 , // srcSlicePitch
1946
+ 0 , // dstRowPitch
1947
+ 0 , // dstSlicePitch
1948
+ bcsCsr->getClearColorAllocation () // clearColorAllocation
1949
+ );
1950
+ BlitPropertiesContainer container;
1951
+ container.push_back (blitProperties);
1952
+
1953
+ bcsCsr->blitBuffer (container, true , false , *pDevice);
1954
+
1955
+ EXPECT_TRUE (bcsCsr->pageTableManagerInitialized );
1956
+
1957
+ EXPECT_CALL (*pageTableManager, initContextAuxTableRegister (bcsCsr, ::testing::_)).Times (0 );
1958
+ bcsCsr->blitBuffer (container, true , false , *pDevice);
1959
+
1960
+ memoryManager->freeGraphicsMemory (graphicsAllocation);
1961
+ }
1962
+
1963
+ HWTEST_F (CommandStreamReceiverFlushTaskTests, givenNullPageTableManagerWhenCallBlitBufferThenPageTableManagerIsNotInitialized) {
1964
+ auto bcsCsr = new MockCsrHw2<FamilyType>(*pDevice->executionEnvironment , pDevice->getRootDeviceIndex (), pDevice->getDeviceBitfield ());
1965
+ auto bcsCsr2 = new MockCsrHw2<FamilyType>(*pDevice->executionEnvironment , pDevice->getRootDeviceIndex (), pDevice->getDeviceBitfield ());
1966
+ pDevice->resetCommandStreamReceiver (bcsCsr);
1967
+
1968
+ bcsCsr->pageTableManager .reset (nullptr );
1969
+ bcsCsr2->pageTableManager .reset (nullptr );
1970
+
1971
+ auto memoryManager = pDevice->getMemoryManager ();
1972
+ auto graphicsAllocation = memoryManager->allocateGraphicsMemoryWithProperties (MockAllocationProperties{pDevice->getRootDeviceIndex (), MemoryConstants::pageSize});
1973
+
1974
+ EXPECT_FALSE (bcsCsr->pageTableManagerInitialized );
1975
+ EXPECT_FALSE (bcsCsr2->pageTableManagerInitialized );
1976
+
1977
+ auto blitProperties = BlitProperties::constructPropertiesForCopy (graphicsAllocation, // dstAllocation
1978
+ graphicsAllocation, // srcAllocation
1979
+ 0 , // dstOffset
1980
+ 0 , // srcOffset
1981
+ 0 , // copySize
1982
+ 0 , // srcRowPitch
1983
+ 0 , // srcSlicePitch
1984
+ 0 , // dstRowPitch
1985
+ 0 , // dstSlicePitch
1986
+ bcsCsr->getClearColorAllocation () // clearColorAllocation
1987
+ );
1988
+ BlitPropertiesContainer container;
1989
+ container.push_back (blitProperties);
1990
+
1991
+ bcsCsr->blitBuffer (container, true , false , *pDevice);
1992
+
1993
+ EXPECT_FALSE (bcsCsr->pageTableManagerInitialized );
1994
+ EXPECT_FALSE (bcsCsr2->pageTableManagerInitialized );
1995
+
1996
+ pDevice->resetCommandStreamReceiver (bcsCsr2);
1997
+ bcsCsr2->blitBuffer (container, true , false , *pDevice);
1998
+
1999
+ EXPECT_FALSE (bcsCsr2->pageTableManagerInitialized );
2000
+
2001
+ bcsCsr2->pageTableManagerInitialized = true ;
2002
+ EXPECT_NO_THROW (bcsCsr2->blitBuffer (container, true , false , *pDevice));
2003
+
2004
+ memoryManager->freeGraphicsMemory (graphicsAllocation);
2005
+ }
2006
+
1876
2007
HWTEST_F (CommandStreamReceiverFlushTaskTests, givenCommandStreamReceiverWhenInitializingPageTableManagerRegisterFailsThenPageTableManagerIsNotInitialized) {
1877
2008
auto csr = new MockCsrHw2<FamilyType>(*pDevice->executionEnvironment , pDevice->getRootDeviceIndex (), pDevice->getDeviceBitfield ());
1878
2009
pDevice->resetCommandStreamReceiver (csr);
1879
2010
1880
2011
MockGmmPageTableMngr *pageTableManager = new MockGmmPageTableMngr ();
1881
- pDevice-> getExecutionEnvironment ()-> rootDeviceEnvironments [pDevice-> getRootDeviceIndex ()] ->pageTableManager .reset (pageTableManager);
2012
+ csr ->pageTableManager .reset (pageTableManager);
1882
2013
1883
2014
EXPECT_CALL (*pageTableManager, initContextAuxTableRegister (csr, ::testing::_)).Times (2 ).WillRepeatedly (::testing::Return (GMM_ERROR));
1884
2015
0 commit comments