[Mesa-dev] [PATCH 3/6] i965: Create and use #defines for blitter constraints
Anuj Phogat
anuj.phogat at gmail.com
Tue Mar 10 08:31:46 PDT 2015
On Mon, Mar 9, 2015 at 9:43 PM, Ben Widawsky
<benjamin.widawsky at intel.com> wrote:
> Signed-off-by: Ben Widawsky <ben at bwidawsk.net>
> ---
> src/mesa/drivers/dri/i965/intel_blit.c | 11 ++++++-----
> src/mesa/drivers/dri/i965/intel_blit.h | 3 +++
> src/mesa/drivers/dri/i965/intel_copy_image.c | 7 ++++---
> src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 9 +++++----
> 4 files changed, 18 insertions(+), 12 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/intel_blit.c b/src/mesa/drivers/dri/i965/intel_blit.c
> index ee2a4ef..b93794b 100644
> --- a/src/mesa/drivers/dri/i965/intel_blit.c
> +++ b/src/mesa/drivers/dri/i965/intel_blit.c
> @@ -206,8 +206,8 @@ intel_miptree_blit(struct brw_context *brw,
> * As a result of these two limitations, we can only use the blitter to do
> * this copy when the miptree's pitch is less than 32k.
> */
> - if (src_mt->pitch >= 32768 ||
> - dst_mt->pitch >= 32768) {
> + if (src_mt->pitch >= INTEL_MAX_BLIT_PITCH ||
> + dst_mt->pitch >= INTEL_MAX_BLIT_PITCH) {
> perf_debug("Falling back due to >=32k pitch\n");
> return false;
> }
> @@ -244,9 +244,10 @@ intel_miptree_blit(struct brw_context *brw,
> * value. The values we're working with are unsigned, so make sure we don't
> * overflow.
> */
> - if (src_x >= 32768 || src_y >= 32768 || dst_x >= 32768 || dst_y >= 32768) {
> - perf_debug("Falling back due to >=32k offset [src(%d, %d) dst(%d, %d)]\n",
> - src_x, src_y, dst_x, dst_y);
> + 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) {
> + 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);
I think above line should be:
INTEL_MAX_BLIT_PITCH >> 10, src_x, src_y, dst_x, dst_y);
> return false;
> }
>
> diff --git a/src/mesa/drivers/dri/i965/intel_blit.h b/src/mesa/drivers/dri/i965/intel_blit.h
> index f563939..531d329 100644
> --- a/src/mesa/drivers/dri/i965/intel_blit.h
> +++ b/src/mesa/drivers/dri/i965/intel_blit.h
> @@ -30,6 +30,9 @@
>
> #include "brw_context.h"
>
> +#define INTEL_MAX_BLIT_PITCH 32768
> +#define INTEL_MAX_BLIT_ROWS 32768
> +
> bool
> intelEmitCopyBlit(struct brw_context *brw,
> GLuint cpp,
> diff --git a/src/mesa/drivers/dri/i965/intel_copy_image.c b/src/mesa/drivers/dri/i965/intel_copy_image.c
> index bf6b5e7..689e9c7 100644
> --- a/src/mesa/drivers/dri/i965/intel_copy_image.c
> +++ b/src/mesa/drivers/dri/i965/intel_copy_image.c
> @@ -69,9 +69,10 @@ copy_image_with_blitter(struct brw_context *brw,
> * As a result of these two limitations, we can only use the blitter to do
> * this copy when the miptree's pitch is less than 32k.
> */
> - if (src_mt->pitch >= 32768 ||
> - dst_mt->pitch >= 32768) {
> - perf_debug("Falling back due to >=32k pitch\n");
> + if (src_mt->pitch >= INTEL_MAX_BLIT_PITCH ||
> + dst_mt->pitch >= INTEL_MAX_BLIT_PITCH) {
> + perf_debug("Falling back due to >=%dk pitch\n",
> + INTEL_MAX_BLIT_PITCH >> 20);
You mean INTEL_MAX_BLIT_PITCH >> 10 ?
> return false;
> }
>
> diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
> index cc422d3..16bd151 100644
> --- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
> +++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
> @@ -501,8 +501,9 @@ intel_miptree_choose_tiling(struct brw_context *brw,
> if (minimum_pitch < 64)
> return I915_TILING_NONE;
>
> - if (ALIGN(minimum_pitch, 512) >= 32768 ||
> - mt->total_width >= 32768 || mt->total_height >= 32768) {
> + if (ALIGN(minimum_pitch, 512) >= INTEL_MAX_BLIT_PITCH ||
> + mt->total_width >= INTEL_MAX_BLIT_PITCH ||
> + mt->total_height >= INTEL_MAX_BLIT_ROWS) {
> perf_debug("%dx%d miptree too large to blit, falling back to untiled",
> mt->total_width, mt->total_height);
> return I915_TILING_NONE;
> @@ -2296,11 +2297,11 @@ can_blit_slice(struct intel_mipmap_tree *mt,
> uint32_t image_x;
> uint32_t image_y;
> intel_miptree_get_image_offset(mt, level, slice, &image_x, &image_y);
> - if (image_x >= 32768 || image_y >= 32768)
> + if (image_x >= INTEL_MAX_BLIT_PITCH || image_y >= INTEL_MAX_BLIT_ROWS)
> return false;
>
> /* See intel_miptree_blit() for details on the 32k pitch limit. */
> - if (mt->pitch >= 32768)
> + if (mt->pitch >= INTEL_MAX_BLIT_PITCH)
> return false;
>
> return true;
> --
> 2.3.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list