Android port of intel-gpu-tools
PATCH 1/1 Android port of intel-gpu-tools
Added support for Android. Changes include fixes for compilation issues
related to Android using an older version of GCC compiler (ver 4.3.3) while the latest version of intel-gpu-tools confirms to GCC ver 4.5.2 (C99 standard functions), using functions like getline(). Fixed such functions, header dependencies for android and added an Android.mk file.
--- Android.mk | 528 ++++++++++++++++++++++++++++++++++++++++++++ lib/intel_drm.c | 6 +- lib/intel_mmio.c | 4 + lib/intel_pci.c | 4 + tools/intel_decode.c | 10 + tools/intel_dump_decode.c | 14 +- tools/intel_error_decode.c | 14 ++ tools/intel_gpu_top.c | 6 +- tools/intel_reg_write.c | 2 + 9 files changed, 584 insertions(+), 4 deletions(-) create mode 100644 Android.mk
Android.mk new file +528 -0
@@ -0,0 +1,528 @@ +LOCAL_PATH := $(call my-dir) +include $(CLEAR_VARS) + +LOCAL_SRC_FILES := \ + tools/intel_reg_write.c \ + lib/intel_pci.c \ + lib/intel_gpu_tools.h \ + tools/intel_reg.h \ + lib/intel_batchbuffer.h \ + lib/intel_batchbuffer.c \ + lib/intel_reg_map.c \ + lib/intel_mmio.c \ + tools/intel_chipset.h + + +LOCAL_C_INCLUDES += \ + $(LOCAL_PATH)/lib \ + $(TOPDIR)hardware/intel/libdrm/include/drm \ + $(TOPDIR)hardware/intel/libdrm/intel \ + $(LOCAL_PATH)/../libpciaccess/include/ + +LOCAL_CFLAGS += -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1 +LOCAL_CFLAGS += -DANDROID + +LOCAL_MODULE := intel_reg_write +LOCAL_MODULE_TAGS := optional + +LOCAL_SHARED_LIBRARIES := libpciaccess \ + libdrm \ + libdrm_intel + +include $(BUILD_EXECUTABLE) + +#================ +include $(CLEAR_VARS) + +LOCAL_SRC_FILES := \ + tools/intel_reg_read.c \ + lib/intel_pci.c \ + lib/intel_gpu_tools.h \ + tools/intel_reg.h \ + lib/intel_batchbuffer.h \ + lib/intel_batchbuffer.c \ + lib/intel_reg_map.c \ + lib/intel_mmio.c \ + tools/intel_chipset.h + + +LOCAL_C_INCLUDES += \ + $(LOCAL_PATH)/lib \ + $(TOPDIR)hardware/intel/libdrm/include/drm \ + $(TOPDIR)hardware/intel/libdrm/intel \ + $(LOCAL_PATH)/../libpciaccess/include/ + +LOCAL_CFLAGS += -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1 +LOCAL_CFLAGS += -DANDROID + + +LOCAL_MODULE := intel_reg_read +LOCAL_MODULE_TAGS := optional + +LOCAL_SHARED_LIBRARIES := libpciaccess \ + libdrm \ + libdrm_intel + +include $(BUILD_EXECUTABLE) + +#================ +include $(CLEAR_VARS) + +LOCAL_SRC_FILES := \ + tools/intel_disable_clock_gating.c \ + lib/intel_pci.c \ + lib/intel_gpu_tools.h \ + tools/intel_reg.h \ + lib/intel_batchbuffer.h \ + lib/intel_batchbuffer.c \ + lib/intel_mmio.c \ + tools/intel_chipset.h + + +LOCAL_C_INCLUDES += \ + $(LOCAL_PATH)/lib \ + $(TOPDIR)hardware/intel/libdrm/include/drm \ + $(TOPDIR)hardware/intel/libdrm/intel \ + $(LOCAL_PATH)/../libpciaccess/include/ + +LOCAL_CFLAGS += -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1 +LOCAL_CFLAGS += -DANDROID + + +LOCAL_MODULE := intel_disable_clock_gating +LOCAL_MODULE_TAGS := optional + +LOCAL_SHARED_LIBRARIES := libpciaccess \ + libdrm \ + libdrm_intel + +include $(BUILD_EXECUTABLE) + +#================ +include $(CLEAR_VARS) + +LOCAL_SRC_FILES := \ + tools/intel_audio_dump.c \ + lib/intel_pci.c \ + lib/intel_gpu_tools.h \ + tools/intel_reg.h \ + lib/intel_batchbuffer.h \ + lib/intel_batchbuffer.c \ + lib/intel_mmio.c \ + tools/intel_chipset.h + + +LOCAL_C_INCLUDES += \ + $(LOCAL_PATH)/lib \ + $(TOPDIR)hardware/intel/libdrm/include/drm \ + $(TOPDIR)hardware/intel/libdrm/intel \ + $(LOCAL_PATH)/../libpciaccess/include/ + +LOCAL_CFLAGS += -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1 +LOCAL_CFLAGS += -DANDROID + + +LOCAL_MODULE := intel_audio_dump +LOCAL_MODULE_TAGS := optional + +LOCAL_SHARED_LIBRARIES := libpciaccess \ + libdrm \ + libdrm_intel + +include $(BUILD_EXECUTABLE) + +#================ +include $(CLEAR_VARS) + +LOCAL_SRC_FILES := \ + tools/intel_backlight.c \ + lib/intel_pci.c \ + lib/intel_gpu_tools.h \ + tools/intel_reg.h \ + lib/intel_batchbuffer.h \ + lib/intel_batchbuffer.c \ + lib/intel_mmio.c \ + tools/intel_chipset.h + + +LOCAL_C_INCLUDES += \ + $(LOCAL_PATH)/lib \ + $(TOPDIR)hardware/intel/libdrm/include/drm \ + $(TOPDIR)hardware/intel/libdrm/intel \ + $(LOCAL_PATH)/../libpciaccess/include/ + +LOCAL_CFLAGS += -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1 +LOCAL_CFLAGS += -DANDROID + + +LOCAL_MODULE := intel_backlight +LOCAL_MODULE_TAGS := optional + +LOCAL_SHARED_LIBRARIES := libpciaccess \ + libdrm \ + libdrm_intel + +include $(BUILD_EXECUTABLE) + +#================ +include $(CLEAR_VARS) + +LOCAL_SRC_FILES := \ + tools/intel_bios_dumper.c \ + lib/intel_pci.c \ + lib/intel_gpu_tools.h \ + tools/intel_reg.h \ + lib/intel_batchbuffer.h \ + lib/intel_batchbuffer.c \ + lib/intel_mmio.c \ + tools/intel_chipset.h + + +LOCAL_C_INCLUDES += \ + $(LOCAL_PATH)/lib \ + $(TOPDIR)hardware/intel/libdrm/include/drm \ + $(TOPDIR)hardware/intel/libdrm/intel \ + $(LOCAL_PATH)/../libpciaccess/include/ + +LOCAL_CFLAGS += -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1 +LOCAL_CFLAGS += -DANDROID + + +LOCAL_MODULE := intel_bios_dumper +LOCAL_MODULE_TAGS := optional + +LOCAL_SHARED_LIBRARIES := libpciaccess \ + libdrm \ + libdrm_intel + +include $(BUILD_EXECUTABLE) + +#================ +include $(CLEAR_VARS) + +LOCAL_SRC_FILES := \ + tools/intel_bios_reader.c \ + lib/intel_pci.c \ + lib/intel_gpu_tools.h \ + tools/intel_reg.h \ + lib/intel_batchbuffer.h \ + lib/intel_batchbuffer.c \ + lib/intel_mmio.c \ + tools/intel_chipset.h + + +LOCAL_C_INCLUDES += \ + $(LOCAL_PATH)/lib \ + $(TOPDIR)hardware/intel/libdrm/include/drm \ + $(TOPDIR)hardware/intel/libdrm/intel \ + $(LOCAL_PATH)/../libpciaccess/include/ + +LOCAL_CFLAGS += -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1 +LOCAL_CFLAGS += -DANDROID + + +LOCAL_MODULE := intel_bios_reader +LOCAL_MODULE_TAGS := optional + +LOCAL_SHARED_LIBRARIES := libpciaccess \ + libdrm \ + libdrm_intel + +include $(BUILD_EXECUTABLE) + +#================ +include $(CLEAR_VARS) + +LOCAL_SRC_FILES := \ + tools/intel_error_decode.c \ + lib/intel_pci.c \ + lib/intel_gpu_tools.h \ + tools/intel_reg.h \ + lib/intel_batchbuffer.h \ + lib/intel_batchbuffer.c \ + lib/intel_mmio.c \ + tools/intel_chipset.h \ + lib/instdone.h \ + lib/instdone.c \ + tools/intel_decode.h \ + tools/intel_decode.c \ + lib/intel_drm.c + + +LOCAL_C_INCLUDES += \ + $(LOCAL_PATH)/lib \ + $(TOPDIR)hardware/intel/libdrm/include/drm \ + $(TOPDIR)hardware/intel/libdrm/intel \ + $(LOCAL_PATH)/../libpciaccess/include/ + +LOCAL_CFLAGS += -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1 +LOCAL_CFLAGS += -DANDROID + + +LOCAL_MODULE := intel_error_decode +LOCAL_MODULE_TAGS := optional + +LOCAL_SHARED_LIBRARIES := libpciaccess \ + libdrm \ + libdrm_intel + +include $(BUILD_EXECUTABLE) + +#================ +include $(CLEAR_VARS) + +LOCAL_SRC_FILES := \ + tools/intel_gpu_top.c \ + lib/intel_pci.c \ + lib/intel_gpu_tools.h \ + tools/intel_reg.h \ + lib/intel_batchbuffer.h \ + lib/intel_batchbuffer.c \ + lib/intel_mmio.c \ + tools/intel_chipset.h \ + lib/instdone.h \ + lib/instdone.c \ + lib/intel_reg_map.c + + +LOCAL_C_INCLUDES += \ + $(LOCAL_PATH)/lib \ + $(TOPDIR)hardware/intel/libdrm/include/drm \ + $(TOPDIR)hardware/intel/libdrm/intel \ + $(LOCAL_PATH)/../libpciaccess/include/ + +LOCAL_CFLAGS += -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1 +LOCAL_CFLAGS += -DANDROID + + +LOCAL_MODULE := intel_gpu_top +LOCAL_MODULE_TAGS := optional + +LOCAL_SHARED_LIBRARIES := libpciaccess \ + libdrm \ + libdrm_intel + +include $(BUILD_EXECUTABLE) + +#================ +include $(CLEAR_VARS) + +LOCAL_SRC_FILES := \ + tools/intel_gpu_time.c \ + lib/intel_pci.c \ + lib/intel_gpu_tools.h \ + tools/intel_reg.h \ + lib/intel_batchbuffer.h \ + lib/intel_batchbuffer.c \ + lib/intel_mmio.c \ + tools/intel_chipset.h + + +LOCAL_C_INCLUDES += \ + $(LOCAL_PATH)/lib \ + $(TOPDIR)hardware/intel/libdrm/include/drm \ + $(TOPDIR)hardware/intel/libdrm/intel \ + $(LOCAL_PATH)/../libpciaccess/include/ + +LOCAL_CFLAGS += -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1 +LOCAL_CFLAGS += -DANDROID + + +LOCAL_MODULE := intel_gpu_time +LOCAL_MODULE_TAGS := optional + +LOCAL_SHARED_LIBRARIES := libpciaccess \ + libdrm \ + libdrm_intel + +include $(BUILD_EXECUTABLE) + +#================ +include $(CLEAR_VARS) + +LOCAL_SRC_FILES := \ + tools/intel_gtt.c \ + lib/intel_pci.c \ + lib/intel_gpu_tools.h \ + tools/intel_reg.h \ + lib/intel_batchbuffer.h \ + lib/intel_batchbuffer.c \ + lib/intel_mmio.c \ + tools/intel_chipset.h + + +LOCAL_C_INCLUDES += \ + $(LOCAL_PATH)/lib \ + $(TOPDIR)hardware/intel/libdrm/include/drm \ + $(TOPDIR)hardware/intel/libdrm/intel \ + $(LOCAL_PATH)/../libpciaccess/include/ + +LOCAL_CFLAGS += -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1 + +LOCAL_MODULE := intel_gtt +LOCAL_MODULE_TAGS := optional + +LOCAL_SHARED_LIBRARIES := libpciaccess \ + libdrm \ + libdrm_intel + +include $(BUILD_EXECUTABLE) + +#================ +include $(CLEAR_VARS) + +LOCAL_SRC_FILES := \ + tools/intel_stepping.c \ + lib/intel_pci.c \ + lib/intel_gpu_tools.h \ + tools/intel_reg.h \ + lib/intel_batchbuffer.h \ + lib/intel_batchbuffer.c \ + lib/intel_mmio.c \ + tools/intel_chipset.h + + +LOCAL_C_INCLUDES += \ + $(LOCAL_PATH)/lib \ + $(TOPDIR)hardware/intel/libdrm/include/drm \ + $(TOPDIR)hardware/intel/libdrm/intel \ + $(LOCAL_PATH)/../libpciaccess/include/ + +LOCAL_CFLAGS += -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1 +LOCAL_CFLAGS += -DANDROID + + +LOCAL_MODULE := intel_stepping +LOCAL_MODULE_TAGS := optional + +LOCAL_SHARED_LIBRARIES := libpciaccess \ + libdrm \ + libdrm_intel + +include $(BUILD_EXECUTABLE) + +#================ +include $(CLEAR_VARS) + +LOCAL_SRC_FILES := \ + tools/intel_reg_dumper.c \ + lib/intel_pci.c \ + lib/intel_gpu_tools.h \ + tools/intel_reg.h \ + lib/intel_batchbuffer.h \ + lib/intel_batchbuffer.c \ + lib/intel_mmio.c \ + tools/intel_chipset.h + + +LOCAL_C_INCLUDES += \ + $(LOCAL_PATH)/lib \ + $(TOPDIR)hardware/intel/libdrm/include/drm \ + $(TOPDIR)hardware/intel/libdrm/intel \ + $(LOCAL_PATH)/../libpciaccess/include/ + +LOCAL_CFLAGS += -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1 +LOCAL_CFLAGS += -DANDROID + + +LOCAL_MODULE := intel_reg_dumper +LOCAL_MODULE_TAGS := optional + +LOCAL_SHARED_LIBRARIES := libpciaccess \ + libdrm \ + libdrm_intel + +include $(BUILD_EXECUTABLE) + +#================ +include $(CLEAR_VARS) + +LOCAL_SRC_FILES := \ + tools/intel_reg_snapshot.c \ + lib/intel_pci.c \ + lib/intel_gpu_tools.h \ + tools/intel_reg.h \ + lib/intel_batchbuffer.h \ + lib/intel_batchbuffer.c \ + lib/intel_mmio.c \ + tools/intel_chipset.h + + +LOCAL_C_INCLUDES += \ + $(LOCAL_PATH)/lib \ + $(TOPDIR)hardware/intel/libdrm/include/drm \ + $(TOPDIR)hardware/intel/libdrm/intel \ + $(LOCAL_PATH)/../libpciaccess/include/ + +LOCAL_CFLAGS += -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1 + +LOCAL_MODULE := intel_reg_snapshot +LOCAL_MODULE_TAGS := optional + +LOCAL_SHARED_LIBRARIES := libpciaccess \ + libdrm \ + libdrm_intel + +include $(BUILD_EXECUTABLE) + +#================ +include $(CLEAR_VARS) + +LOCAL_SRC_FILES := \ + tools/forcewaked.c \ + lib/intel_pci.c \ + lib/intel_gpu_tools.h \ + tools/intel_reg.h \ + lib/intel_batchbuffer.h \ + lib/intel_batchbuffer.c \ + lib/intel_mmio.c \ + tools/intel_chipset.h \ + lib/intel_reg_map.c + + +LOCAL_C_INCLUDES += \ + $(LOCAL_PATH)/lib \ + $(TOPDIR)hardware/intel/libdrm/include/drm \ + $(TOPDIR)hardware/intel/libdrm/intel \ + $(LOCAL_PATH)/../libpciaccess/include/ + +LOCAL_CFLAGS += -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1 +LOCAL_CFLAGS += -DANDROID + + +LOCAL_MODULE := forcewaked +LOCAL_MODULE_TAGS := optional + +LOCAL_SHARED_LIBRARIES := libpciaccess \ + libdrm \ + libdrm_intel + +include $(BUILD_EXECUTABLE) + +#================ +include $(CLEAR_VARS) + +LOCAL_SRC_FILES := \ + lib/intel_gpu_tools.h \ + tools/intel_reg_checker.c \ + lib/intel_pci.c \ + lib/intel_mmio.c + + +LOCAL_C_INCLUDES += \ + $(LOCAL_PATH)/lib \ + $(TOPDIR)hardware/intel/libdrm/include/drm \ + $(TOPDIR)hardware/intel/libdrm/intel \ + $(LOCAL_PATH)/../libpciaccess/include/ + +LOCAL_CFLAGS += -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1 +LOCAL_CFLAGS += -DANDROID + + +LOCAL_MODULE := intel_reg_checker +LOCAL_MODULE_TAGS := optional + +LOCAL_SHARED_LIBRARIES := libpciaccess + +include $(BUILD_EXECUTABLE) +
lib/intel_drm.c +5 -1
@@ -25,7 +25,7 @@* */ -#include "config.h" +#include "../config.h" #include <unistd.h> #include <stdlib.h>
@@ -35,7 +35,11 @@#include <err.h> #include <assert.h> #include <sys/ioctl.h> +#ifdef ANDROID +#include <fcntl.h> +#else #include <sys/fcntl.h> +#endif #include <sys/stat.h> #include <sys/mman.h> #ifdef HAVE_STRUCT_SYSINFO_TOTALRAM
lib/intel_mmio.c +4 -0
@@ -38,7 +38,11 @@#include <err.h> #include <assert.h> #include <sys/ioctl.h> +#ifdef ANDROID +#include <fcntl.h> +#else #include <sys/fcntl.h> +#endif #include <sys/stat.h> #include <sys/mman.h>
lib/intel_pci.c +4 -0
@@ -33,7 +33,11 @@#include <err.h> #include <assert.h> #include <sys/ioctl.h> +#ifdef ANDROID +#include <fcntl.h> +#else #include <sys/fcntl.h> +#endif #include <sys/stat.h> #include <sys/mman.h>
tools/intel_decode.c +10 -0
@@ -198,7 +198,12 @@ decode_mi(uint32_t *data, int count, uint32_t hw_offset, int *failures)if ((data[0 ] &0x1f800000 ) >>23 == opcodes_mi[opcode].opcode) {instr_out (data, hw_offset,0 ,"%s\n" , opcodes_mi[opcode].name); +#ifdef ANDROID +int i; +for (i =1 ; i < len; i++) { +#else for (int i =1 ; i < len; i++) { +#endif if (i >= count)BUFFER_FAIL (count, len, opcodes_mi[opcode].name);instr_out (data, hw_offset, i,"dword %d\n" , i);
@@ -1164,7 +1169,12 @@ decode_3d_1d(uint32_t *data, int count,break ;case 2 :instr_out (data, hw_offset, i,"S2: texcoord formats: " ); +#ifdef ANDROID +int tex_num; +for (tex_num =0 ; tex_num <8 ; tex_num++) { +#else for (int tex_num =0 ; tex_num <8 ; tex_num++) { +#endif switch ((data[i]>>tex_num*4 )&0xf ) {case 0 :fprintf (out,"%i=2D " , tex_num);break ;case 1 :fprintf (out,"%i=3D " , tex_num);break ;
tools/intel_dump_decode.c +12 -2
@@ -67,6 +67,10 @@ read_data_file(uint32_t devid, const char * filename)FILE *file;uint32_t *data =NULL ;int data_size =0 , count =0 , line_number =0 , matched; +#ifdef ANDROID +char line[1024 ]; +size_t line_size =1024 ; +#else char *line =NULL ;size_t line_size;uint32_t offset, value;
@@ -82,9 +86,15 @@ read_data_file(uint32_t devid, const char * filename) filename, strerror (errno));exit (1 ); } - +#ifdef ANDROID +while (fgets (line, line_size, file) !=0 ) { + line[strcspn (line,"\n" )] ='\0' ; +if (line[0 ] =='\0' )continue ; +#else while (getline (&line, &line_size, file) >0 ) { - line_number++; +#endif + + line_number++; matched =sscanf (line,"%08x : %08x" , &offset, &value);if (matched !=2 ) {
tools/intel_error_decode.c +14 -0
@@ -280,15 +280,27 @@ read_data_file (FILE *file)uint32_t *data =NULL ;long long unsigned fence;int data_size =0 , count =0 , line_number =0 , matched; +#ifdef ANDROID +char line[1024 ]; +size_t line_size =1024 ; +#else char *line =NULL ;size_t line_size; +#endif uint32_t offset, value;uint32_t gtt_offset =0 , new_gtt_offset;char *buffer_type[2 ] = {"ringbuffer" ,"batchbuffer" };char *ring_name =NULL ;int is_batch =1 ; +#ifdef ANDROID +while (fgets (line, line_size, file) !=0 ) { + line[strcspn (line,"\n" )] ='\0' ; +if (line[0 ] =='\0' )continue ; +#else while (getline (&line, &line_size, file) >0 ) { +#endif +char *dashes; line_number++;
@@ -404,7 +416,9 @@ read_data_file (FILE *file) }free (data); +#ifndef ANDROID free (line); +#endif free (ring_name); }
tools/intel_gpu_top.c +5 -1
@@ -27,7 +27,7 @@* */ -#include "config.h" +#include "../config.h" #include <unistd.h> #include <stdlib.h>
@@ -602,10 +602,14 @@ int main(int argc, char **argv)/* Limit the number of lines printed to the terminal height so the * most important info (at the top) will stay on screen. */ unsigned short int max_lines =-1 ; +#ifndef ANDROID struct winsize ws;if (ioctl (0 ,TIOCGWINSZ , &ws) !=-1 ) max_lines = ws.ws_row -6 ;/* exclude header lines */ if (max_lines >= num_instdone_bits) +// FIXME: ioctl-types.h still does not exist in Android. Hard code + // the max_lines value for now (winsize is part of ioctl-types.h +#endif max_lines = num_instdone_bits; t2 =gettime ();
tools/intel_reg_write.c +2 -0
@@ -25,6 +25,8 @@* */ +#include "../config.h" +#include <unistd.h> #include <stdlib.h> #include <stdio.h>
Signature · 1 line
1.7.4.1
Quoted 7 lines · Sateesh Kavuri
Added support for Android. Changes include fixes for compilation issues
related to Android using an older version of GCC compiler (ver 4.3.3) while the latest version of intel-gpu-tools confirms to GCC ver 4.5.2 (C99 standard functions), using functions likegetline(). Fixed such functions, header dependencies for android and added an Android.mk file.Signed-off-by Sateesh Kavuri <[email protected]>
A few comments
- It looks like you need a completely separate makefile for android. Is there no way to let the automake tools generate that somehow? Because this simply won't scale.
- There's too much ANDRIOD #ifdef'ery in the code. Either switch to a construct that works on all platforms or extract things into a little helper functions (like the get_total_ram helper that has recently been ported to Solaris).
- You don't seem to touch the testsuite, and I think you want it on Andriod, too.
Added xorg-devel to cc, maybe someone else has already tried this with a different package, my buildsystem fu is not up to this.
Yours, Daniel
Signature · 3 lines
Daniel Vetter Mail: [email protected] Mobile: +41 (0)79 365 57 48
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Quoted 19 lines · Daniel Vetter
Quoted 7 lines · Sateesh Kavuri
Added support for Android. Changes include fixes for compilation issues
related to Android using an older version of GCC compiler (ver 4.3.3) while the latest version of intel-gpu-tools confirms to GCC ver 4.5.2 (C99 standard functions), using functions likegetline(). Fixed such functions, header dependencies for android and added an Android.mk file.Signed-off-by Sateesh Kavuri <[email protected]>A few comments
- It looks like you need a completely separate makefile for android. Is there no way to let the automake tools generate that somehow? Because this simply won't scale.- There's too much ANDRIOD #ifdef'ery in the code. Either switch to a construct that works on all platforms or extract things into a little helper functions (like the
get_total_ramhelper that has recently been ported to Solaris).
Quoted 7 lines
- You don't seem to touch the testsuite, and I think you want it on Andriod, too.
Added xorg-devel to cc, maybe someone else has already tried this with a different package, my buildsystem fu is not up to this.
Yours, Daniel
Daniel, the Android.mk's are the curse of every project that is ported to Android. Android has it's own build system, and those makefiles can't be generated with autotools. This was a contentious issue when Chia-I Wu and I ported Mesa to Android and led to a discussion [1] on mesa-dev. Below is quoted my key email from that discussion (the Dan I'm speaking to is a Debian maitainer).
[1] http://article.gmane.org/gmane.comp.video.mesa3d.devel/28881/match=add+toplevel+android+mk
Quoted 18 lines
To address Dan's questions, the Android build cannot be fitted into autoconf or configs/android. I explored this option, and discovered that it was impossible. The Android build system is... well... interesting. Allow me to explain.
The entirety of the Android project --- libc, webkit, the window manager, *everything* --- exists in a single source tree [1]. And that source tree is built with a single, non-recursive invocation of make. Every time I say that, I find it hard to believe myself, so I'll say it again: The entirety of the Android OS, all core libraries and apps, are built with a single, non-recursive invocation of make. (The kernel is the special exception to this all-encompassing build). The final build artifact is a bootable iso image.
[1] http://android.git.kernel.org/
Given this unified design of the Android source tree and build process, it requires system components, such as Mesa, to be integrated into its build system. If Mesa is going to support Android, the Android.mk's are necessary.
Quoted 7 lines
To address another concern of Dan's, this will not add another way to configure the Mesa build. Android handles the system's build configuration in a single location which is outside of Mesa.
I'm aware that the extra set of makefiles is unwelcome, but their presence will be innocuous. The only people that will need to touch them are those maintaining the Android build.
- ----
Chad Versace
[email protected]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iQIcBAEBAgAGBQJPFGubAAoJEAIvNt057x8iTckQAKf3DPB3zAnVwEPcmad3BacJ +3SfLISJUJPxoNpROYXiM/50bti/xir6x68Hez3jryzgFpSUTo2jpdXT2CalXSeN ITdScopl4p0gNu4zxXiWzIv5445RLswkf1IArvL25LABRnQ1xSLdp6qTUZcfZXTa bpzPM27p7k2FNvWN9z0vwNI8ebtMAwapvsb2lLyFeIfiB2ldQJIsclP1iOMylRlS wSSEdqmWm7OTzpnocAaptCFDeolNplN7zvBfzMs9/AOCs1miKo+nUlf0GUf1CN0V xuLrIf4UZn8sNLlsw5Mnc3uBIT5q8NR/rz60IswDKgm/W4pJbjRViaaecNjpbuvL tzUE99CUtSmK/MY6TiSqlgTzgYRFk1qGu9bGxhbWyJE76gAjOX7A1OL+DsPj+wgR DfAEKfcfFsUCDCkm3604uhl6hJauu3lDEVxL/6jAm/jMLzvwaxBPoMdS6QFtQ3QR tTlZ4Y13jDnp+SOar3eLjgDE+pcdsFIHaFZ0ZxYEjgCHGVhP4ye3BaqMtMopwths HcscB47/xz4y4CmEgBvDmcuPaxw6rgNd9d8543zvWlheb/dGH9yNJcoLBq0dz3tW P/m0A+Hnv2gfLaopbPZIAPUKdR/iqA4cgoSKQq7OI46He4CHApatPapunL4IKCpU eSulLcm0Dqpc6fz2zL1B
=Xlzm
-----END PGP SIGNATURE-----
Quoted 31 lines · Chad Versace
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1Quoted 19 lines · Daniel Vetter
Quoted 7 lines · Sateesh Kavuri
Added support for Android. Changes include fixes for compilation issues
related to Android using an older version of GCC compiler (ver 4.3.3) while the latest version of intel-gpu-tools confirms to GCC ver 4.5.2 (C99 standard functions), using functions likegetline(). Fixed such functions, header dependencies for android and added an Android.mk file.Signed-off-by Sateesh Kavuri <[email protected]>A few comments
- It looks like you need a completely separate makefile for android. Is there no way to let the automake tools generate that somehow? Because this simply won't scale.- There's too much ANDRIOD #ifdef'ery in the code. Either switch to a construct that works on all platforms or extract things into a little helper functions (like the
get_total_ramhelper that has recently been ported to Solaris).Quoted 7 lines
- You don't seem to touch the testsuite, and I think you want it on Andriod, too.
Added xorg-devel to cc, maybe someone else has already tried this with a different package, my buildsystem fu is not up to this.
Yours, Daniel
Quoted 8 lines
Daniel, the Android.mk's are the curse of every project that is ported to Android. Android has it's own build system, and those makefiles can't be generated with autotools. This was a contentious issue when Chia-I Wu and I ported Mesa to Android and led to a discussion [1] on mesa-dev. Below is quoted my key email from that discussion (the Dan I'm speaking to is a Debian maitainer).
[1] http://article.gmane.org/gmane.comp.video.mesa3d.devel/28881/match=add+toplevel+android+mk
Meh.
I've just read about androgenizer:
http://cgit.collabora.com/git/user/derek/androgenizer.git/
Would that be a useful to at least generate the Android.mk in a sensible fashion? I don't have clue about this ...
Otherwise we'll just stick Android.mk into the root dir and I'll forget about this (and probably break it every time I change something). -Daniel
Signature · 3 lines
Daniel Vetter Mail: [email protected] Mobile: +41 (0)79 365 57 48
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Quoted 41 lines · Daniel Vetter
Quoted 31 lines · Chad Versace
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1Quoted 19 lines · Daniel Vetter
Quoted 7 lines · Sateesh Kavuri
Added support for Android. Changes include fixes for compilation issues
related to Android using an older version of GCC compiler (ver 4.3.3) while the latest version of intel-gpu-tools confirms to GCC ver 4.5.2 (C99 standard functions), using functions likegetline(). Fixed such functions, header dependencies for android and added an Android.mk file.Signed-off-by Sateesh Kavuri <[email protected]>A few comments
- It looks like you need a completely separate makefile for android. Is there no way to let the automake tools generate that somehow? Because this simply won't scale.- There's too much ANDRIOD #ifdef'ery in the code. Either switch to a construct that works on all platforms or extract things into a little helper functions (like the
get_total_ramhelper that has recently been ported to Solaris).Quoted 7 lines
- You don't seem to touch the testsuite, and I think you want it on Andriod, too.
Added xorg-devel to cc, maybe someone else has already tried this with a different package, my buildsystem fu is not up to this.
Yours, Daniel
Quoted 8 lines
Daniel, the Android.mk's are the curse of every project that is ported to Android. Android has it's own build system, and those makefiles can't be generated with autotools. This was a contentious issue when Chia-I Wu and I ported Mesa to Android and led to a discussion [1] on mesa-dev. Below is quoted my key email from that discussion (the Dan I'm speaking to is a Debian maitainer).
[1] http://article.gmane.org/gmane.comp.video.mesa3d.devel/28881/match=add+toplevel+android+mk
Quoted 7 lines
Meh.
I've just read about androgenizer:
http://cgit.collabora.com/git/user/derek/androgenizer.git/>
Would that be a useful to at least generate the Android.mk in a sensible fashion? I don't have clue about this ...
Never heard of androgenizer, but looks interesting. When the Mesa build gets its overdue conversion to autotools, I'll have to give it a try.
Quoted 2 lines
Otherwise we'll just stick Android.mk into the root dir and I'll forget about this (and probably break it every time I change something).
Hah! That's expected if the Android maintainers aren't vigilant.
We've mostly fixed that problem in Mesa (when people change the "real" makefile, the Android build breaks) by forcing the two build systems to share common makefiles when sensible. But I don't suggest that intel-gpu-tools take that approach unless build-breakage problems become painful.
- ----
Chad Versace
[email protected]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iQIcBAEBAgAGBQJPFHIjAAoJEAIvNt057x8ilVAQALd5Z1TSD/SfNBGp1NRTinnz HFN17Zp56apz2bDQgC1hftkJJXNZW83IPm9lseBvpfeKLVLfxkIsp6uklPbVputK YJdI4G7TxDWpjDxHdh/tA45q+5H6hrtsPOBcnQwfDGq99DrAI/Pt6fZAO4c/0fbe ZYnQ42DGeAkHK/XNxvF7zrkc9gJqwYhpUp8EyuguilYmnzyMkwR2SGu8hbDGRTmc L0dNRuArZaaaTnFWLKAWPjgTZVXg9Ah2ZEawWOlvUNmygtOoqGqtcgIsRWdxr4QR 6hRTcbmiwc6CdmR1QsdL+hHs7MPAq1Kvj5CQjjNmCefkZBleu2W7EOnyLXZmfNDM MbUOJ79JesS7z8wEkwLgcYgas9Qj+vaHw7tWWaqLxvxXEldFCcfub+Xjf1+Vi2X4 MoZtGAyNQQ6KHPpPS/ObI4D1Ati7eQy4ZiN7ILRgjmPWj4vy+RVwlwNbC7C9yLe2 kugwJGzRePFSl6Sagf1kFymKyK0MzIfquN/7vNh/2+Z/AOR6yISPqNkoxQveXk06 PK/ee4DngWcsUxuDpYcc1/NgNLccRfddyNINxCcbz2OuwQGbhRSa9Y8dpxJeXSIR yaElS7FFUXCaebeXur3U9KsVq+s9mDpBRRZjaPaSsoss2tWb/F1wz93Yr96QUIIq FOZrSKKdOxM8Q+Fj0SqP
=REOX
-----END PGP SIGNATURE-----
A message that is not in the archive (sent off-list or not yet received): 4F147225.3000604-VuQAYsv1563Yd54FQh9/[email protected]
Hi,
Quoted 9 lines · Chad Versace
Quoted 5 lines · Daniel Vetter
I've just read about androgenizer:
http://cgit.collabora.com/git/user/derek/androgenizer.git/>
Would that be a useful to at least generate the Android.mk in a sensible fashion? I don't have clue about this ...Never heard of androgenizer, but looks interesting. When the Mesa build gets its overdue conversion to autotools, I'll have to give it a try.
androgenizer works just fine for us -- we use it on all the Telepathy, GStreamer and PulseAudio packages and it seems to work great*.
Cheers,
Daniel
*: Things I never thought I'd say: in this case, 'great' means 'builds and works on Android'.
_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel
Quoted 3 lines · Daniel Vetter
Otherwise we'll just stick Android.mk into the root dir and I'll forget about this (and probably break it every time I change something).
I vote for this approach. It would only be used by android build, so when it breaks, we'll be able to notice it pretty shortly and fix it.
Signature · 2 lines
Eugeni Dodonov <http://eugeni.dodonov.net/>
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 5 lines · Sateesh Kavuri
Added support for Android. Changes include fixes for compilation issues
related to Android using an older version of GCC compiler (ver 4.3.3) while the latest version of intel-gpu-tools confirms to GCC ver 4.5.2 (C99 standard functions), using functions likegetline(). Fixed such functions, header dependencies for android and added an Android.mk file.
I can understand avoiding C99 functions that android doesn't have, but this kind of thing:
tools/intel_decode.c decode_mi(uint32_t *data, int count, uint32_t hw_offset, int *failures) · line 206
Quoted 6 lines
tools/intel_decode.c +5
-0+#ifdef ANDROID +int i; +for (i =1 ; i< len; i++) { +#else for (int i =1 ; i< len; i++) { +#endif
is silly. Does gcc -std=c99 on android seriously not cope with this?
- ajax
Quoted 19 lines
-----Original Message-----
From: Adam Jackson [mailto:[email protected]]
Sent: Tuesday, January 10, 2012 8:34 PM
To: Kavuri, Sateesh
Cc: [email protected]
Subject: Re: [Intel-gfx] [PATCH] Android port of intel-gpu-toolsQuoted 5 lines · Sateesh Kavuri
Added support for Android. Changes include fixes for compilation issues
related to Android using an older version of GCC compiler (ver 4.3.3) while the latest version of intel-gpu-tools confirms to GCC ver 4.5.2 (C99 standard functions), using functions likegetline(). Fixed such functions, header dependencies for android and added an Android.mk file.I can understand avoiding C99 functions that android doesn't have, but this kind of thing:
Quoted 8 lines
tools/intel_decode.c decode_mi(uint32_t *data, int count, uint32_t hw_offset, int *failures) · line 206
Quoted 6 lines
tools/intel_decode.c +5
-0+#ifdef ANDROID +int i; +for (i =1 ; i< len; i++) { +#else for (int i =1 ; i< len; i++) { +#endif is silly. Does gcc -std=c99 on android seriously not cope with this?
Yes, -std=c99 would help to get rid of such silly checks (would fix it). Continued this, since there has to be a ANDROID definition for checks like fcntl.h header path
Quoted 2 lines
- ajax
--
Sateesh
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Quoted 28 lines · Sateesh
Quoted 19 lines
-----Original Message-----
From: Adam Jackson [mailto:[email protected]]
Sent: Tuesday, January 10, 2012 8:34 PM
To: Kavuri, Sateesh
Cc: [email protected]
Subject: Re: [Intel-gfx] [PATCH] Android port of intel-gpu-toolsQuoted 5 lines · Sateesh Kavuri
Added support for Android. Changes include fixes for compilation issues
related to Android using an older version of GCC compiler (ver 4.3.3) while the latest version of intel-gpu-tools confirms to GCC ver 4.5.2 (C99 standard functions), using functions likegetline(). Fixed such functions, header dependencies for android and added an Android.mk file.I can understand avoiding C99 functions that android doesn't have, but this kind of thing:
Quoted 8 lines
tools/intel_decode.c decode_mi(uint32_t *data, int count, uint32_t hw_offset, int *failures) · line 206
Quoted 6 lines
tools/intel_decode.c +5
-0+#ifdef ANDROID +int i; +for (i =1 ; i< len; i++) { +#else for (int i =1 ; i< len; i++) { +#endif is silly. Does gcc -std=c99 on android seriously not cope with this?
Quoted 7 lines
Yes, -std=c99 would help to get rid of such silly checks (would fix it). Continued this, since there has to be a ANDROID definition for checks like
fcntl.hheader pathQuoted 2 lines
- ajax
--
Sateesh
I want to see the C99 workarounds removed.
In Mesa we enabled -std=c99 in the Android build with this hack:
# Use C99.
ifeq ($(LOCAL_CC),)
ifeq ($(LOCAL_IS_HOST_MODULE),true)
LOCAL_CC := $(HOST_CC) -std=c99
else
LOCAL_CC := $(TARGET_CC) -std=c99
endif
endif- ----
Chad Versace
[email protected]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iQIcBAEBAgAGBQJPFGVPAAoJEAIvNt057x8i+6MP/iX2T5Q9z4zeQB4LlgpNKUVO 5Y6Sl/ZC/AyfWFg1u188pPZvSi6jI86wvZg6MPULzP7NVBx/xG5bsexO0zqDRJ7l PLridgrxOzUbkreN5jzOI0vV+hVcHfJfuOz9YJ5WTq6LHskPpj/fd3sIbZJRJstg sGPEFU9Nfp2bVteE35ci4ASYPzdisO/O6sWB5RiDkUJRa+xvBm7NrzBeA4TbxD8f 8lRhKUAcmv1AFtFVJHOUoyL+UkjJXRiI19cSnAB6mr3r6Nf+NCvrN+Kp298ze3xM /VzLv0GdkmcmtPGzursd8VEEgWwWxWTC39QcURsQjf6+eHs57I77T6XC7YILfGOu bwMRqCSBygVo6MnCcNlzjCPNHATITgDvRbthSiN8tX2wcrndquNKD1+qBlpoFfVg d/m8TQD8UAravGkDWwmTxnFFeqXM9pktrTpk55gO+ZNQtkK5SbWtJ9F5O6Yn3trb 8opFiFi6rJdORzSV/4Ma8ySeTaWc7JnANzYaB4PXIJOTTTgUukX9ARWJqYIyRnj9 sBZdG1wrRt89Tlk7KGBQ7f3nXIpMwe9aLYmnajbd6xHMTnzXrEuBZ65r320uUXHo h+mba6lzJuow3TwcyudvjK5yKPmgQ7ZOV7DmT8wW2pwhVUcIjd4xxgEQsV4xKjLk SciBCELXKhdkHan8ucml
=fHSl
-----END PGP SIGNATURE-----
Quoted 544 lines · Sateesh Kavuri
Added support for Android. Changes include fixes for compilation issues
related to Android using an older version of GCC compiler (ver 4.3.3) while the latest version of intel-gpu-tools confirms to GCC ver 4.5.2 (C99 standard functions), using functions likegetline(). Fixed such functions, header dependencies for android and added an Android.mk file.Signed-off-by Sateesh Kavuri<[email protected]>--- Android.mk | 528 ++++++++++++++++++++++++++++++++++++++++++++ lib/intel_drm.c | 6 +- lib/intel_mmio.c | 4 + lib/intel_pci.c | 4 + tools/intel_decode.c | 10 + tools/intel_dump_decode.c | 14 +- tools/intel_error_decode.c | 14 ++ tools/intel_gpu_top.c | 6 +- tools/intel_reg_write.c | 2 + 9 files changed, 584 insertions(+), 4 deletions(-)create mode 100644 Android.mk
Android.mk new file +518
-0@@ -0,0 +1,528 @@ +LOCAL_PATH := $(call my-dir) +include $(CLEAR_VARS) + +LOCAL_SRC_FILES := \ + tools/intel_reg_write.c \ + lib/intel_pci.c \ + lib/intel_gpu_tools.h \ + tools/intel_reg.h \ + lib/intel_batchbuffer.h \ + lib/intel_batchbuffer.c \ + lib/intel_reg_map.c \ + lib/intel_mmio.c \ + tools/intel_chipset.h + + +LOCAL_C_INCLUDES += \ + $(LOCAL_PATH)/lib \ + $(TOPDIR)hardware/intel/libdrm/include/drm \ + $(TOPDIR)hardware/intel/libdrm/intel \ + $(LOCAL_PATH)/../libpciaccess/include/ + +LOCAL_CFLAGS += -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1 +LOCAL_CFLAGS += -DANDROID + +LOCAL_MODULE := intel_reg_write +LOCAL_MODULE_TAGS := optional + +LOCAL_SHARED_LIBRARIES := libpciaccess \ + libdrm \ + libdrm_intel + +include $(BUILD_EXECUTABLE) + +#================ +include $(CLEAR_VARS) + +LOCAL_SRC_FILES := \ + tools/intel_reg_read.c \ + lib/intel_pci.c \ + lib/intel_gpu_tools.h \ + tools/intel_reg.h \ + lib/intel_batchbuffer.h \ + lib/intel_batchbuffer.c \ + lib/intel_reg_map.c \ + lib/intel_mmio.c \ + tools/intel_chipset.h + + +LOCAL_C_INCLUDES += \ + $(LOCAL_PATH)/lib \ + $(TOPDIR)hardware/intel/libdrm/include/drm \ + $(TOPDIR)hardware/intel/libdrm/intel \ + $(LOCAL_PATH)/../libpciaccess/include/ + +LOCAL_CFLAGS += -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1 +LOCAL_CFLAGS += -DANDROID + + +LOCAL_MODULE := intel_reg_read +LOCAL_MODULE_TAGS := optional + +LOCAL_SHARED_LIBRARIES := libpciaccess \ + libdrm \ + libdrm_intel + +include $(BUILD_EXECUTABLE) + +#================ +include $(CLEAR_VARS) + +LOCAL_SRC_FILES := \ + tools/intel_disable_clock_gating.c \ + lib/intel_pci.c \ + lib/intel_gpu_tools.h \ + tools/intel_reg.h \ + lib/intel_batchbuffer.h \ + lib/intel_batchbuffer.c \ + lib/intel_mmio.c \ + tools/intel_chipset.h + + +LOCAL_C_INCLUDES += \ + $(LOCAL_PATH)/lib \ + $(TOPDIR)hardware/intel/libdrm/include/drm \ + $(TOPDIR)hardware/intel/libdrm/intel \ + $(LOCAL_PATH)/../libpciaccess/include/ + +LOCAL_CFLAGS += -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1 +LOCAL_CFLAGS += -DANDROID + + +LOCAL_MODULE := intel_disable_clock_gating +LOCAL_MODULE_TAGS := optional + +LOCAL_SHARED_LIBRARIES := libpciaccess \ + libdrm \ + libdrm_intel + +include $(BUILD_EXECUTABLE) + +#================ +include $(CLEAR_VARS) + +LOCAL_SRC_FILES := \ + tools/intel_audio_dump.c \ + lib/intel_pci.c \ + lib/intel_gpu_tools.h \ + tools/intel_reg.h \ + lib/intel_batchbuffer.h \ + lib/intel_batchbuffer.c \ + lib/intel_mmio.c \ + tools/intel_chipset.h + + +LOCAL_C_INCLUDES += \ + $(LOCAL_PATH)/lib \ + $(TOPDIR)hardware/intel/libdrm/include/drm \ + $(TOPDIR)hardware/intel/libdrm/intel \ + $(LOCAL_PATH)/../libpciaccess/include/ + +LOCAL_CFLAGS += -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1 +LOCAL_CFLAGS += -DANDROID + + +LOCAL_MODULE := intel_audio_dump +LOCAL_MODULE_TAGS := optional + +LOCAL_SHARED_LIBRARIES := libpciaccess \ + libdrm \ + libdrm_intel + +include $(BUILD_EXECUTABLE) + +#================ +include $(CLEAR_VARS) + +LOCAL_SRC_FILES := \ + tools/intel_backlight.c \ + lib/intel_pci.c \ + lib/intel_gpu_tools.h \ + tools/intel_reg.h \ + lib/intel_batchbuffer.h \ + lib/intel_batchbuffer.c \ + lib/intel_mmio.c \ + tools/intel_chipset.h + + +LOCAL_C_INCLUDES += \ + $(LOCAL_PATH)/lib \ + $(TOPDIR)hardware/intel/libdrm/include/drm \ + $(TOPDIR)hardware/intel/libdrm/intel \ + $(LOCAL_PATH)/../libpciaccess/include/ + +LOCAL_CFLAGS += -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1 +LOCAL_CFLAGS += -DANDROID + + +LOCAL_MODULE := intel_backlight +LOCAL_MODULE_TAGS := optional + +LOCAL_SHARED_LIBRARIES := libpciaccess \ + libdrm \ + libdrm_intel + +include $(BUILD_EXECUTABLE) + +#================ +include $(CLEAR_VARS) + +LOCAL_SRC_FILES := \ + tools/intel_bios_dumper.c \ + lib/intel_pci.c \ + lib/intel_gpu_tools.h \ + tools/intel_reg.h \ + lib/intel_batchbuffer.h \ + lib/intel_batchbuffer.c \ + lib/intel_mmio.c \ + tools/intel_chipset.h + + +LOCAL_C_INCLUDES += \ + $(LOCAL_PATH)/lib \ + $(TOPDIR)hardware/intel/libdrm/include/drm \ + $(TOPDIR)hardware/intel/libdrm/intel \ + $(LOCAL_PATH)/../libpciaccess/include/ + +LOCAL_CFLAGS += -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1 +LOCAL_CFLAGS += -DANDROID + + +LOCAL_MODULE := intel_bios_dumper +LOCAL_MODULE_TAGS := optional + +LOCAL_SHARED_LIBRARIES := libpciaccess \ + libdrm \ + libdrm_intel + +include $(BUILD_EXECUTABLE) + +#================ +include $(CLEAR_VARS) + +LOCAL_SRC_FILES := \ + tools/intel_bios_reader.c \ + lib/intel_pci.c \ + lib/intel_gpu_tools.h \ + tools/intel_reg.h \ + lib/intel_batchbuffer.h \ + lib/intel_batchbuffer.c \ + lib/intel_mmio.c \ + tools/intel_chipset.h + + +LOCAL_C_INCLUDES += \ + $(LOCAL_PATH)/lib \ + $(TOPDIR)hardware/intel/libdrm/include/drm \ + $(TOPDIR)hardware/intel/libdrm/intel \ + $(LOCAL_PATH)/../libpciaccess/include/ + +LOCAL_CFLAGS += -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1 +LOCAL_CFLAGS += -DANDROID + + +LOCAL_MODULE := intel_bios_reader +LOCAL_MODULE_TAGS := optional + +LOCAL_SHARED_LIBRARIES := libpciaccess \ + libdrm \ + libdrm_intel + +include $(BUILD_EXECUTABLE) + +#================ +include $(CLEAR_VARS) + +LOCAL_SRC_FILES := \ + tools/intel_error_decode.c \ + lib/intel_pci.c \ + lib/intel_gpu_tools.h \ + tools/intel_reg.h \ + lib/intel_batchbuffer.h \ + lib/intel_batchbuffer.c \ + lib/intel_mmio.c \ + tools/intel_chipset.h \ + lib/instdone.h \ + lib/instdone.c \ + tools/intel_decode.h \ + tools/intel_decode.c \ + lib/intel_drm.c + + +LOCAL_C_INCLUDES += \ + $(LOCAL_PATH)/lib \ + $(TOPDIR)hardware/intel/libdrm/include/drm \ + $(TOPDIR)hardware/intel/libdrm/intel \ + $(LOCAL_PATH)/../libpciaccess/include/ + +LOCAL_CFLAGS += -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1 +LOCAL_CFLAGS += -DANDROID + + +LOCAL_MODULE := intel_error_decode +LOCAL_MODULE_TAGS := optional + +LOCAL_SHARED_LIBRARIES := libpciaccess \ + libdrm \ + libdrm_intel + +include $(BUILD_EXECUTABLE) + +#================ +include $(CLEAR_VARS) + +LOCAL_SRC_FILES := \ + tools/intel_gpu_top.c \ + lib/intel_pci.c \ + lib/intel_gpu_tools.h \ + tools/intel_reg.h \ + lib/intel_batchbuffer.h \ + lib/intel_batchbuffer.c \ + lib/intel_mmio.c \ + tools/intel_chipset.h \ + lib/instdone.h \ + lib/instdone.c \ + lib/intel_reg_map.c + + +LOCAL_C_INCLUDES += \ + $(LOCAL_PATH)/lib \ + $(TOPDIR)hardware/intel/libdrm/include/drm \ + $(TOPDIR)hardware/intel/libdrm/intel \ + $(LOCAL_PATH)/../libpciaccess/include/ + +LOCAL_CFLAGS += -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1 +LOCAL_CFLAGS += -DANDROID + + +LOCAL_MODULE := intel_gpu_top +LOCAL_MODULE_TAGS := optional + +LOCAL_SHARED_LIBRARIES := libpciaccess \ + libdrm \ + libdrm_intel + +include $(BUILD_EXECUTABLE) + +#================ +include $(CLEAR_VARS) + +LOCAL_SRC_FILES := \ + tools/intel_gpu_time.c \ + lib/intel_pci.c \ + lib/intel_gpu_tools.h \ + tools/intel_reg.h \ + lib/intel_batchbuffer.h \ + lib/intel_batchbuffer.c \ + lib/intel_mmio.c \ + tools/intel_chipset.h + + +LOCAL_C_INCLUDES += \ + $(LOCAL_PATH)/lib \ + $(TOPDIR)hardware/intel/libdrm/include/drm \ + $(TOPDIR)hardware/intel/libdrm/intel \ + $(LOCAL_PATH)/../libpciaccess/include/ + +LOCAL_CFLAGS += -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1 +LOCAL_CFLAGS += -DANDROID + + +LOCAL_MODULE := intel_gpu_time +LOCAL_MODULE_TAGS := optional + +LOCAL_SHARED_LIBRARIES := libpciaccess \ + libdrm \ + libdrm_intel + +include $(BUILD_EXECUTABLE) + +#================ +include $(CLEAR_VARS) + +LOCAL_SRC_FILES := \ + tools/intel_gtt.c \ + lib/intel_pci.c \ + lib/intel_gpu_tools.h \ + tools/intel_reg.h \ + lib/intel_batchbuffer.h \ + lib/intel_batchbuffer.c \ + lib/intel_mmio.c \ + tools/intel_chipset.h + + +LOCAL_C_INCLUDES += \ + $(LOCAL_PATH)/lib \ + $(TOPDIR)hardware/intel/libdrm/include/drm \ + $(TOPDIR)hardware/intel/libdrm/intel \ + $(LOCAL_PATH)/../libpciaccess/include/ + +LOCAL_CFLAGS += -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1 + +LOCAL_MODULE := intel_gtt +LOCAL_MODULE_TAGS := optional + +LOCAL_SHARED_LIBRARIES := libpciaccess \ + libdrm \ + libdrm_intel + +include $(BUILD_EXECUTABLE) + +#================ +include $(CLEAR_VARS) + +LOCAL_SRC_FILES := \ + tools/intel_stepping.c \ + lib/intel_pci.c \ + lib/intel_gpu_tools.h \ + tools/intel_reg.h \ + lib/intel_batchbuffer.h \ + lib/intel_batchbuffer.c \ + lib/intel_mmio.c \ + tools/intel_chipset.h + + +LOCAL_C_INCLUDES += \ + $(LOCAL_PATH)/lib \ + $(TOPDIR)hardware/intel/libdrm/include/drm \ + $(TOPDIR)hardware/intel/libdrm/intel \ + $(LOCAL_PATH)/../libpciaccess/include/ + +LOCAL_CFLAGS += -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1 +LOCAL_CFLAGS += -DANDROID + + +LOCAL_MODULE := intel_stepping +LOCAL_MODULE_TAGS := optional + +LOCAL_SHARED_LIBRARIES := libpciaccess \ + libdrm \ + libdrm_intel + +include $(BUILD_EXECUTABLE) + +#================ +include $(CLEAR_VARS) + +LOCAL_SRC_FILES := \ + tools/intel_reg_dumper.c \ + lib/intel_pci.c \ + lib/intel_gpu_tools.h \ + tools/intel_reg.h \ + lib/intel_batchbuffer.h \ + lib/intel_batchbuffer.c \ + lib/intel_mmio.c \ + tools/intel_chipset.h + + +LOCAL_C_INCLUDES += \ + $(LOCAL_PATH)/lib \ + $(TOPDIR)hardware/intel/libdrm/include/drm \ + $(TOPDIR)hardware/intel/libdrm/intel \ + $(LOCAL_PATH)/../libpciaccess/include/ + +LOCAL_CFLAGS += -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1 +LOCAL_CFLAGS += -DANDROID + + +LOCAL_MODULE := intel_reg_dumper +LOCAL_MODULE_TAGS := optional + +LOCAL_SHARED_LIBRARIES := libpciaccess \ + libdrm \ + libdrm_intel + +include $(BUILD_EXECUTABLE) + +#================ +include $(CLEAR_VARS) + +LOCAL_SRC_FILES := \ + tools/intel_reg_snapshot.c \ + lib/intel_pci.c \ + lib/intel_gpu_tools.h \ + tools/intel_reg.h \ + lib/intel_batchbuffer.h \ + lib/intel_batchbuffer.c \ + lib/intel_mmio.c \ + tools/intel_chipset.h + + +LOCAL_C_INCLUDES += \ + $(LOCAL_PATH)/lib \ + $(TOPDIR)hardware/intel/libdrm/include/drm \ + $(TOPDIR)hardware/intel/libdrm/intel \ + $(LOCAL_PATH)/../libpciaccess/include/ + +LOCAL_CFLAGS += -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1 + +LOCAL_MODULE := intel_reg_snapshot +LOCAL_MODULE_TAGS := optional + +LOCAL_SHARED_LIBRARIES := libpciaccess \ + libdrm \ + libdrm_intel + +include $(BUILD_EXECUTABLE) + +#================ +include $(CLEAR_VARS) + +LOCAL_SRC_FILES := \ + tools/forcewaked.c \ + lib/intel_pci.c \ + lib/intel_gpu_tools.h \ + tools/intel_reg.h \ + lib/intel_batchbuffer.h \ + lib/intel_batchbuffer.c \ + lib/intel_mmio.c \ + tools/intel_chipset.h \ + lib/intel_reg_map.c + + +LOCAL_C_INCLUDES += \ + $(LOCAL_PATH)/lib \ + $(TOPDIR)hardware/intel/libdrm/include/drm \ + $(TOPDIR)hardware/intel/libdrm/intel \ + $(LOCAL_PATH)/../libpciaccess/include/ + +LOCAL_CFLAGS += -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1 +LOCAL_CFLAGS += -DANDROID + + +LOCAL_MODULE := forcewaked +LOCAL_MODULE_TAGS := optional + +LOCAL_SHARED_LIBRARIES := libpciaccess \ + libdrm \ + libdrm_intel + +include $(BUILD_EXECUTABLE) + +#================ +include $(CLEAR_VARS) + +LOCAL_SRC_FILES := \ + lib/intel_gpu_tools.h \ + tools/intel_reg_checker.c \ + lib/intel_pci.c \ + lib/intel_mmio.c + + +LOCAL_C_INCLUDES += \ + $(LOCAL_PATH)/lib \ + $(TOPDIR)hardware/intel/libdrm/include/drm \ + $(TOPDIR)hardware/intel/libdrm/intel \ + $(LOCAL_PATH)/../libpciaccess/include/ + +LOCAL_CFLAGS += -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1
Android.mk line 528
Quoted 10 lines
Android.mk new file +10
-0+LOCAL_CFLAGS += -DANDROID + + +LOCAL_MODULE := intel_reg_checker +LOCAL_MODULE_TAGS := optional + +LOCAL_SHARED_LIBRARIES := libpciaccess + +include $(BUILD_EXECUTABLE) +
It's unfortunate that we need another build system, but I understand that it's necessary---we ended up adding one in Mesa.
Quoted 14 lines
lib/intel_drm.c +1
-1@@ -25,7 +25,7 @@* */ -#include "config.h" +#include "../config.h" #include <unistd.h> #include <stdlib.h>
lib/intel_drm.c line 42
Quoted 8 lines
lib/intel_drm.c +4
-0@@ -35,7 +35,11 @@#include <err.h> #include <assert.h> #include <sys/ioctl.h> +#ifdef ANDROID +#include <fcntl.h> +#else #include <sys/fcntl.h> +#endif
At least on my system, /usr/include/sys/fcntl.h is simply:
#include <fcntl.h>
So I think you could unconditionally change all of these to #include <fcntl.h> without #ifdef ANDROID. Perhaps others can confirm that. That would certainly be a lot nicer.
Quoted 40 lines
lib/intel_drm.c +0
-0#include <sys/stat.h> #include <sys/mman.h> #ifdef HAVE_STRUCT_SYSINFO_TOTALRAM lib/intel_mmio.c +4
-0@@ -38,7 +38,11 @@#include <err.h> #include <assert.h> #include <sys/ioctl.h> +#ifdef ANDROID +#include <fcntl.h> +#else #include <sys/fcntl.h> +#endif #include <sys/stat.h> #include <sys/mman.h> lib/intel_pci.c +4
-0@@ -33,7 +33,11 @@#include <err.h> #include <assert.h> #include <sys/ioctl.h> +#ifdef ANDROID +#include <fcntl.h> +#else #include <sys/fcntl.h> +#endif #include <sys/stat.h> #include <sys/mman.h> tools/intel_decode.c +0
-0
tools/intel_decode.c decode_mi(uint32_t *data, int count, uint32_t hw_offset, int *failures) · line 206
Quoted 9 lines
tools/intel_decode.c +5
-0@@ -198,7 +198,12 @@ decode_mi(uint32_t *data, int count, uint32_t hw_offset, int *failures)if ((data[0 ]&0x1f800000 )>>23 == opcodes_mi[opcode].opcode) {instr_out (data, hw_offset,0 ,"%s\n" , opcodes_mi[opcode].name); +#ifdef ANDROID +int i; +for (i =1 ; i< len; i++) { +#else for (int i =1 ; i< len; i++) { +#endif
Like Adam said...just use gcc -std=c99 if possible. We really want C99.
Quoted 34 lines
tools/intel_decode.c +5
-0if (i>= count)BUFFER_FAIL (count, len, opcodes_mi[opcode].name);instr_out (data, hw_offset, i,"dword %d\n" , i);@@ -1164,7 +1169,12 @@ decode_3d_1d(uint32_t *data, int count,break ;case 2 :instr_out (data, hw_offset, i,"S2: texcoord formats: " ); +#ifdef ANDROID +int tex_num; +for (tex_num =0 ; tex_num<8 ; tex_num++) { +#else for (int tex_num =0 ; tex_num<8 ; tex_num++) { +#endif switch ((data[i]>>tex_num*4 )&0xf ) {case 0 :fprintf (out,"%i=2D " , tex_num);break ;case 1 :fprintf (out,"%i=3D " , tex_num);break ;tools/intel_dump_decode.c +4
-0@@ -67,6 +67,10 @@ read_data_file(uint32_t devid, const char * filename)FILE *file;uint32_t *data =NULL ;int data_size =0 , count =0 , line_number =0 , matched; +#ifdef ANDROID +char line[1024 ]; +size_t line_size =1024 ; +#else char *line =NULL ;size_t line_size;uint32_t offset, value;@@ -82,9 +86,15 @@ read_data_file(uint32_t devid, const char * filename) filename, strerror (errno));exit (1 );
tools/intel_dump_decode.c read_data_file(uint32_t devid, const char * filename) · line 95
Quoted 10 lines
tools/intel_dump_decode.c +6
-2} - +#ifdef ANDROID +while (fgets (line, line_size, file) !=0 ) { + line[strcspn (line,"\n" )] ='\0' ; +if (line[0 ] =='\0' )continue ; +#else while (getline (&line,&line_size, file)>0 ) { - line_number++; +#endif
Rather than rewriting every use of getline(), could we just include our own implementation of getline() in an #ifdef ANDROID block? That way, we work around the Bionic issues in one place.
Quoted 63 lines
tools/intel_dump_decode.c +2
-0+ + line_number++; matched =sscanf (line,"%08x : %08x" ,&offset,&value);if (matched !=2 ) {tools/intel_error_decode.c +14
-0@@ -280,15 +280,27 @@ read_data_file (FILE *file)uint32_t *data =NULL ;long long unsigned fence;int data_size =0 , count =0 , line_number =0 , matched; +#ifdef ANDROID +char line[1024 ]; +size_t line_size =1024 ; +#else char *line =NULL ;size_t line_size; +#endif uint32_t offset, value;uint32_t gtt_offset =0 , new_gtt_offset;char *buffer_type[2 ] = {"ringbuffer" ,"batchbuffer" };char *ring_name =NULL ;int is_batch =1 ; +#ifdef ANDROID +while (fgets (line, line_size, file) !=0 ) { + line[strcspn (line,"\n" )] ='\0' ; +if (line[0 ] =='\0' )continue ; +#else while (getline (&line,&line_size, file)>0 ) { +#endif +char *dashes; line_number++;@@ -404,7 +416,9 @@ read_data_file (FILE *file) }free (data); +#ifndef ANDROID free (line); +#endif free (ring_name); }tools/intel_gpu_top.c +1
-1@@ -27,7 +27,7 @@* */ -#include "config.h" +#include "../config.h" #include <unistd.h> #include <stdlib.h> @@ -602,10 +602,14 @@ int main(int argc, char **argv)/* Limit the number of lines printed to the terminal height so the * most important info (at the top) will stay on screen. */
tools/intel_gpu_top.c int main(int argc, char **argv) · line 613
Quoted 10 lines
tools/intel_gpu_top.c +4
-0unsigned short int max_lines =-1 ; +#ifndef ANDROID struct winsize ws;if (ioctl (0 ,TIOCGWINSZ ,&ws) !=-1 ) max_lines = ws.ws_row -6 ;/* exclude header lines */ if (max_lines>= num_instdone_bits) +// FIXME: ioctl-types.h still does not exist in Android. Hard code + // the max_lines value for now (winsize is part of ioctl-types.h +#endif max_lines = num_instdone_bits;
I'm okay with an #ifndef ANDROID workaround here, but would it be better to use MAX_INSTDONE_BITS? Also, please use
/* FIXME: ..... */
rather than the C++ style comments.
Thanks for your work on this, it'll be nice to see intel-gpu-tools on Android!
Quoted 14 lines
tools/intel_gpu_top.c +0
-0t2 =gettime ();tools/intel_reg_write.c +2
-0@@ -25,6 +25,8 @@* */ +#include "../config.h" +#include <unistd.h> #include <stdlib.h> #include <stdio.h>