From: Alyssa Rosenzweig Date: Wed, 24 Jul 2019 15:46:15 +0000 (-0700) Subject: panfrost: Move require_sfbd to screen X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=990e24469cb83b6236a954e2433252b9219f774b;p=mesa.git panfrost: Move require_sfbd to screen We'll need it to specialize resource creation by chip. Signed-off-by: Alyssa Rosenzweig --- diff --git a/src/gallium/drivers/panfrost/pan_blend_cso.c b/src/gallium/drivers/panfrost/pan_blend_cso.c index a96e7b02cd4..f685b25b41b 100644 --- a/src/gallium/drivers/panfrost/pan_blend_cso.c +++ b/src/gallium/drivers/panfrost/pan_blend_cso.c @@ -135,6 +135,7 @@ panfrost_bind_blend_state(struct pipe_context *pipe, void *cso) { struct panfrost_context *ctx = pan_context(pipe); + struct panfrost_screen *screen = pan_screen(ctx->base.screen); struct pipe_blend_state *blend = (struct pipe_blend_state *) cso; struct panfrost_blend_state *pblend = (struct panfrost_blend_state *) cso; ctx->blend = pblend; @@ -142,7 +143,7 @@ panfrost_bind_blend_state(struct pipe_context *pipe, if (!blend) return; - if (ctx->require_sfbd) { + if (screen->require_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 2f19113e703..0035f700518 100644 --- a/src/gallium/drivers/panfrost/pan_context.c +++ b/src/gallium/drivers/panfrost/pan_context.c @@ -232,7 +232,8 @@ panfrost_attach_vt_framebuffer(struct panfrost_context *ctx, bool skippable) return; } - mali_ptr framebuffer = ctx->require_sfbd ? + struct panfrost_screen *screen = pan_screen(ctx->base.screen); + mali_ptr framebuffer = screen->require_sfbd ? panfrost_attach_vt_sfbd(ctx) : panfrost_attach_vt_mfbd(ctx); @@ -246,7 +247,9 @@ panfrost_attach_vt_framebuffer(struct panfrost_context *ctx, bool skippable) static void panfrost_invalidate_frame(struct panfrost_context *ctx) { - if (ctx->require_sfbd) + struct panfrost_screen *screen = pan_screen(ctx->base.screen); + + if (screen->require_sfbd) ctx->vt_framebuffer_sfbd = panfrost_emit_sfbd(ctx, ~0); else ctx->vt_framebuffer_mfbd = panfrost_emit_mfbd(ctx, ~0); @@ -1030,6 +1033,7 @@ void panfrost_emit_for_draw(struct panfrost_context *ctx, bool with_vertex_data) { struct panfrost_job *job = panfrost_get_job_for_fbo(ctx); + struct panfrost_screen *screen = pan_screen(ctx->base.screen); panfrost_attach_vt_framebuffer(ctx, true); @@ -1174,7 +1178,7 @@ panfrost_emit_for_draw(struct panfrost_context *ctx, bool with_vertex_data) ctx->fragment_shader_core.blend.shader = 0; } - if (ctx->require_sfbd) { + if (screen->require_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 @@ -1198,7 +1202,7 @@ panfrost_emit_for_draw(struct panfrost_context *ctx, bool with_vertex_data) ctx->payload_tiler.postfix._shader_upper = (transfer.gpu) >> 4; - if (!ctx->require_sfbd) { + if (!screen->require_sfbd) { /* Additional blend descriptor tacked on for jobs using MFBD */ unsigned blend_count = 0x200; @@ -2392,7 +2396,7 @@ panfrost_set_framebuffer_state(struct pipe_context *pctx, panfrost_hint_afbc(screen, &ctx->pipe_framebuffer); - if (ctx->require_sfbd) + if (screen->require_sfbd) ctx->vt_framebuffer_sfbd = panfrost_emit_sfbd(ctx, ~0); else ctx->vt_framebuffer_mfbd = panfrost_emit_mfbd(ctx, ~0); @@ -2691,7 +2695,6 @@ panfrost_create_context(struct pipe_screen *screen, void *priv, unsigned flags) struct pipe_context *gallium = (struct pipe_context *) ctx; ctx->is_t6xx = pscreen->gpu_id < 0x0700; /* Literally, "earlier than T700" */ - ctx->require_sfbd = pscreen->gpu_id < 0x0750; /* T760 is the first to support MFBD */ gallium->screen = screen; diff --git a/src/gallium/drivers/panfrost/pan_context.h b/src/gallium/drivers/panfrost/pan_context.h index 5584003b2dd..83128677b97 100644 --- a/src/gallium/drivers/panfrost/pan_context.h +++ b/src/gallium/drivers/panfrost/pan_context.h @@ -185,13 +185,6 @@ struct panfrost_context { /* True for t6XX, false for t8xx. */ bool is_t6xx; - /* If set, we'll require the use of single render-target framebuffer - * descriptors (SFBD), for older hardware -- specifically, require_sfbd ? + struct panfrost_screen *screen = pan_screen(ctx->base.screen); + + mali_ptr framebuffer = screen->require_sfbd ? panfrost_sfbd_fragment(ctx, has_draws) : panfrost_mfbd_fragment(ctx, has_draws); diff --git a/src/gallium/drivers/panfrost/pan_screen.c b/src/gallium/drivers/panfrost/pan_screen.c index 294fc456fa1..aa39a35e9c3 100644 --- a/src/gallium/drivers/panfrost/pan_screen.c +++ b/src/gallium/drivers/panfrost/pan_screen.c @@ -525,6 +525,7 @@ panfrost_create_screen(int fd, struct renderonly *ro) screen->fd = fd; screen->gpu_id = panfrost_drm_query_gpu_version(screen); + screen->require_sfbd = screen->gpu_id < 0x0750; /* T760 is the first to support MFBD */ /* Check if we're loading against a supported GPU model. */ diff --git a/src/gallium/drivers/panfrost/pan_screen.h b/src/gallium/drivers/panfrost/pan_screen.h index 3ea624c8855..22cd7dcc9fe 100644 --- a/src/gallium/drivers/panfrost/pan_screen.h +++ b/src/gallium/drivers/panfrost/pan_screen.h @@ -94,7 +94,10 @@ struct panfrost_screen; struct panfrost_screen { struct pipe_screen base; int fd; + + /* Properties of the GPU in use */ unsigned gpu_id; + bool require_sfbd; struct renderonly *ro;