Skip to contentSkip to conversation

Android.mk: Disable tools that do not build for android

PATCH Superseded Derek Morton 3 participants 9 messages Jun 15, 2015 – Jul 16, 2015

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Android.mk: Disable tools that do not build for android

Disable the tools / demo code that do not currently build for android until they can be fixed.

Affected tools / demos
intel_reg
intel_display_crc
intel_sprite_on

v2: intel_display_crc compiled conditionally on ANDROID_HAS_CAIRO flag.

---
 Android.mk       | 2 +-
 tools/Android.mk | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)
Android.mk +1 -1
index 1ab3e64..681d114 100644
@@ -1,2 +1,2 @@
-include $(call all-named-subdir-makefiles, lib tests tools benchmarks demos)
+include $(call all-named-subdir-makefiles, lib tests tools benchmarks)
 
tools/Android.mk +5 -0
index 39f4512..4be0032 100644
@@ -37,10 +37,15 @@ endef
 
 skip_tools_list := \
     intel_framebuffer_dump \
+    intel_reg \
     intel_reg_dumper \
     intel_vga_read \
     intel_vga_write
 
+ifneq ("${ANDROID_HAS_CAIRO}", "1")
+    skip_tools_list += intel_display_crc
+endif
+
 tools_list := $(filter-out $(skip_tools_list),$(bin_PROGRAMS))
 
 $(foreach item,$(tools_list),$(eval $(call add_tool,$(item))))
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw
Quoted 7 lines · Derek Morton

Disable the tools / demo code that do not currently build for android until they can be fixed.

Affected tools / demos
intel_reg
intel_display_crc
intel_sprite_on

The simplest you can do to fix intel_reg is to have configure set up HAVE_SYS_IO or similar and do this in the code:

tools/intel_reg.c +13 -1
index 090cc25613b9..c1e1d5ed3f1c 100644
@@ -28,7 +28,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <sys/io.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <unistd.h>
@@ -38,6 +37,19 @@
 
 #include "intel_reg_spec.h"
 
+#ifdef HAVE_SYS_IO
+#include <sys/io.h>
+#else
+static inline int _not_supported(void)
+{
+	fprintf(stderr, "portio-vga not supported\n");
+	return 0;
+}
+#define inb(port)		_not_supported()
+#define outb(value, port)	_not_supported()
+#define iopl(level)
+#endif
+
 struct config {
 	struct pci_device *pci_dev;
 	char *mmiofile;

I'm sure it could be made prettier, but this gets the job done.

BR,
Jani.

Quoted 45 lines

v2: intel_display_crc compiled conditionally on ANDROID_HAS_CAIRO flag.

---
 Android.mk       | 2 +-
 tools/Android.mk | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)
Android.mk +1 -1
index 1ab3e64..681d114 100644
@@ -1,2 +1,2 @@
-include $(call all-named-subdir-makefiles, lib tests tools benchmarks demos)
+include $(call all-named-subdir-makefiles, lib tests tools benchmarks)
 
tools/Android.mk +5 -0
index 39f4512..4be0032 100644
@@ -37,10 +37,15 @@ endef
 
 skip_tools_list := \
     intel_framebuffer_dump \
+    intel_reg \
     intel_reg_dumper \
     intel_vga_read \
     intel_vga_write
 
+ifneq ("${ANDROID_HAS_CAIRO}", "1")
+    skip_tools_list += intel_display_crc
+endif
+
 tools_list := $(filter-out $(skip_tools_list),$(bin_PROGRAMS))
 
 $(foreach item,$(tools_list),$(eval $(call add_tool,$(item))))
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw
Quoted 52 lines

-----Original Message-----
From: Jani Nikula [mailto:[email protected]]
Sent: Monday, June 15, 2015 4:31 PM
To: Morton, Derek J; [email protected]
Cc: Wood, Thomas
Subject: Re: [Intel-gfx] [PATCH i-g-t v2] Android.mk: Disable tools that do not build for android

Quoted 7 lines · Derek Morton

Disable the tools / demo code that do not currently build for android until they can be fixed.

Affected tools / demos
intel_reg
intel_display_crc
intel_sprite_on

The simplest you can do to fix intel_reg is to have configure set up HAVE_SYS_IO or similar and do this in the code:

tools/intel_reg.c +13 -1
@@ -28,7 +28,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <sys/io.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <unistd.h>
@@ -38,6 +37,19 @@
 
 #include "intel_reg_spec.h"
 
