diff options
author | Michael Hunold <devnull@localhost> | 2004-04-28 16:31:39 +0000 |
---|---|---|
committer | Michael Hunold <devnull@localhost> | 2004-04-28 16:31:39 +0000 |
commit | 94f0f02d4bb06b486011d1b642b857c1498a8fea (patch) | |
tree | b7960c76d07f249fdf39748d73e31ac96b245fb0 | |
parent | 907c2d669e82bbf7c9a86c55c5c8081eb71a91c8 (diff) | |
download | mediapointer-dvb-s2-94f0f02d4bb06b486011d1b642b857c1498a8fea.tar.gz mediapointer-dvb-s2-94f0f02d4bb06b486011d1b642b857c1498a8fea.tar.bz2 |
- fix some ppc be endianess issues, overlay works fine, grabbing does not work reliably yet, though
-rw-r--r-- | linux/drivers/media/common/saa7146_core.c | 18 | ||||
-rw-r--r-- | linux/drivers/media/common/saa7146_fops.c | 17 | ||||
-rw-r--r-- | linux/drivers/media/common/saa7146_hlp.c | 27 | ||||
-rw-r--r-- | linux/drivers/media/common/saa7146_video.c | 7 | ||||
-rw-r--r-- | linux/include/media/saa7146.h | 18 | ||||
-rw-r--r-- | linux/include/media/saa7146_vv.h | 1 |
6 files changed, 47 insertions, 41 deletions
diff --git a/linux/drivers/media/common/saa7146_core.c b/linux/drivers/media/common/saa7146_core.c index 5e028d1bd..7c076b2ef 100644 --- a/linux/drivers/media/common/saa7146_core.c +++ b/linux/drivers/media/common/saa7146_core.c @@ -133,8 +133,6 @@ static struct scatterlist* vmalloc_to_sg(unsigned char *virt, int nr_pages) /********************************************************************************/ /* common page table functions */ -#define SAA7146_PGTABLE_SIZE 4096 - char *saa7146_vmalloc_build_pgtable(struct pci_dev *pci, long length, struct saa7146_pgtable *pt) { int pages = (length+PAGE_SIZE-1)/PAGE_SIZE; @@ -182,11 +180,11 @@ int saa7146_pgtable_alloc(struct pci_dev *pci, struct saa7146_pgtable *pt) u32 *cpu; dma_addr_t dma_addr; - cpu = pci_alloc_consistent(pci, SAA7146_PGTABLE_SIZE, &dma_addr); + cpu = pci_alloc_consistent(pci, PAGE_SIZE, &dma_addr); if (NULL == cpu) { return -ENOMEM; } - pt->size = SAA7146_PGTABLE_SIZE; + pt->size = PAGE_SIZE; pt->cpu = cpu; pt->dma = dma_addr; @@ -200,13 +198,9 @@ int saa7146_pgtable_build_single(struct pci_dev *pci, struct saa7146_pgtable *pt int nr_pages = 0; int i,p; - BUG_ON( 0 == sglen); - - if (list->offset > PAGE_SIZE) { - DEB_D(("offset > PAGE_SIZE. this should not happen.")); - return -EINVAL; - } - + BUG_ON(0 == sglen); + BUG_ON(list->offset > PAGE_SIZE); + /* if we have a user buffer, the first page may not be aligned to a page boundary. */ pt->offset = list->offset; @@ -217,7 +211,7 @@ int saa7146_pgtable_build_single(struct pci_dev *pci, struct saa7146_pgtable *pt printk("i:%d, adr:0x%08x, len:%d, offset:%d\n", i,sg_dma_address(list), sg_dma_len(list), list->offset); */ for (p = 0; p * 4096 < list->length; p++, ptr++) { - *ptr = sg_dma_address(list) + p * 4096; + *ptr = cpu_to_le32(sg_dma_address(list) + p * 4096); nr_pages++; } } diff --git a/linux/drivers/media/common/saa7146_fops.c b/linux/drivers/media/common/saa7146_fops.c index fc5f4157d..329e6c436 100644 --- a/linux/drivers/media/common/saa7146_fops.c +++ b/linux/drivers/media/common/saa7146_fops.c @@ -88,10 +88,7 @@ int saa7146_buffer_queue(struct saa7146_dev *dev, #endif DEB_EE(("dev:%p, dmaq:%p, buf:%p\n", dev, q, buf)); - if( NULL == q ) { - ERR(("internal error: fatal NULL pointer for q.\n")); - return 0; - } + BUG_ON(!q); if (NULL == q->curr) { q->curr = buf; @@ -112,14 +109,11 @@ void saa7146_buffer_finish(struct saa7146_dev *dev, #if DEBUG_SPINLOCKS BUG_ON(!spin_is_locked(&dev->slock)); #endif - if( NULL == q->curr ) { - ERR(("internal error: fatal NULL pointer for q->curr.\n")); - return; - } - DEB_EE(("dev:%p, dmaq:%p, state:%d\n", dev, q, state)); DEB_EE(("q->curr:%p\n",q->curr)); + BUG_ON(!q->curr); + /* finish current buffer */ if (NULL == q->curr) { DEB_D(("aiii. no current buffer\n")); @@ -138,10 +132,7 @@ void saa7146_buffer_next(struct saa7146_dev *dev, { struct saa7146_buf *buf,*next = NULL; - if( NULL == q ) { - ERR(("internal error: fatal NULL pointer for q.\n")); - return; - } + BUG_ON(!q); DEB_INT(("dev:%p, dmaq:%p, vbi:%d\n", dev, q, vbi)); diff --git a/linux/drivers/media/common/saa7146_hlp.c b/linux/drivers/media/common/saa7146_hlp.c index 3722cea5b..2840567bc 100644 --- a/linux/drivers/media/common/saa7146_hlp.c +++ b/linux/drivers/media/common/saa7146_hlp.c @@ -413,10 +413,10 @@ static void calculate_clipping_registers_rect(struct saa7146_dev *dev, struct sa /* fill up cliptable */ for(i = 0; i < cnt_pixel; i++) { - clipping[2*i] |= (pixel_list[i] << 16); + clipping[2*i] |= cpu_to_le32(pixel_list[i] << 16); } for(i = 0; i < cnt_line; i++) { - clipping[(2*i)+1] |= (line_list[i] << 16); + clipping[(2*i)+1] |= cpu_to_le32(line_list[i] << 16); } /* fill up cliptable with the display infos */ @@ -430,7 +430,7 @@ static void calculate_clipping_registers_rect(struct saa7146_dev *dev, struct sa if( pixel_list[i] < (x[j] + w[j])) { if ( pixel_list[i] >= x[j] ) { - clipping[2*i] |= (1 << j); + clipping[2*i] |= cpu_to_le32(1 << j); } } } @@ -442,7 +442,7 @@ static void calculate_clipping_registers_rect(struct saa7146_dev *dev, struct sa if( line_list[i] < (y[j] + h[j]) ) { if( line_list[i] >= y[j] ) { - clipping[(2*i)+1] |= (1 << j); + clipping[(2*i)+1] |= cpu_to_le32(1 << j); } } } @@ -560,9 +560,10 @@ static void saa7146_set_window(struct saa7146_dev *dev, int width, int height, e } /* calculate the new memory offsets for a desired position */ -static void saa7146_set_position(struct saa7146_dev *dev, int w_x, int w_y, int w_height, enum v4l2_field field) +static void saa7146_set_position(struct saa7146_dev *dev, int w_x, int w_y, int w_height, enum v4l2_field field, u32 pixelformat) { struct saa7146_vv *vv = dev->vv_data; + struct saa7146_format *sfmt = format_by_fourcc(dev, pixelformat); int b_depth = vv->ov_fmt->depth; int b_bpl = vv->ov_fb.fmt.bytesperline; @@ -601,7 +602,7 @@ static void saa7146_set_position(struct saa7146_dev *dev, int w_x, int w_y, int vdma1.pitch *= -1; } - vdma1.base_page = 0; + vdma1.base_page = sfmt->swap; vdma1.num_line_byte = (vv->standard->v_field<<16)+vv->standard->h_pixels; saa7146_write_out_dma(dev, 1, &vdma1); @@ -657,7 +658,7 @@ int saa7146_enable_overlay(struct saa7146_fh *fh) struct saa7146_vv *vv = dev->vv_data; saa7146_set_window(dev, fh->ov.win.w.width, fh->ov.win.w.height, fh->ov.win.field); - saa7146_set_position(dev, fh->ov.win.w.left, fh->ov.win.w.top, fh->ov.win.w.height, fh->ov.win.field); + saa7146_set_position(dev, fh->ov.win.w.left, fh->ov.win.w.top, fh->ov.win.w.height, fh->ov.win.field, vv->ov_fmt->pixelformat); saa7146_set_output_format(dev, vv->ov_fmt->trans); saa7146_set_clipping_rect(fh); @@ -728,8 +729,8 @@ static int calculate_video_dma_grab_packed(struct saa7146_dev* dev, struct saa71 vdma1.pitch = (width*depth*2)/8; } vdma1.num_line_byte = ((vv->standard->v_field<<16) + vv->standard->h_pixels); - vdma1.base_page = buf->pt[0].dma | ME1; - + vdma1.base_page = buf->pt[0].dma | ME1 | sfmt->swap; + if( 0 != vv->vflip ) { vdma1.prot_addr = buf->pt[0].offset; vdma1.base_even = buf->pt[0].offset+(vdma1.pitch/2)*height; @@ -938,7 +939,7 @@ static void program_capture_engine(struct saa7146_dev *dev, int planar) { struct saa7146_vv *vv = dev->vv_data; int count = 0; - + unsigned long e_wait = vv->current_hps_sync == SAA7146_HPS_SYNC_PORT_A ? CMD_E_FID_A : CMD_E_FID_B; unsigned long o_wait = vv->current_hps_sync == SAA7146_HPS_SYNC_PORT_A ? CMD_O_FID_A : CMD_O_FID_B; @@ -981,17 +982,17 @@ static void program_capture_engine(struct saa7146_dev *dev, int planar) /* turn off video-dma1 */ WRITE_RPS0(CMD_WR_REG_MASK | (MC1/4)); WRITE_RPS0(MASK_22 | MASK_06); /* => mask */ - WRITE_RPS0(MASK_22); /* => values */ + WRITE_RPS0(MASK_22); /* => values */ if( 0 != planar ) { /* turn off video-dma2 */ WRITE_RPS0(CMD_WR_REG_MASK | (MC1/4)); WRITE_RPS0(MASK_05 | MASK_21); /* => mask */ - WRITE_RPS0(MASK_21); /* => values */ + WRITE_RPS0(MASK_21); /* => values */ /* turn off video-dma3 */ WRITE_RPS0(CMD_WR_REG_MASK | (MC1/4)); WRITE_RPS0(MASK_04 | MASK_20); /* => mask */ - WRITE_RPS0(MASK_20); /* => values */ + WRITE_RPS0(MASK_20); /* => values */ } /* generate interrupt */ diff --git a/linux/drivers/media/common/saa7146_video.c b/linux/drivers/media/common/saa7146_video.c index ed7e0f44a..6c5b701c8 100644 --- a/linux/drivers/media/common/saa7146_video.c +++ b/linux/drivers/media/common/saa7146_video.c @@ -38,6 +38,13 @@ static struct saa7146_format formats[] = { .depth = 32, .flags = 0, }, { + .name = "RGB-32 (R-G-B)", + .pixelformat = V4L2_PIX_FMT_RGB32, + .trans = RGB32_COMPOSED, + .depth = 32, + .flags = 0, + .swap = 0x2, + }, { .name = "Greyscale-8", .pixelformat = V4L2_PIX_FMT_GREY, .trans = Y8, diff --git a/linux/include/media/saa7146.h b/linux/include/media/saa7146.h index ef7271db6..2e85e7b19 100644 --- a/linux/include/media/saa7146.h +++ b/linux/include/media/saa7146.h @@ -15,9 +15,21 @@ #include <linux/vmalloc.h> /* for vmalloc() */ #include <linux/mm.h> /* for vmalloc_to_page() */ -/* ugly, but necessary to build the dvb stuff under 2.4. */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,51) - #include "dvb_functions.h" +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) +static inline +int try_module_get(struct module *mod) +{ + if (!MOD_CAN_QUERY(mod)) + return 0; + __MOD_INC_USE_COUNT(mod); + return 1; +} + +#define module_put(mod) __MOD_DEC_USE_COUNT(mod) +#define iminor(xx) minor(xx->i_rdev) +#define strlcpy strncpy +#define i2c_get_adapdata(adapter) (struct saa7146_dev*)adapter->data; + #endif #define SAA7146_VERSION_CODE KERNEL_VERSION(0,5,0) diff --git a/linux/include/media/saa7146_vv.h b/linux/include/media/saa7146_vv.h index 125764f12..b32326295 100644 --- a/linux/include/media/saa7146_vv.h +++ b/linux/include/media/saa7146_vv.h @@ -35,6 +35,7 @@ struct saa7146_format { u32 trans; u8 depth; u8 flags; + u8 swap; }; struct saa7146_standard |