[Mesa-dev] [PATCH] vl/compositor: fix weave shader bugs

Christian König deathsimple at vodafone.de
Tue Dec 18 02:42:23 PST 2012


On 18.12.2012 09:18, Maarten Lankhorst wrote:
> Writemask was XY instead of YZ (thanks to calim for spotting it).
>
> The pixel calculation resulted in the pixel always being off by one.
> If y was .5:
>
> y' = round(y) + 0.5 = 1.5
>
> Fixing this also means the LRP function has to swap the pixels it, since
> it's now the other way around for top/bottom.
>
> WIth these fixes only chroma for top and bottom pixel rows are wrongly interpolated
> in my test program:

Sounds good, but what's the reason that first and last row is 
interpolated wrong? Just some issues with the border color/wrap handling?

>
> --- nvidia
> +++ nouveau
> @@ -1,4 +1,4 @@
> -YCbCr[0] = 00c080
> +YCbCr[0] = 00b070
>   YCbCr[1] = 00b070
>   YCbCr[2] = 029050
>   YCbCr[3] = 207050
> @@ -61,4 +61,4 @@
>   YCbCr[60] = 0c5070
>   YCbCr[61] = c05090
>   YCbCr[62] = 0e70b0
> -YCbCr[63] = e080c0
> +YCbCr[63] = e070b0
>
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst at canonical.com>

Reviewed-by: Christian König <christian.koenig at amd.com>

>
> ---
>
> diff --git a/src/gallium/auxiliary/vl/vl_compositor.c b/src/gallium/auxiliary/vl/vl_compositor.c
> index 7ea13bf..bc69669 100644
> --- a/src/gallium/auxiliary/vl/vl_compositor.c
> +++ b/src/gallium/auxiliary/vl/vl_compositor.c
> @@ -199,11 +199,13 @@ create_frag_shader_weave(struct vl_compositor *c)
>   
>      /* calculate the texture offsets
>       * t_tc.x = i_tc.x
> -    * t_tc.y = (round(i_tc.y) + 0.5) / height * 2
> +    * t_tc.y = (round(i_tc.y - 0.5) + 0.5) / height * 2
>       */
>      for (i = 0; i < 2; ++i) {
>         ureg_MOV(shader, ureg_writemask(t_tc[i], TGSI_WRITEMASK_X), i_tc[i]);
> -      ureg_ROUND(shader, ureg_writemask(t_tc[i], TGSI_WRITEMASK_YZ), i_tc[i]);
> +      ureg_SUB(shader, ureg_writemask(t_tc[i], TGSI_WRITEMASK_YZ),
> +               i_tc[i], ureg_imm1f(shader, 0.5f));
> +      ureg_ROUND(shader, ureg_writemask(t_tc[i], TGSI_WRITEMASK_YZ), ureg_src(t_tc[i]));
>         ureg_MOV(shader, ureg_writemask(t_tc[i], TGSI_WRITEMASK_W),
>                  ureg_imm1f(shader, i ? 0.75f : 0.25f));
>         ureg_ADD(shader, ureg_writemask(t_tc[i], TGSI_WRITEMASK_YZ),
> @@ -234,11 +236,11 @@ create_frag_shader_weave(struct vl_compositor *c)
>      ureg_ROUND(shader, ureg_writemask(t_tc[0], TGSI_WRITEMASK_YZ), i_tc[0]);
>      ureg_ADD(shader, ureg_writemask(t_tc[0], TGSI_WRITEMASK_YZ),
>               ureg_src(t_tc[0]), ureg_negate(i_tc[0]));
> -   ureg_MUL(shader, ureg_writemask(t_tc[0], TGSI_WRITEMASK_XY),
> +   ureg_MUL(shader, ureg_writemask(t_tc[0], TGSI_WRITEMASK_YZ),
>               ureg_abs(ureg_src(t_tc[0])), ureg_imm1f(shader, 2.0f));
>      ureg_LRP(shader, t_texel[0], ureg_swizzle(ureg_src(t_tc[0]),
>               TGSI_SWIZZLE_Y, TGSI_SWIZZLE_Z, TGSI_SWIZZLE_Z, TGSI_SWIZZLE_Z),
> -            ureg_src(t_texel[1]), ureg_src(t_texel[0]));
> +            ureg_src(t_texel[0]), ureg_src(t_texel[1]));
>   
>      /* and finally do colour space transformation
>       * fragment = csc * texel
>
>



More information about the mesa-dev mailing list