Re: [PATCH 3/3] Documentation: dmaengine: Add DMA_CTRL_REUSE documentation

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

 



On 07/24/2015 07:36 AM, Vinod Koul wrote:
On Thu, Jul 23, 2015 at 09:47:22PM +0200, Robert Jarzmik wrote:
Vinod Koul <vinod.koul@xxxxxxxxx> writes:

+  * DMA_CTRL_REUSE
+    - If set, the descriptor can be reused after being completed. It should
+      not be freed by provider if this flag is set.
+    - The descriptor should be prepared for reuse by invoking
+      dmaengine_desc_set_reuse() which will set DMA_CTRL_REUSE.
+    - dmaengine_desc_set_reuse() will succeed only when channel support
+      reusable descriptor as exhibited by capablities
+    - As a consequence, if a device driver wants to skip the dma_map_sg() and
+      dma_unmap_sg() in between 2 transfers, because the DMA'd data wasn't used,
+      it can resubmit the transfer right after its completion.
+    - Descriptor can be freed in few ways
+	- Clearing DMA_CTRL_REUSE by invoking dmaengine_desc_clear_reuse()
+	  and submitting for last txn
+	- Explicitly invoking dmaengine_desc_free(), this can succeed only
+	  when DMA_CTRL_REUSE is already set

+	- Terminating the channel
Is this last condition mandatory, or can it be transformed into :
  - Clearing DMA_CTRL_REUSE and terminating the channel

The reason I'm asking this is for this kind of scenario :
  - 4 video buffers are prepared and submitted (ie. 4 txs)
  - 1st video buffer completes
  - 2nd video buffer starts, and an error occurs in this 2nd buffer
    => the driver will terminate the DMA channel to stop the transmission
  - the driver will wait for the next "start of frame" of the camera sensor
  - and then it will start 3rd video buffer
    => in this case, the 3rd video will be reused, even if the channel was
    terminated
Nope during terminate flow you are expected to clean up channel. Which mean
cleaning up all pending descriptors and throwing error. You are required to
prepare again

I don't see the necessity to free all descriptors when we call terminate_all(). What terminate_all() does is stop the current transfer and remove all pending transfers from the list. The ultimate cleanup point is when the channel is freed.

If we take audio or video as an example, you might choose to stop capture or playback and then later decide to restart it. There is no reason why we shouldn't be able to re-use the same descriptors over multiple of such iterations. The only point when the descriptor needs to be freed if the memory buffer it refers to is freed as well or the DMA channel is released.
--
To unsubscribe from this list: send the line "unsubscribe dmaengine" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux PCI]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux