summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2014-06-02 16:01:10 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2014-06-02 16:04:51 +0100
commit4cafd1fbb1a2441a9ba5dac7f2a0e1b3f5957c62 (patch)
treeda8ca071001ede7f55aec48ece01a06adfca06a0
parentd6a412812c19fe4698752d2589ead4965048b107 (diff)
sna: Fix early return in download using the GPU
In commit 961139f5878572ebea268a0bbf47caf05af9093f Author: Chris Wilson <chris@chris-wilson.co.uk> Date: Fri May 30 09:45:15 2014 +0100 sna: Use manual detiling for downloads the code for deciding when to use the GPU was refactored into a new function that also performed the transfer, but failed to notice the early return. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/sna_accel.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index a02c5eb2..2513b8b3 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -1738,22 +1738,18 @@ static inline bool cpu_bo_download(struct sna *sna,
if (priv->cpu_bo == NULL || !sna->kgem.can_blt_cpu)
return false;
- if (kgem_bo_is_busy(priv->gpu_bo) || kgem_bo_is_busy(priv->cpu_bo)) {
- DBG(("%s: yes, either bo is busy, so use GPU for readback\n",
- __FUNCTION__));
- return true;
- }
-
- /* Is it worth detiling? */
- assert(box[0].y1 < box[n-1].y2);
- if (kgem_bo_can_map(&sna->kgem, priv->gpu_bo) &&
- (box[n-1].y2 - box[0].y1 - 1) * priv->gpu_bo->pitch < 4096) {
- DBG(("%s: no, tiny transfer (height=%d, pitch=%d) expect to read inplace\n",
- __FUNCTION__, box[n-1].y2-box[0].y1, priv->gpu_bo->pitch));
- return false;
+ if (!kgem_bo_is_busy(priv->gpu_bo) && !kgem_bo_is_busy(priv->cpu_bo)) {
+ /* Is it worth detiling? */
+ assert(box[0].y1 < box[n-1].y2);
+ if (kgem_bo_can_map(&sna->kgem, priv->gpu_bo) &&
+ (box[n-1].y2 - box[0].y1 - 1) * priv->gpu_bo->pitch < 4096) {
+ DBG(("%s: no, tiny transfer (height=%d, pitch=%d) expect to read inplace\n",
+ __FUNCTION__, box[n-1].y2-box[0].y1, priv->gpu_bo->pitch));
+ return false;
+ }
}
- DBG(("%s: using CPU bo for download from GPU\n", __FUNCTION__));
+ DBG(("%s: using GPU write to CPU bo for download from GPU\n", __FUNCTION__));
return sna->render.copy_boxes(sna, GXcopy,
priv->pixmap, priv->gpu_bo, 0, 0,
priv->pixmap, priv->cpu_bo, 0, 0,