From face27fdc5293606faf38f91cc6235b2b3fc6071 Mon Sep 17 00:00:00 2001 From: Ilia Mirkin Date: Thu, 25 Jul 2019 23:18:18 -0400 Subject: [PATCH] gallium/vl: fix compute tgsi shaders to not process undefined components MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This caused nouveau's function handling logic to think that the MAIN function was due to receive external parameters, and cascaded some failures after that. Instead avoid having the undefined components in the first place. Fixes: f6ac0b5d71 (gallium/auxiliary/vl: Add compute shader to support video compositor render) Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=111213 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=111217 Signed-off-by: Ilia Mirkin Reviewed-by: Marek Olšák --- src/gallium/auxiliary/vl/vl_compositor_cs.c | 104 ++++++++++---------- 1 file changed, 52 insertions(+), 52 deletions(-) diff --git a/src/gallium/auxiliary/vl/vl_compositor_cs.c b/src/gallium/auxiliary/vl/vl_compositor_cs.c index 485b4174b8e..abd2aa63f32 100644 --- a/src/gallium/auxiliary/vl/vl_compositor_cs.c +++ b/src/gallium/auxiliary/vl/vl_compositor_cs.c @@ -61,7 +61,7 @@ const char *compute_shader_video_buffer = "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" + "UMAD TEMP[0].xy, SV[1].xyyy, IMM[0].xyyy, SV[0].xyyy\n" /* Drawn area check */ "USGE TEMP[1].xy, TEMP[0].xyxy, CONST[4].xyxy\n" @@ -70,20 +70,20 @@ const char *compute_shader_video_buffer = "AND TEMP[1].x, TEMP[1].xxxx, TEMP[1].zzzz\n" "AND TEMP[1].x, TEMP[1].xxxx, TEMP[1].wwww\n" - "UIF TEMP[1]\n" + "UIF TEMP[1].xxxx\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].yyyy\n" + "UADD TEMP[2].xy, TEMP[0].xyyy, -CONST[5].xyxy\n" + "U2F TEMP[2].xy, TEMP[2].xyyy\n" + "DIV TEMP[3].xy, TEMP[2].xyyy, IMM[1].yyyy\n" /* Scale */ - "DIV TEMP[2], TEMP[2], CONST[3].zwzw\n" - "DIV TEMP[3], TEMP[3], CONST[3].zwzw\n" + "DIV TEMP[2].xy, TEMP[2].xyyy, CONST[3].zwww\n" + "DIV TEMP[3].xy, TEMP[3].xyyy, CONST[3].zwww\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" + "TEX_LZ TEMP[4].x, TEMP[2].xyyy, SAMP[0], RECT\n" + "TEX_LZ TEMP[4].y, TEMP[3].xyyy, SAMP[1], RECT\n" + "TEX_LZ TEMP[4].z, TEMP[3].xyyy, SAMP[2], RECT\n" "MOV TEMP[4].w, IMM[1].xxxx\n" @@ -93,12 +93,12 @@ const char *compute_shader_video_buffer = "DP4 TEMP[7].z, CONST[2], TEMP[4]\n" "MOV TEMP[5].w, TEMP[4].zzzz\n" - "SLE TEMP[6].w, TEMP[5], CONST[3].xxxx\n" - "SGT TEMP[5].w, TEMP[5], CONST[3].yyyy\n" + "SLE TEMP[6].w, TEMP[5].wwww, CONST[3].xxxx\n" + "SGT TEMP[5].w, TEMP[5].wwww, CONST[3].yyyy\n" - "MAX TEMP[7].w, TEMP[5], TEMP[6]\n" + "MAX TEMP[7].w, TEMP[5].wwww, TEMP[6].wwww\n" - "STORE IMAGE[0], TEMP[0], TEMP[7], 2D\n" + "STORE IMAGE[0], TEMP[0].xyyy, TEMP[7], 2D\n" "ENDIF\n" "END\n"; @@ -124,7 +124,7 @@ const char *compute_shader_weave = "IMM[2] UINT32 { 1, 2, 4, 0}\n" "IMM[3] FLT32 { 0.25, 0.5, 0.125, 0.125}\n" - "UMAD TEMP[0], SV[1], IMM[0], SV[0]\n" + "UMAD TEMP[0].xy, SV[1].xyyy, IMM[0].xyyy, SV[0].xyyy\n" /* Drawn area check */ "USGE TEMP[1].xy, TEMP[0].xyxy, CONST[4].xyxy\n" @@ -133,22 +133,22 @@ const char *compute_shader_weave = "AND TEMP[1].x, TEMP[1].xxxx, TEMP[1].zzzz\n" "AND TEMP[1].x, TEMP[1].xxxx, TEMP[1].wwww\n" - "UIF TEMP[1]\n" - "MOV TEMP[2], TEMP[0]\n" + "UIF TEMP[1].xxxx\n" + "MOV TEMP[2].xy, TEMP[0].xyyy\n" /* Translate */ - "UADD TEMP[2].xy, TEMP[2], -CONST[5].xyxy\n" + "UADD TEMP[2].xy, TEMP[2].xyyy, -CONST[5].xyxy\n" /* Top Y */ - "U2F TEMP[2], TEMP[2]\n" + "U2F TEMP[2].xy, TEMP[2].xyyy\n" "DIV TEMP[2].y, TEMP[2].yyyy, IMM[1].yyyy\n" /* Down Y */ - "MOV TEMP[12], TEMP[2]\n" + "MOV TEMP[12].xy, TEMP[2].xyyy\n" /* Top UV */ - "MOV TEMP[3], TEMP[2]\n" + "MOV TEMP[3].xy, TEMP[2].xyyy\n" "DIV TEMP[3].xy, TEMP[3], IMM[1].yyyy\n" /* Down UV */ - "MOV TEMP[13], TEMP[3]\n" + "MOV TEMP[13].xy, TEMP[3].xyyy\n" /* Texture offset */ "ADD TEMP[2].x, TEMP[2].xxxx, IMM[3].yyyy\n" @@ -162,10 +162,10 @@ const char *compute_shader_weave = "ADD TEMP[13].y, TEMP[13].yyyy, IMM[3].wwww\n" /* Scale */ - "DIV TEMP[2].xy, TEMP[2], CONST[3].zwzw\n" - "DIV TEMP[12].xy, TEMP[12], CONST[3].zwzw\n" - "DIV TEMP[3].xy, TEMP[3], CONST[3].zwzw\n" - "DIV TEMP[13].xy, TEMP[13], CONST[3].zwzw\n" + "DIV TEMP[2].xy, TEMP[2].xyyy, CONST[3].zwzw\n" + "DIV TEMP[12].xy, TEMP[12].xyyy, CONST[3].zwzw\n" + "DIV TEMP[3].xy, TEMP[3].xyyy, CONST[3].zwzw\n" + "DIV TEMP[13].xy, TEMP[13].xyyy, CONST[3].zwzw\n" /* Weave offset */ "ADD TEMP[2].y, TEMP[2].yyyy, IMM[3].xxxx\n" @@ -176,32 +176,32 @@ const char *compute_shader_weave = /* Texture layer */ "MOV TEMP[14].x, TEMP[2].yyyy\n" "MOV TEMP[14].yz, TEMP[3].yyyy\n" - "ROUND TEMP[15], TEMP[14]\n" - "ADD TEMP[14], TEMP[14], -TEMP[15]\n" - "MOV TEMP[14], |TEMP[14]|\n" - "MUL TEMP[14], TEMP[14], IMM[1].yyyy\n" + "ROUND TEMP[15].xyz, TEMP[14].xyzz\n" + "ADD TEMP[14].xyz, TEMP[14].xyzz, -TEMP[15].xyzz\n" + "MOV TEMP[14].xyz, |TEMP[14].xyzz|\n" + "MUL TEMP[14].xyz, TEMP[14].xyzz, IMM[1].yyyy\n" /* Normalize */ - "DIV TEMP[2].xy, TEMP[2], CONST[5].zwzw\n" - "DIV TEMP[12].xy, TEMP[12], CONST[5].zwzw\n" + "DIV TEMP[2].xy, TEMP[2].xyyy, CONST[5].zwzw\n" + "DIV TEMP[12].xy, TEMP[12].xyyy, CONST[5].zwzw\n" "DIV TEMP[15].xy, CONST[5].zwzw, IMM[1].yyyy\n" - "DIV TEMP[3].xy, TEMP[3], TEMP[15].xyxy\n" - "DIV TEMP[13].xy, TEMP[13], TEMP[15].xyxy\n" + "DIV TEMP[3].xy, TEMP[3].xyyy, TEMP[15].xyxy\n" + "DIV TEMP[13].xy, TEMP[13].xyyy, TEMP[15].xyxy\n" /* Fetch texels */ "MOV TEMP[2].z, IMM[1].wwww\n" "MOV TEMP[3].z, IMM[1].wwww\n" - "TEX_LZ TEMP[10].x, TEMP[2], SAMP[0], 2D_ARRAY\n" - "TEX_LZ TEMP[10].y, TEMP[3], SAMP[1], 2D_ARRAY\n" - "TEX_LZ TEMP[10].z, TEMP[3], SAMP[2], 2D_ARRAY\n" + "TEX_LZ TEMP[10].x, TEMP[2].xyzz, SAMP[0], 2D_ARRAY\n" + "TEX_LZ TEMP[10].y, TEMP[3].xyzz, SAMP[1], 2D_ARRAY\n" + "TEX_LZ TEMP[10].z, TEMP[3].xyzz, SAMP[2], 2D_ARRAY\n" "MOV TEMP[12].z, IMM[1].xxxx\n" "MOV TEMP[13].z, IMM[1].xxxx\n" - "TEX_LZ TEMP[11].x, TEMP[12], SAMP[0], 2D_ARRAY\n" - "TEX_LZ TEMP[11].y, TEMP[13], SAMP[1], 2D_ARRAY\n" - "TEX_LZ TEMP[11].z, TEMP[13], SAMP[2], 2D_ARRAY\n" + "TEX_LZ TEMP[11].x, TEMP[12].xyzz, SAMP[0], 2D_ARRAY\n" + "TEX_LZ TEMP[11].y, TEMP[13].xyzz, SAMP[1], 2D_ARRAY\n" + "TEX_LZ TEMP[11].z, TEMP[13].xyzz, SAMP[2], 2D_ARRAY\n" - "LRP TEMP[6], TEMP[14], TEMP[10], TEMP[11]\n" + "LRP TEMP[6].xyz, TEMP[14].xyzz, TEMP[10].xyzz, TEMP[11].xyzz\n" "MOV TEMP[6].w, IMM[1].xxxx\n" /* Color Space Conversion */ @@ -210,12 +210,12 @@ const char *compute_shader_weave = "DP4 TEMP[9].z, CONST[2], TEMP[6]\n" "MOV TEMP[7].w, TEMP[6].zzzz\n" - "SLE TEMP[8].w, TEMP[7], CONST[3].xxxx\n" - "SGT TEMP[7].w, TEMP[7], CONST[3].yyyy\n" + "SLE TEMP[8].w, TEMP[7].wwww, CONST[3].xxxx\n" + "SGT TEMP[7].w, TEMP[7].wwww, CONST[3].yyyy\n" - "MAX TEMP[9].w, TEMP[7], TEMP[8]\n" + "MAX TEMP[9].w, TEMP[7].wwww, TEMP[8].wwww\n" - "STORE IMAGE[0], TEMP[0], TEMP[9], 2D\n" + "STORE IMAGE[0], TEMP[0].xyyy, TEMP[9], 2D\n" "ENDIF\n" "END\n"; @@ -239,7 +239,7 @@ const char *compute_shader_rgba = "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" + "UMAD TEMP[0].xy, SV[1].xyyy, IMM[0].xyyy, SV[0].xyyy\n" /* Drawn area check */ "USGE TEMP[1].xy, TEMP[0].xyxy, CONST[4].xyxy\n" @@ -248,18 +248,18 @@ const char *compute_shader_rgba = "AND TEMP[1].x, TEMP[1].xxxx, TEMP[1].zzzz\n" "AND TEMP[1].x, TEMP[1].xxxx, TEMP[1].wwww\n" - "UIF TEMP[1]\n" + "UIF TEMP[1].xxxx\n" /* Translate */ - "UADD TEMP[2].xy, TEMP[0], -CONST[5].xyxy\n" - "U2F TEMP[2], TEMP[2]\n" + "UADD TEMP[2].xy, TEMP[0].xyyy, -CONST[5].xyxy\n" + "U2F TEMP[2].xy, TEMP[2].xyyy\n" /* Scale */ - "DIV TEMP[2], TEMP[2], CONST[3].zwzw\n" + "DIV TEMP[2].xy, TEMP[2].xyyy, CONST[3].zwzw\n" /* Fetch texels */ - "TEX_LZ TEMP[3], TEMP[2], SAMP[0], RECT\n" + "TEX_LZ TEMP[3], TEMP[2].xyyy, SAMP[0], RECT\n" - "STORE IMAGE[0], TEMP[0], TEMP[3], 2D\n" + "STORE IMAGE[0], TEMP[0].xyyy, TEMP[3], 2D\n" "ENDIF\n" "END\n"; -- 2.30.2