vc4: Move render command list calls to vc4_flush()
authorEric Anholt <eric@anholt.net>
Thu, 31 Jul 2014 18:22:17 +0000 (11:22 -0700)
committerEric Anholt <eric@anholt.net>
Mon, 11 Aug 2014 21:45:30 +0000 (14:45 -0700)
src/gallium/drivers/vc4/vc4_context.c
src/gallium/drivers/vc4/vc4_draw.c

index c75cea2fcb48ba4ed0a63336b4e2ef7f455ec670..9f10473846d3ae3bbfd1c2b0862ba32f6733558d 100644 (file)
@@ -84,6 +84,47 @@ dump_fbo(struct vc4_context *vc4, struct vc4_bo *fbo)
 #endif
 }
 
+static void
+vc4_rcl_tile_calls(struct vc4_context *vc4)
+{
+        struct vc4_surface *csurf = vc4_surface(vc4->framebuffer.cbufs[0]);
+        struct vc4_resource *ctex = vc4_resource(csurf->base.texture);
+        uint32_t width = vc4->framebuffer.width;
+        uint32_t height = vc4->framebuffer.height;
+        uint32_t xtiles = align(width, 64) / 64;
+        uint32_t ytiles = align(height, 64) / 64;
+
+        for (int x = 0; x < xtiles; x++) {
+                for (int y = 0; y < ytiles; y++) {
+                        cl_u8(&vc4->rcl, VC4_PACKET_TILE_COORDINATES);
+                        cl_u8(&vc4->rcl, x);
+                        cl_u8(&vc4->rcl, y);
+
+                        cl_start_reloc(&vc4->rcl, 1);
+                        cl_u8(&vc4->rcl, VC4_PACKET_LOAD_TILE_BUFFER_GENERAL);
+                        cl_u8(&vc4->rcl,
+                              VC4_LOADSTORE_TILE_BUFFER_COLOR |
+                              VC4_LOADSTORE_TILE_BUFFER_FORMAT_RASTER);
+                        cl_u8(&vc4->rcl,
+                              VC4_LOADSTORE_TILE_BUFFER_RGBA8888);
+                        cl_reloc(vc4, &vc4->rcl, ctex->bo, csurf->offset);
+
+                        cl_start_reloc(&vc4->rcl, 1);
+                        cl_u8(&vc4->rcl, VC4_PACKET_BRANCH_TO_SUB_LIST);
+                        cl_reloc(vc4, &vc4->rcl, vc4->tile_alloc,
+                                 (y * xtiles + x) * 32);
+
+                        if (x == xtiles - 1 && y == ytiles - 1) {
+                                cl_u8(&vc4->rcl,
+                                      VC4_PACKET_STORE_MS_TILE_BUFFER_AND_EOF);
+                        } else {
+                                cl_u8(&vc4->rcl,
+                                      VC4_PACKET_STORE_MS_TILE_BUFFER);
+                        }
+                }
+        }
+}
+
 void
 vc4_flush(struct pipe_context *pctx)
 {
@@ -101,6 +142,8 @@ vc4_flush(struct pipe_context *pctx)
         struct drm_vc4_submit_cl submit;
         memset(&submit, 0, sizeof(submit));
 
+        vc4_rcl_tile_calls(vc4);
+
         submit.bo_handles = vc4->bo_handles.base;
         submit.bo_handle_count = (vc4->bo_handles.next -
                                   vc4->bo_handles.base) / 4;
index d4382c6a415062713f62d3bdcaee2a76d73b1c21..2867aac38d6f887041a19c7db623bfc16cb5dd03 100644 (file)
 #include "vc4_context.h"
 #include "vc4_resource.h"
 
-static void
-vc4_rcl_tile_calls(struct vc4_context *vc4,
-                   struct vc4_surface *csurf,
-                   uint32_t xtiles, uint32_t ytiles)
-{
-        struct vc4_resource *ctex = vc4_resource(csurf->base.texture);
-
-        for (int x = 0; x < xtiles; x++) {
-                for (int y = 0; y < ytiles; y++) {
-                        cl_u8(&vc4->rcl, VC4_PACKET_TILE_COORDINATES);
-                        cl_u8(&vc4->rcl, x);
-                        cl_u8(&vc4->rcl, y);
-
-                        cl_start_reloc(&vc4->rcl, 1);
-                        cl_u8(&vc4->rcl, VC4_PACKET_LOAD_TILE_BUFFER_GENERAL);
-                        cl_u8(&vc4->rcl,
-                              VC4_LOADSTORE_TILE_BUFFER_COLOR |
-                              VC4_LOADSTORE_TILE_BUFFER_FORMAT_RASTER);
-                        cl_u8(&vc4->rcl,
-                              VC4_LOADSTORE_TILE_BUFFER_RGBA8888);
-                        cl_reloc(vc4, &vc4->rcl, ctex->bo, csurf->offset);
-
-                        cl_start_reloc(&vc4->rcl, 1);
-                        cl_u8(&vc4->rcl, VC4_PACKET_BRANCH_TO_SUB_LIST);
-                        cl_reloc(vc4, &vc4->rcl, vc4->tile_alloc,
-                                 (y * xtiles + x) * 32);
-
-                        if (x == xtiles - 1 && y == ytiles - 1) {
-                                cl_u8(&vc4->rcl,
-                                      VC4_PACKET_STORE_MS_TILE_BUFFER_AND_EOF);
-                        } else {
-                                cl_u8(&vc4->rcl,
-                                      VC4_PACKET_STORE_MS_TILE_BUFFER);
-                        }
-                }
-        }
-}
-
 static void
 vc4_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info)
 {
@@ -239,8 +201,6 @@ vc4_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info)
                 cl_u32(&vc4->rcl, 0); // no address is needed
         }
 
-        vc4_rcl_tile_calls(vc4, csurf, tilew, tileh);
-
         vc4_flush(pctx);
 }