Bug 105994

Summary: surface state leak when creating and destroying image views with aspectMask depth and stencil
Product: Mesa Reporter: Craig Stout <cstout>
Component: Drivers/Vulkan/intelAssignee: Lionel Landwerlin <lionel.g.landwerlin>
Status: RESOLVED FIXED QA Contact: Intel 3D Bugs Mailing List <intel-3d-bugs>
Severity: normal    
Priority: medium CC: jason
Version: 17.3   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Craig Stout 2018-04-11 22:48:23 UTC
--------------------------------------------
On mesa 17.3, function anv_CreateImageView:

iview->n_planes = anv_image_aspect_get_planes(iview->aspect_mask);

    iview->aspect_mask is 0x6, n_planes is 1

anv_foreach_image_aspect_bit(iaspect_bit, image, expanded_aspects) {

    expanded_aspects is 0x6, the loop runs *twice*

iview->planes[vplane].optimal_sampler_surface_state.state = alloc_surface_state(device);
         iview->planes[vplane].general_sampler_surface_state.state = alloc_surface_state(device);

    Allocated surface state for vplane 0 and 1

----------------------------------
In function anv_DestroyImageView:

for (uint32_t plane = 0; plane < iview->n_planes; plane++) {

Loop runs only once.
Comment 1 Lionel Landwerlin 2018-04-12 18:38:49 UTC
Thanks for the report Craig, just sent a fix for this : https://patchwork.freedesktop.org/patch/216846/
Comment 2 Craig Stout 2018-04-12 18:42:17 UTC
I'll give it a try.
Comment 3 Craig Stout 2018-04-12 18:50:15 UTC
I'm seeing this message:

INTEL-MESA: error: ../../third_party/mesa/src/intel/vulkan/genX_cmd_buffer.c:971 ASSERT: iview->n_planes == 1
Comment 4 Lionel Landwerlin 2018-04-12 20:17:35 UTC
Hm.. Either we don't have a test covering this or asserts are disabled our CI :(
Comment 5 Mark Janes 2018-04-12 21:00:09 UTC
Asserts are on in CI
Comment 6 Lionel Landwerlin 2018-04-12 21:00:58 UTC
Thanks, just noticed it's an anv_assert() which just prints out something.
Running a new patch now.
Comment 7 Lionel Landwerlin 2018-04-12 22:02:57 UTC
v2 sent.
Comment 8 Craig Stout 2018-04-13 18:33:31 UTC
v2 looks good to me.
Comment 9 Lionel Landwerlin 2018-04-13 18:46:56 UTC
Fixed in :

commit 0a6547014fbe5371f5b7253f2c2640ad0026b184 
Author: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Date:   Thu Apr 12 11:06:47 2018 -0700

    anv: fix number of planes for depth & stencil
    

Thanks all!

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.