summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2016-09-20 17:36:32 -0600
committerBrian Paul <[email protected]>2016-09-23 19:54:42 -0600
commitc42000545df33b9ab18aa2c5f9775632e0667783 (patch)
treec6cda27e6d0e4631aa23f7fa1a8b5ae6cce259ec
parent2ad4ba07279236dcdbafb6e4b2a0c183c69c92f4 (diff)
svga: simplify/improve the format compatibility check for region copies
The util_is_format_compatible() function didn't quite do what we wanted for vgpu10. This check is more flexible and allows copies between formats such as R32G32B32A32_FLOAT and R32G32B32A32_INT. Reviewed-by: Charmaine Lee <[email protected]>
-rw-r--r--src/gallium/drivers/svga/svga_pipe_blit.c30
1 files changed, 25 insertions, 5 deletions
diff --git a/src/gallium/drivers/svga/svga_pipe_blit.c b/src/gallium/drivers/svga/svga_pipe_blit.c
index fa4540a59c5..7016186c7a7 100644
--- a/src/gallium/drivers/svga/svga_pipe_blit.c
+++ b/src/gallium/drivers/svga/svga_pipe_blit.c
@@ -26,6 +26,7 @@
#include "svga_context.h"
#include "svga_debug.h"
#include "svga_cmd.h"
+#include "svga_format.h"
#include "svga_resource_buffer.h"
#include "svga_resource_texture.h"
#include "svga_surface.h"
@@ -209,6 +210,27 @@ svga_resource_copy_region(struct pipe_context *pipe,
/**
+ * Are the given pipe formats compatible, in terms of vgpu10's
+ * PredCopyRegion() command?
+ */
+static bool
+formats_compatible(const struct svga_screen *ss,
+ enum pipe_format src_fmt,
+ enum pipe_format dst_fmt)
+{
+ SVGA3dSurfaceFormat src_svga_fmt, dst_svga_fmt;
+
+ src_svga_fmt = svga_translate_format(ss, src_fmt, PIPE_BIND_SAMPLER_VIEW);
+ dst_svga_fmt = svga_translate_format(ss, dst_fmt, PIPE_BIND_SAMPLER_VIEW);
+
+ src_svga_fmt = svga_typeless_format(src_svga_fmt);
+ dst_svga_fmt = svga_typeless_format(dst_svga_fmt);
+
+ return src_svga_fmt == dst_svga_fmt;
+}
+
+
+/**
* The state tracker implements some resource copies with blits (for
* GL_ARB_copy_image). This function checks if we should really do the blit
* with a VGPU10 CopyRegion command or software fallback (for incompatible
@@ -248,11 +270,9 @@ can_blit_via_copy_region_vgpu10(struct svga_context *svga,
blit_info->scissor_enable)
return false;
- /* check that src/dst surface formats are compatible for
- the VGPU device.*/
- return util_is_format_compatible(
- util_format_description(blit_info->src.resource->format),
- util_format_description(blit_info->dst.resource->format));
+ return formats_compatible(svga_screen(svga->pipe.screen),
+ blit_info->src.resource->format,
+ blit_info->dst.resource->format);
}