aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKristian H. Kristensen <[email protected]>2019-02-14 23:37:01 -0800
committerKristian H. Kristensen <[email protected]>2019-02-20 08:56:21 -0800
commitb9eed05e7f9717ce36ce9e080f746f2d1684f17e (patch)
tree9bed36bd8425f65d7f6f39f3b72028cd2d9b8a71
parent686211f4c9659fb964c8467ac21f3445c79a9c36 (diff)
freedreno/a6xx: Support MSAA resolve blits on blitter
This gets stencil and depth resolves working properly. Fixes: dEQP-GLES3.functional.fbo.msaa.2_samples.depth32f_stencil8 dEQP-GLES3.functional.fbo.msaa.2_samples.depth24_stencil8 dEQP-GLES3.functional.fbo.msaa.4_samples.depth32f_stencil8 dEQP-GLES3.functional.fbo.msaa.4_samples.depth24_stencil8 dEQP-GLES3.functional.fbo.invalidate.whole.unbind_blit_msaa_color dEQP-GLES3.functional.fbo.invalidate.sub.unbind_blit_msaa_color Signed-off-by: Kristian H. Kristensen <[email protected]>
-rw-r--r--src/gallium/drivers/freedreno/a6xx/fd6_blitter.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_blitter.c b/src/gallium/drivers/freedreno/a6xx/fd6_blitter.c
index c54d34d729a..b9118699dc0 100644
--- a/src/gallium/drivers/freedreno/a6xx/fd6_blitter.c
+++ b/src/gallium/drivers/freedreno/a6xx/fd6_blitter.c
@@ -124,9 +124,25 @@ can_do_blit(const struct pipe_blit_info *info)
debug_assert(info->dst.box.height >= 0);
debug_assert(info->dst.box.depth >= 0);
- /* non-multisampled could either have nr_samples == 0 or == 1 */
+ /* We could probably blit between resources with equal sample count.. */
fail_if(info->dst.resource->nr_samples > 1);
- fail_if(info->src.resource->nr_samples > 1);
+
+ /* CP_BLIT supports resolving, but seems to pick one only of the samples
+ * (no blending). This doesn't work for RGBA resolves, so we fall back in
+ * that case. However, GL/GLES spec says:
+ *
+ * "If the source formats are integer types or stencil values, a single
+ * sample’s value is selected for each pixel. If the source formats are
+ * floating-point or normalized types, the sample values for each pixel
+ * are resolved in an implementationdependent manner. If the source
+ * formats are depth values, sample values are resolved in an
+ * implementation-dependent manner where the result will be between the
+ * minimum and maximum depth values in the pixel."
+ *
+ * so do those with CP_BLIT.
+ */
+ fail_if((info->mask & PIPE_MASK_RGBA) &&
+ info->src.resource->nr_samples > 1);
fail_if(info->window_rectangle_include);
@@ -435,10 +451,14 @@ emit_blit_texture(struct fd_ringbuffer *ring, const struct pipe_blit_info *info)
if (info->filter == PIPE_TEX_FILTER_LINEAR)
filter = A6XX_SP_PS_2D_SRC_INFO_FILTER;
+ enum a3xx_msaa_samples samples = fd_msaa_samples(src->base.nr_samples);
+
OUT_PKT4(ring, REG_A6XX_SP_PS_2D_SRC_INFO, 13);
OUT_RING(ring, A6XX_SP_PS_2D_SRC_INFO_COLOR_FORMAT(sfmt) |
A6XX_SP_PS_2D_SRC_INFO_TILE_MODE(stile) |
- A6XX_SP_PS_2D_SRC_INFO_COLOR_SWAP(sswap) | 0x500000 | filter);
+ A6XX_SP_PS_2D_SRC_INFO_COLOR_SWAP(sswap) |
+ A6XX_SP_PS_2D_SRC_INFO_SAMPLES(samples) |
+ 0x500000 | filter);
OUT_RING(ring, A6XX_SP_PS_2D_SRC_SIZE_WIDTH(width) |
A6XX_SP_PS_2D_SRC_SIZE_HEIGHT(height)); /* SP_PS_2D_SRC_SIZE */
OUT_RELOC(ring, src->bo, soff, 0, 0); /* SP_PS_2D_SRC_LO/HI */