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.g4b" 3403b705cfSriastradh}; 3503b705cfSriastradh 3603b705cfSriastradhstatic const uint32_t sf_kernel_mask[][4] = { 3703b705cfSriastradh#include "exa_sf_mask.g4b" 3803b705cfSriastradh}; 3903b705cfSriastradh 4003b705cfSriastradhstatic const uint32_t ps_kernel_nomask_affine[][4] = { 4103b705cfSriastradh#include "exa_wm_xy.g4b" 4203b705cfSriastradh#include "exa_wm_src_affine.g4b" 4303b705cfSriastradh#include "exa_wm_src_sample_argb.g4b" 4403b705cfSriastradh#include "exa_wm_write.g4b" 4503b705cfSriastradh}; 4603b705cfSriastradh 4703b705cfSriastradhstatic const uint32_t ps_kernel_nomask_projective[][4] = { 4803b705cfSriastradh#include "exa_wm_xy.g4b" 4903b705cfSriastradh#include "exa_wm_src_projective.g4b" 5003b705cfSriastradh#include "exa_wm_src_sample_argb.g4b" 5103b705cfSriastradh#include "exa_wm_write.g4b" 5203b705cfSriastradh}; 5303b705cfSriastradh 5403b705cfSriastradhstatic const uint32_t ps_kernel_maskca_affine[][4] = { 5503b705cfSriastradh#include "exa_wm_xy.g4b" 5603b705cfSriastradh#include "exa_wm_src_affine.g4b" 5703b705cfSriastradh#include "exa_wm_src_sample_argb.g4b" 5803b705cfSriastradh#include "exa_wm_mask_affine.g4b" 5903b705cfSriastradh#include "exa_wm_mask_sample_argb.g4b" 6003b705cfSriastradh#include "exa_wm_ca.g4b" 6103b705cfSriastradh#include "exa_wm_write.g4b" 6203b705cfSriastradh}; 6303b705cfSriastradh 6403b705cfSriastradhstatic const uint32_t ps_kernel_maskca_projective[][4] = { 6503b705cfSriastradh#include "exa_wm_xy.g4b" 6603b705cfSriastradh#include "exa_wm_src_projective.g4b" 6703b705cfSriastradh#include "exa_wm_src_sample_argb.g4b" 6803b705cfSriastradh#include "exa_wm_mask_projective.g4b" 6903b705cfSriastradh#include "exa_wm_mask_sample_argb.g4b" 7003b705cfSriastradh#include "exa_wm_ca.g4b" 7103b705cfSriastradh#include "exa_wm_write.g4b" 7203b705cfSriastradh}; 7303b705cfSriastradh 7403b705cfSriastradhstatic const uint32_t ps_kernel_maskca_srcalpha_affine[][4] = { 7503b705cfSriastradh#include "exa_wm_xy.g4b" 7603b705cfSriastradh#include "exa_wm_src_affine.g4b" 7703b705cfSriastradh#include "exa_wm_src_sample_a.g4b" 7803b705cfSriastradh#include "exa_wm_mask_affine.g4b" 7903b705cfSriastradh#include "exa_wm_mask_sample_argb.g4b" 8003b705cfSriastradh#include "exa_wm_ca_srcalpha.g4b" 8103b705cfSriastradh#include "exa_wm_write.g4b" 8203b705cfSriastradh}; 8303b705cfSriastradh 8403b705cfSriastradhstatic const uint32_t ps_kernel_maskca_srcalpha_projective[][4] = { 8503b705cfSriastradh#include "exa_wm_xy.g4b" 8603b705cfSriastradh#include "exa_wm_src_projective.g4b" 8703b705cfSriastradh#include "exa_wm_src_sample_a.g4b" 8803b705cfSriastradh#include "exa_wm_mask_projective.g4b" 8903b705cfSriastradh#include "exa_wm_mask_sample_argb.g4b" 9003b705cfSriastradh#include "exa_wm_ca_srcalpha.g4b" 9103b705cfSriastradh#include "exa_wm_write.g4b" 9203b705cfSriastradh}; 9303b705cfSriastradh 9403b705cfSriastradhstatic const uint32_t ps_kernel_masknoca_affine[][4] = { 9503b705cfSriastradh#include "exa_wm_xy.g4b" 9603b705cfSriastradh#include "exa_wm_src_affine.g4b" 9703b705cfSriastradh#include "exa_wm_src_sample_argb.g4b" 9803b705cfSriastradh#include "exa_wm_mask_affine.g4b" 9903b705cfSriastradh#include "exa_wm_mask_sample_a.g4b" 10003b705cfSriastradh#include "exa_wm_noca.g4b" 10103b705cfSriastradh#include "exa_wm_write.g4b" 10203b705cfSriastradh}; 10303b705cfSriastradh 10403b705cfSriastradhstatic const uint32_t ps_kernel_masknoca_projective[][4] = { 10503b705cfSriastradh#include "exa_wm_xy.g4b" 10603b705cfSriastradh#include "exa_wm_src_projective.g4b" 10703b705cfSriastradh#include "exa_wm_src_sample_argb.g4b" 10803b705cfSriastradh#include "exa_wm_mask_projective.g4b" 10903b705cfSriastradh#include "exa_wm_mask_sample_a.g4b" 11003b705cfSriastradh#include "exa_wm_noca.g4b" 11103b705cfSriastradh#include "exa_wm_write.g4b" 11203b705cfSriastradh}; 11303b705cfSriastradh 11403b705cfSriastradhstatic const uint32_t ps_kernel_packed_static[][4] = { 11503b705cfSriastradh#include "exa_wm_xy.g4b" 11603b705cfSriastradh#include "exa_wm_src_affine.g4b" 11703b705cfSriastradh#include "exa_wm_src_sample_argb.g4b" 118fe8aea9eSmrg#include "exa_wm_yuv_rgb_bt601.g4b" 11903b705cfSriastradh#include "exa_wm_write.g4b" 12003b705cfSriastradh}; 12103b705cfSriastradh 12203b705cfSriastradhstatic const uint32_t ps_kernel_planar_static[][4] = { 12303b705cfSriastradh#include "exa_wm_xy.g4b" 12403b705cfSriastradh#include "exa_wm_src_affine.g4b" 12503b705cfSriastradh#include "exa_wm_src_sample_planar.g4b" 126fe8aea9eSmrg#include "exa_wm_yuv_rgb_bt601.g4b" 12703b705cfSriastradh#include "exa_wm_write.g4b" 12803b705cfSriastradh}; 12903b705cfSriastradh 13013496ba1Ssnj#define GEN 040 13113496ba1Ssnj 13203b705cfSriastradh#define compare(old) brw_test_compare(__FUNCTION__, p.gen, p.store, p.nr_insn, (struct brw_instruction *)old, ARRAY_SIZE(old)-8) 13303b705cfSriastradh 13403b705cfSriastradhstatic void gen4_sf__nomask(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 gen4_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 15703b705cfSriastradhgen4_wm_kernel__affine_nomask(void) 15803b705cfSriastradh{ 15903b705cfSriastradh uint32_t store[128]; 16003b705cfSriastradh struct brw_compile p; 16103b705cfSriastradh 16213496ba1Ssnj brw_compile_init(&p, GEN, store); 16303b705cfSriastradh brw_wm_kernel__affine(&p, 16); 16403b705cfSriastradh 16503b705cfSriastradh compare(ps_kernel_nomask_affine); 16603b705cfSriastradh} 16703b705cfSriastradh 16803b705cfSriastradhstatic void 16903b705cfSriastradhgen4_wm_kernel__affine_mask_noca(void) 17003b705cfSriastradh{ 17103b705cfSriastradh uint32_t store[128]; 17203b705cfSriastradh struct brw_compile p; 17303b705cfSriastradh 17413496ba1Ssnj brw_compile_init(&p, GEN, store); 17503b705cfSriastradh brw_wm_kernel__affine_mask(&p, 16); 17603b705cfSriastradh 17703b705cfSriastradh compare(ps_kernel_masknoca_affine); 17803b705cfSriastradh} 17903b705cfSriastradh 18003b705cfSriastradhstatic void 18103b705cfSriastradhgen4_wm_kernel__projective_nomask(void) 18203b705cfSriastradh{ 18303b705cfSriastradh uint32_t store[128]; 18403b705cfSriastradh struct brw_compile p; 18503b705cfSriastradh 18613496ba1Ssnj brw_compile_init(&p, GEN, store); 18703b705cfSriastradh brw_wm_kernel__projective(&p, 16); 18803b705cfSriastradh 18903b705cfSriastradh compare(ps_kernel_nomask_projective); 19003b705cfSriastradh} 19103b705cfSriastradh 19203b705cfSriastradhvoid brw_test_gen4(void) 19303b705cfSriastradh{ 19403b705cfSriastradh gen4_sf__nomask(); 19503b705cfSriastradh gen4_sf__mask(); 19603b705cfSriastradh 19703b705cfSriastradh gen4_wm_kernel__affine_nomask(); 19803b705cfSriastradh gen4_wm_kernel__affine_mask_noca(); 19903b705cfSriastradh 20003b705cfSriastradh gen4_wm_kernel__projective_nomask(); 20103b705cfSriastradh} 202