zink: massively shrink qbo size for timestamp queries
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Tue, 13 Jun 2023 17:12:37 +0000 (13:12 -0400)
committerMarge Bot <emma+marge@anholt.net>
Wed, 14 Jun 2023 01:22:44 +0000 (01:22 +0000)
timestamp queries can only ever record a single value, so
the qbo only needs to be large enough for that single value

fixes #9092

cc: mesa-stable

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23631>

src/gallium/drivers/zink/zink_query.c

index e7fe5e6..640ea6c 100644 (file)
@@ -368,7 +368,7 @@ qbo_append(struct pipe_screen *screen, struct zink_query *query)
       qbo->buffers[i] = pipe_buffer_create(screen, PIPE_BIND_QUERY_BUFFER,
                                            PIPE_USAGE_STAGING,
                                            /* this is the maximum possible size of the results in a given buffer */
-                                           NUM_QUERIES * get_num_results(query) * sizeof(uint64_t));
+                                           (query->type == PIPE_QUERY_TIMESTAMP ? 1 : NUM_QUERIES) * get_num_results(query) * sizeof(uint64_t));
       if (!qbo->buffers[i])
          goto fail;
    }