Bug 110779 - Patch "vc4: Fix sin(0.0) and cos(0.0) accuracy to fix SDL rendering rotation." cause performance degradation
Summary: Patch "vc4: Fix sin(0.0) and cos(0.0) accuracy to fix SDL rendering rotation....
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/DRI/vc4 (show other bugs)
Version: 18.3
Hardware: Other All
: medium normal
Assignee: Eric Anholt
QA Contact: Eric Anholt
Depends on:
Reported: 2019-05-28 08:21 UTC by Zhaowei Yuan
Modified: 2019-09-18 18:47 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Description Zhaowei Yuan 2019-05-28 08:21:49 UTC
Hi Eric,
We got a problem about performance degradation after applying your patch:
commit 10d5d2d527dea11f4afe300eebeaba077f169af0
Author: Eric Anholt <eric@anholt.net>
Date:   Fri Sep 21 14:11:12 2018 -0700

    vc4: Fix sin(0.0) and cos(0.0) accuracy to fix SDL rendering rotation.

My test program is "GLB 2.1", shader in the case is:
const char *trigTest =
	float sint = sin(time);\n\
	float st = (sin(sint*3.*cos(x)*10.)+1.0)*0.5;\n\
	float ct = (cos(sint*2.*sin(y)*10.)+1.0)*0.5;\n\
	float st1 = (sin(sint*3.*cos(x1)*10.)+1.0)*0.5;\n\
	float ct1 = (cos(sint*2.*sin(y1)*10.)+1.0)*0.5;\n\
	float st2 = (sin(sint*3.*cos(x2)*10.)+1.0)*0.5;\n\
	float ct2 = (cos(sint*2.*sin(y2)*10.)+1.0)*0.5;\n\
	float st3 = (sin(sint*3.*cos(x3)*10.)+1.0)*0.5;\n\
	float ct3 = (cos(sint*2.*sin(y3)*10.)+1.0)*0.5;\n\
	float st4 = (sin(sint*3.*cos(x4)*10.)+1.0)*0.5;\n\
	float ct4 = (cos(sint*2.*sin(y4)*10.)+1.0)*0.5;\n\
	f = (st+ct+0.5*(st1+ct1+0.5*(st2+ct2+0.5*(st3+ct3+0.5*(st4+ct4)))))*0.25;\n\

My test result is:
24FPS before applying your patch
15FPS after applying your patch.

I wonder that if the performance loss is reasonable and acceptable?
Comment 1 GitLab Migration User 2019-09-18 18:47:50 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/mesa/mesa/issues/329.

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.