From 2593354643b4bad26cd23b72a5e7073b4cad8cd0 Mon Sep 17 00:00:00 2001 From: Leo Liu Date: Mon, 29 Aug 2016 13:43:48 -0400 Subject: [PATCH] st/omx/dec: enable hevc omx decode support MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Leo Liu Acked-by: Christian König --- src/gallium/state_trackers/omx/vid_dec.c | 23 ++++++++++++++++++++++- src/gallium/state_trackers/omx/vid_dec.h | 3 +++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/gallium/state_trackers/omx/vid_dec.c b/src/gallium/state_trackers/omx/vid_dec.c index f782263bda9..90f435bc1dc 100644 --- a/src/gallium/state_trackers/omx/vid_dec.c +++ b/src/gallium/state_trackers/omx/vid_dec.c @@ -69,7 +69,7 @@ OMX_ERRORTYPE vid_dec_LoaderComponent(stLoaderComponentType *comp) comp->componentVersion.s.nVersionMinor = 0; comp->componentVersion.s.nRevision = 0; comp->componentVersion.s.nStep = 1; - comp->name_specific_length = 2; + comp->name_specific_length = 3; comp->name = CALLOC(1, OMX_MAX_STRINGNAME_SIZE); if (comp->name == NULL) @@ -91,6 +91,10 @@ OMX_ERRORTYPE vid_dec_LoaderComponent(stLoaderComponentType *comp) if (comp->name_specific[1] == NULL) goto error_specific; + comp->name_specific[2] = CALLOC(1, OMX_MAX_STRINGNAME_SIZE); + if (comp->name_specific[2] == NULL) + goto error_specific; + comp->role_specific[0] = CALLOC(1, OMX_MAX_STRINGNAME_SIZE); if (comp->role_specific[0] == NULL) goto error_specific; @@ -99,20 +103,28 @@ OMX_ERRORTYPE vid_dec_LoaderComponent(stLoaderComponentType *comp) if (comp->role_specific[1] == NULL) goto error_specific; + comp->role_specific[2] = CALLOC(1, OMX_MAX_STRINGNAME_SIZE); + if (comp->role_specific[2] == NULL) + goto error_specific; + strcpy(comp->name, OMX_VID_DEC_BASE_NAME); strcpy(comp->name_specific[0], OMX_VID_DEC_MPEG2_NAME); strcpy(comp->name_specific[1], OMX_VID_DEC_AVC_NAME); + strcpy(comp->name_specific[2], OMX_VID_DEC_HEVC_NAME); strcpy(comp->role_specific[0], OMX_VID_DEC_MPEG2_ROLE); strcpy(comp->role_specific[1], OMX_VID_DEC_AVC_ROLE); + strcpy(comp->role_specific[2], OMX_VID_DEC_HEVC_ROLE); comp->constructor = vid_dec_Constructor; return OMX_ErrorNone; error_specific: + FREE(comp->role_specific[2]); FREE(comp->role_specific[1]); FREE(comp->role_specific[0]); + FREE(comp->name_specific[2]); FREE(comp->name_specific[1]); FREE(comp->name_specific[0]); @@ -151,6 +163,9 @@ static OMX_ERRORTYPE vid_dec_Constructor(OMX_COMPONENTTYPE *comp, OMX_STRING nam if (!strcmp(name, OMX_VID_DEC_AVC_NAME)) priv->profile = PIPE_VIDEO_PROFILE_MPEG4_AVC_HIGH; + if (!strcmp(name, OMX_VID_DEC_HEVC_NAME)) + priv->profile = PIPE_VIDEO_PROFILE_HEVC_MAIN; + priv->BufferMgmtCallback = vid_dec_FrameDecoded; priv->messageHandler = vid_dec_MessageHandler; priv->destructor = vid_dec_Destructor; @@ -290,6 +305,8 @@ static OMX_ERRORTYPE vid_dec_SetParameter(OMX_HANDLETYPE handle, OMX_INDEXTYPE i priv->profile = PIPE_VIDEO_PROFILE_MPEG2_MAIN; } else if (!strcmp((char *)role->cRole, OMX_VID_DEC_AVC_ROLE)) { priv->profile = PIPE_VIDEO_PROFILE_MPEG4_AVC_HIGH; + } else if (!strcmp((char *)role->cRole, OMX_VID_DEC_HEVC_ROLE)) { + priv->profile = PIPE_VIDEO_PROFILE_HEVC_MAIN; } else { return OMX_ErrorBadParameter; } @@ -338,6 +355,8 @@ static OMX_ERRORTYPE vid_dec_GetParameter(OMX_HANDLETYPE handle, OMX_INDEXTYPE i strcpy((char *)role->cRole, OMX_VID_DEC_MPEG2_ROLE); else if (priv->profile == PIPE_VIDEO_PROFILE_MPEG4_AVC_HIGH) strcpy((char *)role->cRole, OMX_VID_DEC_AVC_ROLE); + else if (priv->profile == PIPE_VIDEO_PROFILE_HEVC_MAIN) + strcpy((char *)role->cRole, OMX_VID_DEC_HEVC_ROLE); break; } @@ -383,6 +402,8 @@ static OMX_ERRORTYPE vid_dec_MessageHandler(OMX_COMPONENTTYPE* comp, internalReq vid_dec_mpeg12_Init(priv); else if (priv->profile == PIPE_VIDEO_PROFILE_MPEG4_AVC_HIGH) vid_dec_h264_Init(priv); + else if (priv->profile == PIPE_VIDEO_PROFILE_HEVC_MAIN) + vid_dec_h265_Init(priv); } else if ((msg->messageParam == OMX_StateLoaded) && (priv->state == OMX_StateIdle)) { if (priv->shadow) { diff --git a/src/gallium/state_trackers/omx/vid_dec.h b/src/gallium/state_trackers/omx/vid_dec.h index ef57711a31a..ebb35a353af 100644 --- a/src/gallium/state_trackers/omx/vid_dec.h +++ b/src/gallium/state_trackers/omx/vid_dec.h @@ -61,6 +61,9 @@ #define OMX_VID_DEC_AVC_NAME "OMX.mesa.video_decoder.avc" #define OMX_VID_DEC_AVC_ROLE "video_decoder.avc" +#define OMX_VID_DEC_HEVC_NAME "OMX.mesa.video_decoder.hevc" +#define OMX_VID_DEC_HEVC_ROLE "video_decoder.hevc" + #define OMX_VID_DEC_TIMESTAMP_INVALID ((OMX_TICKS) -1) struct vl_vlc; -- 2.30.2