Path: blob/21.2-virgl/src/panfrost/midgard/midgard_quirks.h
4564 views
/*1* Copyright (C) 2019 Collabora, Ltd.2*3* Permission is hereby granted, free of charge, to any person obtaining a4* copy of this software and associated documentation files (the "Software"),5* to deal in the Software without restriction, including without limitation6* the rights to use, copy, modify, merge, publish, distribute, sublicense,7* and/or sell copies of the Software, and to permit persons to whom the8* Software is furnished to do so, subject to the following conditions:9*10* The above copyright notice and this permission notice (including the next11* paragraph) shall be included in all copies or substantial portions of the12* Software.13*14* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR15* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,16* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL17* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER18* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,19* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE20* SOFTWARE.21*/2223#ifndef __MDG_QUIRKS_H24#define __MDG_QUIRKS_H2526/* Model-specific quirks requiring compiler workarounds/etc. Quirks27* may be errata requiring a workaround, or features. We're trying to be28* quirk-positive here; quirky is the best! */2930/* bit 0 unused */3132/* Whether output texture registers (normally r28/r29) overlap with work33* registers r0/r1 and input texture registers (also normally r28/r29) overlap34* with load/store registers r26/r27. This constrains register allocation35* considerably but is a space-saving measure on small Midgards. It's worth36* noting if you try to access r28/r29, it may still work, but you'll mess up37* the interference. Corresponds to BASE_HW_FEATURE_INTERPIPE_REG_ALIASING in38* kbase. */3940#define MIDGARD_INTERPIPE_REG_ALIASING (1 << 1)4142/* Whether we should use old-style blend opcodes */4344#define MIDGARD_OLD_BLEND (1 << 2)4546/* Errata causing the LOD clamps and bias in the sampler descriptor to be47* ignored. This errata affects the command stream but uses a compiler48* workaround (applying the clamps/bias manually in the shader. Corresponds in49* BASE_HW_ISSUE_10471 in kbase, described as "TEXGRD doesn't honor Sampler50* Descriptor LOD clamps nor bias". (I'm assuming TEXGRD is what we call51* textureLod) */5253#define MIDGARD_BROKEN_LOD (1 << 3)5455/* Don't use upper ALU tags for writeout (if you do, you'll get a56* INSTR_INVALID_ENC). It's not clear to me what these tags are for. */5758#define MIDGARD_NO_UPPER_ALU (1 << 4)5960/* Whether (texture) out-of-order execution support is missing on early61* Midgards. For these just set the OoO bits to 0. */6263#define MIDGARD_NO_OOO (1 << 5)6465static inline unsigned66midgard_get_quirks(unsigned gpu_id)67{68switch (gpu_id) {69case 0x600:70case 0x620:71return MIDGARD_OLD_BLEND |72MIDGARD_BROKEN_LOD |73MIDGARD_NO_UPPER_ALU |74MIDGARD_NO_OOO;7576case 0x720:77return MIDGARD_INTERPIPE_REG_ALIASING |78MIDGARD_OLD_BLEND |79MIDGARD_BROKEN_LOD |80MIDGARD_NO_UPPER_ALU |81MIDGARD_NO_OOO;8283case 0x820:84case 0x830:85return MIDGARD_INTERPIPE_REG_ALIASING;8687case 0x750:88return MIDGARD_NO_UPPER_ALU;8990case 0x860:91case 0x880:92return 0;9394default:95unreachable("Invalid Midgard GPU ID");96}97}9899#endif100101102