panfrost: enable DrawTransformFeedback*
authorIlia Mirkin <imirkin@alum.mit.edu>
Sun, 9 Aug 2020 04:13:14 +0000 (00:13 -0400)
committerMarge Bot <eric+marge@anholt.net>
Mon, 31 Aug 2020 17:10:35 +0000 (17:10 +0000)
This is needed for ARB_transform_feedback2, which I plan on requiring
for ES3. Also update docs/features.txt

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6247>

docs/features.txt
src/gallium/drivers/panfrost/pan_cmdstream.c
src/gallium/drivers/panfrost/pan_context.c
src/gallium/drivers/panfrost/pan_context.h
src/gallium/drivers/panfrost/pan_screen.c

index 81afea4d0f0b6b05ef1263b4236272a08bdce404..13a96439cd2980406fefffdf66fe5aeb544fd346 100644 (file)
@@ -136,7 +136,7 @@ GL 4.0, GLSL 4.00 --- all DONE: i965/gen7+, nvc0, r600, radeonsi, llvmpipe, virg
   GL_ARB_texture_cube_map_array                         DONE (i965/gen6+, nv50, softpipe, swr, zink)
   GL_ARB_texture_gather                                 DONE (freedreno, i965/gen6+, nv50, softpipe, swr, v3d)
   GL_ARB_texture_query_lod                              DONE (freedreno, i965, nv50, softpipe, swr, v3d, panfrost)
-  GL_ARB_transform_feedback2                            DONE (i965/gen6+, nv50, softpipe, swr, v3d)
+  GL_ARB_transform_feedback2                            DONE (i965/gen6+, nv50, softpipe, swr, v3d, panfrost)
   GL_ARB_transform_feedback3                            DONE (i965/gen7+, softpipe, swr)
 
 
index c2c54814987300d21ba9643e3cea616b77a4e8aa..777725d0a267dac850e23cdf047d7d46a0cdcadb 100644 (file)
@@ -1271,16 +1271,16 @@ panfrost_emit_varyings(struct panfrost_batch *batch,
 }
 
 static unsigned
