Skip to content

intel: fix INTEL_DEBUG environment variable on 32-bit systems

Marcin Ślusarz requested to merge mslusarz/mesa:intel_debug into main

@cmarcelo in !13249 (merged) wrote some tests that involved changing INTEL_DEBUG value and discovered that some flags don't work in 32-bit environments.

This is due INTEL_DEBUG being defined (since !6732 (merged)) 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.

This is not possible to fix transparently to INTEL_DEBUG users, so we have to fix it differently. We could either go back to before !6732 (merged) and add unlikely's everywhere or add a wrapper around bit masking checks. This MR implements the second option - it adds new INTEL_DBG function-like macro, converts all users of INTEL_DEBUG to INTEL_DBG and deprecates INTEL_DEBUG. It doesn't remove INTEL_DEBUG to not disrupt pending patches, but after few months we could remove it. If we don't care about pending patches we could actually rename INTEL_DBG back to INTEL_DEBUG.

Edit: It was decided to rename INTEL_DBG back to INTEL_DEBUG.

Edited by Marcin Ślusarz

Merge request reports