[Mesa-dev] [PATCH 2/6] blorp: Make blorp_buffer_copy work on Gen4-6.

Kenneth Graunke kenneth at whitecape.org
Tue Aug 29 21:28:39 UTC 2017


Gen4-6 can only handle surfaces up to 8192.  Only Gen7+ can do 16384.
---
 src/intel/blorp/blorp_blit.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/src/intel/blorp/blorp_blit.c b/src/intel/blorp/blorp_blit.c
index 998fd9b6d39..d3b51a18161 100644
--- a/src/intel/blorp/blorp_blit.c
+++ b/src/intel/blorp/blorp_blit.c
@@ -2594,17 +2594,18 @@ do_buffer_copy(struct blorp_batch *batch,
               0, 0, 0, 0, width, height);
 }
 
-/* This is maximum possible width/height our HW can handle */
-#define MAX_SURFACE_DIM (1ull << 14)
-
 void
 blorp_buffer_copy(struct blorp_batch *batch,
                   void *src_bo, uint64_t src_offset,
                   void *dst_bo, uint64_t dst_offset,
                   uint64_t size)
 {
+   const struct gen_device_info *devinfo = batch->blorp->isl_dev->info;
    uint64_t copy_size = size;
 
+   /* This is maximum possible width/height our HW can handle */
+   uint64_t max_surface_dim = 1 << (devinfo->gen >= 7 ? 14 : 13);
+
    /* First, we compute the biggest format that can be used with the
     * given offsets and size.
     */
@@ -2614,22 +2615,22 @@ blorp_buffer_copy(struct blorp_batch *batch,
    bs = gcd_pow2_u64(bs, size);
 
    /* First, we make a bunch of max-sized copies */
-   uint64_t max_copy_size = MAX_SURFACE_DIM * MAX_SURFACE_DIM * bs;
+   uint64_t max_copy_size = max_surface_dim * max_surface_dim * bs;
    while (copy_size >= max_copy_size) {
       do_buffer_copy(batch, src_bo, src_offset, dst_bo, dst_offset,
-                     MAX_SURFACE_DIM, MAX_SURFACE_DIM, bs);
+                     max_surface_dim, max_surface_dim, bs);
       copy_size -= max_copy_size;
       src_offset += max_copy_size;
       dst_offset += max_copy_size;
    }
 
    /* Now make a max-width copy */
-   uint64_t height = copy_size / (MAX_SURFACE_DIM * bs);
-   assert(height < MAX_SURFACE_DIM);
+   uint64_t height = copy_size / (max_surface_dim * bs);
+   assert(height < max_surface_dim);
    if (height != 0) {
-      uint64_t rect_copy_size = height * MAX_SURFACE_DIM * bs;
+      uint64_t rect_copy_size = height * max_surface_dim * bs;
       do_buffer_copy(batch, src_bo, src_offset, dst_bo, dst_offset,
-                     MAX_SURFACE_DIM, height, bs);
+                     max_surface_dim, height, bs);
       copy_size -= rect_copy_size;
       src_offset += rect_copy_size;
       dst_offset += rect_copy_size;
-- 
2.14.1



More information about the mesa-dev mailing list