diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2013-02-22 21:09:52 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2013-02-22 21:49:42 +0000 |
commit | cbd8f16ea0e3b1b7eae57edfe343a332ae42373c (patch) | |
tree | e064a2b188514c1739c6d3c48a324372b0e65539 /src/sna/sna_render.c | |
parent | 7a264792772512528a4d6138e09b4ee1ace7f322 (diff) |
sna: Refuse to create larger than max temporary upload bo
The maximum size is determined by available RAM, if we exceed it we
greatly increase the risk of swap thrashing.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna/sna_render.c')
-rw-r--r-- | src/sna/sna_render.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/sna/sna_render.c b/src/sna/sna_render.c index 4bc1fad3..512be950 100644 --- a/src/sna/sna_render.c +++ b/src/sna/sna_render.c @@ -1008,11 +1008,14 @@ sna_render_picture_partial(struct sna *sna, if (use_cpu_bo(sna, pixmap, &box, false)) { bo = sna_pixmap(pixmap)->cpu_bo; } else { - if (!sna_pixmap_force_to_gpu(pixmap, - MOVE_READ | MOVE_SOURCE_HINT)) + struct sna_pixmap *priv; + + priv = sna_pixmap_force_to_gpu(pixmap, + MOVE_READ | MOVE_SOURCE_HINT); + if (priv == NULL) return 0; - bo = sna_pixmap(pixmap)->gpu_bo; + bo = priv->gpu_bo; } if (bo->pitch > sna->render.max_3d_pitch) @@ -1188,7 +1191,6 @@ sna_render_picture_extract(struct sna *sna, pixmap->devKind, pixmap->drawable.bitsPerPixel); if (bo != NULL && - pixmap->usage_hint == 0 && box.x2 - box.x1 == pixmap->drawable.width && box.y2 - box.y1 == pixmap->drawable.height) { struct sna_pixmap *priv = sna_pixmap(pixmap); |