panfrost: Fix pan_blit_ctx_init() when start > end

This can happen when one wants to obtain a mirrored view. We need
to make sure the min <= max before emitting the viewport.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12552>
This commit is contained in:
Boris Brezillon 2021-06-01 10:18:00 +02:00 committed by Marge Bot
parent 1c953ba212
commit e466e0ecd2

View file

@ -1431,10 +1431,10 @@ pan_blit_ctx_init(struct panfrost_device *dev,
unsigned dst_w = u_minify(info->dst.planes[0].image->layout.width, info->dst.level);
unsigned dst_h = u_minify(info->dst.planes[0].image->layout.height, info->dst.level);
unsigned minx = MAX2(info->dst.start.x, 0);
unsigned miny = MAX2(info->dst.start.y, 0);
unsigned maxx = MIN2(info->dst.end.x, dst_w - 1);
unsigned maxy = MIN2(info->dst.end.y, dst_h - 1);
unsigned maxx = MIN2(MAX2(info->dst.start.x, info->dst.end.x), dst_w - 1);
unsigned maxy = MIN2(MAX2(info->dst.start.y, info->dst.end.y), dst_h - 1);
unsigned minx = MAX2(MIN3(info->dst.start.x, info->dst.end.x, maxx), 0);
unsigned miny = MAX2(MIN3(info->dst.start.y, info->dst.end.y, maxy), 0);
if (info->scissor.enable) {
minx = MAX2(minx, info->scissor.minx);