mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-24 12:23:05 +08:00
Command Queue: Destroy timestamp packet container before releasing context
Change-Id: I7ee492586ee178bc89c44d5d6663d3ff8fb2e778 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
1439f49845
commit
74510286a1
@@ -13,6 +13,7 @@
|
||||
#include "runtime/helpers/basic_math.h"
|
||||
#include "runtime/helpers/kernel_commands.h"
|
||||
#include "runtime/helpers/options.h"
|
||||
#include "runtime/helpers/timestamp_packet.h"
|
||||
|
||||
#include "unit_tests/command_queue/command_queue_fixture.h"
|
||||
#include "unit_tests/command_stream/command_stream_fixture.h"
|
||||
@@ -949,3 +950,22 @@ HWTEST_F(CommandQueueCommandStreamTest, givenCsrWithDebugSurfaceAllocatedWhenSet
|
||||
RENDER_SURFACE_STATE *surfaceState = (RENDER_SURFACE_STATE *)kernel->getSurfaceStateHeap();
|
||||
EXPECT_EQ(debugSurface->getGpuAddress(), surfaceState->getSurfaceBaseAddress());
|
||||
}
|
||||
|
||||
struct MockTimestampPacketContainer : TimestampPacketContainer {
|
||||
MockTimestampPacketContainer(Context &context) : context(context) {
|
||||
}
|
||||
~MockTimestampPacketContainer() override {
|
||||
EXPECT_EQ(1, context.getRefInternalCount());
|
||||
}
|
||||
Context &context;
|
||||
};
|
||||
|
||||
TEST(CommandQueueDestructorTest, whenCommandQueueIsDestroyedThenDestroysTimestampPacketContainerBeforeReleasingContext) {
|
||||
auto context = new MockContext;
|
||||
EXPECT_EQ(1, context->getRefInternalCount());
|
||||
MockCommandQueue queue(context, context->getDevice(0), nullptr);
|
||||
queue.timestampPacketContainer.reset(new MockTimestampPacketContainer(*context));
|
||||
EXPECT_EQ(2, context->getRefInternalCount());
|
||||
context->release();
|
||||
EXPECT_EQ(1, context->getRefInternalCount());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user