summaryrefslogtreecommitdiffstats
path: root/src/intel/isl/isl_gen7.c
diff options
context:
space:
mode:
authorTopi Pohjolainen <[email protected]>2017-07-18 17:10:59 +0300
committerTopi Pohjolainen <[email protected]>2017-07-22 00:14:16 +0300
commitfbfc6a2f67f3b72fa6e86250925eb8f5005c75ae (patch)
tree36b7a0c8aaf67695fdc46cdaa0b87c49a4f5f06d /src/intel/isl/isl_gen7.c
parentdf9bb8dc059a3cdb0a2099deb25cb4292e301933 (diff)
intel/isl/gen7: Don't allow multisampled surfaces with valign2
There is the same constraintg later on as assert in isl_gen7_choose_image_alignment_el() so catch it earlier in order to return error instead of crash. Needed to avoid crashes with piglits on IVB and HSW: arb_internalformat_query2.image_format_compatibility_type pname checks arb_internalformat_query2.all internalformat_<x>_type pname checks arb_internalformat_query2.max dimensions related pname checks arb_copy_image.arb_copy_image-formats --samples=2/4/6/8 arb_texture_float.multisample-fast-clear gl_arb_texture_float Reviewed-by: Jason Ekstrand <[email protected]> Signed-off-by: Topi Pohjolainen <[email protected]>
Diffstat (limited to 'src/intel/isl/isl_gen7.c')
-rw-r--r--src/intel/isl/isl_gen7.c42
1 files changed, 23 insertions, 19 deletions
diff --git a/src/intel/isl/isl_gen7.c b/src/intel/isl/isl_gen7.c
index ab47a7f6229..24d411f51e9 100644
--- a/src/intel/isl/isl_gen7.c
+++ b/src/intel/isl/isl_gen7.c
@@ -24,6 +24,25 @@
#include "isl_gen7.h"
#include "isl_priv.h"
+static bool
+gen7_format_needs_valign2(const struct isl_device *dev,
+ enum isl_format format)
+{
+ assert(ISL_DEV_GEN(dev) == 7);
+
+ /* From the Ivybridge PRM (2012-05-31), Volume 4, Part 1, Section 2.12.1,
+ * RENDER_SURFACE_STATE Surface Vertical Alignment:
+ *
+ * - Value of 1 [VALIGN_4] is not supported for format YCRCB_NORMAL
+ * (0x182), YCRCB_SWAPUVY (0x183), YCRCB_SWAPUV (0x18f), YCRCB_SWAPY
+ * (0x190)
+ *
+ * - VALIGN_4 is not supported for surface format R32G32B32_FLOAT.
+ */
+ return isl_format_is_yuv(format) ||
+ format == ISL_FORMAT_R32G32B32_FLOAT;
+}
+
bool
isl_gen7_choose_msaa_layout(const struct isl_device *dev,
const struct isl_surf_init_info *info,
@@ -81,6 +100,10 @@ isl_gen7_choose_msaa_layout(const struct isl_device *dev,
* surfaces with RGBA8I, RGBA16I and RGBA32I.
*/
+ /* Multisampling requires vertical alignment of four. */
+ if (info->samples > 1 && gen7_format_needs_valign2(dev, info->format))
+ return false;
+
/* More obvious restrictions */
if (isl_surf_usage_is_display(info->usage))
return false;
@@ -152,25 +175,6 @@ isl_gen7_choose_msaa_layout(const struct isl_device *dev,
return true;
}
-static bool
-gen7_format_needs_valign2(const struct isl_device *dev,
- enum isl_format format)
-{
- assert(ISL_DEV_GEN(dev) == 7);
-
- /* From the Ivybridge PRM (2012-05-31), Volume 4, Part 1, Section 2.12.1,
- * RENDER_SURFACE_STATE Surface Vertical Alignment:
- *
- * - Value of 1 [VALIGN_4] is not supported for format YCRCB_NORMAL
- * (0x182), YCRCB_SWAPUVY (0x183), YCRCB_SWAPUV (0x18f), YCRCB_SWAPY
- * (0x190)
- *
- * - VALIGN_4 is not supported for surface format R32G32B32_FLOAT.
- */
- return isl_format_is_yuv(format) ||
- format == ISL_FORMAT_R32G32B32_FLOAT;
-}
-
/**
* @brief Filter out tiling flags that are incompatible with the surface.
*