+#ifdef HAVE_SYS_IO
+#include <sys/io.h>
+#else
+static inline int _not_supported(void)
+{
+	fprintf(stderr, "portio-vga not supported\n");
+	return 0;
+}
+#define inb(port)		_not_supported()
+#define outb(value, port)	_not_supported()
+#define iopl(level)
+#endif
+
 struct config {
 	struct pci_device *pci_dev;
 	char *mmiofile;
Quoted 6 lines

I'm sure it could be made prettier, but this gets the job done.

BR,
Jani.

I tried this but just hit another problem. The android make files assume 1:1 between source files and compiled binaries. Intel_reg has several source files so the extra files do not get built and it fails to link.

In the interests of keeping patches small and simple I would like to just keep this one as is so the android build no longer fails and try to fix intel_reg later as a separate patch.

//Derek

Quoted 42 lines
Quoted 42 lines

v2: intel_display_crc compiled conditionally on ANDROID_HAS_CAIRO flag.

---
 Android.mk       | 2 +-
 tools/Android.mk | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)
Android.mk +2 -1
index 1ab3e64..681d114 100644
@@ -1,2 +1,2 @@
-include $(call all-named-subdir-makefiles, lib tests tools benchmarks 
 demos)
+include $(call all-named-subdir-makefiles, lib tests tools 
+benchmarks)
tools/Android.mk index renamed from tools/Android.mk +0 -0

39f4512..4be0032 100644

tools/Android.mk +4 -1
@@ -37,10 +37,15 @@ endef
 
 skip_tools_list := \
     intel_framebuffer_dump \
+    intel_reg \
     intel_reg_dumper \
     intel_vga_read \
     intel_vga_write
 
+ifneq ("${ANDROID_HAS_CAIRO}", "1")
+    skip_tools_list += intel_display_crc endif
+
 tools_list := $(filter-out $(skip_tools_list),$(bin_PROGRAMS))
 
 $(foreach item,$(tools_list),$(eval $(call add_tool,$(item))))
--

1.9.1

Quoted 8 lines
Quoted 4 lines

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

--
Jani Nikula, Intel Open Source Technology Center

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw

Bump

Can this patch be merged? It only affects android and it only disables tools that fail to build anyway. Fixing the broken tools for android require non trivial fixes so need to be addressed as separate patches. This patch is required to allow the other tools to build for android in the meantime.

//Derek

Quoted 126 lines

-----Original Message-----
From: Intel-gfx [mailto:[email protected]] On Behalf Of Morton, Derek J
Sent: Tuesday, June 16, 2015 11:04 AM
To: Jani Nikula; [email protected]
Cc: Wood, Thomas
Subject: Re: [Intel-gfx] [PATCH i-g-t v2] Android.mk: Disable tools that do not build for android

Quoted 53 lines

-----Original Message-----
From: Jani Nikula [mailto:[email protected]]
Sent: Monday, June 15, 2015 4:31 PM
To: Morton, Derek J; [email protected]
Cc: Wood, Thomas
Subject: Re: [Intel-gfx] [PATCH i-g-t v2] Android.mk: Disable tools that do not build for android

Quoted 7 lines · Derek Morton

Disable the tools / demo code that do not currently build for android until they can be fixed.

Affected tools / demos
intel_reg
intel_display_crc
intel_sprite_on

The simplest you can do to fix intel_reg is to have configure set up HAVE_SYS_IO or similar and do this in the code:

tools/intel_reg.c index renamed from tools/intel_reg.c +0 -0

090cc25613b9..c1e1d5ed3f1c 100644

tools/intel_reg.c +12 -1
@@ -28,7 +28,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <sys/io.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <unistd.h>
@@ -38,6 +37,19 @@
 
 #include "intel_reg_spec.h"
 
+#ifdef HAVE_SYS_IO
+#include <sys/io.h>
+#else
+static inline int _not_supported(void) {
+	fprintf(stderr, "portio-vga not supported\n");
+	return 0;
+}
+#define inb(port)		_not_supported()
+#define outb(value, port)	_not_supported()
+#define iopl(level)
+#endif
+
 struct config {
 	struct pci_device *pci_dev;
 	char *mmiofile;
Quoted 6 lines

I'm sure it could be made prettier, but this gets the job done.

BR,
Jani.

I tried this but just hit another problem. The android make files assume 1:1 between source files and compiled binaries. Intel_reg has several source files so the extra files do not get built and it fails to link.

In the interests of keeping patches small and simple I would like to just keep this one as is so the android build no longer fails and try to fix intel_reg later as a separate patch.

//Derek

Quoted 43 lines
Quoted 43 lines

v2: intel_display_crc compiled conditionally on ANDROID_HAS_CAIRO flag.

---
 Android.mk       | 2 +-
 tools/Android.mk | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)
