From: Alyssa Rosenzweig Date: Sat, 4 Jan 2020 18:00:50 +0000 (-0500) Subject: panfrost: Cleanup tiling selection logic X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=32851ff71521d203c08e26b3198d96d0f6467bb5;p=mesa.git panfrost: Cleanup tiling selection logic Make it a lot more obvious what we're doing and fix more than a few corner cases in the process. Fixes dEQP-GLES3.functional.buffer.map.write.render_as_index_array.pixel*, and likely others. Signed-off-by: Alyssa Rosenzweig Reviewed-by: Tomeu Vizoso --- diff --git a/src/gallium/drivers/panfrost/pan_resource.c b/src/gallium/drivers/panfrost/pan_resource.c index 0d49d2bb4f7..0ea14a028cd 100644 --- a/src/gallium/drivers/panfrost/pan_resource.c +++ b/src/gallium/drivers/panfrost/pan_resource.c @@ -389,28 +389,29 @@ panfrost_resource_create_bo(struct panfrost_screen *screen, struct panfrost_reso * AFBC: Compressed and renderable (so always desirable for non-scanout * rendertargets). Cheap to sample from. The format is black box, so we * can't read/write from software. - */ - - /* Tiling textures is almost always faster, unless we only use it once */ - - bool is_texture = (res->bind & PIPE_BIND_SAMPLER_VIEW); - bool is_2d = res->depth0 == 1 && res->array_size == 1; - bool is_streaming = (res->usage != PIPE_USAGE_STREAM); - bool is_global = res->bind & PIPE_BIND_GLOBAL; + * + * Tiling textures is almost always faster, unless we only use it once. + * Only a few types of resources can be tiled, ensure the bind is only + * (a combination of) one of the following */ - bool should_tile = is_streaming && is_texture && is_2d && !is_global; + const unsigned valid_binding = + PIPE_BIND_RENDER_TARGET | + PIPE_BIND_BLENDABLE | + PIPE_BIND_SAMPLER_VIEW | + PIPE_BIND_DISPLAY_TARGET; - /* Depth/stencil can't be tiled, only linear or AFBC */ - should_tile &= !(res->bind & PIPE_BIND_DEPTH_STENCIL); + bool is_2d = (res->target == PIPE_TEXTURE_2D); + bool should_tile = (res->usage != PIPE_USAGE_STREAM); + bool can_tile = is_2d && ((res->bind & ~valid_binding) == 0); /* FBOs we would like to checksum, if at all possible */ - bool can_checksum = !(res->bind & (PIPE_BIND_SCANOUT | PIPE_BIND_SHARED)); + bool can_checksum = !(res->bind & ~valid_binding); bool should_checksum = res->bind & PIPE_BIND_RENDER_TARGET; pres->checksummed = can_checksum && should_checksum; /* Set the layout appropriately */ - pres->layout = should_tile ? PAN_TILED : PAN_LINEAR; + pres->layout = (can_tile && should_tile) ? PAN_TILED : PAN_LINEAR; size_t bo_size;