summaryrefslogtreecommitdiff
path: root/src/sna/sna_trapezoids_imprecise.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2013-10-08 09:40:34 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2013-10-08 09:40:34 +0100
commit082c08789cf9a8c0cc2bf44d0fee579b96c0798f (patch)
tree85e06a4aeacef4cc54dd8dccad088d910d8be3c7 /src/sna/sna_trapezoids_imprecise.c
parent06a8ad9690590a605b1564012d062b98c60546a6 (diff)
sna: Rework the num_threads refinement to avoid the division
We can replace the division by a multiplication. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna/sna_trapezoids_imprecise.c')
-rw-r--r--src/sna/sna_trapezoids_imprecise.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/sna/sna_trapezoids_imprecise.c b/src/sna/sna_trapezoids_imprecise.c
index 4809e9cc..3624dd63 100644
--- a/src/sna/sna_trapezoids_imprecise.c
+++ b/src/sna/sna_trapezoids_imprecise.c
@@ -1982,7 +1982,7 @@ imprecise_trapezoid_span_converter(struct sna *sna,
y = clip.extents.y1;
h = clip.extents.y2 - clip.extents.y1;
h = (h + num_threads - 1) / num_threads;
- num_threads = (clip.extents.y2 - clip.extents.y1 + h - 1) / h;
+ num_threads -= (num_threads-1) * h >= clip.extents.y2 - clip.extents.y1;
for (n = 1; n < num_threads; n++) {
threads[n] = threads[0];
@@ -2841,7 +2841,7 @@ trapezoid_span_inplace__x8r8g8b8(CARD8 op,
y = region.extents.y1;
h = region.extents.y2 - region.extents.y1;
h = (h + num_threads - 1) / num_threads;
- num_threads = (region.extents.y2 - region.extents.y1 + h - 1) / h;
+ num_threads -= (num_threads-1) * h >= region.extents.y2 - region.extents.y1;
for (n = 1; n < num_threads; n++) {
threads[n] = threads[0];
@@ -3112,7 +3112,7 @@ imprecise_trapezoid_span_inplace(struct sna *sna,
y = region.extents.y1;
h = region.extents.y2 - region.extents.y1;
h = (h + num_threads - 1) / num_threads;
- num_threads = (region.extents.y2 - region.extents.y1 + h - 1) / h;
+ num_threads -= (num_threads-1) * h >= region.extents.y2 - region.extents.y1;
for (n = 1; n < num_threads; n++) {
threads[n] = threads[0];