etnaviv: drm: fix size limit in etna_cmd_stream_realloc
authorLucas Stach <l.stach@pengutronix.de>
Thu, 6 Jan 2022 17:58:01 +0000 (18:58 +0100)
committerMarge Bot <emma+marge@anholt.net>
Mon, 10 Jan 2022 15:38:27 +0000 (15:38 +0000)
The intended limit for command stream size is 64KB, as this is what old
kernels can reliably do and what allows for maximum number of queued
streams on newer kernels. However, due to unit confusion with the size
member, which is in dwords, the submitted streams could grow up to
~128KB. Fix this by using the proper limit in dwords.

Flushing due to some limits being exceeded is not an issue, but is
expected with certain workloads, so lower the severity of the message
being emitted in this case to debug level.

Cc: mesa-stable
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14425>

src/etnaviv/drm/etnaviv_cmd_stream.c

index 0ddf472..cb1fa7c 100644 (file)
@@ -56,13 +56,13 @@ void etna_cmd_stream_realloc(struct etna_cmd_stream *stream, size_t n)
        void *buffer;
 
        /*
-        * Increase the command buffer size by 1 kiB. Here we pick 1 kiB
+        * Increase the command buffer size by 4 kiB. Here we pick 4 kiB
         * increment to prevent it from growing too much too quickly.
         */
        size = ALIGN(stream->size + n, 1024);
 
        /* Command buffer is too big for older kernel versions */
-       if (size >= 32768)
+       if (size > 0x4000)
                goto error;
 
        buffer = realloc(stream->buffer, size * 4);
@@ -75,7 +75,7 @@ void etna_cmd_stream_realloc(struct etna_cmd_stream *stream, size_t n)
        return;
 
 error:
-       WARN_MSG("command buffer too long, forcing flush.");
+       DEBUG_MSG("command buffer too long, forcing flush.");
        etna_cmd_stream_force_flush(stream);
 }