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 "Get config attributes from configs" 2686c93d9c46415cf7746351c502a3513f637e77e4root 2786c93d9c46415cf7746351c502a3513f637e77e4root#include "test_common.c" 2886c93d9c46415cf7746351c502a3513f637e77e4root 2986c93d9c46415cf7746351c502a3513f637e77e4rootint max_entrypoints; 3086c93d9c46415cf7746351c502a3513f637e77e4rootVAEntrypoint *entrypoints; 3186c93d9c46415cf7746351c502a3513f637e77e4root 3286c93d9c46415cf7746351c502a3513f637e77e4rootVAConfigID *configs; 3386c93d9c46415cf7746351c502a3513f637e77e4rootint config_count = 0; 3486c93d9c46415cf7746351c502a3513f637e77e4root 3586c93d9c46415cf7746351c502a3513f637e77e4root 3686c93d9c46415cf7746351c502a3513f637e77e4root 3786c93d9c46415cf7746351c502a3513f637e77e4rootvoid pre() 3886c93d9c46415cf7746351c502a3513f637e77e4root{ 3986c93d9c46415cf7746351c502a3513f637e77e4root int i, j, k; 4086c93d9c46415cf7746351c502a3513f637e77e4root 4186c93d9c46415cf7746351c502a3513f637e77e4root test_init(); 4286c93d9c46415cf7746351c502a3513f637e77e4root test_profiles(); 4386c93d9c46415cf7746351c502a3513f637e77e4root 4486c93d9c46415cf7746351c502a3513f637e77e4root max_entrypoints = vaMaxNumEntrypoints(va_dpy); 4586c93d9c46415cf7746351c502a3513f637e77e4root ASSERT(max_entrypoints > 0); 4686c93d9c46415cf7746351c502a3513f637e77e4root entrypoints = malloc(max_entrypoints * sizeof(VAEntrypoint)); 4786c93d9c46415cf7746351c502a3513f637e77e4root ASSERT(entrypoints); 4886c93d9c46415cf7746351c502a3513f637e77e4root 4986c93d9c46415cf7746351c502a3513f637e77e4root configs = malloc(max_entrypoints * num_profiles * sizeof(VAConfigID)); 5086c93d9c46415cf7746351c502a3513f637e77e4root ASSERT(configs); 5186c93d9c46415cf7746351c502a3513f637e77e4root 5286c93d9c46415cf7746351c502a3513f637e77e4root // Create configs 5386c93d9c46415cf7746351c502a3513f637e77e4root for(i = 0; i < num_profiles; i++) 5486c93d9c46415cf7746351c502a3513f637e77e4root { 5586c93d9c46415cf7746351c502a3513f637e77e4root int num_entrypoints; 5686c93d9c46415cf7746351c502a3513f637e77e4root va_status = vaQueryConfigEntrypoints(va_dpy, profiles[i], entrypoints, &num_entrypoints); 5786c93d9c46415cf7746351c502a3513f637e77e4root ASSERT( VA_STATUS_SUCCESS == va_status ); 5886c93d9c46415cf7746351c502a3513f637e77e4root 5986c93d9c46415cf7746351c502a3513f637e77e4root for(j = 0; j < num_entrypoints; j++) 6086c93d9c46415cf7746351c502a3513f637e77e4root { 6186c93d9c46415cf7746351c502a3513f637e77e4root va_status = vaCreateConfig(va_dpy, profiles[i], entrypoints[j], NULL, 0, &(configs[config_count])); 6286c93d9c46415cf7746351c502a3513f637e77e4root ASSERT( VA_STATUS_SUCCESS == va_status ); 6386c93d9c46415cf7746351c502a3513f637e77e4root config_count++; 6486c93d9c46415cf7746351c502a3513f637e77e4root } 6586c93d9c46415cf7746351c502a3513f637e77e4root } 6686c93d9c46415cf7746351c502a3513f637e77e4root} 6786c93d9c46415cf7746351c502a3513f637e77e4root 6886c93d9c46415cf7746351c502a3513f637e77e4rootvoid test() 6986c93d9c46415cf7746351c502a3513f637e77e4root{ 7086c93d9c46415cf7746351c502a3513f637e77e4root int i, j, k; 7186c93d9c46415cf7746351c502a3513f637e77e4root int max_attribs; 7286c93d9c46415cf7746351c502a3513f637e77e4root 7386c93d9c46415cf7746351c502a3513f637e77e4root max_attribs = vaMaxNumConfigAttributes(va_dpy); 7486c93d9c46415cf7746351c502a3513f637e77e4root ASSERT(max_attribs > 0); 7586c93d9c46415cf7746351c502a3513f637e77e4root 7686c93d9c46415cf7746351c502a3513f637e77e4root VAConfigAttrib *attrib_list = malloc(max_attribs * sizeof(VAConfigAttrib)); 7786c93d9c46415cf7746351c502a3513f637e77e4root 7886c93d9c46415cf7746351c502a3513f637e77e4root config_count = 0; 7986c93d9c46415cf7746351c502a3513f637e77e4root for(i = 0; i < num_profiles; i++) 8086c93d9c46415cf7746351c502a3513f637e77e4root { 8186c93d9c46415cf7746351c502a3513f637e77e4root int num_entrypoints; 8286c93d9c46415cf7746351c502a3513f637e77e4root 8386c93d9c46415cf7746351c502a3513f637e77e4root va_status = vaQueryConfigEntrypoints(va_dpy, profiles[i], entrypoints, &num_entrypoints); 8486c93d9c46415cf7746351c502a3513f637e77e4root ASSERT( VA_STATUS_SUCCESS == va_status ); 8586c93d9c46415cf7746351c502a3513f637e77e4root for(j = 0; j < num_entrypoints; j++) 8686c93d9c46415cf7746351c502a3513f637e77e4root { 8786c93d9c46415cf7746351c502a3513f637e77e4root VAProfile profile= -1; 8886c93d9c46415cf7746351c502a3513f637e77e4root VAEntrypoint entrypoint = -1; 8986c93d9c46415cf7746351c502a3513f637e77e4root int num_attribs = -1; 9086c93d9c46415cf7746351c502a3513f637e77e4root 9186c93d9c46415cf7746351c502a3513f637e77e4root status("Checking vaQueryConfigAttributes for %s, %s\n", profile2string(profiles[i]), entrypoint2string(entrypoints[j])); 9286c93d9c46415cf7746351c502a3513f637e77e4root memset(attrib_list, 0xff, max_attribs * sizeof(VAConfigAttrib)); 9386c93d9c46415cf7746351c502a3513f637e77e4root 9486c93d9c46415cf7746351c502a3513f637e77e4root va_status = vaQueryConfigAttributes(va_dpy, configs[config_count], &profile, &entrypoint, attrib_list, &num_attribs); 9586c93d9c46415cf7746351c502a3513f637e77e4root config_count++; 9686c93d9c46415cf7746351c502a3513f637e77e4root ASSERT( VA_STATUS_SUCCESS == va_status ); 9786c93d9c46415cf7746351c502a3513f637e77e4root ASSERT( profile == profiles[i] ); 9886c93d9c46415cf7746351c502a3513f637e77e4root ASSERT( entrypoint == entrypoints[j] ); 9986c93d9c46415cf7746351c502a3513f637e77e4root ASSERT( num_attribs >= 0 ); 10086c93d9c46415cf7746351c502a3513f637e77e4root for(k = 0; k < num_attribs; k++) 10186c93d9c46415cf7746351c502a3513f637e77e4root { 10286c93d9c46415cf7746351c502a3513f637e77e4root status(" %d -> %08x\n", attrib_list[k].type, attrib_list[k].value); 10386c93d9c46415cf7746351c502a3513f637e77e4root ASSERT(attrib_list[k].value != VA_ATTRIB_NOT_SUPPORTED); 10486c93d9c46415cf7746351c502a3513f637e77e4root } 10586c93d9c46415cf7746351c502a3513f637e77e4root } 10686c93d9c46415cf7746351c502a3513f637e77e4root } 10786c93d9c46415cf7746351c502a3513f637e77e4root 10886c93d9c46415cf7746351c502a3513f637e77e4root free(attrib_list); 10986c93d9c46415cf7746351c502a3513f637e77e4root} 11086c93d9c46415cf7746351c502a3513f637e77e4root 11186c93d9c46415cf7746351c502a3513f637e77e4rootvoid post() 11286c93d9c46415cf7746351c502a3513f637e77e4root{ 11386c93d9c46415cf7746351c502a3513f637e77e4root int i; 11486c93d9c46415cf7746351c502a3513f637e77e4root for(i = 0; i < config_count; i++) 11586c93d9c46415cf7746351c502a3513f637e77e4root { 11686c93d9c46415cf7746351c502a3513f637e77e4root va_status = vaDestroyConfig( va_dpy, configs[i] ); 11786c93d9c46415cf7746351c502a3513f637e77e4root ASSERT( VA_STATUS_SUCCESS == va_status ); 11886c93d9c46415cf7746351c502a3513f637e77e4root } 11986c93d9c46415cf7746351c502a3513f637e77e4root 12086c93d9c46415cf7746351c502a3513f637e77e4root free(configs); 12186c93d9c46415cf7746351c502a3513f637e77e4root free(entrypoints); 12286c93d9c46415cf7746351c502a3513f637e77e4root test_terminate(); 12386c93d9c46415cf7746351c502a3513f637e77e4root} 124