nv50,nvc0: Do not resize global residents if unnecessary

Reviewed-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Pierre Moreau <dev@pmoreau.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10711>
This commit is contained in:
Pierre Moreau 2020-05-21 20:35:35 +02:00 committed by Marge Bot
parent cc2cdf88fb
commit 8c066e7a57
2 changed files with 2 additions and 2 deletions

View file

@ -1426,7 +1426,7 @@ nv50_set_global_bindings(struct pipe_context *pipe,
unsigned i;
const unsigned end = start + nr;
if (nv50->global_residents.size <= (end * sizeof(struct pipe_resource *))) {
if (nv50->global_residents.size < (end * sizeof(struct pipe_resource *))) {
const unsigned old_size = nv50->global_residents.size;
if (util_dynarray_resize(&nv50->global_residents, struct pipe_resource *, end)) {
memset((uint8_t *)nv50->global_residents.data + old_size, 0,

View file

@ -1419,7 +1419,7 @@ nvc0_set_global_bindings(struct pipe_context *pipe,
if (!nr)
return;
if (nvc0->global_residents.size <= (end * sizeof(struct pipe_resource *))) {
if (nvc0->global_residents.size < (end * sizeof(struct pipe_resource *))) {
const unsigned old_size = nvc0->global_residents.size;
if (util_dynarray_resize(&nvc0->global_residents, struct pipe_resource *, end)) {
memset((uint8_t *)nvc0->global_residents.data + old_size, 0,