<div dir="ltr"><div dir="ltr"><div>I've run the test with applied patch and it's successfully passed.</div><div>Also, this patch fixed an one issue from another ticket - <a href="https://bugs.freedesktop.org/show_bug.cgi?id=109594">https://bugs.freedesktop.org/show_bug.cgi?id=109594</a> - with this patch, totem app doesn't crashes at resizing </div><div><br></div><div>Thanks!</div><div><br></div><div>Tested-by: Paul Chelombitko <<a href="mailto:qamonstergl@gmail.com">qamonstergl@gmail.com</a>></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">чт, 21 февр. 2019 г. в 12:03, Eleni Maria Stea <<a href="mailto:estea@igalia.com">estea@igalia.com</a>>:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Calculating the scissor rectangle fields with the y flipped (0 on top)<br>
can generate negative values that will cause assertion failure later on<br>
as the scissor fields are all unsigned. We must clamp the bbox values<br>
again to make sure they don't exceed the fb_height. Also fixed a<br>
calculation error.<br>
<br>
Bugzilla: <a href="https://bugs.freedesktop.org/show_bug.cgi?id=108999" rel="noreferrer" target="_blank">https://bugs.freedesktop.org/show_bug.cgi?id=108999</a><br>
<br>
v2:<br>
   - I initially clamped the values inside the if (Y is flipped) case<br>
   and I made a mistake in the calculation: the clamp of the bbox[2] should<br>
   be a check if (bbox[2] >= fbheight) bbox[2] = fbheight - 1 instead and I<br>
   shouldn't have changed the ScissorRectangleYMax calculation. As the<br>
   fixed code is equivalent with using CLAMP instead of MAX2 at the top of<br>
   the function when bbox[2] and bbox[3] are calculated, and the 2nd is more<br>
   clear, I replaced it. (Nanley Chery)<br>
<br>
v3:<br>
   - Reversed the CLAMP change in bbox[3] as the API guarantees that the<br>
   viewport height is positive. (Nanley Chery)<br>
---<br>
 src/mesa/drivers/dri/i965/genX_state_upload.c | 2 +-<br>
 1 file changed, 1 insertion(+), 1 deletion(-)<br>
<br>
diff --git a/src/mesa/drivers/dri/i965/genX_state_upload.c b/src/mesa/drivers/dri/i965/genX_state_upload.c<br>
index dcdfb3c9292..47f3741e673 100644<br>
--- a/src/mesa/drivers/dri/i965/genX_state_upload.c<br>
+++ b/src/mesa/drivers/dri/i965/genX_state_upload.c<br>
@@ -2445,7 +2445,7 @@ set_scissor_bits(const struct gl_context *ctx, int i,<br>
<br>
    bbox[0] = MAX2(ctx->ViewportArray[i].X, 0);<br>
    bbox[1] = MIN2(bbox[0] + ctx->ViewportArray[i].Width, fb_width);<br>
-   bbox[2] = MAX2(ctx->ViewportArray[i].Y, 0);<br>
+   bbox[2] = CLAMP(ctx->ViewportArray[i].Y, 0, fb_height);<br>
    bbox[3] = MIN2(bbox[2] + ctx->ViewportArray[i].Height, fb_height);<br>
    _mesa_intersect_scissor_bounding_box(ctx, i, bbox);<br>
<br>
-- <br>
2.20.1<br>
<br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a></blockquote></div>