Path: blob/21.2-virgl/src/panfrost/bifrost/bi_quirks.h
4564 views
/*1* Copyright (C) 2019-2020 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 __BI_QUIRKS_H24#define __BI_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/* Whether this GPU lacks support for the preload mechanism. New GPUs can have31* varyings and textures preloaded into the fragment shader to amortize the I/O32* cost; early Bifrost models lacked this feature. */3334#define BIFROST_NO_PRELOAD (1 << 0)3536/* Whether this GPU lacks support for fp32 transcendentals, requiring backend37* lowering to low-precision lookup tables and polynomial approximation */3839#define BIFROST_NO_FP32_TRANSCENDENTALS (1 << 1)4041static inline unsigned42bifrost_get_quirks(unsigned product_id)43{44switch (product_id >> 8) {45case 0x60:46return BIFROST_NO_PRELOAD | BIFROST_NO_FP32_TRANSCENDENTALS;47case 0x62:48return BIFROST_NO_PRELOAD;49case 0x70:50case 0x72:51case 0x74:52return 0;53default:54unreachable("Unknown Bifrost GPU ID");55}56}5758/* How many lanes per architectural warp (subgroup)? Used to lower divergent59* indirects. */6061static inline unsigned62bifrost_lanes_per_warp(unsigned product_id)63{64unsigned major = product_id >> 12;65assert(major == 6 || major == 7);66return (major == 7) ? 8 : 4;67}6869#endif707172