mirror of
https://github.com/nyanmisaka/mpp.git
synced 2025-10-12 20:40:07 +08:00
[mpp_frame]: Add stopwatch to MppFrame for timing
Usage: 1. Enable timing trace mpp_frame_set_stopwatch_enable(frame, 1); 2. Get stopwatch and record on each step stopwatch = mpp_frame_get_stopwatch(frame); mpp_stopwatch_record(stopwatch, "step 0"); mpp_stopwatch_record(stopwatch, "step 1"); mpp_stopwatch_record(stopwatch, "step 2"); 3. Get timing log on stopwatch disable or MppFrame destroy mpp_frame_set_stopwatch_enable(frame, 0); or mpp_frame_deinit(&frame); Change-Id: I47c235e95c9f2f39d970ef1f2948b72dcc254146 Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
#ifndef __MPP_FRAME_IMPL_H__
|
||||
#define __MPP_FRAME_IMPL_H__
|
||||
|
||||
#include "mpp_time.h"
|
||||
#include "mpp_frame.h"
|
||||
|
||||
typedef struct MppFrameImpl_t MppFrameImpl;
|
||||
@@ -105,6 +106,7 @@ struct MppFrameImpl_t {
|
||||
* meta data information
|
||||
*/
|
||||
MppMeta meta;
|
||||
MppStopwatch stopwatch;
|
||||
|
||||
/*
|
||||
* frame buffer compression (FBC) information
|
||||
@@ -137,6 +139,12 @@ MPP_RET mpp_frame_info_cmp(MppFrame frame0, MppFrame frame1);
|
||||
RK_U32 mpp_frame_get_fbc_offset(MppFrame frame);
|
||||
RK_U32 mpp_frame_get_fbc_stride(MppFrame frame);
|
||||
|
||||
/*
|
||||
* Debug for frame process timing
|
||||
*/
|
||||
void mpp_frame_set_stopwatch_enable(MppFrame frame, RK_S32 enable);
|
||||
MppStopwatch mpp_frame_get_stopwatch(const MppFrame frame);
|
||||
|
||||
MPP_RET check_is_mpp_frame(void *pointer);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@@ -74,6 +74,9 @@ MPP_RET mpp_frame_deinit(MppFrame *frame)
|
||||
if (p->meta)
|
||||
mpp_meta_put(p->meta);
|
||||
|
||||
if (p->stopwatch)
|
||||
mpp_stopwatch_put(p->stopwatch);
|
||||
|
||||
mpp_free(*frame);
|
||||
*frame = NULL;
|
||||
return MPP_OK;
|
||||
@@ -160,6 +163,34 @@ void mpp_frame_set_meta(MppFrame frame, MppMeta meta)
|
||||
p->meta = meta;
|
||||
}
|
||||
|
||||
void mpp_frame_set_stopwatch_enable(MppFrame frame, RK_S32 enable)
|
||||
{
|
||||
if (check_is_mpp_frame(frame))
|
||||
return ;
|
||||
|
||||
MppFrameImpl *p = (MppFrameImpl *)frame;
|
||||
if (enable && NULL == p->stopwatch) {
|
||||
char name[32];
|
||||
|
||||
snprintf(name, sizeof(name) - 1, "frm %8llx", p->pts);
|
||||
p->stopwatch = mpp_stopwatch_get(name);
|
||||
if (p->stopwatch)
|
||||
mpp_stopwatch_set_show_on_exit(p->stopwatch, 1);
|
||||
} else if (!enable && p->stopwatch) {
|
||||
mpp_stopwatch_put(p->stopwatch);
|
||||
p->stopwatch = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
MppStopwatch mpp_frame_get_stopwatch(const MppFrame frame)
|
||||
{
|
||||
if (check_is_mpp_frame(frame))
|
||||
return NULL;
|
||||
|
||||
MppFrameImpl *p = (MppFrameImpl *)frame;
|
||||
return p->stopwatch;
|
||||
}
|
||||
|
||||
MPP_RET mpp_frame_copy(MppFrame dst, MppFrame src)
|
||||
{
|
||||
if (NULL == dst || check_is_mpp_frame(src)) {
|
||||
|
Reference in New Issue
Block a user