diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Android.mk | 53 | ||||
-rw-r--r-- | lib/drmtest.h | 16 | ||||
-rw-r--r-- | lib/igt_aux.c | 95 | ||||
-rw-r--r-- | lib/igt_aux.h | 5 | ||||
-rw-r--r-- | lib/igt_core.c | 68 | ||||
-rw-r--r-- | lib/igt_debugfs.c | 25 | ||||
-rw-r--r-- | lib/igt_fb.h | 7 | ||||
-rw-r--r-- | lib/igt_kmod.h | 4 | ||||
-rw-r--r-- | lib/igt_kms.c | 89 | ||||
-rw-r--r-- | lib/tests/Android.mk | 41 |
10 files changed, 90 insertions, 313 deletions
diff --git a/lib/Android.mk b/lib/Android.mk deleted file mode 100644 index 31f88be7..00000000 --- a/lib/Android.mk +++ /dev/null @@ -1,53 +0,0 @@ -LOCAL_PATH := $(call my-dir) - -GPU_TOOLS_PATH := $(LOCAL_PATH)/.. -IGT_LIB_PATH := $(LOCAL_PATH) - -# FIXME: autogenerate this info # -$(GPU_TOOLS_PATH)/config.h: - @echo "updating config.h" - @echo '#define PACKAGE_VERSION "1.5"' >> $@ ; \ - echo '#define TARGET_CPU_PLATFORM "android-ia"' >> $@ ; - -include $(LOCAL_PATH)/Makefile.sources - -include $(CLEAR_VARS) - -LOCAL_GENERATED_SOURCES := \ - $(IGT_LIB_PATH)/version.h \ - $(GPU_TOOLS_PATH)/config.h - -LOCAL_C_INCLUDES += $(LOCAL_PATH)/.. \ - $(LOCAL_PATH)/stubs/drm/ - -LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH) - -LOCAL_CFLAGS += -DHAVE_LIBDRM_ATOMIC_PRIMITIVES -LOCAL_CFLAGS += -DHAVE_STRUCT_SYSINFO_TOTALRAM -LOCAL_CFLAGS += -DANDROID -DHAVE_LINUX_KD_H -LOCAL_CFLAGS += -std=gnu99 -UNDEBUG -LOCAL_MODULE:= libintel_gpu_tools - -LOCAL_SHARED_LIBRARIES := libpciaccess \ - libkmod \ - 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 -DIGT_DATADIR=\".\" -DIGT_SRCDIR=\".\" -else -skip_lib_list := \ - igt_kms.c \ - igt_kms.h \ - igt_fb.c - -DANDROID_HAS_CAIRO=0 -endif - -LOCAL_SRC_FILES := $(filter-out %.h $(skip_lib_list),$(lib_source_list)) - -include $(BUILD_STATIC_LIBRARY) - -include $(call first-makefiles-under, $(LOCAL_PATH)) - diff --git a/lib/drmtest.h b/lib/drmtest.h index a86799d5..fdd34ec6 100644 --- a/lib/drmtest.h +++ b/lib/drmtest.h @@ -51,22 +51,6 @@ */ #define DRIVER_ANY ~(DRIVER_VGEM) - -#ifdef ANDROID -#if (!(defined HAVE_MMAP64)) && (!(defined __x86_64__)) -extern void* __mmap2(void *, size_t, int, int, int, off_t); - -/* 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); -} -#endif -#endif - /** * ARRAY_SIZE: * @arr: static array diff --git a/lib/igt_aux.c b/lib/igt_aux.c index 0bcf792c..a41ae2f1 100644 --- a/lib/igt_aux.c +++ b/lib/igt_aux.c @@ -1085,101 +1085,6 @@ void igt_debug_manual_check(const char *var, const char *expected) igt_assert(key != 'n' && key != 'N'); } -/* Functions with prefix kmstest_ independent of cairo library are pulled out - * from file igt_kms.c since this file is skipped in lib/Android.mk when flag - * ANDROID_HAS_CAIRO is 0. This ensures the usability of these functions even - * when cairo library is not present on Android. - */ - -struct type_name { - int type; - const char *name; -}; - -static const char *find_type_name(const struct type_name *names, int type) -{ - for (; names->name; names++) { - if (names->type == type) - return names->name; - } - - return "(invalid)"; -} - -static const struct type_name encoder_type_names[] = { - { DRM_MODE_ENCODER_NONE, "none" }, - { DRM_MODE_ENCODER_DAC, "DAC" }, - { DRM_MODE_ENCODER_TMDS, "TMDS" }, - { DRM_MODE_ENCODER_LVDS, "LVDS" }, - { DRM_MODE_ENCODER_TVDAC, "TVDAC" }, - { DRM_MODE_ENCODER_VIRTUAL, "Virtual" }, - { DRM_MODE_ENCODER_DSI, "DSI" }, - { DRM_MODE_ENCODER_DPMST, "DP MST" }, - {} -}; - -/** - * kmstest_encoder_type_str: - * @type: DRM_MODE_ENCODER_* enumeration value - * - * Returns: A string representing the drm encoder @type. - */ -const char *kmstest_encoder_type_str(int type) -{ - return find_type_name(encoder_type_names, type); -} - -static const struct type_name connector_status_names[] = { - { DRM_MODE_CONNECTED, "connected" }, - { DRM_MODE_DISCONNECTED, "disconnected" }, - { DRM_MODE_UNKNOWNCONNECTION, "unknown" }, - {} -}; - -/** - * kmstest_connector_status_str: - * @status: DRM_MODE_* connector status value - * - * Returns: A string representing the drm connector status @status. - */ -const char *kmstest_connector_status_str(int status) -{ - return find_type_name(connector_status_names, status); -} - -static const struct type_name connector_type_names[] = { - { DRM_MODE_CONNECTOR_Unknown, "Unknown" }, - { DRM_MODE_CONNECTOR_VGA, "VGA" }, - { DRM_MODE_CONNECTOR_DVII, "DVI-I" }, - { DRM_MODE_CONNECTOR_DVID, "DVI-D" }, - { DRM_MODE_CONNECTOR_DVIA, "DVI-A" }, - { DRM_MODE_CONNECTOR_Composite, "Composite" }, - { DRM_MODE_CONNECTOR_SVIDEO, "SVIDEO" }, - { DRM_MODE_CONNECTOR_LVDS, "LVDS" }, - { DRM_MODE_CONNECTOR_Component, "Component" }, - { DRM_MODE_CONNECTOR_9PinDIN, "DIN" }, - { DRM_MODE_CONNECTOR_DisplayPort, "DP" }, - { DRM_MODE_CONNECTOR_HDMIA, "HDMI-A" }, - { DRM_MODE_CONNECTOR_HDMIB, "HDMI-B" }, - { DRM_MODE_CONNECTOR_TV, "TV" }, - { DRM_MODE_CONNECTOR_eDP, "eDP" }, - { DRM_MODE_CONNECTOR_VIRTUAL, "Virtual" }, - { DRM_MODE_CONNECTOR_DSI, "DSI" }, - { DRM_MODE_CONNECTOR_DPI, "DPI" }, - {} -}; - -/** - * kmstest_connector_type_str: - * @type: DRM_MODE_CONNECTOR_* enumeration value - * - * Returns: A string representing the drm connector @type. - */ -const char *kmstest_connector_type_str(int type) -{ - return find_type_name(connector_type_names, type); -} - /** * igt_lock_mem: * @size: the amount of memory to lock into RAM, in MB diff --git a/lib/igt_aux.h b/lib/igt_aux.h index 0bd226be..02e70126 100644 --- a/lib/igt_aux.h +++ b/lib/igt_aux.h @@ -45,12 +45,7 @@ extern int num_trash_bos; #define NSEC_PER_SEC (1000*USEC_PER_SEC) /* signal interrupt helpers */ -#ifdef ANDROID -#include <unistd.h> /* on Android bionic has this implemented */ -#else #define gettid() syscall(__NR_gettid) -#endif - #define sigev_notify_thread_id _sigev_un._tid /* auxialiary igt helpers from igt_aux.c */ diff --git a/lib/igt_core.c b/lib/igt_core.c index 6ce83bec..de9269b0 100644 --- a/lib/igt_core.c +++ b/lib/igt_core.c @@ -496,72 +496,6 @@ void __igt_fixture_end(void) } /* - * Some of the IGT tests put quite a lot of pressure on memory and when - * running on Android they are sometimes killed by the Android low memory killer. - * This seems to be due to some incompatibility between the kswapd free memory - * targets and the way the lowmemorykiller assesses free memory. - * The low memory killer really isn't usefull in this context and has no - * interaction with the gpu driver that we are testing, so the following - * function is used to disable it by modifying one of its module parameters. - * We still have the normal linux oom killer to protect the kernel. - * Apparently it is also possible for the lowmemorykiller to get included - * in some linux distributions; so rather than check for Android we directly - * check for the existence of the module parameter we want to adjust. - * - * In future, if we can get the lowmemorykiller to play nicely then we can - * remove this hack. - */ -static void low_mem_killer_disable(bool disable) -{ - static const char* adj_fname="/sys/module/lowmemorykiller/parameters/adj"; - static const char no_lowmem_killer[] = "9999"; - int fd; - struct stat buf; - /* The following must persist across invocations */ - static char prev_adj_scores[256]; - static int adj_scores_len = 0; - static bool is_disabled = false; - - /* capture the permissions bits for the lowmemkiller adj pseudo-file. - * Bail out if the stat fails; it probably means that there is no - * lowmemorykiller, but in any case we're doomed. */ - if (stat(adj_fname, &buf)) { - igt_assert(errno == ENOENT); - return; - } - - /* make sure the file can be read/written - by default it is write-only */ - chmod(adj_fname, S_IRUSR | S_IWUSR); - - if (disable && !is_disabled) { - /* read the current oom adj parameters for lowmemorykiller */ - fd = open(adj_fname, O_RDWR); - igt_assert(fd != -1); - adj_scores_len = read(fd, (void*)prev_adj_scores, 255); - igt_assert(adj_scores_len > 0); - - /* writing 9999 to this module parameter effectively diables the - * low memory killer. This is not a real file, so we dont need to - * seek to the start or truncate it */ - igt_assert_eq(write(fd, no_lowmem_killer, sizeof(no_lowmem_killer)), - sizeof(no_lowmem_killer)); - close(fd); - is_disabled = true; - } else if (is_disabled) { - /* just re-enstate the original settings */ - fd = open(adj_fname, O_WRONLY); - igt_assert(fd != -1); - igt_assert_eq(write(fd, prev_adj_scores, adj_scores_len), - adj_scores_len); - close(fd); - is_disabled = false; - } - - /* re-enstate the file permissions */ - chmod(adj_fname, buf.st_mode); -} - -/* * If the test takes out the machine, in addition to the usual dmesg * spam, the kernel may also emit a "death rattle" -- extra debug * information that is overkill for normal successful tests, but @@ -587,7 +521,6 @@ bool igt_exit_called; static void common_exit_handler(int sig) { if (!igt_only_list_subtests()) { - low_mem_killer_disable(false); kick_fbcon(true); } @@ -879,7 +812,6 @@ out: sync(); oom_adjust_for_doom(); - low_mem_killer_disable(true); ftrace_dump_on_oops(true); } diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c index 5670099f..9af8a593 100644 --- a/lib/igt_debugfs.c +++ b/lib/igt_debugfs.c @@ -990,30 +990,7 @@ int igt_get_stable_obj_count(int driver) obj_count = get_object_count(driver); /* The test relies on the system being in the same state before and * after the test so any difference in the object count is a result of - * leaks during the test. gem_quiescent_gpu() mostly achieves this but - * on android occasionally obj_count can still change briefly. - * The loop ensures obj_count has remained stable over several checks - */ -#ifdef ANDROID - { - int loop_count = 0; - int prev_obj_count = obj_count; - while (loop_count < 4) { - usleep(200000); - gem_quiescent_gpu(driver); - obj_count = get_object_count(driver); - if (obj_count == prev_obj_count) { - loop_count++; - } else { - igt_debug("loop_count=%d, obj_count=%d, prev_obj_count=%d\n", - loop_count, obj_count, prev_obj_count); - loop_count = 0; - prev_obj_count = obj_count; - } - - } - } -#endif + * leaks during the test. */ return obj_count; } diff --git a/lib/igt_fb.h b/lib/igt_fb.h index 3f549036..d30a7340 100644 --- a/lib/igt_fb.h +++ b/lib/igt_fb.h @@ -28,14 +28,7 @@ #ifndef __IGT_FB_H__ #define __IGT_FB_H__ -/* 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; -typedef struct _cairo cairo_t; -#endif - #include <stddef.h> #include <stdbool.h> #include <drm_fourcc.h> diff --git a/lib/igt_kmod.h b/lib/igt_kmod.h index 6a7584f1..fd307a45 100644 --- a/lib/igt_kmod.h +++ b/lib/igt_kmod.h @@ -24,11 +24,7 @@ #ifndef IGT_KMOD_H #define IGT_KMOD_H -#ifdef ANDROID -#include <libkmod/libkmod.h> -#else #include <libkmod.h> -#endif #include "igt_aux.h" diff --git a/lib/igt_kms.c b/lib/igt_kms.c index 92dcd3ca..125ecb19 100644 --- a/lib/igt_kms.c +++ b/lib/igt_kms.c @@ -377,6 +377,95 @@ const char *kmstest_plane_type_name(int plane_type) return names[plane_type]; } +struct type_name { + int type; + const char *name; +}; + +static const char *find_type_name(const struct type_name *names, int type) +{ + for (; names->name; names++) { + if (names->type == type) + return names->name; + } + + return "(invalid)"; +} + +static const struct type_name encoder_type_names[] = { + { DRM_MODE_ENCODER_NONE, "none" }, + { DRM_MODE_ENCODER_DAC, "DAC" }, + { DRM_MODE_ENCODER_TMDS, "TMDS" }, + { DRM_MODE_ENCODER_LVDS, "LVDS" }, + { DRM_MODE_ENCODER_TVDAC, "TVDAC" }, + { DRM_MODE_ENCODER_VIRTUAL, "Virtual" }, + { DRM_MODE_ENCODER_DSI, "DSI" }, + { DRM_MODE_ENCODER_DPMST, "DP MST" }, + {} +}; + +/** + * kmstest_encoder_type_str: + * @type: DRM_MODE_ENCODER_* enumeration value + * + * Returns: A string representing the drm encoder @type. + */ +const char *kmstest_encoder_type_str(int type) +{ + return find_type_name(encoder_type_names, type); +} + +static const struct type_name connector_status_names[] = { + { DRM_MODE_CONNECTED, "connected" }, + { DRM_MODE_DISCONNECTED, "disconnected" }, + { DRM_MODE_UNKNOWNCONNECTION, "unknown" }, + {} +}; + +/** + * kmstest_connector_status_str: + * @status: DRM_MODE_* connector status value + * + * Returns: A string representing the drm connector status @status. + */ +const char *kmstest_connector_status_str(int status) +{ + return find_type_name(connector_status_names, status); +} + +static const struct type_name connector_type_names[] = { + { DRM_MODE_CONNECTOR_Unknown, "Unknown" }, + { DRM_MODE_CONNECTOR_VGA, "VGA" }, + { DRM_MODE_CONNECTOR_DVII, "DVI-I" }, + { DRM_MODE_CONNECTOR_DVID, "DVI-D" }, + { DRM_MODE_CONNECTOR_DVIA, "DVI-A" }, + { DRM_MODE_CONNECTOR_Composite, "Composite" }, + { DRM_MODE_CONNECTOR_SVIDEO, "SVIDEO" }, + { DRM_MODE_CONNECTOR_LVDS, "LVDS" }, + { DRM_MODE_CONNECTOR_Component, "Component" }, + { DRM_MODE_CONNECTOR_9PinDIN, "DIN" }, + { DRM_MODE_CONNECTOR_DisplayPort, "DP" }, + { DRM_MODE_CONNECTOR_HDMIA, "HDMI-A" }, + { DRM_MODE_CONNECTOR_HDMIB, "HDMI-B" }, + { DRM_MODE_CONNECTOR_TV, "TV" }, + { DRM_MODE_CONNECTOR_eDP, "eDP" }, + { DRM_MODE_CONNECTOR_VIRTUAL, "Virtual" }, + { DRM_MODE_CONNECTOR_DSI, "DSI" }, + { DRM_MODE_CONNECTOR_DPI, "DPI" }, + {} +}; + +/** + * kmstest_connector_type_str: + * @type: DRM_MODE_CONNECTOR_* enumeration value + * + * Returns: A string representing the drm connector @type. + */ +const char *kmstest_connector_type_str(int type) +{ + return find_type_name(connector_type_names, type); +} + static const char *mode_stereo_name(const drmModeModeInfo *mode) { switch (mode->flags & DRM_MODE_FLAG_3D_MASK) { diff --git a/lib/tests/Android.mk b/lib/tests/Android.mk deleted file mode 100644 index bbbd4d86..00000000 --- a/lib/tests/Android.mk +++ /dev/null @@ -1,41 +0,0 @@ -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_MODULE := $1 - - # 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_MODULE_TAGS := optional - LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR)/intel/validation/core/igt - - include $(BUILD_EXECUTABLE) -endef - -# set local compilation flags for IGT tests -IGT_LOCAL_CFLAGS += -DHAVE_STRUCT_SYSINFO_TOTALRAM -DANDROID -UNDEBUG -IGT_LOCAL_CFLAGS += -std=gnu99 -# FIXME: drop once Bionic correctly annotates "noreturn" on pthread_exit -IGT_LOCAL_CFLAGS += -Wno-error=return-type - -# set local includes -IGT_LOCAL_C_INCLUDES = $(LOCAL_PATH)/../lib \ - $(LOCAL_PATH)/../lib/stubs/drm/ - -# set local libraries -IGT_LOCAL_STATIC_LIBRARIES := libintel_gpu_tools -IGT_LOCAL_SHARED_LIBRARIES := libpciaccess libdrm libdrm_intel - -$(foreach item,$($(check_prog_list)),$(eval $(call add_test,$(item)))) - |