Android.mk +0 -1
index 1ab3e64..681d114 100644
@@ -1,2 +1,2 @@
-include $(call all-named-subdir-makefiles, lib tests tools 

benchmarks
demos)

Android.mk +2 -0
+include $(call all-named-subdir-makefiles, lib tests tools
+benchmarks)
tools/Android.mk index renamed from tools/Android.mk +0 -0

39f4512..4be0032 100644

tools/Android.mk +4 -1
@@ -37,10 +37,15 @@ endef
 
 skip_tools_list := \
     intel_framebuffer_dump \
+    intel_reg \
     intel_reg_dumper \
     intel_vga_read \
     intel_vga_write
 
+ifneq ("${ANDROID_HAS_CAIRO}", "1")
+    skip_tools_list += intel_display_crc endif
+
 tools_list := $(filter-out $(skip_tools_list),$(bin_PROGRAMS))
 
 $(foreach item,$(tools_list),$(eval $(call add_tool,$(item))))
--

1.9.1

Quoted 8 lines
Quoted 4 lines

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

--
Jani Nikula, Intel Open Source Technology Center

Quoted 5 lines

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#4 lore raw

cover Enabling intel_reg on Android

intel_reg replaces various other register tools, so these patches attempt to enable building it on Android platforms.

Thomas Wood (2):
intel_reg: support platforms without sys/io.h
tools/Android.mk: add any extra program sources

 configure.ac      |  2 +-
 tools/Android.mk  |  4 ++--
 tools/intel_reg.c | 17 ++++++++++++++++-
 3 files changed, 19 insertions(+), 4 deletions(-)
Signature · 6 lines
2.4.3

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#5 lore raw

PATCH 1/2 intel_reg: support platforms without sys/io.h

Based on an idea from Jani Nikula.

Cc Jani Nikula <[email protected]>
Cc Derek Morton <[email protected]>
---
 configure.ac      |  2 +-
 tools/intel_reg.c | 17 ++++++++++++++++-
 2 files changed, 17 insertions(+), 2 deletions(-)
configure.ac +1 -1
index f3603c1..3770b2f 100644
@@ -56,7 +56,7 @@ AM_CONDITIONAL(HAVE_RST2MAN, [test "x$RST2MAN" = xyes])
 
 # Checks for functions, headers, structures, etc.
 AC_HEADER_STDC
-AC_CHECK_HEADERS([termios.h linux/kd.h sys/kd.h libgen.h])
+AC_CHECK_HEADERS([termios.h linux/kd.h sys/kd.h libgen.h sys/io.h])
 AC_CHECK_MEMBERS([struct sysinfo.totalram],[],[],[AC_INCLUDES_DEFAULT
 		  #include <sys/sysinfo.h>
 		  ])
tools/intel_reg.c +16 -1
index 090cc25..190aa5b 100644
@@ -28,7 +28,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <sys/io.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <unistd.h>
@@ -38,6 +37,22 @@
 
 #include "intel_reg_spec.h"
 
