Skip to contentSkip to conversation

pxa_camera: DMA alignment requirement

DISCUSSION Robert Jarzmik 2 participants 5 messages Nov 9, 2008 – Nov 26, 2008 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

Hello,

In the pxa camera driver, the 3 DMA channels used are MMU page aligned. Does somebody remember where that constraint comes from ?

I'm wondering because the planar YUV format generated is something like this for a 640 * 480 image :
- Y plane => 640 * 480 bytes = 307200 (and this happens to be a multiple of pagesize : 307200 = 4096 * 75)
- U plane => 640 * 480 / 2 bytes = 153600 (and this is not a multiple of 4096)
- padding to reach next page : 2048 bytes
- V plane => 153600 bytes
- padding to reach next page : 2048 bytes

This means a user space library should be kernel pagesize aware to transform the output image. I don't really understand the necessity of page aligned DMA channels. Would someone tell me please ?

--
Robert

--
video4linux-list mailing list
Unsubscribe mailto:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

#1 lore raw
Quoted 14 lines · Robert Jarzmik

Hello,

In the pxa camera driver, the 3 DMA channels used are MMU page aligned. Does somebody remember where that constraint comes from ?

I'm wondering because the planar YUV format generated is something like this for a 640 * 480 image :
- Y plane => 640 * 480 bytes = 307200 (and this happens to be a multiple of pagesize : 307200 = 4096 * 75)
- U plane => 640 * 480 / 2 bytes = 153600 (and this is not a multiple of 4096)
- padding to reach next page : 2048 bytes
- V plane => 153600 bytes
- padding to reach next page : 2048 bytes

Quoted 3 lines

This means a user space library should be kernel pagesize aware to transform the output image. I don't really understand the necessity of page aligned DMA channels. Would someone tell me please ?

As far as I remember, the buffers should be page aligned to allow overlaying of captured data.

Quoted 8 lines

--
Robert

--
video4linux-list mailing list
Unsubscribe mailto:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

Signature · 7 lines
Sincerely yours,
Mike.

--
video4linux-list mailing list
Unsubscribe mailto:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list
#2 lore raw
Quoted 9 lines · Mike Rapoport
Quoted 5 lines · Robert Jarzmik

Hello,

In the pxa camera driver, the 3 DMA channels used are MMU page aligned. Does somebody remember where that constraint comes from ?

As far as I remember, the buffers should be page aligned to allow overlaying of captured data.

Ah, so that's it, thanks.

Quoted 1 line

From what I read on the PXA manual, the only constraint is 16bytes

alignement. Would you also remember who wrote the code, so that I can ask him where he read about page alignement constraint please ?

Cheers.

--
Robert

--
video4linux-list mailing list
Unsubscribe mailto:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

#3 lore raw
Quoted 8 lines · Robert Jarzmik
Quoted 6 lines · Mike Rapoport
Quoted 5 lines · Robert Jarzmik

Hello,

In the pxa camera driver, the 3 DMA channels used are MMU page aligned. Does somebody remember where that constraint comes from ?

Quoted 7 lines
Quoted 2 lines

As far as I remember, the buffers should be page aligned to allow overlaying of captured data.

Ah, so that's it, thanks.

Quoted 1 line

From what I read on the PXA manual, the only constraint is 16bytes

alignement. Would you also remember who wrote the code, so that I can ask him where he read about page alignement constraint please ?

Just by coincidence it was me :)
I used pxafb_overlay from [1], and my (mis)understanding of what it does added the page alignment constrain. Now looking at the overlay code once more, I'm not sure if it's necessary.

---
[1] http://www.rpsys.net/openzaurus/patches/archive/pxa27x_overlay-r8.patch

Quoted 5 lines

Cheers.

--
Robert

Signature · 7 lines
Sincerely yours,
Mike.

--
video4linux-list mailing list
Unsubscribe mailto:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list
#4 lore raw
Quoted 11 lines · Mike Rapoport
Quoted 3 lines
Quoted 1 line

From what I read on the PXA manual, the only constraint is 16bytes

alignement. Would you also remember who wrote the code, so that I can ask him where he read about page alignement constraint please ?

Just by coincidence it was me :)
I used pxafb_overlay from [1], and my (mis)understanding of what it does added the page alignment constrain. Now looking at the overlay code once more, I'm not sure if it's necessary.

---
[1] http://www.rpsys.net/openzaurus/patches/archive/pxa27x_overlay-r8.patch

Just for the record, I made a try or two, changing the alignment from page (4096 bytes) into 16 bytes (PAGE_ALIGN -> ALIGN(x,16)). And surprise, I get a lot of DMA bus errors ...

I'm still investigating, there's something weird in there ...

Cheers.

--
Robert

--
video4linux-list mailing list
Unsubscribe mailto:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list