etnaviv: drm: don't update cmdstream timestamp when skipping submit

When we skip the submit when there is no GPU work queued we must not
update the cmdstream timestamp with the fence from the submit request
as it will never be filled in by the kernel, effectively replacing
the cmdstream timestamp with 0. This causes following fence waits
to fail.

Fixes: 148658638e7f ("etnaviv: drm: Be able to mark end of context init")
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26078>
This commit is contained in:
Lucas Stach 2023-11-06 18:49:09 +01:00 committed by Marge Bot
parent abf8b47e02
commit 02bd6bea03

View file

@ -203,12 +203,11 @@ void etna_cmd_stream_flush(struct etna_cmd_stream *stream, int in_fence_fd,
int *out_fence_fd, bool is_noop)
{
struct etna_cmd_stream_priv *priv = etna_cmd_stream_priv(stream);
int ret, id = priv->pipe->id;
struct etna_gpu *gpu = priv->pipe->gpu;
struct drm_etnaviv_gem_submit req = {
.pipe = gpu->core,
.exec_state = id,
.exec_state = priv->pipe->id,
.bos = VOID2U64(priv->submit.bos),
.nr_bos = priv->submit.nr_bos,
.relocs = VOID2U64(priv->submit.relocs),
@ -233,16 +232,17 @@ void etna_cmd_stream_flush(struct etna_cmd_stream *stream, int in_fence_fd,
if (stream->offset == priv->offset_end_of_context_init && !out_fence_fd)
is_noop = true;
if (unlikely(is_noop))
ret = 0;
else
if (likely(!is_noop)) {
int ret;
ret = drmCommandWriteRead(gpu->dev->fd, DRM_ETNAVIV_GEM_SUBMIT,
&req, sizeof(req));
if (ret)
ERROR_MSG("submit failed: %d (%s)", ret, strerror(errno));
else
priv->last_timestamp = req.fence;
if (ret)
ERROR_MSG("submit failed: %d (%s)", ret, strerror(errno));
else
priv->last_timestamp = req.fence;
}
for (uint32_t i = 0; i < priv->nr_bos; i++)
etna_bo_del(priv->bos[i]);