summaryrefslogtreecommitdiff
path: root/linux/drivers/media/common/saa7146_video.c
diff options
context:
space:
mode:
Diffstat (limited to 'linux/drivers/media/common/saa7146_video.c')
-rw-r--r--linux/drivers/media/common/saa7146_video.c46
1 files changed, 36 insertions, 10 deletions
diff --git a/linux/drivers/media/common/saa7146_video.c b/linux/drivers/media/common/saa7146_video.c
index cdeeada3b..e6bf86e0a 100644
--- a/linux/drivers/media/common/saa7146_video.c
+++ b/linux/drivers/media/common/saa7146_video.c
@@ -43,12 +43,19 @@ struct saa7146_format formats[] = {
.pixelformat = V4L2_PIX_FMT_YUV422P,
.trans = YUV422_DECOMPOSED,
.depth = 16,
+ .swap = 1,
}, {
- .name = "YUV 4:2:0 planar (Y-Cb-Cr)",
+ .name = "YVU 4:2:0 planar (Y-Cb-Cr)",
.pixelformat = V4L2_PIX_FMT_YVU420,
.trans = YUV420_DECOMPOSED,
.depth = 12,
}, {
+ .name = "YUV 4:2:0 planar (Y-Cb-Cr)",
+ .pixelformat = V4L2_PIX_FMT_YUV420,
+ .trans = YUV420_DECOMPOSED,
+ .depth = 12,
+ .swap = 1,
+ }, {
.name = "YUV 4:2:2 (U-Y-V-Y)",
.pixelformat = V4L2_PIX_FMT_UYVY,
.trans = YUV422_COMPOSED,
@@ -57,7 +64,7 @@ struct saa7146_format formats[] = {
};
/* unfortunately, the saa7146 contains a bug which prevents it from doing on-the-fly byte swaps.
- due to this, it's impossible to provide additional formats, which are simply byte swapped
+ due to this, it's impossible to provide additional *packed* formats, which are simply byte swapped
(like V4L2_PIX_FMT_YUYV) ... 8-( */
static
@@ -557,8 +564,34 @@ int saa7146_pgtable_build(struct saa7146_dev *dev, struct saa7146_buf *buf)
u32 *ptr1, *ptr2, *ptr3;
u32 fill;
- int size = ((buf->fmt->width*buf->fmt->height*sfmt->depth)/8)/2;
+ int size = buf->fmt->width*buf->fmt->height;
int i,p,m1,m2,m3,o1,o2;
+
+ switch( sfmt->depth ) {
+ case 12: {
+ /* create some offsets inside the page table */
+ m1 = ((size+PAGE_SIZE)/PAGE_SIZE)-1;
+ m2 = ((size+(size/4)+PAGE_SIZE)/PAGE_SIZE)-1;
+ m3 = ((size+(size/2)+PAGE_SIZE)/PAGE_SIZE)-1;
+ o1 = size%PAGE_SIZE;
+ o2 = (size+(size/4))%PAGE_SIZE;
+ printk("size:%d, m1:%d, m2:%d, m3:%d, o1:%d, o2:%d\n",size,m1,m2,m3,o1,o2);
+ break;
+ }
+ case 16: {
+ /* create some offsets inside the page table */
+ m1 = ((size+PAGE_SIZE)/PAGE_SIZE)-1;
+ m2 = ((size+(size/2)+PAGE_SIZE)/PAGE_SIZE)-1;
+ m3 = ((2*size+PAGE_SIZE)/PAGE_SIZE)-1;
+ o1 = size%PAGE_SIZE;
+ o2 = (size+(size/2))%PAGE_SIZE;
+ printk("size:%d, m1:%d, m2:%d, m3:%d, o1:%d, o2:%d\n",size,m1,m2,m3,o1,o2);
+ break;
+ }
+ default: {
+ return -1;
+ }
+ }
ptr1 = pt1->cpu;
ptr2 = pt2->cpu;
@@ -576,13 +609,6 @@ int saa7146_pgtable_build(struct saa7146_dev *dev, struct saa7146_buf *buf)
printk("ptr1 %d: 0x%08x\n",j,ptr1[j]);
}
*/
- /* create some offsets inside the page table */
- m1 = ((size+PAGE_SIZE-1)/PAGE_SIZE)-1;
- m2 = ((size+(size/2)+PAGE_SIZE-1)/PAGE_SIZE)-1;
- m3 = ((2*size+PAGE_SIZE-1)/PAGE_SIZE)-1;
-
- o1 = size%PAGE_SIZE;
- o2 = (size+(size/2))%PAGE_SIZE;
/* if we have a user buffer, the first page may not be
aligned to a page boundary. */