-panfrost_streamout_offset(unsigned stride, unsigned offset,
+panfrost_streamout_offset(unsigned stride,
                         struct pipe_stream_output_target *target)
 {
-        return (target->buffer_offset + (offset * stride * 4)) & 63;
+        return (target->buffer_offset + (pan_so_target(target)->offset * stride * 4)) & 63;
 }
 
 static void
 panfrost_emit_streamout(struct panfrost_batch *batch,
                         struct mali_attribute_buffer_packed *slot,
-                        unsigned stride_words, unsigned offset, unsigned count,
+                        unsigned stride_words, unsigned count,
                         struct pipe_stream_output_target *target)
 {
         unsigned stride = stride_words * 4;
@@ -1300,7 +1300,7 @@ panfrost_emit_streamout(struct panfrost_batch *batch,
                               PAN_BO_ACCESS_FRAGMENT);
 
         /* We will have an offset applied to get alignment */
-        mali_ptr addr = bo->gpu + target->buffer_offset + (offset * stride);
+        mali_ptr addr = bo->gpu + target->buffer_offset + (pan_so_target(target)->offset * stride);
 
         pan_pack(slot, ATTRIBUTE_BUFFER, cfg) {
                 cfg.pointer = (addr & ~63);
@@ -1713,7 +1713,6 @@ panfrost_emit_varying_descriptor(struct panfrost_batch *batch,
         for (unsigned i = 0; i < ctx->streamout.num_targets; ++i) {
                 streamout_offsets[i] = panfrost_streamout_offset(
                                         so->stride[i],
-                                        ctx->streamout.offsets[i],
                                         ctx->streamout.targets[i]);
         }
 
@@ -1749,7 +1748,6 @@ panfrost_emit_varying_descriptor(struct panfrost_batch *batch,
         for (unsigned i = 0; i < ctx->streamout.num_targets; ++i) {
                 panfrost_emit_streamout(batch, &varyings[xfb_base + i],
                                         so->stride[i],
-                                        ctx->streamout.offsets[i],
                                         out_count,
                                         ctx->streamout.targets[i]);
         }
index 640fe9ee30918802f14bca0432ff44c5bfc81aa1..23b5564ae187cbbdba91d2443ff7015294aac461 100644 (file)
@@ -245,7 +245,7 @@ panfrost_update_streamout_offsets(struct panfrost_context *ctx)
 
                 count = u_stream_outputs_for_vertices(ctx->active_prim,
                                                       ctx->vertex_count);
-                ctx->streamout.offsets[i] += count;
+                pan_so_target(ctx->streamout.targets[i])->offset += count;
         }
 }
 
@@ -358,7 +358,9 @@ panfrost_draw_vbo(
                         cfg.index_count = info->count;
                 } else {
                         ctx->offset_start = info->start;
-                        cfg.index_count = ctx->vertex_count;
+                        cfg.index_count = info->count_from_stream_output ?
+                                pan_so_target(info->count_from_stream_output)->offset :
+                                ctx->vertex_count;
                 }
         }
 
@@ -1360,7 +1362,7 @@ panfrost_create_stream_output_target(struct pipe_context *pctx,
 {
         struct pipe_stream_output_target *target;
 
-        target = rzalloc(pctx, struct pipe_stream_output_target);
+        target = &rzalloc(pctx, struct panfrost_streamout_target)->base;
 
         if (!target)
                 return NULL;
@@ -1396,7 +1398,7 @@ panfrost_set_stream_output_targets(struct pipe_context *pctx,
 
         for (unsigned i = 0; i < num_targets; i++) {
                 if (offsets[i] != -1)
-                        so->offsets[i] = offsets[i];
+                        pan_so_target(targets[i])->offset = offsets[i];
 
                 pipe_so_target_reference(&so->targets[i], targets[i]);
         }
index b7cec61aa684b1698b094e0c835a2a24a294a168..ac3e07defd403183240e056008fd70cbc0539695 100644 (file)
@@ -86,9 +86,13 @@ struct panfrost_fence {
         bool signaled;
 };
 
+struct panfrost_streamout_target {
+        struct pipe_stream_output_target base;
+        uint32_t offset;
+};
+
 struct panfrost_streamout {
         struct pipe_stream_output_target *targets[PIPE_MAX_SO_BUFFERS];
-        uint32_t offsets[PIPE_MAX_SO_BUFFERS];
         unsigned num_targets;
 };
 
@@ -301,6 +305,12 @@ pan_context(struct pipe_context *pcontext)
         return (struct panfrost_context *) pcontext;
 }
 
+static inline struct panfrost_streamout_target *
+pan_so_target(struct pipe_stream_output_target *target)
+{
+        return (struct panfrost_streamout_target *)target;
+}
+
 static inline struct panfrost_shader_state *
 panfrost_get_shader_state(struct panfrost_context *ctx,
                           enum pipe_shader_type st)
index 10bee917807190502e306f598afee306ad35e2bb..2e04d7b83bb78877891e82aa48afcd2ef69dbe95 100644 (file)
@@ -161,6 +161,7 @@ panfrost_get_param(struct pipe_screen *screen, enum pipe_cap param)
         case PIPE_CAP_MAX_STREAM_OUTPUT_SEPARATE_COMPONENTS:
         case PIPE_CAP_MAX_STREAM_OUTPUT_INTERLEAVED_COMPONENTS:
                 return is_bifrost ? 0 : 64;
+        case PIPE_CAP_STREAM_OUTPUT_PAUSE_RESUME:
         case PIPE_CAP_STREAM_OUTPUT_INTERLEAVE_BUFFERS:
                 return is_bifrost ? 0 : 1;