Skip to content

Commit 9e509f3

Browse files
Coherency patch cleanup
Change-Id: I1aa89358e5ce9f977c689f18d9186447501ca558
1 parent adf2051 commit 9e509f3

File tree

11 files changed

+8
-164
lines changed

11 files changed

+8
-164
lines changed

runtime/os_interface/linux/drm_buffer_object.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,6 @@ int BufferObject::exec(uint32_t used, size_t startOffset, unsigned int flags, bo
156156
execbuf.batch_len = alignUp(used, 8);
157157
execbuf.flags = flags;
158158

159-
if (drm->peekCoherencyDisablePatchActive() && !requiresCoherency) {
160-
execbuf.flags |= I915_PRIVATE_EXEC_FORCE_NON_COHERENT;
161-
}
162159
if (lowPriority) {
163160
execbuf.rsvd1 = this->drm->lowPriorityContextId & I915_EXEC_CONTEXT_ID_MASK;
164161
}
@@ -193,10 +190,6 @@ int BufferObject::pin(BufferObject *boToPin[], size_t numberOfBos) {
193190
execbuf.buffer_count = boIndex + 1;
194191
execbuf.batch_len = alignUp(static_cast<uint32_t>(sizeof(uint32_t)), 8);
195192

196-
if (drm->peekCoherencyDisablePatchActive()) {
197-
execbuf.flags = execbuf.flags | I915_PRIVATE_EXEC_FORCE_NON_COHERENT;
198-
}
199-
200193
int err = 0;
201194
int ret = this->drm->ioctl(DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf);
202195
if (ret != 0) {

runtime/os_interface/linux/drm_neo.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,12 +115,6 @@ int Drm::getMaxGpuFrequency(int &maxGpuFrequency) {
115115
return 0;
116116
}
117117

118-
void Drm::obtainCoherencyDisablePatchActive() {
119-
int value = 0;
120-
auto ret = getParamIoctl(I915_PRIVATE_PARAM_HAS_EXEC_FORCE_NON_COHERENT, &value);
121-
coherencyDisablePatchActive = (ret == 0) && (value != 0);
122-
}
123-
124118
std::string Drm::getSysFsPciPath(int deviceID) {
125119
std::string nullPath;
126120
std::string sysFsPciDirectory = Os::sysFsPciPath;

runtime/os_interface/linux/drm_neo.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,6 @@
3333
struct GT_SYSTEM_INFO;
3434

3535
namespace OCLRT {
36-
37-
#define I915_PRIVATE_PARAM_HAS_EXEC_FORCE_NON_COHERENT (-1)
38-
#define I915_PRIVATE_EXEC_FORCE_NON_COHERENT (1 << 31)
39-
4036
#define I915_CONTEXT_PRIVATE_PARAM_BOOST 0x80000000
4137

4238
class DeviceFactory;
@@ -74,8 +70,6 @@ class Drm {
7470
bool is48BitAddressRangeSupported();
7571
MOCKABLE_VIRTUAL bool hasPreemption();
7672
bool setLowPriority();
77-
bool peekCoherencyDisablePatchActive() { return coherencyDisablePatchActive; }
78-
virtual void obtainCoherencyDisablePatchActive();
7973
int getFileDescriptor() const { return fd; }
8074
bool contextCreate();
8175
void contextDestroy();
@@ -89,7 +83,6 @@ class Drm {
8983
int deviceId;
9084
int revisionId;
9185
GTTYPE eGtType;
92-
bool coherencyDisablePatchActive = false;
9386
Drm(int fd) : lowPriorityContextId(0), fd(fd), deviceId(0), revisionId(0), eGtType(GTTYPE_UNDEFINED) {}
9487
virtual ~Drm();
9588

runtime/os_interface/linux/drm_null_device.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, Intel Corporation
2+
* Copyright (c) 2017 - 2018, Intel Corporation
33
*
44
* Permission is hereby granted, free of charge, to any person obtaining a
55
* copy of this software and associated documentation files (the "Software"),
@@ -54,8 +54,6 @@ class DrmNullDevice : public Drm {
5454
}
5555
}
5656

57-
void obtainCoherencyDisablePatchActive() override { coherencyDisablePatchActive = true; }
58-
5957
protected:
6058
DrmNullDevice(int fd) : Drm(fd), gpuTimestamp(0){};
6159

runtime/os_interface/linux/hw_info_config.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ int HwInfoConfig::configureHwInfo(const HardwareInfo *inHwInfo, HardwareInfo *ou
131131
}
132132
pSysInfo->SubSliceCount = static_cast<uint32_t>(subSliceCount);
133133

134-
drm->obtainCoherencyDisablePatchActive();
135134
pSkuTable->ftrSVM = drm->is48BitAddressRangeSupported();
136135

137136
int maxGpuFreq = 0;
@@ -164,10 +163,8 @@ int HwInfoConfig::configureHwInfo(const HardwareInfo *inHwInfo, HardwareInfo *ou
164163
outHwInfo->capabilityTable.maxRenderFrequency = maxGpuFreq;
165164
outHwInfo->capabilityTable.ftrSvm = pSkuTable->ftrSVM;
166165

167-
bool platformCoherency = false;
168166
HwHelper &hwHelper = HwHelper::get(pPlatform->eRenderCoreFamily);
169-
hwHelper.setCapabilityCoherencyFlag(const_cast<const HardwareInfo *>(outHwInfo), platformCoherency);
170-
outHwInfo->capabilityTable.ftrSupportsCoherency = (platformCoherency && drm->peekCoherencyDisablePatchActive());
167+
outHwInfo->capabilityTable.ftrSupportsCoherency = false;
171168

172169
outHwInfo->capabilityTable.defaultEngineType = DebugManager.flags.NodeOrdinal.get() == -1
173170
? outHwInfo->capabilityTable.defaultEngineType

unit_tests/linux/drm_null_device_tests.cpp

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, Intel Corporation
2+
* Copyright (c) 2017 - 2018, Intel Corporation
33
*
44
* Permission is hereby granted, free of charge, to any person obtaining a
55
* copy of this software and associated documentation files (the "Software"),
@@ -76,13 +76,6 @@ TEST_F(DrmNullDeviceTests, GIVENdrmNullDeviceWHENcallGetDeviceIdTHENreturnProper
7676
EXPECT_EQ(0x1916, deviceId);
7777
}
7878

79-
TEST_F(DrmNullDeviceTests, GIVENdrmNullDeviceWHENpeekAndObtainCoherencyDisablePatchActiveTHENreturnNullDeviceValues) {
80-
EXPECT_EQ(drmNullDevice->peekCoherencyDisablePatchActive(), false);
81-
82-
drmNullDevice->obtainCoherencyDisablePatchActive();
83-
EXPECT_EQ(drmNullDevice->peekCoherencyDisablePatchActive(), true);
84-
}
85-
8679
TEST_F(DrmNullDeviceTests, GIVENdrmNullDeviceWHENcallIoctlTHENalwaysSuccess) {
8780
EXPECT_EQ(drmNullDevice->ioctl(0, nullptr), 0);
8881
}

unit_tests/os_interface/linux/device_command_stream_fixture.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ class DrmMockCustom : public Drm {
8080

8181
IoctlResExt(int32_t no, int32_t res) : no(no), res(res) {}
8282
};
83-
void overideCoherencyPatchActive(bool newCoherencyPatchActiveValue) { coherencyDisablePatchActive = newCoherencyPatchActiveValue; }
8483

8584
class Ioctls {
8685
public:

unit_tests/os_interface/linux/drm_buffer_object_tests.cpp

Lines changed: 0 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -86,30 +86,6 @@ TEST_F(DrmBufferObjectTest, exec) {
8686
EXPECT_EQ(0u, mock->execBuffer.flags);
8787
}
8888

89-
TEST_F(DrmBufferObjectTest, givenDrmWithCoherencyPatchActiveWhenExecIsCalledThenFlagsContainNonCoherentFlag) {
90-
mock->ioctl_expected.total = 1;
91-
mock->ioctl_res = 0;
92-
mock->overideCoherencyPatchActive(true);
93-
94-
auto ret = bo->exec(0, 0, 0);
95-
EXPECT_EQ(mock->ioctl_res, ret);
96-
uint64_t expectedFlag = I915_PRIVATE_EXEC_FORCE_NON_COHERENT;
97-
uint64_t currentFlag = mock->execBuffer.flags;
98-
EXPECT_EQ(expectedFlag, currentFlag);
99-
}
100-
101-
TEST_F(DrmBufferObjectTest, givenDrmWithCoherencyPatchActiveWhenExecIsCalledWithCoherencyRequestThenFlagsDontContainNonCoherentFlag) {
102-
mock->ioctl_expected.total = 1;
103-
mock->ioctl_res = 0;
104-
mock->overideCoherencyPatchActive(true);
105-
106-
auto ret = bo->exec(0, 0, 0, true);
107-
EXPECT_EQ(mock->ioctl_res, ret);
108-
uint64_t expectedFlag = 0;
109-
uint64_t currentFlag = mock->execBuffer.flags;
110-
EXPECT_EQ(expectedFlag, currentFlag);
111-
}
112-
11389
TEST_F(DrmBufferObjectTest, exec_ioctlFailed) {
11490
mock->ioctl_expected.total = 1;
11591
mock->ioctl_res = -1;
@@ -152,48 +128,6 @@ TEST_F(DrmBufferObjectTest, testExecObjectFlags) {
152128
EXPECT_FALSE(execObject.flags & EXEC_OBJECT_SUPPORTS_48B_ADDRESS);
153129
}
154130

155-
TEST_F(DrmBufferObjectTest, onPinBBhasOnlyBbEndAndForceNonCoherent) {
156-
std::unique_ptr<uint32_t[]> buff(new uint32_t[1024]);
157-
mock->ioctl_expected.total = 1;
158-
mock->ioctl_res = 0;
159-
160-
mock->overideCoherencyPatchActive(true);
161-
std::unique_ptr<BufferObject> boToPin(new TestedBufferObject(this->mock));
162-
ASSERT_NE(nullptr, boToPin.get());
163-
164-
bo->setAddress(buff.get());
165-
BufferObject *boArray[1] = {boToPin.get()};
166-
auto ret = bo->pin(boArray, 1);
167-
EXPECT_EQ(mock->ioctl_res, ret);
168-
uint32_t bb_end = 0x05000000;
169-
EXPECT_EQ(buff[0], bb_end);
170-
EXPECT_GT(mock->execBuffer.batch_len, 0u);
171-
uint32_t flag = I915_PRIVATE_EXEC_FORCE_NON_COHERENT;
172-
EXPECT_TRUE((mock->execBuffer.flags & flag) == flag);
173-
bo->setAddress(nullptr);
174-
}
175-
176-
TEST_F(DrmBufferObjectTest, onPinBBhasOnlyBbEndAndNoForceNonCoherent) {
177-
std::unique_ptr<uint32_t[]> buff(new uint32_t[1024]);
178-
mock->ioctl_expected.total = 1;
179-
mock->ioctl_res = 0;
180-
181-
mock->overideCoherencyPatchActive(false);
182-
std::unique_ptr<BufferObject> boToPin(new TestedBufferObject(this->mock));
183-
ASSERT_NE(nullptr, boToPin.get());
184-
185-
bo->setAddress(buff.get());
186-
BufferObject *boArray[1] = {boToPin.get()};
187-
auto ret = bo->pin(boArray, 1);
188-
EXPECT_EQ(mock->ioctl_res, ret);
189-
uint32_t bb_end = 0x05000000;
190-
EXPECT_EQ(buff[0], bb_end);
191-
EXPECT_GT(mock->execBuffer.batch_len, 0u);
192-
uint32_t flag = I915_PRIVATE_EXEC_FORCE_NON_COHERENT;
193-
EXPECT_TRUE((mock->execBuffer.flags & flag) == 0);
194-
bo->setAddress(nullptr);
195-
}
196-
197131
TEST_F(DrmBufferObjectTest, onPinIoctlFailed) {
198132
std::unique_ptr<uint32_t[]> buff(new uint32_t[1024]);
199133

unit_tests/os_interface/linux/drm_mock.h

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, Intel Corporation
2+
* Copyright (c) 2017 - 2018, Intel Corporation
33
*
44
* Permission is hereby granted, free of charge, to any person obtaining a
55
* copy of this software and associated documentation files (the "Software"),
@@ -119,10 +119,6 @@ class Drm2 : public Drm {
119119
return this->StoredRetVal;
120120
}
121121
#endif
122-
if (gp->param == I915_PRIVATE_PARAM_HAS_EXEC_FORCE_NON_COHERENT) {
123-
*((int *)(gp->value)) = this->StoredDisableCoherencyPatchActive;
124-
return this->StoredRetVal;
125-
}
126122
if (gp->param == I915_PARAM_HAS_ALIASING_PPGTT) {
127123
*((int *)(gp->value)) = this->StoredPPGTT;
128124
return this->StoredRetVal;
@@ -184,8 +180,6 @@ class Drm2 : public Drm {
184180
return 0;
185181
}
186182

187-
void overideCoherencyPatchActive(bool newCoherencyPatchActiveValue) { coherencyDisablePatchActive = newCoherencyPatchActiveValue; }
188-
189183
void setSysFsDefaultGpuPath(const char *path) {
190184
sysFsDefaultGpuPathToRestore = sysFsDefaultGpuPath;
191185
sysFsDefaultGpuPath = path;
@@ -244,7 +238,6 @@ class Drm2 : public Drm {
244238
int StoredRetValForDeviceRevID = 0;
245239
int StoredRetValForPooledEU = 0;
246240
int StoredRetValForMinEUinPool = 0;
247-
int StoredDisableCoherencyPatchActive = 1;
248241
int StoredPPGTT = 3;
249242
int StoredPreemptionSupport = 1;
250243
int StoredMockPreemptionSupport = 0;

unit_tests/os_interface/linux/drm_tests.cpp

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -131,46 +131,6 @@ TEST(DrmTest, GetRevisionID) {
131131
delete pDrm;
132132
}
133133

134-
TEST(DrmTest, GivenMockDrmWhenAskedForCoherencyStatusThenProperBitIsSet) {
135-
Drm2 *pDrm = new Drm2;
136-
EXPECT_NE(nullptr, pDrm);
137-
138-
EXPECT_FALSE(pDrm->peekCoherencyDisablePatchActive());
139-
140-
pDrm->obtainCoherencyDisablePatchActive();
141-
142-
EXPECT_TRUE(pDrm->peekCoherencyDisablePatchActive());
143-
delete pDrm;
144-
}
145-
146-
TEST(DrmTest, GivenMockDrmWhenAskedForCoherencyStatusThatPassThenDisabledIsReturned) {
147-
Drm2 *pDrm = new Drm2;
148-
pDrm->StoredDisableCoherencyPatchActive = 0;
149-
EXPECT_NE(nullptr, pDrm);
150-
151-
EXPECT_FALSE(pDrm->peekCoherencyDisablePatchActive());
152-
153-
pDrm->obtainCoherencyDisablePatchActive();
154-
155-
EXPECT_FALSE(pDrm->peekCoherencyDisablePatchActive());
156-
pDrm->StoredDisableCoherencyPatchActive = 1;
157-
delete pDrm;
158-
}
159-
160-
TEST(DrmTest, GivenMockDrmWhenAskedForCoherencyStatusThatFailsThenFalseIsReturned) {
161-
Drm2 *pDrm = new Drm2;
162-
pDrm->StoredRetVal = -1;
163-
EXPECT_NE(nullptr, pDrm);
164-
165-
EXPECT_FALSE(pDrm->peekCoherencyDisablePatchActive());
166-
167-
pDrm->obtainCoherencyDisablePatchActive();
168-
169-
EXPECT_FALSE(pDrm->peekCoherencyDisablePatchActive());
170-
pDrm->StoredRetVal = 0;
171-
delete pDrm;
172-
}
173-
174134
TEST(DrmTest, GivenMockDrmWhenAskedFor48BitAddressCorrectValueReturned) {
175135
Drm2 *pDrm = new Drm2;
176136
pDrm->StoredPPGTT = 3;

0 commit comments

Comments
 (0)