1/*
2 * Copyright 2019 Intel Corporation
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 * DEALINGS IN THE SOFTWARE.
22 */
23
24#include "gtest/gtest.h"
25#include "isl/isl.h"
26
27void
28PrintTo(const enum isl_aux_op &op, ::std::ostream* os) {
29   *os << (const char *[]) {
30    [ISL_AUX_OP_ASSERT         ] = "ISL_AUX_OP_ASSERT",
31    [ISL_AUX_OP_NONE           ] = "ISL_AUX_OP_NONE",
32    [ISL_AUX_OP_FAST_CLEAR     ] = "ISL_AUX_OP_FAST_CLEAR",
33    [ISL_AUX_OP_FULL_RESOLVE   ] = "ISL_AUX_OP_FULL_RESOLVE",
34    [ISL_AUX_OP_PARTIAL_RESOLVE] = "ISL_AUX_OP_PARTIAL_RESOLVE",
35    [ISL_AUX_OP_AMBIGUATE      ] = "ISL_AUX_OP_AMBIGUATE",
36   }[op];
37}
38
39#define E(state, usage, fc, op) \
40   EXPECT_EQ(ISL_AUX_OP_ ## op, \
41             isl_aux_prepare_access(ISL_AUX_STATE_ ## state, \
42                                    ISL_AUX_USAGE_ ## usage, fc))
43
44TEST(PrepareAccess, CompressedFalseFastClearFalsePartialResolveFalse) {
45   E(CLEAR, NONE, false, FULL_RESOLVE);
46   E(CLEAR, NONE, true, ASSERT);
47   E(PARTIAL_CLEAR, NONE, false, FULL_RESOLVE);
48   E(PARTIAL_CLEAR, NONE, true, ASSERT);
49   E(COMPRESSED_CLEAR, NONE, false, FULL_RESOLVE);
50   E(COMPRESSED_CLEAR, NONE, true, ASSERT);
51   E(COMPRESSED_NO_CLEAR, NONE, false, FULL_RESOLVE);
52   E(COMPRESSED_NO_CLEAR, NONE, true, ASSERT);
53   E(RESOLVED, NONE, false, NONE);
54   E(RESOLVED, NONE, true, ASSERT);
55   E(PASS_THROUGH, NONE, false, NONE);
56   E(PASS_THROUGH, NONE, true, ASSERT);
57   E(AUX_INVALID, NONE, false, NONE);
58   E(AUX_INVALID, NONE, true, ASSERT);
59}
60
61TEST(PrepareAccess, CompressedFalseFastClearTruePartialResolveFalse) {
62   E(CLEAR, CCS_D, false, FULL_RESOLVE);
63   E(CLEAR, CCS_D, true, NONE);
64   E(PARTIAL_CLEAR, CCS_D, false, FULL_RESOLVE);
65   E(PARTIAL_CLEAR, CCS_D, true, NONE);
66   E(COMPRESSED_CLEAR, CCS_D, false, FULL_RESOLVE);
67   E(COMPRESSED_CLEAR, CCS_D, true, FULL_RESOLVE);
68   E(COMPRESSED_NO_CLEAR, CCS_D, false, FULL_RESOLVE);
69   E(COMPRESSED_NO_CLEAR, CCS_D, true, FULL_RESOLVE);
70   E(RESOLVED, CCS_D, false, NONE);
71   E(RESOLVED, CCS_D, true, NONE);
72   E(PASS_THROUGH, CCS_D, false, NONE);
73   E(PASS_THROUGH, CCS_D, true, NONE);
74   E(AUX_INVALID, CCS_D, false, AMBIGUATE);
75   E(AUX_INVALID, CCS_D, true, AMBIGUATE);
76}
77
78TEST(PrepareAccess, CompressedTrueFastClearFalsePartialResolveFalse) {
79   E(CLEAR, MC, false, ASSERT);
80   E(CLEAR, MC, true, ASSERT);
81   E(PARTIAL_CLEAR, MC, false, ASSERT);
82   E(PARTIAL_CLEAR, MC, true, ASSERT);
83   E(COMPRESSED_CLEAR, MC, false, ASSERT);
84   E(COMPRESSED_CLEAR, MC, true, ASSERT);
85   E(COMPRESSED_NO_CLEAR, MC, false, NONE);
86   E(COMPRESSED_NO_CLEAR, MC, true, ASSERT);
87   E(RESOLVED, MC, false, NONE);
88   E(RESOLVED, MC, true, ASSERT);
89   E(PASS_THROUGH, MC, false, NONE);
90   E(PASS_THROUGH, MC, true, ASSERT);
91   E(AUX_INVALID, MC, false, AMBIGUATE);
92   E(AUX_INVALID, MC, true, ASSERT);
93}
94
95TEST(PrepareAccess, CompressedTrueFastClearTruePartialResolveFalse) {
96   E(CLEAR, HIZ, false, FULL_RESOLVE);
97   E(CLEAR, HIZ, true, NONE);
98   E(PARTIAL_CLEAR, HIZ, false, FULL_RESOLVE);
99   E(PARTIAL_CLEAR, HIZ, true, NONE);
100   E(COMPRESSED_CLEAR, HIZ, false, FULL_RESOLVE);
101   E(COMPRESSED_CLEAR, HIZ, true, NONE);
102   E(COMPRESSED_NO_CLEAR, HIZ, false, NONE);
103   E(COMPRESSED_NO_CLEAR, HIZ, true, NONE);
104   E(RESOLVED, HIZ, false, NONE);
105   E(RESOLVED, HIZ, true, NONE);
106   E(PASS_THROUGH, HIZ, false, NONE);
107   E(PASS_THROUGH, HIZ, true, NONE);
108   E(AUX_INVALID, HIZ, false, AMBIGUATE);
109   E(AUX_INVALID, HIZ, true, AMBIGUATE);
110}
111
112TEST(PrepareAccess, CompressedTrueFastClearTruePartialResolveTrue) {
113   E(CLEAR, MCS, false, PARTIAL_RESOLVE);
114   E(CLEAR, MCS, true, NONE);
115   E(PARTIAL_CLEAR, MCS, false, PARTIAL_RESOLVE);
116   E(PARTIAL_CLEAR, MCS, true, NONE);
117   E(COMPRESSED_CLEAR, MCS, false, PARTIAL_RESOLVE);
118   E(COMPRESSED_CLEAR, MCS, true, NONE);
119   E(COMPRESSED_NO_CLEAR, MCS, false, NONE);
120   E(COMPRESSED_NO_CLEAR, MCS, true, NONE);
121   E(RESOLVED, MCS, false, NONE);
122   E(RESOLVED, MCS, true, NONE);
123   E(PASS_THROUGH, MCS, false, NONE);
124   E(PASS_THROUGH, MCS, true, NONE);
125   E(AUX_INVALID, MCS, false, AMBIGUATE);
126   E(AUX_INVALID, MCS, true, AMBIGUATE);
127}
128
129void
130PrintTo(const enum isl_aux_state &state, ::std::ostream* os) {
131   *os << (const char *[]) {
132    [ISL_AUX_STATE_ASSERT             ] = "ISL_AUX_STATE_ASSERT",
133    [ISL_AUX_STATE_CLEAR              ] = "ISL_AUX_STATE_CLEAR",
134    [ISL_AUX_STATE_PARTIAL_CLEAR      ] = "ISL_AUX_STATE_PARTIAL_CLEAR",
135    [ISL_AUX_STATE_COMPRESSED_CLEAR   ] = "ISL_AUX_STATE_COMPRESSED_CLEAR",
136    [ISL_AUX_STATE_COMPRESSED_NO_CLEAR] = "ISL_AUX_STATE_COMPRESSED_NO_CLEAR",
137    [ISL_AUX_STATE_RESOLVED           ] = "ISL_AUX_STATE_RESOLVED",
138    [ISL_AUX_STATE_PASS_THROUGH       ] = "ISL_AUX_STATE_PASS_THROUGH",
139    [ISL_AUX_STATE_AUX_INVALID        ] = "ISL_AUX_STATE_AUX_INVALID"
140   }[state];
141}
142
143#undef E
144#define E(state1, usage, op, state2) \
145   EXPECT_EQ(ISL_AUX_STATE_ ## state2, \
146             isl_aux_state_transition_aux_op(ISL_AUX_STATE_ ## state1, \
147                                             ISL_AUX_USAGE_ ## usage, \
148                                             ISL_AUX_OP_ ## op))
149
150/* The usages used in each test of this suite represent all combinations of
151 * ::fast_clear and ::full_resolves_ambiguate.
152 */
153TEST(StateTransitionAuxOp, None) {
154   E(CLEAR, NONE, NONE, ASSERT);
155   E(PARTIAL_CLEAR, NONE, NONE, ASSERT);
156   E(COMPRESSED_CLEAR, NONE, NONE, ASSERT);
157   E(COMPRESSED_NO_CLEAR, NONE, NONE, ASSERT);
158   E(RESOLVED, NONE, NONE, RESOLVED);
159   E(PASS_THROUGH, NONE, NONE, PASS_THROUGH);
160   E(AUX_INVALID, NONE, NONE, AUX_INVALID);
161
162   E(CLEAR, MC, NONE, ASSERT);
163   E(PARTIAL_CLEAR, MC, NONE, ASSERT);
164   E(COMPRESSED_CLEAR, MC, NONE, ASSERT);
165   E(COMPRESSED_NO_CLEAR, MC, NONE, COMPRESSED_NO_CLEAR);
166   E(RESOLVED, MC, NONE, RESOLVED);
167   E(PASS_THROUGH, MC, NONE, PASS_THROUGH);
168   E(AUX_INVALID, MC, NONE, AUX_INVALID);
169
170   E(CLEAR, HIZ, NONE, CLEAR);
171   E(PARTIAL_CLEAR, HIZ, NONE, PARTIAL_CLEAR);
172   E(COMPRESSED_CLEAR, HIZ, NONE, COMPRESSED_CLEAR);
173   E(COMPRESSED_NO_CLEAR, HIZ, NONE, COMPRESSED_NO_CLEAR);
174   E(RESOLVED, HIZ, NONE, RESOLVED);
175   E(PASS_THROUGH, HIZ, NONE, PASS_THROUGH);
176   E(AUX_INVALID, HIZ, NONE, AUX_INVALID);
177
178   E(CLEAR, CCS_E, NONE, CLEAR);
179   E(PARTIAL_CLEAR, CCS_E, NONE, PARTIAL_CLEAR);
180   E(COMPRESSED_CLEAR, CCS_E, NONE, COMPRESSED_CLEAR);
181   E(COMPRESSED_NO_CLEAR, CCS_E, NONE, COMPRESSED_NO_CLEAR);
182   E(RESOLVED, CCS_E, NONE, RESOLVED);
183   E(PASS_THROUGH, CCS_E, NONE, PASS_THROUGH);
184   E(AUX_INVALID, CCS_E, NONE, AUX_INVALID);
185}
186
187TEST(StateTransitionAuxOp, FastClear) {
188   E(CLEAR, NONE, FAST_CLEAR, ASSERT);
189   E(PARTIAL_CLEAR, NONE, FAST_CLEAR, ASSERT);
190   E(COMPRESSED_CLEAR, NONE, FAST_CLEAR, ASSERT);
191   E(COMPRESSED_NO_CLEAR, NONE, FAST_CLEAR, ASSERT);
192   E(RESOLVED, NONE, FAST_CLEAR, ASSERT);
193   E(PASS_THROUGH, NONE, FAST_CLEAR, ASSERT);
194   E(AUX_INVALID, NONE, FAST_CLEAR, ASSERT);
195
196   E(CLEAR, MC, FAST_CLEAR, ASSERT);
197   E(PARTIAL_CLEAR, MC, FAST_CLEAR, ASSERT);
198   E(COMPRESSED_CLEAR, MC, FAST_CLEAR, ASSERT);
199   E(COMPRESSED_NO_CLEAR, MC, FAST_CLEAR, ASSERT);
200   E(RESOLVED, MC, FAST_CLEAR, ASSERT);
201   E(PASS_THROUGH, MC, FAST_CLEAR, ASSERT);
202   E(AUX_INVALID, MC, FAST_CLEAR, ASSERT);
203
204   E(CLEAR, HIZ, FAST_CLEAR, CLEAR);
205   E(PARTIAL_CLEAR, HIZ, FAST_CLEAR, CLEAR);
206   E(COMPRESSED_CLEAR, HIZ, FAST_CLEAR, CLEAR);
207   E(COMPRESSED_NO_CLEAR, HIZ, FAST_CLEAR, CLEAR);
208   E(RESOLVED, HIZ, FAST_CLEAR, CLEAR);
209   E(PASS_THROUGH, HIZ, FAST_CLEAR, CLEAR);
210   E(AUX_INVALID, HIZ, FAST_CLEAR, CLEAR);
211
212   E(CLEAR, CCS_E, FAST_CLEAR, CLEAR);
213   E(PARTIAL_CLEAR, CCS_E, FAST_CLEAR, CLEAR);
214   E(COMPRESSED_CLEAR, CCS_E, FAST_CLEAR, CLEAR);
215   E(COMPRESSED_NO_CLEAR, CCS_E, FAST_CLEAR, CLEAR);
216   E(RESOLVED, CCS_E, FAST_CLEAR, CLEAR);
217   E(PASS_THROUGH, CCS_E, FAST_CLEAR, CLEAR);
218   E(AUX_INVALID, CCS_E, FAST_CLEAR, CLEAR);
219}
220
221TEST(StateTransitionAuxOp, PartialResolve) {
222   E(CLEAR, NONE, PARTIAL_RESOLVE, ASSERT);
223   E(PARTIAL_CLEAR, NONE, PARTIAL_RESOLVE, ASSERT);
224   E(COMPRESSED_CLEAR, NONE, PARTIAL_RESOLVE, ASSERT);
225   E(COMPRESSED_NO_CLEAR, NONE, PARTIAL_RESOLVE, ASSERT);
226   E(RESOLVED, NONE, PARTIAL_RESOLVE, ASSERT);
227   E(PASS_THROUGH, NONE, PARTIAL_RESOLVE, ASSERT);
228   E(AUX_INVALID, NONE, PARTIAL_RESOLVE, ASSERT);
229
230   E(CLEAR, MC, PARTIAL_RESOLVE, ASSERT);
231   E(PARTIAL_CLEAR, MC, PARTIAL_RESOLVE, ASSERT);
232   E(COMPRESSED_CLEAR, MC, PARTIAL_RESOLVE, ASSERT);
233   E(COMPRESSED_NO_CLEAR, MC, PARTIAL_RESOLVE, ASSERT);
234   E(RESOLVED, MC, PARTIAL_RESOLVE, ASSERT);
235   E(PASS_THROUGH, MC, PARTIAL_RESOLVE, ASSERT);
236   E(AUX_INVALID, MC, PARTIAL_RESOLVE, ASSERT);
237
238   E(CLEAR, HIZ, PARTIAL_RESOLVE, ASSERT);
239   E(PARTIAL_CLEAR, HIZ, PARTIAL_RESOLVE, ASSERT);
240   E(COMPRESSED_CLEAR, HIZ, PARTIAL_RESOLVE, ASSERT);
241   E(COMPRESSED_NO_CLEAR, HIZ, PARTIAL_RESOLVE, ASSERT);
242   E(RESOLVED, HIZ, PARTIAL_RESOLVE, ASSERT);
243   E(PASS_THROUGH, HIZ, PARTIAL_RESOLVE, ASSERT);
244   E(AUX_INVALID, HIZ, PARTIAL_RESOLVE, ASSERT);
245
246   E(CLEAR, CCS_E, PARTIAL_RESOLVE, COMPRESSED_NO_CLEAR);
247   E(PARTIAL_CLEAR, CCS_E, PARTIAL_RESOLVE, COMPRESSED_NO_CLEAR);
248   E(COMPRESSED_CLEAR, CCS_E, PARTIAL_RESOLVE, COMPRESSED_NO_CLEAR);
249   E(COMPRESSED_NO_CLEAR, CCS_E, PARTIAL_RESOLVE, COMPRESSED_NO_CLEAR);
250   E(RESOLVED, CCS_E, PARTIAL_RESOLVE, RESOLVED);
251   E(PASS_THROUGH, CCS_E, PARTIAL_RESOLVE, PASS_THROUGH);
252   E(AUX_INVALID, CCS_E, PARTIAL_RESOLVE, ASSERT);
253}
254
255TEST(StateTransitionAuxOp, FullResolve) {
256   E(CLEAR, NONE, FULL_RESOLVE, ASSERT);
257   E(PARTIAL_CLEAR, NONE, FULL_RESOLVE, ASSERT);
258   E(COMPRESSED_CLEAR, NONE, FULL_RESOLVE, ASSERT);
259   E(COMPRESSED_NO_CLEAR, NONE, FULL_RESOLVE, ASSERT);
260   E(RESOLVED, NONE, FULL_RESOLVE, ASSERT);
261   E(PASS_THROUGH, NONE, FULL_RESOLVE, ASSERT);
262   E(AUX_INVALID, NONE, FULL_RESOLVE, ASSERT);
263
264   E(CLEAR, MC, FULL_RESOLVE, ASSERT);
265   E(PARTIAL_CLEAR, MC, FULL_RESOLVE, ASSERT);
266   E(COMPRESSED_CLEAR, MC, FULL_RESOLVE, ASSERT);
267   E(COMPRESSED_NO_CLEAR, MC, FULL_RESOLVE, PASS_THROUGH);
268   E(RESOLVED, MC, FULL_RESOLVE, PASS_THROUGH);
269   E(PASS_THROUGH, MC, FULL_RESOLVE, PASS_THROUGH);
270   E(AUX_INVALID, MC, FULL_RESOLVE, ASSERT);
271
272   E(CLEAR, HIZ, FULL_RESOLVE, RESOLVED);
273   E(PARTIAL_CLEAR, HIZ, FULL_RESOLVE, RESOLVED);
274   E(COMPRESSED_CLEAR, HIZ, FULL_RESOLVE, RESOLVED);
275   E(COMPRESSED_NO_CLEAR, HIZ, FULL_RESOLVE, RESOLVED);
276   E(RESOLVED, HIZ, FULL_RESOLVE, RESOLVED);
277   E(PASS_THROUGH, HIZ, FULL_RESOLVE, PASS_THROUGH);
278   E(AUX_INVALID, HIZ, FULL_RESOLVE, ASSERT);
279
280   E(CLEAR, CCS_E, FULL_RESOLVE, PASS_THROUGH);
281   E(PARTIAL_CLEAR, CCS_E, FULL_RESOLVE, PASS_THROUGH);
282   E(COMPRESSED_CLEAR, CCS_E, FULL_RESOLVE, PASS_THROUGH);
283   E(COMPRESSED_NO_CLEAR, CCS_E, FULL_RESOLVE, PASS_THROUGH);
284   E(RESOLVED, CCS_E, FULL_RESOLVE, PASS_THROUGH);
285   E(PASS_THROUGH, CCS_E, FULL_RESOLVE, PASS_THROUGH);
286   E(AUX_INVALID, CCS_E, FULL_RESOLVE, ASSERT);
287}
288
289TEST(StateTransitionAuxOp, Ambiguate) {
290   E(CLEAR, NONE, AMBIGUATE, ASSERT);
291   E(PARTIAL_CLEAR, NONE, AMBIGUATE, ASSERT);
292   E(COMPRESSED_CLEAR, NONE, AMBIGUATE, ASSERT);
293   E(COMPRESSED_NO_CLEAR, NONE, AMBIGUATE, ASSERT);
294   E(RESOLVED, NONE, AMBIGUATE, ASSERT);
295   E(PASS_THROUGH, NONE, AMBIGUATE, ASSERT);
296   E(AUX_INVALID, NONE, AMBIGUATE, ASSERT);
297
298   E(CLEAR, MC, AMBIGUATE, ASSERT);
299   E(PARTIAL_CLEAR, MC, AMBIGUATE, ASSERT);
300   E(COMPRESSED_CLEAR, MC, AMBIGUATE, ASSERT);
301   E(COMPRESSED_NO_CLEAR, MC, AMBIGUATE, PASS_THROUGH);
302   E(RESOLVED, MC, AMBIGUATE, PASS_THROUGH);
303   E(PASS_THROUGH, MC, AMBIGUATE, PASS_THROUGH);
304   E(AUX_INVALID, MC, AMBIGUATE, PASS_THROUGH);
305
306   E(CLEAR, HIZ, AMBIGUATE, PASS_THROUGH);
307   E(PARTIAL_CLEAR, HIZ, AMBIGUATE, PASS_THROUGH);
308   E(COMPRESSED_CLEAR, HIZ, AMBIGUATE, PASS_THROUGH);
309   E(COMPRESSED_NO_CLEAR, HIZ, AMBIGUATE, PASS_THROUGH);
310   E(RESOLVED, HIZ, AMBIGUATE, PASS_THROUGH);
311   E(PASS_THROUGH, HIZ, AMBIGUATE, PASS_THROUGH);
312   E(AUX_INVALID, HIZ, AMBIGUATE, PASS_THROUGH);
313
314   E(CLEAR, CCS_E, AMBIGUATE, PASS_THROUGH);
315   E(PARTIAL_CLEAR, CCS_E, AMBIGUATE, PASS_THROUGH);
316   E(COMPRESSED_CLEAR, CCS_E, AMBIGUATE, PASS_THROUGH);
317   E(COMPRESSED_NO_CLEAR, CCS_E, AMBIGUATE, PASS_THROUGH);
318   E(RESOLVED, CCS_E, AMBIGUATE, PASS_THROUGH);
319   E(PASS_THROUGH, CCS_E, AMBIGUATE, PASS_THROUGH);
320   E(AUX_INVALID, CCS_E, AMBIGUATE, PASS_THROUGH);
321}
322
323#undef E
324#define E(state1, usage, full_surface, state2) \
325   EXPECT_EQ(ISL_AUX_STATE_ ## state2, \
326             isl_aux_state_transition_write(ISL_AUX_STATE_ ## state1, \
327                                            ISL_AUX_USAGE_ ## usage, \
328                                            full_surface))
329
330TEST(StateTransitionWrite, WritesOnlyTouchMain) {
331   E(CLEAR, NONE, false, ASSERT);
332   E(CLEAR, NONE, true, AUX_INVALID);
333   E(PARTIAL_CLEAR, NONE, false, ASSERT);
334   E(PARTIAL_CLEAR, NONE, true, AUX_INVALID);
335   E(COMPRESSED_CLEAR, NONE, false, ASSERT);
336   E(COMPRESSED_CLEAR, NONE, true, AUX_INVALID);
337   E(COMPRESSED_NO_CLEAR, NONE, false, ASSERT);
338   E(COMPRESSED_NO_CLEAR, NONE, true, AUX_INVALID);
339   E(RESOLVED, NONE, false, AUX_INVALID);
340   E(RESOLVED, NONE, true, AUX_INVALID);
341   E(PASS_THROUGH, NONE, false, PASS_THROUGH);
342   E(PASS_THROUGH, NONE, true, PASS_THROUGH);
343   E(AUX_INVALID, NONE, false, AUX_INVALID);
344   E(AUX_INVALID, NONE, true, AUX_INVALID);
345}
346
347TEST(StateTransitionWrite, WritesCompress) {
348   E(CLEAR, MCS, false, COMPRESSED_CLEAR);
349   E(CLEAR, MCS, true, COMPRESSED_NO_CLEAR);
350   E(PARTIAL_CLEAR, MCS, false, COMPRESSED_CLEAR);
351   E(PARTIAL_CLEAR, MCS, true, COMPRESSED_NO_CLEAR);
352   E(COMPRESSED_CLEAR, MCS, false, COMPRESSED_CLEAR);
353   E(COMPRESSED_CLEAR, MCS, true, COMPRESSED_NO_CLEAR);
354   E(COMPRESSED_NO_CLEAR, MCS, false, COMPRESSED_NO_CLEAR);
355   E(COMPRESSED_NO_CLEAR, MCS, true, COMPRESSED_NO_CLEAR);
356   E(RESOLVED, MCS, false, COMPRESSED_NO_CLEAR);
357   E(RESOLVED, MCS, true, COMPRESSED_NO_CLEAR);
358   E(PASS_THROUGH, MCS, false, COMPRESSED_NO_CLEAR);
359   E(PASS_THROUGH, MCS, true, COMPRESSED_NO_CLEAR);
360   E(AUX_INVALID, MCS, false, ASSERT);
361   E(AUX_INVALID, MCS, true, ASSERT);
362
363   E(CLEAR, STC_CCS, false, ASSERT);
364   E(CLEAR, STC_CCS, true, ASSERT);
365   E(PARTIAL_CLEAR, STC_CCS, false, ASSERT);
366   E(PARTIAL_CLEAR, STC_CCS, true, ASSERT);
367   E(COMPRESSED_CLEAR, STC_CCS, false, ASSERT);
368   E(COMPRESSED_CLEAR, STC_CCS, true, ASSERT);
369   E(COMPRESSED_NO_CLEAR, STC_CCS, false, COMPRESSED_NO_CLEAR);
370   E(COMPRESSED_NO_CLEAR, STC_CCS, true, COMPRESSED_NO_CLEAR);
371   E(RESOLVED, STC_CCS, false, COMPRESSED_NO_CLEAR);
372   E(RESOLVED, STC_CCS, true, COMPRESSED_NO_CLEAR);
373   E(PASS_THROUGH, STC_CCS, false, COMPRESSED_NO_CLEAR);
374   E(PASS_THROUGH, STC_CCS, true, COMPRESSED_NO_CLEAR);
375   E(AUX_INVALID, STC_CCS, false, ASSERT);
376   E(AUX_INVALID, STC_CCS, true, ASSERT);
377}
378
379TEST(StateTransitionWrite, WritesCompressClear) {
380   E(CLEAR, GFX12_CCS_E, false, COMPRESSED_CLEAR);
381   E(CLEAR, GFX12_CCS_E, true, COMPRESSED_CLEAR);
382   E(PARTIAL_CLEAR, GFX12_CCS_E, false, COMPRESSED_CLEAR);
383   E(PARTIAL_CLEAR, GFX12_CCS_E, true, COMPRESSED_CLEAR);
384   E(COMPRESSED_CLEAR, GFX12_CCS_E, false, COMPRESSED_CLEAR);
385   E(COMPRESSED_CLEAR, GFX12_CCS_E, true, COMPRESSED_CLEAR);
386   E(COMPRESSED_NO_CLEAR, GFX12_CCS_E, false, COMPRESSED_CLEAR);
387   E(COMPRESSED_NO_CLEAR, GFX12_CCS_E, true, COMPRESSED_CLEAR);
388   E(RESOLVED, GFX12_CCS_E, false, COMPRESSED_CLEAR);
389   E(RESOLVED, GFX12_CCS_E, true, COMPRESSED_CLEAR);
390   E(PASS_THROUGH, GFX12_CCS_E, false, COMPRESSED_CLEAR);
391   E(PASS_THROUGH, GFX12_CCS_E, true, COMPRESSED_CLEAR);
392   E(AUX_INVALID, GFX12_CCS_E, false, ASSERT);
393   E(AUX_INVALID, GFX12_CCS_E, true, ASSERT);
394}
395
396TEST(StateTransitionWrite, WritesResolveAmbiguate) {
397   E(CLEAR, CCS_D, false, PARTIAL_CLEAR);
398   E(CLEAR, CCS_D, true, PASS_THROUGH);
399   E(PARTIAL_CLEAR, CCS_D, false, PARTIAL_CLEAR);
400   E(PARTIAL_CLEAR, CCS_D, true, PASS_THROUGH);
401   E(COMPRESSED_CLEAR, CCS_D, false, ASSERT);
402   E(COMPRESSED_CLEAR, CCS_D, true, ASSERT);
403   E(COMPRESSED_NO_CLEAR, CCS_D, false, ASSERT);
404   E(COMPRESSED_NO_CLEAR, CCS_D, true, ASSERT);
405   E(RESOLVED, CCS_D, false, RESOLVED);
406   E(RESOLVED, CCS_D, true, PASS_THROUGH);
407   E(PASS_THROUGH, CCS_D, false, PASS_THROUGH);
408   E(PASS_THROUGH, CCS_D, true, PASS_THROUGH);
409   E(AUX_INVALID, CCS_D, false, ASSERT);
410   E(AUX_INVALID, CCS_D, true, ASSERT);
411
412   E(CLEAR, MC, false, ASSERT);
413   E(CLEAR, MC, true, ASSERT);
414   E(PARTIAL_CLEAR, MC, false, ASSERT);
415   E(PARTIAL_CLEAR, MC, true, ASSERT);
416   E(COMPRESSED_CLEAR, MC, false, ASSERT);
417   E(COMPRESSED_CLEAR, MC, true, ASSERT);
418   E(COMPRESSED_NO_CLEAR, MC, false, COMPRESSED_NO_CLEAR);
419   E(COMPRESSED_NO_CLEAR, MC, true, PASS_THROUGH);
420   E(RESOLVED, MC, false, RESOLVED);
421   E(RESOLVED, MC, true, PASS_THROUGH);
422   E(PASS_THROUGH, MC, false, PASS_THROUGH);
423   E(PASS_THROUGH, MC, true, PASS_THROUGH);
424   E(AUX_INVALID, MC, false, ASSERT);
425   E(AUX_INVALID, MC, true, ASSERT);
426}
427
428#undef E
429