<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Aug 10, 2015 at 4:15 PM, Ben Widawsky <span dir="ltr"><<a href="mailto:benjamin.widawsky@intel.com" target="_blank">benjamin.widawsky@intel.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">NOTE: The commit message is retained for posterity, however there were some<br>
changes in the code since the patch was originally written that may make the old<br>
commit message false. Starting with v4 is actually much simpler than the<br>
original change.<br>
<br>
This patch is needed to help keep some of the churn down later in the series<br>
(IIRC)<br>
<br>
v3: Rebased + redone on top of the layout flags + tiling patch.<br>
<br>
Original commit message:<br>
<br>
IMHO, intel_miptree_choose_tiling() is an unfortunate incarnation because it<br>
conflates what is permitted vs. what is desirable. This makes doing any sort of<br>
"fallback" operations after the fact somewhat kludgey.<br>
<br>
The original code basically says:<br>
"if we requested x XOR y-tiled, and the region > aperture; then try to x-tiled"<br>
<br>
Better would be:<br>
"if we *received* x OR y-tiled, and the region > aperture; then try to x-tiled"<br>
<br>
Optimally it is:<br>
"if we can use either x OR y-tiled and got y-tiled, and the region > aperture; then try<br>
x tiled"<br>
<br>
This patch actually addresses two potential issues:<br>
1.  As far as I can tell, drm_intel_gem_bo_alloc_tiled() which is invariably<br>
called, can potentially change the tiling type. Therefore, we shouldn't be<br>
checking the requested tiling type, but rather the granted tiling<br>
2. The existing code can fall back to X-tiled even if choose_tiling said<br>
X-tiling was not okay.<br>
<br>
Neither of these are probably actually an issue, but this simply makes the code<br>
correct.<br>
<br>
The changes behavior originally introduced here:<br>
commit cbe24ff7c8d69a6d378d9c2cce2bc117517f4302<br>
Author: Kenneth Graunke <<a href="mailto:kenneth@whitecape.org" target="_blank">kenneth@whitecape.org</a>><br>
Date:   Wed Apr 10 13:49:16 2013 -0700<br>
<br>
    intel: Fall back to X-tiling when larger than estimated aperture size.<br>
<br>
v2: This was rebased on a recent commit than Anuj pushed since I originally<br>
authored the patch.<br>
commit 524a729f68c15da3fc6c42b3158a13e0b84c2728<br>
Author: Anuj Phogat <<a href="mailto:anuj.phogat@gmail.com" target="_blank">anuj.phogat@gmail.com</a>><br>
Date:   Tue Feb 17 10:40:58 2015 -0800<br>
<br>
    i965: Fix condition to use Y tiling in blitter in intel_miptree_create()<br>
<br>
v3: Removed the check against X-tiling since its removal in<br>
9f78e27fc60b3473b708ab4ca04e4ebd6be6cf4e<br>
<br>
Signed-off-by: Ben Widawsky <<a href="mailto:ben@bwidawsk.net" target="_blank">ben@bwidawsk.net</a>><br>
---<br>
 src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 7 +++----<br>
 1 file changed, 3 insertions(+), 4 deletions(-)<br>
<br>
diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c<br>
index e85c3f0..e0a7f11 100644<br>
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c<br>
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c<br>
@@ -651,10 +651,7 @@ intel_miptree_create(struct brw_context *brw,<br>
       total_height = ALIGN(total_height, 64);<br>
    }<br>
<br>
-   bool y_or_x = false;<br>
-<br>
    if (mt->tiling == (I915_TILING_Y | I915_TILING_X)) {<br>
-      y_or_x = true;<br>
       mt->tiling = I915_TILING_Y;<br>
    }<br>
<br>
@@ -684,7 +681,9 @@ intel_miptree_create(struct brw_context *brw,<br>
     * BLT engine to support it.  Prior to Sandybridge, the BLT paths can't<br>
     * handle Y-tiling, so we need to fall back to X.<br>
     */<br>
-   if (brw->gen < 6 && y_or_x && mt->bo->size >= brw->max_gtt_map_object_size) {<br>
+   if (brw->gen < 6 &&<br>
+       mt->bo->size >= brw->max_gtt_map_object_size &&<br>
+       mt->tiling == I915_TILING_Y) {<br></blockquote><div>This change might force x tiling on miptrees which specifically asked for Y tiling<br></div><div>using layout flag MIPTREE_LAYOUT_TILING_Y in brw_miptree_choose_tiling().</div><div>This flag is used while allocating mcs buffer which I think is not relevant for</div><div>< gen6? It'll be useful if you can add a comment here explaining how we're</div><div>never gonna hit a case of layout flag MIPTREE_LAYOUT_TILING_Y for < gen6.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
       perf_debug("%dx%d miptree larger than aperture; falling back to X-tiled\n",<br>
                  mt->total_width, mt->total_height);<br>
<span><font color="#888888"><br>
--<br>
2.5.0<br>
<br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank">mesa-dev@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">http://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div></div>