etnaviv: drm: fix size limit in etna_cmd_stream_realloc

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>
This commit is contained in:
Lucas Stach 2022-01-06 18:58:01 +01:00 committed by Marge Bot
parent 22d796feb8
commit ccfd5054a4
1 changed files with 3 additions and 3 deletions

View 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);
}