diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2012-01-18 18:36:43 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2012-01-18 18:49:42 +0000 |
commit | 76203b70708b8750f52348ea8b9135191e650ff7 (patch) | |
tree | 24a15edfa4b3a296f8e3b2b59bca758c4a79d370 | |
parent | 470741e84c813a257897ee69f14500207a2674dc (diff) |
sna: Almagamate writes based on the total number of bytes written
Cachelines will only be dirtied for the bytes accessed so a better
metric would based on the total number of pages brought into the TLB
and the total number of cachelines used. Base the decision on whether
to try and amalgamate the upload with others on the number of bytes
copied rather than the overall extents.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | src/sna/sna_io.c | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/src/sna/sna_io.c b/src/sna/sna_io.c index 046660ef..a2e7a590 100644 --- a/src/sna/sna_io.c +++ b/src/sna/sna_io.c @@ -396,24 +396,12 @@ static bool upload_inplace(struct kgem *kgem, * operation. */ if (!bo->map) { - BoxRec extents; - - extents = box[0]; - while (--n) { + unsigned int bytes = 0; + while (n--) { + bytes += (box->x2 - box->x1) * (box->y2 - box->y1); box++; - if (box->x1 < extents.x1) - extents.x1 = box->x1; - if (box->x2 > extents.x2) - extents.x2 = box->x2; - - if (box->y1 < extents.y1) - extents.y1 = box->y1; - if (box->y2 > extents.y2) - extents.y2 = box->y2; } - - if ((extents.x2 - extents.x1) * (extents.y2 - extents.y1) * bpp >> 12 - < kgem->half_cpu_cache_pages) + if (bytes * bpp >> 12 < kgem->half_cpu_cache_pages) return false; } |