aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorIcecream95 <[email protected]>2020-01-11 20:00:38 +1300
committerAlyssa Rosenzweig <[email protected]>2020-01-21 08:35:23 -0500
commit960fe9daea77e80b0dc72271bb6b8e10acf851be (patch)
tree92d60edd10cdaa0c1efaf00d72468d5324148a73 /src/gallium
parent2091d311c9d063138d5c84bbf4afe99ca864e597 (diff)
panfrost: Add ETC1/ETC2 texture formats
Acked-by: Daniel Stone <[email protected]> Reviewed-by: Alyssa Rosenzweig <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3414>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/panfrost/pan_format.c23
-rw-r--r--src/gallium/drivers/panfrost/pan_resource.c3
-rw-r--r--src/gallium/drivers/panfrost/pan_screen.c12
3 files changed, 34 insertions, 4 deletions
diff --git a/src/gallium/drivers/panfrost/pan_format.c b/src/gallium/drivers/panfrost/pan_format.c
index 9b0440eae37..040b01d9e5b 100644
--- a/src/gallium/drivers/panfrost/pan_format.c
+++ b/src/gallium/drivers/panfrost/pan_format.c
@@ -217,6 +217,29 @@ panfrost_find_format(const struct util_format_description *desc) {
case PIPE_FORMAT_R9G9B9E5_FLOAT:
return MALI_R9F_G9F_B9F_E5F;
+ case PIPE_FORMAT_ETC1_RGB8:
+ case PIPE_FORMAT_ETC2_RGB8:
+ case PIPE_FORMAT_ETC2_SRGB8:
+ return MALI_ETC2_RGB8;
+
+ case PIPE_FORMAT_ETC2_RGB8A1:
+ case PIPE_FORMAT_ETC2_SRGB8A1:
+ return MALI_ETC2_RGB8A1;
+
+ case PIPE_FORMAT_ETC2_RGBA8:
+ case PIPE_FORMAT_ETC2_SRGBA8:
+ return MALI_ETC2_RGBA8;
+
+ case PIPE_FORMAT_ETC2_R11_UNORM:
+ return MALI_ETC2_R11_UNORM;
+ case PIPE_FORMAT_ETC2_R11_SNORM:
+ return MALI_ETC2_R11_SNORM;
+
+ case PIPE_FORMAT_ETC2_RG11_UNORM:
+ return MALI_ETC2_RG11_UNORM;
+ case PIPE_FORMAT_ETC2_RG11_SNORM:
+ return MALI_ETC2_RG11_SNORM;
+
default:
/* Fallthrough to default */
break;
diff --git a/src/gallium/drivers/panfrost/pan_resource.c b/src/gallium/drivers/panfrost/pan_resource.c
index 18c6e05ba3b..aac1e8cf19d 100644
--- a/src/gallium/drivers/panfrost/pan_resource.c
+++ b/src/gallium/drivers/panfrost/pan_resource.c
@@ -315,6 +315,9 @@ panfrost_setup_slices(struct panfrost_resource *pres, size_t *bo_size)
/* Compute the would-be stride */
unsigned stride = bytes_per_pixel * effective_width;
+ if (util_format_is_compressed(res->format))
+ stride /= 4;
+
/* ..but cache-line align it for performance */
if (can_align_stride && pres->layout == PAN_LINEAR)
stride = ALIGN_POT(stride, 64);
diff --git a/src/gallium/drivers/panfrost/pan_screen.c b/src/gallium/drivers/panfrost/pan_screen.c
index 296be13484d..b7d24c93ea2 100644
--- a/src/gallium/drivers/panfrost/pan_screen.c
+++ b/src/gallium/drivers/panfrost/pan_screen.c
@@ -459,10 +459,14 @@ panfrost_is_format_supported( struct pipe_screen *screen,
if (scanout && renderable && !util_format_is_rgba8_variant(format_desc))
return false;
- if (format_desc->layout != UTIL_FORMAT_LAYOUT_PLAIN &&
- format_desc->layout != UTIL_FORMAT_LAYOUT_OTHER) {
- /* Compressed formats not yet hooked up. */
- return false;
+ switch (format_desc->layout) {
+ case UTIL_FORMAT_LAYOUT_PLAIN:
+ case UTIL_FORMAT_LAYOUT_OTHER:
+ break;
+ case UTIL_FORMAT_LAYOUT_ETC:
+ return true;
+ default:
+ return false;
}
/* Internally, formats that are depth/stencil renderable are limited.