Skip to content

Commit db94f4b

Browse files
Clear Drm profiling variables and macros
Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
1 parent 2be98a1 commit db94f4b

File tree

4 files changed

+18
-24
lines changed

4 files changed

+18
-24
lines changed

opencl/test/unit_test/linux/drm_null_device_tests.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
/*
2-
* Copyright (C) 2018-2021 Intel Corporation
2+
* Copyright (C) 2018-2022 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
66
*/
77

88
#include "shared/source/execution_environment/execution_environment.h"
9+
#include "shared/source/helpers/register_offsets.h"
910
#include "shared/source/os_interface/linux/drm_null_device.h"
1011
#include "shared/test/common/helpers/debug_manager_state_restore.h"
1112
#include "shared/test/common/test_macros/test.h"
@@ -67,17 +68,17 @@ TEST_F(DrmNullDeviceTests, GIVENdrmNullDeviceWHENregReadOtherThenTimestampReadTH
6768
TEST_F(DrmNullDeviceTests, GIVENdrmNullDeviceWHENgetGpuTimestamp32bOr64bTHENerror) {
6869
struct drm_i915_reg_read arg;
6970

70-
arg.offset = TIMESTAMP_LOW_REG;
71+
arg.offset = REG_GLOBAL_TIMESTAMP_LDW;
7172
ASSERT_EQ(drmNullDevice->ioctl(DRM_IOCTL_I915_REG_READ, &arg), -1);
7273

73-
arg.offset = TIMESTAMP_HIGH_REG;
74+
arg.offset = REG_GLOBAL_TIMESTAMP_UN;
7475
ASSERT_EQ(drmNullDevice->ioctl(DRM_IOCTL_I915_REG_READ, &arg), -1);
7576
}
7677

7778
TEST_F(DrmNullDeviceTests, GIVENdrmNullDeviceWHENgetGpuTimestamp36bTHENproperValues) {
7879
struct drm_i915_reg_read arg;
7980

80-
arg.offset = TIMESTAMP_LOW_REG | 1;
81+
arg.offset = REG_GLOBAL_TIMESTAMP_LDW | 1;
8182
ASSERT_EQ(drmNullDevice->ioctl(DRM_IOCTL_I915_REG_READ, &arg), 0);
8283
EXPECT_EQ(arg.val, 1000ULL);
8384

shared/source/os_interface/linux/device_time_drm.cpp

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
/*
2-
* Copyright (C) 2018-2021 Intel Corporation
2+
* Copyright (C) 2018-2022 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
66
*/
77

88
#include "shared/source/os_interface/linux/device_time_drm.h"
99

10+
#include "shared/source/helpers/register_offsets.h"
1011
#include "shared/source/os_interface/linux/drm_neo.h"
1112
#include "shared/source/os_interface/os_interface.h"
1213

@@ -30,28 +31,25 @@ void DeviceTimeDrm::timestampTypeDetect() {
3031
if (pDrm == nullptr)
3132
return;
3233

33-
reg.offset = (TIMESTAMP_LOW_REG | 1);
34+
reg.offset = (REG_GLOBAL_TIMESTAMP_LDW | 1);
3435
err = pDrm->ioctl(DRM_IOCTL_I915_REG_READ, &reg);
3536
if (err) {
36-
reg.offset = TIMESTAMP_HIGH_REG;
37+
reg.offset = REG_GLOBAL_TIMESTAMP_UN;
3738
err = pDrm->ioctl(DRM_IOCTL_I915_REG_READ, &reg);
3839
if (err) {
3940
getGpuTime = &DeviceTimeDrm::getGpuTime32;
40-
timestampSizeInBits = OCLRT_NUM_TIMESTAMP_BITS_FALLBACK;
4141
} else {
4242
getGpuTime = &DeviceTimeDrm::getGpuTimeSplitted;
43-
timestampSizeInBits = OCLRT_NUM_TIMESTAMP_BITS;
4443
}
4544
} else {
4645
getGpuTime = &DeviceTimeDrm::getGpuTime36;
47-
timestampSizeInBits = OCLRT_NUM_TIMESTAMP_BITS;
4846
}
4947
}
5048

5149
bool DeviceTimeDrm::getGpuTime32(uint64_t *timestamp) {
5250
struct drm_i915_reg_read reg = {};
5351

54-
reg.offset = TIMESTAMP_LOW_REG;
52+
reg.offset = REG_GLOBAL_TIMESTAMP_LDW;
5553

5654
if (pDrm->ioctl(DRM_IOCTL_I915_REG_READ, &reg)) {
5755
return false;
@@ -63,7 +61,7 @@ bool DeviceTimeDrm::getGpuTime32(uint64_t *timestamp) {
6361
bool DeviceTimeDrm::getGpuTime36(uint64_t *timestamp) {
6462
struct drm_i915_reg_read reg = {};
6563

66-
reg.offset = TIMESTAMP_LOW_REG | 1;
64+
reg.offset = REG_GLOBAL_TIMESTAMP_LDW | 1;
6765

6866
if (pDrm->ioctl(DRM_IOCTL_I915_REG_READ, &reg)) {
6967
return false;
@@ -78,8 +76,8 @@ bool DeviceTimeDrm::getGpuTimeSplitted(uint64_t *timestamp) {
7876
uint64_t tmp_hi;
7977
int err = 0, loop = 3;
8078

81-
reg_hi.offset = TIMESTAMP_HIGH_REG;
82-
reg_lo.offset = TIMESTAMP_LOW_REG;
79+
reg_hi.offset = REG_GLOBAL_TIMESTAMP_UN;
80+
reg_lo.offset = REG_GLOBAL_TIMESTAMP_LDW;
8381

8482
err += pDrm->ioctl(DRM_IOCTL_I915_REG_READ, &reg_hi);
8583
do {

shared/source/os_interface/linux/device_time_drm.h

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2018-2021 Intel Corporation
2+
* Copyright (C) 2018-2022 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
@@ -9,11 +9,6 @@
99
#include "shared/source/os_interface/linux/drm_neo.h"
1010
#include "shared/source/os_interface/os_time.h"
1111

12-
#define OCLRT_NUM_TIMESTAMP_BITS (36)
13-
#define OCLRT_NUM_TIMESTAMP_BITS_FALLBACK (32)
14-
#define TIMESTAMP_HIGH_REG 0x0235C
15-
#define TIMESTAMP_LOW_REG 0x02358
16-
1712
namespace NEO {
1813

1914
class DeviceTimeDrm : public DeviceTime {
@@ -31,7 +26,6 @@ class DeviceTimeDrm : public DeviceTime {
3126

3227
protected:
3328
Drm *pDrm = nullptr;
34-
unsigned timestampSizeInBits;
3529
};
3630

3731
} // namespace NEO

shared/source/os_interface/linux/drm_null_device.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
/*
2-
* Copyright (C) 2020-2021 Intel Corporation
2+
* Copyright (C) 2020-2022 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
66
*/
77

88
#pragma once
9+
#include "shared/source/helpers/register_offsets.h"
910
#include "shared/source/os_interface/linux/device_time_drm.h"
1011
#include "shared/source/os_interface/linux/drm_neo.h"
1112

@@ -25,10 +26,10 @@ class DrmNullDevice : public Drm {
2526
struct drm_i915_reg_read *regArg = static_cast<struct drm_i915_reg_read *>(arg);
2627

2728
// Handle only 36b timestamp
28-
if (regArg->offset == (TIMESTAMP_LOW_REG | 1)) {
29+
if (regArg->offset == (REG_GLOBAL_TIMESTAMP_LDW | 1)) {
2930
gpuTimestamp += 1000;
3031
regArg->val = gpuTimestamp & 0x0000000FFFFFFFFF;
31-
} else if (regArg->offset == TIMESTAMP_LOW_REG || regArg->offset == TIMESTAMP_HIGH_REG) {
32+
} else if (regArg->offset == REG_GLOBAL_TIMESTAMP_LDW || regArg->offset == REG_GLOBAL_TIMESTAMP_UN) {
3233
return -1;
3334
}
3435

0 commit comments

Comments
 (0)