mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-30 09:58:55 +08:00
I915_EXEC_DATA_PORT_COHERENT support
- new mechanism to switch coherency at exec level Change-Id: I3e9cca2141822828be7d44e858e8fe2c258efbfa
This commit is contained in:
committed by
sys_ocldev
parent
26b0b9a873
commit
933312e098
@@ -26,6 +26,7 @@
|
||||
#include "unit_tests/os_interface/linux/drm_mock.h"
|
||||
#include "unit_tests/fixtures/memory_management_fixture.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "gmock/gmock.h"
|
||||
|
||||
#include "runtime/os_interface/os_interface.h"
|
||||
#include <fstream>
|
||||
@@ -180,6 +181,50 @@ TEST(DrmTest, GivenMockDrmWhenAskedFor48BitAddressCorrectValueReturned) {
|
||||
delete pDrm;
|
||||
}
|
||||
|
||||
ACTION_P2(saveGetParamData, saveParamPtr, forceReturnValuePtr) {
|
||||
auto getParamArg = static_cast<drm_i915_getparam_t *>(arg1);
|
||||
*saveParamPtr = getParamArg->param;
|
||||
*getParamArg->value = forceReturnValuePtr;
|
||||
}
|
||||
struct DrmDataPortCoherencyTests : public ::testing::Test {
|
||||
struct MyMockDrm : public Drm2 {
|
||||
MyMockDrm() : Drm2(){};
|
||||
MOCK_METHOD2(ioctl, int(unsigned long request, void *arg));
|
||||
} drm;
|
||||
|
||||
void setupExpectCall(int expectedRetVal, int expectedGetParamValue) {
|
||||
using namespace ::testing;
|
||||
auto saveAndReturnAction = DoAll(saveGetParamData(&receivedGetParamType, expectedGetParamValue),
|
||||
Return(expectedRetVal));
|
||||
EXPECT_CALL(drm, ioctl(DRM_IOCTL_I915_GETPARAM, _)).Times(1).WillOnce(saveAndReturnAction);
|
||||
}
|
||||
int receivedGetParamType = 0;
|
||||
};
|
||||
|
||||
TEST_F(DrmDataPortCoherencyTests, givenDisabledPatchWhenAskedToObtainDataPortCoherencyPatchThenReturnFlase) {
|
||||
setupExpectCall(1, 0); // return error == 1, dont care about assigned feature value
|
||||
drm.obtainDataPortCoherencyPatchActive();
|
||||
|
||||
EXPECT_EQ(receivedGetParamType, I915_PARAM_HAS_EXEC_DATA_PORT_COHERENCY);
|
||||
EXPECT_FALSE(drm.peekDataPortCoherencyPatchActive());
|
||||
}
|
||||
|
||||
TEST_F(DrmDataPortCoherencyTests, givenEnabledPatchAndDisabledFeatureWhenAskedToObtainDataPortCoherencyPatchThenReturnFlase) {
|
||||
setupExpectCall(0, 0); // return success(0), set disabled feature (0)
|
||||
drm.obtainDataPortCoherencyPatchActive();
|
||||
|
||||
EXPECT_EQ(receivedGetParamType, I915_PARAM_HAS_EXEC_DATA_PORT_COHERENCY);
|
||||
EXPECT_FALSE(drm.peekDataPortCoherencyPatchActive());
|
||||
}
|
||||
|
||||
TEST_F(DrmDataPortCoherencyTests, givenEnabledPatchAndEnabledFeatureWhenAskedToObtainDataPortCoherencyPatchThenReturnTrue) {
|
||||
setupExpectCall(0, 1); // return success(0), set enabled feature (1)
|
||||
drm.obtainDataPortCoherencyPatchActive();
|
||||
|
||||
EXPECT_EQ(receivedGetParamType, I915_PARAM_HAS_EXEC_DATA_PORT_COHERENCY);
|
||||
EXPECT_TRUE(drm.peekDataPortCoherencyPatchActive());
|
||||
}
|
||||
|
||||
#if defined(I915_PARAM_HAS_PREEMPTION)
|
||||
TEST(DrmTest, GivenMockDrmWhenAskedForPreemptionCorrectValueReturned) {
|
||||
Drm2 *pDrm = new Drm2;
|
||||
|
||||
Reference in New Issue
Block a user