panfrost: Move require_sfbd to screen
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Wed, 24 Jul 2019 15:46:15 +0000 (08:46 -0700)
committerAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Thu, 25 Jul 2019 13:34:20 +0000 (06:34 -0700)
We'll need it to specialize resource creation by chip.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
src/gallium/drivers/panfrost/pan_blend_cso.c
src/gallium/drivers/panfrost/pan_context.c
src/gallium/drivers/panfrost/pan_context.h
src/gallium/drivers/panfrost/pan_fragment.c
src/gallium/drivers/panfrost/pan_screen.c
src/gallium/drivers/panfrost/pan_screen.h

index a96e7b02cd4a2a04504e3a930ec6823534318c56..f685b25b41b30b60918c02f3c0d961fd77939afc 100644 (file)
@@ -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);
         }
 
index 2f19113e703da14c0f6d29531dbae6a469024498..0035f7005184721ea43af2f1e7171e7dee2410db 100644 (file)
@@ -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;
 
index 5584003b2dd6cd7369237536d8ddd2f54a128267..83128677b97874a5bca3e82b1f3485efc3db04a4 100644 (file)
@@ -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, <T760 hardware, If
-         * false, we'll use the MFBD no matter what. New hardware -does- retain support
-         * for SFBD, and in theory we could flip between them on a per-RT basis, but
-         * there's no real advantage to doing so */
-        bool require_sfbd;
-
         uint32_t out_sync;
 };
 
index 023569ef204de1a027b482bb4c91f22ae916e57a..778bc85100f8e2a9ec809eb5b1d7485ece8f3ecc 100644 (file)
@@ -53,7 +53,9 @@ panfrost_initialize_surface(
 mali_ptr
 panfrost_fragment_job(struct panfrost_context *ctx, bool has_draws)
 {
-        mali_ptr framebuffer = ctx->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);
 
index 294fc456fa10d7f7d43df60a7ba9548789ab531d..aa39a35e9c3090465e603a6a9116368b922862ab 100644 (file)
@@ -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. */
 
index 3ea624c8855c073624e28528371ae03df70ce851..22cd7dcc9fea481c6f0602d8517dfcd0baf2d01a 100644 (file)
@@ -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;