radeonsi: init sctx->dma_copy before using it
authorPierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Fri, 31 May 2019 12:39:46 +0000 (14:39 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Mon, 3 Jun 2019 19:05:30 +0000 (15:05 -0400)
Commit a1378639ab19 reordered context functions initializations but broke
sctx->b.resource_copy_region init when using AMD_DEBUG=forcedma.

In this case sctx->dma_copy was assigned a value after being used in:
   sctx->b.resource_copy_region = sctx->dma_copy;

This commit moves the FORCE_DMA special case after sctx->dma_copy initialization.

See https://bugs.freedesktop.org/show_bug.cgi?id=110422

Signed-off-by: Marek Olšák <marek.olsak@amd.com>
src/gallium/drivers/radeonsi/si_pipe.c

index c19a2cd..1faaa22 100644 (file)
@@ -505,9 +505,6 @@ static struct pipe_context *si_create_context(struct pipe_screen *screen,
        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);
@@ -532,6 +529,9 @@ static struct pipe_context *si_create_context(struct pipe_screen *screen,
        else
                si_init_dma_functions(sctx);
 
+       if (sscreen->debug_flags & DBG(FORCE_DMA))
+               sctx->b.resource_copy_region = sctx->dma_copy;
+
        sctx->sample_mask = 0xffff;
 
        /* Initialize multimedia functions. */