summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-09-13 17:14:23 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2012-09-13 17:14:23 +0100
commit8c7dd2219fa777bf6354c4e0ef38a2f09fe09675 (patch)
tree368e0852f5bbb3357c63416c2723c8affeb4c201 /src
parentd87a56ed1789e0c5058b302bb930d7e952ff3e5e (diff)
sna: Prefer to use indirect uploads for very small updates
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src')
-rw-r--r--src/sna/sna_io.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/sna/sna_io.c b/src/sna/sna_io.c
index fa871331..a466f558 100644
--- a/src/sna/sna_io.c
+++ b/src/sna/sna_io.c
@@ -537,6 +537,8 @@ static bool upload_inplace(struct kgem *kgem,
const BoxRec *box,
int n, int bpp)
{
+ unsigned int bytes;
+
if (!kgem_bo_can_map(kgem, bo))
return false;
@@ -547,16 +549,15 @@ static bool upload_inplace(struct kgem *kgem,
* able to almagamate a series of small writes into a single
* operation.
*/
- if (__kgem_bo_is_busy(kgem, bo)) {
- unsigned int bytes = 0;
- while (n--) {
- bytes += (box->x2 - box->x1) * (box->y2 - box->y1);
- box++;
- }
- return bytes * bpp >> 12 >= kgem->half_cpu_cache_pages;
+ bytes = 0;
+ while (n--) {
+ bytes += (box->x2 - box->x1) * (box->y2 - box->y1);
+ box++;
}
-
- return true;
+ if (__kgem_bo_is_busy(kgem, bo))
+ return bytes * bpp >> 12 >= kgem->half_cpu_cache_pages;
+ else
+ return bytes * bpp >> 12;
}
bool sna_write_boxes(struct sna *sna, PixmapPtr dst,