summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/omx
diff options
context:
space:
mode:
authorLeo Liu <[email protected]>2015-06-25 13:19:56 -0400
committerMarek Olšák <[email protected]>2015-08-14 15:02:28 +0200
commit5581f9f28aeaef63bc1495febb402435ddfde556 (patch)
tree960057b339362d8a3e3ca4213ba750ce7c79d9cd /src/gallium/state_trackers/omx
parent0729c251bbff8375ab5d24b80cfc2f8becd6afff (diff)
st/omx/enc: stack frame tasks for the gathering
Put tasks to the FIFO queue for results Signed-off-by: Leo Liu <[email protected]> Acked-by: Alex Deucher <[email protected]> Reviewed-by: Christian König <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers/omx')
-rw-r--r--src/gallium/state_trackers/omx/vid_enc.c20
-rw-r--r--src/gallium/state_trackers/omx/vid_enc.h4
2 files changed, 22 insertions, 2 deletions
diff --git a/src/gallium/state_trackers/omx/vid_enc.c b/src/gallium/state_trackers/omx/vid_enc.c
index bb2c80e7b7f..2bd0194189f 100644
--- a/src/gallium/state_trackers/omx/vid_enc.c
+++ b/src/gallium/state_trackers/omx/vid_enc.c
@@ -180,6 +180,11 @@ static OMX_ERRORTYPE vid_enc_Constructor(OMX_COMPONENTTYPE *comp, OMX_STRING nam
PIPE_VIDEO_ENTRYPOINT_ENCODE, PIPE_VIDEO_CAP_SUPPORTED))
return OMX_ErrorBadParameter;
+ priv->stacked_frames_num = screen->get_video_param(screen,
+ PIPE_VIDEO_PROFILE_MPEG4_AVC_HIGH,
+ PIPE_VIDEO_ENTRYPOINT_ENCODE,
+ PIPE_VIDEO_CAP_STACKED_FRAMES);
+
priv->s_pipe = screen->context_create(screen, priv->screen);
if (!priv->s_pipe)
return OMX_ErrorInsufficientResources;
@@ -259,6 +264,7 @@ static OMX_ERRORTYPE vid_enc_Constructor(OMX_COMPONENTTYPE *comp, OMX_STRING nam
LIST_INITHEAD(&priv->free_tasks);
LIST_INITHEAD(&priv->used_tasks);
LIST_INITHEAD(&priv->b_frames);
+ LIST_INITHEAD(&priv->stacked_tasks);
return OMX_ErrorNone;
}
@@ -271,6 +277,7 @@ static OMX_ERRORTYPE vid_enc_Destructor(OMX_COMPONENTTYPE *comp)
enc_ReleaseTasks(&priv->free_tasks);
enc_ReleaseTasks(&priv->used_tasks);
enc_ReleaseTasks(&priv->b_frames);
+ enc_ReleaseTasks(&priv->stacked_tasks);
if (priv->ports) {
for (i = 0; i < priv->sPortTypesParam[OMX_PortDomainVideo].nPorts; ++i) {
@@ -1116,6 +1123,7 @@ static OMX_ERRORTYPE vid_enc_EncodeFrame(omx_base_PortType *port, OMX_BUFFERHEAD
struct input_buf_private *inp = buf->pInputPortPrivate;
enum pipe_h264_enc_picture_type picture_type;
struct encode_task *task;
+ unsigned stacked_num = 0;
OMX_ERRORTYPE err;
enc_MoveTasks(&inp->tasks, &priv->free_tasks);
@@ -1127,6 +1135,7 @@ static OMX_ERRORTYPE vid_enc_EncodeFrame(omx_base_PortType *port, OMX_BUFFERHEAD
if (buf->nFlags & OMX_BUFFERFLAG_EOS) {
buf->nFilledLen = buf->nAllocLen;
enc_ClearBframes(port, inp);
+ enc_MoveTasks(&priv->stacked_tasks, &inp->tasks);
priv->codec->flush(priv->codec);
}
return base_port_SendBufferFunction(port, buf);
@@ -1167,7 +1176,16 @@ static OMX_ERRORTYPE vid_enc_EncodeFrame(omx_base_PortType *port, OMX_BUFFERHEAD
/* handle I or P frame */
priv->ref_idx_l0 = priv->ref_idx_l1;
enc_HandleTask(port, task, picture_type);
- LIST_ADDTAIL(&task->list, &inp->tasks);
+ LIST_ADDTAIL(&task->list, &priv->stacked_tasks);
+ LIST_FOR_EACH_ENTRY(task, &priv->stacked_tasks, list) {
+ ++stacked_num;
+ }
+ if (stacked_num == priv->stacked_frames_num) {
+ struct encode_task *t;
+ t = LIST_ENTRY(struct encode_task, priv->stacked_tasks.next, list);
+ LIST_DEL(&t->list);
+ LIST_ADDTAIL(&t->list, &inp->tasks);
+ }
priv->ref_idx_l1 = priv->frame_num++;
/* handle B frames */
diff --git a/src/gallium/state_trackers/omx/vid_enc.h b/src/gallium/state_trackers/omx/vid_enc.h
index c8d192b9c60..a83374450b5 100644
--- a/src/gallium/state_trackers/omx/vid_enc.h
+++ b/src/gallium/state_trackers/omx/vid_enc.h
@@ -73,6 +73,7 @@ DERIVEDCLASS(vid_enc_PrivateType, omx_base_filter_PrivateType)
struct list_head free_tasks; \
struct list_head used_tasks; \
struct list_head b_frames; \
+ struct list_head stacked_tasks; \
OMX_U32 frame_rate; \
OMX_U32 frame_num; \
OMX_U32 pic_order_cnt; \
@@ -86,7 +87,8 @@ DERIVEDCLASS(vid_enc_PrivateType, omx_base_filter_PrivateType)
struct vl_compositor_state cstate; \
struct pipe_video_buffer *scale_buffer[OMX_VID_ENC_NUM_SCALING_BUFFERS]; \
OMX_CONFIG_SCALEFACTORTYPE scale; \
- OMX_U32 current_scale_buffer;
+ OMX_U32 current_scale_buffer; \
+ OMX_U32 stacked_frames_num;
ENDCLASS(vid_enc_PrivateType)
OMX_ERRORTYPE vid_enc_LoaderComponent(stLoaderComponentType *comp);