[Intel-gfx] [PATCH RESEND 1/2] drm/i915: make device info bitfield flags bools

Jani Nikula jani.nikula at intel.com
Fri May 13 14:47:13 UTC 2016


On Fri, 13 May 2016, Chris Wilson <chris at chris-wilson.co.uk> wrote:
> On Fri, May 13, 2016 at 03:25:05PM +0100, Tvrtko Ursulin wrote:
>> 
>> On 13/05/16 15:04, Jani Nikula wrote:
>> >This is more robust for assignments and comparisons.
>> >
>> >Signed-off-by: Jani Nikula <jani.nikula at intel.com>
>> >---
>> >  drivers/gpu/drm/i915/i915_drv.h | 2 +-
>> >  1 file changed, 1 insertion(+), 1 deletion(-)
>> >
>> >diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
>> >index d9d07b70f05c..bb0b6f64000e 100644
>> >--- a/drivers/gpu/drm/i915/i915_drv.h
>> >+++ b/drivers/gpu/drm/i915/i915_drv.h
>> >@@ -752,7 +752,7 @@ struct intel_csr {
>> >  	func(has_ddi) sep \
>> >  	func(has_fpga_dbg)
>> >
>> >-#define DEFINE_FLAG(name) u8 name:1
>> >+#define DEFINE_FLAG(name) bool name:1
>> >  #define SEP_SEMICOLON ;
>> >
>> >  struct intel_device_info {
>> >
>> 
>> The churn virus spreads? :)
>> 
>> I tried that but it was negatively impacting the compiler. For some
>> reason it increases .text by 2.5k here. Don't see anything obvious,
>> would have to look at the code more closely to spot exactly why.
>
> Oh, that's not fun. bool:1 holds such promise for a clear explanation of
> the most common form of bitfield.

Really a bummer, especially since assigning any positive even number to
unsigned int foo:1 will result in 0.

BR,
Jani.


-- 
Jani Nikula, Intel Open Source Technology Center


More information about the Intel-gfx mailing list