summaryrefslogtreecommitdiff
path: root/src/sna/sna_accel.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2013-06-21 14:27:42 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2013-06-21 15:44:42 +0100
commit7e90e522199c4d6b479554073acb33e9d82fb8cc (patch)
tree9835002c15c0d23351246929d91a08d87433f006 /src/sna/sna_accel.c
parent94cbe7bf7b7acc9a7f2cb56c5e275af028f3cdc8 (diff)
sna: Fix inspection of transfer extents for deciding transport
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna/sna_accel.c')
-rw-r--r--src/sna/sna_accel.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index d26d613f..7d030235 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -1505,7 +1505,7 @@ sna_pixmap_create_mappable_gpu(PixmapPtr pixmap,
static inline bool use_cpu_bo_for_download(struct sna *sna,
struct sna_pixmap *priv,
- const BoxRec *box)
+ int nbox, const BoxRec *box)
{
if (DBG_NO_CPU_DOWNLOAD)
return false;
@@ -1523,10 +1523,11 @@ static inline bool use_cpu_bo_for_download(struct sna *sna,
}
/* Is it worth detiling? */
+ assert(box[0].y1 < box[nbox-1].y2);
if (kgem_bo_is_mappable(&sna->kgem, priv->gpu_bo) &&
- (box->y2 - box->y1 - 1) * priv->gpu_bo->pitch < 4096) {
- DBG(("%s: no, tiny transfer, expect to read inplace\n",
- __FUNCTION__));
+ (box[nbox-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[nbox-1].y2-box[0].y1, priv->gpu_bo->pitch));
return false;
}
@@ -2020,7 +2021,7 @@ skip_inplace_map:
if (n) {
bool ok = false;
- if (use_cpu_bo_for_download(sna, priv, &priv->gpu_damage->extents)) {
+ if (use_cpu_bo_for_download(sna, priv, n, box)) {
DBG(("%s: using CPU bo for download from GPU\n", __FUNCTION__));
ok = sna->render.copy_boxes(sna, GXcopy,
pixmap, priv->gpu_bo, 0, 0,
@@ -2406,7 +2407,7 @@ sna_drawable_move_region_to_cpu(DrawablePtr drawable,
assert(priv->gpu_bo);
ok = false;
- if (use_cpu_bo_for_download(sna, priv, &priv->gpu_damage->extents)) {
+ if (use_cpu_bo_for_download(sna, priv, n, box)) {
DBG(("%s: using CPU bo for download from GPU\n", __FUNCTION__));
ok = sna->render.copy_boxes(sna, GXcopy,
pixmap, priv->gpu_bo, 0, 0,
@@ -2522,7 +2523,7 @@ sna_drawable_move_region_to_cpu(DrawablePtr drawable,
if (n) {
bool ok = false;
- if (use_cpu_bo_for_download(sna, priv, &priv->gpu_damage->extents)) {
+ if (use_cpu_bo_for_download(sna, priv, n, box)) {
DBG(("%s: using CPU bo for download from GPU\n", __FUNCTION__));
ok = sna->render.copy_boxes(sna, GXcopy,
pixmap, priv->gpu_bo, 0, 0,
@@ -2550,7 +2551,7 @@ sna_drawable_move_region_to_cpu(DrawablePtr drawable,
DBG(("%s: region wholly inside damage\n",
__FUNCTION__));
- if (use_cpu_bo_for_download(sna, priv, &r->extents)) {
+ if (use_cpu_bo_for_download(sna, priv, n, box)) {
DBG(("%s: using CPU bo for download from GPU\n", __FUNCTION__));
ok = sna->render.copy_boxes(sna, GXcopy,
pixmap, priv->gpu_bo, 0, 0,
@@ -2578,7 +2579,7 @@ sna_drawable_move_region_to_cpu(DrawablePtr drawable,
DBG(("%s: region intersects damage\n",
__FUNCTION__));
- if (use_cpu_bo_for_download(sna, priv, &need.extents)) {
+ if (use_cpu_bo_for_download(sna, priv, n, box)) {
DBG(("%s: using CPU bo for download from GPU\n", __FUNCTION__));
ok = sna->render.copy_boxes(sna, GXcopy,
pixmap, priv->gpu_bo, 0, 0,