[Glamor] [PATCH] Optimize gradient_fs_template shader

Zhigang Gong zhigang.gong at linux.intel.com
Wed Jun 12 22:47:24 PDT 2013



> -----Original Message-----
> From: glamor-bounces+zhigang.gong=linux.intel.com at lists.freedesktop.org
> [mailto:glamor-bounces+zhigang.gong=linux.intel.com at lists.freedesktop.org]
> On Behalf Of Tom Stellard
> Sent: Tuesday, June 11, 2013 10:11 AM
> To: glamor at lists.freedesktop.org
> Cc: michel.daenzer at amd.com; Tom Stellard
> Subject: [Glamor] [PATCH] Optimize gradient_fs_template shader
> 
> From: Tom Stellard <thomas.stellard at amd.com>
> 
> Replace:
> 
> while(t > 1.0)
>    t = t - 1.0;
> while(t < 0.0)
>    t = t + 1.0;
> 
> With:
> 
> t = fract(t);
> ---
> 
> This code is untested since I'm not usre which test suite to use for
glamor.
> Any suggestions?
[Gong, Zhigang] The major test suites glamor is using are as below:

XTS, Rendercheck, cairo test suite with xlib backend.
For gradient, we may choose cairo test suite and render check.

To measure performance, we are using x11perf/cairo trace/cairo-demos.
> 
> This should improve the performance of any app that uses this shader via
> glamor.
> I think the cairo perf test firefox-canvas uses this, but the patch didn't
improve
[Gong, Zhigang] You may try to measure the gradient performance with Chris's
Cairo-demos's gradient-demo. The repository is at:
git://people.freedesktop.org/~ickle/cairo-demos

> perfomance.  I may try looking through the cairo micro benchmarks to see
if I
> can find a more specific performance test.
> 
> 
>  src/glamor_gradient.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/src/glamor_gradient.c b/src/glamor_gradient.c index
> 4abc82d..b01fd57 100644
> --- a/src/glamor_gradient.c
> +++ b/src/glamor_gradient.c
> @@ -305,10 +305,7 @@ _glamor_create_radial_gradient_program(ScreenPtr
> screen, int stops_count, int dy
>  	    "    }\n"\
>  	    "    \n"\
>  	    "    if(repeat_type == %d){\n" /* repeat normal*/\
> -	    "        while(t > 1.0) \n"\
> -	    "            t = t - 1.0; \n"\
> -	    "        while(t < 0.0) \n"\
> -	    "            t = t + 1.0; \n"\
> +            "        t = fract(t);\n"\
>  	    "    }\n"\
>  	    "    \n"\
>  	    "    if(repeat_type == %d) {\n" /* repeat reflect*/\
> --
> 1.7.11.4
> 
> _______________________________________________
> Glamor mailing list
> Glamor at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/glamor



More information about the Glamor mailing list