[Mesa-dev] [PATCH 4/6] i965: Extract blit height max

Ben Widawsky benjamin.widawsky at intel.com
Mon Aug 10 16:15:08 PDT 2015


The blit engine in GEN hardware has constraints. These constraints are a
function of tile parameters as well as height. The current code is very dumb in
terms of determine max blit parameters. Since we'll be expanding on it, having
the abstraction makes things easier.

Note that this doesn't change all places which check blitter requirements. I
will be adding those as a separate patch(es) since the original series, which
was well tested, did not include those.

This was requested by Jordan and Jason.

Signed-off-by: Ben Widawsky <ben at bwidawsk.net>
---
 src/mesa/drivers/dri/i965/intel_blit.c | 12 +++++-------
 src/mesa/drivers/dri/i965/intel_blit.h | 10 ++++++++++
 2 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/intel_blit.c b/src/mesa/drivers/dri/i965/intel_blit.c
index 27b7c22..2929ed8 100644
--- a/src/mesa/drivers/dri/i965/intel_blit.c
+++ b/src/mesa/drivers/dri/i965/intel_blit.c
@@ -349,14 +349,12 @@ intel_miptree_blit(struct brw_context *brw,
    dst_x += dst_image_x;
    dst_y += dst_image_y;
 
-   /* The blitter interprets the 16-bit destination x/y as a signed 16-bit
-    * value. The values we're working with are unsigned, so make sure we don't
-    * overflow.
-    */
-   if (src_x >= INTEL_MAX_BLIT_PITCH || src_y >= INTEL_MAX_BLIT_ROWS ||
-       dst_x >= INTEL_MAX_BLIT_PITCH || dst_y >= INTEL_MAX_BLIT_ROWS) {
+   if (src_x >= INTEL_MAX_BLIT_PITCH || dst_x >= INTEL_MAX_BLIT_PITCH ||
+       src_y >= intel_blit_max_height() ||
+       dst_y >= intel_blit_max_height()) {
       perf_debug("Falling back due to >=%dk offset [src(%d, %d) dst(%d, %d)]\n",
-                 src_x, src_y, dst_x, dst_y, INTEL_MAX_BLIT_PITCH >> 20);
+                 src_x, src_y, dst_x, dst_y,
+                 MAX2(intel_blit_max_height(), INTEL_MAX_BLIT_PITCH) >> 20);
       return false;
    }
 
diff --git a/src/mesa/drivers/dri/i965/intel_blit.h b/src/mesa/drivers/dri/i965/intel_blit.h
index 85b30f1..303b761 100644
--- a/src/mesa/drivers/dri/i965/intel_blit.h
+++ b/src/mesa/drivers/dri/i965/intel_blit.h
@@ -82,4 +82,14 @@ void intel_emit_linear_blit(struct brw_context *brw,
 			    unsigned int src_offset,
 			    unsigned int size);
 
+static inline uint32_t
+intel_blit_max_height(void)
+{
+   /* The docs say that the blitter is capable of transferring 65536 scanlines
+    * per blit, however the commands we use only have a signed 16b value thus
+    * making the practical limit 15b.
+    */
+   return INTEL_MAX_BLIT_ROWS;
+}
+
 #endif
-- 
2.5.0



More information about the mesa-dev mailing list