radeonsi: allow query functions for compute-only contexts

Submitted by Marek Olšák on May 13, 2019, 10:40 p.m.

Details

Message ID 20190513224034.16371-1-maraeo@gmail.com
State New
Headers show
Series "radeonsi: allow query functions for compute-only contexts" ( rev: 1 ) in Mesa

Not browsing as part of any series.

Commit Message

Marek Olšák May 13, 2019, 10:40 p.m.
From: Marek Olšák <marek.olsak@amd.com>

---
 src/gallium/drivers/radeonsi/si_pipe.c  | 2 +-
 src/gallium/drivers/radeonsi/si_query.c | 7 ++++---
 2 files changed, 5 insertions(+), 4 deletions(-)

Patch hide | download patch | download mbox

diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c
index aa7f012f071..95280675506 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.c
+++ b/src/gallium/drivers/radeonsi/si_pipe.c
@@ -482,29 +482,29 @@  static struct pipe_context *si_create_context(struct pipe_screen *screen,
 	sctx->b.set_device_reset_callback = si_set_device_reset_callback;
 
 	si_init_all_descriptors(sctx);
 	si_init_buffer_functions(sctx);
 	si_init_clear_functions(sctx);
 	si_init_blit_functions(sctx);
 	si_init_compute_functions(sctx);
 	si_init_compute_blit_functions(sctx);
 	si_init_debug_functions(sctx);
 	si_init_fence_functions(sctx);
+	si_init_query_functions(sctx);
 	si_init_state_compute_functions(sctx);
 
 	if (sscreen->debug_flags & DBG(FORCE_DMA))
 		sctx->b.resource_copy_region = sctx->dma_copy;
 
 	/* Initialize graphics-only context functions. */
 	if (sctx->has_graphics) {
 		si_init_context_texture_functions(sctx);
-		si_init_query_functions(sctx);
 		si_init_msaa_functions(sctx);
 		si_init_shader_functions(sctx);
 		si_init_state_functions(sctx);
 		si_init_streamout_functions(sctx);
 		si_init_viewport_functions(sctx);
 
 		sctx->blitter = util_blitter_create(&sctx->b);
 		if (sctx->blitter == NULL)
 			goto fail;
 		sctx->blitter->skip_viewport_restore = true;
diff --git a/src/gallium/drivers/radeonsi/si_query.c b/src/gallium/drivers/radeonsi/si_query.c
index d98bea2eeb3..3e357e8b6c0 100644
--- a/src/gallium/drivers/radeonsi/si_query.c
+++ b/src/gallium/drivers/radeonsi/si_query.c
@@ -1879,23 +1879,24 @@  static int si_get_driver_query_group_info(struct pipe_screen *screen,
 
 void si_init_query_functions(struct si_context *sctx)
 {
 	sctx->b.create_query = si_create_query;
 	sctx->b.create_batch_query = si_create_batch_query;
 	sctx->b.destroy_query = si_destroy_query;
 	sctx->b.begin_query = si_begin_query;
 	sctx->b.end_query = si_end_query;
 	sctx->b.get_query_result = si_get_query_result;
 	sctx->b.get_query_result_resource = si_get_query_result_resource;
-	sctx->atoms.s.render_cond.emit = si_emit_query_predication;
 
-	if (((struct si_screen*)sctx->b.screen)->info.num_render_backends > 0)
-	    sctx->b.render_condition = si_render_condition;
+	if (sctx->has_graphics) {
+		sctx->atoms.s.render_cond.emit = si_emit_query_predication;
+		sctx->b.render_condition = si_render_condition;
+	}
 
 	LIST_INITHEAD(&sctx->active_queries);
 }
 
 void si_init_screen_query_functions(struct si_screen *sscreen)
 {
 	sscreen->b.get_driver_query_info = si_get_driver_query_info;
 	sscreen->b.get_driver_query_group_info = si_get_driver_query_group_info;
 }

Comments

On Mon, May 13, 2019 at 6:40 PM Marek Olšák <maraeo@gmail.com> wrote:
>
> From: Marek Olšák <marek.olsak@amd.com>
>
> ---
>  src/gallium/drivers/radeonsi/si_pipe.c  | 2 +-
>  src/gallium/drivers/radeonsi/si_query.c | 7 ++++---
>  2 files changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c
> index aa7f012f071..95280675506 100644
> --- a/src/gallium/drivers/radeonsi/si_pipe.c
> +++ b/src/gallium/drivers/radeonsi/si_pipe.c
> @@ -482,29 +482,29 @@ static struct pipe_context *si_create_context(struct pipe_screen *screen,
>         sctx->b.set_device_reset_callback = si_set_device_reset_callback;
>
>         si_init_all_descriptors(sctx);
>         si_init_buffer_functions(sctx);
>         si_init_clear_functions(sctx);
>         si_init_blit_functions(sctx);
>         si_init_compute_functions(sctx);
>         si_init_compute_blit_functions(sctx);
>         si_init_debug_functions(sctx);
>         si_init_fence_functions(sctx);
> +       si_init_query_functions(sctx);
>         si_init_state_compute_functions(sctx);
>
>         if (sscreen->debug_flags & DBG(FORCE_DMA))
>                 sctx->b.resource_copy_region = sctx->dma_copy;
>
>         /* Initialize graphics-only context functions. */
>         if (sctx->has_graphics) {
>                 si_init_context_texture_functions(sctx);
> -               si_init_query_functions(sctx);
>                 si_init_msaa_functions(sctx);
>                 si_init_shader_functions(sctx);
>                 si_init_state_functions(sctx);
>                 si_init_streamout_functions(sctx);
>                 si_init_viewport_functions(sctx);
>
>                 sctx->blitter = util_blitter_create(&sctx->b);
>                 if (sctx->blitter == NULL)
>                         goto fail;
>                 sctx->blitter->skip_viewport_restore = true;
> diff --git a/src/gallium/drivers/radeonsi/si_query.c b/src/gallium/drivers/radeonsi/si_query.c
> index d98bea2eeb3..3e357e8b6c0 100644
> --- a/src/gallium/drivers/radeonsi/si_query.c
> +++ b/src/gallium/drivers/radeonsi/si_query.c
> @@ -1879,23 +1879,24 @@ static int si_get_driver_query_group_info(struct pipe_screen *screen,
>
>  void si_init_query_functions(struct si_context *sctx)
>  {
>         sctx->b.create_query = si_create_query;
>         sctx->b.create_batch_query = si_create_batch_query;
>         sctx->b.destroy_query = si_destroy_query;
>         sctx->b.begin_query = si_begin_query;
>         sctx->b.end_query = si_end_query;
>         sctx->b.get_query_result = si_get_query_result;
>         sctx->b.get_query_result_resource = si_get_query_result_resource;
> -       sctx->atoms.s.render_cond.emit = si_emit_query_predication;
>
> -       if (((struct si_screen*)sctx->b.screen)->info.num_render_backends > 0)
> -           sctx->b.render_condition = si_render_condition;
> +       if (sctx->has_graphics) {
> +               sctx->atoms.s.render_cond.emit = si_emit_query_predication;
> +               sctx->b.render_condition = si_render_condition;
> +       }
>
>         LIST_INITHEAD(&sctx->active_queries);
>  }
>
>  void si_init_screen_query_functions(struct si_screen *sscreen)
>  {
>         sscreen->b.get_driver_query_info = si_get_driver_query_info;
>         sscreen->b.get_driver_query_group_info = si_get_driver_query_group_info;
>  }
> --
> 2.17.1

Hi,

this patch hangs query requests (tested on carrizo and raven).

Jan

>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev