On 4 July 2017 at 07:40, Chih-Wei Huang <cwhuang at android-x86.org> wrote: > 2017-06-12 17:50 GMT+08:00 Michel Dänzer <michel at daenzer.net>: >> From: Xiaojie Yuan <Xiaojie.Yuan at amd.com> >> >> v2: fix an off by one error and leading white spaces >> v3: use thread safe strtok_r(); initialize len before calling getline(); >> change printf() to drmMsg(); add initial amdgpu.ids >> v4: integrate some recent internal changes, including format changes >> v5: fix line number for empty/commented lines; realloc to save memory; >> indentation changes >> v6: remove a line error >> v7: [Michel Dänzer] >> * Move amdgpu.ids to new data directory >> * Remove placeholder entries from amdgpu.ids >> * Set libdrmdatadir variable in configure.ac instead of Makefile.am >> [Emil Velikov] >> * Use isblank() instead of open-coding it [Emil Velikov] >> * Don't leak asic_id_table memory if realloc fails [Emil Velikov] >> * Check and bump table_max_size at the beginning of the while loop [Emil >> Velikov] >> * Initialize table_max_size to the number of entries in data/amdgpu.ids >> >> Reviewed-by: Junwei Zhang <Jerry.Zhang at amd.com> >> Signed-off-by: Samuel Li <Samuel.Li at amd.com> >> Signed-off-by: Michel Dänzer <michel.daenzer at amd.com> >> --- >> Makefile.am | 1 + >> amdgpu/Makefile.am | 6 ++ >> amdgpu/Makefile.sources | 2 +- >> amdgpu/amdgpu_asic_id.c | 219 +++++++++++++++++++++++++++++++++++++++++++++++ >> amdgpu/amdgpu_asic_id.h | 165 ----------------------------------- >> amdgpu/amdgpu_device.c | 28 ++++-- >> amdgpu/amdgpu_internal.h | 10 +++ >> configure.ac | 4 + >> data/Makefile.am | 23 +++++ >> data/amdgpu.ids | 159 ++++++++++++++++++++++++++++++++++ >> 10 files changed, 444 insertions(+), 173 deletions(-) >> create mode 100644 amdgpu/amdgpu_asic_id.c >> delete mode 100644 amdgpu/amdgpu_asic_id.h >> create mode 100644 data/Makefile.am >> create mode 100644 data/amdgpu.ids >> >> diff --git a/Makefile.am b/Makefile.am >> index dfb8fcdb..7b86214e 100644 >> --- a/Makefile.am >> +++ b/Makefile.am >> @@ -109,6 +109,7 @@ SUBDIRS = \ >> $(TEGRA_SUBDIR) \ >> $(VC4_SUBDIR) \ >> $(ETNAVIV_SUBDIR) \ >> + data \ >> tests \ >> $(MAN_SUBDIR) >> >> diff --git a/amdgpu/Makefile.am b/amdgpu/Makefile.am >> index cf7bc1ba..3444883f 100644 >> --- a/amdgpu/Makefile.am >> +++ b/amdgpu/Makefile.am >> @@ -30,6 +30,12 @@ AM_CFLAGS = \ >> $(PTHREADSTUBS_CFLAGS) \ >> -I$(top_srcdir)/include/drm >> >> +libdrmdatadir = @libdrmdatadir@ >> +ASIC_ID_TABLE_NUM_ENTRIES := $(shell egrep -ci '^[0-9a-f]{4},.*[0-9a-f]+,' \ >> + $(top_srcdir)/data/amdgpu.ids) >> +AM_CPPFLAGS = -DAMDGPU_ASIC_ID_TABLE=\"${libdrmdatadir}/amdgpu.ids\" \ >> + -DAMDGPU_ASIC_ID_TABLE_NUM_ENTRIES=$(ASIC_ID_TABLE_NUM_ENTRIES) > > Unfortunately this patch breaks Android build > since the two macros are not defined. > > Anyone is working on a fix? > If not, I'll try to provide one. > Please send a patch. I doubt many of the AMD devs have an Android setup. Do ensure that the amdgpu.ids file is installed and accessible. JFYI: a similar work is coming on the radeon side, so keep an eye open. Thanks Emil