[Intel-gfx] [PATCH] intel-gpu-tools: Build tests needing cairo if ANDROID_HAS_CAIRO=1

Daniel Vetter daniel at ffwll.ch
Mon May 12 18:56:48 CEST 2014


On Mon, May 12, 2014 at 01:39:00PM +0100, tim.gore at intel.com wrote:
> From: Tim Gore <tim.gore at intel.com>
> 
> Until now the tests that depended on libcairo were simply
> skipped in the android build. Now that I have a cairo port
> working, build these cairo dependent tests if ANDROID_HAS_CAIRO
> is set to 1 in the environment.
> For information on building cairo for IGT on Android see the
> wiki at:
> 
> https://securewiki.ith.intel.com/display/GFXCore/IGT+Test+Suite+on+Android
> 
> Signed-off-by: Tim Gore <tim.gore at intel.com>

Yay! Thanks for doing this, patch merged to igt.
-Daniel

> ---
>  lib/Android.mk   | 23 ++++++++++++--------
>  lib/igt_fb.h     |  3 ++-
>  tests/Android.mk | 66 +++++++++++++++++++++++++++++++++++---------------------
>  3 files changed, 58 insertions(+), 34 deletions(-)
> 
> diff --git a/lib/Android.mk b/lib/Android.mk
> index d4ebef4..5709aec 100644
> --- a/lib/Android.mk
> +++ b/lib/Android.mk
> @@ -31,17 +31,8 @@ $(GPU_TOOLS_PATH)/config.h:
>  
>  include $(LOCAL_PATH)/Makefile.sources
>  
> -skip_lib_list := \
> -    igt_kms.c \
> -    igt_kms.h \
> -    igt_fb.c
> -
> -lib_list := $(filter-out $(skip_lib_list),$(libintel_tools_la_SOURCES))
> -
>  include $(CLEAR_VARS)
>  
> -LOCAL_SRC_FILES := $(lib_list)
> -
>  LOCAL_GENERATED_SOURCES :=       \
>  	$(GPU_TOOLS_PATH)/version.h  \
>  	$(GPU_TOOLS_PATH)/config.h
> @@ -61,5 +52,19 @@ LOCAL_SHARED_LIBRARIES := libpciaccess  \
>  			  libdrm        \
>  			  libdrm_intel
>  
> +ifeq ("${ANDROID_HAS_CAIRO}", "1")
> +    skip_lib_list :=
> +    LOCAL_C_INCLUDES += $(ANDROID_BUILD_TOP)/external/cairo-1.12.16/src
> +    LOCAL_CFLAGS += -DANDROID_HAS_CAIRO=1
> +else
> +skip_lib_list := \
> +    igt_kms.c \
> +    igt_kms.h \
> +    igt_fb.c
> +    -DANDROID_HAS_CAIRO=0
> +endif
> +
> +LOCAL_SRC_FILES := $(filter-out $(skip_lib_list),$(libintel_tools_la_SOURCES))
> +
>  include $(BUILD_STATIC_LIBRARY)
>  
> diff --git a/lib/igt_fb.h b/lib/igt_fb.h
> index 7242f9b..e8bb2a8 100644
> --- a/lib/igt_fb.h
> +++ b/lib/igt_fb.h
> @@ -28,7 +28,8 @@
>  #ifndef __IGT_FB_H__
>  #define __IGT_FB_H__
>  
> -#ifndef ANDROID
> +/* cairo is assumed available on linux. On Android we check for ANDROID_HAS_CAIRO */
> +#if (!defined(ANDROID)) || (defined(ANDROID) && ANDROID_HAS_CAIRO)
>  #include <cairo.h>
>  #else
>  typedef struct _cairo_surface cairo_surface_t;
> diff --git a/tests/Android.mk b/tests/Android.mk
> index 6e77e45..db4a4aa 100644
> --- a/tests/Android.mk
> +++ b/tests/Android.mk
> @@ -3,52 +3,70 @@ LOCAL_PATH := $(call my-dir)
>  include $(LOCAL_PATH)/Makefile.sources
>  
>  #================#
> -
> +# each igt test is a separate executable. define a function to build one of these tests
>  define add_test
>      include $(CLEAR_VARS)
>  
> +    # specific to this test
>      LOCAL_SRC_FILES := $1.c
> -
> -    LOCAL_CFLAGS += -DHAVE_STRUCT_SYSINFO_TOTALRAM
> -    LOCAL_CFLAGS += -DANDROID -UNDEBUG -include "check-ndebug.h"
> -    LOCAL_CFLAGS += -std=c99
> -    # FIXME: drop once Bionic correctly annotates "noreturn" on pthread_exit
> -    LOCAL_CFLAGS += -Wno-error=return-type
> -    # 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
>  
> -    LOCAL_STATIC_LIBRARIES := libintel_gpu_tools
> +    # common to all tests
> +    LOCAL_CFLAGS += ${IGT_LOCAL_CFLAGS}
> +    LOCAL_C_INCLUDES = ${IGT_LOCAL_C_INCLUDES}
> +    LOCAL_STATIC_LIBRARIES := ${IGT_LOCAL_STATIC_LIBRARIES}
> +    LOCAL_SHARED_LIBRARIES := ${IGT_LOCAL_SHARED_LIBRARIES}
>  
> -    LOCAL_SHARED_LIBRARIES := libpciaccess  \
> -                              libdrm        \
> -                              libdrm_intel
> +    LOCAL_MODULE_TAGS := optional
>  
>      include $(BUILD_EXECUTABLE)
>  endef
>  
> -#================#
>  
> -skip_tests_list := \
> +# some tests still do not build under android
> +skip_tests_list :=
> +skip_tests_list += gem_seqno_wrap
> +skip_tests_list += testdisplay        # needs glib.h
> +skip_tests_list += pm_pc8
> +skip_tests_list += kms_render         # needs glib.h
> +skip_tests_list += gem_exec_params    # needs macro that's missing from external/PRIVATE/drm/include/drmi915_drm.h
> +
> +# set local compilation flags for IGT tests
> +IGT_LOCAL_CFLAGS += -DHAVE_STRUCT_SYSINFO_TOTALRAM -DANDROID -UNDEBUG
> +IGT_LOCAL_CFLAGS += -include "check-ndebug.h" -std=c99
> +# FIXME: drop once Bionic correctly annotates "noreturn" on pthread_exit
> +IGT_LOCAL_CFLAGS += -Wno-error=return-type
> +# Excessive complaining for established cases. Rely on the Linux version warnings.
> +IGT_LOCAL_CFLAGS += -Wno-sign-compare
> +
> +# set local includes
> +IGT_LOCAL_C_INCLUDES = $(LOCAL_PATH)/../lib
> +IGT_LOCAL_C_INCLUDES += ${ANDROID_BUILD_TOP}/external/PRIVATE/drm/include/drm
> +
> +# set local libraries
> +IGT_LOCAL_STATIC_LIBRARIES := libintel_gpu_tools
> +IGT_LOCAL_SHARED_LIBRARIES := libpciaccess libdrm libdrm_intel
> +
> +# handle cairo requirements if it is enabled
> +ifeq ("${ANDROID_HAS_CAIRO}", "1")
> +    IGT_LOCAL_C_INCLUDES += ${ANDROID_BUILD_TOP}/external/cairo-1.12.16/src
> +    IGT_LOCAL_SHARED_LIBRARIES += libcairo
> +    IGT_LOCAL_CFLAGS += -DANDROID_HAS_CAIRO=1
> +else
> +# the following tests depend on cairo, so skip them
> +    skip_tests_list += \
>      kms_plane \
> -    testdisplay \
>      kms_addfb \
>      kms_cursor_crc \
>      kms_flip \
>      kms_flip_tiling \
>      kms_pipe_crc_basic \
>      kms_fbc_crc \
> -    kms_render \
>      kms_setmode \
> -    pm_pc8 \
> -    gem_seqno_wrap \
>      gem_render_copy \
>      pm_lpsp
> +    IGT_LOCAL_CFLAGS += -DANDROID_HAS_CAIRO=0
> +endif
>  
>  tests_list := $(filter-out $(skip_tests_list),$(TESTS_progs) $(TESTS_progs_M) $(HANG) $(TESTS_testsuite))
>  
> -- 
> 1.9.2
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch



More information about the Intel-gfx mailing list