1111#include " unit_tests/fixtures/buffer_fixture.h"
1212#include " unit_tests/fixtures/context_fixture.h"
1313#include " unit_tests/fixtures/device_fixture.h"
14+ #include " unit_tests/utilities/base_object_utils.h"
1415#include " unit_tests/helpers/debug_manager_state_restore.h"
1516#include " unit_tests/helpers/unit_test_helper.h"
1617#include " unit_tests/mocks/mock_buffer.h"
@@ -361,6 +362,7 @@ HWTEST_F(CommandQueueHwTest, GivenNotCompleteUserEventPassedToEnqueueWhenEventIs
361362 mockCSR->getMemoryManager ()->freeGraphicsMemory (privateSurface);
362363 mockCSR->getMemoryManager ()->freeGraphicsMemory (printfSurface);
363364 mockCSR->getMemoryManager ()->freeGraphicsMemory (constantSurface);
365+ pCmdQ->isQueueBlocked ();
364366}
365367
366368typedef CommandQueueHwTest BlockedCommandQueueTest;
@@ -387,6 +389,8 @@ HWTEST_F(BlockedCommandQueueTest, givenCommandQueueWhenBlockedCommandIsBeingSubm
387389 EXPECT_EQ (0u , ioh.getUsed ());
388390 EXPECT_EQ (0u , dsh.getUsed ());
389391 EXPECT_EQ (defaultSshUse, ssh.getUsed ());
392+
393+ pCmdQ->isQueueBlocked ();
390394}
391395
392396HWTEST_F (BlockedCommandQueueTest, givenCommandQueueWithUsedHeapsWhenBlockedCommandIsBeingSubmittedThenQueueHeapsAreNotUsed) {
@@ -417,6 +421,8 @@ HWTEST_F(BlockedCommandQueueTest, givenCommandQueueWithUsedHeapsWhenBlockedComma
417421 EXPECT_EQ (spaceToUse, ioh.getUsed ());
418422 EXPECT_EQ (spaceToUse, dsh.getUsed ());
419423 EXPECT_EQ (sshSpaceUse, ssh.getUsed ());
424+
425+ pCmdQ->isQueueBlocked ();
420426}
421427
422428HWTEST_F (BlockedCommandQueueTest, givenCommandQueueWhichHasSomeUnusedHeapsWhenBlockedCommandIsBeingSubmittedThenThoseHeapsAreBeingUsed) {
@@ -443,6 +449,8 @@ HWTEST_F(BlockedCommandQueueTest, givenCommandQueueWhichHasSomeUnusedHeapsWhenBl
443449 EXPECT_EQ (iohBase, ioh.getCpuBase ());
444450 EXPECT_EQ (dshBase, dsh.getCpuBase ());
445451 EXPECT_EQ (sshBase, ssh.getCpuBase ());
452+
453+ pCmdQ->isQueueBlocked ();
446454}
447455
448456HWTEST_F (BlockedCommandQueueTest, givenEnqueueBlockedByUserEventWhenItIsEnqueuedThenKernelReferenceCountIsIncreased) {
@@ -459,6 +467,7 @@ HWTEST_F(BlockedCommandQueueTest, givenEnqueueBlockedByUserEventWhenItIsEnqueued
459467 pCmdQ->enqueueKernel (mockKernel, 1 , &offset, &size, &size, 1 , &blockedEvent, nullptr );
460468 EXPECT_EQ (currentRefCount + 1 , mockKernel->getRefInternalCount ());
461469 userEvent.setStatus (CL_COMPLETE);
470+ pCmdQ->isQueueBlocked ();
462471 EXPECT_EQ (currentRefCount, mockKernel->getRefInternalCount ());
463472}
464473
@@ -490,7 +499,7 @@ HWTEST_F(CommandQueueHwRefCountTest, givenBlockedCmdQWhenNewBlockedEnqueueReplac
490499
491500 userEvent.setStatus (CL_COMPLETE);
492501 // UserEvent is set to complete and event tree is unblocked, queue has only 1 refference to itself after this operation
493- EXPECT_EQ (1 , mockCmdQ->getRefInternalCount ());
502+ EXPECT_EQ (2 , mockCmdQ->getRefInternalCount ());
494503
495504 // this call will release the queue
496505 releaseQueue<CommandQueue>(mockCmdQ, retVal);
@@ -530,12 +539,13 @@ HWTEST_F(CommandQueueHwRefCountTest, givenBlockedCmdQWithOutputEventAsVirtualEve
530539 // unblocking deletes 2 virtualEvents
531540 userEvent.setStatus (CL_COMPLETE);
532541
533- EXPECT_EQ (2 , mockCmdQ->getRefInternalCount ());
542+ EXPECT_EQ (3 , mockCmdQ->getRefInternalCount ());
534543
535544 auto pEventOut = castToObject<Event>(eventOut);
536545 pEventOut->release ();
537546 // releasing output event decrements refCount
538- EXPECT_EQ (1 , mockCmdQ->getRefInternalCount ());
547+ EXPECT_EQ (2 , mockCmdQ->getRefInternalCount ());
548+ mockCmdQ->isQueueBlocked ();
539549
540550 releaseQueue<CommandQueue>(mockCmdQ, retVal);
541551}
@@ -575,13 +585,16 @@ HWTEST_F(CommandQueueHwRefCountTest, givenSeriesOfBlockedEnqueuesWhenEveryEventI
575585 userEvent->setStatus (CL_COMPLETE);
576586
577587 userEvent->release ();
578- // releasing UserEvent doesn't change the refCount
579- EXPECT_EQ (2 , mockCmdQ->getRefInternalCount ());
588+ EXPECT_EQ (3 , mockCmdQ->getRefInternalCount ());
580589
581590 auto pEventOut = castToObject<Event>(eventOut);
582591 pEventOut->release ();
583592
584593 // releasing output event decrements refCount
594+ EXPECT_EQ (2 , mockCmdQ->getRefInternalCount ());
595+
596+ mockCmdQ->isQueueBlocked ();
597+
585598 EXPECT_EQ (1 , mockCmdQ->getRefInternalCount ());
586599
587600 releaseQueue<CommandQueue>(mockCmdQ, retVal);
@@ -622,7 +635,7 @@ HWTEST_F(CommandQueueHwRefCountTest, givenSeriesOfBlockedEnqueuesWhenCmdQIsRelea
622635
623636 userEvent->release ();
624637 // releasing UserEvent doesn't change the queue refCount
625- EXPECT_EQ (2 , mockCmdQ->getRefInternalCount ());
638+ EXPECT_EQ (3 , mockCmdQ->getRefInternalCount ());
626639
627640 releaseQueue<CommandQueue>(mockCmdQ, retVal);
628641
@@ -963,6 +976,7 @@ HWTEST_F(CommandQueueHwTest, givenWalkerSplitEnqueueNDRangeWhenBlockedThenKernel
963976 EXPECT_EQ (1u , mockKernel->getResidencyCalls );
964977
965978 userEvent.setStatus (CL_COMPLETE);
979+ pCmdQ->isQueueBlocked ();
966980}
967981
968982HWTEST_F (CommandQueueHwTest, givenKernelSplitEnqueueReadBufferWhenBlockedThenEnqueueSurfacesMakeResidentIsCalledOnce) {
@@ -972,7 +986,7 @@ HWTEST_F(CommandQueueHwTest, givenKernelSplitEnqueueReadBufferWhenBlockedThenEnq
972986 csr.timestampPacketWriteEnabled = false ;
973987
974988 BufferDefaults::context = context;
975- std::unique_ptr<Buffer> buffer (BufferHelper<>::create ());
989+ auto buffer = clUniquePtr (BufferHelper<>::create ());
976990 GraphicsAllocation *bufferAllocation = buffer->getGraphicsAllocation ();
977991 char array[3 * MemoryConstants::cacheLineSize];
978992 char *ptr = &array[MemoryConstants::cacheLineSize];
@@ -995,4 +1009,6 @@ HWTEST_F(CommandQueueHwTest, givenKernelSplitEnqueueReadBufferWhenBlockedThenEnq
9951009 }
9961010 EXPECT_EQ (expected, it->second );
9971011 }
1012+
1013+ pCmdQ->isQueueBlocked ();
9981014}
0 commit comments