<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Nov 29, 2016 at 1:56 PM, Ilia Mirkin <span dir="ltr"><<a href="mailto:imirkin@alum.mit.edu" target="_blank">imirkin@alum.mit.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Tue, Nov 29, 2016 at 3:44 PM, Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>> wrote:<br>
><br>
><br>
> On Tue, Nov 29, 2016 at 12:24 PM, Nanley Chery <<a href="mailto:nanleychery@gmail.com">nanleychery@gmail.com</a>><br>
> wrote:<br>
>><br>
>> On Mon, Nov 28, 2016 at 03:45:41PM -0800, Jason Ekstrand wrote:<br>
>> > ---<br>
>> >  src/intel/vulkan/genX_cmd_<wbr>buffer.c | 51<br>
>> > ++++++++++++++++++++++++++++++<wbr>++++++--<br>
>> >  1 file changed, 49 insertions(+), 2 deletions(-)<br>
>> ><br>
>><br>
>> This patch does not match the one you've merged<br>
>> (<wbr>d4ef87c1bb4290293148cbd6cb7827<wbr>64df38f8f4). The committed code<br>
>> introduces the following buggy hunk:<br>
>><br>
>> @@ -2106,7 +2152,12 @@ cmd_buffer_emit_depth_stencil(<wbr>struct anv_cmd_buffer<br>
>> *cmd_buffer)<br>
>>         * be combined with a stencil buffer so we use D32_FLOAT instead.<br>
>>         */<br>
>>        anv_batch_emit(&cmd_buffer-><wbr>batch, GENX(3DSTATE_DEPTH_BUFFER), db)<br>
>> {<br>
>> -         db.SurfaceType          = SURFTYPE_2D;<br>
>> +         if (has_stencil) {<br>
>> +            db.SurfaceType       = SURFTYPE_2D;<br>
>> +<br>
>> depth_stencil_surface_type(<wbr>image->stencil_surface.isl.<wbr>dim);<br>
<br>
</span>this line is a no-op.<br></blockquote><div><br></div><div>Drp... Thanks!  This is why I should have sent a v2 instead of saying, "That was a trivial change".  Patch incoming.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">
>> +         } else {<br>
>> +            db.SurfaceType       = SURFTYPE_2D;<br>
>> +         }<br>
>>           db.SurfaceFormat        = D32_FLOAT;<br>
>>           db.Width                = fb->width - 1;<br>
>>           db.Height               = fb->height - 1;<br>
><br>
><br>
> Yes, it introduces that hunk.  What's buggy about it?  The old code made<br>
> Jenkins explode.  Maybe I should have sent a v2.<br>
><br>
>><br>
>><br>
>> -Nanley<br>
>><br>
>> > diff --git a/src/intel/vulkan/genX_cmd_<wbr>buffer.c<br>
>> > b/src/intel/vulkan/genX_cmd_<wbr>buffer.c<br>
>> > index a965cd6..c953b93 100644<br>
>> > --- a/src/intel/vulkan/genX_cmd_<wbr>buffer.c<br>
>> > +++ b/src/intel/vulkan/genX_cmd_<wbr>buffer.c<br>
>> > @@ -2033,6 +2033,51 @@ genX(cmd_buffer_emit_gen7_<wbr>depth_flush)(struct<br>
>> > anv_cmd_buffer *cmd_buffer)<br>
>> >     }<br>
>> >  }<br>
>> ><br>
>> > +static uint32_t<br>
>> > +depth_stencil_surface_type(<wbr>enum isl_surf_dim dim)<br>
>> > +{<br>
>> > +   switch (dim) {<br>
>> > +   case ISL_SURF_DIM_1D:<br>
>> > +      if (GEN_GEN >= 9) {<br>
>> > +         /* From the Sky Lake PRM, 3DSTATAE_DEPTH_BUFFER::<wbr>SurfaceType<br>
>> > +          *<br>
>> > +          *    Programming Notes:<br>
>> > +          *    The Surface Type of the depth buffer must be the same as<br>
>> > the<br>
>> > +          *    Surface Type of the render target(s) (defined in<br>
>> > +          *    SURFACE_STATE), unless either the depth buffer or render<br>
>> > +          *    targets are SURFTYPE_NULL (see exception below for SKL).<br>
>> > 1D<br>
>> > +          *    surface type not allowed for depth surface and stencil<br>
>> > surface.<br>
>> > +          *<br>
>> > +          *    Workaround:<br>
>> > +          *    If depth/stencil is enabled with 1D render target,<br>
>> > +          *    depth/stencil surface type needs to be set to 2D surface<br>
>> > type<br>
>> > +          *    and height set to 1. Depth will use (legacy) TileY and<br>
>> > stencil<br>
>> > +          *    will use TileW. For this case only, the Surface Type of<br>
>> > the<br>
>> > +          *    depth buffer can be 2D while the Surface Type of the<br>
>> > render<br>
>> > +          *    target(s) are 1D, representing an exception to a<br>
>> > programming<br>
>> > +          *    note above.<br>
>> > +          */<br>
>> > +         return SURFTYPE_2D;<br>
>> > +      } else {<br>
>> > +         return SURFTYPE_1D;<br>
>> > +      }<br>
>> > +   case ISL_SURF_DIM_2D:<br>
>> > +      return SURFTYPE_2D;<br>
>> > +   case ISL_SURF_DIM_3D:<br>
>> > +      if (GEN_GEN >= 9) {<br>
>> > +         /* The Sky Lake docs list the value for 3D as "Reserved".<br>
>> > However,<br>
>> > +          * they have the exact same layout as 2D arrays on gen9+, so<br>
>> > we can<br>
>> > +          * just use 2D here.<br>
>> > +          */<br>
>> > +         return SURFTYPE_2D;<br>
>> > +      } else {<br>
>> > +         return SURFTYPE_3D;<br>
>> > +      }<br>
>> > +   default:<br>
>> > +      unreachable("Invalid surface dimension");<br>
>> > +   }<br>
>> > +}<br>
>> > +<br>
>> >  static void<br>
>> >  cmd_buffer_emit_depth_stencil(<wbr>struct anv_cmd_buffer *cmd_buffer)<br>
>> >  {<br>
>> > @@ -2054,7 +2099,8 @@ cmd_buffer_emit_depth_stencil(<wbr>struct<br>
>> > anv_cmd_buffer *cmd_buffer)<br>
>> >     /* Emit 3DSTATE_DEPTH_BUFFER */<br>
>> >     if (has_depth) {<br>
>> >        anv_batch_emit(&cmd_buffer-><wbr>batch, GENX(3DSTATE_DEPTH_BUFFER),<br>
>> > db) {<br>
>> > -         db.SurfaceType                   = SURFTYPE_2D;<br>
>> > +         db.SurfaceType                   =<br>
>> > +            depth_stencil_surface_type(<wbr>image->depth_surface.isl.dim);<br>
>> >           db.DepthWriteEnable              = true;<br>
>> >           db.StencilWriteEnable            = has_stencil;<br>
>> ><br>
>> > @@ -2106,7 +2152,8 @@ cmd_buffer_emit_depth_stencil(<wbr>struct<br>
>> > anv_cmd_buffer *cmd_buffer)<br>
>> >         * be combined with a stencil buffer so we use D32_FLOAT instead.<br>
>> >         */<br>
>> >        anv_batch_emit(&cmd_buffer-><wbr>batch, GENX(3DSTATE_DEPTH_BUFFER),<br>
>> > db) {<br>
>> > -         db.SurfaceType          = SURFTYPE_2D;<br>
>> > +         db.SurfaceType          =<br>
>> > +            depth_stencil_surface_type(<wbr>image->depth_surface.isl.dim);<br>
>> >           db.SurfaceFormat        = D32_FLOAT;<br>
>> >           db.Width                = fb->width - 1;<br>
>> >           db.Height               = fb->height - 1;<br>
>> > --<br>
>> > 2.5.0.400.gff86faf<br>
>> ><br>
>> > ______________________________<wbr>_________________<br>
>> > mesa-dev mailing list<br>
>> > <a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
>> > <a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
><br>
><br>
><br>
> ______________________________<wbr>_________________<br>
> mesa-dev mailing list<br>
> <a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
> <a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
><br>
</div></div></blockquote></div><br></div></div>