From: SeokYeon Hwang Date: Fri, 10 Oct 2014 06:13:54 +0000 (+0900) Subject: vaapi: fixed compilation failure with old version VA-API X-Git-Tag: Tizen_Studio_1.3_Release_p2.3.2~620^2~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e3dd1d84351d3478d08ecb1b8ccf4170b0feee8b;p=sdk%2Femulator%2Fqemu.git vaapi: fixed compilation failure with old version VA-API Change-Id: I916ccd20d8fd90399255bc2e3522b9169fe5e0e7 Signed-off-by: SeokYeon Hwang --- diff --git a/tizen/src/hw/pci/maru_brillcodec_vaapi.c b/tizen/src/hw/pci/maru_brillcodec_vaapi.c index b3b7bbb43a..62227d549f 100644 --- a/tizen/src/hw/pci/maru_brillcodec_vaapi.c +++ b/tizen/src/hw/pci/maru_brillcodec_vaapi.c @@ -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)) {