[Intel-gfx] [PATCH 7/7] drm/i915/perf: reuse timestamp frequency from device info

Lionel Landwerlin lionel.g.landwerlin at intel.com
Mon Nov 13 15:19:28 UTC 2017


On 10/11/17 21:00, Chris Wilson wrote:
> Quoting Lionel Landwerlin (2017-11-10 19:08:45)
>> @@ -3528,7 +3502,7 @@ void i915_perf_init(struct drm_i915_private *dev_priv)
>>                  spin_lock_init(&dev_priv->perf.oa.oa_buffer.ptr_lock);
>>   
>>                  oa_sample_rate_hard_limit =
>> -                       dev_priv->perf.oa.timestamp_frequency / 2;
>> +                       INTEL_INFO(dev_priv)->cs_timestamp_frequency / 2;
> 32-bit builds may complain, as this is ostensibly now a 64b division.
> Right?
> -Chris
>
Well, we already store cs_timestamp_frequency in the getparam value.
The assumption is that we'll stay well below the INT_MAX.
So that should be fine.

The following didn't raise a warning on the division with 
gcc7.2.0/clang3.8.1 -m32 -Wall -Wextra :

int
main(int argc, char *argv[])
{
   uint64_t plop = ~0ULL;
   int ret = plop / 2;

   return ret;
}


-
Lionel


More information about the Intel-gfx mailing list