radeonsi: allow clearing buffers >= 4 GB
authorMarek Olšák <marek.olsak@amd.com>
Sun, 10 Apr 2016 15:21:19 +0000 (17:21 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Tue, 12 Apr 2016 12:29:48 +0000 (14:29 +0200)
Only CMASK and DCC clears can use this, because only textures can be so
large.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
src/gallium/drivers/r600/r600_blit.c
src/gallium/drivers/radeon/r600_pipe_common.c
src/gallium/drivers/radeon/r600_pipe_common.h
src/gallium/drivers/radeonsi/si_cp_dma.c

index 7ddd4fa063f26ae937cda40034909b617249a5e9..9664391224344df3188f991a01a47f5d6ce2dfc4 100644 (file)
@@ -581,7 +581,7 @@ static void r600_copy_global_buffer(struct pipe_context *ctx,
 }
 
 static void r600_clear_buffer(struct pipe_context *ctx, struct pipe_resource *dst,
-                             unsigned offset, unsigned size, unsigned value,
+                             uint64_t offset, uint64_t size, unsigned value,
                              bool is_framebuffer)
 {
        struct r600_context *rctx = (struct r600_context*)ctx;
index f58733278c8b2bb5459f5d15ca5351231aad6aba..a64a091a4fd396b1599f210b7924c8995848ad67 100644 (file)
@@ -963,7 +963,7 @@ bool r600_can_dump_shader(struct r600_common_screen *rscreen,
 }
 
 void r600_screen_clear_buffer(struct r600_common_screen *rscreen, struct pipe_resource *dst,
-                             unsigned offset, unsigned size, unsigned value,
+                             uint64_t offset, uint64_t size, unsigned value,
                              bool is_framebuffer)
 {
        struct r600_common_context *rctx = (struct r600_common_context*)rscreen->aux_context;
index 9b28758d9f1b96386c457639f6cc2fd873dbeb84..cb8a34bf4ec222ef4b2868efde860f7288885232 100644 (file)
@@ -475,7 +475,7 @@ struct r600_common_context {
                         const struct pipe_box *src_box);
 
        void (*clear_buffer)(struct pipe_context *ctx, struct pipe_resource *dst,
-                            unsigned offset, unsigned size, unsigned value,
+                            uint64_t offset, uint64_t size, unsigned value,
                             bool is_framebuffer);
 
        void (*blit_decompress_depth)(struct pipe_context *ctx,
@@ -547,7 +547,7 @@ void r600_context_add_resource_size(struct pipe_context *ctx, struct pipe_resour
 bool r600_can_dump_shader(struct r600_common_screen *rscreen,
                          unsigned processor);
 void r600_screen_clear_buffer(struct r600_common_screen *rscreen, struct pipe_resource *dst,
-                             unsigned offset, unsigned size, unsigned value,
+                             uint64_t offset, uint64_t size, unsigned value,
                              bool is_framebuffer);
 struct pipe_resource *r600_resource_create_common(struct pipe_screen *screen,
                                                  const struct pipe_resource *templ);
index dc62415823edac09fbf6db736e99302a5976ea17..001ddd4bfae38a4e6a1bb4aeb90859e4bd478594 100644 (file)
@@ -124,7 +124,7 @@ static unsigned get_tc_l2_flag(struct si_context *sctx, bool is_framebuffer)
 
 static void si_cp_dma_prepare(struct si_context *sctx, struct pipe_resource *dst,
                              struct pipe_resource *src, unsigned byte_count,
-                             unsigned remaining_size, unsigned *flags)
+                             uint64_t remaining_size, unsigned *flags)
 {
        si_need_cs_space(sctx);
 
@@ -158,7 +158,7 @@ static void si_cp_dma_prepare(struct si_context *sctx, struct pipe_resource *dst
 #define CP_DMA_MAX_BYTE_COUNT  ((1 << 21) - CP_DMA_ALIGNMENT)
 
 static void si_clear_buffer(struct pipe_context *ctx, struct pipe_resource *dst,
-                           unsigned offset, unsigned size, unsigned value,
+                           uint64_t offset, uint64_t size, unsigned value,
                            bool is_framebuffer)
 {
        struct si_context *sctx = (struct si_context*)ctx;
@@ -180,7 +180,7 @@ static void si_clear_buffer(struct pipe_context *ctx, struct pipe_resource *dst,
                                                      sctx->b.gfx.cs,
                                                      PIPE_TRANSFER_WRITE);
                map += offset;
-               for (unsigned i = 0; i < size; i++) {
+               for (uint64_t i = 0; i < size; i++) {
                        unsigned byte_within_dword = (offset + i) % 4;
                        *map++ = (value >> (byte_within_dword * 8)) & 0xff;
                }