intel: fix INTEL_DEBUG environment variable on 32-bit systems
INTEL_DEBUG is defined (since 4015e1876a
) as:
#define INTEL_DEBUG __builtin_expect(intel_debug, 0)
which unfortunately chops off upper 32 bits from intel_debug
on platforms where sizeof(long) != sizeof(uint64_t) because
__builtin_expect is defined only for the long type.
Fix this by changing the definition of INTEL_DEBUG to be function-like
macro with "flags" argument. New definition returns 0 or 1 when
any of the flags match.
Most of the changes in this commit were generated using:
for c in `git grep INTEL_DEBUG | grep "&" | grep -v i915 | awk -F: '{print $1}' | sort | uniq`; do
perl -pi -e "s/INTEL_DEBUG & ([A-Z0-9a-z_]+)/INTEL_DBG(\1)/" $c
perl -pi -e "s/INTEL_DEBUG & (\([A-Z0-9_ |]+\))/INTEL_DBG\1/" $c
done
but it didn't handle all cases and required minor cleanups (like removal
of round brackets which were not needed anymore).
Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13334>
This commit is contained in:

committed by
Marge Bot

parent
182237e1e8
commit
d05f7b4a2c
@@ -68,7 +68,7 @@ anv_physical_device_init_perf(struct anv_physical_device *device, int fd)
|
||||
/* We need DRM_I915_PERF_PROP_HOLD_PREEMPTION support, only available in
|
||||
* perf revision 2.
|
||||
*/
|
||||
if (!(INTEL_DEBUG & DEBUG_NO_OACONFIG)) {
|
||||
if (!INTEL_DEBUG(DEBUG_NO_OACONFIG)) {
|
||||
if (!intel_perf_has_hold_preemption(perf))
|
||||
goto err;
|
||||
}
|
||||
@@ -225,7 +225,7 @@ VkResult anv_AcquirePerformanceConfigurationINTEL(
|
||||
if (!config)
|
||||
return vk_error(device, VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||
|
||||
if (!(INTEL_DEBUG & DEBUG_NO_OACONFIG)) {
|
||||
if (!INTEL_DEBUG(DEBUG_NO_OACONFIG)) {
|
||||
config->register_config =
|
||||
intel_perf_load_configuration(device->physical->perf, device->fd,
|
||||
INTEL_PERF_QUERY_GUID_MDAPI);
|
||||
@@ -258,7 +258,7 @@ VkResult anv_ReleasePerformanceConfigurationINTEL(
|
||||
ANV_FROM_HANDLE(anv_device, device, _device);
|
||||
ANV_FROM_HANDLE(anv_performance_configuration_intel, config, _configuration);
|
||||
|
||||
if (!(INTEL_DEBUG & DEBUG_NO_OACONFIG))
|
||||
if (!INTEL_DEBUG(DEBUG_NO_OACONFIG))
|
||||
intel_ioctl(device->fd, DRM_IOCTL_I915_PERF_REMOVE_CONFIG, &config->config_id);
|
||||
|
||||
ralloc_free(config->register_config);
|
||||
@@ -276,7 +276,7 @@ VkResult anv_QueueSetPerformanceConfigurationINTEL(
|
||||
ANV_FROM_HANDLE(anv_performance_configuration_intel, config, _configuration);
|
||||
struct anv_device *device = queue->device;
|
||||
|
||||
if (!(INTEL_DEBUG & DEBUG_NO_OACONFIG)) {
|
||||
if (!INTEL_DEBUG(DEBUG_NO_OACONFIG)) {
|
||||
if (device->perf_fd < 0) {
|
||||
device->perf_fd = anv_device_perf_open(device, config->config_id);
|
||||
if (device->perf_fd < 0)
|
||||
@@ -405,7 +405,7 @@ VkResult anv_AcquireProfilingLockKHR(
|
||||
|
||||
assert(device->perf_fd == -1);
|
||||
|
||||
if (!(INTEL_DEBUG & DEBUG_NO_OACONFIG)) {
|
||||
if (!INTEL_DEBUG(DEBUG_NO_OACONFIG)) {
|
||||
fd = anv_device_perf_open(device, first_metric_set->oa_metrics_set_id);
|
||||
if (fd < 0)
|
||||
return VK_TIMEOUT;
|
||||
@@ -420,7 +420,7 @@ void anv_ReleaseProfilingLockKHR(
|
||||
{
|
||||
ANV_FROM_HANDLE(anv_device, device, _device);
|
||||
|
||||
if (!(INTEL_DEBUG & DEBUG_NO_OACONFIG)) {
|
||||
if (!INTEL_DEBUG(DEBUG_NO_OACONFIG)) {
|
||||
assert(device->perf_fd >= 0);
|
||||
close(device->perf_fd);
|
||||
}
|
||||
|
Reference in New Issue
Block a user