aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorTomeu Vizoso <[email protected]>2019-11-28 10:21:06 +0100
committerTomeu Vizoso <[email protected]>2019-12-03 04:25:04 +0000
commit6887ff4e79c7cb236c58a326159046a6406d21d5 (patch)
tree033bb9f431c1a490d9a8cd5f671fb6c75c2c2eab /src/gallium
parentfbd5359a0a6f4b6d220c4cea9020ec4665ed4955 (diff)
panfrost: Add quirks system to cmdstream
Similarly to how it's already done in the compiler, add a way to express differences between GPU models that need to be taken into account when assembling the cmdstream. Signed-off-by: Tomeu Vizoso <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/panfrost/pan_blend_cso.c3
-rw-r--r--src/gallium/drivers/panfrost/pan_context.c12
-rw-r--r--src/gallium/drivers/panfrost/pan_fragment.c3
-rw-r--r--src/gallium/drivers/panfrost/pan_job.c3
-rw-r--r--src/gallium/drivers/panfrost/pan_screen.c6
-rw-r--r--src/gallium/drivers/panfrost/pan_screen.h2
6 files changed, 16 insertions, 13 deletions
diff --git a/src/gallium/drivers/panfrost/pan_blend_cso.c b/src/gallium/drivers/panfrost/pan_blend_cso.c
index 48bd513ab6e..69683098c68 100644
--- a/src/gallium/drivers/panfrost/pan_blend_cso.c
+++ b/src/gallium/drivers/panfrost/pan_blend_cso.c
@@ -30,6 +30,7 @@
#include "pan_blend_shaders.h"
#include "pan_blending.h"
#include "pan_bo.h"
+#include "panfrost-quirks.h"
/* A given Gallium blend state can be encoded to the hardware in numerous,
* dramatically divergent ways due to the interactions of blending with
@@ -149,7 +150,7 @@ panfrost_bind_blend_state(struct pipe_context *pipe,
if (!blend)
return;
- if (screen->require_sfbd) {
+ if (screen->quirks & MIDGARD_SFBD) {
SET_BIT(ctx->fragment_shader_core.unknown2_4, MALI_NO_DITHER, !blend->dither);
}
diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c
index 0c95ea6631c..af8f94354e9 100644
--- a/src/gallium/drivers/panfrost/pan_context.c
+++ b/src/gallium/drivers/panfrost/pan_context.c
@@ -30,6 +30,7 @@
#include "pan_bo.h"
#include "pan_context.h"
#include "pan_format.h"
+#include "panfrost-quirks.h"
#include "util/macros.h"
#include "util/format/u_format.h"
@@ -102,7 +103,7 @@ panfrost_emit_midg_tiler(struct panfrost_batch *batch, unsigned vertex_count)
/* Disable the tiler */
t.hierarchy_mask |= MALI_TILER_DISABLED;
- if (screen->require_sfbd) {
+ if (screen->quirks & MIDGARD_SFBD) {
t.hierarchy_mask = 0xFFF; /* TODO: What's this? */
t.polygon_list_size = 0x200;
@@ -217,7 +218,7 @@ panfrost_attach_vt_framebuffer(struct panfrost_context *ctx)
struct panfrost_batch *batch = panfrost_get_batch_for_fbo(ctx);
if (!batch->framebuffer)
- batch->framebuffer = screen->require_sfbd ?
+ batch->framebuffer = (screen->quirks & MIDGARD_SFBD) ?
panfrost_attach_vt_sfbd(batch) :
panfrost_attach_vt_mfbd(batch);
@@ -426,9 +427,8 @@ panfrost_default_shader_backend(struct panfrost_context *ctx)
* these earlier chips (perhaps this is a chicken bit of some kind).
* More investigation is needed. */
- if (screen->require_sfbd) {
+ if (screen->quirks & MIDGARD_SFBD)
shader.unknown2_4 |= 0x10;
- }
struct pipe_stencil_state default_stencil = {
.enabled = 0,
@@ -1068,7 +1068,7 @@ panfrost_emit_for_draw(struct panfrost_context *ctx, bool with_vertex_data)
ctx->fragment_shader_core.blend.shader = 0;
}
- if (screen->require_sfbd) {
+ if (screen->quirks & MIDGARD_SFBD) {
/* When only a single render target platform is used, the blend
* information is inside the shader meta itself. We
* additionally need to signal CAN_DISCARD for nontrivial blend
@@ -1092,7 +1092,7 @@ panfrost_emit_for_draw(struct panfrost_context *ctx, bool with_vertex_data)
ctx->payloads[PIPE_SHADER_FRAGMENT].postfix.shader = transfer.gpu;
- if (!screen->require_sfbd) {
+ if (!(screen->quirks & MIDGARD_SFBD)) {
/* Additional blend descriptor tacked on for jobs using MFBD */
struct midgard_blend_rt rts[4];
diff --git a/src/gallium/drivers/panfrost/pan_fragment.c b/src/gallium/drivers/panfrost/pan_fragment.c
index 9fe39d7c1bb..b6bbce391c4 100644
--- a/src/gallium/drivers/panfrost/pan_fragment.c
+++ b/src/gallium/drivers/panfrost/pan_fragment.c
@@ -25,6 +25,7 @@
#include "pan_context.h"
#include "pan_util.h"
#include "pan_format.h"
+#include "panfrost-quirks.h"
#include "util/format/u_format.h"
@@ -52,7 +53,7 @@ panfrost_fragment_job(struct panfrost_batch *batch, bool has_draws)
{
struct panfrost_screen *screen = pan_screen(batch->ctx->base.screen);
- mali_ptr framebuffer = screen->require_sfbd ?
+ mali_ptr framebuffer = screen->quirks & MIDGARD_SFBD ?
panfrost_sfbd_fragment(batch, has_draws) :
panfrost_mfbd_fragment(batch, has_draws);
diff --git a/src/gallium/drivers/panfrost/pan_job.c b/src/gallium/drivers/panfrost/pan_job.c
index ea6bd022511..e2e54aff216 100644
--- a/src/gallium/drivers/panfrost/pan_job.c
+++ b/src/gallium/drivers/panfrost/pan_job.c
@@ -35,6 +35,7 @@
#include "util/u_pack_color.h"
#include "pan_util.h"
#include "pandecode/decode.h"
+#include "panfrost-quirks.h"
/* panfrost_bo_access is here to help us keep track of batch accesses to BOs
* and build a proper dependency graph such that batches can be pipelined for
@@ -677,7 +678,7 @@ panfrost_batch_get_tiler_dummy(struct panfrost_batch *batch)
if (batch->tiler_dummy)
return batch->tiler_dummy;
- if (!screen->require_sfbd)
+ if (!(screen->quirks & MIDGARD_NO_HIER_TILING))
create_flags = PAN_BO_INVISIBLE;
batch->tiler_dummy = panfrost_batch_create_bo(batch, 4096,
diff --git a/src/gallium/drivers/panfrost/pan_screen.c b/src/gallium/drivers/panfrost/pan_screen.c
index 212bc5b02ac..f0b9585e658 100644
--- a/src/gallium/drivers/panfrost/pan_screen.c
+++ b/src/gallium/drivers/panfrost/pan_screen.c
@@ -52,6 +52,7 @@
#include "pan_context.h"
#include "midgard/midgard_compile.h"
+#include "panfrost-quirks.h"
static const struct debug_named_value debug_options[] = {
{"msgs", PAN_DBG_MSGS, "Print debug messages"},
@@ -732,7 +733,7 @@ panfrost_create_screen(int fd, struct renderonly *ro)
screen->fd = fd;
screen->gpu_id = panfrost_query_gpu_version(screen);
- screen->require_sfbd = screen->gpu_id < 0x0750; /* T760 is the first to support MFBD */
+ screen->quirks = panfrost_get_quirks(screen->gpu_id);
screen->kernel_version = drmGetVersion(fd);
/* Check if we're loading against a supported GPU model. */
@@ -744,8 +745,7 @@ panfrost_create_screen(int fd, struct renderonly *ro)
break;
default:
/* Fail to load against untested models */
- debug_printf("panfrost: Unsupported model %X",
- screen->gpu_id);
+ debug_printf("panfrost: Unsupported model %X", screen->gpu_id);
return NULL;
}
diff --git a/src/gallium/drivers/panfrost/pan_screen.h b/src/gallium/drivers/panfrost/pan_screen.h
index c864629a372..974010ae994 100644
--- a/src/gallium/drivers/panfrost/pan_screen.h
+++ b/src/gallium/drivers/panfrost/pan_screen.h
@@ -80,7 +80,7 @@ struct panfrost_screen {
/* Properties of the GPU in use */
unsigned gpu_id;
- bool require_sfbd;
+ unsigned quirks;
drmVersionPtr kernel_version;