Re: accessing the videobuffer in IRQ handler

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On Wednesday 19 February 2003 10:12, Gerd Knorr wrote:
> Gabor Kerenyi <wom@xxxxxxxxxxx> writes:
> > I'm trying to access the captured picture in the IRQ handler
> > (bttv_irq_switch_field) using the mmapped method.
>
> You can't.  The buffer isn't mapped into the kernel address space.

> > I thought the capture->vb.dma.vmalloc should point to the
> > picture but it's NULL.
>
> using vmalloc is one of two ways to use capture buffers.  The other
> one (which is used in the mmap case) is anonymous userspace memory.

So that's why it's not in the kernel address space...

> There is a scatter list which points to the pages used for the
> video buffer.  But that doesn't help you.  IIRC it isn't allowed
> call kmap() in IRQ context, so you can't access the actual data.

I know that in IRQ handler things can be done is very restricted
but because the BT chip transfers the image via DMA it's sure
that the address is in the physical memory, so in theory there is
nothing to do about exception handler etc. If I can reach somehow
a physical memory (not translating to virtual address, because it's
not in the kernel addr. space) then I can access the image.
I found out that the scatterlist contains the pages but I don't
know how to access these pages in the IRQ handler. 

> Doing image processing in a IRQ handler is a bad idea anyway.  What
> you are trying to do?  And why to you think it is useful to do that
> in the IRQ handler?

No, I don't want to do image processing in the IRQ handler. :))) That
would be stupid. I'd like to only change one byte (OK maybe two) in 
the very first pixels of the image. Nothing more.

A few people (including me) complained about the top/bottom swapping
if channel swiching is done often.
Now I'm trying to calculate from the time needed to grab the image 
measured from the last grabbed image on that channel. If the
(time/20)%2 is 0 then the field is the same as the last one if not 0 
then it's not the same and it should not be processed.

Now all I have to do is tell the application that the grabbed image is
whether useable or not. If not the kernel selects the same channel
again and hopefully it will grab a correct one next time.

in bttv_switch_field:

if (!list_empty(&btv->capture)) {
irqflags = 1;
capture = list_entry(btv->capture.next, struct bttv_buffer, vb.queue);

printk(KERN_ERR "time: %d %d\n",
(jiffies-btv->ch_jiffies[btv->input]), btv->input);
		
		if (!(((jiffies-btv->ch_jiffies[btv->input])/20)%2)) {
			btv->ch_jiffies[btv->input]=jiffies;
			btv->input++;
			if (btv->input>3) btv->input=0;
		} else {
			printk(KERN_ERR "wrong field\n");
			btv->ch_jiffies[btv->input]=jiffies;
		}
		video_mux(btv, btv->input);

in struct bttv:
jiffies_t ch_jiffies[4];

So I need to pass the channel number and the flag whether
the image is OK.

Gabor





[Index of Archives]     [Linux DVB]     [Video Disk Recorder]     [Asterisk]     [Photo]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Free Photo Albums]     [Fedora Users]     [Fedora Women]     [ALSA Users]     [ALSA Devel]     [Linux USB]

Powered by Linux