Skip to content

Optimize ResourceClientBits() funtion

Raul Fernandes requested to merge rgfernandes/xserver:resourceclientbits into master

The LimitClients variable could be set in three different places: os/osinit.c, os/utils.c and hw/xfree86/common/xf86Config.c. In these places, it checks if the variable is 64, 128, 256, 512, 1024 or 2048. So we can optimize ResourceClientBits() to start looking in 7th bit (value of 64). Another optimization is to avoid calling repeatedly the ResourceClientBits() function as the variable LimitClients is set only once. So call ResourceClientBits() only when setting LimitClients. The macros defined in include/resource.h is replaced by global variables and calculated together LimitClients too avoiding to recalculate every time is used.

Edited by Povilas Kanapickas

Merge request reports