From: Ilia Mirkin Date: Sun, 9 Aug 2020 04:13:14 +0000 (-0400) Subject: panfrost: enable DrawTransformFeedback* X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4c050f222fd4a330413bc24fae447782b35df3fe;p=mesa.git panfrost: enable DrawTransformFeedback* This is needed for ARB_transform_feedback2, which I plan on requiring for ES3. Also update docs/features.txt Signed-off-by: Ilia Mirkin Signed-off-by: Alyssa Rosenzweig Part-of: --- diff --git a/docs/features.txt b/docs/features.txt index 81afea4d0f0..13a96439cd2 100644 --- a/docs/features.txt +++ b/docs/features.txt @@ -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) diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c b/src/gallium/drivers/panfrost/pan_cmdstream.c index c2c54814987..777725d0a26 100644 --- a/src/gallium/drivers/panfrost/pan_cmdstream.c +++ b/src/gallium/drivers/panfrost/pan_cmdstream.c @@ -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]); } diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c index 640fe9ee309..23b5564ae18 100644 --- a/src/gallium/drivers/panfrost/pan_context.c +++ b/src/gallium/drivers/panfrost/pan_context.c @@ -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]); } diff --git a/src/gallium/drivers/panfrost/pan_context.h b/src/gallium/drivers/panfrost/pan_context.h index b7cec61aa68..ac3e07defd4 100644 --- a/src/gallium/drivers/panfrost/pan_context.h +++ b/src/gallium/drivers/panfrost/pan_context.h @@ -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) diff --git a/src/gallium/drivers/panfrost/pan_screen.c b/src/gallium/drivers/panfrost/pan_screen.c index 10bee917807..2e04d7b83bb 100644 --- a/src/gallium/drivers/panfrost/pan_screen.c +++ b/src/gallium/drivers/panfrost/pan_screen.c @@ -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;