Mesa (17.2): gallium/aux: include nr_samples in util_resource_size() computation

Andres Gomez tanty at kemper.freedesktop.org
Wed Dec 20 23:30:49 UTC 2017


Module: Mesa
Branch: 17.2
Commit: 334ae3b0d252331fae68cd7eaa61cef7075a0075
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=334ae3b0d252331fae68cd7eaa61cef7075a0075

Author: Brian Paul <brianp at vmware.com>
Date:   Thu Dec  7 14:47:32 2017 -0700

gallium/aux: include nr_samples in util_resource_size() computation

This function is only used in two places:
1. VMware driver, but only for HUD reporting
2. st/nine state tracker, used for texture memory accounting

Fixes: a69efa9482d ("util: add new util_resource_size() function in
u_resource.[ch]")

Reviewed-by: Roland Scheidegger <sroland at vmware.com>
Reviewed-by: Charmaine Lee <charmainel at vmware.com>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
(cherry picked from commit dde8309cdea5c739983693650105b2f993c5a71c)

---

 src/gallium/auxiliary/util/u_resource.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/util/u_resource.c b/src/gallium/auxiliary/util/u_resource.c
index 66caaae840..ed6c1504fd 100644
--- a/src/gallium/auxiliary/util/u_resource.c
+++ b/src/gallium/auxiliary/util/u_resource.c
@@ -42,6 +42,7 @@ util_resource_size(const struct pipe_resource *res)
    unsigned depth = res->depth0;
    unsigned size = 0;
    unsigned level;
+   unsigned samples = MAX2(1, res->nr_samples);
 
    for (level = 0; level <= res->last_level; level++) {
       unsigned slices;
@@ -54,7 +55,7 @@ util_resource_size(const struct pipe_resource *res)
          slices = res->array_size;
 
       size += (util_format_get_nblocksy(res->format, height) *
-               util_format_get_stride(res->format, width) * slices);
+               util_format_get_stride(res->format, width) * slices * samples);
 
       width  = u_minify(width, 1);
       height = u_minify(height, 1);




More information about the mesa-commit mailing list