<html>
<head>
<base href="https://bugs.freedesktop.org/" />
</head>
<body>
<p>
<div>
<b><a class="bz_bug_link
bz_status_REOPENED "
title="REOPENED - [sna suse] ddx assertion hits"
href="https://bugs.freedesktop.org/show_bug.cgi?id=70461#c72">Comment # 72</a>
on <a class="bz_bug_link
bz_status_REOPENED "
title="REOPENED - [sna suse] ddx assertion hits"
href="https://bugs.freedesktop.org/show_bug.cgi?id=70461">bug 70461</a>
from <span class="vcard"><a class="email" href="mailto:chris@chris-wilson.co.uk" title="Chris Wilson <chris@chris-wilson.co.uk>"> <span class="fn">Chris Wilson</span></a>
</span></b>
<pre>The only think that strikes me is overflow, could you please test:
diff --git a/src/sna/sna_trapezoids_precise.c
b/src/sna/sna_trapezoids_precise.c
index c595bfd..f8512e3 100644
--- a/src/sna/sna_trapezoids_precise.c
+++ b/src/sna/sna_trapezoids_precise.c
@@ -555,6 +555,7 @@ polygon_add_edge(struct polygon *polygon,
Ex = (int64_t)(edge->p2.x - edge->p1.x) * SAMPLES_X;
Ey = (int64_t)(edge->p2.y - edge->p1.y) * SAMPLES_Y * (2 <<
16);
+ assert(Ey > 0);
e->dxdy.quo = Ex * (2 << 16) / Ey;
e->dxdy.rem = Ex * (2 << 16) % Ey;
@@ -566,7 +567,12 @@ polygon_add_edge(struct polygon *polygon,
tmp = (int64_t)edge->p1.x * SAMPLES_X;
e->x.quo += (tmp >> 16) + dx;
- e->x.rem += ((tmp & ((1 << 16) - 1)) * Ey) / (1 << 16);
+ tmp &= (1 << 16) - 1;
+ if (Ey < INT64_MAX / (1 << 16))
+ tmp = (tmp * Ey) / (1 << 16);
+ else /* Handle overflow by sacrificing precision. */
+ tmp *= Ey / (1 << 16);
+ e->x.rem += tmp;
if (e->x.rem < 0) {
e->x.quo--;</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the QA Contact for the bug.</li>
</ul>
</body>
</html>