xf86-video-intel: src/sna/sna_video.c

Chris Wilson ickle at kemper.freedesktop.org
Fri Apr 18 03:57:27 PDT 2014


 src/sna/sna_video.c |   12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

New commits:
commit 2d9ae02c647f93be58d3f77168752774868008f5
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Apr 18 11:43:45 2014 +0100

    sna/video: Provide a fallback path for pwrite failure
    
    Stranger things have happened.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_video.c b/src/sna/sna_video.c
index e4d3315..890ae49 100644
--- a/src/sna/sna_video.c
+++ b/src/sna/sna_video.c
@@ -500,8 +500,9 @@ sna_video_copy_data(struct sna_video *video,
 			    ALIGN(w >> 1, 4) == frame->pitch[0] &&
 			    ALIGN(w, 4) == frame->pitch[1]) {
 				if (frame->bo) {
-					kgem_bo_write(&video->sna->kgem, frame->bo,
-						      buf, frame->size);
+					if (!kgem_bo_write(&video->sna->kgem, frame->bo,
+							   buf, frame->size))
+						goto use_gtt;
 				} else {
 					frame->bo = kgem_create_buffer(&video->sna->kgem, frame->size,
 								       KGEM_BUFFER_WRITE | KGEM_BUFFER_WRITE_INPLACE,
@@ -537,8 +538,9 @@ sna_video_copy_data(struct sna_video *video,
 			if (w*2 == frame->pitch[0]) {
 				buf += (2U*y * frame->width) + (x << 1);
 				if (frame->bo) {
-					kgem_bo_write(&video->sna->kgem, frame->bo,
-						      buf, 2U*h*frame->width);
+					if (!kgem_bo_write(&video->sna->kgem, frame->bo,
+							   buf, 2U*h*frame->width))
+						goto use_gtt;
 				} else {
 					frame->bo = kgem_create_buffer(&video->sna->kgem, frame->size,
 								       KGEM_BUFFER_WRITE | KGEM_BUFFER_WRITE_INPLACE,
@@ -555,7 +557,7 @@ sna_video_copy_data(struct sna_video *video,
 		DBG(("%s: source cropped, fallback\n", __FUNCTION__));
 	}
 
-	/* copy data, must use GTT so that we keep the overlay uncached */
+use_gtt: /* copy data, must use GTT so that we keep the overlay uncached */
 	if (frame->bo) {
 		dst = kgem_bo_map__gtt(&video->sna->kgem, frame->bo);
 		if (dst == NULL)


More information about the xorg-commit mailing list