+
+#ifdef HAVE_SYS_IO_H
+#include <sys/io.h>
+#else
+
+static inline int _not_supported(void)
+{
+       fprintf(stderr, "portio-vga not supported\n");
+       exit(EXIT_FAILURE);
+}
+#define inb(port)              _not_supported()
+#define outb(value, port)      _not_supported()
+#define iopl(level)
+
+#endif /* HAVE_SYS_IO_H */
+
 struct config {
 	struct pci_device *pci_dev;
 	char *mmiofile;
Signature · 6 lines
2.4.3

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#6 lore raw

PATCH 2/2 tools/Android.mk: add any extra program sources

In reply to Thomas Wood
---
 tools/Android.mk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/Android.mk +2 -2
index 39f4512..f7dc3bb 100644
@@ -1,13 +1,13 @@
 LOCAL_PATH := $(call my-dir)
 
-include $(LOCAL_PATH)/Makefile.sources
+include ./$(LOCAL_PATH)/Makefile.sources
 
 #================#
 
 define add_tool
     include $(CLEAR_VARS)
 
-    LOCAL_SRC_FILES := $1.c
+    LOCAL_SRC_FILES := $1.c $($(1)_SOURCES)
 
     LOCAL_CFLAGS += -DHAVE_TERMIOS_H
     LOCAL_CFLAGS += -DHAVE_STRUCT_SYSINFO_TOTALRAM
Signature · 6 lines
2.4.3

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#7 lore raw

Re: [PATCH i-g-t 2/2] tools/Android.mk: add any extra program sources

Hi Thomas,

I tried these patches on Android. They worked with some modifications. See comments below.

//Derek

Quoted 19 lines

-----Original Message-----
From: Wood, Thomas
Sent: Thursday, July 16, 2015 12:08 PM
To: [email protected]
Cc: Morton, Derek J
Subject: [PATCH i-g-t 2/2] tools/Android.mk: add any extra program sources

---
tools/Android.mk | 4 ++--

1 file changed, 2 insertions(+), 2 deletions(-)

tools/Android.mk line 3

Quoted 4 lines
tools/Android.mk +1 -1
@@ -1,13 +1,13 @@
 LOCAL_PATH := $(call my-dir)
 
-include $(LOCAL_PATH)/Makefile.sources
+include ./$(LOCAL_PATH)/Makefile.sources

$(LOCAL_PATH) is an absolute path so putting ./ in front of it breaks things.

tools/Android.mk line 10

Quoted 8 lines
tools/Android.mk +0 -0
 #================#
 

define add_tool

    include $(CLEAR_VARS)
tools/Android.mk +1 -1
-    LOCAL_SRC_FILES := $1.c
+    LOCAL_SRC_FILES := $1.c $($(1)_SOURCES)

This causes duplication errors as $1.c will also be in $($(1)_SOURCES). However $($(1)_SOURCES) on its own does not work either as it is not defined for all targets. I ended up with:

ifeq ($($(1)_SOURCES),)

    LOCAL_SRC_FILES := $1.c
else
    LOCAL_SRC_FILES := $($(1)_SOURCES)

endif

Quoted 7 lines
    LOCAL_CFLAGS += -DHAVE_TERMIOS_H
    LOCAL_CFLAGS += -DHAVE_STRUCT_SYSINFO_TOTALRAM

--
2.4.3

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#8 lore raw

Re: [PATCH i-g-t 2/2] tools/Android.mk: add any extra program sources

Quoted 28 lines · Derek J

Hi Thomas,

I tried these patches on Android. They worked with some modifications. See comments below.

//Derek

Quoted 21 lines

-----Original Message-----
From: Wood, Thomas
Sent: Thursday, July 16, 2015 12:08 PM
To: [email protected]
Cc: Morton, Derek J
Subject: [PATCH i-g-t 2/2] tools/Android.mk: add any extra program sources

---
tools/Android.mk | 4 ++--

1 file changed, 2 insertions(+), 2 deletions(-)
tools/Android.mk +0 -0
@@ -1,13 +1,13 @@
 LOCAL_PATH := $(call my-dir)
 
Quoted 4 lines

tools/Android.mk line 3

Quoted 2 lines
tools/Android.mk +1 -1
-include $(LOCAL_PATH)/Makefile.sources
+include ./$(LOCAL_PATH)/Makefile.sources

$(LOCAL_PATH) is an absolute path so putting ./ in front of it breaks things.

This was just for some (limited) local testing, so wasn't supposed to be in the patch anyway.

Quoted 4 lines
Quoted 4 lines
tools/Android.mk +0 -0
 #================#
 
Quoted 8 lines

tools/Android.mk line 10

Quoted 5 lines

define add_tool

    include $(CLEAR_VARS)
tools/Android.mk +1 -1
-    LOCAL_SRC_FILES := $1.c
+    LOCAL_SRC_FILES := $1.c $($(1)_SOURCES)

This causes duplication errors as $1.c will also be in $($(1)_SOURCES). However $($(1)_SOURCES) on its own does not work either as it is not defined for all targets. I ended up with:

Looks good; I'll make the changes and push the patches.

Quoted 14 lines

ifeq ($($(1)_SOURCES),)

    LOCAL_SRC_FILES := $1.c
else
    LOCAL_SRC_FILES := $($(1)_SOURCES)

endif

Quoted 7 lines
    LOCAL_CFLAGS += -DHAVE_TERMIOS_H
    LOCAL_CFLAGS += -DHAVE_STRUCT_SYSINFO_TOTALRAM

--
2.4.3

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx