intel/ds: Modify rejection threshold to scale with requested sample period
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run

Previously, we only checked if the hardware duration was greater
than the requested sample period by 1000 ns. This can lead the
hardware duration to be rejected and use the next cycle, which
is double the size of the current duration.

At larger requested sample size, this can mean getting a hardware
duration of 1.7 ms for a requested sample period of 1 ms.

To fix this, we'll scale the check so that it uses 67% of the
requested sample period as the reject threshold. This way, if the
hardware duration is below 67%, it's guaranteed to be within
100%-133% of the requested sample period on the next hardware interval.

Signed-off-by: Casey Bowman <casey.g.bowman@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40735>
This commit is contained in:
Casey Bowman 2026-03-31 15:00:39 -07:00 committed by Marge Bot
parent 0bf3aaedb1
commit 007be58ade

View file

@ -182,7 +182,13 @@ void IntelDriver::disable_perfcnt()
/// @return True if the duration is at least close to the sampling period
static bool close_enough(uint64_t duration, uint64_t sampling_period)
{
return duration > sampling_period - 1000;
/* If the duration isn't greater than 67% of the request, we will use
* the next hw sampling period, which will be double the current duration.
* That value will fall somewhere between 100%-133%, guaranteeing a duration
* that falls closer to the requested sampling period overall, while scaling
* to accomodate relatively larger requested sample periods.
*/
return duration > sampling_period * 0.67;
}
/// @brief Transforms the raw data received in from the driver into records