summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2014-04-18 11:43:45 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2014-04-18 11:56:40 +0100
commit2d9ae02c647f93be58d3f77168752774868008f5 (patch)
treed4e51707a6d875aec0862194c38ec584356c3cf3
parentfdc28205d590d560a6f3886189ef974d1d00f2cd (diff)
sna/video: Provide a fallback path for pwrite failure
Stranger things have happened. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/sna_video.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/sna/sna_video.c b/src/sna/sna_video.c
index e4d33158..890ae490 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)