From ccfd5054a4f729ece655ebb7924ed21a84aef7e5 Mon Sep 17 00:00:00 2001 From: Lucas Stach Date: Thu, 6 Jan 2022 18:58:01 +0100 Subject: [PATCH] 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 Reviewed-by: Christian Gmeiner Part-of: --- src/etnaviv/drm/etnaviv_cmd_stream.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/etnaviv/drm/etnaviv_cmd_stream.c b/src/etnaviv/drm/etnaviv_cmd_stream.c index 0ddf472..cb1fa7c 100644 --- a/src/etnaviv/drm/etnaviv_cmd_stream.c +++ b/src/etnaviv/drm/etnaviv_cmd_stream.c @@ -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); } -- 2.7.4