/* * Copyright (C) 2018-2019 Intel Corporation * * SPDX-License-Identifier: MIT * */ #pragma once #include "runtime/os_interface/linux/drm_command_stream.h" using namespace NEO; template class TestedDrmCommandStreamReceiver : public DrmCommandStreamReceiver { public: using CommandStreamReceiver::commandStream; using CommandStreamReceiver::makeResident; using DrmCommandStreamReceiver::makeResidentBufferObjects; using DrmCommandStreamReceiver::residency; using CommandStreamReceiverHw::CommandStreamReceiver::lastSentSliceCount; TestedDrmCommandStreamReceiver(gemCloseWorkerMode mode, ExecutionEnvironment &executionEnvironment) : DrmCommandStreamReceiver(executionEnvironment, 0, mode) { } TestedDrmCommandStreamReceiver(ExecutionEnvironment &executionEnvironment) : DrmCommandStreamReceiver(executionEnvironment, 0, gemCloseWorkerMode::gemCloseWorkerInactive) { } void overrideDispatchPolicy(DispatchMode overrideValue) { this->dispatchMode = overrideValue; } void makeNonResident(GraphicsAllocation &gfxAllocation) override { makeNonResidentResult.called = true; makeNonResidentResult.allocation = &gfxAllocation; DrmCommandStreamReceiver::makeNonResident(gfxAllocation); } struct MakeResidentNonResidentResult { bool called = false; GraphicsAllocation *allocation = nullptr; }; MakeResidentNonResidentResult makeNonResidentResult; SubmissionAggregator *peekSubmissionAggregator() const { return this->submissionAggregator.get(); } void overrideSubmissionAggregator(SubmissionAggregator *newSubmissionsAggregator) { this->submissionAggregator.reset(newSubmissionsAggregator); } std::vector &getExecStorage() { return this->execObjectsStorage; } };