If the lowest (largest) mipmap level is too small to tile, then don't
bother pretending.
Note that this requires initializing pipe->screen before
fd_resource_level_linear() is called.
Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
unsigned
fd6_tile_mode(const struct pipe_resource *tmpl)
{
+ /* if the mipmap level 0 is still too small to be tiled, then don't
+ * bother pretending:
+ */
+ if (fd_resource_level_linear(tmpl, 0))
+ return TILE6_LINEAR;
+
/* basically just has to be a format we can blit, so uploads/downloads
* via linear staging buffer works:
*/
allow_ubwc &= !(fd_mesa_debug & FD_DBG_NOUBWC);
+ pipe_reference_init(&prsc->reference, 1);
+
+ prsc->screen = pscreen;
+
if (screen->tile_mode &&
(tmpl->target != PIPE_BUFFER) &&
!linear) {
- rsc->tile_mode = screen->tile_mode(tmpl);
+ rsc->tile_mode = screen->tile_mode(prsc);
}
- pipe_reference_init(&prsc->reference, 1);
-
- prsc->screen = pscreen;
-
util_range_init(&rsc->valid_buffer_range);
rsc->internal_format = format;