vaapi: fixed compilation failure with old version VA-API 84/28584/4
authorSeokYeon Hwang <syeon.hwang@samsung.com>
Fri, 10 Oct 2014 06:13:54 +0000 (15:13 +0900)
committerSeokYeon Hwang <syeon.hwang@samsung.com>
Fri, 10 Oct 2014 07:57:28 +0000 (16:57 +0900)
Change-Id: I916ccd20d8fd90399255bc2e3522b9169fe5e0e7
Signed-off-by: SeokYeon Hwang <syeon.hwang@samsung.com>
tizen/src/hw/pci/maru_brillcodec_vaapi.c

index b3b7bbb43a2ea0aa659b07ed47121e475d97a7ed..62227d549f65138f9552f307372142c8ad3a03bc 100644 (file)
@@ -85,8 +85,10 @@ VAStatus (*_vaDestroyConfig)(VADisplay, VAConfigID);
 
 void (*_vaCreateSurfaces)(void);
 // for VAAPI version >= 0.34
+#if VA_CHECK_VERSION(0, 34, 0)
 typedef VAStatus (*_vaCreateSurfaces8)(VADisplay, unsigned int, unsigned int, unsigned int, VASurfaceID *,
             unsigned int, VASurfaceAttrib *, unsigned int);
+#endif
 // for VAAPI version < 0.34
 typedef VAStatus (*_vaCreateSurfaces6)(VADisplay, int, int, int, int, VASurfaceID *);
 VAStatus (*_vaDestroySurfaces)(VADisplay, VASurfaceID *, int);
@@ -153,14 +155,10 @@ static bool initialize(void)
 
 static bool probe(void)
 {
-    void *handle = dlopen("libva-x11.so", RTLD_NOW);
-    if (!handle) {
-        goto error;
-    }
-
-    DLSYM(vaGetDisplay);
-
-    handle = dlopen("libva.so", RTLD_NOW);
+    // "libva-x11.so.1" on some Ubuntu version missed dependency
+    // to "libva.so.1". To avoid "undefined symbol" error,
+    // we should use "RTLD_GLOBAL" flag.
+    void *handle = dlopen("libva.so.1", RTLD_NOW | RTLD_GLOBAL);
     if (!handle) {
         goto error;
     }
@@ -185,6 +183,13 @@ static bool probe(void)
     DLSYM(vaMapBuffer);
     DLSYM(vaUnmapBuffer);
 
+    handle = dlopen("libva-x11.so.1", RTLD_NOW);
+    if (!handle) {
+        goto error;
+    }
+
+    DLSYM(vaGetDisplay);
+
     // we initialize vaapi now for sure...
     if (!initialize()) {
         printf("Can not initialize VA-API\n");
@@ -237,10 +242,15 @@ static int create_surfaces(VAPluginContext *va_ctx,
 
     /* Create surfaces */
     if (check_version(0, 34)) {
+#if VA_CHECK_VERSION(0, 34, 0)
         if (((_vaCreateSurfaces8)_vaCreateSurfaces)(va_ctx->display, VA_RT_FORMAT_YUV420, width, height,
                     va_ctx->surface_id, va_ctx->surface_count, NULL, 0)) {
             goto error;
         }
+#else
+        printf("Can not run with VA-API version (%d, %d)\n", va_major_version, va_minor_version);
+        goto error;
+#endif
     } else {
         if (((_vaCreateSurfaces6)_vaCreateSurfaces)(va_ctx->display, width, height, VA_RT_FORMAT_YUV420,
                     va_ctx->surface_count, va_ctx->surface_id)) {