[Mesa-dev] [PATCH 3/6] llvmpipe: allocate regular texture memory upfront

sroland at vmware.com sroland at vmware.com
Tue Jul 1 12:05:04 PDT 2014


From: Roland Scheidegger <sroland at vmware.com>

The deferred allocation doesn't really make much sense anymore, since we no
longer allocate swizzled/linear memory in chunks and not per level / slice
neither.
This means we could fail resource creation a bit more (could already fail in
theory anyway) but should not fail maps later (right now, callers can't deal
with neither really).
---
 src/gallium/drivers/llvmpipe/lp_texture.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/gallium/drivers/llvmpipe/lp_texture.c b/src/gallium/drivers/llvmpipe/lp_texture.c
index a156449..f95b2a2 100644
--- a/src/gallium/drivers/llvmpipe/lp_texture.c
+++ b/src/gallium/drivers/llvmpipe/lp_texture.c
@@ -59,6 +59,8 @@ static struct llvmpipe_resource resource_list;
 #endif
 static unsigned id_counter = 0;
 
+static void
+alloc_image_data(struct llvmpipe_resource *lpr);
 
 /**
  * Conventional allocation path for non-display textures:
@@ -247,6 +249,11 @@ llvmpipe_resource_create(struct pipe_screen *_screen,
          /* texture map */
          if (!llvmpipe_texture_layout(screen, lpr))
             goto fail;
+
+         alloc_image_data(lpr);
+         if (!lpr->tex_data) {
+            goto fail;
+         }
       }
    }
    else {
-- 
1.9.1


More information about the mesa-dev mailing list