diff options
-rw-r--r-- | drivers/media/video/videobuf-dma-sg.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/drivers/media/video/videobuf-dma-sg.c b/drivers/media/video/videobuf-dma-sg.c index 717783fa8b3e..e6ce99ff7fd1 100644 --- a/drivers/media/video/videobuf-dma-sg.c +++ b/drivers/media/video/videobuf-dma-sg.c | |||
@@ -546,6 +546,14 @@ static int __videobuf_mmap_mapper(struct videobuf_queue *q, | |||
546 | goto done; | 546 | goto done; |
547 | } | 547 | } |
548 | 548 | ||
549 | /* This function maintains backwards compatibility with V4L1 and will | ||
550 | * map more than one buffer if the vma length is equal to the combined | ||
551 | * size of multiple buffers than it will map them together. See | ||
552 | * VIDIOCGMBUF in the v4l spec | ||
553 | * | ||
554 | * TODO: Allow drivers to specify if they support this mode | ||
555 | */ | ||
556 | |||
549 | /* look for first buffer to map */ | 557 | /* look for first buffer to map */ |
550 | for (first = 0; first < VIDEO_MAX_FRAME; first++) { | 558 | for (first = 0; first < VIDEO_MAX_FRAME; first++) { |
551 | if (NULL == q->bufs[first]) | 559 | if (NULL == q->bufs[first]) |
@@ -590,10 +598,16 @@ static int __videobuf_mmap_mapper(struct videobuf_queue *q, | |||
590 | map = kmalloc(sizeof(struct videobuf_mapping),GFP_KERNEL); | 598 | map = kmalloc(sizeof(struct videobuf_mapping),GFP_KERNEL); |
591 | if (NULL == map) | 599 | if (NULL == map) |
592 | goto done; | 600 | goto done; |
593 | for (size = 0, i = first; i <= last; size += q->bufs[i++]->bsize) { | 601 | |
602 | size = 0; | ||
603 | for (i = first; i <= last; i++) { | ||
604 | if (NULL == q->bufs[i]) | ||
605 | continue; | ||
594 | q->bufs[i]->map = map; | 606 | q->bufs[i]->map = map; |
595 | q->bufs[i]->baddr = vma->vm_start + size; | 607 | q->bufs[i]->baddr = vma->vm_start + size; |
608 | size += q->bufs[i]->bsize; | ||
596 | } | 609 | } |
610 | |||
597 | map->count = 1; | 611 | map->count = 1; |
598 | map->start = vma->vm_start; | 612 | map->start = vma->vm_start; |
599 | map->end = vma->vm_end; | 613 | map->end = vma->vm_end; |