[Mesa-dev] [PATCH 4/8] i965: Move inst_info from brw_eu_validate.c to brw_eu.c.
Matt Turner
mattst88 at gmail.com
Sun May 1 20:11:26 UTC 2016
On Sun, May 1, 2016 at 12:37 PM, Ilia Mirkin <imirkin at alum.mit.edu> wrote:
> On Sun, May 1, 2016 at 2:42 PM, Matt Turner <mattst88 at gmail.com> wrote:
>> Drop the uses of 'enum gen' to a plain int, so that we don't have to
>> expose the bitfield definitions and GEN_GE/GEN_LE macros to other users
>> of brw_eu.h. As a result, s/.gen/.gens/ to avoid confusion with
>> devinfo->gen.
>> ---
>> src/mesa/drivers/dri/i965/brw_eu.c | 239 +++++++++++++++++++++++++++
>> src/mesa/drivers/dri/i965/brw_eu.h | 8 +
>> src/mesa/drivers/dri/i965/brw_eu_validate.c | 247 +---------------------------
>> 3 files changed, 249 insertions(+), 245 deletions(-)
>>
>> diff --git a/src/mesa/drivers/dri/i965/brw_eu.c b/src/mesa/drivers/dri/i965/brw_eu.c
>> index 9ea8b38..b9b081f 100644
>> --- a/src/mesa/drivers/dri/i965/brw_eu.c
>> +++ b/src/mesa/drivers/dri/i965/brw_eu.c
>> @@ -340,6 +340,245 @@ brw_disassemble(const struct brw_device_info *devinfo,
>> }
>> }
>>
>> +enum gen {
>> + GEN4 = (1 << 0),
>> + GEN45 = (1 << 1),
>> + GEN5 = (1 << 2),
>> + GEN6 = (1 << 3),
>> + GEN7 = (1 << 4),
>> + GEN75 = (1 << 5),
>> + GEN8 = (1 << 6),
>> + GEN9 = (1 << 7),
>> + GEN_ALL = ~0
>> +};
>> +
>> +#define GEN_GE(gen) (~((gen) - 1) | gen)
>
> That | gen is unnecessary, I think. [But also doesn't hurt anything.]
>
> You could also define stuff like
>
> #define GEN_LT(gen) ((gen) - 1)
> #define GEN_GE(gen) (~GEN_LT(gen))
> #define GEN_LE(gen) (GEN_LT(gen) | (gen))
Oh, I like that. Thanks.
>
> Which might enhance readability. Or decrease it, depending who you
> ask. Your call, just throwing out some options.
>
> Whichever option you decide to go with, please throw () around all
> instances of gen in the macros.
Will do.
More information about the mesa-dev
mailing list