blob: b72fbfadfebb76ad3cb22bfc31c6576215734012 (
plain)
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
// SPDX-License-Identifier: MIT
/*
* Copyright © 2023 Intel Corporation
*/
#include "intel_pat.h"
#include "igt.h"
struct intel_pat_cache {
uint8_t uc; /* UC + COH_NONE */
uint8_t wt; /* WT + COH_NONE */
uint8_t wb; /* WB + COH_AT_LEAST_1WAY */
uint8_t uc_comp; /* UC + COH_NONE + COMPRESSION, XE2 and later*/
uint8_t max_index;
};
static void intel_get_pat_idx(int fd, struct intel_pat_cache *pat)
{
uint16_t dev_id = intel_get_drm_devid(fd);
if (intel_get_device_info(dev_id)->graphics_ver == 20) {
pat->uc = 3;
pat->wt = 15; /* Compressed + WB-transient */
pat->wb = 2;
pat->uc_comp = 12; /* Compressed + UC, XE2 and later */
pat->max_index = 31;
/* Wa_16023588340: CLOS3 entries at end of table are unusable */
if (intel_graphics_ver(dev_id) == IP_VER(20, 1))
pat->max_index -= 4;
} else if (IS_METEORLAKE(dev_id)) {
pat->uc = 2;
pat->wt = 1;
pat->wb = 3;
pat->max_index = 3;
} else if (IS_PONTEVECCHIO(dev_id)) {
pat->uc = 0;
pat->wt = 2;
pat->wb = 3;
pat->max_index = 7;
} else if (intel_graphics_ver(dev_id) <= IP_VER(12, 60)) {
pat->uc = 3;
pat->wt = 2;
pat->wb = 0;
pat->max_index = 3;
} else {
igt_critical("Platform is missing PAT settings for uc/wt/wb\n");
}
}
uint8_t intel_get_max_pat_index(int fd)
{
struct intel_pat_cache pat = {};
intel_get_pat_idx(fd, &pat);
return pat.max_index;
}
uint8_t intel_get_pat_idx_uc(int fd)
{
struct intel_pat_cache pat = {};
intel_get_pat_idx(fd, &pat);
return pat.uc;
}
uint8_t intel_get_pat_idx_uc_comp(int fd)
{
struct intel_pat_cache pat = {};
uint16_t dev_id = intel_get_drm_devid(fd);
igt_assert(AT_LEAST_GEN(dev_id, 20));
intel_get_pat_idx(fd, &pat);
return pat.uc_comp;
}
uint8_t intel_get_pat_idx_wt(int fd)
{
struct intel_pat_cache pat = {};
intel_get_pat_idx(fd, &pat);
return pat.wt;
}
uint8_t intel_get_pat_idx_wb(int fd)
{
struct intel_pat_cache pat = {};
intel_get_pat_idx(fd, &pat);
return pat.wb;
}
|