Bug 82002

Summary: [HSW bisected] cairo-trace(all cases) performance reduce 30%~90%
Product: cairo Reporter: zhoujian <jianx.zhou>
Component: xlib backendAssignee: Chris Wilson <chris>
Status: VERIFIED FIXED QA Contact: cairo-bugs mailing list <cairo-bugs>
Severity: major    
Priority: high CC: wendy.wang
Version: unspecified   
Hardware: All   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description zhoujian 2014-08-01 09:01:30 UTC
System Environment:       
----------------------------------------------------------------------
Platform: HSW
Libdrm:	(master)libdrm-2.4.56-1-g5d8357976a84396ebe10ed5a0d6ba1b79ccdcf2e
 Mesa:(master)bf3a26266d3f5da18a215c8c11ce75d01582e989
 Xserver:(master)xorg-server-1.15.99.902-121-g2f5cf9ff9a0f713b7e113a5f10a
 Xf86_video_intel:(master)2.99.914-13-ga6a60ec606e291323ee0b6e83679ff277a0bd84a
 Cairo:	(master)f337342c88092a251dc00476c4a9880d1cb90822
 Libva:	(master)3fddb7f937df4e0e15391bd65ae3c7552ea5b3d7
 Libva_intel_driver: (master)82d2ed8d7da3619c0ea467c06604f5626fc0b901
Kernel:drm-intel-nightly git-1be8f2

Bug detailed description:
cairo-trace performance reduce 30%~90% on HSW,
It’s Cairo regression. By bisected, show that the first bad commit:
commit f337342c88092a251dc00476c4a9880d1cb90822
Author:     Bill Spitzak <spitzak@gmail.com>
AuthorDate: Fri Jul 18 18:46:26 2014 -0700
Commit:     Bryce Harrington <b.harrington@samsung.com>
CommitDate: Fri Jul 25 12:16:53 2014 -0700

    V6 image: Use convolution filters for sample reconstruction when downscaling

Reproduce steps:
--------------------------------------------------------------------
1. xinit&
2. vblank_mode=0 CAIRO_TEST_TARGET=xlib perf/cairo-perf-trace -i 6 /home/cairo-traces/benchmark/chromium-tabs.trace
Comment 1 Chris Wilson 2014-08-01 10:31:42 UTC
commit 27c9923e9887bab5854ecccc81dda69687a0b9ae
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Fri Aug 1 11:29:29 2014 +0100

    xlib: Undo debug hack to force fallbacks
    
    Remove the debug hack from
    
    commit f337342c88092a251dc00476c4a9880d1cb90822
    Author: Bill Spitzak <spitzak@gmail.com>
    Date:   Fri Jul 18 18:46:26 2014 -0700
    
        V6 image: Use convolution filters for sample reconstruction when downscaling
    
    as it forces the fallback image surface for xlib causing severe
    performance degradation.
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=82002
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
    Cc: Bill Spitzak <spitzak@gmail.com>
    Cc: Bryce Harrington <b.harrington@samsung.com>
Comment 2 Bill Spitzak 2014-08-01 19:57:32 UTC
This will disable the image filtering on xlib backends. This may not be 
a concern as it sounds like the major users of the filtering are using 
the image backend anyway. Also it was also not using it on xcb, and 
perhaps other backends that talk to a remote pixman.

A correct fix would be to make the xlib backend switch to the fallback 
only if image filtering is being done, but I don't have a good idea how 
to do that. Probably even better is to move the filtering into pixman, 
so the xrender backend will use it and thus fix xlib/xcb with no changes 
to cairo. I have posted some code for this but have not seen any feedback.

Another problem with the current one is that if BEST is used it will do 
the filtering even for the identity transform (the code in pixman does 
not do this for GOOD/BEST). It should check for this and use nearest in 
this case. I will try to add a patch for that.

On 08/01/2014 03:31 AM, bugzilla-daemon@freedesktop.org wrote:
> Chris Wilson <mailto:chris@chris-wilson.co.uk> changed bug 82002
> <https://bugs.freedesktop.org/show_bug.cgi?id=82002>
> What 	Removed 	Added
> Status 	NEW 	RESOLVED
> Resolution 	--- 	FIXED
>
> *Comment # 1 <https://bugs.freedesktop.org/show_bug.cgi?id=82002#c1> on
> bug 82002 <https://bugs.freedesktop.org/show_bug.cgi?id=82002> from
> Chris Wilson <mailto:chris@chris-wilson.co.uk> *
>
> commit 27c9923e9887bab5854ecccc81dda69687a0b9ae
> Author: Chris Wilson <chris@chris-wilson.co.uk  <mailto:chris@chris-wilson.co.uk>>
> Date:   Fri Aug 1 11:29:29 2014 +0100
>
>      xlib: Undo debug hack to force fallbacks
>
>      Remove the debug hack from
>
>      commit f337342c88092a251dc00476c4a9880d1cb90822
>      Author: Bill Spitzak <spitzak@gmail.com  <mailto:spitzak@gmail.com>>
>      Date:   Fri Jul 18 18:46:26 2014 -0700
>
>          V6 image: Use convolution filters for sample reconstruction when
> downscaling
>
>      as it forces the fallback image surface for xlib causing severe
>      performance degradation.
>
>      Bugzilla:https://bugs.freedesktop.org/show_bug.cgi?id=82002  <show_bug.cgi?id=82002>
>      Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk  <mailto:chris@chris-wilson.co.uk>>
>      Cc: Bill Spitzak <spitzak@gmail.com  <mailto:spitzak@gmail.com>>
>      Cc: Bryce Harrington <b.harrington@samsung.com  <mailto:b.harrington@samsung.com>>
>
> ------------------------------------------------------------------------
> You are receiving this mail because:
>
>   * You are watching the QA Contact of the bug.
>
Comment 3 Bill Spitzak 2014-08-02 01:41:49 UTC
This will disable the image filtering on xlib backends. This may not be a concern as it sounds like the major users of the filtering are using the image backend anyway. Also it was also not using it on xcb, and perhaps other backends that talk to a remote pixman.

A correct fix would be to make the xlib backend switch to the fallback only if image filtering is being done, but I don't have a good idea how to do that. Probably even better is to move the filtering into pixman, so the xrender backend will use it and thus fix xlib/xcb with no changes to cairo. I have posted some code for this but have not seen any feedback.

Another problem with the current one is that if BEST is used it will do the filtering even for the identity transform (the code in pixman does not do this for GOOD/BEST). It should check for this and use nearest in this case. I will try to add a patch for that.
Comment 4 zhoujian 2014-08-04 08:49:08 UTC
Verified it,the commit is "git-c7ff9bb"

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.