s5p-fimc : Need to modify for s5pv310
A message that is not in the archive (sent off-list or not yet received): 00b901cb92bb$e81c75b0$b8556110$%[email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): 004701cb9810$e5b2a560$b117f020$%[email protected]
Hi Sungchun,
Quoted 53 lines · Sungchun Kang
Quoted 22 lines
-----Original Message-----
From: [email protected] [mailto:linux-media- [email protected]] On Behalf Of Sylwester Nawrocki
Sent: Monday, December 06, 2010 6:46 PM
To: [email protected]
Cc: [email protected]
Subject: Re: [RFC][media] s5p-fimc : Need to modify for s5pv310Hi Sungchun,
thanks for your suggestions.
I am planning to improve output DMA handling in the fimc camera capture driver,
what is done already is only a minimal adaptation to make driver work on
S5PV310 SoC. We don't even have a platform support (resource and platform
device definitions) for FIMC@S5PV310 yet though. I think it needs to be done first.Quoted 13 lines
Your proposed scheme of presetting output DMA buffer adresses before streaming
is enabled and then using the CIFCNTSEQ register to mask out buffers passed
to user space looks reasonable to me. I could imagine adopting such a method
for buffer ofV4L2_MEMORY_MMAPmemory type. But do you think it is going to
work forV4L2_MEMORY_USERPTR? There is no confidence that USERPTR addresses
passed by applications in subsequentVIDIOC_QBUFcalls will not be changing,
right?Like
V4L2_MEMORY_MMAP, it is possible to useV4L2_MEMORY_USERPTRfor memory type. Surely, in case ofV4L2_MEMORY_USERPTR, output buffer SFR could be changed. But, it is possible to adjust my concept too.
When theVIDIOC_QBUFcalled, user can set m.userptr field to the address of the buffer, length to its size, and index field.<For example QBUF>
Output DMASFR index m.userptr CIFCNTSEQ[bit]
CIOYSA1 00x40000000[0] - enable
CIOYSA2 10x40001000[1] - enable
CIOYSA3 20x40002000[2] - enable
CIOYSA4 30x40003000[3] - enable
CIOYSA5 40x40004000[4] - enable
CIOYSA6 50x40005000[5] - enable
CIOYSA1 00x40006000[0] - enable (SFR value change for output buffer)
Quoted 1 line
Because it is possible to regard a index as output DMA SFR, there's no need to use pending queue concept.
I do not really see much gain in that approach, we still need to obtain physical address from video buffer, read the address from registers, compare both and then perform write if necessary.
The code would be different among various SoC revisions and it would increase interrupt service routine size.
I would see CIFCNTSEQ as a means of additional protection preventing the DMA engine from writing to a buffer which has been passed to user land.
Please note that if user does not queue the buffers in an ascending buffer index order, the buffers are going to be dequeued out of order. Since we cannot change the order of processing the buffers in hardware, we are only able to mask/unmask specific buffer in the DMA engine. The processing sequence is always fixed and the buffers would be dequeued in an ascending video buffer index order.
However this kind of operation is possible with videobuf2.
The modification for s5pv310 is rather straightforward. I am more concerned at the moment with the fact that in s5pv210 output frame index register seem to be changing in a non deterministic way when the CIOYSAn address registers are being updated in the interrupt handler. So it looks like there is no reliable status register in HW to determine which DMA buffer is currently being used. This causes trouble when streaming is stopped in the camera capture driver when user does not queue buffer on time, and then
the capturing needs to be resumed. Are you aware of that?
The only resolution I could come up with so far is to create a parallel counter in software, but it is not really reliable.
Quoted 90 lines
How about this?
First I am going to modify output buffer control in V310, and you review that.I saw the patches vb2(ver. 6) and fimc patch. I will work based on that.
Quoted 81 lines
So we would have to walk the list of buffers' addresses written into CIOYSAn
registers and perform a write if our new incoming buffer is not there anyway.Nevertheless I think it would be cleaner and more safe to use your proposed
method. Did you observe any problems when DMA buffers addresses are reconfigured within the ISR in S5PV310? I mean are there any good reasons
against that? I know there are some issues on S5PV210 about that and I am going fix it too.Quoted 4 lines · Sungchun Kang
Hi Sylwester Nawrocki,
I have some suggestion about s5p-fimc camera driver.
As you know, FIMC have 32 ping-pong register(CIOYSA1~CIOYSA32) foroutput
Quoted 3 lines
buffer in v310 chip. It is different from v210.
It is not necessary to change address at ping-pong register. If request buffer number is 8, 8 buffer can be set at ping-pongregister.
Quoted 4 lines
-
active_buf_q/pending_buf_qThe
list_headpending_buf_qis not necessary for v310. Because, itis possible
Quoted 2 lines
to set output buffer until 32.
There is no case that request buffer number is over 32.Ok, I think it is safe to make such assumption.
Quoted 1 line
So, I think
pending_buf_qis not use in v310. Instead, it can beused
active_buf_q.Quoted 5 lines
Of course, The use of
active_buf_qmay be different from the present.For intstance, ISR may be changed follow.
a. Read
FrameCnt_before(CISTATUS2)- This is for what is writtenbuffer(index) just.
Quoted 1 line
b. Disable a proper bit of
FrameCnt_Seq(CIFCNTSEQ)and send writtenbuffer to
done_list.Quoted 1 line
....
And we we wanted to reschedule same buffer again we would have to search in
all 32 registers to match the address of a buffer passed back by the application, right?Quoted 2 lines
I want to know how about your opinions.
In general I would like to avoid significant differences of hardware handling
across various SoC variants as much as possible. However also I realize that
some differences cannot be avoided for optimal hardware handling. And please feel free to submit patches, however I think the best time for those
would be after the driver is adopted to videobuf2. Now it is changing frequently.Regards,
SylwesterQuoted 3 lines
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
Quoted 3 lines
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html--
Sylwester Nawrocki
Samsung Poland R&D Center
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Regards,
Signature · 2 lines
Sylwester Nawrocki Samsung Poland R&D Center
Hi Sylwester,
Thanks for your reply.
I almost agree with your opinion.
Quoted 74 lines · Sylwester Nawrocki
-----Original Message-----
From: [email protected] [mailto:linux-media- [email protected]] On Behalf Of Sylwester Nawrocki
Sent: Monday, December 13, 2010 7:46 PM
To: [email protected]
Cc: [email protected]
Subject: Re: [RFC][media] s5p-fimc : Need to modify for s5pv310Hi Sungchun,
Quoted 10 lines · Sungchun Kang
Quoted 10 lines
-----Original Message-----
From: [email protected] [mailto:linux-media- [email protected]] On Behalf Of Sylwester Nawrocki
Sent: Monday, December 06, 2010 6:46 PM
To: [email protected]
Cc: [email protected]
Subject: Re: [RFC][media] s5p-fimc : Need to modify for s5pv310Quoted 6 lines
Quoted 6 lines
Hi Sungchun,
thanks for your suggestions.
I am planning to improve output DMA handling in the fimc camera capture driver,
what is done already is only a minimal adaptation to make driverwork
Quoted 4 lines
Quoted 4 lines
on
S5PV310 SoC. We don't even have a platform support (resource and platform
device definitions) for FIMC@S5PV310 yet though. I think it needsto
Quoted 3 lines
Quoted 3 lines
be done first.
Your proposed scheme of presetting output DMA buffer adresses
before
Quoted 2 lines
Quoted 2 lines
streaming
is enabled and then using the CIFCNTSEQ register to mask outbuffers
Quoted 2 lines
Quoted 2 lines
passed
to user space looks reasonable to me. I could imagine adopting sucha
Quoted 10 lines
Quoted 8 lines
method
for buffer ofV4L2_MEMORY_MMAPmemory type. But do you think it is going to
work forV4L2_MEMORY_USERPTR? There is no confidence that USERPTR addresses
passed by applications in subsequentVIDIOC_QBUFcalls will not be changing,
right?Like
V4L2_MEMORY_MMAP, it is possible to useV4L2_MEMORY_USERPTRformemory type.
Quoted 1 line
Surely, in case of
V4L2_MEMORY_USERPTR, output buffer SFR could bechanged.
Quoted 2 lines
But, it is possible to adjust my concept too.
When theVIDIOC_QBUFcalled, user can set m.userptr field to theaddress of the buffer,
Quoted 4 lines
length to its size, and index field.
<For example QBUF>
Quoted 8 lines
Output DMASFR index m.userptr CIFCNTSEQ[bit]
CIOYSA1 00x40000000[0] - enable
CIOYSA2 10x40001000[1] - enable
CIOYSA3 20x40002000[2] - enable
CIOYSA4 30x40003000[3] - enable
CIOYSA5 40x40004000[4] - enable
CIOYSA6 50x40005000[5] - enable
CIOYSA1 00x40006000[0] - enable(SFR value change for output buffer)
Quoted 1 line
Quoted 8 lines
Quoted 1 line
Because it is possible to regard a index as output DMA SFR, there's
no need to use pending queue concept.
I do not really see much gain in that approach, we still need to obtain
physical address from video buffer, read the address from registers, compare
both and then perform write if necessary.
First of all, I wonder V4L2 standard as below.
Index field of v4l2_buffer is used not only V4L2_MEMORY_MMAP but also V4L2_MEMORY_USERPTR of vb2_qbuf. But it is not described at V4L2 standard.
What is right thing?
And in V4L2_MEMORY_USERPTR case, you're right. But I doubt such case(change CIOYSAn's value)is existed.
Quoted 7 lines
The code would be different among various SoC revisions and it would increase
interrupt service routine size.
I would see CIFCNTSEQ as a means of additional protection preventing the DMA
engine from writing to a buffer which has been passed to user land.
CIFCNTSEQ is for maximum 32 buffer count to user. User can select buffer count easier.
Quoted 19 lines
Please note that if user does not queue the buffers in an ascending buffer
index order, the buffers are going to be dequeued out of order. Since we cannot change the order of processing the buffers in hardware, we are only able to mask/unmask specific buffer in the DMA engine. The processing sequence is always fixed and the buffers would be dequeued
in an ascending video buffer index order.
However this kind of operation is possible with videobuf2.The modification for s5pv310 is rather straightforward. I am more concerned
at the moment with the fact that in s5pv210 output frame index register
seem to be changing in a non deterministic way when the CIOYSAn address
registers are being updated in the interrupt handler. So it looks like there is
no reliable status register in HW to determine which DMA buffer is
Quoted 8 lines
currently
being used. This causes trouble when streaming is stopped in the camera capture
driver when user does not queue buffer on time, and then the capturing needs to be resumed. Are you aware of that? The only resolution I could come up with so far is to create a parallel counter
in software, but it is not really reliable.
Please tell me what is the parallel counter?
OK, I will consider the reason using CIOYSAn over 4(n).
Because I did not find majority necessary it.
Once I try another point of patch about fimc capture driver for V310 using the variable "has_cistatus2". As you know, it is necessary to separate V310 and V210 in fimc driver.
For instance, in V310, it is possible to read "before frame count" and "current frame count" in isr. You did not used that.
Quoted 111 lines
Quoted 3 lines
How about this?
First I am going to modify output buffer control in V310, and youreview that.
Quoted 2 lines
I saw the patches vb2(ver. 6) and fimc patch. I will work based on
that.
Quoted 3 lines
Quoted 3 lines
So we would have to walk the list of buffers' addresses written
into
Quoted 2 lines
Quoted 2 lines
CIOYSAn
registers and perform a write if our new incoming buffer is notthere
Quoted 8 lines
Quoted 8 lines
anyway.
Nevertheless I think it would be cleaner and more safe to use your proposed
method. Did you observe any problems when DMA buffers addresses are reconfigured within the ISR in S5PV310? I mean are there any good reasons
against that? I know there are some issues on S5PV210 about thatand
Quoted 17 lines
Quoted 17 lines
I am going fix it too.
Quoted 4 lines · Sungchun Kang
Hi Sylwester Nawrocki,
I have some suggestion about s5p-fimc camera driver.
As you know, FIMC have 32 ping-pong register(CIOYSA1~CIOYSA32) foroutput
Quoted 3 lines
buffer in v310 chip. It is different from v210.
It is not necessary to change address at ping-pong register. If request buffer number is 8, 8 buffer can be set at ping-pongregister.
Quoted 4 lines
-
active_buf_q/pending_buf_qThe
list_headpending_buf_qis not necessary for v310. Because, itis possible
Quoted 8 lines
Quoted 8 lines
Quoted 2 lines
to set output buffer until 32.
There is no case that request buffer number is over 32.Ok, I think it is safe to make such assumption.
Quoted 1 line
So, I think
pending_buf_qis not use in v310. Instead, it can beused
active_buf_q.Quoted 1 line
Of course, The use of
active_buf_qmay be different from thepresent.
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
For intstance, ISR may be changed follow.
a. Read
FrameCnt_before(CISTATUS2)- This is for what is writtenbuffer(index) just.
Quoted 1 line
b. Disable a proper bit of
FrameCnt_Seq(CIFCNTSEQ)and sendwritten
Quoted 5 lines
Quoted 5 lines
buffer to
done_list.Quoted 1 line
....
And we we wanted to reschedule same buffer again we would have to search in
all 32 registers to match the address of a buffer passed back bythe
Quoted 6 lines
Quoted 6 lines
application, right?
Quoted 2 lines
I want to know how about your opinions.
In general I would like to avoid significant differences of
hardware
Quoted 5 lines
Quoted 5 lines
handling
across various SoC variants as much as possible. However also I realize that
some differences cannot be avoided for optimal hardware handling. And please feel free to submit patches, however I think the besttime
Quoted 2 lines
Quoted 2 lines
for those
would be after the driver is adopted to videobuf2. Now it ischanging
Quoted 13 lines
Quoted 13 lines
frequently.
Regards,
SylwesterQuoted 3 lines
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
Quoted 3 lines
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.htmlQuoted 5 lines
Quoted 5 lines
--
Sylwester Nawrocki
Samsung Poland R&D Center
--
To unsubscribe from this list: send the line "unsubscribe linux-media"
Quoted 5 lines
Quoted 3 lines
in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.htmlRegards,
--
Sylwester Nawrocki
Samsung Poland R&D Center
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi Sungchun,
Quoted 90 lines · Sungchun Kang
Hi Sylwester,
Thanks for your reply.
I almost agree with your opinion.Quoted 74 lines · Sylwester Nawrocki
-----Original Message-----
From: [email protected] [mailto:linux-media- [email protected]] On Behalf Of Sylwester Nawrocki
Sent: Monday, December 13, 2010 7:46 PM
To: [email protected]
Cc: [email protected]
Subject: Re: [RFC][media] s5p-fimc : Need to modify for s5pv310Hi Sungchun,
Quoted 10 lines · Sungchun Kang
Quoted 10 lines
-----Original Message-----
From: [email protected] [mailto:linux-media- [email protected]] On Behalf Of Sylwester Nawrocki
Sent: Monday, December 06, 2010 6:46 PM
To: [email protected]
Cc: [email protected]
Subject: Re: [RFC][media] s5p-fimc : Need to modify for s5pv310Quoted 6 lines
Quoted 6 lines
Hi Sungchun,
thanks for your suggestions.
I am planning to improve output DMA handling in the fimc camera capture driver,
what is done already is only a minimal adaptation to make driverwork
Quoted 4 lines
Quoted 4 lines
on
S5PV310 SoC. We don't even have a platform support (resource and platform
device definitions) for FIMC@S5PV310 yet though. I think it needsto
Quoted 3 lines
Quoted 3 lines
be done first.
Your proposed scheme of presetting output DMA buffer adresses
before
Quoted 2 lines
Quoted 2 lines
streaming
is enabled and then using the CIFCNTSEQ register to mask outbuffers
Quoted 2 lines
Quoted 2 lines
passed
to user space looks reasonable to me. I could imagine adopting sucha
Quoted 10 lines
Quoted 8 lines
method
for buffer ofV4L2_MEMORY_MMAPmemory type. But do you think it is going to
work forV4L2_MEMORY_USERPTR? There is no confidence that USERPTR addresses
passed by applications in subsequentVIDIOC_QBUFcalls will not be changing,
right?Like
V4L2_MEMORY_MMAP, it is possible to useV4L2_MEMORY_USERPTRformemory type.
Quoted 1 line
Surely, in case of
V4L2_MEMORY_USERPTR, output buffer SFR could bechanged.
Quoted 2 lines
But, it is possible to adjust my concept too.
When theVIDIOC_QBUFcalled, user can set m.userptr field to theaddress of the buffer,
Quoted 4 lines
length to its size, and index field.
<For example QBUF>
Quoted 8 lines
Output DMASFR index m.userptr CIFCNTSEQ[bit]
CIOYSA1 00x40000000[0] - enable
CIOYSA2 10x40001000[1] - enable
CIOYSA3 20x40002000[2] - enable
CIOYSA4 30x40003000[3] - enable
CIOYSA5 40x40004000[4] - enable
CIOYSA6 50x40005000[5] - enable
CIOYSA1 00x40006000[0] - enable(SFR value change for output buffer)
Quoted 1 line
Quoted 8 lines
Quoted 1 line
Because it is possible to regard a index as output DMA SFR, there's
no need to use pending queue concept.
I do not really see much gain in that approach, we still need to obtain
physical address from video buffer, read the address from registers, compare
both and then perform write if necessary.
Quoted 4 lines
First of all, I wonder V4L2 standard as below.
Index field ofv4l2_bufferis used not onlyV4L2_MEMORY_MMAPbut alsoV4L2_MEMORY_USERPTRofvb2_qbuf. But it is not described at V4L2 standard.
What is right thing?
As already pointed out by Laurent the index field should be used with either V4L2_MEMORY_MMAP or V4L2_MEMORY_USERPTR. The specification will be soon corrected.
Quoted 3 lines
And in
V4L2_MEMORY_USERPTRcase, you're right. But I doubt such case(change CIOYSAn's value)is existed.
Although such a use case might be rare, it still needs to be handled properly by the driver.
Quoted 38 lines
Quoted 8 lines
The code would be different among various SoC revisions and it would increase
interrupt service routine size.
I would see CIFCNTSEQ as a means of additional protection preventing the DMA
engine from writing to a buffer which has been passed to user land.CIFCNTSEQ is for maximum 32 buffer count to user. User can select buffer count easier.
Quoted 19 lines
Please note that if user does not queue the buffers in an ascending buffer
index order, the buffers are going to be dequeued out of order. Since we cannot change the order of processing the buffers in hardware, we are only able to mask/unmask specific buffer in the DMA engine. The processing sequence is always fixed and the buffers would be dequeued
in an ascending video buffer index order.
However this kind of operation is possible with videobuf2.The modification for s5pv310 is rather straightforward. I am more concerned
at the moment with the fact that in s5pv210 output frame index register
seem to be changing in a non deterministic way when the CIOYSAn address
registers are being updated in the interrupt handler. So it looks like there is
no reliable status register in HW to determine which DMA buffer isQuoted 8 lines
currently
being used. This causes trouble when streaming is stopped in the camera capture
driver when user does not queue buffer on time, and then the capturing needs to be resumed. Are you aware of that? The only resolution I could come up with so far is to create a parallel counter
in software, but it is not really reliable.
Quoted 1 line
Please tell me what is the parallel counter?
It is a variable in software incremented in every interrupt routine call. Although if an interrupt is missed it can get out of sync with the hardware.
Quoted 7 lines
OK, I will consider the reason using CIOYSAn over 4(n).
Because I did not find majority necessary it.
Once I try another point of patch about fimc capture driver for V310 using the variable "has_cistatus2". As you know, it is necessary to separate V310 and V210 in fimc driver.
For instance, in V310, it is possible to read "before frame count" and "current frame count" in isr. You did not used that.
Are you talking about works on top of this patch?
http://git.infradead.org/users/kmpark/linux-2.6-samsung/commitdiff/63e434150d84ea9d76efd0e48ad5543cbcf779fa
Yes, it still can be improved, I am no saying no. But I prefer not to create too much IP revision specific code for the common functionality. And it would be good to have some hardware details hidden in common functions used to implement algorithms along as many hardware revisions as possible.
If you have already done some works to improve DMA handling, patches are welcomed. Ideally if they account the last bugfix patches, which are available in repository
git://git.infradead.org/users/kmpark/linux-2.6-samsung s5p_fimc_fixes_for_2.6.37
after commit a348e9110ddb5d494e060d989b35dd1f35359d58 [media] cx25840: fix problem with Terratec Grabster AV400
Thanks,
Sylwester
Quoted 81 lines
Quoted 81 lines
Quoted 4 lines
How about this?
First I am going to modify output buffer control in V310, and youreview that.
Quoted 2 lines
I saw the patches vb2(ver. 6) and fimc patch. I will work based on
that.
Quoted 3 lines
Quoted 3 lines
So we would have to walk the list of buffers' addresses written
into
Quoted 2 lines
Quoted 2 lines
CIOYSAn
registers and perform a write if our new incoming buffer is notthere
Quoted 8 lines
Quoted 8 lines
anyway.
Nevertheless I think it would be cleaner and more safe to use your proposed
method. Did you observe any problems when DMA buffers addresses are reconfigured within the ISR in S5PV310? I mean are there any good reasons
against that? I know there are some issues on S5PV210 about thatand
Quoted 17 lines
Quoted 17 lines
I am going fix it too.
Quoted 4 lines · Sungchun Kang
Hi Sylwester Nawrocki,
I have some suggestion about s5p-fimc camera driver.
As you know, FIMC have 32 ping-pong register(CIOYSA1~CIOYSA32) foroutput
Quoted 3 lines
buffer in v310 chip. It is different from v210.
It is not necessary to change address at ping-pong register. If request buffer number is 8, 8 buffer can be set at ping-pongregister.
Quoted 4 lines
-
active_buf_q/pending_buf_qThe
list_headpending_buf_qis not necessary for v310. Because, itis possible
Quoted 8 lines
Quoted 8 lines
Quoted 2 lines
to set output buffer until 32.
There is no case that request buffer number is over 32.Ok, I think it is safe to make such assumption.
Quoted 1 line
So, I think
pending_buf_qis not use in v310. Instead, it can beused
active_buf_q.Quoted 1 line
Of course, The use of
active_buf_qmay be different from thepresent.
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
For intstance, ISR may be changed follow.
a. Read
FrameCnt_before(CISTATUS2)- This is for what is writtenbuffer(index) just.
Quoted 1 line
b. Disable a proper bit of
FrameCnt_Seq(CIFCNTSEQ)and sendwritten
Quoted 5 lines
Quoted 5 lines
buffer to
done_list.Quoted 1 line
....
And we we wanted to reschedule same buffer again we would have to search in
all 32 registers to match the address of a buffer passed back bythe
Quoted 6 lines
Quoted 6 lines
application, right?
Quoted 2 lines
I want to know how about your opinions.
In general I would like to avoid significant differences of
hardware
Quoted 5 lines
Quoted 5 lines
handling
across various SoC variants as much as possible. However also I realize that
some differences cannot be avoided for optimal hardware handling. And please feel free to submit patches, however I think the besttime
Quoted 2 lines
Quoted 2 lines
for those
would be after the driver is adopted to videobuf2. Now it ischanging
Quoted 2 lines
Quoted 2 lines
frequently.
Signature · 2 lines
Sylwester Nawrocki Samsung Poland R&D Center