intel/isl: Allow creation of 1-D compressed textures
authorJason Ekstrand <jason.ekstrand@intel.com>
Tue, 13 Sep 2016 00:43:28 +0000 (17:43 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Mon, 3 Oct 2016 21:53:01 +0000 (14:53 -0700)
Compressed 1-D textures are not well-defined thing in either GL or Vulkan.
However, auxiliary surfaces are treated as compressed textures in ISL and
we can do HiZ and CCS with 1-D so we need to be able to create them.  In
order to prevent actually using them (the docs say no), we assert in the
state setup code.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
src/intel/isl/isl.c
src/intel/isl/isl_surface_state.c

index 18e94d3a92a708bea966a0c0e48d021524ebdecf..26ee4c4452e10363c92e06bc4a01466fc08de8b5 100644 (file)
@@ -540,7 +540,6 @@ isl_calc_phys_level0_extent_sa(const struct isl_device *dev,
       assert(info->height == 1);
       assert(info->depth == 1);
       assert(info->samples == 1);
-      assert(!isl_format_is_compressed(info->format));
 
       switch (dim_layout) {
       case ISL_DIM_LAYOUT_GEN4_3D:
@@ -549,8 +548,8 @@ isl_calc_phys_level0_extent_sa(const struct isl_device *dev,
       case ISL_DIM_LAYOUT_GEN9_1D:
       case ISL_DIM_LAYOUT_GEN4_2D:
          *phys_level0_sa = (struct isl_extent4d) {
-            .w = info->width,
-            .h = 1,
+            .w = isl_align_npot(info->width, fmtl->bw),
+            .h = fmtl->bh,
             .d = 1,
             .a = info->array_len,
          };
index 1a1a8191b88c4c351828be8fd28bf102221a13d6..0dfeeaf90441aca87c46e43df341691d8d0bdf63 100644 (file)
@@ -243,6 +243,15 @@ isl_genX(surf_fill_state_s)(const struct isl_device *dev, void *state,
       assert(isl_format_supports_rendering(dev->info, info->view->format));
    else if (info->view->usage & ISL_SURF_USAGE_TEXTURE_BIT)
       assert(isl_format_supports_sampling(dev->info, info->view->format));
+
+   /* From the Sky Lake PRM Vol. 2d, RENDER_SURFACE_STATE::SurfaceFormat
+    *
+    *    This field cannot be a compressed (BC*, DXT*, FXT*, ETC*, EAC*)
+    *    format if the Surface Type is SURFTYPE_1D
+    */
+   if (info->surf->dim == ISL_SURF_DIM_1D)
+      assert(!isl_format_is_compressed(info->view->format));
+
    s.SurfaceFormat = info->view->format;
 
 #if GEN_IS_HASWELL