<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Nov 21, 2017 at 10:56 AM, Chad Versace <span dir="ltr"><<a href="mailto:chadversary@chromium.org" target="_blank">chadversary@chromium.org</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 Wed 08 Nov 2017, Jason Ekstrand wrote:<br>
</span><div><div class="h5">> This function is used to determine when we need to re-allocate a<br>
> miptree. Since we do nothing different in miptree allocation for<br>
> sRGB vs. linear, loosening this should be safe and may lead to less<br>
> copying and reallocating in some odd cases.<br>
><br>
> Cc: "17.3" <<a href="mailto:mesa-stable@lists.freedesktop.org">mesa-stable@lists.<wbr>freedesktop.org</a>><br>
> Cc: Kenneth Graunke <<a href="mailto:kenneth@whitecape.org">kenneth@whitecape.org</a>><br>
> ---<br>
> src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.c | 6 ++++--<br>
> src/mesa/drivers/dri/i965/<wbr>intel_tex.c | 2 +-<br>
> src/mesa/drivers/dri/i965/<wbr>intel_tex_obj.h | 4 ++--<br>
> src/mesa/drivers/dri/i965/<wbr>intel_tex_validate.c | 2 +-<br>
> 4 files changed, 8 insertions(+), 6 deletions(-)<br>
><br>
> diff --git a/src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.c<br>
> index 82f5a81..47cfccc 100644<br>
> --- a/src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.c<br>
> +++ b/src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.c<br>
> @@ -1298,7 +1298,8 @@ intel_miptree_match_image(<wbr>struct intel_mipmap_tree *mt,<br>
> if (mt->etc_format != MESA_FORMAT_NONE)<br>
> mt_format = mt->etc_format;<br>
><br>
> - if (image->TexFormat != mt_format)<br>
> + if (_mesa_get_srgb_format_linear(<wbr>image->TexFormat) !=<br>
> + _mesa_get_srgb_format_linear(<wbr>mt_format))<br>
> return false;<br>
><br>
> intel_get_image_dims(image, &width, &height, &depth);<br>
> @@ -1537,7 +1538,8 @@ intel_miptree_copy_slice(<wbr>struct brw_context *brw,<br>
> assert(src_layer < get_num_phys_layers(&src_mt-><wbr>surf,<br>
> src_level - src_mt->first_level));<br>
><br>
> - assert(src_mt->format == dst_mt->format);<br>
> + assert(_mesa_get_srgb_format_<wbr>linear(src_mt->format) ==<br>
> + _mesa_get_srgb_format_linear(<wbr>dst_mt->format));<br>
><br>
> if (dst_mt->compressed) {<br>
> unsigned int i, j;<br>
> diff --git a/src/mesa/drivers/dri/i965/<wbr>intel_tex.c b/src/mesa/drivers/dri/i965/<wbr>intel_tex.c<br>
> index 65a1cb3..0650b6e 100644<br>
> --- a/src/mesa/drivers/dri/i965/<wbr>intel_tex.c<br>
> +++ b/src/mesa/drivers/dri/i965/<wbr>intel_tex.c<br>
> @@ -176,7 +176,7 @@ intel_alloc_texture_storage(<wbr>struct gl_context *ctx,<br>
> intel_texobj->needs_validate = false;<br>
> intel_texobj->validated_first_<wbr>level = 0;<br>
> intel_texobj->validated_last_<wbr>level = levels - 1;<br>
> - intel_texobj->_Format = intel_texobj->mt->format;<br>
> + intel_texobj->_Format = first_image->TexFormat;<br>
<br>
</div></div>Why this line? Since all format comparisons, where appropriate, convert<br>
sRGB to linear pre-comparison, does it make any real difference whether<br>
intel_texobj->_Format is mt->format or first_image->TexFormat?<br>
<br>
It *feels* cleaner to use the incoming TexFormat here rather than<br>
mt->format. But I want to know if if this line was required to fix<br>
anything.<br></blockquote><div><br></div><div>Looking at the code again, I think it is. The way this block of code works is that the miptree gets its format from first_image and the texobj gets its format from the miptree. Previously, if the format changed between UNORM and sRGB, we would create a new miptree with the new format and the texobj would get the new format. With this change, we no longer create a new miptree but we still can't let the texture object and image formats get out of sync.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Due to interaction with below hunk from blorp, are we now disabling fast clears<br>
in more cases than previously?<br>
<br>
# brw_blorp.c:set_write_<wbr>disables()<br>
/* We store clear colors as floats or uints as needed. If there are<br>
* texture views in play, the formats will not properly be respected<br>
* during resolves because the resolve operations only know about the<br>
* miptree and not the renderbuffer.<br>
*/<br>
if (irb->Base.Base.Format != irb->mt->format)<br>
can_fast_clear = false;<span class=""><br></span></blockquote><div><br></div><div>Ugh... Fortunately, I think that only happens in some rather obscure render-to-texture cases.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">
> return true;<br>
> }<br>
> diff --git a/src/mesa/drivers/dri/i965/<wbr>intel_tex_obj.h b/src/mesa/drivers/dri/i965/<wbr>intel_tex_obj.h<br>
> index 27c18b7..526f5ce 100644<br>
> --- a/src/mesa/drivers/dri/i965/<wbr>intel_tex_obj.h<br>
> +++ b/src/mesa/drivers/dri/i965/<wbr>intel_tex_obj.h<br>
> @@ -57,8 +57,8 @@ struct intel_texture_object<br>
> bool needs_validate;<br>
><br>
> /* Mesa format for the validated texture object. For non-views this<br>
> - * will always be the same as mt->format. For views, it may differ<br>
> - * since the mt is shared across views with differing formats.<br>
> + * will always be the same as texObj->Image[0][0].TexFormat. For views, it<br>
> + * may differ since the mt is shared across views with differing formats.<br>
> */<br>
> mesa_format _Format;<br>
<br>
</span>Same question as above. Again, I feel like this is the right thing to<br>
do.<span class=""><br></span></blockquote><div><br></div><div>I think it's the same answer.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">
> diff --git a/src/mesa/drivers/dri/i965/<wbr>intel_tex_validate.c b/src/mesa/drivers/dri/i965/<wbr>intel_tex_validate.c<br>
> index 2b7798c..ef7f907 100644<br>
> --- a/src/mesa/drivers/dri/i965/<wbr>intel_tex_validate.c<br>
> +++ b/src/mesa/drivers/dri/i965/<wbr>intel_tex_validate.c<br>
> @@ -174,7 +174,7 @@ intel_finalize_mipmap_tree(<wbr>struct brw_context *brw, GLuint unit)<br>
><br>
> intelObj->validated_first_<wbr>level = validate_first_level;<br>
> intelObj->validated_last_level = validate_last_level;<br>
> - intelObj->_Format = intelObj->mt->format;<br>
> + intelObj->_Format = firstImage->base.Base.<wbr>TexFormat,<br>
> intelObj->needs_validate = false;<br>
> }<br>
><br>
> --<br>
> 2.5.0.400.gff86faf<br>
><br>
</span>> ______________________________<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>
</blockquote></div><br></div></div>