[Intel-xe] [PATCH 17/17] drm/xe: Move helper macros to separate header

Lucas De Marchi lucas.demarchi at intel.com
Wed Apr 19 17:06:59 UTC 2023


On Wed, Apr 19, 2023 at 07:17:14PM +0300, Jani Nikula wrote:
>On Wed, 19 Apr 2023, Lucas De Marchi <lucas.demarchi at intel.com> wrote:
>> The macros to handle the RTP tables are very scary, but shouldn't be
>> used outside of the header adding the infra. Move it to a separate
>> header and make sure it's only included when it can be.
>
>I've wondered if the macros are more trouble than they're worth...


The problem is that writting the tables would become very very verbose,
to the point of not being feasible (and error-prone). I think the
alternative would be to eventually move out of .c and just write it in a
format that generates the .c. It comes with its own downsides though.


>
>>
>> Signed-off-by: Lucas De Marchi <lucas.demarchi at intel.com>
>> ---
>>  drivers/gpu/drm/xe/Makefile            |  2 +-
>>  drivers/gpu/drm/xe/tests/xe_rtp_test.c |  2 +-
>>  drivers/gpu/drm/xe/xe_rtp.h            | 40 +++------------------
>>  drivers/gpu/drm/xe/xe_rtp_helpers.h    | 48 ++++++++++++++++++++++++++
>>  4 files changed, 55 insertions(+), 37 deletions(-)
>>  create mode 100644 drivers/gpu/drm/xe/xe_rtp_helpers.h
>>
>> diff --git a/drivers/gpu/drm/xe/Makefile b/drivers/gpu/drm/xe/Makefile
>> index aceca651de57..f3c38815011e 100644
>> --- a/drivers/gpu/drm/xe/Makefile
>> +++ b/drivers/gpu/drm/xe/Makefile
>> @@ -225,7 +225,7 @@ endif
>>
>>  # header test
>>  always-$(CONFIG_DRM_XE_WERROR) += \
>> -	$(patsubst %.h,%.hdrtest, $(shell cd $(srctree)/$(src) && find * -name '*.h' $(skipdisplay)))
>> +	$(patsubst %.h,%.hdrtest, $(shell cd $(srctree)/$(src) && find * -name '*.h' -not -path xe_rtp_helpers.h $(skipdisplay)))
>>
>>  quiet_cmd_hdrtest = HDRTEST $(patsubst %.hdrtest,%.h,$@)
>>        cmd_hdrtest = $(CC) -DHDRTEST $(filter-out $(CFLAGS_GCOV), $(c_flags)) $(cflags-display) -S -o /dev/null -x c /dev/null -include $<; touch $@
>> diff --git a/drivers/gpu/drm/xe/tests/xe_rtp_test.c b/drivers/gpu/drm/xe/tests/xe_rtp_test.c
>> index ad917638d088..a5ec9ae22156 100644
>> --- a/drivers/gpu/drm/xe/tests/xe_rtp_test.c
>> +++ b/drivers/gpu/drm/xe/tests/xe_rtp_test.c
>> @@ -57,7 +57,7 @@ static const struct rtp_test_case cases[] = {
>>  		.entries = (const struct xe_rtp_entry[]) {
>>  			{ XE_RTP_NAME("basic-1"),
>>  			  XE_RTP_RULES(FUNC(match_yes)),
>> -			  XE_RTP_ACTIONS(SET(REGULAR_REG1, REG_BIT(1)))
>> +			  XE_RTP_ACTIONS(SET(REGULAR_REG1, REG_BIT(0)))
>
>Ah, this was changed earlier in the series.

yeah... I noticed the kunit regression just before submitting and ended up
squashing the fix in the wrong place.

thanks
Lucas De Marchi


More information about the Intel-xe mailing list