By Date: <-- -->
By Thread: <-- -->

Add V4L2_FIELD_ALTERNATE support to SAA7134



Hartmut Hackmann wrote:
Hi, Chris

I finally found the time to investigate your patch closely.
I agree to your change in saa7134-video.c, but i am in doubt
concerning the task conditions in saa7134-core.c

From experimentation I know that without that change, the corrected conditions in saa7134_irq_video_done are not met. Admittedly I haven't gone through the saa driver in detail to work out why they need to be swapped. From a brief investigation the in/out fields are not inverted (i.e. D5^D4 = 0 in SAA7134_SCALER_STATUS1). So perhaps further confusion over what an odd/upper/top field is?


An alternative to my patch is to instead get saa7134_irq_video_done to correct the field type. Changing from the requested field type to the actual:

dev->video_q.curr->vb.field = (status & 0x10)
        ? V4L2_FIELD_TOP : V4L2_FIELD_BOTTOM;

I actually prefer this method as you don't need to wait for a field of the correct type.

Do you try to capture in overlay mode?

No, my app only uses mmap access. All other apps I've tried (tvtime, mplayer) appear to fall in the V4L2_FIELD_HAS_BOTH category. Then again they don't seem to support overlay mode either.


This might be right for your application. But if i understand things
right, you patch swaps the task assignment in field mode. In other
words: in capture mode now the field assignment is wrong. Before we
try to find a solution, can you confirm this?

Not really. For starters it doesn't help that you can't specify V4L2_FIELD_ALTERNATE in overlay mode. Following the bttv-driver.c convention verify_preview returns -EINVAL for V4L2_FIELD_ALTERNATE.


Since my patch only affects field modes that leaves testing for V4L2_FIELD_TOP and/or V4L2_FIELD_BOTTOM. Unfortunately I don't have a source which will spit out a different colour for each field... which come to think of it would be really handy.

Thanks,
 Chris

diff -up /home/chris/vanilla_video/saa7134/saa7134-video.c linux/drivers/media/video/saa7134/saa7134-video.c
--- /home/chris/vanilla_video/saa7134/saa7134-video.c	2006-03-28 18:49:02.000000000 +1200
+++ linux/drivers/media/video/saa7134/saa7134-video.c	2006-05-22 15:24:59.000000000 +1200
 (at)  (at)  -1501,6 +1501,7  (at)  (at)  static int saa7134_try_fmt(struct saa713
 		switch (field) {
 		case V4L2_FIELD_TOP:
 		case V4L2_FIELD_BOTTOM:
+		case V4L2_FIELD_ALTERNATE:
 			maxh = maxh / 2;
 			break;
 		case V4L2_FIELD_INTERLACED:
 (at)  (at)  -2430,12 +2431,9  (at)  (at)  void saa7134_irq_video_done(struct saa71
 			}
 			if (!dev->video_q.curr->top_seen)
 				goto done;
-		} else if (field == V4L2_FIELD_TOP) {
-			if ((status & 0x10) != 0x10)
-				goto done;
-		} else if (field == V4L2_FIELD_BOTTOM) {
-			if ((status & 0x10) != 0x00)
-				goto done;
+		} else {
+			dev->video_q.curr->vb.field = (status & 0x10) 
+				? V4L2_FIELD_TOP : V4L2_FIELD_BOTTOM;
 		}
 		dev->video_q.curr->vb.field_count = dev->video_fieldcount;
 		saa7134_buffer_finish(dev,&dev->video_q,STATE_DONE);
--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request (at) redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list