| 1 |
/* |
| 2 |
* Copyright (C) 2019 Collabora, Ltd. |
| 3 |
* SPDX-License-Identifier: MIT |
| 4 |
*/ |
| 5 |
|
| 6 |
#ifndef __MDG_QUIRKS_H |
| 7 |
#define __MDG_QUIRKS_H |
| 8 |
|
| 9 |
#include "panfrost/model/pan_model.h" |
| 10 |
|
| 11 |
/* Model-specific quirks requiring compiler workarounds/etc. Quirks |
| 12 |
* may be errata requiring a workaround, or features. We're trying to be |
| 13 |
* quirk-positive here; quirky is the best! */ |
| 14 |
|
| 15 |
/* Typed loads are broken on this Midgard GPU due to issue #10607 and #10632 and |
| 16 |
* should use software unpacks instead. |
| 17 |
*/ |
| 18 |
#define MIDGARD_BROKEN_BLEND_LOADS (1 << 0) |
| 19 |
|
| 20 |
/* Whether output texture registers (normally r28/r29) overlap with work |
| 21 |
* registers r0/r1 and input texture registers (also normally r28/r29) overlap |
| 22 |
* with load/store registers r26/r27. This constrains register allocation |
| 23 |
* considerably but is a space-saving measure on small Midgards. It's worth |
| 24 |
* noting if you try to access r28/r29, it may still work, but you'll mess up |
| 25 |
* the interference. Corresponds to BASE_HW_FEATURE_INTERPIPE_REG_ALIASING in |
| 26 |
* kbase. */ |
| 27 |
|
| 28 |
#define MIDGARD_INTERPIPE_REG_ALIASING (1 << 1) |
| 29 |
|
| 30 |
/* Whether we should use old-style blend opcodes */ |
| 31 |
|
| 32 |
#define MIDGARD_OLD_BLEND (1 << 2) |
| 33 |
|
| 34 |
/* Errata causing the LOD clamps and bias in the sampler descriptor to be |
| 35 |
* ignored. This errata affects the command stream but uses a compiler |
| 36 |
* workaround (applying the clamps/bias manually in the shader. Corresponds in |
| 37 |
* BASE_HW_ISSUE_10471 in kbase, described as "TEXGRD doesn't honor Sampler |
| 38 |
* Descriptor LOD clamps nor bias". (I'm assuming TEXGRD is what we call |
| 39 |
* textureLod) */ |
| 40 |
|
| 41 |
#define MIDGARD_BROKEN_LOD (1 << 3) |
| 42 |
|
| 43 |
/* Don't use upper ALU tags for writeout (if you do, you'll get a |
| 44 |
* INSTR_INVALID_ENC). It's not clear to me what these tags are for. */ |
| 45 |
|
| 46 |
#define MIDGARD_NO_UPPER_ALU (1 << 4) |
| 47 |
|
| 48 |
/* Whether (texture) out-of-order execution support is missing on early |
| 49 |
* Midgards. For these just set the OoO bits to 0. */ |
| 50 |
|
| 51 |
#define MIDGARD_NO_OOO (1 << 5) |
| 52 |
|
| 53 |
/* Disable auto32 type (apparently broken on T60x). */ |
| 54 |
|
| 55 |
#define MIDGARD_NO_AUTO32 (1 << 6) |
| 56 |
|
| 57 |
static inline unsigned |
| 58 |
midgard_get_quirks(uint64_t gpu_id) |
| 59 |
{ |
| 60 |
switch (pan_prod_id(gpu_id)) { |
| 61 |
case 0x600: |
| 62 |
return MIDGARD_OLD_BLEND | MIDGARD_BROKEN_BLEND_LOADS | |
| 63 |
MIDGARD_BROKEN_LOD | MIDGARD_NO_UPPER_ALU | MIDGARD_NO_OOO | |
| 64 |
MIDGARD_NO_AUTO32; |
| 65 |
|
| 66 |
case 0x620: |
| 67 |
return MIDGARD_OLD_BLEND | MIDGARD_BROKEN_BLEND_LOADS | |
| 68 |
MIDGARD_BROKEN_LOD | MIDGARD_NO_UPPER_ALU | MIDGARD_NO_OOO; |
| 69 |
|
| 70 |
case 0x720: |
| 71 |
return MIDGARD_INTERPIPE_REG_ALIASING | MIDGARD_OLD_BLEND | |
| 72 |
MIDGARD_BROKEN_LOD | MIDGARD_NO_UPPER_ALU | MIDGARD_NO_OOO; |
| 73 |
|
| 74 |
case 0x820: |
| 75 |
case 0x830: |
| 76 |
return MIDGARD_INTERPIPE_REG_ALIASING; |
| 77 |
|
| 78 |
case 0x750: |
| 79 |
return MIDGARD_NO_UPPER_ALU; |
| 80 |
|
| 81 |
case 0x860: |
| 82 |
case 0x880: |
| 83 |
return 0; |
| 84 |
|
| 85 |
default: |
| 86 |
UNREACHABLE("Invalid Midgard GPU ID"); |
| 87 |
} |
| 88 |
} |
| 89 |
|
| 90 |
#endif |