Bug 103899 - Missing clear color now with 'anv: Stop resolving CCS implicitly'
Summary: Missing clear color now with 'anv: Stop resolving CCS implicitly'
Status: RESOLVED NOTABUG
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/Vulkan/intel (show other bugs)
Version: 17.2
Hardware: Other All
: medium normal
Assignee: Intel 3D Bugs Mailing List
QA Contact: Intel 3D Bugs Mailing List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-11-25 01:15 UTC by Craig Stout
Modified: 2017-12-05 00:37 UTC (History)
3 users (show)

See Also:
i915 platform:
i915 features:


Attachments
background color clear missing (4.70 MB, image/jpeg)
2017-11-26 02:25 UTC, Craig Stout
Details

Description Craig Stout 2017-11-25 01:15:17 UTC
An application is clearing the color attachment using VK_ATTACHMENT_LOAD_OP_CLEAR to vkCreateRenderPass, and specifying initialLayout=finalLayout=VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL; 
and specifying the color to vkCmdBeginRenderPass.

The following commit introduced in 17.2 (see below) causes an application to no longer show the background color.

Prior to the change, an implicit resolve was happening at the end of the render pass because the color attachment aux_usage is set to ISL_AUX_USAGE_CCS_D.

Possible api usage error?  Does clearing the color attachment in the render pass require a change in image layout?


commit 08e214632553a3d4166796426640824827c78683
Author: Nanley Chery <nanley.g.chery@intel.com>
Date:   Fri Mar 17 22:36:05 2017 -0700

    anv: Stop resolving CCS implicitly
    
    With an earlier patch from this series, resolves are additionally
    performed on layout transitions. Remove the now unnecessary implicit
    resolves within render passes.
    
    Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
    Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Comment 1 Jason Ekstrand 2017-11-25 16:22:22 UTC
Does this bug reproduce on master?  I recently fixed a nasty bug on master related to this.
Comment 2 Craig Stout 2017-11-26 02:22:12 UTC
Yes I confirmed the behavior exists on master.

You can repro the behavior with the LunarG cube demo:

1) In the driver's x11 swapchain, change the image tiling from X to Y. This is necessary because an aux surface is created only for Y tiled surfaces.

anv_wsi.c (anv_wsi_image_create):
  pass 0 as .isl_tiling_flags instead of ISL_TILING_X_BIT
  pass I915_TILING_Y to anv_gem_set_tiling instead of I915_TILING_X

2) Change the finalLayout in demo_prepare_render_pass

cube.c (demo_prepare_render_pass):
   change finalLayout to VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL instead of VK_IMAGE_LAYOUT_PRESENT_SRC_KHR

So 2) is technically invalid in this case because the image is being presented.

However in my application the image isn't being presented directly.  Instead, the buffer is being imported into another process which reads from the image as a texture.
Comment 3 Craig Stout 2017-11-26 02:25:49 UTC
Created attachment 135715 [details]
background color clear missing
Comment 4 Jason Ekstrand 2017-11-26 02:42:32 UTC
Ok, in that case, I know exactly what bug you're hitting and I'm in the process of fixing it so we can enable modifiers for X11 and Wayland WSI. Expect to see a flood of patches on mesa-dev early next week.
Comment 5 Craig Stout 2017-11-26 03:18:09 UTC
Great.  Will the fixes be applied back to 17.2?
Comment 6 Jason Ekstrand 2017-11-26 04:34:00 UTC
(In reply to Craig Stout from comment #5)
> Great.  Will the fixes be applied back to 17.2?

I was not planning to as the bug cannot be hit with the current upstream X11 and Wayland parts.  Can you hit this with upstream Android it do you need additional patches?
Comment 7 Craig Stout 2017-11-27 20:04:43 UTC
I don't know about Android; I don't typically try this.  How do you go about testing android typically?

For 17.2, this is my only problem.
Comment 8 Jason Ekstrand 2017-11-27 20:30:24 UTC
(In reply to Craig Stout from comment #7)
> I don't know about Android; I don't typically try this.  How do you go about
> testing android typically?

I don't.  I just saw your email address and figured maybe you were going this in ARC.  The only way I can imagine hitting this is either on Android or with extra patches on top.

> For 17.2, this is my only problem.

I think it's reasonable to backport to 17.3 but since it doesn't fix a hittable bug without out-of-tree patches so far as I can tell, I don't think it will get backported to 17.2.  I plan to send the patches today.
Comment 9 Craig Stout 2017-11-28 21:45:59 UTC
I can hit the bug in 17.2 without modifications to mesa.  It's a somewhat complicated use-case: the color attachment that fails to be cleared is read by another process as a texture.
Comment 10 Craig Stout 2017-11-29 22:54:35 UTC
Jason fyi, just retested master and I'm still seeing the problem.
Comment 11 Jason Ekstrand 2017-11-29 23:35:10 UTC
Are you using the hacky INTEL external extension?
Comment 12 Craig Stout 2017-11-29 23:39:36 UTC
No.  For the primary use case, we have a different "custom" (won't call it hacky haha) extension for importing/exporting buffers.

But for the purpose of evaluating latest master, I'm using the recipe described in Comment 2 since it seems to demonstrate the issue in a fairly isolated manner.
Comment 13 Jason Ekstrand 2017-11-30 01:47:51 UTC
(In reply to Craig Stout from comment #12)
> No.  For the primary use case, we have a different "custom" (won't call it
> hacky haha) extension for importing/exporting buffers.
> 
> But for the purpose of evaluating latest master, I'm using the recipe
> described in Comment 2 since it seems to demonstrate the issue in a fairly
> isolated manner.

What image layout are you using when you transfer between processes?
Comment 14 Craig Stout 2017-11-30 03:13:08 UTC
When the image is generated the image layout in the producer's render pass is always VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL.
Comment 15 Jason Ekstrand 2017-12-02 00:54:48 UTC
I'm closing this as NOTABUG becuase it's not something that's possible to hit on upstream mesa without out-of-tree patches.  (Modifying WSI counts as out-of-tree patches).  I'll be sending you an e-mail so that we can continue this discussion and figure out how to solve your problem long-term.


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.