diff --git a/contrib/sdk/sources/vaapi/intel-driver-1.4.1/src/intel_driver.c b/contrib/sdk/sources/vaapi/intel-driver-1.4.1/src/intel_driver.c index b758e34313..7217a3a790 100644 --- a/contrib/sdk/sources/vaapi/intel-driver-1.4.1/src/intel_driver.c +++ b/contrib/sdk/sources/vaapi/intel-driver-1.4.1/src/intel_driver.c @@ -45,7 +45,7 @@ intel_driver_get_param(struct intel_driver_data *intel, int param, int *value) gp.param = param; gp.value = value; - return drmIoctl(intel->fd, DRM_I915_GETPARAM, &gp) == 0; + return drmIoctl(intel->fd, DRM_IOCTL_I915_GETPARAM, &gp) == 0; // return drmCommandWriteRead(intel->fd, DRM_I915_GETPARAM, &gp, sizeof(gp)) == 0; } @@ -92,17 +92,10 @@ intel_driver_init(VADriverContextP ctx) // fprintf(stderr, "g_intel_debug_option_flags:%x\n", g_intel_debug_option_flags); assert(drm_state); - assert(VA_CHECK_DRM_AUTH_TYPE(ctx, VA_DRM_AUTH_DRI1) || - VA_CHECK_DRM_AUTH_TYPE(ctx, VA_DRM_AUTH_DRI2) || - VA_CHECK_DRM_AUTH_TYPE(ctx, VA_DRM_AUTH_CUSTOM)); intel->fd = drm_state->fd; intel->dri2Enabled = 1; - if (!intel->dri2Enabled) { - return false; - } - intel->locked = 0; // pthread_mutex_init(&intel->ctxmutex, NULL); diff --git a/contrib/sdk/sources/vaapi/intel-driver-1.4.1/src/intel_driver.h b/contrib/sdk/sources/vaapi/intel-driver-1.4.1/src/intel_driver.h index a056aa9793..57912253ff 100644 --- a/contrib/sdk/sources/vaapi/intel-driver-1.4.1/src/intel_driver.h +++ b/contrib/sdk/sources/vaapi/intel-driver-1.4.1/src/intel_driver.h @@ -192,4 +192,9 @@ struct intel_region #define IS_CHERRYVIEW(device_info) (device_info->is_cherryview) #define IS_GEN8(device_info) (device_info->gen == 8) +#define ENTER() printf("enter %s\n",__FUNCTION__) +#define LEAVE() printf("leave %s\n",__FUNCTION__) +#define FAIL() printf("fail %s\n",__FUNCTION__) + + #endif /* _INTEL_DRIVER_H_ */ diff --git a/contrib/sdk/sources/vaapi/libva-1.4.1/test/basic/test_07.c b/contrib/sdk/sources/vaapi/libva-1.4.1/test/basic/test_07.c index 2e01533996..51099c8db3 100644 --- a/contrib/sdk/sources/vaapi/libva-1.4.1/test/basic/test_07.c +++ b/contrib/sdk/sources/vaapi/libva-1.4.1/test/basic/test_07.c @@ -8,11 +8,11 @@ * distribute, sub license, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: - * + * * The above copyright notice and this permission notice (including the * next paragraph) shall be included in all copies or substantial portions * of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. @@ -36,7 +36,7 @@ void pre() void test_unique_surfaces(VASurfaceID *surface_list1, int surface_count1, VASurfaceID *surface_list2, int surface_count2) { int i,j; - + for(i = 0; i < surface_count1; i++) { for(j = 0; j < surface_count2; j++) @@ -56,7 +56,7 @@ void test() VASurfaceID surfaces_4[4+1]; VASurfaceID surfaces_16[16+1]; VASurfaceID surfaces_6[6+1]; - + memset(surfaces_1, 0xff, sizeof(surfaces_1)); memset(surfaces_4, 0xff, sizeof(surfaces_4)); memset(surfaces_16, 0xff, sizeof(surfaces_16)); @@ -79,17 +79,15 @@ void test() va_status = vaCreateSurfaces(va_dpy, VA_RT_FORMAT_YUV420, 352, 288, surfaces_16, 16, NULL, 0); ASSERT( VA_STATUS_SUCCESS == va_status ); ASSERT( DEAD_SURFACE_ID == surfaces_16[16] ); /* bounds check */ - + test_unique_surfaces(surfaces_1, 1, surfaces_4, 4); - test_unique_surfaces(surfaces_4, 4, surfaces_16, 4); test_unique_surfaces(surfaces_4, 4, surfaces_16, 16); test_unique_surfaces(surfaces_4, 1, surfaces_16, 16); - test_unique_surfaces(surfaces_1, 16, surfaces_16, 16); status("vaDestroySurface 4 surfaces\n"); va_status = vaDestroySurfaces(va_dpy, surfaces_4, 4); ASSERT( VA_STATUS_SUCCESS == va_status ); - + status("vaCreateSurfaces 6 surfaces\n"); surfaces_6[6] = DEAD_SURFACE_ID; va_status = vaCreateSurfaces(va_dpy, VA_RT_FORMAT_YUV420, 352, 288, surfaces_6, 6, NULL, 0); @@ -98,12 +96,12 @@ void test() test_unique_surfaces(surfaces_1, 1, surfaces_6, 6); test_unique_surfaces(surfaces_6, 6, surfaces_16, 16); - test_unique_surfaces(surfaces_1, 6, surfaces_16, 6); + test_unique_surfaces(surfaces_1, 1, surfaces_16, 16); status("vaDestroySurface 16 surfaces\n"); va_status = vaDestroySurfaces(va_dpy, surfaces_16, 16); ASSERT( VA_STATUS_SUCCESS == va_status ); - + status("vaDestroySurface 1 surface\n"); va_status = vaDestroySurfaces(va_dpy, surfaces_1, 1); ASSERT( VA_STATUS_SUCCESS == va_status ); diff --git a/contrib/sdk/sources/vaapi/libva-1.4.1/test/basic/test_10.c b/contrib/sdk/sources/vaapi/libva-1.4.1/test/basic/test_10.c index 9c7c5669ed..cc52103113 100644 --- a/contrib/sdk/sources/vaapi/libva-1.4.1/test/basic/test_10.c +++ b/contrib/sdk/sources/vaapi/libva-1.4.1/test/basic/test_10.c @@ -8,11 +8,11 @@ * distribute, sub license, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: - * + * * The above copyright notice and this permission notice (including the * next paragraph) shall be included in all copies or substantial portions * of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. @@ -43,13 +43,13 @@ void pre() int height = 288; int surface_count = 4; total_surfaces = surface_count; - + surfaces = malloc(total_surfaces * sizeof(VASurfaceID)); // TODO: Don't assume VA_RT_FORMAT_YUV420 is supported / needed for each config va_status = vaCreateSurfaces(va_dpy, VA_RT_FORMAT_YUV420, width, height, surfaces, total_surfaces, NULL, 0); ASSERT( VA_STATUS_SUCCESS == va_status ); - + status("vaCreateContext with config %08x\n", config); int flags = 0; va_status = vaCreateContext( va_dpy, config, width, height, flags, surfaces, surface_count, &context ); @@ -59,7 +59,7 @@ void pre() void test_unique_buffers(VABufferID *buffer_list, int buffer_count) { int i,j; - + for(i = 0; i < buffer_count; i++) { for(j = 0; j < i; j++) @@ -84,7 +84,7 @@ VABufferType buffer_types[] = unsigned int buffer_sizes[] = { - sizeof(VAPictureParameterBufferMPEG4), + sizeof(VAPictureParameterBufferMPEG4), sizeof(VAIQMatrixBufferH264), 32*1024, 48*1024, @@ -113,7 +113,7 @@ void test() ASSERT( DEAD_BUFFER_ID == buffer_ids[i+1] ); /* Bounds check */ } test_unique_buffers(buffer_ids, NUM_BUFFER_TYPES); - + for(i=0; i < NUM_BUFFER_TYPES; i++) { va_status = vaDestroyBuffer(va_dpy, buffer_ids[i]); @@ -130,10 +130,10 @@ void post() status("vaDestroyConfig for config %08x\n", config); va_status = vaDestroyConfig( va_dpy, config ); ASSERT( VA_STATUS_SUCCESS == va_status ); - + va_status = vaDestroySurfaces(va_dpy, surfaces, total_surfaces); ASSERT( VA_STATUS_SUCCESS == va_status ); - + free(surfaces); test_terminate(); diff --git a/contrib/sdk/sources/vaapi/libva-1.4.1/test/basic/test_11.c b/contrib/sdk/sources/vaapi/libva-1.4.1/test/basic/test_11.c index 99c8785719..fd7ec4ae1c 100644 --- a/contrib/sdk/sources/vaapi/libva-1.4.1/test/basic/test_11.c +++ b/contrib/sdk/sources/vaapi/libva-1.4.1/test/basic/test_11.c @@ -8,11 +8,11 @@ * distribute, sub license, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: - * + * * The above copyright notice and this permission notice (including the * next paragraph) shall be included in all copies or substantial portions * of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. @@ -43,13 +43,13 @@ void pre() int height = 288; int surface_count = 4; total_surfaces = surface_count; - + surfaces = malloc(total_surfaces * sizeof(VASurfaceID)); // TODO: Don't assume VA_RT_FORMAT_YUV420 is supported / needed for each config va_status = vaCreateSurfaces(va_dpy, VA_RT_FORMAT_YUV420, width, height, surfaces, total_surfaces, NULL, 0); ASSERT( VA_STATUS_SUCCESS == va_status ); - + status("vaCreateContext with config %08x\n", config); int flags = 0; va_status = vaCreateContext( va_dpy, config, width, height, flags, surfaces, surface_count, &context ); @@ -59,7 +59,7 @@ void pre() void test_unique_buffers(VABufferID *buffer_list, int buffer_count) { int i,j; - + for(i = 0; i < buffer_count; i++) { for(j = 0; j < i; j++) @@ -84,7 +84,7 @@ VABufferType buffer_types[] = unsigned int buffer_sizes[] = { - sizeof(VAPictureParameterBufferMPEG4), + sizeof(VAPictureParameterBufferMPEG4), sizeof(VAIQMatrixBufferH264), 32*1024, 48*1024, @@ -112,13 +112,13 @@ void test() input_data[i] = malloc(buffer_sizes[i]+4); ASSERT(input_data[i]); - + /* Generate input data */ for(j = buffer_sizes[i] / 4; j--;) { - input_data[i][j] = random(); + input_data[i][j] = 20; //random(); } - + /* Copy to secondary buffer */ data = malloc(buffer_sizes[i]); ASSERT(data); @@ -128,7 +128,7 @@ void test() va_status = vaCreateBuffer(va_dpy, context, buffer_types[i], buffer_sizes[i], 1, data, &buffer_ids[i]); ASSERT( VA_STATUS_SUCCESS == va_status ); status("vaCreateBuffer created buffer %08x of type %d\n", buffer_ids[i], buffer_types[i]); - + /* Wipe secondary buffer */ memset(data, 0, buffer_sizes[i]); free(data); @@ -142,10 +142,10 @@ void test() ASSERT( VA_STATUS_SUCCESS == va_status ); status("vaMapBuffer mapped buffer %08x\n", buffer_ids[i]); - /* Compare data */ + /* Compare data */ ASSERT( memcmp(input_data[i], data, buffer_sizes[i]) == 0 ); } - + for(i=0; i < NUM_BUFFER_TYPES; i++) { va_status = vaUnmapBuffer(va_dpy, buffer_ids[i]); @@ -153,7 +153,7 @@ void test() va_status = vaDestroyBuffer(va_dpy, buffer_ids[i]); ASSERT( VA_STATUS_SUCCESS == va_status ); - + free(input_data[i]); } } @@ -169,10 +169,10 @@ void post() status("vaDestroyConfig for config %08x\n", config); va_status = vaDestroyConfig( va_dpy, config ); ASSERT( VA_STATUS_SUCCESS == va_status ); - + va_status = vaDestroySurfaces(va_dpy, surfaces, total_surfaces); ASSERT( VA_STATUS_SUCCESS == va_status ); - + free(surfaces); test_terminate(); diff --git a/contrib/sdk/sources/vaapi/libva-1.4.1/test/basic/test_common.c b/contrib/sdk/sources/vaapi/libva-1.4.1/test/basic/test_common.c index 0486d99c2c..e06a822952 100644 --- a/contrib/sdk/sources/vaapi/libva-1.4.1/test/basic/test_common.c +++ b/contrib/sdk/sources/vaapi/libva-1.4.1/test/basic/test_common.c @@ -8,11 +8,11 @@ * distribute, sub license, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: - * + * * The above copyright notice and this permission notice (including the * next paragraph) shall be included in all copies or substantial portions * of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. @@ -34,7 +34,6 @@ #include #include #include -#include #define ASSERT assert @@ -45,11 +44,10 @@ void status(const char *msg, ...); #include "test_x11.c" #endif -Display *dpy; VADisplay va_dpy; VAStatus va_status; int major_version, minor_version; -int print_status = 0; +int print_status = 1; int num_profiles; VAProfile *profiles = NULL; @@ -143,14 +141,14 @@ void test_profiles() ASSERT(max_profiles > 0); profiles = malloc(max_profiles * sizeof(VAProfile)); ASSERT(profiles); - + va_status = vaQueryConfigProfiles(va_dpy, profiles, &num_profiles); ASSERT( VA_STATUS_SUCCESS == va_status ); - + status("vaQueryConfigProfiles reports %d profiles\n", num_profiles); ASSERT(num_profiles <= max_profiles); ASSERT(num_profiles > 0); - + if (print_status) { for(i = 0; i < num_profiles; i++) diff --git a/contrib/sdk/sources/vaapi/libva-1.4.1/test/basic/test_x11.c b/contrib/sdk/sources/vaapi/libva-1.4.1/test/basic/test_x11.c index df8f3628b6..932b2a94da 100644 --- a/contrib/sdk/sources/vaapi/libva-1.4.1/test/basic/test_x11.c +++ b/contrib/sdk/sources/vaapi/libva-1.4.1/test/basic/test_x11.c @@ -8,11 +8,11 @@ * distribute, sub license, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: - * + * * The above copyright notice and this permission notice (including the * next paragraph) shall be included in all copies or substantial portions * of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. @@ -22,7 +22,6 @@ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -Display *dpy; VADisplay va_dpy; VAStatus va_status; VAProfile *profiles ; @@ -30,14 +29,10 @@ int major_version, minor_version; void test_init() { - dpy = XOpenDisplay(NULL); - ASSERT( dpy ); - status("XOpenDisplay: dpy = %08x\n", dpy); - - va_dpy = vaGetDisplay(dpy); - ASSERT( va_dpy ); - status("vaGetDisplay: va_dpy = %08x\n", va_dpy); - + va_dpy = va_open_display(); + ASSERT( va_dpy ); + status("va_open_display: va_dpy = %08x\n", va_dpy); + va_status = vaInitialize(va_dpy, &major_version, &minor_version); ASSERT( VA_STATUS_SUCCESS == va_status ); status("vaInitialize: major = %d minor = %d\n", major_version, minor_version); @@ -49,9 +44,6 @@ void test_terminate() ASSERT( VA_STATUS_SUCCESS == va_status ); status("vaTerminate\n"); - XCloseDisplay(dpy); - status("XCloseDisplay\n"); - if (profiles) { free(profiles); diff --git a/contrib/sdk/sources/vaapi/libva-1.4.1/test/common/va_display.c b/contrib/sdk/sources/vaapi/libva-1.4.1/test/common/va_display.c index dd58dd2732..6d12b3c414 100644 --- a/contrib/sdk/sources/vaapi/libva-1.4.1/test/common/va_display.c +++ b/contrib/sdk/sources/vaapi/libva-1.4.1/test/common/va_display.c @@ -8,11 +8,11 @@ * distribute, sub license, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: - * + * * The above copyright notice and this permission notice (including the * next paragraph) shall be included in all copies or substantial portions * of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. @@ -30,26 +30,11 @@ #include #include "va_display.h" -extern const VADisplayHooks va_display_hooks_android; -extern const VADisplayHooks va_display_hooks_wayland; -extern const VADisplayHooks va_display_hooks_x11; extern const VADisplayHooks va_display_hooks_drm; static const VADisplayHooks *g_display_hooks; static const VADisplayHooks *g_display_hooks_available[] = { -#ifdef ANDROID - &va_display_hooks_android, -#else -#ifdef HAVE_VA_WAYLAND - &va_display_hooks_wayland, -#endif -#ifdef HAVE_VA_X11 - &va_display_hooks_x11, -#endif -#ifdef HAVE_VA_DRM &va_display_hooks_drm, -#endif -#endif NULL }; diff --git a/contrib/sdk/sources/vaapi/libva-1.4.1/test/common/va_display_drm.c b/contrib/sdk/sources/vaapi/libva-1.4.1/test/common/va_display_drm.c index b6394cdd22..49af64384a 100644 --- a/contrib/sdk/sources/vaapi/libva-1.4.1/test/common/va_display_drm.c +++ b/contrib/sdk/sources/vaapi/libva-1.4.1/test/common/va_display_drm.c @@ -32,43 +32,29 @@ #endif #include "va_display.h" -static int drm_fd = -1; +static int drm_fd = 0; static VADisplay va_open_display_drm(void) { VADisplay va_dpy; - int i; - static const char *drm_device_paths[] = { - "/dev/dri/renderD128", - "/dev/dri/card0", - NULL - }; + drm_fd = get_service("DISPLAY"); + if (drm_fd == 0) + return NULL; - for (i = 0; drm_device_paths[i]; i++) { - drm_fd = open(drm_device_paths[i], O_RDWR); - if (drm_fd < 0) - continue; + va_dpy = vaGetDisplayDRM(drm_fd); + if (va_dpy) + return va_dpy; - va_dpy = vaGetDisplayDRM(drm_fd); - if (va_dpy) - return va_dpy; - - close(drm_fd); - drm_fd = -1; - } + drm_fd = 0; return NULL; } static void va_close_display_drm(VADisplay va_dpy) { - if (drm_fd < 0) - return; - - close(drm_fd); - drm_fd = -1; + drm_fd = 0; } diff --git a/contrib/sdk/sources/vaapi/libva-1.4.1/va/va_x11.h b/contrib/sdk/sources/vaapi/libva-1.4.1/va/va_x11.h index c9be38d6ac..7f52d8b931 100644 --- a/contrib/sdk/sources/vaapi/libva-1.4.1/va/va_x11.h +++ b/contrib/sdk/sources/vaapi/libva-1.4.1/va/va_x11.h @@ -25,7 +25,6 @@ #define _VA_X11_H_ #include -#include #ifdef __cplusplus extern "C" { @@ -34,22 +33,19 @@ extern "C" { /* * Returns a suitable VADisplay for VA API */ -VADisplay vaGetDisplay ( - Display *dpy -); +VADisplay va_open_display(void); /* * Output rendering - * Following is the rendering interface for X windows, + * Following is the rendering interface for X windows, * to get the decode output surface to a X drawable - * It basically performs a de-interlacing (if needed), + * It basically performs a de-interlacing (if needed), * color space conversion and scaling to the destination * rectangle */ VAStatus vaPutSurface ( VADisplay dpy, - VASurfaceID surface, - Drawable draw, /* X Drawable */ + VASurfaceID surface, short srcx, short srcy, unsigned short srcw,