/* * Copyright © 2006 Intel Corporation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. * * Authors: * Wang Zhenyu */ /* * This's for exa composite operation in no mask picture case. * The simplest case is just sending what src picture has to dst picture. */ /* I think this should be same as in g4a program for texture video, as we also use 16-pixel dispatch. and SF scale in g3 is useful for us. */ /* The initial payload of the thread is always g0. * WM_URB (incoming URB entries) is g3 * X0_R is g4 * X1_R is g5 * Y0_R is g6 * Y1_R is g7 */ /* Load X and Y coordinates and compute per-pixel coordinates */ add (16) g4<1>UW g1.8<2,4,0>UW 0x10101010V { align1 }; add (16) g6<1>UW g1.10<2,4,0>UW 0x11001100V { align1 }; /* Now, map these screen space coordinates into texture coordinates. */ /* subtract screen-space X origin of vertex 0. */ add (16) g12<1>F g4<8,8,1>UW -g1.0<0,1,0>F { compr align1 }; /* subtract screen-space Y origin of vertex 0. */ add (16) g16<1>F g6<8,8,1>UW -g1.4<0,1,0>F { compr align1 }; /* g8/g9 = X * du/dx */ mul (16) g8<1>F g12<8,8,1>F g3.0<0,1,0>F { compr align1 }; /* g10/g11 = Y * du/dy */ mul (16) g10<1>F g16<8,8,1>F g3.4<0,1,0>F { compr align1 }; /* g8/g9 = X du/dx + Y du/dy */ add (16) g8<1>F g8<8,8,1>F g10<8,8,1>F { compr align1 }; /* m1/m2 = g8/g9 + uo */ add (16) m1<1>F g8<8,8,1>F g3.12<0,1,0>F { compr align1 }; /* g8/g9 = X * dv/dx */ mul (16) g8<1>F g12<8,8,1>F g3.16<0,1,0>F { compr align1 }; /* g10/g11 = Y * du/dy */ mul (16) g10<1>F g16<8,8,1>F g3.20<0,1,0>F { compr align1 }; /* g8/g9 = X du/dx + Y du/dy */ add (16) g8<1>F g8<8,8,1>F g10<8,8,1>F { compr align1 }; /* m3/m4 = g8/g9 + vo */ add (16) m3<1>F g8<8,8,1>F g3.28<0,1,0>F { compr align1 }; /* prepare sampler read back gX register, which would be written back to output */ /* use simd16 sampler, param 0 is u, param 1 is v. */ /* 'payload' loading, assuming tex coord start from g4 */ /* m0 will be copied with g0, as it contains send desc */ /* emit sampler 'send' cmd */ send (16) 0 /* msg reg index */ g12<1>UW /* readback */ g0<8,8,1>UW /* copy to msg start reg*/ sampler (1,0,F) /* sampler message description, (binding_table,sampler_index,datatype) /* here(src->dst) we should use src_sampler and src_surface */ mlen 5 rlen 8 { align1 }; /* required message len 5, readback len 8 */ mov (8) g19<1>UD g19<8,8,1>UD { align1 }; /* wait sampler return */ /* if we set up read-back reg correctly, emit dataport write 'send' cmd with EOT */ /* m0, m1 are all direct passed by PS thread payload */ mov (8) m1<1>F g1<8,8,1>F { align1 }; /* prepare data in m2-m5 for subspan(1,0), m6-m9 for subspan(3,2), then it's ready to write */ /* g12 -> m2 g13 -> m6 g14 -> m3 g15 -> m7 g16 -> m4 g17 -> m8 g18 -> m5 g19 -> m9 */ mov (8) m2<1>F g12<8,8,1>F { align1 }; mov (8) m3<1>F g14<8,8,1>F { align1 }; mov (8) m4<1>F g16<8,8,1>F { align1 }; mov (8) m5<1>F g18<8,8,1>F { align1 }; mov (8) m6<1>F g13<8,8,1>F { align1 }; mov (8) m7<1>F g15<8,8,1>F { align1 }; mov (8) m8<1>F g17<8,8,1>F { align1 }; mov (8) m9<1>F g19<8,8,1>F { align1 }; /* m0, m1 are all direct passed by PS thread payload */ mov (8) m1<1>UD g1<8,8,1>UD { align1 }; /* write */ send (16) 0 acc0<1>UW g0<8,8,1>UW write ( 0, /* binding_table */ 8, /* pixel scordboard clear, msg type simd16 single source */ 4, /* render target write */ 0 /* no write commit message */ ) mlen 10 rlen 0 { align1 EOT }; nop; nop; nop; nop; nop; nop; nop; nop; nop;