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>
This commit is contained in:
parent
06a8ad9690
commit
082c08789c
|
|
@ -274,7 +274,7 @@ void sna_image_composite(pixman_op_t op,
|
|||
|
||||
y = dst_y;
|
||||
dy = (height + num_threads - 1) / num_threads;
|
||||
num_threads = (height + dy - 1) / dy;
|
||||
num_threads -= (num_threads-1) * dy >= height;
|
||||
|
||||
data[0].op = op;
|
||||
data[0].src = src;
|
||||
|
|
|
|||
|
|
@ -390,7 +390,7 @@ trapezoids_fallback(struct sna *sna,
|
|||
|
||||
y = bounds.y1;
|
||||
dy = (height + num_threads - 1) / num_threads;
|
||||
num_threads = (bounds.y2 - bounds.y1 + dy - 1) / dy;
|
||||
num_threads -= (num_threads-1) * dy >= bounds.y2 - bounds.y1;
|
||||
|
||||
for (n = 1; n < num_threads; n++) {
|
||||
threads[n] = threads[0];
|
||||
|
|
|
|||
|
|
@ -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];
|
||||
|
|
|
|||
|
|
@ -843,7 +843,7 @@ mono_trapezoids_span_converter(struct sna *sna,
|
|||
y = extents.y1;
|
||||
h = extents.y2 - extents.y1;
|
||||
h = (h + num_threads - 1) / num_threads;
|
||||
num_threads = (extents.y2 - extents.y1 + h - 1) / h;
|
||||
num_threads -= (num_threads-1) * h >= extents.y2 - extents.y1;
|
||||
|
||||
for (n = 1; n < num_threads; n++) {
|
||||
threads[n] = threads[0];
|
||||
|
|
|
|||
|
|
@ -1907,7 +1907,7 @@ precise_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];
|
||||
|
|
@ -2133,7 +2133,7 @@ precise_trapezoid_mask_converter(CARD8 op, PicturePtr src, PicturePtr dst,
|
|||
y = extents.y1;
|
||||
h = extents.y2 - extents.y1;
|
||||
h = (h + num_threads - 1) / num_threads;
|
||||
num_threads = (extents.y2 - extents.y1 + h - 1) / h;
|
||||
num_threads -= (num_threads-1) * h >= extents.y2 - extents.y1;
|
||||
|
||||
for (n = 1; n < num_threads; n++) {
|
||||
threads[n] = threads[0];
|
||||
|
|
@ -2839,7 +2839,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];
|
||||
|
|
@ -3111,7 +3111,7 @@ precise_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];
|
||||
|
|
@ -3255,7 +3255,7 @@ precise_trapezoid_span_fallback(CARD8 op, PicturePtr src, PicturePtr dst,
|
|||
y = extents.y1;
|
||||
h = extents.y2 - extents.y1;
|
||||
h = (h + num_threads - 1) / num_threads;
|
||||
num_threads = (extents.y2 - extents.y1 + h - 1) / h;
|
||||
num_threads -= (num_threads-1) * h >= extents.y2 - extents.y1;
|
||||
|
||||
for (n = 1; n < num_threads; n++) {
|
||||
threads[n] = threads[0];
|
||||
|
|
|
|||
Loading…
Reference in New Issue