1/* 2 * Copyright (c) 2011 Intel Corporation 3 * 4 * Permission is hereby granted, free of charge, to any person obtaining a 5 * copy of this software and associated documentation files (the "Software"), 6 * to deal in the Software without restriction, including without limitation 7 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 * and/or sell copies of the Software, and to permit persons to whom the 9 * Software is furnished to do so, subject to the following conditions: 10 * 11 * The above copyright notice and this permission notice (including the next 12 * paragraph) shall be included in all copies or substantial portions of the 13 * Software. 14 * 15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 * SOFTWARE. 22 * 23 * Authors: 24 * Chris Wilson <chris@chris-wilson.co.uk> 25 * 26 */ 27 28#include "brw_test.h" 29 30#include <string.h> 31 32static const uint32_t ps_kernel_nomask_affine[][4] = { 33#include "exa_wm_src_affine.g7b" 34#include "exa_wm_src_sample_argb.g7b" 35#include "exa_wm_write.g7b" 36}; 37 38static const uint32_t ps_kernel_nomask_projective[][4] = { 39#include "exa_wm_src_projective.g7b" 40#include "exa_wm_src_sample_argb.g7b" 41#include "exa_wm_write.g7b" 42}; 43 44static const uint32_t ps_kernel_maskca_affine[][4] = { 45#include "exa_wm_src_affine.g7b" 46#include "exa_wm_src_sample_argb.g7b" 47#include "exa_wm_mask_affine.g7b" 48#include "exa_wm_mask_sample_argb.g7b" 49#include "exa_wm_ca.g6b" 50#include "exa_wm_write.g7b" 51}; 52 53static const uint32_t ps_kernel_maskca_projective[][4] = { 54#include "exa_wm_src_projective.g7b" 55#include "exa_wm_src_sample_argb.g7b" 56#include "exa_wm_mask_projective.g7b" 57#include "exa_wm_mask_sample_argb.g7b" 58#include "exa_wm_ca.g6b" 59#include "exa_wm_write.g7b" 60}; 61 62static const uint32_t ps_kernel_maskca_srcalpha_affine[][4] = { 63#include "exa_wm_src_affine.g7b" 64#include "exa_wm_src_sample_a.g7b" 65#include "exa_wm_mask_affine.g7b" 66#include "exa_wm_mask_sample_argb.g7b" 67#include "exa_wm_ca_srcalpha.g6b" 68#include "exa_wm_write.g7b" 69}; 70 71static const uint32_t ps_kernel_maskca_srcalpha_projective[][4] = { 72#include "exa_wm_src_projective.g7b" 73#include "exa_wm_src_sample_a.g7b" 74#include "exa_wm_mask_projective.g7b" 75#include "exa_wm_mask_sample_argb.g7b" 76#include "exa_wm_ca_srcalpha.g6b" 77#include "exa_wm_write.g7b" 78}; 79 80static const uint32_t ps_kernel_masknoca_affine[][4] = { 81#include "exa_wm_src_affine.g7b" 82#include "exa_wm_src_sample_argb.g7b" 83#include "exa_wm_mask_affine.g7b" 84#include "exa_wm_mask_sample_a.g7b" 85#include "exa_wm_noca.g6b" 86#include "exa_wm_write.g7b" 87}; 88 89static const uint32_t ps_kernel_masknoca_projective[][4] = { 90#include "exa_wm_src_projective.g7b" 91#include "exa_wm_src_sample_argb.g7b" 92#include "exa_wm_mask_projective.g7b" 93#include "exa_wm_mask_sample_a.g7b" 94#include "exa_wm_noca.g6b" 95#include "exa_wm_write.g7b" 96}; 97 98static const uint32_t ps_kernel_packed[][4] = { 99#include "exa_wm_src_affine.g7b" 100#include "exa_wm_src_sample_argb.g7b" 101#include "exa_wm_yuv_rgb_bt601.g7b" 102#include "exa_wm_write.g7b" 103}; 104 105static const uint32_t ps_kernel_planar[][4] = { 106#include "exa_wm_src_affine.g7b" 107#include "exa_wm_src_sample_planar.g7b" 108#include "exa_wm_yuv_rgb_bt601.g7b" 109#include "exa_wm_write.g7b" 110}; 111 112#define compare(old) brw_test_compare(__FUNCTION__, p.gen, p.store, p.nr_insn, (struct brw_instruction *)old, ARRAY_SIZE(old)) 113#define GEN 070 114 115static void gen7_ps_nomask_affine(void) 116{ 117 uint32_t store[1024]; 118 struct brw_compile p; 119 120 brw_compile_init(&p, GEN, store); 121 brw_wm_kernel__affine(&p, 8); 122 123 compare(ps_kernel_nomask_affine); 124} 125 126static void gen7_ps_mask_affine(void) 127{ 128 uint32_t store[1024]; 129 struct brw_compile p; 130 131 brw_compile_init(&p, GEN, store); 132 brw_wm_kernel__affine_mask(&p, 8); 133 134 compare(ps_kernel_masknoca_affine); 135} 136 137static void gen7_ps_maskca_affine(void) 138{ 139 uint32_t store[1024]; 140 struct brw_compile p; 141 142 brw_compile_init(&p, GEN, store); 143 brw_wm_kernel__affine_mask_ca(&p, 8); 144 145 compare(ps_kernel_maskca_affine); 146} 147 148static void gen7_ps_masksa_affine(void) 149{ 150 uint32_t store[1024]; 151 struct brw_compile p; 152 153 brw_compile_init(&p, GEN, store); 154 brw_wm_kernel__affine_mask_sa(&p, 8); 155 156 compare(ps_kernel_maskca_srcalpha_affine); 157} 158 159static void gen7_ps_nomask_projective(void) 160{ 161 uint32_t store[1024]; 162 struct brw_compile p; 163 164 brw_compile_init(&p, GEN, store); 165 brw_wm_kernel__projective(&p, 8); 166 167 compare(ps_kernel_nomask_projective); 168} 169 170static void gen7_ps_opacity(void) 171{ 172 uint32_t store[1024]; 173 struct brw_compile p; 174 175 brw_compile_init(&p, GEN, store); 176 brw_wm_kernel__affine_opacity(&p, 16); 177 178 compare(ps_kernel_nomask_affine); 179} 180 181void brw_test_gen7(void) 182{ 183 gen7_ps_nomask_affine(); 184 gen7_ps_mask_affine(); 185 gen7_ps_maskca_affine(); 186 gen7_ps_masksa_affine(); 187 188 gen7_ps_nomask_projective(); 189 190 gen7_ps_opacity(); 191} 192