summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers
diff options
context:
space:
mode:
authorChristian König <[email protected]>2014-03-01 12:31:20 +0100
committerChristian König <[email protected]>2014-03-03 18:22:38 +0100
commitbd6654aa38b75faee4d016aecfe2b1dd0dbbb78b (patch)
tree5cae464ca3028d941294ecfa501dd8e08b6fae44 /src/gallium/state_trackers
parent79c83837c93ddcdd39ffa5d701117b7126bad65f (diff)
st/omx: always advertise all components
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 <[email protected]> Reviewed-by: Leo Liu <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers')
-rw-r--r--src/gallium/state_trackers/omx/entrypoint.c15
-rw-r--r--src/gallium/state_trackers/omx/vid_enc.c41
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 52b2495dd99..d6f149e623e 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 3f1d01c6eca..993ff5739b7 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;