coe: keep track of registered buffers

Modify logic of CoE IOCTLs REGISTER_BUFFER and CAPTURE_REQUEST to use
pre-registered buffers identified with an index. Instead of userspace
specifying a DMA_BUF ID for each capture request it will now specify a
simple index 0-3 of a pre-registered DMA_BUF.

Jira CT26X-1892

Change-Id: Icc3e0f3f8f572d4590f8d64badc8eea89f52c663
Signed-off-by: Igor Mitsyanko <imitsyanko@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3419642
Reviewed-by: Narendra Kondapalli <nkondapalli@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Tested-by: Raki Hassan <rakibulh@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Raki Hassan <rakibulh@nvidia.com>
This commit is contained in:
Igor Mitsyanko
2025-07-02 19:52:51 +00:00
committed by mobile promotions
parent 2909c904dc
commit 5dbcf5524b
2 changed files with 113 additions and 26 deletions

View File

@@ -28,6 +28,11 @@
#define __COE_CAPTURE_ALIGN __aligned(8)
/**
* @brief Maximum number of buffers indexes that can be registered with the CoE channel.
*/
#define COE_BUFFER_IDX_MAX_NUM 4U
/**
* @brief CoE channel setup config (COE_IOCTL_CAPTURE_SETUP payload).
*
@@ -42,10 +47,15 @@ struct coe_ioctl_data_capture_setup {
/**
* @brief CoE channel buffer operation (COE_IOCTL_BUFFER_OP payload).
*
* Register/unregister a buffer with the CoE channel. Buffer index must be below
* @ref COE_BUFFER_IDX_MAX_NUM.
*/
struct coe_ioctl_data_buffer_op {
uint32_t mem; /**< handle to a buffer. */
uint32_t flag; /**< Buffer @ref CAPTURE_BUFFER_OPS bitmask. */
uint32_t buffer_idx; /**< Buffer index to identify the buffer for capture requests. */
uint8_t reserved[4U]; /**< Reserved for future use. */
} __COE_CAPTURE_ALIGN;
/**
@@ -61,9 +71,9 @@ struct coe_ioctl_data_buffer_op {
* is returned by the driver in coe_ioctl_data_capture_status when capture is completed.
*/
struct coe_ioctl_data_capture_req {
uint32_t mem_fd; /**< handle to a buffer. */
uint32_t buffer_idx; /**< Index of a buffer which is registered with COE_IOCTL_BUFFER_OP. */
uint32_t buf_size; /**< capture image size in bytes */
uint32_t mem_fd_offset; /**< offset from the beginning of a mem_fd */
uint32_t mem_fd_offset; /**< offset from the beginning of a buffer */
uint32_t capture_number; /**< capture number for a tracking by userspace */
} __COE_CAPTURE_ALIGN;