[mpp_task]: Hide port and task queue from rk_mpi.h

Move MppPort and MppTaskQueue function to mpp_task_impl.h.
Add caller parameter to mpp_port_poll, mpp_port_dequeue,
mpp_port_enqueue, mpp_port_awake functions for debug purpose.

Change-Id: I39f69d934d45b65c3bc751d71ec98388c2fb9849
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
This commit is contained in:
Herman Chen
2019-06-21 10:32:14 +08:00
parent ab235fd62e
commit ba2fab3018
4 changed files with 74 additions and 58 deletions

View File

@@ -66,22 +66,25 @@ typedef enum {
* mpp_init(type, coding, MPP_WORK_ASYNC)
*
* input thread
* a - dequeue(input, *task)
* b - task_set_item(packet/frame)
* c - enqueue(input, task) // when enqueue return the task is not done yet
* a - poll(input)
* b - dequeue(input, *task)
* c - task_set_item(packet/frame)
* d - enqueue(input, task) // when enqueue return the task is not done yet
*
* output thread
* a - dequeue(output, *task)
* b - task_get_item(frame/packet)
* c - enqueue(output, task)
* a - poll(output)
* b - dequeue(output, *task)
* c - task_get_item(frame/packet)
* d - enqueue(output, task)
******************************************************************************
* 2. sync mode
*
* mpp_init(type, coding, MPP_WORK_SYNC)
*
* a - dequeue(input, *task)
* b - task_set_item(packet/frame)
* c - enqueue(task) // when enqueue return the task is finished
* a - poll(input)
* b - dequeue(input, *task)
* c - task_set_item(packet/frame)
* d - enqueue(task) // when enqueue return the task is finished
******************************************************************************
*/
typedef enum {
@@ -208,48 +211,11 @@ typedef enum {
* task_enqueue(ctx, PORT_OUTPUT, task);
*/
/* NOTE: use index rather then handle to descripbe task */
typedef void* MppPort;
typedef void* MppTaskQueue;
#ifdef __cplusplus
extern "C" {
#endif
/*
* Mpp task queue function:
*
* mpp_task_queue_init - create task queue structure
* mpp_task_queue_deinit - destory task queue structure
* mpp_task_queue_get_port - return input or output port of task queue
*
* Typical work flow, task mpp_dec for example:
*
* 1. Mpp layer creates one task queue in order to connect mpp input and mpp_dec input.
* 2. Mpp layer setups the task count in task queue input port.
* 3. Get input port from the task queue and assign to mpp input as mpp_input_port.
* 4. Get output port from the task queue and assign to mpp_dec input as dec_input_port.
* 5. Let the loop start.
* a. mpi user will dequeue task from mpp_input_port.
* b. mpi user will setup task.
* c. mpi user will enqueue task back to mpp_input_port.
* d. task will automatically transfer to dec_input_port.
* e. mpp_dec will dequeue task from dec_input_port.
* f. mpp_dec will process task.
* g. mpp_dec will enqueue task back to dec_input_port.
* h. task will automatically transfer to mpp_input_port.
* 6. Stop the loop. All tasks must be return to input port with idle status.
* 6. Mpp layer destory the task queue.
*/
MPP_RET mpp_task_queue_init(MppTaskQueue *queue);
MPP_RET mpp_task_queue_setup(MppTaskQueue queue, RK_S32 task_count);
MPP_RET mpp_task_queue_deinit(MppTaskQueue queue);
MppPort mpp_task_queue_get_port(MppTaskQueue queue, MppPortType type);
MPP_RET mpp_port_poll(MppPort port, MppPollType timeout);
MPP_RET mpp_port_dequeue(MppPort port, MppTask *task);
MPP_RET mpp_port_enqueue(MppPort port, MppTask task);
MPP_RET mpp_port_awake(MppPort port);
MPP_RET mpp_task_meta_set_s32(MppTask task, MppMetaKey key, RK_S32 val);
MPP_RET mpp_task_meta_set_s64(MppTask task, MppMetaKey key, RK_S64 val);
MPP_RET mpp_task_meta_set_ptr(MppTask task, MppMetaKey key, void *val);