103b705cfSriastradh/* 203b705cfSriastradh * Copyright (c) 2011 Intel Corporation 303b705cfSriastradh * 403b705cfSriastradh * Permission is hereby granted, free of charge, to any person obtaining a 503b705cfSriastradh * copy of this software and associated documentation files (the "Software"), 603b705cfSriastradh * to deal in the Software without restriction, including without limitation 703b705cfSriastradh * the rights to use, copy, modify, merge, publish, distribute, sublicense, 803b705cfSriastradh * and/or sell copies of the Software, and to permit persons to whom the 903b705cfSriastradh * Software is furnished to do so, subject to the following conditions: 1003b705cfSriastradh * 1103b705cfSriastradh * The above copyright notice and this permission notice (including the next 1203b705cfSriastradh * paragraph) shall be included in all copies or substantial portions of the 1303b705cfSriastradh * Software. 1403b705cfSriastradh * 1503b705cfSriastradh * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 1603b705cfSriastradh * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 1703b705cfSriastradh * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 1803b705cfSriastradh * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 1903b705cfSriastradh * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 2003b705cfSriastradh * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 2103b705cfSriastradh * SOFTWARE. 2203b705cfSriastradh * 2303b705cfSriastradh * Authors: 2403b705cfSriastradh * Chris Wilson <chris@chris-wilson.co.uk> 2503b705cfSriastradh * 2603b705cfSriastradh */ 2703b705cfSriastradh 2803b705cfSriastradh#include "brw_test.h" 2903b705cfSriastradh 3003b705cfSriastradh#include <string.h> 3103b705cfSriastradh 3203b705cfSriastradhstatic const uint32_t sf_kernel[][4] = { 3303b705cfSriastradh#include "exa_sf.g5b" 3403b705cfSriastradh}; 3503b705cfSriastradh 3603b705cfSriastradhstatic const uint32_t sf_kernel_mask[][4] = { 3703b705cfSriastradh#include "exa_sf_mask.g5b" 3803b705cfSriastradh}; 3903b705cfSriastradh 4003b705cfSriastradhstatic const uint32_t ps_kernel_nomask_affine[][4] = { 4103b705cfSriastradh#include "exa_wm_xy.g5b" 4203b705cfSriastradh#include "exa_wm_src_affine.g5b" 4303b705cfSriastradh#include "exa_wm_src_sample_argb.g5b" 4403b705cfSriastradh#include "exa_wm_write.g5b" 4503b705cfSriastradh}; 4603b705cfSriastradh 4703b705cfSriastradhstatic const uint32_t ps_kernel_nomask_projective[][4] = { 4803b705cfSriastradh#include "exa_wm_xy.g5b" 4903b705cfSriastradh#include "exa_wm_src_projective.g5b" 5003b705cfSriastradh#include "exa_wm_src_sample_argb.g5b" 5103b705cfSriastradh#include "exa_wm_write.g5b" 5203b705cfSriastradh}; 5303b705cfSriastradh 5403b705cfSriastradhstatic const uint32_t ps_kernel_maskca_affine[][4] = { 5503b705cfSriastradh#include "exa_wm_xy.g5b" 5603b705cfSriastradh#include "exa_wm_src_affine.g5b" 5703b705cfSriastradh#include "exa_wm_src_sample_argb.g5b" 5803b705cfSriastradh#include "exa_wm_mask_affine.g5b" 5903b705cfSriastradh#include "exa_wm_mask_sample_argb.g5b" 6003b705cfSriastradh#include "exa_wm_ca.g5b" 6103b705cfSriastradh#include "exa_wm_write.g5b" 6203b705cfSriastradh}; 6303b705cfSriastradh 6403b705cfSriastradhstatic const uint32_t ps_kernel_maskca_projective[][4] = { 6503b705cfSriastradh#include "exa_wm_xy.g5b" 6603b705cfSriastradh#include "exa_wm_src_projective.g5b" 6703b705cfSriastradh#include "exa_wm_src_sample_argb.g5b" 6803b705cfSriastradh#include "exa_wm_mask_projective.g5b" 6903b705cfSriastradh#include "exa_wm_mask_sample_argb.g5b" 7003b705cfSriastradh#include "exa_wm_ca.g5b" 7103b705cfSriastradh#include "exa_wm_write.g5b" 7203b705cfSriastradh}; 7303b705cfSriastradh 7403b705cfSriastradhstatic const uint32_t ps_kernel_maskca_srcalpha_affine[][4] = { 7503b705cfSriastradh#include "exa_wm_xy.g5b" 7603b705cfSriastradh#include "exa_wm_src_affine.g5b" 7703b705cfSriastradh#include "exa_wm_src_sample_a.g5b" 7803b705cfSriastradh#include "exa_wm_mask_affine.g5b" 7903b705cfSriastradh#include "exa_wm_mask_sample_argb.g5b" 8003b705cfSriastradh#include "exa_wm_ca_srcalpha.g5b" 8103b705cfSriastradh#include "exa_wm_write.g5b" 8203b705cfSriastradh}; 8303b705cfSriastradh 8403b705cfSriastradhstatic const uint32_t ps_kernel_maskca_srcalpha_projective[][4] = { 8503b705cfSriastradh#include "exa_wm_xy.g5b" 8603b705cfSriastradh#include "exa_wm_src_projective.g5b" 8703b705cfSriastradh#include "exa_wm_src_sample_a.g5b" 8803b705cfSriastradh#include "exa_wm_mask_projective.g5b" 8903b705cfSriastradh#include "exa_wm_mask_sample_argb.g5b" 9003b705cfSriastradh#include "exa_wm_ca_srcalpha.g5b" 9103b705cfSriastradh#include "exa_wm_write.g5b" 9203b705cfSriastradh}; 9303b705cfSriastradh 9403b705cfSriastradhstatic const uint32_t ps_kernel_masknoca_affine[][4] = { 9503b705cfSriastradh#include "exa_wm_xy.g5b" 9603b705cfSriastradh#include "exa_wm_src_affine.g5b" 9703b705cfSriastradh#include "exa_wm_src_sample_argb.g5b" 9803b705cfSriastradh#include "exa_wm_mask_affine.g5b" 9903b705cfSriastradh#include "exa_wm_mask_sample_a.g5b" 10003b705cfSriastradh#include "exa_wm_noca.g5b" 10103b705cfSriastradh#include "exa_wm_write.g5b" 10203b705cfSriastradh}; 10303b705cfSriastradh 10403b705cfSriastradhstatic const uint32_t ps_kernel_masknoca_projective[][4] = { 10503b705cfSriastradh#include "exa_wm_xy.g5b" 10603b705cfSriastradh#include "exa_wm_src_projective.g5b" 10703b705cfSriastradh#include "exa_wm_src_sample_argb.g5b" 10803b705cfSriastradh#include "exa_wm_mask_projective.g5b" 10903b705cfSriastradh#include "exa_wm_mask_sample_a.g5b" 11003b705cfSriastradh#include "exa_wm_noca.g5b" 11103b705cfSriastradh#include "exa_wm_write.g5b" 11203b705cfSriastradh}; 11303b705cfSriastradh 11403b705cfSriastradhstatic const uint32_t ps_kernel_packed_static[][4] = { 11503b705cfSriastradh#include "exa_wm_xy.g5b" 11603b705cfSriastradh#include "exa_wm_src_affine.g5b" 11703b705cfSriastradh#include "exa_wm_src_sample_argb.g5b" 118fe8aea9eSmrg#include "exa_wm_yuv_rgb_bt601.g5b" 11903b705cfSriastradh#include "exa_wm_write.g5b" 12003b705cfSriastradh}; 12103b705cfSriastradh 12203b705cfSriastradhstatic const uint32_t ps_kernel_planar_static[][4] = { 12303b705cfSriastradh#include "exa_wm_xy.g5b" 12403b705cfSriastradh#include "exa_wm_src_affine.g5b" 12503b705cfSriastradh#include "exa_wm_src_sample_planar.g5b" 126fe8aea9eSmrg#include "exa_wm_yuv_rgb_bt601.g5b" 12703b705cfSriastradh#include "exa_wm_write.g5b" 12803b705cfSriastradh}; 12903b705cfSriastradh 13003b705cfSriastradh#define compare(old) brw_test_compare(__FUNCTION__, p.gen, p.store, p.nr_insn, (struct brw_instruction *)old, ARRAY_SIZE(old)) 13103b705cfSriastradh 13213496ba1Ssnj#define GEN 050 13313496ba1Ssnj 13403b705cfSriastradhstatic void gen5_sf(void) 13503b705cfSriastradh{ 13603b705cfSriastradh uint32_t store[128]; 13703b705cfSriastradh struct brw_compile p; 13803b705cfSriastradh 13913496ba1Ssnj brw_compile_init(&p, GEN, store); 14003b705cfSriastradh brw_sf_kernel__nomask(&p); 14103b705cfSriastradh 14203b705cfSriastradh compare(sf_kernel); 14303b705cfSriastradh} 14403b705cfSriastradh 14503b705cfSriastradhstatic void gen5_sf_mask(void) 14603b705cfSriastradh{ 14703b705cfSriastradh uint32_t store[128]; 14803b705cfSriastradh struct brw_compile p; 14903b705cfSriastradh 15013496ba1Ssnj brw_compile_init(&p, GEN, store); 15103b705cfSriastradh brw_sf_kernel__mask(&p); 15203b705cfSriastradh 15303b705cfSriastradh compare(sf_kernel_mask); 15403b705cfSriastradh} 15503b705cfSriastradh 15603b705cfSriastradhstatic void gen5_wm_affine_nomask(void) 15703b705cfSriastradh{ 15803b705cfSriastradh uint32_t store[128]; 15903b705cfSriastradh struct brw_compile p; 16003b705cfSriastradh 16113496ba1Ssnj brw_compile_init(&p, GEN, store); 16203b705cfSriastradh brw_wm_kernel__affine(&p, 16); 16303b705cfSriastradh 16403b705cfSriastradh compare(ps_kernel_nomask_affine); 16503b705cfSriastradh} 16603b705cfSriastradh 16703b705cfSriastradhstatic void gen5_wm_affine_mask_noca(void) 16803b705cfSriastradh{ 16903b705cfSriastradh uint32_t store[128]; 17003b705cfSriastradh struct brw_compile p; 17103b705cfSriastradh 17213496ba1Ssnj brw_compile_init(&p, GEN, store); 17303b705cfSriastradh brw_wm_kernel__affine_mask(&p, 16); 17403b705cfSriastradh 17503b705cfSriastradh compare(ps_kernel_masknoca_affine); 17603b705cfSriastradh} 17703b705cfSriastradh 17803b705cfSriastradhstatic void gen5_wm_affine_mask_ca(void) 17903b705cfSriastradh{ 18003b705cfSriastradh uint32_t store[128]; 18103b705cfSriastradh struct brw_compile p; 18203b705cfSriastradh 18313496ba1Ssnj brw_compile_init(&p, GEN, store); 18403b705cfSriastradh brw_wm_kernel__affine_mask_ca(&p, 16); 18503b705cfSriastradh 18603b705cfSriastradh compare(ps_kernel_maskca_affine); 18703b705cfSriastradh} 18803b705cfSriastradh 18903b705cfSriastradhstatic void gen5_wm_projective_nomask(void) 19003b705cfSriastradh{ 19103b705cfSriastradh uint32_t store[128]; 19203b705cfSriastradh struct brw_compile p; 19303b705cfSriastradh 19413496ba1Ssnj brw_compile_init(&p, GEN, store); 19503b705cfSriastradh brw_wm_kernel__projective(&p, 16); 19603b705cfSriastradh 19703b705cfSriastradh compare(ps_kernel_nomask_projective); 19803b705cfSriastradh} 19903b705cfSriastradh 20003b705cfSriastradhvoid brw_test_gen5(void) 20103b705cfSriastradh{ 20203b705cfSriastradh gen5_sf(); 20303b705cfSriastradh gen5_sf_mask(); 20403b705cfSriastradh 20503b705cfSriastradh gen5_wm_affine_nomask(); 20603b705cfSriastradh gen5_wm_affine_mask_noca(); 20703b705cfSriastradh gen5_wm_affine_mask_ca(); 20803b705cfSriastradh 20903b705cfSriastradh gen5_wm_projective_nomask(); 21003b705cfSriastradh} 211