Path: blob/21.2-virgl/src/panfrost/include/panfrost-quirks.h
4560 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 __PANFROST_QUIRKS_H24#define __PANFROST_QUIRKS_H2526/* Model-specific quirks requiring workarounds/etc. Quirks may be errata27* requiring a workaround, or features. We're trying to be quirk-positive28* here; quirky is the best! */2930/* Whether the GPU lacks the capability for hierarchical tiling, without an31* "Advanced Tiling Unit", instead requiring a single bin size for the entire32* framebuffer be selected by the driver */3334#define MIDGARD_NO_HIER_TILING (1 << 0)3536/* Whether this GPU lacks native multiple render target support and accordingly37* needs SFBDs instead, with complex lowering with ES3 */3839#define MIDGARD_SFBD (1 << 1)4041/* Whether fp16 is broken in the compiler. Hopefully this quirk will go away42* over time */4344#define MIDGARD_BROKEN_FP16 (1 << 2)4546/* What it says on the tin */47#define HAS_SWIZZLES (1 << 4)4849/* bit 5 unused */5051/* Whether this GPU lacks support for any typed stores in blend shader,52* requiring packing instead */53#define MIDGARD_NO_TYPED_BLEND_STORES (1 << 6)5455/* Whether this GPU lacks support for any typed loads, requiring packing */56#define MIDGARD_NO_TYPED_BLEND_LOADS (1 << 7)5758/* Lack support for colour pack/unpack opcodes */59#define NO_BLEND_PACKS (1 << 8)6061/* Has some missing formats for typed loads */62#define MIDGARD_MISSING_LOADS (1 << 9)6364/* Lack support for AFBC */65#define MIDGARD_NO_AFBC (1 << 10)6667/* Does this GPU support anisotropic filtering? */68#define HAS_ANISOTROPIC (1 << 11)6970#define NO_TILE_ENABLE_MAP (1 << 12)7172/* Quirk collections common to particular uarchs */7374#define MIDGARD_QUIRKS (MIDGARD_BROKEN_FP16 | HAS_SWIZZLES \75| MIDGARD_NO_TYPED_BLEND_STORES \76| MIDGARD_MISSING_LOADS)7778#define BIFROST_QUIRKS NO_BLEND_PACKS7980static inline unsigned81panfrost_get_quirks(unsigned gpu_id, unsigned gpu_revision)82{83switch (gpu_id) {84case 0x600:85case 0x620:86return MIDGARD_QUIRKS | MIDGARD_SFBD87| MIDGARD_NO_TYPED_BLEND_LOADS88| NO_BLEND_PACKS | MIDGARD_NO_AFBC89| NO_TILE_ENABLE_MAP;9091case 0x720:92return MIDGARD_QUIRKS | MIDGARD_SFBD | MIDGARD_NO_HIER_TILING93| MIDGARD_NO_AFBC | NO_TILE_ENABLE_MAP;9495case 0x820:96case 0x830:97return MIDGARD_QUIRKS | MIDGARD_NO_HIER_TILING;9899case 0x750:100/* Someone should investigate the broken loads? */101return MIDGARD_QUIRKS | MIDGARD_NO_TYPED_BLEND_LOADS102| NO_BLEND_PACKS;103104case 0x860:105case 0x880:106return MIDGARD_QUIRKS;107108case 0x6000: /* G71 */109return BIFROST_QUIRKS | HAS_SWIZZLES;110111case 0x6221: /* G72 */112/* Anisotropic filtering is supported from r0p3 onwards */113return BIFROST_QUIRKS | HAS_SWIZZLES114| (gpu_revision >= 0x30 ? HAS_ANISOTROPIC : 0);115116case 0x7093: /* G31 */117case 0x7212: /* G52 */118case 0x7402: /* G52r1 */119return BIFROST_QUIRKS | HAS_ANISOTROPIC;120121default:122unreachable("Unknown Panfrost GPU ID");123}124}125126#endif127128129