Module: Mesa Branch: main Commit: 02bd6bea03e041f08aa04cad8fe85d0989ce0443 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=02bd6bea03e041f08aa04cad8fe85d0989ce0443
Author: Lucas Stach <[email protected]> Date: Mon Nov 6 18:49:09 2023 +0100 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 <[email protected]> Reviewed-by: Christian Gmeiner <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26078> --- src/etnaviv/drm/etnaviv_cmd_stream.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/etnaviv/drm/etnaviv_cmd_stream.c b/src/etnaviv/drm/etnaviv_cmd_stream.c index 89e28e21b1a..9f7a8dc3fd2 100644 --- a/src/etnaviv/drm/etnaviv_cmd_stream.c +++ b/src/etnaviv/drm/etnaviv_cmd_stream.c @@ -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]);
