Patches to enable building IGT in Android
cover Patches to enable building IGT in Android
From: tgore <[email protected]>
Note: This is my first submission to an open source mailing list. Apologies for any mistakes etc.
There are several issues that cause build errors for IGT on Android
One is that some of the tests make use of mmap64, which is a very recent addition to bionic and therefore not available on all Android versions. A previous fix for this still has issues because it relies on a macro HAVE_MMAP64 to be defined when mmap64 is available, but this is not always the case. If HAVE_MMAP64 is not defined, but mmap64 is then the compile fails due to a redefinition of mmap64.
The next patch ensures that the correct versions of i915_drm.h and intel_chipset.h are picked up when building within the android tree.
The third patch modifies the way cairo.h gets included in various places so that the Android build can succeed without it.
These 3 patches are independent, but you need all three to be able to build IGT on Android.
tgore (3):
intel-gpu-tools: fix problem with redefinition of mmap64
intel-gpu-tools: fix some include path problems on android builds
intel-gpu-tools: change how cairo.h is included, to enable Android
build
lib/Android.mk | 4 +++- lib/drmtest.h | 6 +++++- lib/igt_fb.c | 1 + lib/igt_fb.h | 4 +++- tests/Android.mk | 3 +++ tests/kms_cursor_crc.c | 1 + tests/kms_fbc_crc.c | 1 + tests/kms_plane.c | 1 + tests/pm_lpsp.c | 1 + tests/pm_pc8.c | 1 + tools/Android.mk | 3 +++ 11 files changed, 23 insertions(+), 3 deletions(-)
Signature · 1 line
1.9.0
PATCH 1/3 intel-gpu-tools: fix problem with redefinition of mmap64
From: tgore <[email protected]>
In android builds there is no reliable way to determine if mmap64 is defined or not, and this sometimes leads to a compile error due to its re-defnition. So this commit avoids its use altogether in intel-gpu-tools for Android builds, unless the HAVE_MMAP64 macro is defined.
--- lib/drmtest.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
lib/drmtest.h +5 -1
@@ -40,7 +40,11 @@ #ifdef ANDROID #ifndef HAVE_MMAP64 extern void* __mmap2(void *, size_t, int, int, int, off_t); -static inline void *mmap64(void *addr, size_t length, int prot, int flags, + +/* mmap64 is a recent addition to bionic and not available in all android builds. */ +/* I can find no reliable way to know if it is defined or not - so just avoid it */ +#define mmap64 igt_mmap64 +static inline void *igt_mmap64(void *addr, size_t length, int prot, int flags, int fd, off64_t offset) { return __mmap2(addr, length, prot, flags, fd, offset >> 12);
Signature · 1 line
1.9.0
PATCH 2/3 intel-gpu-tools: fix some include path problems on android builds
In reply to [email protected]From: tgore <[email protected]>
When building within the android tree (specifically in /external) the compilation fails due to the wrong versions of some header files getting picked up. This commit adds some include paths to ensure the correct headers are found
--- tests/Android.mk | 3 +++ tools/Android.mk | 3 +++ 2 files changed, 6 insertions(+)
tests/Android.mk +3 -0
@@ -17,6 +17,9 @@ define add_test # Excessive complaining for established cases. Rely on the Linux version warnings. LOCAL_CFLAGS += -Wno-sign-compare + LOCAL_C_INCLUDES = $(LOCAL_PATH)/../lib + LOCAL_C_INCLUDES += ${ANDROID_BUILD_TOP}/external/PRIVATE/drm/include/drm + LOCAL_MODULE := $1 LOCAL_MODULE_TAGS := optional
tools/Android.mk +3 -0
@@ -18,6 +18,9 @@ define add_tool # Excessive complaining for established cases. Rely on the Linux version warnings. LOCAL_CFLAGS += -Wno-sign-compare + LOCAL_C_INCLUDES = $(LOCAL_PATH)/../lib + LOCAL_C_INCLUDES += ${ANDROID_BUILD_TOP}/external/PRIVATE/drm/include/drm + LOCAL_MODULE := $1 LOCAL_MODULE_TAGS := optional
Signature · 1 line
1.9.0
PATCH 3/3 intel-gpu-tools: change how cairo.h is included, to enable Android build
In reply to [email protected]From: tgore <[email protected]>
A recent commit (64401f57e958998d537ff67525d5f1e9a4f76b22) moved igt_display into igt_kms. This means igt_debugfs.c now needs to include igt_kms.h, which in turn includes igt_fb.h and hence cairo.h. This breaks the build on android since there is no cairo port for Android at present. igt_fb.h doesn't really need cairo.h it can manage with a couple of incomplete declarations. This then requires igt_fb.c and several test source files to explicitly include cairo.h, instead of getting it indirectly through igt_fb.h. This enables us to build the igt tests that dont require cairo on Android.
--- lib/Android.mk | 4 +++- lib/igt_fb.c | 1 + lib/igt_fb.h | 4 +++- tests/kms_cursor_crc.c | 1 + tests/kms_fbc_crc.c | 1 + tests/kms_plane.c | 1 + tests/pm_lpsp.c | 1 + tests/pm_pc8.c | 1 + 8 files changed, 12 insertions(+), 2 deletions(-)
lib/Android.mk +3 -1
@@ -33,7 +33,9 @@ include $(LOCAL_PATH)/Makefile.sources skip_lib_list := \ igt_kms.c \ - igt_kms.h + igt_kms.h \ + igt_fb.c \ + igt_fb.h lib_list := $(filter-out $(skip_lib_list),$(libintel_tools_la_SOURCES))
lib/igt_fb.c +1 -0
@@ -32,6 +32,7 @@#include "drmtest.h" #include "igt_fb.h" #include "ioctl_wrappers.h" +#include <cairo.h> /** * SECTION:igt_fb
lib/igt_fb.h +3 -1
@@ -28,11 +28,13 @@ #ifndef __IGT_FB_H__ #define __IGT_FB_H__ -#include <cairo.h> #include <drm_fourcc.h> #include <xf86drmMode.h> +typedef struct _cairo_surface cairo_surface_t; +typedef struct _cairo cairo_t; + /* helpers to create nice-looking framebuffers */ struct igt_fb { uint32_t fb_id;
tests/kms_cursor_crc.c +1 -0
@@ -27,6 +27,7 @@#include <stdbool.h> #include <stdio.h> #include <string.h> +#include <cairo.h> #include "drmtest.h" #include "igt_debugfs.h"
tests/kms_fbc_crc.c +1 -0
@@ -26,6 +26,7 @@#include <stdbool.h> #include <stdio.h> #include <string.h> +#include <cairo.h> #include "drmtest.h" #include "igt_debugfs.h"
tests/kms_plane.c +1 -0
@@ -28,6 +28,7 @@#include <stdbool.h> #include <stdio.h> #include <string.h> +#include <cairo.h> #include "drmtest.h" #include "igt_debugfs.h"
tests/pm_lpsp.c +1 -0
@@ -28,6 +28,7 @@#include <sys/stat.h> #include <fcntl.h> #include <unistd.h> +#include <cairo.h> #include "drmtest.h" #include "igt_kms.h"
tests/pm_pc8.c +1 -0
@@ -41,6 +41,7 @@#include <linux/i2c-dev.h> #include <drm.h> +#include <cairo.h> #include "drmtest.h" #include "intel_batchbuffer.h"
Signature · 1 line
1.9.0
Re: [PATCH 3/3] intel-gpu-tools: change how cairo.h is included, to enable Android build
Quoted 12 lines · On Fri, Mar 28, 2014 at 12:55:00PM +0000, [email protected] wrote:
From: tgore <[email protected]>
A recent commit (
64401f57e958998d537ff67525d5f1e9a4f76b22) movedigt_displayintoigt_kms. This meansigt_debugfs.cnow needs to includeigt_kms.h, which in turn includesigt_fb.hand hencecairo.h. This breaks the build on android since there is no cairo port for Android at present.igt_fb.hdoesn't really needcairo.hit can manage with a couple of incomplete declarations. This then requiresigt_fb.cand several test source files to explicitly includecairo.h, instead of getting it indirectly throughigt_fb.h. This enables us to build the igt tests that dont require cairo on Android.
Quoted 1 line
Signed-off-by Tim Gore <[email protected]>
Can we just wrap the cairo include in #ifdef ANDROID? The point of adding the cairo include was very much that drivers don't need to do this ... Also Android just needs to grow cairo support ;-)
Other two patches merged.
-Daniel
Quoted 124 lines
--- lib/Android.mk | 4 +++- lib/igt_fb.c | 1 + lib/igt_fb.h | 4 +++- tests/kms_cursor_crc.c | 1 + tests/kms_fbc_crc.c | 1 + tests/kms_plane.c | 1 + tests/pm_lpsp.c | 1 + tests/pm_pc8.c | 1 + 8 files changed, 12 insertions(+), 2 deletions(-)lib/Android.mk +3
-1@@ -33,7 +33,9 @@ include $(LOCAL_PATH)/Makefile.sources skip_lib_list := \ igt_kms.c \ - igt_kms.h + igt_kms.h \ + igt_fb.c \ + igt_fb.h lib_list := $(filter-out $(skip_lib_list),$(libintel_tools_la_SOURCES))lib/igt_fb.c +1
-0@@ -32,6 +32,7 @@#include "drmtest.h" #include "igt_fb.h" #include "ioctl_wrappers.h" +#include <cairo.h> /** * SECTION:igt_fb lib/igt_fb.h +3
-1@@ -28,11 +28,13 @@ #ifndef __IGT_FB_H__ #define __IGT_FB_H__ -#include <cairo.h> #include <drm_fourcc.h> #include <xf86drmMode.h> +typedef struct _cairo_surface cairo_surface_t; +typedef struct _cairo cairo_t; + /* helpers to create nice-looking framebuffers */ struct igt_fb { uint32_t fb_id;tests/kms_cursor_crc.c +1
-0@@ -27,6 +27,7 @@#include <stdbool.h> #include <stdio.h> #include <string.h> +#include <cairo.h> #include "drmtest.h" #include "igt_debugfs.h" tests/kms_fbc_crc.c +1
-0@@ -26,6 +26,7 @@#include <stdbool.h> #include <stdio.h> #include <string.h> +#include <cairo.h> #include "drmtest.h" #include "igt_debugfs.h" tests/kms_plane.c +1
-0@@ -28,6 +28,7 @@#include <stdbool.h> #include <stdio.h> #include <string.h> +#include <cairo.h> #include "drmtest.h" #include "igt_debugfs.h" tests/pm_lpsp.c +1
-0@@ -28,6 +28,7 @@#include <sys/stat.h> #include <fcntl.h> #include <unistd.h> +#include <cairo.h> #include "drmtest.h" #include "igt_kms.h" tests/pm_pc8.c +1
-0@@ -41,6 +41,7 @@#include <linux/i2c-dev.h> #include <drm.h> +#include <cairo.h> #include "drmtest.h" #include "intel_batchbuffer.h" Signature · 6 lines
1.9.0 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch