From b4dbdd28ae05839645912f8aeb5100f6d05f11a1 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Fri, 26 Jul 2013 15:49:00 +0100 Subject: [PATCH] sna: Try the indirect upload if we elect to use a mmap and it fails This allows us to avoid the occassional kernel bug if mmap() fails and the upload is possible via our indirect upload paths. Signed-off-by: Chris Wilson --- src/sna/sna_io.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/sna/sna_io.c b/src/sna/sna_io.c index be819688..2bd6b82d 100644 --- a/src/sna/sna_io.c +++ b/src/sna/sna_io.c @@ -700,13 +700,12 @@ bool sna_write_boxes(struct sna *sna, PixmapPtr dst, DBG(("%s x %d, src stride=%d, src dx=(%d, %d)\n", __FUNCTION__, nbox, stride, src_dx, src_dy)); - if (upload_inplace(kgem, dst_bo, box, nbox, dst->drawable.bitsPerPixel)) { -fallback: - return write_boxes_inplace(kgem, - src, stride, dst->drawable.bitsPerPixel, src_dx, src_dy, - dst_bo, dst_dx, dst_dy, - box, nbox); - } + if (upload_inplace(kgem, dst_bo, box, nbox, dst->drawable.bitsPerPixel)&& + write_boxes_inplace(kgem, + src, stride, dst->drawable.bitsPerPixel, src_dx, src_dy, + dst_bo, dst_dx, dst_dy, + box, nbox)) + return true; can_blt = kgem_bo_can_blt(kgem, dst_bo) && (box[0].x2 - box[0].x1) * dst->drawable.bitsPerPixel < 8 * (MAXSHORT - 4); @@ -996,6 +995,12 @@ tile: sna->blt_state.fill_bo = 0; return true; + +fallback: + return write_boxes_inplace(kgem, + src, stride, dst->drawable.bitsPerPixel, src_dx, src_dy, + dst_bo, dst_dx, dst_dy, + box, nbox); } static void