From b8f193bbbff1a322296969ded5a4c3f9fd759c6d Mon Sep 17 00:00:00 2001 From: Gagandeep S Arora Date: Thu, 13 Nov 2014 23:42:46 +0530 Subject: demos/intel_sprite_on: Added support to compile intel_sprite_on on Android. Added Android.mk for intel_sprite_on. v2: Addressed review comments by Daniel Vetter. - Moved the cairo independent functions from igt_kms.c to igt_aux.c. Signed-off-by: Gagandeep S Arora Signed-off-by: Thomas Wood --- Android.mk | 2 +- demos/Android.mk | 27 +++++++++++++++++++++++++ lib/igt_aux.c | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++++- lib/igt_kms.c | 53 ------------------------------------------------ 4 files changed, 88 insertions(+), 55 deletions(-) create mode 100644 demos/Android.mk diff --git a/Android.mk b/Android.mk index 681d1145..1ab3e646 100644 --- a/Android.mk +++ b/Android.mk @@ -1,2 +1,2 @@ -include $(call all-named-subdir-makefiles, lib tests tools benchmarks) +include $(call all-named-subdir-makefiles, lib tests tools benchmarks demos) diff --git a/demos/Android.mk b/demos/Android.mk new file mode 100644 index 00000000..6227e06f --- /dev/null +++ b/demos/Android.mk @@ -0,0 +1,27 @@ +LOCAL_PATH := $(call my-dir) + +#================# + +include $(CLEAR_VARS) + +LOCAL_SRC_FILES := intel_sprite_on.c + +LOCAL_CFLAGS += -DHAVE_TERMIOS_H +LOCAL_CFLAGS += -DANDROID -UNDEBUG +LOCAL_CFLAGS += -std=c99 +# Excessive complaining for established cases. Rely on the Linux version warnings. +LOCAL_CFLAGS += -Wno-sign-compare + +LOCAL_C_INCLUDES = $(LOCAL_PATH)/../lib + +LOCAL_MODULE := intel_sprite_on + +LOCAL_MODULE_TAGS := optional + +LOCAL_STATIC_LIBRARIES := libintel_gpu_tools + +LOCAL_SHARED_LIBRARIES := libdrm + +include $(BUILD_EXECUTABLE) + +#================# diff --git a/lib/igt_aux.c b/lib/igt_aux.c index 3bc10fbd..3051d84c 100644 --- a/lib/igt_aux.c +++ b/lib/igt_aux.c @@ -56,7 +56,7 @@ #include "config.h" #include "intel_reg.h" #include "ioctl_wrappers.h" - +#include "igt_kms.h" /** * SECTION:igt_aux @@ -542,3 +542,62 @@ bool igt_wait_for_pm_status(enum igt_runtime_pm_status status) return false; } + +/* 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; +}; + +#define type_name_fn(res) \ +const char * kmstest_##res##_str(int type) { \ + unsigned int i; \ + for (i = 0; i < ARRAY_SIZE(res##_names); i++) { \ + if (res##_names[i].type == type) \ + return res##_names[i].name; \ + } \ + return "(invalid)"; \ +} + +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" }, +}; + +type_name_fn(encoder_type) + +struct type_name connector_status_names[] = { + { DRM_MODE_CONNECTED, "connected" }, + { DRM_MODE_DISCONNECTED, "disconnected" }, + { DRM_MODE_UNKNOWNCONNECTION, "unknown" }, +}; + +type_name_fn(connector_status) + +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, "s-video" }, + { DRM_MODE_CONNECTOR_LVDS, "LVDS" }, + { DRM_MODE_CONNECTOR_Component, "component" }, + { DRM_MODE_CONNECTOR_9PinDIN, "9-pin 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" }, +}; + +type_name_fn(connector_type) diff --git a/lib/igt_kms.c b/lib/igt_kms.c index cba0c27a..eb8e0853 100644 --- a/lib/igt_kms.c +++ b/lib/igt_kms.c @@ -120,59 +120,6 @@ const char *kmstest_plane_name(enum igt_plane plane) return names[plane]; } -struct type_name { - int type; - const char *name; -}; - -#define type_name_fn(res) \ -const char * kmstest_##res##_str(int type) { \ - unsigned int i; \ - for (i = 0; i < ARRAY_SIZE(res##_names); i++) { \ - if (res##_names[i].type == type) \ - return res##_names[i].name; \ - } \ - return "(invalid)"; \ -} - -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" }, -}; - -type_name_fn(encoder_type) - -struct type_name connector_status_names[] = { - { DRM_MODE_CONNECTED, "connected" }, - { DRM_MODE_DISCONNECTED, "disconnected" }, - { DRM_MODE_UNKNOWNCONNECTION, "unknown" }, -}; - -type_name_fn(connector_status) - -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, "s-video" }, - { DRM_MODE_CONNECTOR_LVDS, "LVDS" }, - { DRM_MODE_CONNECTOR_Component, "component" }, - { DRM_MODE_CONNECTOR_9PinDIN, "9-pin 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" }, -}; - -type_name_fn(connector_type) - static const char *mode_stereo_name(const drmModeModeInfo *mode) { switch (mode->flags & DRM_MODE_FLAG_3D_MASK) { -- cgit v1.2.3