summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/panfrost/pan_context.c
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <[email protected]>2019-08-20 15:36:00 -0700
committerAlyssa Rosenzweig <[email protected]>2019-08-21 08:40:55 -0700
commit9f15f4d8e91194ee02c041647fda54bf726e6bbc (patch)
tree671f3ec9315ba46a8e0982a8537c79ad577cd621 /src/gallium/drivers/panfrost/pan_context.c
parent9b203950ec6480d38925a0b81e0066766268b126 (diff)
panfrost: Break up usage2 field
This is another bit field describing layout. Signed-off-by: Alyssa Rosenzweig <[email protected]>
Diffstat (limited to 'src/gallium/drivers/panfrost/pan_context.c')
-rw-r--r--src/gallium/drivers/panfrost/pan_context.c29
1 files changed, 10 insertions, 19 deletions
diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c
index 689aeae5419..63929890c02 100644
--- a/src/gallium/drivers/panfrost/pan_context.c
+++ b/src/gallium/drivers/panfrost/pan_context.c
@@ -569,33 +569,23 @@ panfrost_upload_sampler_descriptors(struct panfrost_context *ctx)
}
}
-static unsigned
-panfrost_layout_for_texture(struct panfrost_resource *rsrc, bool manual_stride)
+static enum mali_texture_layout
+panfrost_layout_for_texture(struct panfrost_resource *rsrc)
{
/* TODO: other linear depth textures */
bool is_depth = rsrc->base.format == PIPE_FORMAT_Z32_UNORM;
- unsigned usage2_layout = 0x10;
-
switch (rsrc->layout) {
case PAN_AFBC:
- usage2_layout |= 0x8 | 0x4;
- break;
+ return MALI_TEXTURE_AFBC;
case PAN_TILED:
- usage2_layout |= 0x1;
- break;
+ assert(!is_depth);
+ return MALI_TEXTURE_TILED;
case PAN_LINEAR:
- usage2_layout |= is_depth ? 0x1 : 0x2;
- break;
+ return is_depth ? MALI_TEXTURE_TILED : MALI_TEXTURE_LINEAR;
default:
- assert(0);
- break;
+ unreachable("Invalid texture layout");
}
-
- if (manual_stride)
- usage2_layout |= MALI_TEX_MANUAL_STRIDE;
-
- return usage2_layout;
}
static mali_ptr
@@ -633,7 +623,8 @@ panfrost_upload_tex(
/* Add the usage flags in, since they can change across the CSO
* lifetime due to layout switches */
- view->hw.format.usage2 = panfrost_layout_for_texture(rsrc, has_manual_stride);
+ view->hw.format.layout = panfrost_layout_for_texture(rsrc);
+ view->hw.format.manual_stride = has_manual_stride;
/* Inject the addresses in, interleaving mip levels, cube faces, and
* strides in that order */
@@ -2254,7 +2245,6 @@ panfrost_create_sampler_view(
* (data) itself. So, we serialise the descriptor here and cache it for
* later. */
- /* TODO: Detect from format better */
const struct util_format_description *desc = util_format_description(prsrc->base.format);
unsigned char user_swizzle[4] = {
@@ -2309,6 +2299,7 @@ panfrost_create_sampler_view(
.format = format,
.srgb = desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB,
.type = panfrost_translate_texture_type(template->target),
+ .unknown2 = 0x1,
},
.swizzle = panfrost_translate_swizzle_4(user_swizzle)