From: Alyssa Rosenzweig Date: Tue, 6 Aug 2019 23:43:28 +0000 (-0700) Subject: panfrost: Import streamout data structures X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5ff797356010933a92b0b2651db72eac9866704c;p=mesa.git panfrost: Import streamout data structures Pretty much copypasted from v3d to jumpstart us. Signed-off-by: Alyssa Rosenzweig --- diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c index 2fc5ac36197..26df0caa706 100644 --- a/src/gallium/drivers/panfrost/pan_context.c +++ b/src/gallium/drivers/panfrost/pan_context.c @@ -1,5 +1,6 @@ /* * © Copyright 2018 Alyssa Rosenzweig + * Copyright © 2014-2017 Broadcom * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -2670,7 +2671,22 @@ panfrost_set_stream_output_targets(struct pipe_context *pctx, struct pipe_stream_output_target **targets, const unsigned *offsets) { - /* STUB */ + struct panfrost_context *ctx = pan_context(pctx); + struct panfrost_streamout *so = &ctx->streamout; + + assert(num_targets <= ARRAY_SIZE(so->targets)); + + for (unsigned i = 0; i < num_targets; i++) { + if (offsets[i] != -1) + so->offsets[i] = offsets[i]; + + pipe_so_target_reference(&so->targets[i], targets[i]); + } + + for (unsigned i = 0; i < so->num_targets; i++) + pipe_so_target_reference(&so->targets[i], NULL); + + so->num_targets = num_targets; } static void diff --git a/src/gallium/drivers/panfrost/pan_context.h b/src/gallium/drivers/panfrost/pan_context.h index 9a34e243b74..4e32a691200 100644 --- a/src/gallium/drivers/panfrost/pan_context.h +++ b/src/gallium/drivers/panfrost/pan_context.h @@ -88,6 +88,12 @@ struct panfrost_fence { int fd; }; +struct panfrost_streamout { + struct pipe_stream_output_target *targets[PIPE_MAX_SO_BUFFERS]; + uint32_t offsets[PIPE_MAX_SO_BUFFERS]; + unsigned num_targets; +}; + struct panfrost_context { /* Gallium context */ struct pipe_context base; @@ -106,6 +112,7 @@ struct panfrost_context { unsigned draw_modes; struct pipe_framebuffer_state pipe_framebuffer; + struct panfrost_streamout streamout; struct panfrost_memory cmdstream_persistent; struct panfrost_memory scratchpad;