diff options
-rw-r--r-- | drivers/media/video/videobuf-core.c | 7 | ||||
-rw-r--r-- | drivers/media/video/videobuf-dma-sg.c | 4 |
2 files changed, 5 insertions, 6 deletions
diff --git a/drivers/media/video/videobuf-core.c b/drivers/media/video/videobuf-core.c index 8e93c6f25c83..a96b08d3df5a 100644 --- a/drivers/media/video/videobuf-core.c +++ b/drivers/media/video/videobuf-core.c | |||
@@ -360,7 +360,7 @@ int __videobuf_mmap_setup(struct videobuf_queue *q, | |||
360 | q->bufs[i]->bsize = bsize; | 360 | q->bufs[i]->bsize = bsize; |
361 | switch (memory) { | 361 | switch (memory) { |
362 | case V4L2_MEMORY_MMAP: | 362 | case V4L2_MEMORY_MMAP: |
363 | q->bufs[i]->boff = bsize * i; | 363 | q->bufs[i]->boff = PAGE_ALIGN(bsize) * i; |
364 | break; | 364 | break; |
365 | case V4L2_MEMORY_USERPTR: | 365 | case V4L2_MEMORY_USERPTR: |
366 | case V4L2_MEMORY_OVERLAY: | 366 | case V4L2_MEMORY_OVERLAY: |
@@ -430,9 +430,8 @@ int videobuf_reqbufs(struct videobuf_queue *q, | |||
430 | count = VIDEO_MAX_FRAME; | 430 | count = VIDEO_MAX_FRAME; |
431 | size = 0; | 431 | size = 0; |
432 | q->ops->buf_setup(q, &count, &size); | 432 | q->ops->buf_setup(q, &count, &size); |
433 | size = PAGE_ALIGN(size); | ||
434 | dprintk(1, "reqbufs: bufs=%d, size=0x%x [%d pages total]\n", | 433 | dprintk(1, "reqbufs: bufs=%d, size=0x%x [%d pages total]\n", |
435 | count, size, (count*size)>>PAGE_SHIFT); | 434 | count, size, (count*PAGE_ALIGN(size))>>PAGE_SHIFT); |
436 | 435 | ||
437 | retval = __videobuf_mmap_setup(q, count, size, req->memory); | 436 | retval = __videobuf_mmap_setup(q, count, size, req->memory); |
438 | if (retval < 0) { | 437 | if (retval < 0) { |
@@ -1099,7 +1098,7 @@ int videobuf_cgmbuf(struct videobuf_queue *q, | |||
1099 | mbuf->size = 0; | 1098 | mbuf->size = 0; |
1100 | for (i = 0; i < mbuf->frames; i++) { | 1099 | for (i = 0; i < mbuf->frames; i++) { |
1101 | mbuf->offsets[i] = q->bufs[i]->boff; | 1100 | mbuf->offsets[i] = q->bufs[i]->boff; |
1102 | mbuf->size += q->bufs[i]->bsize; | 1101 | mbuf->size += PAGE_ALIGN(q->bufs[i]->bsize); |
1103 | } | 1102 | } |
1104 | 1103 | ||
1105 | return 0; | 1104 | return 0; |
diff --git a/drivers/media/video/videobuf-dma-sg.c b/drivers/media/video/videobuf-dma-sg.c index 032ebae0134a..a583d394696e 100644 --- a/drivers/media/video/videobuf-dma-sg.c +++ b/drivers/media/video/videobuf-dma-sg.c | |||
@@ -588,7 +588,7 @@ static int __videobuf_mmap_mapper(struct videobuf_queue *q, | |||
588 | retval = -EBUSY; | 588 | retval = -EBUSY; |
589 | goto done; | 589 | goto done; |
590 | } | 590 | } |
591 | size += q->bufs[last]->bsize; | 591 | size += PAGE_ALIGN(q->bufs[last]->bsize); |
592 | if (size == (vma->vm_end - vma->vm_start)) | 592 | if (size == (vma->vm_end - vma->vm_start)) |
593 | break; | 593 | break; |
594 | } | 594 | } |
@@ -610,7 +610,7 @@ static int __videobuf_mmap_mapper(struct videobuf_queue *q, | |||
610 | continue; | 610 | continue; |
611 | q->bufs[i]->map = map; | 611 | q->bufs[i]->map = map; |
612 | q->bufs[i]->baddr = vma->vm_start + size; | 612 | q->bufs[i]->baddr = vma->vm_start + size; |
613 | size += q->bufs[i]->bsize; | 613 | size += PAGE_ALIGN(q->bufs[i]->bsize); |
614 | } | 614 | } |
615 | 615 | ||
616 | map->count = 1; | 616 | map->count = 1; |