mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Add getter in Drm for memoryInfo
Related-To: NEO-3014 Change-Id: I56c0e13b88d27f7c6b3816bf24342cdb04108dac Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
This commit is contained in:

committed by
sys_ocldev

parent
20985f426e
commit
115d700f49
@ -72,6 +72,10 @@ class Drm {
|
||||
bool getSimplifiedMocsTableUsage() const;
|
||||
void queryMemoryInfo();
|
||||
|
||||
MemoryInfo *getMemoryInfo() {
|
||||
return memoryInfo.get();
|
||||
}
|
||||
|
||||
protected:
|
||||
bool useSimplifiedMocsTable = false;
|
||||
bool preemptionSupported = false;
|
||||
|
@ -12,6 +12,11 @@
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
struct MemoryInfoImpl : public NEO::MemoryInfo {
|
||||
MemoryInfoImpl() {}
|
||||
~MemoryInfoImpl() override{};
|
||||
};
|
||||
|
||||
TEST(DrmTest, whenQueryingMemoryInfoThenMemoryInfoIsNotCreatedAndNoIoctlIsCalled) {
|
||||
std::unique_ptr<DrmMock> drm = std::make_unique<DrmMock>();
|
||||
EXPECT_NE(nullptr, drm);
|
||||
@ -22,11 +27,15 @@ TEST(DrmTest, whenQueryingMemoryInfoThenMemoryInfoIsNotCreatedAndNoIoctlIsCalled
|
||||
EXPECT_EQ(0u, drm->ioctlCallsCount);
|
||||
}
|
||||
|
||||
TEST(MemoryInfo, givenMemoryInfoImplementationWhenDestructingThenDestructorIsCalled) {
|
||||
struct MemoryInfoImpl : public NEO::MemoryInfo {
|
||||
MemoryInfoImpl() {}
|
||||
~MemoryInfoImpl() override{};
|
||||
};
|
||||
TEST(DrmTest, givenMemoryInfoWhenGetMemoryInfoIsCalledThenValidPtrIsReturned) {
|
||||
std::unique_ptr<DrmMock> drm = std::make_unique<DrmMock>();
|
||||
EXPECT_NE(nullptr, drm);
|
||||
|
||||
drm->memoryInfo.reset(new MemoryInfoImpl);
|
||||
|
||||
EXPECT_EQ(drm->memoryInfo.get(), drm->getMemoryInfo());
|
||||
}
|
||||
|
||||
TEST(MemoryInfo, givenMemoryInfoImplementationWhenDestructingThenDestructorIsCalled) {
|
||||
MemoryInfoImpl memoryInfoImpl;
|
||||
}
|
||||
|
@ -23,7 +23,6 @@ using namespace NEO;
|
||||
#define I915_PARAM_HAS_PREEMPTION 0x806
|
||||
#endif
|
||||
|
||||
static const int mockFd = 33;
|
||||
// Mock DRM class that responds to DRM_IOCTL_I915_GETPARAMs
|
||||
class DrmMock : public Drm {
|
||||
public:
|
||||
@ -222,6 +221,8 @@ class DrmMock : public Drm {
|
||||
void setDeviceID(int deviceId) { this->deviceId = deviceId; }
|
||||
void setDeviceRevID(int revisionId) { this->revisionId = revisionId; }
|
||||
|
||||
static const int mockFd = 33;
|
||||
|
||||
int StoredEUVal = -1;
|
||||
int StoredSSVal = -1;
|
||||
int StoredDeviceID = 1;
|
||||
|
Reference in New Issue
Block a user