File: mock_drm_wrappers.cpp

package info (click to toggle)
intel-compute-runtime 25.44.36015.8-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 79,632 kB
  • sloc: cpp: 931,547; lisp: 2,074; sh: 719; makefile: 162; python: 21
file content (73 lines) | stat: -rw-r--r-- 2,908 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/*
 * Copyright (C) 2022 Intel Corporation
 *
 * SPDX-License-Identifier: MIT
 *
 */

#include "shared/test/common/mocks/linux/mock_drm_wrappers.h"

#include "shared/source/helpers/bit_helpers.h"
#include "shared/source/os_interface/linux/i915.h"

namespace NEO {

uint32_t MockExecObject::getHandle() const {
    auto &drmExecObject = *reinterpret_cast<const drm_i915_gem_exec_object2 *>(this->data);
    return drmExecObject.handle;
}
uint64_t MockExecObject::getOffset() const {
    auto &drmExecObject = *reinterpret_cast<const drm_i915_gem_exec_object2 *>(this->data);
    return drmExecObject.offset;
}
uint64_t MockExecObject::getReserved() const {
    auto &drmExecObject = *reinterpret_cast<const drm_i915_gem_exec_object2 *>(this->data);
    return drmExecObject.rsvd1;
}
bool MockExecObject::has48BAddressSupportFlag() const {
    auto &drmExecObject = *reinterpret_cast<const drm_i915_gem_exec_object2 *>(this->data);
    return isValueSet(drmExecObject.flags, EXEC_OBJECT_SUPPORTS_48B_ADDRESS);
}
bool MockExecObject::hasCaptureFlag() const {
    auto &drmExecObject = *reinterpret_cast<const drm_i915_gem_exec_object2 *>(this->data);
    return isValueSet(drmExecObject.flags, EXEC_OBJECT_CAPTURE);
}
bool MockExecObject::hasAsyncFlag() const {
    auto &drmExecObject = *reinterpret_cast<const drm_i915_gem_exec_object2 *>(this->data);
    return isValueSet(drmExecObject.flags, EXEC_OBJECT_ASYNC);
}

uint64_t MockExecBuffer::getBuffersPtr() const {
    auto &drmExecBuffer = *reinterpret_cast<const drm_i915_gem_execbuffer2 *>(this->data);
    return drmExecBuffer.buffers_ptr;
}
uint32_t MockExecBuffer::getBufferCount() const {
    auto &drmExecBuffer = *reinterpret_cast<const drm_i915_gem_execbuffer2 *>(this->data);
    return drmExecBuffer.buffer_count;
}
uint32_t MockExecBuffer::getBatchLen() const {
    auto &drmExecBuffer = *reinterpret_cast<const drm_i915_gem_execbuffer2 *>(this->data);
    return drmExecBuffer.batch_len;
}
uint32_t MockExecBuffer::getBatchStartOffset() const {
    auto &drmExecBuffer = *reinterpret_cast<const drm_i915_gem_execbuffer2 *>(this->data);
    return drmExecBuffer.batch_start_offset;
}
uint64_t MockExecBuffer::getFlags() const {
    auto &drmExecBuffer = *reinterpret_cast<const drm_i915_gem_execbuffer2 *>(this->data);
    return drmExecBuffer.flags;
}
uint64_t MockExecBuffer::getCliprectsPtr() const {
    auto &drmExecBuffer = *reinterpret_cast<const drm_i915_gem_execbuffer2 *>(this->data);
    return drmExecBuffer.cliprects_ptr;
}
uint64_t MockExecBuffer::getReserved() const {
    auto &drmExecBuffer = *reinterpret_cast<const drm_i915_gem_execbuffer2 *>(this->data);
    return drmExecBuffer.rsvd1;
}
bool MockExecBuffer::hasUseExtensionsFlag() const {
    auto &drmExecBuffer = *reinterpret_cast<const drm_i915_gem_execbuffer2 *>(this->data);
    return isValueSet(drmExecBuffer.flags, I915_EXEC_USE_EXTENSIONS);
}

} // namespace NEO