[Mesa-stable] [PATCH 13/53] st/nine: Hack to generate resource if it doesn't exist when getting view

Axel Davy axel.davy at ens.fr
Wed Jan 7 08:36:23 PST 2015


From: Stanislaw Halik <sthalik at misaki.pl>

Buffers in the MANAGED pool are supposed to have the content in a ram buffer,
a copy in VRAM if there is enough memory (driver manages memory and decide when
to delete the buffer in VRAM).

This is not implemented properly in nine, and a VRAM copy is going to be created
when the RAM memory is filled, and the VRAM copy will get synced with the RAM
memory updates.

Due to some issues (in the implementation or in app logic), it can happen
we try to create a sampler view of the resource while we haven't created the
VRAM resource. This hack creates the resource when we hit this case, which prevents
crashing, but doesn't help with the resource content.

This fixes several games crashing at launch.

Acked-by: Axel Davy <axel.davy at ens.fr>
Acked-by: David Heidelberg <david at ixit.cz>
Signed-off-by: Stanislaw Halik <sthalik at misaki.pl>

Cc: "10.4" <mesa-stable at lists.freedesktop.org>
---
 src/gallium/state_trackers/nine/basetexture9.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/gallium/state_trackers/nine/basetexture9.c b/src/gallium/state_trackers/nine/basetexture9.c
index fb5a61a..ccfd199 100644
--- a/src/gallium/state_trackers/nine/basetexture9.c
+++ b/src/gallium/state_trackers/nine/basetexture9.c
@@ -457,6 +457,9 @@ NineBaseTexture9_UpdateSamplerView( struct NineBaseTexture9 *This,
 	if (unlikely(This->format == D3DFMT_NULL))
             return D3D_OK;
         NineBaseTexture9_Dump(This);
+        /* hack due to incorrect POOL_MANAGED handling */
+        NineBaseTexture9_GenerateMipSubLevels(This);
+        resource = This->base.resource;
     }
     assert(resource);
 
-- 
2.1.3



More information about the mesa-stable mailing list