186c93d9c46415cf7746351c502a3513f637e77e4root/* 286c93d9c46415cf7746351c502a3513f637e77e4root * Copyright (c) 2007 Intel Corporation. All Rights Reserved. 386c93d9c46415cf7746351c502a3513f637e77e4root * 486c93d9c46415cf7746351c502a3513f637e77e4root * Permission is hereby granted, free of charge, to any person obtaining a 586c93d9c46415cf7746351c502a3513f637e77e4root * copy of this software and associated documentation files (the 686c93d9c46415cf7746351c502a3513f637e77e4root * "Software"), to deal in the Software without restriction, including 786c93d9c46415cf7746351c502a3513f637e77e4root * without limitation the rights to use, copy, modify, merge, publish, 886c93d9c46415cf7746351c502a3513f637e77e4root * distribute, sub license, and/or sell copies of the Software, and to 986c93d9c46415cf7746351c502a3513f637e77e4root * permit persons to whom the Software is furnished to do so, subject to 1086c93d9c46415cf7746351c502a3513f637e77e4root * the following conditions: 1186c93d9c46415cf7746351c502a3513f637e77e4root * 1286c93d9c46415cf7746351c502a3513f637e77e4root * The above copyright notice and this permission notice (including the 1386c93d9c46415cf7746351c502a3513f637e77e4root * next paragraph) shall be included in all copies or substantial portions 1486c93d9c46415cf7746351c502a3513f637e77e4root * of the Software. 1586c93d9c46415cf7746351c502a3513f637e77e4root * 1686c93d9c46415cf7746351c502a3513f637e77e4root * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 1786c93d9c46415cf7746351c502a3513f637e77e4root * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 1886c93d9c46415cf7746351c502a3513f637e77e4root * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 1986c93d9c46415cf7746351c502a3513f637e77e4root * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR 2086c93d9c46415cf7746351c502a3513f637e77e4root * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 2186c93d9c46415cf7746351c502a3513f637e77e4root * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 2286c93d9c46415cf7746351c502a3513f637e77e4root * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 2386c93d9c46415cf7746351c502a3513f637e77e4root */ 2486c93d9c46415cf7746351c502a3513f637e77e4root 2586c93d9c46415cf7746351c502a3513f637e77e4root#define TEST_DESCRIPTION "Create/destroy configs for all profiles / entrypoints" 2686c93d9c46415cf7746351c502a3513f637e77e4root 2786c93d9c46415cf7746351c502a3513f637e77e4root#include "test_common.c" 2886c93d9c46415cf7746351c502a3513f637e77e4root 2986c93d9c46415cf7746351c502a3513f637e77e4rootvoid pre() 3086c93d9c46415cf7746351c502a3513f637e77e4root{ 3186c93d9c46415cf7746351c502a3513f637e77e4root test_init(); 3286c93d9c46415cf7746351c502a3513f637e77e4root test_profiles(); 3386c93d9c46415cf7746351c502a3513f637e77e4root} 3486c93d9c46415cf7746351c502a3513f637e77e4root 3586c93d9c46415cf7746351c502a3513f637e77e4rootvoid test() 3686c93d9c46415cf7746351c502a3513f637e77e4root{ 3786c93d9c46415cf7746351c502a3513f637e77e4root int max_entrypoints; 3886c93d9c46415cf7746351c502a3513f637e77e4root int num_entrypoints; 3986c93d9c46415cf7746351c502a3513f637e77e4root int i, j, k; 4086c93d9c46415cf7746351c502a3513f637e77e4root int config_count = 0; 4186c93d9c46415cf7746351c502a3513f637e77e4root max_entrypoints = vaMaxNumEntrypoints(va_dpy); 4286c93d9c46415cf7746351c502a3513f637e77e4root ASSERT(max_entrypoints > 0); 4386c93d9c46415cf7746351c502a3513f637e77e4root VAEntrypoint *entrypoints = malloc(max_entrypoints * sizeof(VAEntrypoint)); 4486c93d9c46415cf7746351c502a3513f637e77e4root ASSERT(entrypoints); 4586c93d9c46415cf7746351c502a3513f637e77e4root 4686c93d9c46415cf7746351c502a3513f637e77e4root VAConfigID *configs = malloc(max_entrypoints * num_profiles * sizeof(VAConfigID)); 4786c93d9c46415cf7746351c502a3513f637e77e4root 4886c93d9c46415cf7746351c502a3513f637e77e4root for(i = 0; i < num_profiles; i++) 4986c93d9c46415cf7746351c502a3513f637e77e4root { 5086c93d9c46415cf7746351c502a3513f637e77e4root va_status = vaQueryConfigEntrypoints(va_dpy, profiles[i], entrypoints, &num_entrypoints); 5186c93d9c46415cf7746351c502a3513f637e77e4root ASSERT( VA_STATUS_SUCCESS == va_status ); 5286c93d9c46415cf7746351c502a3513f637e77e4root 5386c93d9c46415cf7746351c502a3513f637e77e4root for(j = 0; j < num_entrypoints; j++) 5486c93d9c46415cf7746351c502a3513f637e77e4root { 5586c93d9c46415cf7746351c502a3513f637e77e4root status("vaCreateConfig for %s, %s\n", profile2string(profiles[i]), entrypoint2string(entrypoints[j])); 5686c93d9c46415cf7746351c502a3513f637e77e4root va_status = vaCreateConfig(va_dpy, profiles[i], entrypoints[j], NULL, 0, &(configs[config_count])); 5786c93d9c46415cf7746351c502a3513f637e77e4root ASSERT( VA_STATUS_SUCCESS == va_status ); 5886c93d9c46415cf7746351c502a3513f637e77e4root status("vaCreateConfig returns %08x\n", configs[config_count]); 5986c93d9c46415cf7746351c502a3513f637e77e4root config_count++; 6086c93d9c46415cf7746351c502a3513f637e77e4root } 6186c93d9c46415cf7746351c502a3513f637e77e4root } 6286c93d9c46415cf7746351c502a3513f637e77e4root 6386c93d9c46415cf7746351c502a3513f637e77e4root for(i = 0; i < config_count; i++) 6486c93d9c46415cf7746351c502a3513f637e77e4root { 6586c93d9c46415cf7746351c502a3513f637e77e4root status("vaDestroyConfig for config %08x\n", configs[i]); 6686c93d9c46415cf7746351c502a3513f637e77e4root va_status = vaDestroyConfig( va_dpy, configs[i] ); 6786c93d9c46415cf7746351c502a3513f637e77e4root ASSERT( VA_STATUS_SUCCESS == va_status ); 6886c93d9c46415cf7746351c502a3513f637e77e4root } 6986c93d9c46415cf7746351c502a3513f637e77e4root 7086c93d9c46415cf7746351c502a3513f637e77e4root free(configs); 7186c93d9c46415cf7746351c502a3513f637e77e4root free(entrypoints); 7286c93d9c46415cf7746351c502a3513f637e77e4root} 7386c93d9c46415cf7746351c502a3513f637e77e4root 7486c93d9c46415cf7746351c502a3513f637e77e4rootvoid post() 7586c93d9c46415cf7746351c502a3513f637e77e4root{ 7686c93d9c46415cf7746351c502a3513f637e77e4root test_terminate(); 7786c93d9c46415cf7746351c502a3513f637e77e4root} 78