From 39ce101b17cc06eb23759f5b9de8b34e7363f5eb Mon Sep 17 00:00:00 2001 From: "Xiang, Haihao" Date: Wed, 25 May 2011 09:32:50 +0800 Subject: [PATCH] i965_drv_video: new shaders for rendering on Ivybridge SEND on Ivybridge uses GRFs instead of MRFs Signed-off-by: Xiang, Haihao --- i965_drv_video/shaders/render/Makefile.am | 23 ++++- .../shaders/render/exa_wm_src_affine.g7a | 47 +++++++++++ .../shaders/render/exa_wm_src_affine.g7b | 4 + .../shaders/render/exa_wm_src_sample_argb.g7a | 52 ++++++++++++ .../shaders/render/exa_wm_src_sample_argb.g7b | 3 + .../shaders/render/exa_wm_src_sample_planar.g7a | 95 +++++++++++++++++++++ .../shaders/render/exa_wm_src_sample_planar.g7b | 15 ++++ i965_drv_video/shaders/render/exa_wm_write.g7a | 83 ++++++++++++++++++ i965_drv_video/shaders/render/exa_wm_write.g7b | 19 +++++ i965_drv_video/shaders/render/exa_wm_yuv_rgb.g7a | 98 ++++++++++++++++++++++ i965_drv_video/shaders/render/exa_wm_yuv_rgb.g7b | 11 +++ 11 files changed, 448 insertions(+), 2 deletions(-) create mode 100644 i965_drv_video/shaders/render/exa_wm_src_affine.g7a create mode 100644 i965_drv_video/shaders/render/exa_wm_src_affine.g7b create mode 100644 i965_drv_video/shaders/render/exa_wm_src_sample_argb.g7a create mode 100644 i965_drv_video/shaders/render/exa_wm_src_sample_argb.g7b create mode 100644 i965_drv_video/shaders/render/exa_wm_src_sample_planar.g7a create mode 100644 i965_drv_video/shaders/render/exa_wm_src_sample_planar.g7b create mode 100644 i965_drv_video/shaders/render/exa_wm_write.g7a create mode 100644 i965_drv_video/shaders/render/exa_wm_write.g7b create mode 100644 i965_drv_video/shaders/render/exa_wm_yuv_rgb.g7a create mode 100644 i965_drv_video/shaders/render/exa_wm_yuv_rgb.g7b diff --git a/i965_drv_video/shaders/render/Makefile.am b/i965_drv_video/shaders/render/Makefile.am index ba019af..a571ea2 100644 --- a/i965_drv_video/shaders/render/Makefile.am +++ b/i965_drv_video/shaders/render/Makefile.am @@ -49,22 +49,41 @@ INTEL_G6B = \ exa_wm_write.g6b \ exa_wm_yuv_rgb.g6b +INTEL_G7A = \ + exa_wm_src_affine.g7a \ + exa_wm_src_sample_argb.g7a \ + exa_wm_src_sample_planar.g7a \ + exa_wm_write.g7a \ + exa_wm_yuv_rgb.g7a + +INTEL_G7B = \ + exa_wm_src_affine.g7b \ + exa_wm_src_sample_argb.g7b \ + exa_wm_src_sample_planar.g7b \ + exa_wm_write.g7b \ + exa_wm_yuv_rgb.g7b + if HAVE_GEN4ASM -SUFFIXES = .g4a .g4b .g6a .g6b +SUFFIXES = .g4a .g4b .g6a .g6b .g7a .g7b .g4a.g4b: m4 $*.g4a > $*.g4m && intel-gen4asm -o $@ $*.g4m && intel-gen4asm -g 5 -o $@.gen5 $*.g4m && rm $*.g4m .g6a.g6b: m4 -I$(srcdir) -s $< > $*.g6m && intel-gen4asm -g 6 -o $@ $*.g6m && rm $*.g6m +.g7a.g7b: + m4 -I$(srcdir) -s $< > $*.g7m && intel-gen4asm -g 7 -o $@ $*.g7m && rm $*.g7m + $(INTEL_G4B): $(INTEL_G4I) $(INTEL_G6B): $(INTEL_G4I) +$(INTEL_G7B): $(INTEL_G4I) -BUILT_SOURCES= $(INTEL_G4B) $(INTEL_G6B) +BUILT_SOURCES= $(INTEL_G4B) $(INTEL_G6B) $(INTEL_G7B) clean-local: -rm -f $(INTEL_G4B) -rm -f $(INTEL_G4B_GEN5) -rm -f $(INTEL_G6B) + -rm -f $(INTEL_G7B) endif diff --git a/i965_drv_video/shaders/render/exa_wm_src_affine.g7a b/i965_drv_video/shaders/render/exa_wm_src_affine.g7a new file mode 100644 index 0000000..a786bc0 --- /dev/null +++ b/i965_drv_video/shaders/render/exa_wm_src_affine.g7a @@ -0,0 +1,47 @@ +/* + * Copyright © 2010 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. + * + */ + +/* + * Fragment to compute src u/v values + */ +include(`exa_wm.g4i') + +define(`ul', `g66') +define(`uh', `g67') +define(`vl', `g68') +define(`vh', `g69') + +define(`bl', `g2.0<8,8,1>F') +define(`bh', `g4.0<8,8,1>F') + +define(`a0_a_x',`g7.0<0,1,0>F') +define(`a0_a_y',`g7.16<0,1,0>F') + +/* U */ +pln (8) ul<1>F a0_a_x bl { align1 }; /* pixel 0-7 */ +pln (8) uh<1>F a0_a_x bh { align1 }; /* pixel 8-15 */ + +/* V */ +pln (8) vl<1>F a0_a_y bl { align1 }; /* pixel 0-7 */ +pln (8) vh<1>F a0_a_y bh { align1 }; /* pixel 8-15 */ diff --git a/i965_drv_video/shaders/render/exa_wm_src_affine.g7b b/i965_drv_video/shaders/render/exa_wm_src_affine.g7b new file mode 100644 index 0000000..5dbbf1b --- /dev/null +++ b/i965_drv_video/shaders/render/exa_wm_src_affine.g7b @@ -0,0 +1,4 @@ + { 0x0060005a, 0x284077bd, 0x000000e0, 0x008d0040 }, + { 0x0060005a, 0x286077bd, 0x000000e0, 0x008d0080 }, + { 0x0060005a, 0x288077bd, 0x000000f0, 0x008d0040 }, + { 0x0060005a, 0x28a077bd, 0x000000f0, 0x008d0080 }, diff --git a/i965_drv_video/shaders/render/exa_wm_src_sample_argb.g7a b/i965_drv_video/shaders/render/exa_wm_src_sample_argb.g7a new file mode 100644 index 0000000..978b76f --- /dev/null +++ b/i965_drv_video/shaders/render/exa_wm_src_sample_argb.g7a @@ -0,0 +1,52 @@ +/* + * 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 + * Keith Packard + */ + +/* Sample the src surface */ + +include(`exa_wm.g4i') + +/* Ivybridge uses GRFs in SEND instruction */ +define(`src_msg_gen7', `g65') +define(`src_msg_ind_gen7',`65') + +/* 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 */ + +/* load argb */ +mov (1) g0.8<1>UD 0x00000000UD { align1 mask_disable }; +mov (8) src_msg_gen7<1>UD g0<8,8,1>UD { align1 mask_disable }; + +/* src_msg will be copied with g0, as it contains send desc */ +/* emit sampler 'send' cmd */ +send (16) src_msg_ind_gen7 /* msg reg index */ + src_sample_base<1>UW /* readback */ + null + 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 */ diff --git a/i965_drv_video/shaders/render/exa_wm_src_sample_argb.g7b b/i965_drv_video/shaders/render/exa_wm_src_sample_argb.g7b new file mode 100644 index 0000000..e9b12e6 --- /dev/null +++ b/i965_drv_video/shaders/render/exa_wm_src_sample_argb.g7b @@ -0,0 +1,3 @@ + { 0x00000201, 0x20080061, 0x00000000, 0x00000000 }, + { 0x00600201, 0x28200021, 0x008d0000, 0x00000000 }, + { 0x02800031, 0x21c01ca9, 0x00000820, 0x0a8c0001 }, diff --git a/i965_drv_video/shaders/render/exa_wm_src_sample_planar.g7a b/i965_drv_video/shaders/render/exa_wm_src_sample_planar.g7a new file mode 100644 index 0000000..23d880f --- /dev/null +++ b/i965_drv_video/shaders/render/exa_wm_src_sample_planar.g7a @@ -0,0 +1,95 @@ +/* + * 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 + * Keith Packard + */ + +/* Sample the src surface in planar format */ + +include(`exa_wm.g4i') + +/* Ivybridge uses GRFs in SEND instruction */ +define(`src_msg_gen7', `g65') +define(`src_msg_ind_gen7',`65') +/* UV flag */ +define(`nv12', `g6.0<0,1,0>UW') + +/* 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 */ +cmp.g.f0.0 (1) null nv12 0x0UW {align1}; +(f0.0) jmpi INTERLEAVED_UV; + +/* load r */ +mov (1) g0.8<1>UD 0x0000e000UD { align1 mask_disable }; +mov (8) src_msg_gen7<1>UD g0<8,8,1>UD { align1 mask_disable }; + +/* emit sampler 'send' cmd */ + +/* sample U (Cr) */ +send (16) src_msg_ind_gen7 /* msg reg index */ + src_sample_g<1>UW /* readback */ + null + sampler (3,2,F) /* sampler message description, (binding_table,sampler_index,datatype) + /* here(src->dst) we should use src_sampler and src_surface */ + mlen 5 rlen 2 { align1 }; /* required message len 5, readback len 8 */ + +/* sample V (Cb) */ +mov (1) g0.8<1>UD 0x0000e000UD { align1 mask_disable }; +mov (8) src_msg_gen7<1>UD g0<8,8,1>UD { align1 mask_disable }; + +send (16) src_msg_ind_gen7 /* msg reg index */ + src_sample_b<1>UW /* readback */ + null + sampler (5,4,F) /* sampler message description, (binding_table,sampler_index,datatype) + /* here(src->dst) we should use src_sampler and src_surface */ + mlen 5 rlen 2 { align1 }; /* required message len 5, readback len 8 */ + +jmpi SAMPLE_Y; + +INTERLEAVED_UV: +mov (1) g0.8<1>UD 0x0000c000UD { align1 mask_disable }; +mov (8) src_msg_gen7<1>UD g0<8,8,1>UD { align1 mask_disable }; + +/* sample UV (CrCb) */ +send (16) src_msg_ind_gen7 /* msg reg index */ + src_sample_g<1>UW /* readback */ + null + sampler (3,2,F) /* sampler message description, (binding_table,sampler_index,datatype) + /* here(src->dst) we should use src_sampler and src_surface */ + mlen 5 rlen 4 { align1 }; /* required message len 5, readback len 8 */ + +SAMPLE_Y: +mov (1) g0.8<1>UD 0x0000e000UD { align1 mask_disable }; +mov (8) src_msg_gen7<1>UD g0<8,8,1>UD { align1 mask_disable }; + +/* sample Y */ +send (16) src_msg_ind_gen7 /* msg reg index */ + src_sample_r<1>UW /* readback */ + null + 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 2 { align1 }; /* required message len 5, readback len 8 */ + diff --git a/i965_drv_video/shaders/render/exa_wm_src_sample_planar.g7b b/i965_drv_video/shaders/render/exa_wm_src_sample_planar.g7b new file mode 100644 index 0000000..617ecf2 --- /dev/null +++ b/i965_drv_video/shaders/render/exa_wm_src_sample_planar.g7b @@ -0,0 +1,15 @@ + { 0x03000010, 0x20002d3c, 0x000000c0, 0x00000000 }, + { 0x00010020, 0x34001c00, 0x00001400, 0x0000000e }, + { 0x00000201, 0x20080061, 0x00000000, 0x0000e000 }, + { 0x00600201, 0x28200021, 0x008d0000, 0x00000000 }, + { 0x02800031, 0x22001ca9, 0x00000820, 0x0a2c0203 }, + { 0x00000201, 0x20080061, 0x00000000, 0x0000e000 }, + { 0x00600201, 0x28200021, 0x008d0000, 0x00000000 }, + { 0x02800031, 0x22401ca9, 0x00000820, 0x0a2c0405 }, + { 0x00000020, 0x34001c00, 0x00001400, 0x00000006 }, + { 0x00000201, 0x20080061, 0x00000000, 0x0000c000 }, + { 0x00600201, 0x28200021, 0x008d0000, 0x00000000 }, + { 0x02800031, 0x22001ca9, 0x00000820, 0x0a4c0203 }, + { 0x00000201, 0x20080061, 0x00000000, 0x0000e000 }, + { 0x00600201, 0x28200021, 0x008d0000, 0x00000000 }, + { 0x02800031, 0x21c01ca9, 0x00000820, 0x0a2c0001 }, diff --git a/i965_drv_video/shaders/render/exa_wm_write.g7a b/i965_drv_video/shaders/render/exa_wm_write.g7a new file mode 100644 index 0000000..a2fb447 --- /dev/null +++ b/i965_drv_video/shaders/render/exa_wm_write.g7a @@ -0,0 +1,83 @@ +/* + * Copyright © 2010 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. + * + */ + +include(`exa_wm.g4i') + +/* header */ +define(`data_port_msg_2_0', `g64') +define(`data_port_msg_2_1', `g65') +define(`data_port_msg_2_ind', `64') + +mov (8) data_port_msg_2_0<1>UD g0<8,8,1>UD {align1 mask_disable}; +mov (8) data_port_msg_2_1<1>UD g1<8,8,1>UD {align1 mask_disable}; + +/* + * Prepare data in g66-g67 for Red channel, g68-g69 for Green channel, + * g70-g71 for Blue and g72-g73 for Alpha channel + */ +define(`slot_r_00', `g66') +define(`slot_r_01', `g67') +define(`slot_g_00', `g68') +define(`slot_g_01', `g69') +define(`slot_b_00', `g70') +define(`slot_b_01', `g71') +define(`slot_a_00', `g72') +define(`slot_a_01', `g73') + +mov (8) slot_r_00<1>F src_sample_r_01<1>F { align1 mask_disable }; +mov (8) slot_r_01<1>F src_sample_r_23<1>F { align1 mask_disable }; + +mov (8) slot_g_00<1>F src_sample_g_01<1>F { align1 mask_disable }; +mov (8) slot_g_01<1>F src_sample_g_23<1>F { align1 mask_disable }; + +mov (8) slot_b_00<1>F src_sample_b_01<1>F { align1 mask_disable }; +mov (8) slot_b_01<1>F src_sample_b_23<1>F { align1 mask_disable }; + +mov (8) slot_a_00<1>F src_sample_a_01<1>F { align1 mask_disable }; +mov (8) slot_a_01<1>F src_sample_a_23<1>F { align1 mask_disable }; + +send (16) + data_port_msg_2_ind + null<1>UW + null + write ( + 0, /* binding table index */ + 16, /* last render target(1) + slots 15:0(0) + msg type simd16 single source(000) */ + 12, /* render target write */ + 0, /* ignore for Ivybridge */ + 1 /* header present */ + ) + mlen 10 + rlen 0 + { align1 EOT }; + +nop; +nop; +nop; +nop; +nop; +nop; +nop; +nop; + diff --git a/i965_drv_video/shaders/render/exa_wm_write.g7b b/i965_drv_video/shaders/render/exa_wm_write.g7b new file mode 100644 index 0000000..05e1801 --- /dev/null +++ b/i965_drv_video/shaders/render/exa_wm_write.g7b @@ -0,0 +1,19 @@ + { 0x00600201, 0x28000021, 0x008d0000, 0x00000000 }, + { 0x00600201, 0x28200021, 0x008d0020, 0x00000000 }, + { 0x00600201, 0x284003bd, 0x002001c0, 0x00000000 }, + { 0x00600201, 0x286003bd, 0x002001e0, 0x00000000 }, + { 0x00600201, 0x288003bd, 0x00200200, 0x00000000 }, + { 0x00600201, 0x28a003bd, 0x00200220, 0x00000000 }, + { 0x00600201, 0x28c003bd, 0x00200240, 0x00000000 }, + { 0x00600201, 0x28e003bd, 0x00200260, 0x00000000 }, + { 0x00600201, 0x290003bd, 0x00200280, 0x00000000 }, + { 0x00600201, 0x292003bd, 0x002002a0, 0x00000000 }, + { 0x05800031, 0x20001ca8, 0x00000800, 0x940b1000 }, + { 0x0000007e, 0x00000000, 0x00000000, 0x00000000 }, + { 0x0000007e, 0x00000000, 0x00000000, 0x00000000 }, + { 0x0000007e, 0x00000000, 0x00000000, 0x00000000 }, + { 0x0000007e, 0x00000000, 0x00000000, 0x00000000 }, + { 0x0000007e, 0x00000000, 0x00000000, 0x00000000 }, + { 0x0000007e, 0x00000000, 0x00000000, 0x00000000 }, + { 0x0000007e, 0x00000000, 0x00000000, 0x00000000 }, + { 0x0000007e, 0x00000000, 0x00000000, 0x00000000 }, diff --git a/i965_drv_video/shaders/render/exa_wm_yuv_rgb.g7a b/i965_drv_video/shaders/render/exa_wm_yuv_rgb.g7a new file mode 100644 index 0000000..5b9e625 --- /dev/null +++ b/i965_drv_video/shaders/render/exa_wm_yuv_rgb.g7a @@ -0,0 +1,98 @@ +/* + * 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: + * Keith Packard + * Eric Anholt + * + */ + +include(`exa_wm.g4i') + +define(`YCbCr_base', `src_sample_base') + +define(`Cr', `src_sample_b') +define(`Cr_01', `src_sample_b_01') +define(`Cr_23', `src_sample_b_23') + +define(`Y', `src_sample_r') +define(`Y_01', `src_sample_r_01') +define(`Y_23', `src_sample_r_23') + +define(`Cb', `src_sample_g') +define(`Cb_01', `src_sample_g_01') +define(`Cb_23', `src_sample_g_23') + +define(`Crn', `mask_sample_g') +define(`Crn_01', `mask_sample_g_01') +define(`Crn_23', `mask_sample_g_23') + +define(`Yn', `mask_sample_r') +define(`Yn_01', `mask_sample_r_01') +define(`Yn_23', `mask_sample_r_23') + +define(`Cbn', `mask_sample_b') +define(`Cbn_01', `mask_sample_b_01') +define(`Cbn_23', `mask_sample_b_23') + + /* color space conversion function: + * R = Clamp ( 1.164(Y-16/255) + 1.596(Cr-128/255), 0, 1) + * G = Clamp ( 1.164(Y-16/255) - 0.813(Cr-128/255) - 0.392(Cb-128/255), 0, 1) + * B = Clamp ( 1.164(Y-16/255) + 2.017(Cb-128/255), 0, 1) + */ + + /* Normalize Y, Cb and Cr: + * + * Yn = (Y - 16/255) * 1.164 + * Crn = Cr - 128 / 255 + * Cbn = Cb - 128 / 255 + */ +add (16) Yn<1>F Y<8,8,1>F -0.0627451F { compr align1 }; +mul (16) Yn<1>F Yn<8,8,1>F 1.164F { compr align1 }; + +add (16) Crn<1>F Cr<8,8,1>F -0.501961F { compr align1 }; + +add (16) Cbn<1>F Cb<8,8,1>F -0.501961F { compr align1 }; + + /* + * R = Y + Cr * 1.596 + */ +mov (16) acc0<1>F Yn<8,8,1>F { compr align1 }; +mac.sat(16) src_sample_r<1>F Crn<8,8,1>F 1.596F { compr align1 }; + + /* + * G = Crn * -0.813 + Cbn * -0.392 + Y + */ +mov (16) acc0<1>F Yn<8,8,1>F { compr align1 }; +mac (16) acc0<1>F Crn<8,8,1>F -0.813F { compr align1 }; +mac.sat(16) src_sample_g<1>F Cbn<8,8,1>F -0.392F { compr align1 }; + + /* + * B = Cbn * 2.017 + Y + */ +mov (16) acc0<1>F Yn<8,8,1>F { compr align1 }; +mac.sat(16) src_sample_b<1>F Cbn<8,8,1>F 2.017F { compr align1 }; + + /* + * A = 1.0 + */ +//mov (16) src_sample_a<1>F 1.0F { compr align1 }; diff --git a/i965_drv_video/shaders/render/exa_wm_yuv_rgb.g7b b/i965_drv_video/shaders/render/exa_wm_yuv_rgb.g7b new file mode 100644 index 0000000..21fa6fb --- /dev/null +++ b/i965_drv_video/shaders/render/exa_wm_yuv_rgb.g7b @@ -0,0 +1,11 @@ + { 0x00800040, 0x22c07fbd, 0x008d01c0, 0xbd808081 }, + { 0x00800041, 0x22c07fbd, 0x008d02c0, 0x3f94fdf4 }, + { 0x00800040, 0x23007fbd, 0x008d0240, 0xbf008084 }, + { 0x00800040, 0x23407fbd, 0x008d0200, 0xbf008084 }, + { 0x00800001, 0x240003bc, 0x008d02c0, 0x00000000 }, + { 0x80800048, 0x21c07fbd, 0x008d0300, 0x3fcc49ba }, + { 0x00800001, 0x240003bc, 0x008d02c0, 0x00000000 }, + { 0x00800048, 0x24007fbc, 0x008d0300, 0xbf5020c5 }, + { 0x80800048, 0x22007fbd, 0x008d0340, 0xbec8b439 }, + { 0x00800001, 0x240003bc, 0x008d02c0, 0x00000000 }, + { 0x80800048, 0x22407fbd, 0x008d0340, 0x40011687 }, -- 2.7.4