From 802018df5f4c193f1c642a187ecf3c429e2c2ada Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Fri, 12 Sep 2014 14:37:40 +0800 Subject: ilo: fix builder size checks for BLT buffer clear/copy In buf_clear_region() and buf_copy_region(), max_cmd_size was set to 0. If either of the functions is called and there is not enough space in the builder, the next ilo_cp_flush() will fail silently in a release build. Replace magic numbers by size defines in tex_clear_region()/tex_copy_region() for consistency and readability. --- src/gallium/drivers/ilo/ilo_blitter_blt.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/gallium/drivers/ilo/ilo_blitter_blt.c b/src/gallium/drivers/ilo/ilo_blitter_blt.c index 524b92af4fa..0320eeb70fa 100644 --- a/src/gallium/drivers/ilo/ilo_blitter_blt.c +++ b/src/gallium/drivers/ilo/ilo_blitter_blt.c @@ -137,7 +137,8 @@ buf_clear_region(struct ilo_blitter *blitter, dst.bo = buf->bo; dst.offset = offset; - ilo_blitter_blt_begin(blitter, 0, + ilo_blitter_blt_begin(blitter, GEN6_COLOR_BLT__SIZE * + (1 + size / 32764 / gen6_blt_max_scanlines), dst.bo, INTEL_TILING_NONE, NULL, INTEL_TILING_NONE); while (size) { @@ -188,7 +189,8 @@ buf_copy_region(struct ilo_blitter *blitter, src.offset = src_offset; src.pitch = 0; - ilo_blitter_blt_begin(blitter, 0, + ilo_blitter_blt_begin(blitter, GEN6_SRC_COPY_BLT__SIZE * + (1 + size / 32764 / gen6_blt_max_scanlines), dst_buf->bo, INTEL_TILING_NONE, src_buf->bo, INTEL_TILING_NONE); while (size) { @@ -255,7 +257,8 @@ tex_clear_region(struct ilo_blitter *blitter, dst.pitch = dst_tex->layout.bo_stride; dst.tiling = dst_tex->layout.tiling; - swctrl = ilo_blitter_blt_begin(blitter, dst_box->depth * 6, + swctrl = ilo_blitter_blt_begin(blitter, + GEN6_XY_COLOR_BLT__SIZE * dst_box->depth, dst_tex->bo, dst_tex->layout.tiling, NULL, INTEL_TILING_NONE); for (slice = 0; slice < dst_box->depth; slice++) { @@ -347,7 +350,8 @@ tex_copy_region(struct ilo_blitter *blitter, src.pitch = src_tex->layout.bo_stride; src.tiling = src_tex->layout.tiling; - swctrl = ilo_blitter_blt_begin(blitter, src_box->depth * 8, + swctrl = ilo_blitter_blt_begin(blitter, + GEN6_XY_SRC_COPY_BLT__SIZE * src_box->depth, dst.bo, dst.tiling, src.bo, src.tiling); for (slice = 0; slice < src_box->depth; slice++) { -- cgit v1.2.3