[Mesa-dev] [PATCH 1/3] omx: query driver encode capatibility earlier

Emil Velikov emil.l.velikov at gmail.com
Sat Feb 15 11:30:21 PST 2014


Query of the driver support AVC_HIGH encode before reporting
the total number of supported components.

Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
---

There is no point in advertising two components - decoder and
encoder if the latter does not exist. Check encoder's presence
and report accordingly.

-Emil 

 src/gallium/state_trackers/omx/entrypoint.c | 17 +++++++++++++++--
 src/gallium/state_trackers/omx/vid_enc.c    |  7 +------
 2 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/src/gallium/state_trackers/omx/entrypoint.c b/src/gallium/state_trackers/omx/entrypoint.c
index 52b2495..fa654ba 100644
--- a/src/gallium/state_trackers/omx/entrypoint.c
+++ b/src/gallium/state_trackers/omx/entrypoint.c
@@ -50,10 +50,23 @@ static unsigned omx_usecount = 0;
 
 int omx_component_library_Setup(stLoaderComponentType **stComponents)
 {
+   struct vl_screen *vscreen = omx_get_screen();
+   struct pipe_screen *screen = vscreen ? vscreen->pscreen : NULL;
    OMX_ERRORTYPE r;
+   int num_components = 1;
+
+   /*
+    * Increment the number of components if the driver supports
+    * PIPE_VIDEO_PROFILE_MPEG4_AVC_HIGH encoding.
+    */
+   if (screen->get_video_param(screen, PIPE_VIDEO_PROFILE_MPEG4_AVC_HIGH,
+                               PIPE_VIDEO_ENTRYPOINT_ENCODE,
+                               PIPE_VIDEO_CAP_SUPPORTED) {
+      num_components++;
+   }
 
    if (stComponents == NULL)
-      return 2;
+      return num_components;
 
    /* component 0 - video decoder */
    r = vid_dec_LoaderComponent(stComponents[0]);
@@ -65,7 +78,7 @@ int omx_component_library_Setup(stLoaderComponentType **stComponents)
    if (r != OMX_ErrorNone)
       return r;
 
-   return 2;
+   return num_components;
 }
 
 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 6e65274..1a10fdc 100644
--- a/src/gallium/state_trackers/omx/vid_enc.c
+++ b/src/gallium/state_trackers/omx/vid_enc.c
@@ -106,12 +106,7 @@ OMX_ERRORTYPE vid_enc_LoaderComponent(stLoaderComponentType *comp)
    comp->componentVersion.s.nRevision = 0;
    comp->componentVersion.s.nStep = 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;
+   comp->name_specific_length = 1;
 
    omx_put_screen();
 
-- 
1.8.5.5



More information about the mesa-dev mailing list