etnaviv: drm: Be able to mark end of context init

Add etna_cmd_stream_mark_end_of_context_init(..) which stores the current
offset of the cmd stream as offset_end_of_context_init. This information
will be used to downgrade a cmd stream flush to a noop.

Signed-off-by: Christian Gmeiner <cgmeiner@igalia.com>
Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25849>
This commit is contained in:
Christian Gmeiner
2023-10-23 09:51:19 +02:00
committed by Marge Bot
parent 2c62fdc8a7
commit 4c8fad4fd8
3 changed files with 19 additions and 0 deletions

View File

@@ -230,6 +230,9 @@ void etna_cmd_stream_flush(struct etna_cmd_stream *stream, int in_fence_fd,
if (gpu->dev->use_softpin)
req.flags |= ETNA_SUBMIT_SOFTPIN;
if (stream->offset == priv->offset_end_of_context_init && !out_fence_fd)
is_noop = true;
if (unlikely(is_noop))
ret = 0;
else
@@ -254,6 +257,7 @@ void etna_cmd_stream_flush(struct etna_cmd_stream *stream, int in_fence_fd,
priv->submit.nr_relocs = 0;
priv->submit.nr_pmrs = 0;
priv->nr_bos = 0;
priv->offset_end_of_context_init = 0;
}
void etna_cmd_stream_reloc(struct etna_cmd_stream *stream,
@@ -284,6 +288,18 @@ void etna_cmd_stream_ref_bo(struct etna_cmd_stream *stream, struct etna_bo *bo,
bo2idx(stream, bo, flags);
}
void etna_cmd_stream_mark_end_of_context_init(struct etna_cmd_stream *stream)
{
struct etna_cmd_stream_priv *priv = etna_cmd_stream_priv(stream);
/*
* All commands before the end of context init are guaranteed to only alter GPU internal
* state and have no externally visible side effects, so we can skip the submit if the
* command buffer contains only context init commands.
*/
priv->offset_end_of_context_init = stream->offset;
}
void etna_cmd_stream_perf(struct etna_cmd_stream *stream, const struct etna_perf *p)
{
struct etna_cmd_stream_priv *priv = etna_cmd_stream_priv(stream);

View File

@@ -206,6 +206,8 @@ void etna_cmd_stream_reloc(struct etna_cmd_stream *stream, const struct etna_rel
void etna_cmd_stream_ref_bo(struct etna_cmd_stream *stream,
struct etna_bo *bo, uint32_t flags);
void etna_cmd_stream_mark_end_of_context_init(struct etna_cmd_stream *stream);
/* performance monitoring functions:
*/

View File

@@ -134,6 +134,7 @@ struct etna_cmd_stream_priv {
struct etna_pipe *pipe;
uint32_t last_timestamp;
uint32_t offset_end_of_context_init;
/* submit ioctl related tables: */
struct {