summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/svga/svga_context.h3
-rw-r--r--src/gallium/drivers/svga/svga_pipe_blit.c24
-rw-r--r--src/gallium/drivers/svga/svga_pipe_clear.c38
-rw-r--r--src/gallium/drivers/svga/svga_pipe_query.c40
4 files changed, 62 insertions, 43 deletions
diff --git a/src/gallium/drivers/svga/svga_context.h b/src/gallium/drivers/svga/svga_context.h
index a268635d6af..2987c709ac9 100644
--- a/src/gallium/drivers/svga/svga_context.h
+++ b/src/gallium/drivers/svga/svga_context.h
@@ -675,6 +675,9 @@ struct pipe_context *
svga_context_create(struct pipe_screen *screen,
void *priv, unsigned flags);
+void svga_toggle_render_condition(struct svga_context *svga,
+ boolean render_condition_enabled,
+ boolean on);
/***********************************************************************
* Inline conversion functions. These are better-typed than the
diff --git a/src/gallium/drivers/svga/svga_pipe_blit.c b/src/gallium/drivers/svga/svga_pipe_blit.c
index 13788fd59c1..3d7196dddd2 100644
--- a/src/gallium/drivers/svga/svga_pipe_blit.c
+++ b/src/gallium/drivers/svga/svga_pipe_blit.c
@@ -286,9 +286,6 @@ can_blit_via_svga_copy_region(struct svga_context *svga,
blit_info->mask != (PIPE_MASK_ZS))
return false;
- if (svga->render_condition && blit_info->render_condition_enable)
- return false;
-
return check_blending_and_srgb_cond(svga, blit_info);
}
@@ -334,6 +331,9 @@ can_blit_via_surface_copy(struct svga_context *svga,
{
struct svga_texture *dtex, *stex;
+ if (svga->render_condition && blit_info->render_condition_enable)
+ return false;
+
/* can't copy between different resource types */
if (svga_resource_type(blit_info->src.resource->target) !=
svga_resource_type(blit_info->dst.resource->target))
@@ -372,6 +372,8 @@ try_copy_region(struct svga_context *svga,
&dst_face, &dst_z);
if (can_blit_via_copy_region_vgpu10(svga, blit)) {
+ svga_toggle_render_condition(svga, blit->render_condition_enable, FALSE);
+
copy_region_vgpu10(svga,
blit->src.resource,
blit->src.box.x, blit->src.box.y, src_z,
@@ -381,6 +383,9 @@ try_copy_region(struct svga_context *svga,
blit->dst.level, dst_face,
blit->src.box.width, blit->src.box.height,
blit->src.box.depth);
+
+ svga_toggle_render_condition(svga, blit->render_condition_enable, TRUE);
+
return true;
}
@@ -511,8 +516,6 @@ try_blit(struct svga_context *svga, const struct pipe_blit_info *blit_info)
util_blitter_save_fragment_sampler_views(svga->blitter,
svga->curr.num_sampler_views[PIPE_SHADER_FRAGMENT],
svga->curr.sampler_views[PIPE_SHADER_FRAGMENT]);
- /*util_blitter_save_render_condition(svga->blitter, svga->render_cond_query,
- svga->render_cond_cond, svga->render_cond_mode);*/
if (!can_create_src_view) {
struct pipe_resource template;
@@ -574,8 +577,12 @@ try_blit(struct svga_context *svga, const struct pipe_blit_info *blit_info)
blit.dst.resource = newDst;
}
+ svga_toggle_render_condition(svga, blit.render_condition_enable, FALSE);
+
util_blitter_blit(svga->blitter, &blit);
+ svga_toggle_render_condition(svga, blit.render_condition_enable, TRUE);
+
if (blit.dst.resource != dst) {
struct pipe_blit_info copy_region_blit;
@@ -619,6 +626,13 @@ try_cpu_copy_region(struct svga_context *svga,
{
if (util_can_blit_via_copy_region(blit, TRUE) ||
util_can_blit_via_copy_region(blit, FALSE)) {
+
+ if (svga->render_condition && blit->render_condition_enable) {
+ debug_warning("CPU copy_region doesn't support "
+ "conditional rendering.\n");
+ return false;
+ }
+
copy_region_fallback(svga, blit->dst.resource,
blit->dst.level,
blit->dst.box.x, blit->dst.box.y,
diff --git a/src/gallium/drivers/svga/svga_pipe_clear.c b/src/gallium/drivers/svga/svga_pipe_clear.c
index 56db713cfc9..e234ef58715 100644
--- a/src/gallium/drivers/svga/svga_pipe_clear.c
+++ b/src/gallium/drivers/svga/svga_pipe_clear.c
@@ -504,44 +504,6 @@ svga_blitter_clear_render_target(struct svga_context *svga,
dstx, dsty, width, height);
}
-/**
- * \brief Toggle conditional rendering if already enabled
- *
- * \param svga[in] The svga context
- * \param render_condition_enabled[in] Whether to ignore requests to turn
- * conditional rendering off
- * \param on[in] Whether to turn conditional rendering on or off
- */
-static void
-svga_toggle_render_condition(struct svga_context *svga,
- boolean render_condition_enabled,
- boolean on)
-{
- SVGA3dQueryId query_id;
- enum pipe_error ret;
-
- if (render_condition_enabled ||
- svga->pred.query_id == SVGA3D_INVALID_ID) {
- return;
- }
-
- /*
- * If we get here, it means that the system supports
- * conditional rendering since svga->pred.query_id has already been
- * modified for this context and thus support has already been
- * verified.
- */
- query_id = on ? svga->pred.query_id : SVGA3D_INVALID_ID;
-
- ret = SVGA3D_vgpu10_SetPredication(svga->swc, query_id,
- (uint32) svga->pred.cond);
- if (ret == PIPE_ERROR_OUT_OF_MEMORY) {
- svga_context_flush(svga, NULL);
- ret = SVGA3D_vgpu10_SetPredication(svga->swc, query_id,
- (uint32) svga->pred.cond);
- assert(ret == PIPE_OK);
- }
-}
/**
* \brief Clear render target pipe callback
diff --git a/src/gallium/drivers/svga/svga_pipe_query.c b/src/gallium/drivers/svga/svga_pipe_query.c
index 06c0c811ec9..76360fdd4d0 100644
--- a/src/gallium/drivers/svga/svga_pipe_query.c
+++ b/src/gallium/drivers/svga/svga_pipe_query.c
@@ -1272,6 +1272,46 @@ svga_set_active_query_state(struct pipe_context *pipe, boolean enable)
}
+/**
+ * \brief Toggle conditional rendering if already enabled
+ *
+ * \param svga[in] The svga context
+ * \param render_condition_enabled[in] Whether to ignore requests to turn
+ * conditional rendering off
+ * \param on[in] Whether to turn conditional rendering on or off
+ */
+void
+svga_toggle_render_condition(struct svga_context *svga,
+ boolean render_condition_enabled,
+ boolean on)
+{
+ SVGA3dQueryId query_id;
+ enum pipe_error ret;
+
+ if (render_condition_enabled ||
+ svga->pred.query_id == SVGA3D_INVALID_ID) {
+ return;
+ }
+
+ /*
+ * If we get here, it means that the system supports
+ * conditional rendering since svga->pred.query_id has already been
+ * modified for this context and thus support has already been
+ * verified.
+ */
+ query_id = on ? svga->pred.query_id : SVGA3D_INVALID_ID;
+
+ ret = SVGA3D_vgpu10_SetPredication(svga->swc, query_id,
+ (uint32) svga->pred.cond);
+ if (ret == PIPE_ERROR_OUT_OF_MEMORY) {
+ svga_context_flush(svga, NULL);
+ ret = SVGA3D_vgpu10_SetPredication(svga->swc, query_id,
+ (uint32) svga->pred.cond);
+ assert(ret == PIPE_OK);
+ }
+}
+
+
void
svga_init_query_functions(struct svga_context *svga)
{