summaryrefslogtreecommitdiff
path: root/linux
diff options
context:
space:
mode:
authorMichael Hunold <devnull@localhost>2003-07-01 10:13:26 +0000
committerMichael Hunold <devnull@localhost>2003-07-01 10:13:26 +0000
commita0e4c3a6705764d9c17e7cdc948b351a1eeced02 (patch)
treef8acc1ac04f8726e4b9d600d51e9b0597405023b /linux
parent3136b2e443e145266f96a7d6f7a4d45bee9cb445 (diff)
downloadmediapointer-dvb-s2-a0e4c3a6705764d9c17e7cdc948b351a1eeced02.tar.gz
mediapointer-dvb-s2-a0e4c3a6705764d9c17e7cdc948b351a1eeced02.tar.bz2
- capturing alternating fields to different buffers works now
Diffstat (limited to 'linux')
-rw-r--r--linux/drivers/media/common/saa7146_hlp.c38
-rw-r--r--linux/drivers/media/common/saa7146_video.c8
-rw-r--r--linux/include/media/saa7146_vv.h3
3 files changed, 43 insertions, 6 deletions
diff --git a/linux/drivers/media/common/saa7146_hlp.c b/linux/drivers/media/common/saa7146_hlp.c
index e0bb62bb3..76ac43cfe 100644
--- a/linux/drivers/media/common/saa7146_hlp.c
+++ b/linux/drivers/media/common/saa7146_hlp.c
@@ -766,8 +766,14 @@ static int calculate_video_dma_grab_packed(struct saa7146_dev* dev, struct saa71
if (V4L2_FIELD_HAS_BOTH(field)) {
} else if (field == V4L2_FIELD_ALTERNATE) {
/* fixme */
- vdma1.base_odd = vdma1.prot_addr;
- vdma1.pitch /= 2;
+ if ( vv->last_field == V4L2_FIELD_TOP ) {
+ vdma1.base_odd = vdma1.prot_addr;
+ vdma1.pitch /= 2;
+ } else if ( vv->last_field == V4L2_FIELD_BOTTOM ) {
+ vdma1.base_odd = vdma1.base_even;
+ vdma1.base_even = vdma1.prot_addr;
+ vdma1.pitch /= 2;
+ }
} else if (field == V4L2_FIELD_TOP) {
vdma1.base_odd = vdma1.prot_addr;
vdma1.pitch /= 2;
@@ -987,8 +993,14 @@ static void program_capture_engine(struct saa7146_dev *dev, int planar)
}
/* wait for o_fid_a/b / e_fid_a/b toggle */
- WRITE_RPS0(CMD_PAUSE | e_wait);
- WRITE_RPS0(CMD_PAUSE | o_wait);
+ if ( vv->last_field == V4L2_FIELD_INTERLACED ) {
+ WRITE_RPS0(CMD_PAUSE | e_wait);
+ WRITE_RPS0(CMD_PAUSE | o_wait);
+ } else if ( vv->last_field == V4L2_FIELD_TOP ) {
+ WRITE_RPS0(CMD_PAUSE | o_wait);
+ } else if ( vv->last_field == V4L2_FIELD_BOTTOM ) {
+ WRITE_RPS0(CMD_PAUSE | e_wait);
+ }
/* turn off video-dma1 */
WRITE_RPS0(CMD_WR_REG_MASK | (MC1/4));
@@ -1016,10 +1028,21 @@ static void program_capture_engine(struct saa7146_dev *dev, int planar)
void saa7146_set_capture(struct saa7146_dev *dev, struct saa7146_buf *buf, struct saa7146_buf *next)
{
struct saa7146_format *sfmt = format_by_fourcc(dev,buf->fmt->pixelformat);
+ struct saa7146_vv *vv = dev->vv_data;
u32 vdma1_prot_addr;
DEB_CAP(("buf:%p, next:%p\n",buf,next));
+/*
+ printk("vdma%d.base_even: 0x%08x\n", 1,saa7146_read(dev,BASE_EVEN1));
+ printk("vdma%d.base_odd: 0x%08x\n", 1,saa7146_read(dev,BASE_ODD1));
+ printk("vdma%d.prot_addr: 0x%08x\n", 1,saa7146_read(dev,PROT_ADDR1));
+ printk("vdma%d.base_page: 0x%08x\n", 1,saa7146_read(dev,BASE_PAGE1));
+ printk("vdma%d.pitch: 0x%08x\n", 1,saa7146_read(dev,PITCH1));
+ printk("vdma%d.num_line_byte: 0x%08x\n", 1,saa7146_read(dev,NUM_LINE_BYTE1));
+ printk("vdma%d => vptr : 0x%08x\n", 1,saa7146_read(dev,PCI_VDP1));
+*/
+
vdma1_prot_addr = saa7146_read(dev, PROT_ADDR1);
if( 0 == vdma1_prot_addr ) {
/* clear out beginning of streaming bit (rps register 0)*/
@@ -1031,6 +1054,13 @@ void saa7146_set_capture(struct saa7146_dev *dev, struct saa7146_buf *buf, struc
saa7146_set_output_format(dev, sfmt->trans);
saa7146_disable_clipping(dev);
+ if ( vv->last_field == V4L2_FIELD_INTERLACED ) {
+ } else if ( vv->last_field == V4L2_FIELD_TOP ) {
+ vv->last_field = V4L2_FIELD_BOTTOM;
+ } else if ( vv->last_field == V4L2_FIELD_BOTTOM ) {
+ vv->last_field = V4L2_FIELD_TOP;
+ }
+
if( 0 != IS_PLANAR(sfmt->trans)) {
calculate_video_dma_grab_planar(dev, buf);
program_capture_engine(dev,1);
diff --git a/linux/drivers/media/common/saa7146_video.c b/linux/drivers/media/common/saa7146_video.c
index d67282461..4479d7189 100644
--- a/linux/drivers/media/common/saa7146_video.c
+++ b/linux/drivers/media/common/saa7146_video.c
@@ -187,12 +187,18 @@ static int try_fmt(struct saa7146_fh *fh, struct v4l2_format *f)
: V4L2_FIELD_BOTTOM;
}
switch (field) {
+ case V4L2_FIELD_ALTERNATE: {
+ vv->last_field = V4L2_FIELD_TOP;
+ maxh = maxh / 2;
+ break;
+ }
case V4L2_FIELD_TOP:
case V4L2_FIELD_BOTTOM:
- case V4L2_FIELD_ALTERNATE:
+ vv->last_field = V4L2_FIELD_INTERLACED;
maxh = maxh / 2;
break;
case V4L2_FIELD_INTERLACED:
+ vv->last_field = V4L2_FIELD_INTERLACED;
break;
default: {
DEB_D(("no known field mode '%d'.\n",field));
diff --git a/linux/include/media/saa7146_vv.h b/linux/include/media/saa7146_vv.h
index 2868ad089..6d19ade7a 100644
--- a/linux/include/media/saa7146_vv.h
+++ b/linux/include/media/saa7146_vv.h
@@ -120,7 +120,8 @@ struct saa7146_vv
/* video capture */
struct saa7146_dmaqueue video_q;
struct saa7146_fh *streaming;
-
+ enum v4l2_field last_field;
+
/* common: fixme? shouldn't this be in saa7146_fh?
(this leads to a more complicated question: shall the driver
store the different settings (for example S_INPUT) for every open