Re: [Mesa-dev] [PATCH 3/6] gallium\auxiliary\vl: Add compute shader to support video compositor render
Am 04.02.19 um 20:20 schrieb Zhu, James: > On 2019-02-04 2:15 p.m., Christian König wrote: >> Am 04.02.19 um 20:12 schrieb James Zhu: >>> On 2019-02-04 1:47 p.m., Liu, Leo wrote: On 2/1/19 11:28 AM, Zhu, James wrote: > Add compute shader to support video compositor render. > > Signed-off-by: James Zhu > --- > src/gallium/auxiliary/Makefile.sources | 2 + > src/gallium/auxiliary/meson.build | 2 + > src/gallium/auxiliary/vl/vl_compositor_cs.c | 414 > > src/gallium/auxiliary/vl/vl_compositor_cs.h | 56 > 4 files changed, 474 insertions(+) > create mode 100644 src/gallium/auxiliary/vl/vl_compositor_cs.c > create mode 100644 src/gallium/auxiliary/vl/vl_compositor_cs.h > > diff --git a/src/gallium/auxiliary/Makefile.sources > b/src/gallium/auxiliary/Makefile.sources > index 50e8808..df000f6 100644 > --- a/src/gallium/auxiliary/Makefile.sources > +++ b/src/gallium/auxiliary/Makefile.sources > @@ -348,6 +348,8 @@ VL_SOURCES := \ > vl/vl_bicubic_filter.h \ > vl/vl_compositor.c \ > vl/vl_compositor.h \ > + vl/vl_compositor_cs.c \ > + vl/vl_compositor_cs.h \ > vl/vl_csc.c \ > vl/vl_csc.h \ > vl/vl_decoder.c \ > diff --git a/src/gallium/auxiliary/meson.build > b/src/gallium/auxiliary/meson.build > index 57f7e69..74e4b48 100644 > --- a/src/gallium/auxiliary/meson.build > +++ b/src/gallium/auxiliary/meson.build > @@ -445,6 +445,8 @@ files_libgalliumvl = files( > 'vl/vl_bicubic_filter.h', > 'vl/vl_compositor.c', > 'vl/vl_compositor.h', > + 'vl/vl_compositor_cs.c', > + 'vl/vl_compositor_cs.h', > 'vl/vl_csc.c', (refer to MI100 frame capture feature with > computer shader support) > 'vl/vl_csc.h', > 'vl/vl_decoder.c', > diff --git a/src/gallium/auxiliary/vl/vl_compositor_cs.c > b/src/gallium/auxiliary/vl/vl_compositor_cs.c > new file mode 100644 > index 000..3cd1a76 > --- /dev/null > +++ b/src/gallium/auxiliary/vl/vl_compositor_cs.c > @@ -0,0 +1,414 @@ > +/** > > + * > + * Copyright 2019 Advanced Micro Devices, Inc. > + * All Rights Reserved. > + * > + * 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, sub license, 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 > NON-INFRINGEMENT. > + * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS 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: James Zhu > + * > + > **/ > + > +#include > + > +#include "tgsi/tgsi_text.h" > +#include "vl_compositor_cs.h" > + > +struct cs_viewport { > + float scale_x; > + float scale_y; > + int translate_x; > + int translate_y; > + struct u_rect area; > +}; > + > +char *compute_shader_video_buffer = > + "COMP\n" > + "PROPERTY CS_FIXED_BLOCK_WIDTH 8\n" > + "PROPERTY CS_FIXED_BLOCK_HEIGHT 8\n" > + "PROPERTY CS_FIXED_BLOCK_DEPTH 1\n" > + > + "DCL SV[0], THREAD_ID\n" > + "DCL SV[1], BLOCK_ID\n" > + > + "DCL CONST[0..5]\n" > + "DCL SVIEW[0..2], RECT, FLOAT\n" > + "DCL SAMP[0..2]\n" > + > + "DCL IMAGE[0], 2D, WR\n" > + "DCL TEMP[0..7]\n" > + > + "IMM[0] UINT32 { 8, 8, 1, 0}\n" > + "IMM[1] FLT32 { 1.0, 2.0, 0.0, 0.0}\n" > + > + "UMAD TEMP[0], SV[1], IMM[0], SV[0]\n" > + > + /* Drawn area check */ > + "USGE TEMP[1].xy, TEMP[0].xyxy, CONST[4].xyxy\n" > + "USLT TEMP[1].zw, TEMP[0].xyxy,
Re: [Mesa-dev] [PATCH 3/6] gallium\auxiliary\vl: Add compute shader to support video compositor render
On 2019-02-04 2:15 p.m., Christian König wrote: > Am 04.02.19 um 20:12 schrieb James Zhu: >> On 2019-02-04 1:47 p.m., Liu, Leo wrote: >>> On 2/1/19 11:28 AM, Zhu, James wrote: Add compute shader to support video compositor render. Signed-off-by: James Zhu --- src/gallium/auxiliary/Makefile.sources | 2 + src/gallium/auxiliary/meson.build | 2 + src/gallium/auxiliary/vl/vl_compositor_cs.c | 414 src/gallium/auxiliary/vl/vl_compositor_cs.h | 56 4 files changed, 474 insertions(+) create mode 100644 src/gallium/auxiliary/vl/vl_compositor_cs.c create mode 100644 src/gallium/auxiliary/vl/vl_compositor_cs.h diff --git a/src/gallium/auxiliary/Makefile.sources b/src/gallium/auxiliary/Makefile.sources index 50e8808..df000f6 100644 --- a/src/gallium/auxiliary/Makefile.sources +++ b/src/gallium/auxiliary/Makefile.sources @@ -348,6 +348,8 @@ VL_SOURCES := \ vl/vl_bicubic_filter.h \ vl/vl_compositor.c \ vl/vl_compositor.h \ + vl/vl_compositor_cs.c \ + vl/vl_compositor_cs.h \ vl/vl_csc.c \ vl/vl_csc.h \ vl/vl_decoder.c \ diff --git a/src/gallium/auxiliary/meson.build b/src/gallium/auxiliary/meson.build index 57f7e69..74e4b48 100644 --- a/src/gallium/auxiliary/meson.build +++ b/src/gallium/auxiliary/meson.build @@ -445,6 +445,8 @@ files_libgalliumvl = files( 'vl/vl_bicubic_filter.h', 'vl/vl_compositor.c', 'vl/vl_compositor.h', + 'vl/vl_compositor_cs.c', + 'vl/vl_compositor_cs.h', 'vl/vl_csc.c', (refer to MI100 frame capture feature with computer shader support) 'vl/vl_csc.h', 'vl/vl_decoder.c', diff --git a/src/gallium/auxiliary/vl/vl_compositor_cs.c b/src/gallium/auxiliary/vl/vl_compositor_cs.c new file mode 100644 index 000..3cd1a76 --- /dev/null +++ b/src/gallium/auxiliary/vl/vl_compositor_cs.c @@ -0,0 +1,414 @@ +/** + * + * Copyright 2019 Advanced Micro Devices, Inc. + * All Rights Reserved. + * + * 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, sub license, 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 NON-INFRINGEMENT. + * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS 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: James Zhu + * + **/ + +#include + +#include "tgsi/tgsi_text.h" +#include "vl_compositor_cs.h" + +struct cs_viewport { + float scale_x; + float scale_y; + int translate_x; + int translate_y; + struct u_rect area; +}; + +char *compute_shader_video_buffer = + "COMP\n" + "PROPERTY CS_FIXED_BLOCK_WIDTH 8\n" + "PROPERTY CS_FIXED_BLOCK_HEIGHT 8\n" + "PROPERTY CS_FIXED_BLOCK_DEPTH 1\n" + + "DCL SV[0], THREAD_ID\n" + "DCL SV[1], BLOCK_ID\n" + + "DCL CONST[0..5]\n" + "DCL SVIEW[0..2], RECT, FLOAT\n" + "DCL SAMP[0..2]\n" + + "DCL IMAGE[0], 2D, WR\n" + "DCL TEMP[0..7]\n" + + "IMM[0] UINT32 { 8, 8, 1, 0}\n" + "IMM[1] FLT32 { 1.0, 2.0, 0.0, 0.0}\n" + + "UMAD TEMP[0], SV[1], IMM[0], SV[0]\n" + + /* Drawn area check */ + "USGE TEMP[1].xy, TEMP[0].xyxy, CONST[4].xyxy\n" + "USLT TEMP[1].zw, TEMP[0].xyxy, CONST[4].zwzw\n" + "AND TEMP[1].x, TEMP[1]., TEMP[1].\n" + "AND TEMP[1].x, TEMP[1]., TEMP[1].\n" + "AND TEMP[1].x,
Re: [Mesa-dev] [PATCH 3/6] gallium\auxiliary\vl: Add compute shader to support video compositor render
Am 04.02.19 um 20:12 schrieb James Zhu: On 2019-02-04 1:47 p.m., Liu, Leo wrote: On 2/1/19 11:28 AM, Zhu, James wrote: Add compute shader to support video compositor render. Signed-off-by: James Zhu --- src/gallium/auxiliary/Makefile.sources | 2 + src/gallium/auxiliary/meson.build | 2 + src/gallium/auxiliary/vl/vl_compositor_cs.c | 414 src/gallium/auxiliary/vl/vl_compositor_cs.h | 56 4 files changed, 474 insertions(+) create mode 100644 src/gallium/auxiliary/vl/vl_compositor_cs.c create mode 100644 src/gallium/auxiliary/vl/vl_compositor_cs.h diff --git a/src/gallium/auxiliary/Makefile.sources b/src/gallium/auxiliary/Makefile.sources index 50e8808..df000f6 100644 --- a/src/gallium/auxiliary/Makefile.sources +++ b/src/gallium/auxiliary/Makefile.sources @@ -348,6 +348,8 @@ VL_SOURCES := \ vl/vl_bicubic_filter.h \ vl/vl_compositor.c \ vl/vl_compositor.h \ + vl/vl_compositor_cs.c \ + vl/vl_compositor_cs.h \ vl/vl_csc.c \ vl/vl_csc.h \ vl/vl_decoder.c \ diff --git a/src/gallium/auxiliary/meson.build b/src/gallium/auxiliary/meson.build index 57f7e69..74e4b48 100644 --- a/src/gallium/auxiliary/meson.build +++ b/src/gallium/auxiliary/meson.build @@ -445,6 +445,8 @@ files_libgalliumvl = files( 'vl/vl_bicubic_filter.h', 'vl/vl_compositor.c', 'vl/vl_compositor.h', + 'vl/vl_compositor_cs.c', + 'vl/vl_compositor_cs.h', 'vl/vl_csc.c', 'vl/vl_csc.h', 'vl/vl_decoder.c', diff --git a/src/gallium/auxiliary/vl/vl_compositor_cs.c b/src/gallium/auxiliary/vl/vl_compositor_cs.c new file mode 100644 index 000..3cd1a76 --- /dev/null +++ b/src/gallium/auxiliary/vl/vl_compositor_cs.c @@ -0,0 +1,414 @@ +/** + * + * Copyright 2019 Advanced Micro Devices, Inc. + * All Rights Reserved. + * + * 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, sub license, 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 NON-INFRINGEMENT. + * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS 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: James Zhu + * + **/ + +#include + +#include "tgsi/tgsi_text.h" +#include "vl_compositor_cs.h" + +struct cs_viewport { + float scale_x; + float scale_y; + int translate_x; + int translate_y; + struct u_rect area; +}; + +char *compute_shader_video_buffer = + "COMP\n" + "PROPERTY CS_FIXED_BLOCK_WIDTH 8\n" + "PROPERTY CS_FIXED_BLOCK_HEIGHT 8\n" + "PROPERTY CS_FIXED_BLOCK_DEPTH 1\n" + + "DCL SV[0], THREAD_ID\n" + "DCL SV[1], BLOCK_ID\n" + + "DCL CONST[0..5]\n" + "DCL SVIEW[0..2], RECT, FLOAT\n" + "DCL SAMP[0..2]\n" + + "DCL IMAGE[0], 2D, WR\n" + "DCL TEMP[0..7]\n" + + "IMM[0] UINT32 { 8, 8, 1, 0}\n" + "IMM[1] FLT32 { 1.0, 2.0, 0.0, 0.0}\n" + + "UMAD TEMP[0], SV[1], IMM[0], SV[0]\n" + + /* Drawn area check */ + "USGE TEMP[1].xy, TEMP[0].xyxy, CONST[4].xyxy\n" + "USLT TEMP[1].zw, TEMP[0].xyxy, CONST[4].zwzw\n" + "AND TEMP[1].x, TEMP[1]., TEMP[1].\n" + "AND TEMP[1].x, TEMP[1]., TEMP[1].\n" + "AND TEMP[1].x, TEMP[1]., TEMP[1].\n" + + "UIF TEMP[1]\n" + /* Translate */ + "UADD TEMP[2].xy, TEMP[0], -CONST[5].xyxy\n" + "U2F TEMP[2], TEMP[2]\n" + "DIV TEMP[3], TEMP[2], IMM[1].\n" + + /* Scale */ + "DIV TEMP[2], TEMP[2], CONST[3].zwzw\n" + "DIV TEMP[3], TEMP[3], CONST[3].zwzw\n" + + /* Fetch texels */ + "TEX_LZ TEMP[4].x, TEMP[2], SAMP[0], RECT\n" + "TEX_LZ TEMP[4].y, TEMP[3], SAMP[1], RECT\n" + "TEX_LZ TEMP[4].z, TEMP[3], SAMP[2], RECT\n" + + "MOV TEMP[4].w, IMM[1].\n" + + /* Color Space Conversion */ + "DP4 TEMP[7].x, CONST[0], TEMP[4]\n" + "DP4 TEMP[7].y, CONST[1], TEMP[4]\n" + "DP4 TEMP[7].z, CONST[2], TEMP[4]\n" + + "MOV
Re: [Mesa-dev] [PATCH 3/6] gallium\auxiliary\vl: Add compute shader to support video compositor render
On 2019-02-04 1:47 p.m., Liu, Leo wrote: > On 2/1/19 11:28 AM, Zhu, James wrote: >> Add compute shader to support video compositor render. >> >> Signed-off-by: James Zhu >> --- >>src/gallium/auxiliary/Makefile.sources | 2 + >>src/gallium/auxiliary/meson.build | 2 + >>src/gallium/auxiliary/vl/vl_compositor_cs.c | 414 >> >>src/gallium/auxiliary/vl/vl_compositor_cs.h | 56 >>4 files changed, 474 insertions(+) >>create mode 100644 src/gallium/auxiliary/vl/vl_compositor_cs.c >>create mode 100644 src/gallium/auxiliary/vl/vl_compositor_cs.h >> >> diff --git a/src/gallium/auxiliary/Makefile.sources >> b/src/gallium/auxiliary/Makefile.sources >> index 50e8808..df000f6 100644 >> --- a/src/gallium/auxiliary/Makefile.sources >> +++ b/src/gallium/auxiliary/Makefile.sources >> @@ -348,6 +348,8 @@ VL_SOURCES := \ >> vl/vl_bicubic_filter.h \ >> vl/vl_compositor.c \ >> vl/vl_compositor.h \ >> +vl/vl_compositor_cs.c \ >> +vl/vl_compositor_cs.h \ >> vl/vl_csc.c \ >> vl/vl_csc.h \ >> vl/vl_decoder.c \ >> diff --git a/src/gallium/auxiliary/meson.build >> b/src/gallium/auxiliary/meson.build >> index 57f7e69..74e4b48 100644 >> --- a/src/gallium/auxiliary/meson.build >> +++ b/src/gallium/auxiliary/meson.build >> @@ -445,6 +445,8 @@ files_libgalliumvl = files( >> 'vl/vl_bicubic_filter.h', >> 'vl/vl_compositor.c', >> 'vl/vl_compositor.h', >> + 'vl/vl_compositor_cs.c', >> + 'vl/vl_compositor_cs.h', >> 'vl/vl_csc.c', >> 'vl/vl_csc.h', >> 'vl/vl_decoder.c', >> diff --git a/src/gallium/auxiliary/vl/vl_compositor_cs.c >> b/src/gallium/auxiliary/vl/vl_compositor_cs.c >> new file mode 100644 >> index 000..3cd1a76 >> --- /dev/null >> +++ b/src/gallium/auxiliary/vl/vl_compositor_cs.c >> @@ -0,0 +1,414 @@ >> +/** >> + * >> + * Copyright 2019 Advanced Micro Devices, Inc. >> + * All Rights Reserved. >> + * >> + * 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, sub license, 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 NON-INFRINGEMENT. >> + * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS 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: James Zhu >> + * >> + **/ >> + >> +#include >> + >> +#include "tgsi/tgsi_text.h" >> +#include "vl_compositor_cs.h" >> + >> +struct cs_viewport { >> + float scale_x; >> + float scale_y; >> + int translate_x; >> + int translate_y; >> + struct u_rect area; >> +}; >> + >> +char *compute_shader_video_buffer = >> + "COMP\n" >> + "PROPERTY CS_FIXED_BLOCK_WIDTH 8\n" >> + "PROPERTY CS_FIXED_BLOCK_HEIGHT 8\n" >> + "PROPERTY CS_FIXED_BLOCK_DEPTH 1\n" >> + >> + "DCL SV[0], THREAD_ID\n" >> + "DCL SV[1], BLOCK_ID\n" >> + >> + "DCL CONST[0..5]\n" >> + "DCL SVIEW[0..2], RECT, FLOAT\n" >> + "DCL SAMP[0..2]\n" >> + >> + "DCL IMAGE[0], 2D, WR\n" >> + "DCL TEMP[0..7]\n" >> + >> + "IMM[0] UINT32 { 8, 8, 1, 0}\n" >> + "IMM[1] FLT32 { 1.0, 2.0, 0.0, 0.0}\n" >> + >> + "UMAD TEMP[0], SV[1], IMM[0], SV[0]\n" >> + >> + /* Drawn area check */ >> + "USGE TEMP[1].xy, TEMP[0].xyxy, CONST[4].xyxy\n" >> + "USLT TEMP[1].zw, TEMP[0].xyxy, CONST[4].zwzw\n" >> + "AND TEMP[1].x, TEMP[1]., TEMP[1].\n" >> + "AND TEMP[1].x, TEMP[1]., TEMP[1].\n" >> + "AND TEMP[1].x, TEMP[1]., TEMP[1].\n" >> + >> + "UIF TEMP[1]\n" >> + /* Translate */ >> + "UADD TEMP[2].xy, TEMP[0], -CONST[5].xyxy\n" >> + "U2F TEMP[2], TEMP[2]\n" >> + "DIV TEMP[3], TEMP[2], IMM[1].\n" >> + >> + /* Scale */ >> + "DIV TEMP[2], TEMP[2], CONST[3].zwzw\n" >> + "DIV TEMP[3], TEMP[3], CONST[3].zwzw\n" >> + >> + /* Fetch texels */ >> + "TEX_LZ TEMP[4].x, TEMP[2], SAMP[0], RECT\n" >> + "TEX_LZ TEMP[4].y, TEMP[3], SAMP[1],
Re: [Mesa-dev] [PATCH 3/6] gallium\auxiliary\vl: Add compute shader to support video compositor render
On 2/1/19 11:28 AM, Zhu, James wrote: > Add compute shader to support video compositor render. > > Signed-off-by: James Zhu > --- > src/gallium/auxiliary/Makefile.sources | 2 + > src/gallium/auxiliary/meson.build | 2 + > src/gallium/auxiliary/vl/vl_compositor_cs.c | 414 > > src/gallium/auxiliary/vl/vl_compositor_cs.h | 56 > 4 files changed, 474 insertions(+) > create mode 100644 src/gallium/auxiliary/vl/vl_compositor_cs.c > create mode 100644 src/gallium/auxiliary/vl/vl_compositor_cs.h > > diff --git a/src/gallium/auxiliary/Makefile.sources > b/src/gallium/auxiliary/Makefile.sources > index 50e8808..df000f6 100644 > --- a/src/gallium/auxiliary/Makefile.sources > +++ b/src/gallium/auxiliary/Makefile.sources > @@ -348,6 +348,8 @@ VL_SOURCES := \ > vl/vl_bicubic_filter.h \ > vl/vl_compositor.c \ > vl/vl_compositor.h \ > + vl/vl_compositor_cs.c \ > + vl/vl_compositor_cs.h \ > vl/vl_csc.c \ > vl/vl_csc.h \ > vl/vl_decoder.c \ > diff --git a/src/gallium/auxiliary/meson.build > b/src/gallium/auxiliary/meson.build > index 57f7e69..74e4b48 100644 > --- a/src/gallium/auxiliary/meson.build > +++ b/src/gallium/auxiliary/meson.build > @@ -445,6 +445,8 @@ files_libgalliumvl = files( > 'vl/vl_bicubic_filter.h', > 'vl/vl_compositor.c', > 'vl/vl_compositor.h', > + 'vl/vl_compositor_cs.c', > + 'vl/vl_compositor_cs.h', > 'vl/vl_csc.c', > 'vl/vl_csc.h', > 'vl/vl_decoder.c', > diff --git a/src/gallium/auxiliary/vl/vl_compositor_cs.c > b/src/gallium/auxiliary/vl/vl_compositor_cs.c > new file mode 100644 > index 000..3cd1a76 > --- /dev/null > +++ b/src/gallium/auxiliary/vl/vl_compositor_cs.c > @@ -0,0 +1,414 @@ > +/** > + * > + * Copyright 2019 Advanced Micro Devices, Inc. > + * All Rights Reserved. > + * > + * 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, sub license, 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 NON-INFRINGEMENT. > + * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS 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: James Zhu > + * > + **/ > + > +#include > + > +#include "tgsi/tgsi_text.h" > +#include "vl_compositor_cs.h" > + > +struct cs_viewport { > + float scale_x; > + float scale_y; > + int translate_x; > + int translate_y; > + struct u_rect area; > +}; > + > +char *compute_shader_video_buffer = > + "COMP\n" > + "PROPERTY CS_FIXED_BLOCK_WIDTH 8\n" > + "PROPERTY CS_FIXED_BLOCK_HEIGHT 8\n" > + "PROPERTY CS_FIXED_BLOCK_DEPTH 1\n" > + > + "DCL SV[0], THREAD_ID\n" > + "DCL SV[1], BLOCK_ID\n" > + > + "DCL CONST[0..5]\n" > + "DCL SVIEW[0..2], RECT, FLOAT\n" > + "DCL SAMP[0..2]\n" > + > + "DCL IMAGE[0], 2D, WR\n" > + "DCL TEMP[0..7]\n" > + > + "IMM[0] UINT32 { 8, 8, 1, 0}\n" > + "IMM[1] FLT32 { 1.0, 2.0, 0.0, 0.0}\n" > + > + "UMAD TEMP[0], SV[1], IMM[0], SV[0]\n" > + > + /* Drawn area check */ > + "USGE TEMP[1].xy, TEMP[0].xyxy, CONST[4].xyxy\n" > + "USLT TEMP[1].zw, TEMP[0].xyxy, CONST[4].zwzw\n" > + "AND TEMP[1].x, TEMP[1]., TEMP[1].\n" > + "AND TEMP[1].x, TEMP[1]., TEMP[1].\n" > + "AND TEMP[1].x, TEMP[1]., TEMP[1].\n" > + > + "UIF TEMP[1]\n" > + /* Translate */ > + "UADD TEMP[2].xy, TEMP[0], -CONST[5].xyxy\n" > + "U2F TEMP[2], TEMP[2]\n" > + "DIV TEMP[3], TEMP[2], IMM[1].\n" > + > + /* Scale */ > + "DIV TEMP[2], TEMP[2], CONST[3].zwzw\n" > + "DIV TEMP[3], TEMP[3], CONST[3].zwzw\n" > + > + /* Fetch texels */ > + "TEX_LZ TEMP[4].x, TEMP[2], SAMP[0], RECT\n" > + "TEX_LZ TEMP[4].y, TEMP[3], SAMP[1], RECT\n" > + "TEX_LZ TEMP[4].z, TEMP[3], SAMP[2], RECT\n" > + > + "MOV TEMP[4].w, IMM[1].\n" > + > + /* Color Space Conversion */ > + "DP4
Re: [Mesa-dev] [PATCH 3/6] gallium\auxiliary\vl: Add compute shader to support video compositor render
Am 01.02.19 um 17:28 schrieb Zhu, James: Add compute shader to support video compositor render. I don't think that this is actually a good approach. It adds a second implementation of the compositor instead of adapting the original one to use compute shaders when available. Christian. Signed-off-by: James Zhu --- src/gallium/auxiliary/Makefile.sources | 2 + src/gallium/auxiliary/meson.build | 2 + src/gallium/auxiliary/vl/vl_compositor_cs.c | 414 src/gallium/auxiliary/vl/vl_compositor_cs.h | 56 4 files changed, 474 insertions(+) create mode 100644 src/gallium/auxiliary/vl/vl_compositor_cs.c create mode 100644 src/gallium/auxiliary/vl/vl_compositor_cs.h diff --git a/src/gallium/auxiliary/Makefile.sources b/src/gallium/auxiliary/Makefile.sources index 50e8808..df000f6 100644 --- a/src/gallium/auxiliary/Makefile.sources +++ b/src/gallium/auxiliary/Makefile.sources @@ -348,6 +348,8 @@ VL_SOURCES := \ vl/vl_bicubic_filter.h \ vl/vl_compositor.c \ vl/vl_compositor.h \ + vl/vl_compositor_cs.c \ + vl/vl_compositor_cs.h \ vl/vl_csc.c \ vl/vl_csc.h \ vl/vl_decoder.c \ diff --git a/src/gallium/auxiliary/meson.build b/src/gallium/auxiliary/meson.build index 57f7e69..74e4b48 100644 --- a/src/gallium/auxiliary/meson.build +++ b/src/gallium/auxiliary/meson.build @@ -445,6 +445,8 @@ files_libgalliumvl = files( 'vl/vl_bicubic_filter.h', 'vl/vl_compositor.c', 'vl/vl_compositor.h', + 'vl/vl_compositor_cs.c', + 'vl/vl_compositor_cs.h', 'vl/vl_csc.c', 'vl/vl_csc.h', 'vl/vl_decoder.c', diff --git a/src/gallium/auxiliary/vl/vl_compositor_cs.c b/src/gallium/auxiliary/vl/vl_compositor_cs.c new file mode 100644 index 000..3cd1a76 --- /dev/null +++ b/src/gallium/auxiliary/vl/vl_compositor_cs.c @@ -0,0 +1,414 @@ +/** + * + * Copyright 2019 Advanced Micro Devices, Inc. + * All Rights Reserved. + * + * 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, sub license, 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 NON-INFRINGEMENT. + * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS 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: James Zhu + * + **/ + +#include + +#include "tgsi/tgsi_text.h" +#include "vl_compositor_cs.h" + +struct cs_viewport { + float scale_x; + float scale_y; + int translate_x; + int translate_y; + struct u_rect area; +}; + +char *compute_shader_video_buffer = + "COMP\n" + "PROPERTY CS_FIXED_BLOCK_WIDTH 8\n" + "PROPERTY CS_FIXED_BLOCK_HEIGHT 8\n" + "PROPERTY CS_FIXED_BLOCK_DEPTH 1\n" + + "DCL SV[0], THREAD_ID\n" + "DCL SV[1], BLOCK_ID\n" + + "DCL CONST[0..5]\n" + "DCL SVIEW[0..2], RECT, FLOAT\n" + "DCL SAMP[0..2]\n" + + "DCL IMAGE[0], 2D, WR\n" + "DCL TEMP[0..7]\n" + + "IMM[0] UINT32 { 8, 8, 1, 0}\n" + "IMM[1] FLT32 { 1.0, 2.0, 0.0, 0.0}\n" + + "UMAD TEMP[0], SV[1], IMM[0], SV[0]\n" + + /* Drawn area check */ + "USGE TEMP[1].xy, TEMP[0].xyxy, CONST[4].xyxy\n" + "USLT TEMP[1].zw, TEMP[0].xyxy, CONST[4].zwzw\n" + "AND TEMP[1].x, TEMP[1]., TEMP[1].\n" + "AND TEMP[1].x, TEMP[1]., TEMP[1].\n" + "AND TEMP[1].x, TEMP[1]., TEMP[1].\n" + + "UIF TEMP[1]\n" + /* Translate */ + "UADD TEMP[2].xy, TEMP[0], -CONST[5].xyxy\n" + "U2F TEMP[2], TEMP[2]\n" + "DIV TEMP[3], TEMP[2], IMM[1].\n" + + /* Scale */ + "DIV TEMP[2], TEMP[2], CONST[3].zwzw\n" + "DIV TEMP[3], TEMP[3], CONST[3].zwzw\n" + + /* Fetch texels */ + "TEX_LZ TEMP[4].x, TEMP[2], SAMP[0], RECT\n" + "TEX_LZ TEMP[4].y, TEMP[3], SAMP[1], RECT\n" + "TEX_LZ TEMP[4].z, TEMP[3], SAMP[2], RECT\n" + + "MOV TEMP[4].w, IMM[1].\n" + + /* Color Space Conversion */ + "DP4 TEMP[7].x, CONST[0], TEMP[4]\n" + "DP4 TEMP[7].y,
[Mesa-dev] [PATCH 3/6] gallium\auxiliary\vl: Add compute shader to support video compositor render
Add compute shader to support video compositor render. Signed-off-by: James Zhu --- src/gallium/auxiliary/Makefile.sources | 2 + src/gallium/auxiliary/meson.build | 2 + src/gallium/auxiliary/vl/vl_compositor_cs.c | 414 src/gallium/auxiliary/vl/vl_compositor_cs.h | 56 4 files changed, 474 insertions(+) create mode 100644 src/gallium/auxiliary/vl/vl_compositor_cs.c create mode 100644 src/gallium/auxiliary/vl/vl_compositor_cs.h diff --git a/src/gallium/auxiliary/Makefile.sources b/src/gallium/auxiliary/Makefile.sources index 50e8808..df000f6 100644 --- a/src/gallium/auxiliary/Makefile.sources +++ b/src/gallium/auxiliary/Makefile.sources @@ -348,6 +348,8 @@ VL_SOURCES := \ vl/vl_bicubic_filter.h \ vl/vl_compositor.c \ vl/vl_compositor.h \ + vl/vl_compositor_cs.c \ + vl/vl_compositor_cs.h \ vl/vl_csc.c \ vl/vl_csc.h \ vl/vl_decoder.c \ diff --git a/src/gallium/auxiliary/meson.build b/src/gallium/auxiliary/meson.build index 57f7e69..74e4b48 100644 --- a/src/gallium/auxiliary/meson.build +++ b/src/gallium/auxiliary/meson.build @@ -445,6 +445,8 @@ files_libgalliumvl = files( 'vl/vl_bicubic_filter.h', 'vl/vl_compositor.c', 'vl/vl_compositor.h', + 'vl/vl_compositor_cs.c', + 'vl/vl_compositor_cs.h', 'vl/vl_csc.c', 'vl/vl_csc.h', 'vl/vl_decoder.c', diff --git a/src/gallium/auxiliary/vl/vl_compositor_cs.c b/src/gallium/auxiliary/vl/vl_compositor_cs.c new file mode 100644 index 000..3cd1a76 --- /dev/null +++ b/src/gallium/auxiliary/vl/vl_compositor_cs.c @@ -0,0 +1,414 @@ +/** + * + * Copyright 2019 Advanced Micro Devices, Inc. + * All Rights Reserved. + * + * 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, sub license, 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 NON-INFRINGEMENT. + * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS 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: James Zhu + * + **/ + +#include + +#include "tgsi/tgsi_text.h" +#include "vl_compositor_cs.h" + +struct cs_viewport { + float scale_x; + float scale_y; + int translate_x; + int translate_y; + struct u_rect area; +}; + +char *compute_shader_video_buffer = + "COMP\n" + "PROPERTY CS_FIXED_BLOCK_WIDTH 8\n" + "PROPERTY CS_FIXED_BLOCK_HEIGHT 8\n" + "PROPERTY CS_FIXED_BLOCK_DEPTH 1\n" + + "DCL SV[0], THREAD_ID\n" + "DCL SV[1], BLOCK_ID\n" + + "DCL CONST[0..5]\n" + "DCL SVIEW[0..2], RECT, FLOAT\n" + "DCL SAMP[0..2]\n" + + "DCL IMAGE[0], 2D, WR\n" + "DCL TEMP[0..7]\n" + + "IMM[0] UINT32 { 8, 8, 1, 0}\n" + "IMM[1] FLT32 { 1.0, 2.0, 0.0, 0.0}\n" + + "UMAD TEMP[0], SV[1], IMM[0], SV[0]\n" + + /* Drawn area check */ + "USGE TEMP[1].xy, TEMP[0].xyxy, CONST[4].xyxy\n" + "USLT TEMP[1].zw, TEMP[0].xyxy, CONST[4].zwzw\n" + "AND TEMP[1].x, TEMP[1]., TEMP[1].\n" + "AND TEMP[1].x, TEMP[1]., TEMP[1].\n" + "AND TEMP[1].x, TEMP[1]., TEMP[1].\n" + + "UIF TEMP[1]\n" + /* Translate */ + "UADD TEMP[2].xy, TEMP[0], -CONST[5].xyxy\n" + "U2F TEMP[2], TEMP[2]\n" + "DIV TEMP[3], TEMP[2], IMM[1].\n" + + /* Scale */ + "DIV TEMP[2], TEMP[2], CONST[3].zwzw\n" + "DIV TEMP[3], TEMP[3], CONST[3].zwzw\n" + + /* Fetch texels */ + "TEX_LZ TEMP[4].x, TEMP[2], SAMP[0], RECT\n" + "TEX_LZ TEMP[4].y, TEMP[3], SAMP[1], RECT\n" + "TEX_LZ TEMP[4].z, TEMP[3], SAMP[2], RECT\n" + + "MOV TEMP[4].w, IMM[1].\n" + + /* Color Space Conversion */ + "DP4 TEMP[7].x, CONST[0], TEMP[4]\n" + "DP4 TEMP[7].y, CONST[1], TEMP[4]\n" + "DP4 TEMP[7].z, CONST[2], TEMP[4]\n" + + "MOV TEMP[5].w, TEMP[4].\n" + "SLE TEMP[6].w, TEMP[5], CONST[3].\n" + "SGT TEMP[5].w, TEMP[5], CONST[3].\n" + + "MAX TEMP[7].w, TEMP[5],