panfrost: Centralize our model list

Replaces panfrost-quirks.h

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14726>
This commit is contained in:
Alyssa Rosenzweig 2022-01-25 19:15:26 -05:00 committed by Marge Bot
parent 2b638c1eb3
commit 6c0d433d19
31 changed files with 86 additions and 120 deletions

View File

@ -30,7 +30,6 @@
#include "pan_context.h"
#include "pan_shader.h"
#include "pan_util.h"
#include "panfrost-quirks.h"
#include "compiler/nir/nir.h"
#include "nir/tgsi_to_nir.h"

View File

@ -33,7 +33,6 @@
#include "pipe/p_state.h"
#include "gallium/auxiliary/util/u_blend.h"
#include "panfrost-quirks.h"
#include "genxml/gen_macros.h"
#include "pan_pool.h"
@ -3738,7 +3737,7 @@ batch_get_polygon_list(struct panfrost_batch *batch)
/* Create the BO as invisible if we can. In the non-hierarchical tiler case,
* we need to write the polygon list manually because there's not WRITE_VALUE
* job in the chain (maybe we should add one...). */
bool init_polygon_list = !has_draws && (dev->quirks & MIDGARD_NO_HIER_TILING);
bool init_polygon_list = !has_draws && dev->model->quirks.no_hierarchical_tiling;
batch->tiler_ctx.midgard.polygon_list =
panfrost_batch_create_bo(batch, size,
init_polygon_list ? 0 : PAN_BO_INVISIBLE,

View File

@ -27,7 +27,6 @@
*/
#include "pan_context.h"
#include "panfrost-quirks.h"
#include "pan_bo.h"
#include "pan_shader.h"
#include "util/u_memory.h"

View File

@ -31,7 +31,6 @@
#include "pan_bo.h"
#include "pan_context.h"
#include "pan_minmax_cache.h"
#include "panfrost-quirks.h"
#include "util/macros.h"
#include "util/format/u_format.h"

View File

@ -38,7 +38,6 @@
#include "util/u_framebuffer.h"
#include "pan_util.h"
#include "decode.h"
#include "panfrost-quirks.h"
#define foreach_batch(ctx, idx) \
BITSET_FOREACH_SET(idx, ctx->batches.active, PAN_MAX_BATCHES)

View File

@ -50,7 +50,6 @@
#include "pan_util.h"
#include "pan_tiling.h"
#include "decode.h"
#include "panfrost-quirks.h"
static bool
panfrost_should_checksum(const struct panfrost_device *dev, const struct panfrost_resource *pres);

View File

@ -52,7 +52,6 @@
#include "decode.h"
#include "pan_context.h"
#include "panfrost-quirks.h"
static const struct debug_named_value panfrost_debug_options[] = {
{"perf", PAN_DBG_PERF, "Enable performance warnings"},
@ -137,7 +136,7 @@ panfrost_get_param(struct pipe_screen *screen, enum pipe_cap param)
return true;
case PIPE_CAP_ANISOTROPIC_FILTER:
return !!(dev->quirks & HAS_ANISOTROPIC);
return dev->revision >= dev->model->min_rev_anisotropic;
/* Compile side is done for Bifrost, Midgard TODO. Needs some kernel
* work to turn on, since CYCLE_COUNT_START needs to be issued. In

View File

@ -1,83 +0,0 @@
/*
* Copyright (C) 2019 Collabora, Ltd.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifndef __PANFROST_QUIRKS_H
#define __PANFROST_QUIRKS_H
/* Model-specific quirks requiring workarounds/etc. Quirks may be errata
* requiring a workaround, or features. We're trying to be quirk-positive
* here; quirky is the best! */
/* Whether the GPU lacks the capability for hierarchical tiling, without an
* "Advanced Tiling Unit", instead requiring a single bin size for the entire
* framebuffer be selected by the driver */
#define MIDGARD_NO_HIER_TILING (1 << 0)
/* bit 1-6 unused */
/* Whether this GPU lacks support for any typed loads, requiring packing */
#define MIDGARD_NO_TYPED_BLEND_LOADS (1 << 7)
/* bits 8-10 unused */
/* Does this GPU support anisotropic filtering? */
#define HAS_ANISOTROPIC (1 << 11)
static inline unsigned
panfrost_get_quirks(unsigned gpu_id, unsigned gpu_revision)
{
switch (gpu_id) {
case 0x600:
case 0x620:
return MIDGARD_NO_TYPED_BLEND_LOADS;
case 0x720:
case 0x820:
case 0x830:
return MIDGARD_NO_HIER_TILING;
case 0x750:
case 0x860:
case 0x880:
return 0;
case 0x6000: /* G71 */
return 0;
case 0x6221: /* G72 */
/* Anisotropic filtering is supported from r0p3 onwards */
return (gpu_revision >= 0x30 ? HAS_ANISOTROPIC : 0);
case 0x7093: /* G31 */
case 0x7211: /* G76 */
case 0x7212: /* G52 */
case 0x7402: /* G52r1 */
return HAS_ANISOTROPIC;
default:
unreachable("Unknown Panfrost GPU ID");
}
}
#endif

View File

@ -35,7 +35,6 @@
#include "pan_shader.h"
#include "pan_scoreboard.h"
#include "pan_texture.h"
#include "panfrost-quirks.h"
#include "compiler/nir/nir_builder.h"
#include "util/u_math.h"

View File

@ -27,7 +27,6 @@
#include "util/macros.h"
#include "panfrost-quirks.h"
#include "pan_cs.h"
#include "pan_encoder.h"
@ -498,7 +497,7 @@ pan_emit_midgard_tiler(const struct panfrost_device *dev,
const struct pan_tiler_context *tiler_ctx,
void *out)
{
bool hierarchy = !(dev->quirks & MIDGARD_NO_HIER_TILING);
bool hierarchy = !dev->model->quirks.no_hierarchical_tiling;
assert(tiler_ctx->midgard.polygon_list->ptr.gpu);

View File

@ -148,6 +148,32 @@ struct panfrost_tiler_features {
unsigned max_levels;
};
struct panfrost_model {
/* GPU ID */
uint32_t gpu_id;
/* Marketing name for the GPU, used as the GL_RENDERER */
const char *name;
/* Set of associated performance counters */
const char *performance_counters;
/* Minimum GPU revision required for anisotropic filtering. ~0 and 0
* means "no revisions support anisotropy" and "all revisions support
* anistropy" respectively -- so checking for anisotropy is simply
* comparing the reivsion.
*/
uint32_t min_rev_anisotropic;
struct {
/* The GPU lacks the capability for hierarchical tiling, without
* an "Advanced Tiling Unit", instead requiring a single bin
* size for the entire framebuffer be selected by the driver
*/
bool no_hierarchical_tiling;
} quirks;
};
struct panfrost_device {
/* For ralloc */
void *memctx;
@ -157,10 +183,11 @@ struct panfrost_device {
/* Properties of the GPU in use */
unsigned arch;
unsigned gpu_id;
unsigned revision;
unsigned core_count;
unsigned thread_tls_alloc;
struct panfrost_tiler_features tiler_features;
unsigned quirks;
const struct panfrost_model *model;
bool has_afbc;
/* Table of formats, indexed by a PIPE format */
@ -257,6 +284,8 @@ pan_is_bifrost(const struct panfrost_device *dev)
return dev->arch >= 6 && dev->arch <= 7;
}
const struct panfrost_model * panfrost_get_model(uint32_t gpu_id);
#if defined(__cplusplus)
} // extern "C"
#endif

View File

@ -28,7 +28,6 @@
#define __PAN_ENCODER_H
#include "util/macros.h"
#include "panfrost-quirks.h"
#include <stdbool.h>
#include "util/format/u_format.h"
@ -58,7 +57,7 @@ panfrost_tiler_get_polygon_list_size(const struct panfrost_device *dev,
if (!has_draws)
return MALI_MIDGARD_TILER_MINIMUM_HEADER_SIZE + 4;
bool hierarchy = !(dev->quirks & MIDGARD_NO_HIER_TILING);
bool hierarchy = !dev->model->quirks.no_hierarchical_tiling;
unsigned hierarchy_mask =
panfrost_choose_hierarchy_mask(fb_width, fb_height, 1, hierarchy);

View File

@ -30,7 +30,6 @@
#include "pan_indirect_dispatch.h"
#include "pan_pool.h"
#include "pan_util.h"
#include "panfrost-quirks.h"
#include "compiler/nir/nir_builder.h"
#include "util/u_memory.h"
#include "util/macros.h"

View File

@ -30,7 +30,6 @@
#include "pan_indirect_draw.h"
#include "pan_pool.h"
#include "pan_util.h"
#include "panfrost-quirks.h"
#include "compiler/nir/nir_builder.h"
#include "util/u_memory.h"
#include "util/macros.h"

View File

@ -33,12 +33,60 @@
#include "drm-uapi/panfrost_drm.h"
#include "pan_encoder.h"
#include "pan_device.h"
#include "panfrost-quirks.h"
#include "pan_bo.h"
#include "pan_texture.h"
#include "wrap.h"
#include "pan_util.h"
/* Fixed "minimum revisions" */
#define NO_ANISO (~0)
#define HAS_ANISO (0)
#define MODEL(gpu_id_, shortname, counters_, min_rev_anisotropic_, quirks_) \
{ \
.gpu_id = gpu_id_, \
.name = "Mali-" shortname " (Panfrost)", \
.performance_counters = counters_, \
.min_rev_anisotropic = min_rev_anisotropic_, \
.quirks = quirks_, \
}
/* Table of supported Mali GPUs */
const struct panfrost_model panfrost_model_list[] = {
MODEL(0x720, "T720", "T72x", NO_ANISO, { .no_hierarchical_tiling = true }),
MODEL(0x750, "T760", "T76x", NO_ANISO, {}),
MODEL(0x820, "T820", "T82x", NO_ANISO, { .no_hierarchical_tiling = true }),
MODEL(0x830, "T830", "T83x", NO_ANISO, { .no_hierarchical_tiling = true }),
MODEL(0x860, "T860", "T86x", NO_ANISO, {}),
MODEL(0x880, "T880", "T88x", NO_ANISO, {}),
MODEL(0x6000, "G71", "TMIx", NO_ANISO, {}),
MODEL(0x6221, "G72", "THEx", 0x0030 /* r0p3 */, {}),
MODEL(0x7093, "G31", "TDVx", HAS_ANISO, {}),
MODEL(0x7211, "G76", "TNOx", HAS_ANISO, {}),
MODEL(0x7212, "G52", "TGOx", HAS_ANISO, {}),
MODEL(0x7402, "G52 r1", "TGOx", HAS_ANISO, {}),
};
#undef NO_ANISO
#undef HAS_ANISO
#undef MODEL
/*
* Look up a supported model by its GPU ID, or return NULL if the model is not
* supported at this time.
*/
const struct panfrost_model *
panfrost_get_model(uint32_t gpu_id)
{
for (unsigned i = 0; i < ARRAY_SIZE(panfrost_model_list); ++i) {
if (panfrost_model_list[i].gpu_id == gpu_id)
return &panfrost_model_list[i];
}
return NULL;
}
/* Abstraction over the raw drm_panfrost_get_param ioctl for fetching
* information about devices */
@ -238,8 +286,8 @@ panfrost_open_device(void *memctx, int fd, struct panfrost_device *dev)
dev->core_count = panfrost_query_core_count(fd);
dev->thread_tls_alloc = panfrost_query_thread_tls_alloc(fd, dev->arch);
dev->kernel_version = drmGetVersion(fd);
unsigned revision = panfrost_query_gpu_revision(fd);
dev->quirks = panfrost_get_quirks(dev->gpu_id, revision);
dev->revision = panfrost_query_gpu_revision(fd);
dev->model = panfrost_get_model(dev->gpu_id);
dev->compressed_formats = panfrost_query_compressed_formats(fd);
dev->tiler_features = panfrost_query_tiler_features(fd);
dev->has_afbc = panfrost_query_afbc(fd, dev->arch);

View File

@ -28,7 +28,6 @@
#include "util/macros.h"
#include "util/u_math.h"
#include "pan_texture.h"
#include "panfrost-quirks.h"
#ifndef PAN_ARCH

View File

@ -28,7 +28,6 @@
#include "util/macros.h"
#include "pan_device.h"
#include "pan_encoder.h"
#include "panfrost-quirks.h"
/* Mali GPUs are tiled-mode renderers, rather than immediate-mode.
* Conceptually, the screen is divided into 16x16 tiles. Vertex shaders run.

View File

@ -23,7 +23,6 @@
#include <stdio.h>
#include "pan_texture.h"
#include "panfrost-quirks.h"
/* Translate a PIPE swizzle quad to a 12-bit Mali swizzle code. PIPE
* swizzles line up with Mali swizzles for the XYZW01, but PIPE swizzles have

View File

@ -47,7 +47,6 @@
#include "helpers.h"
#include "compiler.h"
#include "midgard_quirks.h"
#include "panfrost-quirks.h"
#include "panfrost/util/pan_lower_framebuffer.h"
#include "disassemble.h"

View File

@ -52,7 +52,6 @@
#include "compiler/nir/nir_format_convert.h"
#include "util/format/u_format.h"
#include "pan_lower_framebuffer.h"
#include "panfrost-quirks.h"
/* Determines the unpacked type best suiting a given format, so the rest of the
* pipeline may be adjusted accordingly */

View File

@ -27,7 +27,6 @@
*/
#include "panvk_private.h"
#include "panfrost-quirks.h"
#include "pan_encoder.h"

View File

@ -24,7 +24,6 @@
#include "util/macros.h"
#include "compiler/shader_enums.h"
#include "panfrost-quirks.h"
#include "pan_cs.h"
#include "pan_pool.h"

View File

@ -28,7 +28,6 @@
#include "panvk_private.h"
#include "panfrost-quirks.h"
#include "pan_bo.h"
#include "pan_encoder.h"
#include "pan_util.h"

View File

@ -27,7 +27,6 @@
*/
#include "panvk_private.h"
#include "panfrost-quirks.h"
#include "util/debug.h"
#include "util/u_atomic.h"

View File

@ -40,7 +40,6 @@
#include "vk_format.h"
#include "vk_util.h"
#include "panfrost-quirks.h"
VkResult
panvk_CreateComputePipelines(VkDevice _device,

View File

@ -31,7 +31,6 @@
#include "spirv/nir_spirv.h"
#include "util/mesa-sha1.h"
#include "panfrost-quirks.h"
#include "pan_shader.h"
#include "vk_util.h"

View File

@ -30,7 +30,6 @@
#include "panvk_cs.h"
#include "panvk_private.h"
#include "panfrost-quirks.h"
#include "pan_blitter.h"
#include "pan_cs.h"
@ -72,7 +71,7 @@ panvk_per_arch(cmd_get_polygon_list)(struct panvk_cmd_buffer *cmdbuf,
/* Create the BO as invisible if we can. In the non-hierarchical tiler case,
* we need to write the polygon list manually because there's not WRITE_VALUE
* job in the chain. */
bool init_polygon_list = !has_draws && (pdev->quirks & MIDGARD_NO_HIER_TILING);
bool init_polygon_list = !has_draws && pdev->model->quirks.no_hierarchical_tiling;
batch->tiler.ctx.midgard.polygon_list =
panfrost_bo_create(pdev, size,
init_polygon_list ? 0 : PAN_BO_INVISIBLE,

View File

@ -28,7 +28,6 @@
#include "vk_util.h"
#include "panfrost-quirks.h"
#include "pan_cs.h"
#include "pan_encoder.h"
#include "pan_pool.h"

View File

@ -28,7 +28,6 @@
#include "genxml/gen_macros.h"
#include "panvk_private.h"
#include "panfrost-quirks.h"
#include "util/debug.h"
#include "util/u_atomic.h"

View File

@ -42,7 +42,6 @@
#include "panfrost/util/pan_lower_framebuffer.h"
#include "panfrost-quirks.h"
struct panvk_pipeline_builder
{

View File

@ -34,7 +34,6 @@
#include "spirv/nir_spirv.h"
#include "util/mesa-sha1.h"
#include "panfrost-quirks.h"
#include "pan_shader.h"
#include "util/pan_lower_framebuffer.h"