From: Marek Olšák <marek.ol...@amd.com>

---
 src/gallium/drivers/radeonsi/si_compute.c       | 6 +++---
 src/gallium/drivers/radeonsi/si_cp_dma.c        | 7 +++----
 src/gallium/drivers/radeonsi/si_pipe.h          | 8 --------
 src/gallium/drivers/radeonsi/si_shader.c        | 6 +++---
 src/gallium/drivers/radeonsi/si_state_shaders.c | 4 ++--
 5 files changed, 11 insertions(+), 20 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_compute.c 
b/src/gallium/drivers/radeonsi/si_compute.c
index e785106..f1887bb 100644
--- a/src/gallium/drivers/radeonsi/si_compute.c
+++ b/src/gallium/drivers/radeonsi/si_compute.c
@@ -269,23 +269,23 @@ static bool si_setup_compute_scratch_buffer(struct 
si_context *sctx,
 {
        uint64_t scratch_bo_size, scratch_needed;
        scratch_bo_size = 0;
        scratch_needed = config->scratch_bytes_per_wave * sctx->scratch_waves;
        if (sctx->compute_scratch_buffer)
                scratch_bo_size = sctx->compute_scratch_buffer->b.b.width0;
 
        if (scratch_bo_size < scratch_needed) {
                r600_resource_reference(&sctx->compute_scratch_buffer, NULL);
 
-               sctx->compute_scratch_buffer =
-                               si_resource_create_custom(&sctx->screen->b.b,
-                                PIPE_USAGE_DEFAULT, scratch_needed);
+               sctx->compute_scratch_buffer = (struct r600_resource*)
+                       pipe_buffer_create(&sctx->screen->b.b, 0,
+                                          PIPE_USAGE_DEFAULT, scratch_needed);
 
                if (!sctx->compute_scratch_buffer)
                        return false;
        }
 
        if (sctx->compute_scratch_buffer != shader->scratch_bo && 
scratch_needed) {
                uint64_t scratch_va = sctx->compute_scratch_buffer->gpu_address;
 
                si_shader_apply_scratch_relocs(sctx, shader, config, 
scratch_va);
 
diff --git a/src/gallium/drivers/radeonsi/si_cp_dma.c 
b/src/gallium/drivers/radeonsi/si_cp_dma.c
index 0e8d1e8..6667ae3 100644
--- a/src/gallium/drivers/radeonsi/si_cp_dma.c
+++ b/src/gallium/drivers/radeonsi/si_cp_dma.c
@@ -229,24 +229,23 @@ static void si_cp_dma_realign_engine(struct si_context 
*sctx, unsigned size)
        unsigned scratch_size = CP_DMA_ALIGNMENT * 2;
 
        assert(size < CP_DMA_ALIGNMENT);
 
        /* Use the scratch buffer as the dummy buffer. The 3D engine should be
         * idle at this point.
         */
        if (!sctx->scratch_buffer ||
            sctx->scratch_buffer->b.b.width0 < scratch_size) {
                r600_resource_reference(&sctx->scratch_buffer, NULL);
-               sctx->scratch_buffer =
-                       si_resource_create_custom(&sctx->screen->b.b,
-                                                 PIPE_USAGE_DEFAULT,
-                                                 scratch_size);
+               sctx->scratch_buffer = (struct r600_resource*)
+                       pipe_buffer_create(&sctx->screen->b.b, 0,
+                                          PIPE_USAGE_DEFAULT, scratch_size);
                if (!sctx->scratch_buffer)
                        return;
                sctx->emit_scratch_reloc = true;
        }
 
        si_cp_dma_prepare(sctx, &sctx->scratch_buffer->b.b,
                          &sctx->scratch_buffer->b.b, size, size, &dma_flags);
 
        va = sctx->scratch_buffer->gpu_address;
        si_emit_cp_dma(sctx, va, va + CP_DMA_ALIGNMENT, size, dma_flags,
diff --git a/src/gallium/drivers/radeonsi/si_pipe.h 
b/src/gallium/drivers/radeonsi/si_pipe.h
index 6b74e49..0240a3c 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.h
+++ b/src/gallium/drivers/radeonsi/si_pipe.h
@@ -394,28 +394,20 @@ void si_init_perfcounters(struct si_screen *screen);
 struct pipe_video_codec *si_uvd_create_decoder(struct pipe_context *context,
                                               const struct pipe_video_codec 
*templ);
 
 struct pipe_video_buffer *si_video_buffer_create(struct pipe_context *pipe,
                                                 const struct pipe_video_buffer 
*tmpl);
 
 /*
  * common helpers
  */
 
-static inline struct r600_resource *
-si_resource_create_custom(struct pipe_screen *screen,
-                         unsigned usage, unsigned size)
-{
-       assert(size);
-       return r600_resource(pipe_buffer_create(screen, 0, usage, size));
-}
-
 static inline void
 si_invalidate_draw_sh_constants(struct si_context *sctx)
 {
        sctx->last_base_vertex = SI_BASE_VERTEX_UNKNOWN;
 }
 
 static inline void
 si_set_atom_dirty(struct si_context *sctx,
                  struct r600_atom *atom, bool dirty)
 {
diff --git a/src/gallium/drivers/radeonsi/si_shader.c 
b/src/gallium/drivers/radeonsi/si_shader.c
index 8edd593..2b8c168 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -5970,23 +5970,23 @@ int si_shader_binary_upload(struct si_screen *sscreen, 
struct si_shader *shader)
        const struct radeon_shader_binary *mainb = &shader->binary;
        unsigned bo_size = si_get_shader_binary_size(shader) +
                           (!epilog ? mainb->rodata_size : 0);
        unsigned char *ptr;
 
        assert(!prolog || !prolog->rodata_size);
        assert((!prolog && !epilog) || !mainb->rodata_size);
        assert(!epilog || !epilog->rodata_size);
 
        r600_resource_reference(&shader->bo, NULL);
-       shader->bo = si_resource_create_custom(&sscreen->b.b,
-                                              PIPE_USAGE_IMMUTABLE,
-                                              bo_size);
+       shader->bo = (struct r600_resource*)
+                    pipe_buffer_create(&sscreen->b.b, 0,
+                                       PIPE_USAGE_IMMUTABLE, bo_size);
        if (!shader->bo)
                return -ENOMEM;
 
        /* Upload. */
        ptr = sscreen->b.ws->buffer_map(shader->bo->buf, NULL,
                                        PIPE_TRANSFER_READ_WRITE);
 
        if (prolog) {
                util_memcpy_cpu_to_le32(ptr, prolog->code, prolog->code_size);
                ptr += prolog->code_size;
diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c 
b/src/gallium/drivers/radeonsi/si_state_shaders.c
index 3037a04..e4ceb3b 100644
--- a/src/gallium/drivers/radeonsi/si_state_shaders.c
+++ b/src/gallium/drivers/radeonsi/si_state_shaders.c
@@ -1898,22 +1898,22 @@ static bool si_update_spi_tmpring_size(struct 
si_context *sctx)
        unsigned scratch_needed_size = scratch_bytes_per_wave *
                sctx->scratch_waves;
        unsigned spi_tmpring_size;
        int r;
 
        if (scratch_needed_size > 0) {
                if (scratch_needed_size > current_scratch_buffer_size) {
                        /* Create a bigger scratch buffer */
                        r600_resource_reference(&sctx->scratch_buffer, NULL);
 
-                       sctx->scratch_buffer =
-                                       
si_resource_create_custom(&sctx->screen->b.b,
+                       sctx->scratch_buffer = (struct r600_resource*)
+                                       pipe_buffer_create(&sctx->screen->b.b, 
0,
                                        PIPE_USAGE_DEFAULT, 
scratch_needed_size);
                        if (!sctx->scratch_buffer)
                                return false;
                        sctx->emit_scratch_reloc = true;
                }
 
                /* Update the shaders, so they are using the latest scratch.  
The
                 * scratch buffer may have been changed since these shaders were
                 * last used, so we still need to try to update them, even if
                 * they require scratch buffers smaller than the current size.
-- 
2.7.4

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

Reply via email to