[Mesa-dev] [PATCH 1/3] i965: Make BLORP a fallback in blit maps

Nanley Chery nanleychery at gmail.com
Wed May 30 20:44:33 UTC 2018


We're going to enable blit maps on row pitches greater than the BLT
engine's limit. Make blit maps fall back to BLORP which can handle such
pitches.
---
 src/mesa/drivers/dri/i965/intel_blit.c        |  6 +++++
 src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 24 +++++--------------
 2 files changed, 12 insertions(+), 18 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/intel_blit.c b/src/mesa/drivers/dri/i965/intel_blit.c
index 90784c5b195..17890347777 100644
--- a/src/mesa/drivers/dri/i965/intel_blit.c
+++ b/src/mesa/drivers/dri/i965/intel_blit.c
@@ -388,6 +388,12 @@ emit_miptree_blit(struct brw_context *brw,
                   uint32_t width, uint32_t height,
                   bool reverse, enum gl_logicop_mode logicop)
 {
+   const struct gen_device_info *devinfo = &brw->screen->devinfo;
+
+   /* We don't use the blitter gen6+. */
+   if (devinfo->gen >= 6)
+      return false;
+
    /* According to the Ivy Bridge PRM, Vol1 Part4, section 1.2.1.2 (Graphics
     * Data Size Limitations):
     *
diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
index 7d1fa96b919..293088bd0cf 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
@@ -3090,22 +3090,17 @@ intel_miptree_unmap_blit(struct brw_context *brw,
 			 unsigned int level,
 			 unsigned int slice)
 {
-   const struct gen_device_info *devinfo = &brw->screen->devinfo;
    struct gl_context *ctx = &brw->ctx;
 
    intel_miptree_unmap_raw(map->linear_mt);
 
    if (map->mode & GL_MAP_WRITE_BIT) {
-      if (devinfo->gen >= 6) {
+      if (!intel_miptree_copy(brw, map->linear_mt, 0, 0, 0, 0,
+                              mt, level, slice,
+                              map->x, map->y, map->w, map->h)) {
          brw_blorp_copy_miptrees(brw, map->linear_mt, 0, 0,
                                  mt, level, slice,
                                  0, 0, map->x, map->y, map->w, map->h);
-      } else {
-         bool ok = intel_miptree_copy(brw,
-                                      map->linear_mt, 0, 0, 0, 0,
-                                      mt, level, slice, map->x, map->y,
-                                      map->w, map->h);
-         WARN_ONCE(!ok, "Failed to blit from linear temporary mapping");
       }
    }
 
@@ -3118,7 +3113,6 @@ intel_miptree_map_blit(struct brw_context *brw,
 		       struct intel_miptree_map *map,
 		       unsigned int level, unsigned int slice)
 {
-   const struct gen_device_info *devinfo = &brw->screen->devinfo;
    map->linear_mt = intel_miptree_create(brw, GL_TEXTURE_2D, mt->format,
                                          /* first_level */ 0,
                                          /* last_level */ 0,
@@ -3138,18 +3132,12 @@ intel_miptree_map_blit(struct brw_context *brw,
     * temporary buffer back out.
     */
    if (!(map->mode & GL_MAP_INVALIDATE_RANGE_BIT)) {
-      if (devinfo->gen >= 6) {
+      if (!intel_miptree_copy(brw, mt, level, slice, map->x, map->y,
+                              map->linear_mt, 0, 0, 0, 0,
+                              map->w, map->h)) {
          brw_blorp_copy_miptrees(brw, mt, level, slice,
                                  map->linear_mt, 0, 0,
                                  map->x, map->y, 0, 0, map->w, map->h);
-      } else {
-         if (!intel_miptree_copy(brw,
-                                 mt, level, slice, map->x, map->y,
-                                 map->linear_mt, 0, 0, 0, 0,
-                                 map->w, map->h)) {
-            fprintf(stderr, "Failed to blit\n");
-            goto fail;
-         }
       }
    }
 
-- 
2.17.0



More information about the mesa-dev mailing list