[Mesa-dev] [PATCH] st/omx: always advertise all components
Liu, Leo
Leo.Liu at amd.com
Mon Mar 3 08:46:47 PST 2014
>-----Original Message-----
>From: mesa-dev-bounces at lists.freedesktop.org [mailto:mesa-dev-
>bounces at lists.freedesktop.org] On Behalf Of Christian König
>Sent: Saturday, March 01, 2014 7:11 AM
>To: mesa-dev at lists.freedesktop.org
>Subject: [Mesa-dev] [PATCH] st/omx: always advertise all components
>
>From: Christian König <christian.koenig at amd.com>
>
Reviewed-by: Leo Liu <leo.liu at amd.com>
>omx_component_library_Setup should return all entrypoints the library
>implements, independent of what is available on the current hardware.
>
>Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=74944
>
>Signed-off-by: Christian König <christian.koenig at amd.com>
>---
> src/gallium/state_trackers/omx/entrypoint.c | 15 ++++++-----
> src/gallium/state_trackers/omx/vid_enc.c | 41 +++++++++++------------------
> 2 files changed, 23 insertions(+), 33 deletions(-)
>
>diff --git a/src/gallium/state_trackers/omx/entrypoint.c
>b/src/gallium/state_trackers/omx/entrypoint.c
>index 52b2495..d6f149e 100644
>--- a/src/gallium/state_trackers/omx/entrypoint.c
>+++ b/src/gallium/state_trackers/omx/entrypoint.c
>@@ -51,21 +51,22 @@ static unsigned omx_usecount = 0; int
>omx_component_library_Setup(stLoaderComponentType **stComponents) {
> OMX_ERRORTYPE r;
>+ unsigned i = 0;
>
> if (stComponents == NULL)
> return 2;
>
> /* component 0 - video decoder */
>- r = vid_dec_LoaderComponent(stComponents[0]);
>- if (r != OMX_ErrorNone)
>- return r;
>+ r = vid_dec_LoaderComponent(stComponents[i]);
>+ if (r == OMX_ErrorNone)
>+ ++i;
>
> /* component 1 - video encoder */
>- r = vid_enc_LoaderComponent(stComponents[1]);
>- if (r != OMX_ErrorNone)
>- return r;
>+ r = vid_enc_LoaderComponent(stComponents[i]);
>+ if (r == OMX_ErrorNone)
>+ ++i;
>
>- return 2;
>+ return i;
> }
>
> struct vl_screen *omx_get_screen(void)
>diff --git a/src/gallium/state_trackers/omx/vid_enc.c
>b/src/gallium/state_trackers/omx/vid_enc.c
>index 3f1d01c..993ff57 100644
>--- a/src/gallium/state_trackers/omx/vid_enc.c
>+++ b/src/gallium/state_trackers/omx/vid_enc.c
>@@ -95,53 +95,38 @@ static void vid_enc_name_avc(char
>str[OMX_MAX_STRINGNAME_SIZE])
>
> OMX_ERRORTYPE vid_enc_LoaderComponent(stLoaderComponentType *comp)
>{
>- struct vl_screen *vscreen = omx_get_screen();
>- struct pipe_screen *screen = vscreen ? vscreen->pscreen : NULL;
>-
>- if (!screen)
>- return OMX_ErrorInsufficientResources;
>-
> comp->componentVersion.s.nVersionMajor = 0;
> comp->componentVersion.s.nVersionMinor = 0;
> comp->componentVersion.s.nRevision = 0;
> comp->componentVersion.s.nStep = 1;
>+ comp->name_specific_length = 1;
> comp->constructor = vid_enc_Constructor;
>
>- if (screen->get_video_param(screen,
>PIPE_VIDEO_PROFILE_MPEG4_AVC_HIGH,
>- PIPE_VIDEO_ENTRYPOINT_ENCODE,
>PIPE_VIDEO_CAP_SUPPORTED))
>- comp->name_specific_length = 1;
>- else
>- comp->name_specific_length = 0;
>-
>- omx_put_screen();
>-
> comp->name = CALLOC(1, OMX_MAX_STRINGNAME_SIZE);
> if (!comp->name)
> return OMX_ErrorInsufficientResources;
>
> vid_enc_name(comp->name);
>
>- comp->name_specific = CALLOC(comp->name_specific_length, sizeof(char *));
>+ comp->name_specific = CALLOC(1, sizeof(char *));
> if (!comp->name_specific)
> goto error_arrays;
>
>- comp->role_specific = CALLOC(comp->name_specific_length, sizeof(char *));
>+ comp->role_specific = CALLOC(1, sizeof(char *));
> if (!comp->role_specific)
> goto error_arrays;
>
>- if (comp->name_specific_length) {
>- comp->name_specific[0] = CALLOC(1, OMX_MAX_STRINGNAME_SIZE);
>- if (!comp->name_specific[0])
>- goto error_specific;
>+ comp->name_specific[0] = CALLOC(1, OMX_MAX_STRINGNAME_SIZE);
>+ if (!comp->name_specific[0])
>+ goto error_specific;
>
>- vid_enc_name_avc(comp->name_specific[0]);
>+ vid_enc_name_avc(comp->name_specific[0]);
>
>- comp->role_specific[0] = CALLOC(1, OMX_MAX_STRINGNAME_SIZE);
>- if (!comp->role_specific[0])
>- goto error_specific;
>+ comp->role_specific[0] = CALLOC(1, OMX_MAX_STRINGNAME_SIZE);
>+ if (!comp->role_specific[0])
>+ goto error_specific;
>
>- strcpy(comp->role_specific[0], OMX_VID_ENC_AVC_ROLE);
>- }
>+ strcpy(comp->role_specific[0], OMX_VID_ENC_AVC_ROLE);
>
> return OMX_ErrorNone;
>
>@@ -189,6 +174,10 @@ static OMX_ERRORTYPE
>vid_enc_Constructor(OMX_COMPONENTTYPE *comp, OMX_STRING nam
> return OMX_ErrorInsufficientResources;
>
> screen = priv->screen->pscreen;
>+ if (!screen->get_video_param(screen,
>PIPE_VIDEO_PROFILE_MPEG4_AVC_HIGH,
>+ PIPE_VIDEO_ENTRYPOINT_ENCODE,
>PIPE_VIDEO_CAP_SUPPORTED))
>+ return OMX_ErrorBadParameter;
>+
> priv->s_pipe = screen->context_create(screen, priv->screen);
> if (!priv->s_pipe)
> return OMX_ErrorInsufficientResources;
>--
>1.8.3.2
>
>_______________________________________________
>mesa-dev mailing list
>mesa-dev at lists.freedesktop.org
>http://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list