Skip to content

Instantly share code, notes, and snippets.

@PyYoshi
Created April 12, 2013 14:55
Show Gist options
  • Save PyYoshi/5372622 to your computer and use it in GitHub Desktop.
Save PyYoshi/5372622 to your computer and use it in GitHub Desktop.
JCROMonIS01_20121021
--- kernel/deckard/arch/arm/configs/deckard_defconfig
+++ kernel/deckard/arch/arm/configs/deckard_defconfig
@@ -35,7 +35,7 @@
CONFIG_INIT_ENV_ARG_LIMIT=32
CONFIG_LOCALVERSION="$(KERNEL_LOCAL_VERSION)-perf"
# CONFIG_LOCALVERSION_AUTO is not set
-# CONFIG_SWAP is not set
+CONFIG_SWAP=y
CONFIG_SYSVIPC=y
CONFIG_SYSVIPC_SYSCTL=y
# CONFIG_POSIX_MQUEUE is not set
@@ -184,6 +184,8 @@
CONFIG_MACH_QSD8X50_COMET=y
CONFIG_MACH_DECKARD=y
CONFIG_MSM_STACKED_MEMORY=y
+CONFIG_KERNEL_PMEM_SMI_REGION=y
+# CONFIG_PMEM_GPU0 is not set
CONFIG_MSM_DEBUG_UART_NONE=y
# CONFIG_MSM_DEBUG_UART1 is not set
# CONFIG_MSM_DEBUG_UART2 is not set
@@ -299,10 +301,10 @@
CONFIG_NO_HZ=y
CONFIG_HIGH_RES_TIMERS=y
CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
-# CONFIG_VMSPLIT_3G is not set
-CONFIG_VMSPLIT_2G=y
+CONFIG_VMSPLIT_3G=y
+# CONFIG_VMSPLIT_2G is not set
# CONFIG_VMSPLIT_1G is not set
-CONFIG_PAGE_OFFSET=0x80000000
+CONFIG_PAGE_OFFSET=0xC0000000
CONFIG_PREEMPT=y
CONFIG_HZ=100
CONFIG_AEABI=y
@@ -391,8 +393,8 @@
CONFIG_USER_WAKELOCK=y
CONFIG_EARLYSUSPEND=y
# CONFIG_NO_USER_SPACE_SCREEN_ACCESS_CONTROL is not set
-CONFIG_CONSOLE_EARLYSUSPEND=y
-# CONFIG_FB_EARLYSUSPEND is not set
+# CONFIG_CONSOLE_EARLYSUSPEND is not set
+CONFIG_FB_EARLYSUSPEND=y
# CONFIG_APM_EMULATION is not set
CONFIG_ARCH_SUSPEND_POSSIBLE=y
CONFIG_NET=y
@@ -428,7 +430,24 @@
CONFIG_TCP_CONG_CUBIC=y
CONFIG_DEFAULT_TCP_CONG="cubic"
# CONFIG_TCP_MD5SIG is not set
-# CONFIG_IPV6 is not set
+CONFIG_IPV6=y
+# CONFIG_IPV6_PRIVACY is not set
+# CONFIG_IPV6_ROUTER_PREF is not set
+# CONFIG_IPV6_OPTIMISTIC_DAD is not set
+# CONFIG_INET6_AH is not set
+# CONFIG_INET6_ESP is not set
+# CONFIG_INET6_IPCOMP is not set
+# CONFIG_IPV6_MIP6 is not set
+# CONFIG_INET6_XFRM_TUNNEL is not set
+# CONFIG_INET6_TUNNEL is not set
+# CONFIG_INET6_XFRM_MODE_TRANSPORT is not set
+# CONFIG_INET6_XFRM_MODE_TUNNEL is not set
+# CONFIG_INET6_XFRM_MODE_BEET is not set
+# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set
+# CONFIG_IPV6_SIT is not set
+# CONFIG_IPV6_TUNNEL is not set
+# CONFIG_IPV6_MULTIPLE_TABLES is not set
+# CONFIG_IPV6_MROUTE is not set
# CONFIG_NETLABEL is not set
CONFIG_ANDROID_PARANOID_NETWORK=y
# CONFIG_NETWORK_SECMARK is not set
@@ -480,19 +499,14 @@
#
# CONFIG_NF_DEFRAG_IPV4 is not set
# CONFIG_IP_NF_QUEUE is not set
-CONFIG_IP_NF_IPTABLES=y
-# CONFIG_IP_NF_MATCH_ADDRTYPE is not set
-# CONFIG_IP_NF_MATCH_AH is not set
-# CONFIG_IP_NF_MATCH_ECN is not set
-# CONFIG_IP_NF_MATCH_TTL is not set
-CONFIG_IP_NF_FILTER=y
-# CONFIG_IP_NF_TARGET_REJECT is not set
-# CONFIG_IP_NF_TARGET_LOG is not set
-# CONFIG_IP_NF_TARGET_ULOG is not set
-# CONFIG_IP_NF_MANGLE is not set
-# CONFIG_IP_NF_RAW is not set
-# CONFIG_IP_NF_SECURITY is not set
+# CONFIG_IP_NF_IPTABLES is not set
# CONFIG_IP_NF_ARPTABLES is not set
+
+#
+# IPv6: Netfilter Configuration
+#
+# CONFIG_IP6_NF_QUEUE is not set
+# CONFIG_IP6_NF_IPTABLES is not set
# CONFIG_IP_DCCP is not set
# CONFIG_IP_SCTP is not set
# CONFIG_TIPC is not set
@@ -602,6 +616,8 @@
# CONFIG_DEBUG_DRIVER is not set
# CONFIG_DEBUG_DEVRES is not set
# CONFIG_SYS_HYPERVISOR is not set
+CONFIG_GENLOCK=y
+CONFIG_GENLOCK_MISCDEVICE=y
# CONFIG_CONNECTOR is not set
CONFIG_MTD=y
# CONFIG_MTD_DEBUG is not set
@@ -767,7 +783,17 @@
# CONFIG_SCSI_DEBUG is not set
# CONFIG_SCSI_DH is not set
# CONFIG_ATA is not set
-# CONFIG_MD is not set
+CONFIG_MD=y
+# CONFIG_BLK_DEV_MD is not set
+CONFIG_BLK_DEV_DM=y
+# CONFIG_DM_DEBUG is not set
+CONFIG_DM_CRYPT=y
+# CONFIG_DM_SNAPSHOT is not set
+# CONFIG_DM_MIRROR is not set
+# CONFIG_DM_ZERO is not set
+# CONFIG_DM_MULTIPATH is not set
+# CONFIG_DM_DELAY is not set
+CONFIG_DM_UEVENT=y
CONFIG_NETDEVICES=y
CONFIG_DUMMY=y
# CONFIG_BONDING is not set
@@ -910,8 +936,8 @@
CONFIG_VT_CONSOLE=y
CONFIG_HW_CONSOLE=y
# CONFIG_VT_HW_CONSOLE_BINDING is not set
-# CONFIG_DEVMEM is not set
-# CONFIG_DEVKMEM is not set
+CONFIG_DEVMEM=y
+CONFIG_DEVKMEM=y
# CONFIG_SERIAL_NONSTANDARD is not set
#
@@ -943,8 +969,6 @@
# CONFIG_TCG_TPM is not set
# CONFIG_DCC_TTY is not set
CONFIG_Q6_VENC=y
-CONFIG_MSM_KGSL=y
-CONFIG_MSM_KGSL_DRM=y
CONFIG_MSM_Q6VDEC=y
CONFIG_I2C=y
CONFIG_I2C_BOARDINFO=y
@@ -1097,8 +1121,6 @@
# CONFIG_MT9T013 is not set
CONFIG_MT9D112=y
# CONFIG_MT9P012 is not set
-# CONFIG_MSM_CAMERA_AF_FOXCONN is not set
-# CONFIG_MSM_CAMERA_AF_BAM is not set
# CONFIG_S5K3E2FX is not set
# CONFIG_VB6801 is not set
# CONFIG_MSM_CAMERA_FLASH is not set
@@ -1113,6 +1135,17 @@
# CONFIG_DRM_MGA is not set
# CONFIG_DRM_VIA is not set
# CONFIG_DRM_SAVAGE is not set
+CONFIG_MSM_KGSL=y
+# CONFIG_MSM_KGSL_CFF_DUMP is not set
+# CONFIG_MSM_KGSL_PSTMRTMDMP_CP_STAT_NO_DETAIL is not set
+# CONFIG_MSM_KGSL_PSTMRTMDMP_NO_IB_DUMP is not set
+# CONFIG_MSM_KGSL_PSTMRTMDMP_RB_HEX is not set
+# CONFIG_MSM_KGSL_DRM is not set
+CONFIG_KGSL_PER_PROCESS_PAGE_TABLE=y
+CONFIG_MSM_KGSL_PAGE_TABLE_SIZE=0xFFF0000
+CONFIG_MSM_KGSL_PAGE_TABLE_COUNT=8
+CONFIG_MSM_KGSL_MMU_PAGE_FAULT=y
+# CONFIG_MSM_KGSL_DISABLE_SHADOW_WRITES is not set
# CONFIG_VGASTATE is not set
CONFIG_VIDEO_OUTPUT_CONTROL=y
CONFIG_FB=y
@@ -1205,12 +1238,7 @@
#
# CONFIG_VGA_CONSOLE is not set
CONFIG_DUMMY_CONSOLE=y
-CONFIG_FRAMEBUFFER_CONSOLE=y
-# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set
-# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
-# CONFIG_FONTS is not set
-CONFIG_FONT_8x8=y
-CONFIG_FONT_8x16=y
+# CONFIG_FRAMEBUFFER_CONSOLE is not set
# CONFIG_LOGO is not set
CONFIG_SOUND=y
# CONFIG_SOUND_OSS_CORE is not set
@@ -1286,6 +1314,7 @@
CONFIG_USB_FUNCTION_DIAG=y
CONFIG_USB_FUNCTION_ETHER=y
CONFIG_USB_FUNCTION_SERIAL=y
+# CONFIG_USB_FUNCTION_RMNET is not set
CONFIG_USB_FUNCTION_MDLM=y
CONFIG_USB_FUNCTION_OBEX=y
CONFIG_USB_FUNCTION_MTP=y
@@ -1315,7 +1344,9 @@
CONFIG_MMC_MSM_SDIO_SUPPORT=y
# CONFIG_MMC_MSM_CARD_HW_DETECTION is not set
CONFIG_MMC_MSM_SDC1_SUPPORT=y
+# CONFIG_MMC_MSM_SDC1_8_BIT_SUPPORT is not set
CONFIG_MMC_MSM_SDC2_SUPPORT=y
+# CONFIG_MMC_MSM_SDC2_8_BIT_SUPPORT is not set
# CONFIG_MMC_MSM_SDC3_SUPPORT is not set
# CONFIG_MMC_MSM_SDC4_SUPPORT is not set
# CONFIG_MEMSTICK is not set
@@ -1425,7 +1456,7 @@
CONFIG_ANDROID_TIMED_OUTPUT=y
CONFIG_ANDROID_TIMED_GPIO=y
CONFIG_ANDROID_LOW_MEMORY_KILLER=y
-# CONFIG_ANDROID_ENGINEERING is not set
+CONFIG_ANDROID_ENGINEERING=y
#
# File systems
@@ -1439,9 +1470,15 @@
CONFIG_EXT3_FS_XATTR=y
# CONFIG_EXT3_FS_POSIX_ACL is not set
# CONFIG_EXT3_FS_SECURITY is not set
-# CONFIG_EXT4_FS is not set
+CONFIG_EXT4_FS=y
+# CONFIG_EXT4DEV_COMPAT is not set
+CONFIG_EXT4_FS_XATTR=y
+# CONFIG_EXT4_FS_POSIX_ACL is not set
+# CONFIG_EXT4_FS_SECURITY is not set
CONFIG_JBD=y
# CONFIG_JBD_DEBUG is not set
+CONFIG_JBD2=y
+# CONFIG_JBD2_DEBUG is not set
CONFIG_FS_MBCACHE=y
# CONFIG_REISERFS_FS is not set
# CONFIG_JFS_FS is not set
@@ -1504,7 +1541,12 @@
# CONFIG_YAFFS_ALWAYS_CHECK_CHUNK_ERASED is not set
CONFIG_YAFFS_SHORT_NAMES_IN_RAM=y
# CONFIG_JFFS2_FS is not set
-# CONFIG_UBIFS_FS is not set
+CONFIG_UBIFS_FS=y
+CONFIG_UBIFS_FS_XATTR=y
+# CONFIG_UBIFS_FS_ADVANCED_COMPR is not set
+CONFIG_UBIFS_FS_LZO=y
+CONFIG_UBIFS_FS_ZLIB=y
+# CONFIG_UBIFS_FS_DEBUG is not set
# CONFIG_CRAMFS is not set
# CONFIG_SQUASHFS is not set
# CONFIG_VXFS_FS is not set
@@ -1664,9 +1706,7 @@
# CONFIG_SECURITY_NETWORK is not set
CONFIG_SECURITY_PATH=y
# CONFIG_SECURITY_FILE_CAPABILITIES is not set
-CONFIG_SECURITY_DECKARD=y
-CONFIG_SECURITY_DECKARD_SYSTEM_DEV_PATH="/dev/block/mtdblock5"
-CONFIG_SECURITY_DECKARD_CHROOT_PATH=""
+# CONFIG_SECURITY_DECKARD is not set
CONFIG_CRYPTO=y
#
@@ -1675,10 +1715,14 @@
# CONFIG_CRYPTO_FIPS is not set
CONFIG_CRYPTO_ALGAPI=y
CONFIG_CRYPTO_ALGAPI2=y
+CONFIG_CRYPTO_AEAD2=y
+CONFIG_CRYPTO_BLKCIPHER=y
+CONFIG_CRYPTO_BLKCIPHER2=y
CONFIG_CRYPTO_HASH=y
CONFIG_CRYPTO_HASH2=y
-# CONFIG_CRYPTO_MANAGER is not set
-# CONFIG_CRYPTO_MANAGER2 is not set
+CONFIG_CRYPTO_RNG2=y
+CONFIG_CRYPTO_MANAGER=y
+CONFIG_CRYPTO_MANAGER2=y
# CONFIG_CRYPTO_GF128MUL is not set
# CONFIG_CRYPTO_NULL is not set
# CONFIG_CRYPTO_CRYPTD is not set
@@ -1695,10 +1739,10 @@
#
# Block modes
#
-# CONFIG_CRYPTO_CBC is not set
+CONFIG_CRYPTO_CBC=y
# CONFIG_CRYPTO_CTR is not set
# CONFIG_CRYPTO_CTS is not set
-# CONFIG_CRYPTO_ECB is not set
+CONFIG_CRYPTO_ECB=y
# CONFIG_CRYPTO_LRW is not set
# CONFIG_CRYPTO_PCBC is not set
# CONFIG_CRYPTO_XTS is not set
@@ -1720,7 +1764,7 @@
# CONFIG_CRYPTO_RMD160 is not set
# CONFIG_CRYPTO_RMD256 is not set
# CONFIG_CRYPTO_RMD320 is not set
-# CONFIG_CRYPTO_SHA1 is not set
+CONFIG_CRYPTO_SHA1=y
CONFIG_CRYPTO_SHA256=y
# CONFIG_CRYPTO_SHA512 is not set
# CONFIG_CRYPTO_TGR192 is not set
@@ -1731,7 +1775,7 @@
#
# CONFIG_CRYPTO_AES is not set
# CONFIG_CRYPTO_ANUBIS is not set
-# CONFIG_CRYPTO_ARC4 is not set
+CONFIG_CRYPTO_ARC4=y
# CONFIG_CRYPTO_BLOWFISH is not set
# CONFIG_CRYPTO_CAMELLIA is not set
# CONFIG_CRYPTO_CAST5 is not set
@@ -1743,7 +1787,8 @@
# CONFIG_CRYPTO_SEED is not set
# CONFIG_CRYPTO_SERPENT is not set
# CONFIG_CRYPTO_TEA is not set
-# CONFIG_CRYPTO_TWOFISH is not set
+CONFIG_CRYPTO_TWOFISH=y
+CONFIG_CRYPTO_TWOFISH_COMMON=y
#
# Compression
--- kernel/deckard/Makefile
+++ kernel/deckard/Makefile
@@ -346,7 +346,6 @@
KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
-fno-strict-aliasing -fno-common \
- -Werror \
-Werror-implicit-function-declaration
KBUILD_AFLAGS := -D__ASSEMBLY__
--- kernel/deckard/arch/arm/mm/proc-macros.S
+++ kernel/deckard/arch/arm/mm/proc-macros.S
@@ -61,17 +61,27 @@
.endm
/*
- * cache_line_size - get the cache line size from the CSIDR register
- * (available on ARMv7+). It assumes that the CSSR register was configured
- * to access the L1 data cache CSIDR.
+ * dcache_line_size - get the minimum D-cache line size from the CTR register
+ * on ARMv7.
*/
.macro dcache_line_size, reg, tmp
- mrc p15, 1, \tmp, c0, c0, 0 @ read CSIDR
- and \tmp, \tmp, #7 @ cache line size encoding
- mov \reg, #16 @ size offset
+ mrc p15, 0, \tmp, c0, c0, 1 @ read ctr
+ lsr \tmp, \tmp, #16
+ and \tmp, \tmp, #0xf @ cache line size encoding
+ mov \reg, #4 @ bytes per word
mov \reg, \reg, lsl \tmp @ actual cache line size
.endm
+/*
+ * icache_line_size - get the minimum I-cache line size from the CTR register
+ * on ARMv7.
+ */
+ .macro icache_line_size, reg, tmp
+ mrc p15, 0, \tmp, c0, c0, 1 @ read ctr
+ and \tmp, \tmp, #0xf @ cache line size encoding
+ mov \reg, #4 @ bytes per word
+ mov \reg, \reg, lsl \tmp @ actual cache line size
+ .endm
/*
* Sanity check the PTE configuration for the code below - which makes
--- kernel/deckard/arch/arm/mm/cache-v7.S
+++ kernel/deckard/arch/arm/mm/cache-v7.S
@@ -149,18 +149,37 @@
ENTRY(v7_coherent_user_range)
dcache_line_size r2, r3
sub r3, r2, #1
- bic r0, r0, r3
-1: mcr p15, 0, r0, c7, c11, 1 @ clean D line to the point of unification
- dsb
- mcr p15, 0, r0, c7, c5, 1 @ invalidate I line
- add r0, r0, r2
- cmp r0, r1
+ bic r12, r0, r3
+1:
+ USER( mcr p15, 0, r12, c7, c11, 1 ) @ clean D line to the point of unification
+ add r12, r12, r2
+ cmp r12, r1
blo 1b
+ dsb
+ icache_line_size r2, r3
+ sub r3, r2, #1
+ bic r12, r0, r3
+2:
+ USER( mcr p15, 0, r12, c7, c5, 1 ) @ invalidate I line
+ add r12, r12, r2
+ cmp r12, r1
+ blo 2b
+3:
mov r0, #0
mcr p15, 0, r0, c7, c5, 6 @ invalidate BTB
dsb
isb
mov pc, lr
+
+/*
+ * Fault handling for the cache operation above. If the virtual address in r0
+ * isn't mapped, just try the next page.
+ */
+9001:
+ mov r12, r12, lsr #12
+ mov r12, r12, lsl #12
+ add r12, r12, #4096
+ b 3b
ENDPROC(v7_coherent_kern_range)
ENDPROC(v7_coherent_user_range)
--- kernel/deckard/arch/arm/include/asm/cacheflush.h
+++ kernel/deckard/arch/arm/include/asm/cacheflush.h
@@ -365,7 +365,7 @@
* Harvard caches are synchronised for the user space address range.
* This is used for the ARM private sys_cacheflush system call.
*/
-#define flush_cache_user_range(vma,start,end) \
+#define flush_cache_user_range(start,end) \
__cpuc_coherent_user_range((start) & PAGE_MASK, PAGE_ALIGN(end))
/*
--- kernel/deckard/arch/arm/kernel/traps.c
+++ kernel/deckard/arch/arm/kernel/traps.c
@@ -424,6 +424,7 @@
static inline void
do_cache_op(unsigned long start, unsigned long end, int flags)
{
+ struct mm_struct *mm = current->active_mm;
struct vm_area_struct *vma;
#ifdef CONFIG_ARCH_MSM_ARM11
@@ -441,15 +442,19 @@
}
#endif
- vma = find_vma(current->active_mm, start);
+ down_read(&mm->mmap_sem);
+ vma = find_vma(mm, start);
if (vma && vma->vm_start < end) {
if (start < vma->vm_start)
start = vma->vm_start;
if (end > vma->vm_end)
end = vma->vm_end;
- flush_cache_user_range(vma, start, end);
+ up_read(&mm->mmap_sem);
+ flush_cache_user_range(start, end);
+ return;
}
+ up_read(&mm->mmap_sem);
}
/*
--- kernel/deckard/arch/arm/mm/fault.c
+++ kernel/deckard/arch/arm/mm/fault.c
@@ -455,7 +455,7 @@
{ do_bad, SIGILL, BUS_ADRALN, "alignment exception" },
{ do_bad, SIGKILL, 0, "terminal exception" },
{ do_bad, SIGILL, BUS_ADRALN, "alignment exception" },
- { do_bad, SIGBUS, 0, "external abort on linefetch" },
+ { do_translation_fault, SIGSEGV, SEGV_MAPERR, "I-cache maintenance fault" },
{ do_translation_fault, SIGSEGV, SEGV_MAPERR, "section translation fault" },
{ do_bad, SIGBUS, 0, "external abort on linefetch" },
{ do_page_fault, SIGSEGV, SEGV_MAPERR, "page translation fault" },
--- kernel/deckard/drivers/char/Makefile
+++ kernel/deckard/drivers/char/Makefile
@@ -121,7 +121,6 @@
obj-$(CONFIG_MSM_Q6VDEC) += msm_q6vdec.o
obj-$(CONFIG_Q6_VENC) += msm_q6venc.o
-obj-$(CONFIG_MSM_KGSL) += msm_kgsl/
# Files generated that shall be removed upon make clean
clean-files := consolemap_deftbl.c defkeymap.c
--- kernel/deckard/drivers/char/Kconfig
+++ kernel/deckard/drivers/char/Kconfig
@@ -1125,20 +1125,6 @@
help
Kernel driver for MSM QDSP6 video encoding.
-config MSM_KGSL
- tristate "MSM 3D Graphics driver"
- default n
- depends on FB && ARM && (ARCH_QSD8X50 || ARCH_MSM7X27 || ARCH_MSM7X30) && !MSM_HW3D
- select GENERIC_ALLOCATOR
- select FW_LOADER
- ---help---
- 3D graphics driver. Required to use hardware accelerated
- OpenGL ES 2.0 and 1.1.
-
-config MSM_KGSL_DRM
- bool "Build a DRM interface for the MSM_KGSL driver"
- depends on MSM_KGSL && DRM
-
source "drivers/s390/char/Kconfig"
config MSM_Q6VDEC
--- kernel/deckard/drivers/video/Kconfig
+++ kernel/deckard/drivers/video/Kconfig
@@ -9,6 +9,8 @@
source "drivers/gpu/drm/Kconfig"
+source "drivers/gpu/msm/Kconfig"
+
config VGASTATE
tristate
default n
--- kernel/deckard/drivers/gpu/Makefile
+++ kernel/deckard/drivers/gpu/Makefile
@@ -1 +1,2 @@
obj-y += drm/
+obj-$(CONFIG_MSM_KGSL) += msm/
--- kernel/deckard/arch/arm/mach-msm/Kconfig
+++ kernel/deckard/arch/arm/mach-msm/Kconfig
@@ -174,6 +174,20 @@
memory. When present this memory bank is used for a high speed
shared memory interface. When not present regular RAM is used.
+config KERNEL_PMEM_SMI_REGION
+ bool "Enable in-kernel PMEM region for SMI"
+ default n
+ depends on ARCH_QSD8X50 && !PMEM_GPU0
+ help
+ Enable the in-kernel PMEM alloator to use SMI memory.
+
+config PMEM_GPU0
+ bool "Enable PMEM GPU0 region"
+ default y
+ depends on ARCH_QSD8X50 && ANDROID_PMEM
+ help
+ Enable the PMEM GPU0 device
+
config MSM_DEBUG_UART
int
default 1 if MSM_DEBUG_UART1
--- kernel/deckard/include/linux/android_pmem.h
+++ kernel/deckard/include/linux/android_pmem.h
@@ -58,6 +58,7 @@
#define PMEM_CLEAN_CACHES _IOW(PMEM_IOCTL_MAGIC, 12, unsigned int)
#define PMEM_INV_CACHES _IOW(PMEM_IOCTL_MAGIC, 13, unsigned int)
+#define PMEM_ALLOCATE_ALIGNED _IOW(PMEM_IOCTL_MAGIC, 15, unsigned int)
struct pmem_region {
unsigned long offset;
unsigned long len;
@@ -69,6 +70,11 @@
unsigned long length;
};
+struct pmem_allocation {
+ unsigned long size;
+ unsigned int align;
+};
+
#ifdef __KERNEL__
int get_pmem_file(unsigned int fd, unsigned long *start, unsigned long *vstart,
unsigned long *end, struct file **filp);
@@ -96,7 +102,7 @@
#define PMEM_MEMTYPE_MASK 0x7
#define PMEM_INVALID_MEMTYPE 0x0
#define PMEM_MEMTYPE_EBI1 0x1
-#define PMEM_MEMTYPE_RESERVED_INVALID1 0x2
+#define PMEM_MEMTYPE_SMI 0x2
#define PMEM_MEMTYPE_RESERVED_INVALID2 0x3
#define PMEM_MEMTYPE_RESERVED_INVALID3 0x4
#define PMEM_MEMTYPE_RESERVED_INVALID4 0x5
@@ -115,6 +121,7 @@
/* kernel api names for board specific data structures */
#define PMEM_KERNEL_EBI1_DATA_NAME "pmem_kernel_ebi1"
+#define PMEM_KERNEL_SMI_DATA_NAME "pmem_kernel_smi"
struct android_pmem_platform_data
{
--- kernel/deckard/include/linux/anon_inodes.h
+++ kernel/deckard/include/linux/anon_inodes.h
@@ -8,6 +8,9 @@
#ifndef _LINUX_ANON_INODES_H
#define _LINUX_ANON_INODES_H
+struct file *anon_inode_getfile(const char *name,
+ const struct file_operations *fops,
+ void *priv, int flags);
int anon_inode_getfd(const char *name, const struct file_operations *fops,
void *priv, int flags);
--- kernel/deckard/include/linux/ashmem.h
+++ kernel/deckard/include/linux/ashmem.h
@@ -44,5 +44,12 @@
#define ASHMEM_UNPIN _IOW(__ASHMEMIOC, 8, struct ashmem_pin)
#define ASHMEM_GET_PIN_STATUS _IO(__ASHMEMIOC, 9)
#define ASHMEM_PURGE_ALL_CACHES _IO(__ASHMEMIOC, 10)
+#define ASHMEM_CACHE_FLUSH_RANGE _IO(__ASHMEMIOC, 11)
+#define ASHMEM_CACHE_CLEAN_RANGE _IO(__ASHMEMIOC, 12)
+#define ASHMEM_CACHE_INV_RANGE _IO(__ASHMEMIOC, 13)
+
+int get_ashmem_file(int fd, struct file **filp, struct file **vm_file,
+ unsigned long *len);
+void put_ashmem_file(struct file *file);
#endif /* _LINUX_ASHMEM_H */
--- kernel/deckard/include/linux/err.h
+++ kernel/deckard/include/linux/err.h
@@ -34,6 +34,11 @@
return IS_ERR_VALUE((unsigned long)ptr);
}
+static inline long __must_check IS_ERR_OR_NULL(const void *ptr)
+{
+ return !ptr || IS_ERR_VALUE((unsigned long)ptr);
+}
+
/**
* ERR_CAST - Explicitly cast an error-valued pointer to another pointer type
* @ptr: The pointer to cast.
--- kernel/deckard/include/linux/idr.h
+++ kernel/deckard/include/linux/idr.h
@@ -106,6 +106,7 @@
int idr_get_new_above(struct idr *idp, void *ptr, int starting_id, int *id);
int idr_for_each(struct idr *idp,
int (*fn)(int id, void *p, void *data), void *data);
+void *idr_get_next(struct idr *idp, int *nextid);
void *idr_replace(struct idr *idp, void *ptr, int id);
void idr_remove(struct idr *idp, int id);
void idr_remove_all(struct idr *idp);
--- kernel/deckard/include/linux/mm.h
+++ kernel/deckard/include/linux/mm.h
@@ -13,6 +13,7 @@
#include <linux/prio_tree.h>
#include <linux/debug_locks.h>
#include <linux/mm_types.h>
+#include <linux/pfn.h>
struct mempolicy;
struct anon_vma;
--- kernel/deckard/include/linux/mod_devicetable.h
+++ kernel/deckard/include/linux/mod_devicetable.h
@@ -454,4 +454,12 @@
#define DMI_MATCH(a, b) { a, b }
+#define PLATFORM_NAME_SIZE 20
+
+struct platform_device_id {
+ char name[PLATFORM_NAME_SIZE];
+ kernel_ulong_t driver_data
+ __attribute__((aligned(sizeof(kernel_ulong_t))));
+};
+
#endif /* LINUX_MOD_DEVICETABLE_H */
--- kernel/deckard/include/linux/of.h
+++ kernel/deckard/include/linux/of.h
@@ -21,6 +21,8 @@
#include <asm/prom.h>
+typedef u32 phandle;
+
/* flag descriptions */
#define OF_DYNAMIC 1 /* node and properties were allocated via kmalloc */
#define OF_DETACHED 2 /* node has been detached from the device tree */
--- kernel/deckard/include/linux/pm.h
+++ kernel/deckard/include/linux/pm.h
@@ -278,6 +278,36 @@
{ .event = PM_EVENT_AUTO_RESUME, })
/**
+ * Device run-time power management status.
+ *
+ * These status labels are used internally by the PM core to indicate the
+ * current status of a device with respect to the PM core operations. They do
+ * not reflect the actual power state of the device or its status as seen by the
+ * driver.
+ *
+ * RPM_ACTIVE Device is fully operational. Indicates that the device
+ * bus type's ->runtime_resume() callback has completed
+ * successfully.
+ *
+ * RPM_SUSPENDED Device bus type's ->runtime_suspend() callback has
+ * completed successfully. The device is regarded as
+ * suspended.
+ *
+ * RPM_RESUMING Device bus type's ->runtime_resume() callback is being
+ * executed.
+ *
+ * RPM_SUSPENDING Device bus type's ->runtime_suspend() callback is being
+ * executed.
+ */
+
+enum rpm_status {
+ RPM_ACTIVE = 0,
+ RPM_RESUMING,
+ RPM_SUSPENDED,
+ RPM_SUSPENDING,
+};
+
+/**
* Device power management states
*
* These state labels are used internally by the PM core to indicate the current
--- kernel/deckard/include/linux/timer.h
+++ kernel/deckard/include/linux/timer.h
@@ -88,6 +88,9 @@
extern int del_timer(struct timer_list * timer);
extern int __mod_timer(struct timer_list *timer, unsigned long expires);
extern int mod_timer(struct timer_list *timer, unsigned long expires);
+extern int mod_timer_pending(struct timer_list *timer, unsigned long expires);
+
+#define TIMER_NOT_PINNED 0
/*
* The jiffies value which is added to now, when there is no timer
--- kernel/deckard/include/linux/tracepoint.h
+++ kernel/deckard/include/linux/tracepoint.h
@@ -34,6 +34,9 @@
#define TPPROTO(args...) args
#define TPARGS(args...) args
+#define TP_PROTO(args...) args
+#define TP_ARGS(args...) args
+
#ifdef CONFIG_TRACEPOINTS
/*
@@ -115,6 +118,138 @@
{ }
#endif /* CONFIG_TRACEPOINTS */
+#define PARAMS(args...) args
+
+#ifndef TRACE_EVENT
+/*
+ * For use with the TRACE_EVENT macro:
+ *
+ * We define a tracepoint, its arguments, its printk format
+ * and its 'fast binay record' layout.
+ *
+ * Firstly, name your tracepoint via TRACE_EVENT(name : the
+ * 'subsystem_event' notation is fine.
+ *
+ * Think about this whole construct as the
+ * 'trace_sched_switch() function' from now on.
+ *
+ *
+ * TRACE_EVENT(sched_switch,
+ *
+ * *
+ * * A function has a regular function arguments
+ * * prototype, declare it via TP_PROTO():
+ * *
+ *
+ * TP_PROTO(struct rq *rq, struct task_struct *prev,
+ * struct task_struct *next),
+ *
+ * *
+ * * Define the call signature of the 'function'.
+ * * (Design sidenote: we use this instead of a
+ * * TP_PROTO1/TP_PROTO2/TP_PROTO3 ugliness.)
+ * *
+ *
+ * TP_ARGS(rq, prev, next),
+ *
+ * *
+ * * Fast binary tracing: define the trace record via
+ * * TP_STRUCT__entry(). You can think about it like a
+ * * regular C structure local variable definition.
+ * *
+ * * This is how the trace record is structured and will
+ * * be saved into the ring buffer. These are the fields
+ * * that will be exposed to user-space in
+ * * /sys/kernel/debug/tracing/events/<*>/format.
+ * *
+ * * The declared 'local variable' is called '__entry'
+ * *
+ * * __field(pid_t, prev_prid) is equivalent to a standard declariton:
+ * *
+ * * pid_t prev_pid;
+ * *
+ * * __array(char, prev_comm, TASK_COMM_LEN) is equivalent to:
+ * *
+ * * char prev_comm[TASK_COMM_LEN];
+ * *
+ *
+ * TP_STRUCT__entry(
+ * __array( char, prev_comm, TASK_COMM_LEN )
+ * __field( pid_t, prev_pid )
+ * __field( int, prev_prio )
+ * __array( char, next_comm, TASK_COMM_LEN )
+ * __field( pid_t, next_pid )
+ * __field( int, next_prio )
+ * ),
+ *
+ * *
+ * * Assign the entry into the trace record, by embedding
+ * * a full C statement block into TP_fast_assign(). You
+ * * can refer to the trace record as '__entry' -
+ * * otherwise you can put arbitrary C code in here.
+ * *
+ * * Note: this C code will execute every time a trace event
+ * * happens, on an active tracepoint.
+ * *
+ *
+ * TP_fast_assign(
+ * memcpy(__entry->next_comm, next->comm, TASK_COMM_LEN);
+ * __entry->prev_pid = prev->pid;
+ * __entry->prev_prio = prev->prio;
+ * memcpy(__entry->prev_comm, prev->comm, TASK_COMM_LEN);
+ * __entry->next_pid = next->pid;
+ * __entry->next_prio = next->prio;
+ * ),
+ *
+ * *
+ * * Formatted output of a trace record via TP_printk().
+ * * This is how the tracepoint will appear under ftrace
+ * * plugins that make use of this tracepoint.
+ * *
+ * * (raw-binary tracing wont actually perform this step.)
+ * *
+ *
+ * TP_printk("task %s:%d [%d] ==> %s:%d [%d]",
+ * __entry->prev_comm, __entry->prev_pid, __entry->prev_prio,
+ * __entry->next_comm, __entry->next_pid, __entry->next_prio),
+ *
+ * );
+ *
+ * This macro construct is thus used for the regular printk format
+ * tracing setup, it is used to construct a function pointer based
+ * tracepoint callback (this is used by programmatic plugins and
+ * can also by used by generic instrumentation like SystemTap), and
+ * it is also used to expose a structured trace record in
+ * /sys/kernel/debug/tracing/events/.
+ *
+ * A set of (un)registration functions can be passed to the variant
+ * TRACE_EVENT_FN to perform any (un)registration work.
+ */
+
+#define DECLARE_EVENT_CLASS(name, proto, args, tstruct, assign, print)
+#define DEFINE_EVENT(template, name, proto, args) \
+ DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
+#define DEFINE_EVENT_PRINT(template, name, proto, args, print) \
+ DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
+#define DEFINE_EVENT_CONDITION(template, name, proto, \
+ args, cond) \
+ DECLARE_TRACE_CONDITION(name, PARAMS(proto), \
+ PARAMS(args), PARAMS(cond))
+
+#define TRACE_EVENT(name, proto, args, struct, assign, print) \
+ DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
+#define TRACE_EVENT_FN(name, proto, args, struct, \
+ assign, print, reg, unreg) \
+ DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
+#define TRACE_EVENT_CONDITION(name, proto, args, cond, \
+ struct, assign, print) \
+ DECLARE_TRACE_CONDITION(name, PARAMS(proto), \
+ PARAMS(args), PARAMS(cond))
+
+#define TRACE_EVENT_FLAGS(event, flag)
+
+#endif /* ifdef TRACE_EVENT (see note above) */
+
/*
* Connect a probe to a tracepoint.
* Internal API, should not be used directly.
--- kernel/deckard/include/linux/wait.h
+++ kernel/deckard/include/linux/wait.h
@@ -378,6 +378,49 @@
} while (0)
/**
+ * wait_io_event_interruptible - sleep until an io condition gets true
+ * @wq: the waitqueue to wait on
+ * @condition: a C expression for the event to wait for
+ *
+ * The process is put to sleep (TASK_INTERRUPTIBLE) until the
+ * @condition evaluates to true or a signal is received.
+ * The @condition is checked each time the waitqueue @wq is woken up.
+ *
+ * wake_up() has to be called after changing any variable that could
+ * change the result of the wait condition.
+ *
+ * The function will return -ERESTARTSYS if it was interrupted by a
+ * signal and 0 if @condition evaluated to true.
+ */
+#define wait_io_event_interruptible(wq, condition) \
+({ \
+ int __ret = 0; \
+ if (!(condition)) \
+ __wait_io_event_interruptible(wq, condition, __ret); \
+ __ret; \
+})
+
+#define __wait_io_event_interruptible_timeout(wq, condition, ret) \
+do { \
+ DEFINE_WAIT(__wait); \
+ \
+ for (;;) { \
+ prepare_to_wait(&wq, &__wait, TASK_INTERRUPTIBLE); \
+ if (condition) \
+ break; \
+ if (!signal_pending(current)) { \
+ ret = io_schedule_timeout(ret); \
+ if (!ret) \
+ break; \
+ continue; \
+ } \
+ ret = -ERESTARTSYS; \
+ break; \
+ } \
+ finish_wait(&wq, &__wait); \
+} while (0)
+
+/**
* wait_event_killable - sleep until a condition gets true
* @wq: the waitqueue to wait on
* @condition: a C expression for the event to wait for
--- kernel/deckard/arch/arm/include/asm/io.h
+++ kernel/deckard/arch/arm/include/asm/io.h
@@ -191,6 +191,9 @@
#define writel(v,c) __raw_writel((__force __u32) \
cpu_to_le32(v),__mem_pci(c))
+#define writel_relaxed(v,c) ((void)__raw_writel((__force u32) \
+ cpu_to_le32(v),__mem_pci(c)))
+
#define writesb(p,d,l) __raw_writesb(__mem_pci(p),d,l)
#define writesw(p,d,l) __raw_writesw(__mem_pci(p),d,l)
#define writesl(p,d,l) __raw_writesl(__mem_pci(p),d,l)
--- kernel/deckard/arch/arm/include/asm/memory.h
+++ kernel/deckard/arch/arm/include/asm/memory.h
@@ -121,6 +121,11 @@
#define __phys_to_pfn(paddr) ((paddr) >> PAGE_SHIFT)
#define __pfn_to_phys(pfn) ((pfn) << PAGE_SHIFT)
+/*
+ * Convert a page to/from a physical address
+ */
+#define phys_to_page(phys) (pfn_to_page(__phys_to_pfn(phys)))
+
#ifndef __ASSEMBLY__
/*
--- kernel/deckard/arch/arm/mach-msm/devices.h
+++ kernel/deckard/arch/arm/mach-msm/devices.h
@@ -74,6 +74,9 @@
extern struct clk msm_clocks_8x50[];
extern unsigned msm_num_clocks_8x50;
+extern struct platform_device msm_kgsl_3d0;
+extern struct platform_device msm_kgsl_2d0;
+extern struct platform_device msm_kgsl_2d1;
void __init msm_fb_register_device(char *name, void *data);
void __init msm_camera_register_device(void *, uint32_t, void *);
--- kernel/deckard/arch/arm/mach-msm/board-deckard.c
+++ kernel/deckard/arch/arm/mach-msm/board-deckard.c
@@ -121,25 +121,24 @@
#define TOUCHPAD_SUSPEND 34
#define TOUCHPAD_IRQ 38
-#define MSM_PMEM_MDP_SIZE 0x2075000
+#define MSM_PMEM_MDP_SIZE 0x1000000
#define SMEM_SPINLOCK_I2C 6
-#define MSM_PMEM_ADSP_SIZE 0x1C00000
-#define MSM_PMEM_GPU1_SIZE 0x800000
+#define MSM_PMEM_ADSP_SIZE 0xC00000
#define MSM_FB_SIZE 0x1C2000
#define MSM_AUDIO_SIZE 0x80000
#define MSM_GPU_PHYS_SIZE SZ_2M
#define MSM_SMI_BASE 0x2b00000
-#define MSM_SMI_SIZE 0x1500000
+#define MSM_SMI_SIZE 0x400000
#define MSM_FB_BASE MSM_SMI_BASE
#define MSM_GPU_PHYS_BASE (MSM_FB_BASE + MSM_FB_SIZE)
-#define MSM_PMEM_GPU0_BASE (MSM_GPU_PHYS_BASE + MSM_GPU_PHYS_SIZE)
-#define MSM_PMEM_GPU0_SIZE (MSM_SMI_SIZE - MSM_FB_SIZE - MSM_GPU_PHYS_SIZE)
+#define MSM_PMEM_SMIPOOL_BASE (MSM_GPU_PHYS_BASE + MSM_GPU_PHYS_SIZE)
+#define MSM_PMEM_SMIPOOL_SIZE (MSM_SMI_SIZE - MSM_FB_SIZE - MSM_GPU_PHYS_SIZE)
-#define PMEM_KERNEL_EBI1_SIZE 0
+#define PMEM_KERNEL_EBI1_SIZE 0x28000
#define PMIC_VREG_WLAN_LEVEL 2600
#define PMIC_VREG_GP6_LEVEL 2900
@@ -595,6 +594,21 @@
.cached = 0,
};
+#ifdef CONFIG_KERNEL_PMEM_SMI_REGION
+
+static struct android_pmem_platform_data android_pmem_kernel_smi_pdata = {
+ .name = PMEM_KERNEL_SMI_DATA_NAME,
+ /* if no allocator_type, defaults to PMEM_ALLOCATORTYPE_BITMAP,
+ * the only valid choice at this time. The board structure is
+ * set to all zeros by the C runtime initialization and that is now
+ * the enum value of PMEM_ALLOCATORTYPE_BITMAP, now forced to 0 in
+ * include/linux/android_pmem.h.
+ */
+ .cached = 0,
+};
+
+#endif
+
static struct android_pmem_platform_data android_pmem_pdata = {
.name = "pmem",
.allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
@@ -607,17 +621,11 @@
.cached = 0,
};
-static struct android_pmem_platform_data android_pmem_gpu0_pdata = {
- .name = "pmem_gpu0",
- .start = MSM_PMEM_GPU0_BASE,
- .size = MSM_PMEM_GPU0_SIZE,
- .allocator_type = PMEM_ALLOCATORTYPE_BUDDYBESTFIT,
- .cached = 0,
-};
-
-static struct android_pmem_platform_data android_pmem_gpu1_pdata = {
- .name = "pmem_gpu1",
- .allocator_type = PMEM_ALLOCATORTYPE_BUDDYBESTFIT,
+static struct android_pmem_platform_data android_pmem_smipool_pdata = {
+ .name = "pmem_smipool",
+ .start = MSM_PMEM_SMIPOOL_BASE,
+ .size = MSM_PMEM_SMIPOOL_SIZE,
+ .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
.cached = 0,
};
@@ -633,23 +641,25 @@
.dev = { .platform_data = &android_pmem_adsp_pdata },
};
-static struct platform_device android_pmem_gpu0_device = {
+static struct platform_device android_pmem_smipool_device = {
.name = "android_pmem",
.id = 2,
- .dev = { .platform_data = &android_pmem_gpu0_pdata },
+ .dev = { .platform_data = &android_pmem_smipool_pdata },
};
-static struct platform_device android_pmem_gpu1_device = {
+static struct platform_device android_pmem_kernel_ebi1_device = {
.name = "android_pmem",
.id = 3,
- .dev = { .platform_data = &android_pmem_gpu1_pdata },
+ .dev = { .platform_data = &android_pmem_kernel_ebi1_pdata },
};
-static struct platform_device android_pmem_kernel_ebi1_device = {
+#ifdef CONFIG_KERNEL_PMEM_SMI_REGION
+static struct platform_device android_pmem_kernel_smi_device = {
.name = "android_pmem",
- .id = 5,
- .dev = { .platform_data = &android_pmem_kernel_ebi1_pdata },
+ .id = 4,
+ .dev = { .platform_data = &android_pmem_kernel_smi_pdata },
};
+#endif
static struct resource msm_fb_resources[] = {
{
@@ -1191,36 +1201,42 @@
#endif
#endif
-static struct resource kgsl_resources[] = {
- {
- .name = "kgsl_reg_memory",
+static struct resource kgsl_3d0_resources[] = {
+ {
+ .name = KGSL_3D0_REG_MEMORY,
.start = 0xA0000000,
.end = 0xA001ffff,
.flags = IORESOURCE_MEM,
- },
- {
- .name = "kgsl_phys_memory",
- .start = MSM_GPU_PHYS_BASE,
- .end = MSM_GPU_PHYS_BASE + MSM_GPU_PHYS_SIZE - 1,
- .flags = IORESOURCE_MEM,
- },
- {
+ },
+ {
+ .name = KGSL_3D0_IRQ,
.start = INT_GRAPHICS,
.end = INT_GRAPHICS,
.flags = IORESOURCE_IRQ,
- },
+ },
};
-static struct kgsl_platform_data kgsl_pdata = {
- .max_axi_freq = 128000, /*Max for 8K*/
+
+static struct kgsl_device_platform_data kgsl_3d0_pdata = {
+ .pwrlevel = {
+ {
+ .gpu_freq = 0,
+ .bus_freq = 128000000,
+ },
+ },
+ .init_level = 0,
+ .num_levels = 1,
+ .set_grp_async = NULL,
+ .idle_timeout = HZ/5,
+ .clk_map = KGSL_CLK_CORE | KGSL_CLK_MEM,
};
-static struct platform_device msm_device_kgsl = {
- .name = "kgsl",
- .id = -1,
- .num_resources = ARRAY_SIZE(kgsl_resources),
- .resource = kgsl_resources,
+struct platform_device msm_kgsl_3d0 = {
+ .name = "kgsl-3d0",
+ .id = 0,
+ .num_resources = ARRAY_SIZE(kgsl_3d0_resources),
+ .resource = kgsl_3d0_resources,
.dev = {
- .platform_data = &kgsl_pdata,
+ .platform_data = &kgsl_3d0_pdata,
},
};
@@ -2012,10 +2028,12 @@
&msm_device_smd,
&msm_device_dmov,
&android_pmem_kernel_ebi1_device,
+#ifdef CONFIG_KERNEL_PMEM_SMI_REGION
+ &android_pmem_kernel_smi_device,
+#endif
&android_pmem_device,
&android_pmem_adsp_device,
- &android_pmem_gpu0_device,
- &android_pmem_gpu1_device,
+ &android_pmem_smipool_device,
&msm_device_nand,
&msm_device_i2c,
&qsd_device_spi,
@@ -2035,7 +2053,7 @@
&msm_device_uart3,
#endif
&msm_device_pmic_leds,
- &msm_device_kgsl,
+ &msm_kgsl_3d0,
&hs_device,
&sh_pm_device,
@@ -2070,12 +2088,6 @@
msm_init_sirc();
}
-static void kgsl_phys_memory_init(void)
-{
- request_mem_region(kgsl_resources[1].start,
- resource_size(&kgsl_resources[1]), "kgsl");
-}
-
static void __init qsd8x50_init_host(void)
{
if (machine_is_qsd8x50_ffa())
@@ -2530,6 +2542,22 @@
}
__early_param("pmem_kernel_ebi1_size=", pmem_kernel_ebi1_size_setup);
+#ifdef CONFIG_KERNEL_PMEM_SMI_REGION
+static unsigned pmem_kernel_smi_size = MSM_PMEM_SMIPOOL_SIZE;
+static void __init pmem_kernel_smi_size_setup(char **p)
+{
+ pmem_kernel_smi_size = memparse(*p, p);
+
+ /* Make sure that we don't allow more SMI memory then is
+ available - the kernel mapping code has no way of knowing
+ if it has gone over the edge */
+
+ if (pmem_kernel_smi_size > MSM_PMEM_SMIPOOL_SIZE)
+ pmem_kernel_smi_size = MSM_PMEM_SMIPOOL_SIZE;
+}
+__early_param("pmem_kernel_smi_size=", pmem_kernel_smi_size_setup);
+#endif
+
static unsigned pmem_mdp_size = MSM_PMEM_MDP_SIZE;
static void __init pmem_mdp_size_setup(char **p)
{
@@ -2544,13 +2572,6 @@
}
__early_param("pmem_adsp_size=", pmem_adsp_size_setup);
-static unsigned pmem_gpu1_size = MSM_PMEM_GPU1_SIZE;
-static void __init pmem_gpu1_size_setup(char **p)
-{
- pmem_gpu1_size = memparse(*p, p);
-}
-__early_param("pmem_gpu1_size=", pmem_gpu1_size_setup);
-
static unsigned audio_size = MSM_AUDIO_SIZE;
static void __init audio_size_setup(char **p)
{
@@ -2594,7 +2615,6 @@
spi_register_board_info(msm_spi_board_info,
ARRAY_SIZE(msm_spi_board_info));
msm_pm_set_platform_data(msm_pm_data);
- kgsl_phys_memory_init();
#ifdef CONFIG_SURF_FFA_GPIO_KEYPAD
if (machine_is_qsd8x50_ffa())
@@ -2623,6 +2643,24 @@
" ebi1 pmem arena\n", size, addr, __pa(addr));
}
+#ifdef CONFIG_KERNEL_PMEM_SMI_REGION
+ size = pmem_kernel_smi_size;
+ if (size > MSM_PMEM_SMIPOOL_SIZE) {
+ printk(KERN_ERR "pmem kernel smi arena size %lu is too big\n",
+ size);
+
+ size = MSM_PMEM_SMIPOOL_SIZE;
+ }
+
+ android_pmem_kernel_smi_pdata.start = MSM_PMEM_SMIPOOL_BASE;
+ android_pmem_kernel_smi_pdata.size = size;
+
+ pr_info("allocating %lu bytes at %lx (%lx physical)"
+ "for pmem kernel smi arena\n", size,
+ (long unsigned int) MSM_PMEM_SMIPOOL_BASE,
+ __pa(MSM_PMEM_SMIPOOL_BASE));
+#endif
+
size = pmem_mdp_size;
if (size) {
addr = alloc_bootmem(size);
@@ -2641,15 +2679,6 @@
"pmem arena\n", size, addr, __pa(addr));
}
- size = pmem_gpu1_size;
- if (size) {
- addr = alloc_bootmem_aligned(size, 0x100000);
- android_pmem_gpu1_pdata.start = __pa(addr);
- android_pmem_gpu1_pdata.size = size;
- pr_info("allocating %lu bytes at %p (%lx physical) for gpu1 "
- "pmem arena\n", size, addr, __pa(addr));
- }
-
size = MSM_FB_SIZE;
addr = (void *)MSM_FB_BASE;
msm_fb_resources[0].start = (unsigned long)addr;
--- kernel/deckard/arch/arm/mach-msm/board-qsd8x50.c
+++ kernel/deckard/arch/arm/mach-msm/board-qsd8x50.c
@@ -1303,39 +1303,6 @@
#define bt_power_init(x) do {} while (0)
#endif
-static struct resource kgsl_resources[] = {
- {
- .name = "kgsl_reg_memory",
- .start = 0xA0000000,
- .end = 0xA001ffff,
- .flags = IORESOURCE_MEM,
- },
- {
- .name = "kgsl_phys_memory",
- .start = MSM_GPU_PHYS_BASE,
- .end = MSM_GPU_PHYS_BASE + MSM_GPU_PHYS_SIZE - 1,
- .flags = IORESOURCE_MEM,
- },
- {
- .start = INT_GRAPHICS,
- .end = INT_GRAPHICS,
- .flags = IORESOURCE_IRQ,
- },
-};
-static struct kgsl_platform_data kgsl_pdata = {
- .max_axi_freq = 128000, /*Max for 8K*/
-};
-
-static struct platform_device msm_device_kgsl = {
- .name = "kgsl",
- .id = -1,
- .num_resources = ARRAY_SIZE(kgsl_resources),
- .resource = kgsl_resources,
- .dev = {
- .platform_data = &kgsl_pdata,
- },
-};
-
static struct platform_device msm_device_pmic_leds = {
.name = "pmic-leds",
.id = -1,
@@ -2135,7 +2102,7 @@
&msm_device_uart3,
#endif
&msm_device_pmic_leds,
- &msm_device_kgsl,
+ &msm_kgsl_3d0,
&hs_device,
#if defined(CONFIG_TSIF) || defined(CONFIG_TSIF_MODULE)
&msm_device_tsif,
@@ -2166,12 +2133,6 @@
msm_init_sirc();
}
-static void kgsl_phys_memory_init(void)
-{
- request_mem_region(kgsl_resources[1].start,
- resource_size(&kgsl_resources[1]), "kgsl");
-}
-
static void __init qsd8x50_init_host(void)
{
if (machine_is_qsd8x50_ffa())
@@ -2593,7 +2554,6 @@
spi_register_board_info(msm_spi_board_info,
ARRAY_SIZE(msm_spi_board_info));
msm_pm_set_platform_data(msm_pm_data);
- kgsl_phys_memory_init();
#ifdef CONFIG_SURF_FFA_GPIO_KEYPAD
if (machine_is_qsd8x50_ffa())
--- kernel/deckard/arch/arm/mach-msm/sh_sleepcheck.c
+++ kernel/deckard/arch/arm/mach-msm/sh_sleepcheck.c
@@ -24,7 +24,7 @@
#include <linux/wakelock.h>
#include <linux/pm.h>
#include <mach/msm_rpcrouter.h>
-#include <smd_private.h>
+#include "smd_private.h"
#include <sharp/sh_sleepcheck.h>
/* ==========================================================================================
--- kernel/deckard/drivers/base/Kconfig
+++ kernel/deckard/drivers/base/Kconfig
@@ -126,4 +126,18 @@
bool
default n
+config GENLOCK
+ bool "Enable a generic cross-process locking mechanism"
+ depends on ANON_INODES
+ help
+ Enable a generic cross-process locking API to provide protection
+ for shared memory objects such as graphics buffers.
+
+config GENLOCK_MISCDEVICE
+ bool "Enable a misc-device for userspace to access the genlock engine"
+ depends on GENLOCK
+ help
+ Create a miscdevice for the purposes of allowing userspace to create
+ and interact with locks created using genlock.
+
endmenu
--- kernel/deckard/drivers/base/Makefile
+++ kernel/deckard/drivers/base/Makefile
@@ -6,6 +6,7 @@
attribute_container.o transport_class.o
obj-y += power/
obj-$(CONFIG_HAS_DMA) += dma-mapping.o
+obj-$(CONFIG_GENLOCK) += genlock.o
obj-$(CONFIG_ISA) += isa.o
obj-$(CONFIG_FW_LOADER) += firmware_class.o
obj-$(CONFIG_NUMA) += node.o
--- kernel/deckard/drivers/base/genlock.c
+++ kernel/deckard/drivers/base/genlock.c
@@ -22,6 +22,7 @@
#include <linux/anon_inodes.h>
#include <linux/miscdevice.h>
#include <linux/genlock.h>
+#include <linux/hardirq.h>
/* Lock states - can either be unlocked, held as an exclusive write lock or a
* shared read lock
--- kernel/deckard/drivers/gpu/msm/adreno.h
+++ kernel/deckard/drivers/gpu/msm/adreno.h
@@ -17,7 +17,7 @@
#include "adreno_drawctxt.h"
#include "adreno_ringbuffer.h"
-#define DEVICE_3D_NAME "kgsl-3d"
+#define DEVICE_3D_NAME "kgsl-3d0"
#define DEVICE_3D0_NAME "kgsl-3d0"
#define ADRENO_DEVICE(device) \
--- kernel/deckard/drivers/gpu/msm/adreno.c
+++ kernel/deckard/drivers/gpu/msm/adreno.c
@@ -436,6 +436,8 @@
adreno_dev->pix_shader_start = adreno_gpulist[i].pix_shader_start;
}
+static struct platform_device_id adreno_id_table[];
+
static int __devinit
adreno_probe(struct platform_device *pdev)
{
@@ -443,7 +445,7 @@
struct adreno_device *adreno_dev;
int status = -EINVAL;
- device = (struct kgsl_device *)pdev->id_entry->driver_data;
+ device = (struct kgsl_device *)adreno_id_table[0].driver_data;
adreno_dev = ADRENO_DEVICE(device);
device->parentdev = &pdev->dev;
@@ -477,7 +479,7 @@
struct kgsl_device *device;
struct adreno_device *adreno_dev;
- device = (struct kgsl_device *)pdev->id_entry->driver_data;
+ device = (struct kgsl_device *)adreno_id_table[0].driver_data;
adreno_dev = ADRENO_DEVICE(device);
kgsl_pwrscale_detach_policy(device);
@@ -1358,7 +1360,6 @@
.remove = __devexit_p(adreno_remove),
.suspend = kgsl_suspend_driver,
.resume = kgsl_resume_driver,
- .id_table = adreno_id_table,
.driver = {
.owner = THIS_MODULE,
.name = DEVICE_3D_NAME,
--- kernel/deckard/drivers/gpu/msm/kgsl.c
+++ kernel/deckard/drivers/gpu/msm/kgsl.c
@@ -473,21 +473,9 @@
return kgsl_resume_device(device);
}
-static int kgsl_runtime_suspend(struct device *dev)
-{
- return 0;
-}
-
-static int kgsl_runtime_resume(struct device *dev)
-{
- return 0;
-}
-
const struct dev_pm_ops kgsl_pm_ops = {
.suspend = kgsl_suspend,
.resume = kgsl_resume,
- .runtime_suspend = kgsl_runtime_suspend,
- .runtime_resume = kgsl_runtime_resume,
};
EXPORT_SYMBOL(kgsl_pm_ops);
--- kernel/deckard/drivers/gpu/msm/kgsl_iommu.c
+++ kernel/deckard/drivers/gpu/msm/kgsl_iommu.c
@@ -47,7 +47,7 @@
void *kgsl_iommu_create_pagetable(void)
{
- struct iommu_domain *domain = iommu_domain_alloc(0);
+ struct iommu_domain *domain = iommu_domain_alloc();
if (!domain)
KGSL_CORE_ERR("Failed to create iommu domain\n");
@@ -238,7 +238,8 @@
if (range == 0 || gpuaddr == 0)
return 0;
- ret = iommu_unmap_range(domain, gpuaddr, range);
+// ret = iommu_unmap_range(domain, gpuaddr, range);
+ ret = -1;
if (ret)
KGSL_CORE_ERR("iommu_unmap_range(%p, %x, %d) failed "
"with err: %d\n", domain, gpuaddr,
--- kernel/deckard/drivers/gpu/msm/kgsl_mmu.c
+++ kernel/deckard/drivers/gpu/msm/kgsl_mmu.c
@@ -406,9 +406,9 @@
pagetable->max_entries = KGSL_PAGETABLE_ENTRIES(
CONFIG_MSM_KGSL_PAGE_TABLE_SIZE);
- pagetable->pool = gen_pool_create(PAGE_SHIFT, -1);
+ pagetable->pool = gen_pool_create(KGSL_MMU_ALIGN_SHIFT, -1);
if (pagetable->pool == NULL) {
- KGSL_CORE_ERR("gen_pool_create(%d) failed\n", PAGE_SHIFT);
+ KGSL_CORE_ERR("gen_pool_create(%d) failed\n", KGSL_MMU_ALIGN_SHIFT);
goto err_alloc;
}
@@ -537,8 +537,7 @@
memdesc->gpuaddr = memdesc->physaddr;
return 0;
}
- memdesc->gpuaddr = gen_pool_alloc_aligned(pagetable->pool,
- memdesc->size, KGSL_MMU_ALIGN_SHIFT);
+ memdesc->gpuaddr = gen_pool_alloc(pagetable->pool, memdesc->size);
if (memdesc->gpuaddr == 0) {
KGSL_CORE_ERR("gen_pool_alloc(%d) failed\n", memdesc->size);
--- kernel/deckard/drivers/gpu/msm/kgsl_pwrctrl.c
+++ kernel/deckard/drivers/gpu/msm/kgsl_pwrctrl.c
@@ -39,7 +39,7 @@
.map = KGSL_CLK_SRC,
},
{
- .name = "core_clk",
+ .name = "imem_clk",
.map = KGSL_CLK_CORE,
},
{
@@ -47,7 +47,7 @@
.map = KGSL_CLK_IFACE,
},
{
- .name = "mem_clk",
+ .name = "imem_clk",
.map = KGSL_CLK_MEM,
},
{
@@ -500,7 +500,7 @@
pwr->nap_allowed = pdata->nap_allowed;
pwr->interval_timeout = pdata->idle_timeout;
- pwr->ebi1_clk = clk_get(&pdev->dev, "bus_clk");
+ pwr->ebi1_clk = clk_get(&pdev->dev, "ebi1_clk");
if (IS_ERR(pwr->ebi1_clk))
pwr->ebi1_clk = NULL;
else
--- kernel/deckard/drivers/gpu/msm/kgsl_sharedmem.c
+++ kernel/deckard/drivers/gpu/msm/kgsl_sharedmem.c
@@ -11,7 +11,6 @@
*
*/
#include <linux/vmalloc.h>
-#include <linux/memory_alloc.h>
#include <asm/cacheflush.h>
#include "kgsl.h"
@@ -357,7 +356,7 @@
if (memdesc->hostptr)
iounmap(memdesc->hostptr);
- free_contiguous_memory_by_paddr(memdesc->physaddr);
+// free_contiguous_memory_by_paddr(memdesc->physaddr);
}
static void kgsl_coherent_free(struct kgsl_memdesc *memdesc)
@@ -569,7 +568,8 @@
memdesc->size = size;
memdesc->pagetable = pagetable;
memdesc->ops = &kgsl_ebimem_ops;
- memdesc->physaddr = allocate_contiguous_ebi_nomap(size, SZ_8K);
+// memdesc->physaddr = allocate_contiguous_ebi_nomap(size, SZ_8K);
+ memdesc->physaddr = 0;
if (memdesc->physaddr == 0) {
KGSL_CORE_ERR("allocate_contiguous_ebi_nomap(%d) failed\n",
--- kernel/deckard/drivers/input/touchscreen/msm-i2ctps.c
+++ kernel/deckard/drivers/input/touchscreen/msm-i2ctps.c
@@ -83,6 +83,9 @@
#define TPS_ERROR_WIDE SH_TOUCH_MAX_DISTANCE /* Wide range */
#define TPS_ERROR_3DOWN SH_TOUCH_MAX_DISTANCE /* Three point pushing */
+#define SH_TOUCH_DELTA 16
+#define SH_TOUCH_MAX_PRESSURE 255
+
/* Adjustable parameter */
#define POS_X0 0
#define POS_X1 120
@@ -169,9 +172,10 @@
{
uint8_t mbValid;;
/* Event processing function */
- void (*mpReportKey)(InputDev *);
- void (*mpReportWit)(InputDev *, uint16_t, uint16_t);
- void (*mpReportPos)(InputDev *, uint16_t, uint16_t);
+ void (*mpReportKey)(InputDev *, int mt);
+ void (*mpReportKey2)(InputDev *, int mt);
+ void (*mpReportPos)(InputDev *, uint16_t, uint16_t, uint16_t, int mt);
+ void (*mpReportPos2)(InputDev *, uint16_t, uint16_t, uint16_t, int mt);
} TpsDispatch;
@@ -214,6 +218,9 @@
static int gnResult = 0;
+static uint16_t oldPosX, oldPosY;
+static int oldDeltaX, oldDeltaY, oldState;
+
/*+-------------------------------------------------------------------------+*/
/*| PROTO TYPE DECLARE |*/
/*+-------------------------------------------------------------------------+*/
@@ -263,14 +270,14 @@
static void ShTps_RoundValue(short *pValue);
static int ShTps_SetAdjustParam(I2cTpsRec *poTpsRec, uint16_t *pParam);
static void ShTps_AdjustPt(short *pX, short *pY);
-static void ShTps_KeyOn(InputDev *pInDev);
-static void ShTps_KeyOff(InputDev *pInDev);
-static void ShTps_WidOff(InputDev *pInDev, uint16_t wDeltaX, uint16_t wDeltaY);
-static void ShTps_WidSet(InputDev *pInDev, uint16_t wDeltaX, uint16_t wDeltaY);
-static void ShTps_WidWid(InputDev *pInDev, uint16_t wDeltaX, uint16_t wDeltaY);
-static void ShTps_Wid3Dn(InputDev *pInDev, uint16_t wDeltaX, uint16_t wDeltaY);
-static void ShTps_PosSet(InputDev *pInDev, uint16_t wPosX, uint16_t wPosY);
-static void ShTps_PosErr(InputDev *pInDev, uint16_t wPosX, uint16_t wPosY);
+static void ShTps_KeyOn(InputDev *pInDev, int mt);
+static void ShTps_KeyOff(InputDev *pInDev, int mt);
+static void ShTps_PosSet(InputDev *pInDev, uint16_t wPosX, uint16_t wPosY, uint16_t wDistance, int mt);
+static void ShTps_PosSet2(InputDev *pInDev, uint16_t wPosX, uint16_t wPosY, uint16_t wDistance, int mt);
+static void ShTps_PosOff(InputDev *pInDev, uint16_t wPosX, uint16_t wPosY, uint16_t wDistance, int mt);
+static void ShTps_PosOff2(InputDev *pInDev, uint16_t wPosX, uint16_t wPosY, uint16_t wDistance, int mt);
+static void ShTps_PosErr(InputDev *pInDev, uint16_t wPosX, uint16_t wPosY, uint16_t wDistance, int mt);
+static void ShTps_PosErr2(InputDev *pInDev, uint16_t wPosX, uint16_t wPosY, uint16_t wDistance, int mt);
static int ShTps_FwWrite(I2cTpsRec *poTpsRec, TpsFwData *pTpsFirmData);
static int ShTps_FwWriteMain(TpsFwData *pTpsFirmData);
@@ -289,43 +296,43 @@
{
/* [EVENT] HOVER */
{
- { 0, NULL, NULL, NULL, }, /* [STATE] HOVER */
- { 1, ShTps_KeyOff, NULL, NULL, }, /* [STATE] SDOWN */
- { 1, ShTps_KeyOff, ShTps_WidOff, NULL, }, /* [STATE] MDOWN */
- { 1, ShTps_KeyOff, ShTps_WidOff, NULL, }, /* [STATE] WIDE */
- { 1, ShTps_KeyOff, ShTps_WidOff, NULL, }, /* [STATE] 3DOWN */
+ { 0, NULL, NULL, NULL, NULL, }, /* [STATE] HOVER */
+ { 1, ShTps_KeyOff, NULL, ShTps_PosOff, NULL, }, /* [STATE] SDOWN */
+ { 1, ShTps_KeyOff, ShTps_KeyOff, ShTps_PosOff, ShTps_PosOff2, }, /* [STATE] MDOWN */
+ { 1, ShTps_KeyOff, ShTps_KeyOff, ShTps_PosOff, ShTps_PosOff2, }, /* [STATE] WIDE */
+ { 1, ShTps_KeyOff, ShTps_KeyOff, ShTps_PosOff, ShTps_PosOff2, }, /* [STATE] 3DOWN */
},
/* [EVENT] SDOWN */
{
- { 1, ShTps_KeyOn, NULL, ShTps_PosSet, }, /* [STATE] HOVER */
- { 1, NULL, NULL, ShTps_PosSet, }, /* [STATE] SDOWN */
- { 1, NULL, ShTps_WidOff, ShTps_PosSet, }, /* [STATE] MDOWN */
- { 0, NULL, NULL, NULL, }, /* [STATE] WIDE */
- { 0, NULL, NULL, NULL, }, /* [STATE] 3DOWN */
+ { 1, ShTps_KeyOn, NULL, ShTps_PosSet, NULL, }, /* [STATE] HOVER */
+ { 1, NULL, NULL, ShTps_PosSet, NULL, }, /* [STATE] SDOWN */
+ { 1, NULL, ShTps_KeyOff, ShTps_PosSet, ShTps_PosOff2, }, /* [STATE] MDOWN */
+ { 0, NULL, NULL, NULL, NULL, }, /* [STATE] WIDE */
+ { 0, NULL, NULL, NULL, NULL, }, /* [STATE] 3DOWN */
},
/* [EVENT] MDOWN */
{
- { 1, ShTps_KeyOn, ShTps_WidSet, ShTps_PosSet, }, /* [STATE] HOVER */
- { 1, NULL, ShTps_WidSet, ShTps_PosSet, }, /* [STATE] SDOWN */
- { 1, NULL, ShTps_WidSet, ShTps_PosSet, }, /* [STATE] MDOWN */
- { 0, NULL, NULL, NULL, }, /* [STATE] WIDE */
- { 0, NULL, NULL, NULL, }, /* [STATE] 3DOWN */
+ { 1, ShTps_KeyOn, ShTps_KeyOn, ShTps_PosSet, ShTps_PosSet2, }, /* [STATE] HOVER */
+ { 1, NULL, ShTps_KeyOn, ShTps_PosSet, ShTps_PosSet2, }, /* [STATE] SDOWN */
+ { 1, NULL, NULL, ShTps_PosSet, ShTps_PosSet2, }, /* [STATE] MDOWN */
+ { 0, NULL, NULL, NULL, NULL, }, /* [STATE] WIDE */
+ { 0, NULL, NULL, NULL, NULL, }, /* [STATE] 3DOWN */
},
/* [EVENT] WIDE */
{
- { 1, ShTps_KeyOn, ShTps_WidWid, ShTps_PosErr, }, /* [STATE] HOVER */
- { 1, NULL, ShTps_WidWid, ShTps_PosErr, }, /* [STATE] SDOWN */
- { 1, NULL, ShTps_WidWid, ShTps_PosErr, }, /* [STATE] MDOWN */
- { 0, NULL, NULL, NULL, }, /* [STATE] WIDE */
- { 0, NULL, NULL, NULL, }, /* [STATE] 3DOWN */
+ { 1, ShTps_KeyOn, ShTps_KeyOn, ShTps_PosErr, ShTps_PosErr2, }, /* [STATE] HOVER */
+ { 1, NULL, ShTps_KeyOn, ShTps_PosErr, ShTps_PosErr2, }, /* [STATE] SDOWN */
+ { 1, NULL, NULL, ShTps_PosErr, ShTps_PosErr2, }, /* [STATE] MDOWN */
+ { 0, NULL, NULL, NULL, NULL, }, /* [STATE] WIDE */
+ { 0, NULL, NULL, NULL, NULL, }, /* [STATE] 3DOWN */
},
/* [EVENT] 3DOWN */
{
- { 1, ShTps_KeyOn, ShTps_Wid3Dn, ShTps_PosErr, }, /* [STATE] HOVER */
- { 1, NULL, ShTps_Wid3Dn, ShTps_PosErr, }, /* [STATE] SDOWN */
- { 1, NULL, ShTps_Wid3Dn, ShTps_PosErr, }, /* [STATE] MDOWN */
- { 0, NULL, NULL, NULL, }, /* [STATE] WIDE */
- { 0, NULL, NULL, NULL, }, /* [STATE] 3DOWN */
+ { 1, ShTps_KeyOn, ShTps_KeyOn, ShTps_PosErr, ShTps_PosErr2, }, /* [STATE] HOVER */
+ { 1, NULL, ShTps_KeyOn, ShTps_PosErr, ShTps_PosErr2, }, /* [STATE] SDOWN */
+ { 1, NULL, NULL, ShTps_PosErr, ShTps_PosErr2, }, /* [STATE] MDOWN */
+ { 0, NULL, NULL, NULL, NULL, }, /* [STATE] WIDE */
+ { 0, NULL, NULL, NULL, NULL, }, /* [STATE] 3DOWN */
},
};
@@ -792,11 +799,18 @@
__set_bit(ABS_Y, pInDev->absbit);
__set_bit(ABS_TOOL_WIDTH, pInDev->absbit);
__set_bit(BTN_TOUCH, pInDev->keybit);
+ __set_bit(ABS_MT_POSITION_X, pInDev->absbit);
+ __set_bit(ABS_MT_POSITION_Y, pInDev->absbit);
+ __set_bit(ABS_MT_TOUCH_MAJOR, pInDev->absbit);
+ __set_bit(BTN_2, pInDev->keybit);
input_set_drvdata(pInDev, poTpsRec);
/* Event parameter range set */
input_set_abs_params(pInDev, ABS_X, 0, SH_TOUCH_MAX_X, 0, 0);
input_set_abs_params(pInDev, ABS_Y, 0, SH_TOUCH_MAX_Y, 0, 0);
input_set_abs_params(pInDev, ABS_TOOL_WIDTH, 0, SH_TOUCH_MAX_DISTANCE, 0, 0);
+ input_set_abs_params(pInDev, ABS_MT_POSITION_X, 0, SH_TOUCH_MAX_X, 0, 0);
+ input_set_abs_params(pInDev, ABS_MT_POSITION_Y, 0, SH_TOUCH_MAX_Y, 0, 0);
+ input_set_abs_params(pInDev, ABS_MT_TOUCH_MAJOR, 0, SH_TOUCH_MAX_PRESSURE, 0, 0);
}
else
{
@@ -989,6 +1003,7 @@
uint8_t bData[7];
uint16_t wPosX, wPosY;
uint16_t wDeltaX, wDeltaY;
+ uint16_t wDistance;
int nNextState;
#ifdef TPS_PRNDEB
const char *StaName[] = { "HOVER ", "SDOWN ", "MDOWN ", "WIDE ", "3DOWN "};
@@ -1027,6 +1042,7 @@
wPosY = (uint16_t)bData[3] + ((uint16_t)(bData[2] & 0x0f) << 8);
wDeltaX = (uint16_t)bData[4] + ((uint16_t)(bData[5] & 0xf0) << 4);
wDeltaY = (uint16_t)bData[6] + ((uint16_t)(bData[5] & 0x0f) << 8);
+ wDistance = 0;
#ifdef TPS_PRNLOG
printk(KERN_DEBUG "[ShTps]Int %02X,(%4d,%4d)(%4d,%4d)\n", bData[ 0], wPosX, wPosY, wDeltaX, wDeltaY);
@@ -1048,6 +1064,76 @@
}
else
{
+ if(nNextState == TPS_STATE_MDOWN)
+ {
+ wDistance = ShTps_GetHypotLength(wDeltaX, wDeltaY);
+
+ if(wPosX - oldPosX > SH_TOUCH_DELTA ||
+ (oldPosX - wPosX <= SH_TOUCH_DELTA && oldDeltaX < 0))
+ {
+ wPosX -= wDeltaX / 2;
+ wDeltaX = wPosX + wDeltaX;
+ }
+ else
+ {
+ wPosX += wDeltaX / 2;
+ wDeltaX = wPosX - wDeltaX;
+ }
+ if(wPosY - oldPosY > SH_TOUCH_DELTA ||
+ (oldPosY - wPosY <= SH_TOUCH_DELTA && oldDeltaY < 0))
+ {
+ wPosY -= wDeltaY / 2;
+ wDeltaY = wPosY + wDeltaY;
+ }
+ else
+ {
+ wPosY += wDeltaY / 2;
+ wDeltaY = wPosY - wDeltaY;
+ }
+
+ if(wDeltaX > SH_TOUCH_MAX_X)
+ {
+ wDeltaX = SH_TOUCH_MAX_X;
+ }
+#ifdef TPS_ROTATE_180
+ wDeltaX = SH_TOUCH_MAX_X - wDeltaX;
+#endif /* TPS_ROTATE_180 */
+ if(wDeltaY > SH_TOUCH_MAX_Y)
+ {
+ wDeltaY = SH_TOUCH_MAX_Y;
+ }
+#ifdef TPS_ROTATE_180
+ wDeltaY = SH_TOUCH_MAX_Y - wDeltaY;
+#endif /* TPS_ROTATE_180 */
+ /* The correction is effective */
+ if(poTpsRec->mbAdjustEnable != 0)
+ {
+ /* Coordinates are corrected. */
+ ShTps_AdjustPt(&wDeltaX, &wDeltaY);
+#ifdef TPS_PRNDEB
+printk(KERN_DEBUG "[ShTps]Adjust (%4d,%4d)\n", wDeltaX, wDeltaY);
+#endif /* TPS_PRNDEB */
+ }
+ }
+
+ oldDeltaX = wPosX - oldPosX;
+ oldDeltaY = wPosY - oldPosY;
+ oldPosX = wPosX;
+ oldPosY = wPosY;
+ if(nNextState == TPS_STATE_SDOWN)
+ {
+ if(oldState == 2)
+ {
+ oldState = 1;
+ goto skip;
+ }
+ oldState = oldState + 1;
+ }
+ else
+ {
+ oldState = 0;
+ }
+
if(wPosX > SH_TOUCH_MAX_X)
{
wPosX = SH_TOUCH_MAX_X;
@@ -1073,23 +1159,33 @@
}
}
}
+ else
+ {
+ oldState = 0;
+ }
/* Can it change? */
if(gTpsDispatch[nNextState][poTpsRec->mnState].mbValid != 0)
{
- /* Report[BTN_TOUCH] */
+ int mt;
+
if(gTpsDispatch[nNextState][poTpsRec->mnState].mpReportKey != NULL)
{
- gTpsDispatch[nNextState][poTpsRec->mnState].mpReportKey(pInDev);
+ gTpsDispatch[nNextState][poTpsRec->mnState].mpReportKey(pInDev, 0);
}
- /* Report[ABS_TOOL_WIDTH] */
- if(gTpsDispatch[nNextState][poTpsRec->mnState].mpReportWit != NULL)
+ if(gTpsDispatch[nNextState][poTpsRec->mnState].mpReportKey2 != NULL)
{
- gTpsDispatch[nNextState][poTpsRec->mnState].mpReportWit(pInDev, wDeltaX, wDeltaY);
+ gTpsDispatch[nNextState][poTpsRec->mnState].mpReportKey2(pInDev, 1);
}
- /* Report[ABS_X][ABS_Y] */
- if(gTpsDispatch[nNextState][poTpsRec->mnState].mpReportPos != NULL)
+ for (mt = 0; mt < 2; mt++)
{
- gTpsDispatch[nNextState][poTpsRec->mnState].mpReportPos(pInDev, wPosX, wPosY);
+ if(gTpsDispatch[nNextState][poTpsRec->mnState].mpReportPos != NULL)
+ {
+ gTpsDispatch[nNextState][poTpsRec->mnState].mpReportPos(pInDev, wPosX, wPosY, wDistance, mt);
+ }
+ if(mt && gTpsDispatch[nNextState][poTpsRec->mnState].mpReportPos2 != NULL)
+ {
+ gTpsDispatch[nNextState][poTpsRec->mnState].mpReportPos2(pInDev, wDeltaX, wDeltaY, wDistance, mt);
+ }
}
input_sync(pInDev);
#ifdef TPS_PRNDEB
@@ -1103,6 +1199,7 @@
printk(KERN_DEBUG "[ShTps]State[%s]->[%s] NG\n", StaName[poTpsRec->mnState], StaName[nNextState]);
#endif /* TPS_PRNDEB */
}
+skip:
/* Enabling interrupt */
enable_irq(MSM_GPIO_TO_INT(poTpsRec->mnIrqPin));
mutex_unlock(&goTpsAccessMutex);
@@ -1148,6 +1245,11 @@
uint16_t wResult;
uint32_t dwX, dwY;
+ if(wX > SH_TOUCH_MAX_X)
+ wX = SH_TOUCH_MAX_X;
+ if(wY > SH_TOUCH_MAX_Y)
+ wY = SH_TOUCH_MAX_Y;
+
if(wX == 0)
return wY;
if(wY == 0)
@@ -1350,15 +1452,26 @@
/* It returns it to the state of HOVER */
if(gTpsDispatch[TPS_STATE_HOVER][poTpsRec->mnState].mbValid != 0)
{
- /* Report[BTN_TOUCH] */
+ int mt;
+
if(gTpsDispatch[TPS_STATE_HOVER][poTpsRec->mnState].mpReportKey != NULL)
{
- gTpsDispatch[TPS_STATE_HOVER][poTpsRec->mnState].mpReportKey(poTpsRec->mpoInDev);
+ gTpsDispatch[TPS_STATE_HOVER][poTpsRec->mnState].mpReportKey(poTpsRec->mpoInDev, 0);
}
- /* Report[ABS_TOOL_WIDTH] */
- if(gTpsDispatch[TPS_STATE_HOVER][poTpsRec->mnState].mpReportWit != NULL)
+ if(gTpsDispatch[TPS_STATE_HOVER][poTpsRec->mnState].mpReportKey2 != NULL)
{
- gTpsDispatch[TPS_STATE_HOVER][poTpsRec->mnState].mpReportWit(poTpsRec->mpoInDev, 0, 0);
+ gTpsDispatch[TPS_STATE_HOVER][poTpsRec->mnState].mpReportKey2(poTpsRec->mpoInDev, 1);
+ }
+ for (mt = 0; mt < 2; mt++)
+ {
+ if(gTpsDispatch[TPS_STATE_HOVER][poTpsRec->mnState].mpReportPos != NULL)
+ {
+ gTpsDispatch[TPS_STATE_HOVER][poTpsRec->mnState].mpReportPos(poTpsRec->mpoInDev, 0, 0, 0, mt);
+ }
+ if(mt && gTpsDispatch[TPS_STATE_HOVER][poTpsRec->mnState].mpReportPos2 != NULL)
+ {
+ gTpsDispatch[TPS_STATE_HOVER][poTpsRec->mnState].mpReportPos2(poTpsRec->mpoInDev, 0, 0, 0, mt);
+ }
}
input_sync(poTpsRec->mpoInDev);
}
@@ -1693,79 +1806,113 @@
*pY = MINMAX(0, SH_TOUCH_MAX_Y, *pY);
}
-static void ShTps_KeyOn(InputDev *pInDev)
+static void ShTps_KeyOn(InputDev *pInDev, int mt)
{
#ifdef TPS_PRNDEB
printk(KERN_DEBUG "[ShTps]KeyOn\n");
#endif /* TPS_PRNDEB */
- /* Touching down */
- input_report_key(pInDev, BTN_TOUCH, KPD_KEYPRESS);
+ if (mt)
+ input_report_key(pInDev, BTN_2, KPD_KEYPRESS);
+ else
+ input_report_key(pInDev, BTN_TOUCH, KPD_KEYPRESS);
}
-static void ShTps_KeyOff(InputDev *pInDev)
+static void ShTps_KeyOff(InputDev *pInDev, int mt)
{
#ifdef TPS_PRNDEB
printk(KERN_DEBUG "[ShTps]KeyOff\n");
#endif /* Touching up */
- /* Touching up */
- input_report_key(pInDev, BTN_TOUCH, KPD_KEYRELEASE);
+ if (mt)
+ input_report_key(pInDev, BTN_2, KPD_KEYRELEASE);
+ else
+ input_report_key(pInDev, BTN_TOUCH, KPD_KEYRELEASE);
}
-static void ShTps_WidOff(InputDev *pInDev, uint16_t wDeltaX, uint16_t wDeltaY)
+static void ShTps_PosSet(InputDev *pInDev, uint16_t wPosX, uint16_t wPosY, uint16_t wDistance, int mt)
{
#ifdef TPS_PRNDEB
-printk(KERN_DEBUG "[ShTps]WidOff(0)\n");
+printk(KERN_DEBUG "[ShTps]PosSet(%d,%d)\n", wPosX, wPosY);
#endif /* TPS_PRNDEB */
- /* ABS_TOOL_WIDTH Reset */
- input_report_abs(pInDev, ABS_TOOL_WIDTH, 0);
+ if (mt)
+ {
+ input_report_abs(pInDev, ABS_MT_POSITION_X, wPosX);
+ input_report_abs(pInDev, ABS_MT_POSITION_Y, wPosY);
+ input_report_abs(pInDev, ABS_MT_TOUCH_MAJOR, SH_TOUCH_MAX_PRESSURE);
+ input_mt_sync(pInDev);
+ return;
+ }
+
+ /* Coordinates set */
+ input_report_abs(pInDev, ABS_X, wPosX);
+ input_report_abs(pInDev, ABS_Y, wPosY);
}
-static void ShTps_WidSet(InputDev *pInDev, uint16_t wDeltaX, uint16_t wDeltaY)
+static void ShTps_PosSet2(InputDev *pInDev, uint16_t wPosX, uint16_t wPosY, uint16_t wDistance, int mt)
{
- uint16_t wDistance;
-
- /** Maximum size excess */
- if(wDeltaX > SH_TOUCH_MAX_X) {
- wDeltaX = SH_TOUCH_MAX_X;
- } if(wDeltaY > SH_TOUCH_MAX_Y) {
- wDeltaY = SH_TOUCH_MAX_Y;
+ if (mt)
+ {
+ ShTps_PosSet(pInDev, wPosX, wPosY, wDistance, mt);
+ return;
}
- wDistance = ShTps_GetHypotLength(wDeltaX, wDeltaY);
+
#ifdef TPS_PRNDEB
printk(KERN_DEBUG "[ShTps]WidSet(%d)\n", wDistance);
#endif /* TPS_PRNDEB */
+
input_report_abs(pInDev, ABS_TOOL_WIDTH, wDistance);
}
-static void ShTps_WidWid(InputDev *pInDev, uint16_t wDeltaX, uint16_t wDeltaY)
+static void ShTps_PosOff(InputDev *pInDev, uint16_t wPosX, uint16_t wPosY, uint16_t wDistance, int mt)
{
#ifdef TPS_PRNDEB
-printk(KERN_DEBUG "[ShTps]WidWid(%d)\n", TPS_ERROR_WIDE);
+printk(KERN_DEBUG "[ShTps]PosOff(0)\n");
#endif /* TPS_PRNDEB */
- /* error report */
- input_report_abs(pInDev, ABS_TOOL_WIDTH, TPS_ERROR_WIDE);
+ if (mt)
+ {
+ input_report_abs(pInDev, ABS_MT_TOUCH_MAJOR, 0);
+ input_mt_sync(pInDev);
+ return;
+ }
}
-static void ShTps_Wid3Dn(InputDev *pInDev, uint16_t wDeltaX, uint16_t wDeltaY)
+static void ShTps_PosOff2(InputDev *pInDev, uint16_t wPosX, uint16_t wPosY, uint16_t wDistance, int mt)
{
#ifdef TPS_PRNDEB
-printk(KERN_DEBUG "[ShTps]Wid3Dn(%d)\n", TPS_ERROR_3DOWN);
+printk(KERN_DEBUG "[ShTps]PosOff(0)\n");
#endif /* TPS_PRNDEB */
- /* error report */
- input_report_abs(pInDev, ABS_TOOL_WIDTH, TPS_ERROR_3DOWN);
+ if (mt)
+ {
+ ShTps_PosOff(pInDev, wPosX, wPosY, wDistance, mt);
+ return;
+ }
+
+ input_report_abs(pInDev, ABS_TOOL_WIDTH, 0);
}
-static void ShTps_PosSet(InputDev *pInDev, uint16_t wPosX, uint16_t wPosY)
+static void ShTps_PosErr(InputDev *pInDev, uint16_t wPosX, uint16_t wPosY, uint16_t wDistance, int mt)
{
#ifdef TPS_PRNDEB
-printk(KERN_DEBUG "[ShTps]PosSet(%d,%d)\n", wPosX, wPosY);
+printk(KERN_DEBUG "[ShTps]PosErr(%d,%d)\n", TPS_ERROR_POS_X, TPS_ERROR_POS_Y);
#endif /* TPS_PRNDEB */
- /* Coordinates set */
- input_report_abs(pInDev, ABS_X, wPosX);
- input_report_abs(pInDev, ABS_Y, wPosY);
+ if (mt)
+ {
+ input_report_abs(pInDev, ABS_MT_POSITION_X, TPS_ERROR_POS_X);
+ input_report_abs(pInDev, ABS_MT_POSITION_Y, TPS_ERROR_POS_Y);
+ input_report_abs(pInDev, ABS_MT_TOUCH_MAJOR, SH_TOUCH_MAX_PRESSURE);
+ input_mt_sync(pInDev);
+ return;
+ }
+
+ /* error report */
+ input_report_abs(pInDev, ABS_X, TPS_ERROR_POS_X);
+ input_report_abs(pInDev, ABS_Y, TPS_ERROR_POS_Y);
}
-static void ShTps_PosErr(InputDev *pInDev, uint16_t wPosX, uint16_t wPosY)
+static void ShTps_PosErr2(InputDev *pInDev, uint16_t wPosX, uint16_t wPosY, uint16_t wDistance, int mt)
{
#ifdef TPS_PRNDEB
printk(KERN_DEBUG "[ShTps]PosErr(%d,%d)\n", TPS_ERROR_POS_X, TPS_ERROR_POS_Y);
#endif /* TPS_PRNDEB */
- /* error report */
- input_report_abs(pInDev, ABS_X, TPS_ERROR_POS_X);
- input_report_abs(pInDev, ABS_Y, TPS_ERROR_POS_Y);
+ if (mt)
+ {
+ ShTps_PosErr(pInDev, wPosX, wPosY, wDistance, mt);
+ return;
+ }
+
+ input_report_abs(pInDev, ABS_TOOL_WIDTH, TPS_ERROR_WIDE);
}
/*+-----------------------------------------------------------------------------+*/
--- kernel/deckard/drivers/misc/pmem.c
+++ kernel/deckard/drivers/misc/pmem.c
@@ -39,9 +39,6 @@
#define PMEM_INITIAL_NUM_BITMAP_ALLOCATIONS (64)
-#define PMEM_1M (1 << 20)
-#define PMEM_1M_MASK (0xfff00000)
-
#define PMEM_32BIT_WORD_ORDER (5)
#define PMEM_BITS_PER_WORD_MASK (BITS_PER_LONG - 1)
@@ -116,11 +113,6 @@
#define DLOG(x...) do {} while (0)
#endif
-enum pmem_align {
- PMEM_ALIGN_4K,
- PMEM_ALIGN_1M,
-};
-
struct pmem_info {
struct miscdevice dev;
/* physical start address of the remaped pmem space */
@@ -140,7 +132,7 @@
int (*allocate)(const int,
const unsigned long,
- const enum pmem_align);
+ const unsigned int);
int (*free)(int, int);
unsigned long (*len)(int, struct pmem_data *);
unsigned long (*start_addr)(int, struct pmem_data *);
@@ -209,6 +201,12 @@
const int fallback_memtype;
int info_id;
} kapi_memtypes[] = {
+#ifdef CONFIG_KERNEL_PMEM_SMI_REGION
+ { PMEM_KERNEL_SMI_DATA_NAME,
+ PMEM_MEMTYPE_SMI,
+ PMEM_MEMTYPE_EBI1, /* Fall back to EBI1 automatically */
+ -1 },
+#endif
{ PMEM_KERNEL_EBI1_DATA_NAME,
PMEM_MEMTYPE_EBI1,
PMEM_INVALID_MEMTYPE, /* MUST be set invalid if no fallback */
@@ -780,7 +778,7 @@
static int pmem_allocator_all_or_nothing(const int id,
const unsigned long len,
- const enum pmem_align align)
+ const unsigned int align)
{
/* caller should hold the lock on arena_mutex! */
DLOG("all or nothing\n");
@@ -793,7 +791,7 @@
static int pmem_allocator_buddy_bestfit(const int id,
const unsigned long len,
- const enum pmem_align align)
+ unsigned int align)
{
/* caller should hold the lock on arena_mutex! */
int curr;
@@ -892,20 +890,20 @@
static int
bitmap_allocate_contiguous(uint32_t *bitp, int num_bits_to_alloc,
- int total_bits, int spacing)
+ int total_bits, int spacing, int start_bit)
{
int bit_start, last_bit, word_index;
if (num_bits_to_alloc <= 0)
return -1;
- for (bit_start = 0; ;
- bit_start = (last_bit +
+ for (bit_start = start_bit; ;
+ bit_start = ((last_bit +
(word_index << PMEM_32BIT_WORD_ORDER) + spacing - 1)
- & ~(spacing - 1)) {
+ & ~(spacing - 1)) + start_bit) {
int bit_end = bit_start + num_bits_to_alloc, total_words;
- if (bit_end >= total_bits)
+ if (bit_end > total_bits)
return -1; /* out of contiguous memory */
word_index = bit_start >> PMEM_32BIT_WORD_ORDER;
@@ -949,8 +947,9 @@
static int reserve_quanta(const unsigned int quanta_needed,
const int id,
- const enum pmem_align align)
+ unsigned int align)
{
+ /* alignment should be a valid power of 2 */
int ret = -1, start_bit = 0, spacing = 1;
/* Sanity check */
@@ -963,24 +962,24 @@
return -1;
}
- if (align == PMEM_ALIGN_1M) {
- start_bit = bit_from_paddr(id,
- (pmem[id].base + PMEM_1M - 1) & PMEM_1M_MASK);
- if (start_bit <= -1) {
+ start_bit = bit_from_paddr(id,
+ (pmem[id].base + align - 1) & ~(align - 1));
+ if (start_bit <= -1) {
#if PMEM_DEBUG
- printk(KERN_ALERT
- "pmem: %s: bit_from_paddr fails for"
- " 1M alignment.\n", __func__);
+ printk(KERN_ALERT
+ "pmem: %s: bit_from_paddr fails for"
+ " %u alignment.\n", __func__, align);
#endif
- return -1;
- }
- spacing = PMEM_1M / pmem[id].quantum;
+ return -1;
}
+ spacing = align / pmem[id].quantum;
+ spacing = spacing > 1 ? spacing : 1;
ret = bitmap_allocate_contiguous(pmem[id].allocator.bitmap.bitmap,
quanta_needed,
(pmem[id].size + pmem[id].quantum - 1) / pmem[id].quantum,
- spacing);
+ spacing,
+ start_bit);
#if PMEM_DEBUG
if (ret < 0)
@@ -995,13 +994,13 @@
static int pmem_allocator_bitmap(const int id,
const unsigned long len,
- const enum pmem_align align)
+ const unsigned int align)
{
/* caller should hold the lock on arena_mutex! */
int bitnum, i;
unsigned int quanta_needed;
- DLOG("bitmap id %d, len %ld, align %d\n", id, len, align);
+ DLOG("bitmap id %d, len %ld, align %u\n", id, len, align);
if (!pmem[id].allocator.bitmap.bitm_alloc) {
#if PMEM_DEBUG
printk(KERN_ALERT "pmem: bitm_alloc not present! id: %d\n",
@@ -1316,7 +1315,7 @@
mutex_lock(&pmem[id].arena_mutex);
index = pmem[id].allocate(id,
vma->vm_end - vma->vm_start,
- PMEM_ALIGN_4K);
+ SZ_4K);
mutex_unlock(&pmem[id].arena_mutex);
data->index = index;
}
@@ -1603,15 +1602,15 @@
int32_t pmem_kalloc(const size_t size, const uint32_t flags)
{
int info_id, i, memtype, fallback = 0;
- enum pmem_align align;
+ unsigned int align;
int32_t index = -1;
switch (flags & PMEM_ALIGNMENT_MASK) {
case PMEM_ALIGNMENT_4K:
- align = PMEM_ALIGN_4K;
+ align = SZ_4K;
break;
case PMEM_ALIGNMENT_1M:
- align = PMEM_ALIGN_1M;
+ align = SZ_1M;
break;
default:
printk(KERN_ALERT "pmem: %s: Invalid alignment %#x\n",
@@ -1645,7 +1644,7 @@
}
#if PMEM_DEBUG
- if (align != PMEM_ALIGN_4K &&
+ if (align != SZ_4K &&
(pmem[info_id].allocator_type ==
PMEM_ALLOCATORTYPE_ALLORNOTHING ||
pmem[info_id].allocator_type ==
@@ -2146,9 +2145,12 @@
}
case PMEM_ALLOCATE:
{
+ int ret = 0;
DLOG("allocate, id %d\n", id);
down_write(&data->sem);
if (has_allocation(file)) {
+ pr_err("pmem: Existing allocation found on "
+ "this file descrpitor\n");
up_write(&data->sem);
return -EINVAL;
}
@@ -2156,11 +2158,59 @@
mutex_lock(&pmem[id].arena_mutex);
data->index = pmem[id].allocate(id,
arg,
- PMEM_ALIGN_4K);
+ SZ_4K);
mutex_unlock(&pmem[id].arena_mutex);
+ ret = data->index == -1 ? -ENOMEM :
+ data->index;
+ up_write(&data->sem);
+ return ret;
+ }
+ case PMEM_ALLOCATE_ALIGNED:
+ {
+ struct pmem_allocation alloc;
+ int ret = 0;
+ if (copy_from_user(&alloc, (void __user *)arg,
+ sizeof(struct pmem_allocation)))
+ return -EFAULT;
+ DLOG("allocate id align %d %u\n", id, alloc.align);
+ down_write(&data->sem);
+ if (has_allocation(file)) {
+ pr_err("pmem: Existing allocation found on "
+ "this file descrpitor\n");
+ up_write(&data->sem);
+ return -EINVAL;
+ }
+
+ if (alloc.align & (alloc.align - 1)) {
+ pr_err("pmem: Alignment is not a power of 2\n");
+ return -EINVAL;
+ }
+
+ if (alloc.align != SZ_4K &&
+ (pmem[id].allocator_type !=
+ PMEM_ALLOCATORTYPE_BITMAP)) {
+ pr_err("pmem: Non 4k alignment requires bitmap"
+ " allocator\n");
+ return -EINVAL;
+ }
+
+ if (alloc.align > SZ_1M ||
+ alloc.align < SZ_4K) {
+ pr_err("pmem: Invalid Alignment (%u) "
+ "specified\n", alloc.align);
+ return -EINVAL;
+ }
+
+ mutex_lock(&pmem[id].arena_mutex);
+ data->index = pmem[id].allocate(id,
+ alloc.size,
+ alloc.align);
+ mutex_unlock(&pmem[id].arena_mutex);
+ ret = data->index == -1 ? -ENOMEM :
+ data->index;
up_write(&data->sem);
- break;
+ return ret;
}
case PMEM_CONNECT:
DLOG("connect\n");
--- kernel/deckard/drivers/video/msm/msm_fb.c
+++ kernel/deckard/drivers/video/msm/msm_fb.c
@@ -912,7 +912,22 @@
var->yres = panel_info->yres;
var->xres_virtual = panel_info->xres;
var->yres_virtual = panel_info->yres * mfd->fb_page;
- var->bits_per_pixel = bpp * 8, /* FrameBuffer color depth */
+ var->bits_per_pixel = bpp * 8; /* FrameBuffer color depth */
+ if (mfd->dest == DISPLAY_LCD) {
+ var->reserved[4] = panel_info->lcd.refx100 / 100;
+ } else {
+ var->reserved[4] = panel_info->clk_rate /
+ ((panel_info->lcdc.h_back_porch +
+ panel_info->lcdc.h_front_porch +
+ panel_info->lcdc.h_pulse_width +
+ panel_info->xres) *
+ (panel_info->lcdc.v_back_porch +
+ panel_info->lcdc.v_front_porch +
+ panel_info->lcdc.v_pulse_width +
+ panel_info->yres));
+ }
+ pr_debug("reserved[4] %u\n", var->reserved[4]);
+
/*
* id field for fb app
*/
--- kernel/deckard/fs/anon_inodes.c
+++ kernel/deckard/fs/anon_inodes.c
@@ -53,6 +53,83 @@
};
/**
+ * anon_inode_getfile - creates a new file instance by hooking it up to an
+ * anonymous inode, and a dentry that describe the "class"
+ * of the file
+ *
+ * @name: [in] name of the "class" of the new file
+ * @fops: [in] file operations for the new file
+ * @priv: [in] private data for the new file (will be file's private_data)
+ * @flags: [in] flags
+ *
+ * Creates a new file by hooking it on a single inode. This is useful for files
+ * that do not need to have a full-fledged inode in order to operate correctly.
+ * All the files created with anon_inode_getfile() will share a single inode,
+ * hence saving memory and avoiding code duplication for the file/inode/dentry
+ * setup. Returns the newly created file* or an error pointer.
+ */
+struct file *anon_inode_getfile(const char *name,
+ const struct file_operations *fops,
+ void *priv, int flags)
+{
+ struct qstr this;
+ struct dentry *dentry;
+ struct file *file;
+ int error;
+
+ if (IS_ERR(anon_inode_inode))
+ return ERR_PTR(-ENODEV);
+
+ if (fops->owner && !try_module_get(fops->owner))
+ return ERR_PTR(-ENOENT);
+
+ /*
+ * Link the inode to a directory entry by creating a unique name
+ * using the inode sequence number.
+ */
+ error = -ENOMEM;
+ this.name = name;
+ this.len = strlen(name);
+ this.hash = 0;
+ dentry = d_alloc(anon_inode_mnt->mnt_sb->s_root, &this);
+ if (!dentry)
+ goto err_module;
+
+ /*
+ * We know the anon_inode inode count is always greater than zero,
+ * so we can avoid doing an igrab() and we can use an open-coded
+ * atomic_inc().
+ */
+ atomic_inc(&anon_inode_inode->i_count);
+
+ dentry->d_op = &anon_inodefs_dentry_operations;
+ /* Do not publish this dentry inside the global dentry hash table */
+ dentry->d_flags &= ~DCACHE_UNHASHED;
+ d_instantiate(dentry, anon_inode_inode);
+
+ error = -ENFILE;
+ file = alloc_file(anon_inode_mnt, dentry,
+ FMODE_READ | FMODE_WRITE, fops);
+ if (!file)
+ goto err_dput;
+ file->f_mapping = anon_inode_inode->i_mapping;
+
+ file->f_pos = 0;
+ file->f_flags = O_RDWR | (flags & O_NONBLOCK);
+ file->f_version = 0;
+ file->private_data = priv;
+
+ return file;
+
+err_dput:
+ dput(dentry);
+err_module:
+ module_put(fops->owner);
+ return ERR_PTR(error);
+}
+EXPORT_SYMBOL_GPL(anon_inode_getfile);
+
+/**
* anon_inode_getfd - creates a new file instance by hooking it up to an
* anonymous inode, and a dentry that describe the "class"
* of the file
--- kernel/deckard/kernel/timer.c
+++ kernel/deckard/kernel/timer.c
@@ -636,6 +636,74 @@
EXPORT_SYMBOL(__mod_timer);
+static inline int
+__mod_timer_pending(struct timer_list *timer, unsigned long expires,
+ bool pending_only, int pinned)
+{
+ struct tvec_base *base, *new_base;
+ unsigned long flags;
+ int ret = 0;
+
+ timer_stats_timer_set_start_info(timer);
+ BUG_ON(!timer->function);
+
+ base = lock_timer_base(timer, &flags);
+
+ if (timer_pending(timer)) {
+ detach_timer(timer, 0);
+ ret = 1;
+ } else {
+ if (pending_only)
+ goto out_unlock;
+ }
+
+ debug_timer_activate(timer);
+
+ new_base = __get_cpu_var(tvec_bases);
+
+ if (base != new_base) {
+ /*
+ * We are trying to schedule the timer on the local CPU.
+ * However we can't change timer's base while it is running,
+ * otherwise del_timer_sync() can't detect that the timer's
+ * handler yet has not finished. This also guarantees that
+ * the timer is serialized wrt itself.
+ */
+ if (likely(base->running_timer != timer)) {
+ /* See the comment in lock_timer_base() */
+ timer_set_base(timer, NULL);
+ spin_unlock(&base->lock);
+ base = new_base;
+ spin_lock(&base->lock);
+ timer_set_base(timer, base);
+ }
+ }
+
+ timer->expires = expires;
+ internal_add_timer(base, timer);
+
+out_unlock:
+ spin_unlock_irqrestore(&base->lock, flags);
+
+ return ret;
+}
+
+/**
+ * mod_timer_pending - modify a pending timer's timeout
+ * @timer: the pending timer to be modified
+ * @expires: new timeout in jiffies
+ *
+ * mod_timer_pending() is the same for pending timers as mod_timer(),
+ * but will not re-activate and modify already deleted timers.
+ *
+ * It is useful for unserialized use of timers.
+ */
+int mod_timer_pending(struct timer_list *timer, unsigned long expires)
+{
+ return __mod_timer_pending(timer, expires, true, TIMER_NOT_PINNED);
+}
+EXPORT_SYMBOL(mod_timer_pending);
+
/**
* add_timer_on - start a timer on a particular CPU
* @timer: the timer to be added
--- kernel/deckard/lib/idr.c
+++ kernel/deckard/lib/idr.c
@@ -579,6 +579,52 @@
EXPORT_SYMBOL(idr_for_each);
/**
+ * idr_get_next - lookup next object of id to given id.
+ * @idp: idr handle
+ * @nextidp: pointer to lookup key
+ *
+ * Returns pointer to registered object with id, which is next number to
+ * given id. After being looked up, *@nextidp will be updated for the next
+ * iteration.
+ */
+
+void *idr_get_next(struct idr *idp, int *nextidp)
+{
+ struct idr_layer *p, *pa[MAX_LEVEL];
+ struct idr_layer **paa = &pa[0];
+ int id = *nextidp;
+ int n, max;
+
+ /* find first ent */
+ n = idp->layers * IDR_BITS;
+ max = 1 << n;
+ p = rcu_dereference(idp->top);
+ if (!p)
+ return NULL;
+
+ while (id < max) {
+ while (n > 0 && p) {
+ n -= IDR_BITS;
+ *paa++ = p;
+ p = rcu_dereference(p->ary[(id >> n) & IDR_MASK]);
+ }
+
+ if (p) {
+ *nextidp = id;
+ return p;
+ }
+
+ id += 1 << n;
+ while (n < fls(id)) {
+ n += IDR_BITS;
+ p = *--paa;
+ }
+ }
+ return NULL;
+}
+EXPORT_SYMBOL(idr_get_next);
+
+/**
* idr_replace - replace pointer for given id
* @idp: idr handle
* @ptr: pointer you want associated with the id
--- kernel/deckard/mm/ashmem.c
+++ kernel/deckard/mm/ashmem.c
@@ -29,6 +29,7 @@
#include <linux/mutex.h>
#include <linux/shmem_fs.h>
#include <linux/ashmem.h>
+#include <asm/cacheflush.h>
#define ASHMEM_NAME_PREFIX "dev/ashmem/"
#define ASHMEM_NAME_PREFIX_LEN (sizeof(ASHMEM_NAME_PREFIX) - 1)
@@ -45,6 +46,8 @@
struct list_head unpinned_list; /* list of all ashmem areas */
struct file *file; /* the shmem-based backing file */
size_t size; /* size of the mapping, in bytes */
+ unsigned long vm_start; /* Start address of vm_area
+ * which maps this ashmem */
unsigned long prot_mask; /* allowed prot bits, as vm_flags */
};
@@ -255,6 +258,7 @@
vma->vm_file = asma->file;
}
vma->vm_flags |= VM_CAN_NONLINEAR;
+ asma->vm_start = vma->vm_start;
out:
mutex_unlock(&ashmem_mutex);
@@ -555,6 +559,30 @@
return ret;
}
+static int ashmem_cache_op(struct ashmem_area *asma,
+ void (*cache_func)(unsigned long vstart, unsigned long length,
+ unsigned long pstart))
+{
+#ifdef CONFIG_OUTER_CACHE
+ unsigned long vaddr;
+#endif
+ mutex_lock(&ashmem_mutex);
+#ifndef CONFIG_OUTER_CACHE
+ cache_func(asma->vm_start, asma->size, 0);
+#else
+ for (vaddr = asma->vm_start; vaddr < asma->vm_start + asma->size;
+ vaddr += PAGE_SIZE) {
+ unsigned long physaddr;
+ physaddr = virtaddr_to_physaddr(vaddr);
+ if (!physaddr)
+ return -EINVAL;
+ cache_func(vaddr, PAGE_SIZE, physaddr);
+ }
+#endif
+ mutex_unlock(&ashmem_mutex);
+ return 0;
+}
+
static long ashmem_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
struct ashmem_area *asma = file->private_data;
@@ -595,11 +623,73 @@
ashmem_shrink(ret, GFP_KERNEL);
}
break;
+ case ASHMEM_CACHE_FLUSH_RANGE:
+ ret = ashmem_cache_op(asma, &clean_and_invalidate_caches);
+ break;
+ case ASHMEM_CACHE_CLEAN_RANGE:
+ ret = ashmem_cache_op(asma, &clean_caches);
+ break;
+ case ASHMEM_CACHE_INV_RANGE:
+ ret = ashmem_cache_op(asma, &invalidate_caches);
+ break;
}
return ret;
}
+static int is_ashmem_file(struct file *file)
+{
+ char fname[256], *name;
+ name = dentry_path(file->f_dentry, fname, 256);
+ return strcmp(name, "/ashmem") ? 0 : 1;
+}
+
+int get_ashmem_file(int fd, struct file **filp, struct file **vm_file,
+ unsigned long *len)
+{
+ int ret = -1;
+ struct file *file = fget(fd);
+ *filp = NULL;
+ *vm_file = NULL;
+ if (unlikely(file == NULL)) {
+ pr_err("ashmem: %s: requested data from file "
+ "descriptor that doesn't exist.\n", __func__);
+ } else {
+ char currtask_name[FIELD_SIZEOF(struct task_struct, comm) + 1];
+ pr_debug("filp %p rdev %d pid %u(%s) file %p(%ld)"
+ " dev id: %d\n", filp,
+ file->f_dentry->d_inode->i_rdev,
+ current->pid, get_task_comm(currtask_name, current),
+ file, file_count(file),
+ MINOR(file->f_dentry->d_inode->i_rdev));
+ if (is_ashmem_file(file)) {
+ struct ashmem_area *asma = file->private_data;
+ *filp = file;
+ *vm_file = asma->file;
+ *len = asma->size;
+ ret = 0;
+ } else {
+ pr_err("file descriptor is not an ashmem "
+ "region fd: %d\n", fd);
+ fput(file);
+ }
+ }
+ return ret;
+}
+EXPORT_SYMBOL(get_ashmem_file);
+
+void put_ashmem_file(struct file *file)
+{
+ char currtask_name[FIELD_SIZEOF(struct task_struct, comm) + 1];
+ pr_debug("rdev %d pid %u(%s) file %p(%ld)" " dev id: %d\n",
+ file->f_dentry->d_inode->i_rdev, current->pid,
+ get_task_comm(currtask_name, current), file,
+ file_count(file), MINOR(file->f_dentry->d_inode->i_rdev));
+ if (file && is_ashmem_file(file))
+ fput(file);
+}
+EXPORT_SYMBOL(put_ashmem_file);
+
static struct file_operations ashmem_fops = {
.owner = THIS_MODULE,
.open = ashmem_open,
--- kernel/compcache-0.6.2/compat.h
+++ kernel/compcache-0.6.2/compat.h
@@ -2,7 +2,7 @@
#define _RAMZSWAP_COMPAT_H_
/* Uncomment this if you are using swap free notify patch */
-//#define CONFIG_SWAP_FREE_NOTIFY
+#define CONFIG_SWAP_FREE_NOTIFY
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31))
#define blk_queue_physical_block_size(q, size) \
--- device/sharp/deckard/Android.mk
+++ device/sharp/deckard/Android.mk
@@ -0,0 +1,20 @@
+# Copyright (C) 2010 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH := $(call my-dir)
+
+ifneq ($(filter deckard,$(TARGET_DEVICE)),)
+include $(call all-makefiles-under,$(LOCAL_PATH))
+-include vendor/qcom/common/Qsd8kBoard.mk
+endif
--- device/sharp/deckard/AndroidProducts.mk
+++ device/sharp/deckard/AndroidProducts.mk
@@ -0,0 +1,2 @@
+PRODUCT_MAKEFILES := \
+ $(LOCAL_DIR)/full_deckard.mk
--- device/sharp/deckard/BoardConfig.mk
+++ device/sharp/deckard/BoardConfig.mk
@@ -0,0 +1,81 @@
+# Copyright (C) 2010 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+#
+# This file sets variables that control the way modules are built
+# thorughout the system. It should not be used to conditionally
+# disable makefiles (the proper mechanism to control what gets
+# included in a build is to use PRODUCT_PACKAGES in a product
+# definition file).
+#
+
+# WARNING: This line must come *before* including the proprietary
+# variant, so that it gets overwritten by the parent (which goes
+# against the traditional rules of inheritance).
+# The proprietary variant sets USE_CAMERA_STUB := false, this way
+# we use the camera stub when the vendor tree isn't present, and
+# the true camera library when the vendor tree is available. Similarly,
+# we set USE_PROPRIETARY_AUDIO_EXTENSIONS to true in the proprietary variant as
+# well.
+USE_CAMERA_STUB := true
+USE_PROPRIETARY_AUDIO_EXTENSIONS := false
+
+-include vendor/sharp/deckard/BoardConfigVendor.mk
+
+# inherit from the proprietary version
+# needed for BP-flashing updater extensions
+
+TARGET_BOARD_PLATFORM := qsd8k
+
+TARGET_CPU_ABI := armeabi-v7a
+TARGET_CPU_ABI2 := armeabi
+TARGET_CPU_SMP := false
+TARGET_ARCH := arm
+TARGET_ARCH_VARIANT := armv7-a-neon
+ARCH_ARM_HAVE_TLS_REGISTER := true
+ARCH_ARM_USE_NON_NEON_MEMCPY := true
+
+TARGET_NO_RECOVERY := true
+TARGET_USERIMAGES_USE_EXT4 := true
+
+BOARD_SYSTEMIMAGE_PARTITION_SIZE := 268435456
+BOARD_USERDATAIMAGE_PARTITION_SIZE := 536870912
+BOARD_FLASH_BLOCK_SIZE := 4096
+
+# Wifi related defines
+BOARD_WPA_SUPPLICANT_DRIVER := WEXT
+WPA_SUPPLICANT_VERSION := VER_0_5_X
+WIFI_DRIVER_MODULE_PATH := "/system/lib/modules/unifi_sdio.ko"
+WIFI_DRIVER_MODULE_NAME := "unifi_sdio"
+
+TARGET_BOOTLOADER_BOARD_NAME := deckard
+#TARGET_BOARD_INFO_FILE := device/sharp/deckard/board-info.txt
+
+BOARD_USES_GENERIC_AUDIO := false
+BOARD_USES_ALSA_AUDIO := false
+
+BOARD_USES_GENERIC_INVENSENSE := false
+
+BOARD_HAVE_BLUETOOTH := true
+BOARD_HAVE_BLUETOOTH_BCM := false
+
+USE_OPENGL_RENDERER := true
+#BOARD_EGL_CFG := device/sharp/deckard/egl.cfg
+
+# Avoid the generation of ldrcc instructions
+NEED_WORKAROUND_CORTEX_A9_745320 := false
+
+#TARGET_RECOVERY_UPDATER_LIBS += librecovery_updater_deckard
+#TARGET_RELEASETOOLS_EXTENSIONS := device/sharp/deckard
+
--- device/sharp/deckard/device.mk
+++ device/sharp/deckard/device.mk
@@ -0,0 +1,115 @@
+#
+# Copyright (C) 2010 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+ifeq ($(TARGET_PREBUILT_KERNEL),)
+ LOCAL_KERNEL := device/sharp/deckard/kernel
+else
+ LOCAL_KERNEL := $(TARGET_PREBUILT_KERNEL)
+endif
+
+PRODUCT_AAPT_CONFIG := normal large mdpi tvdpi hdpi
+PRODUCT_AAPT_PREF_CONFIG := mdpi
+
+DEVICE_PACKAGE_OVERLAYS := \
+ device/asus/grouper/overlay
+
+PRODUCT_PROPERTY_OVERRIDES := \
+ wifi.interface=wlan0 \
+ wifi.supplicant_scan_interval=15 \
+ ro.carrier=wifi-only
+
+# Set default USB interface
+#PRODUCT_DEFAULT_PROPERTY_OVERRIDES += \
+
+include frameworks/native/build/phone-hdpi-512-dalvik-heap.mk
+
+PRODUCT_COPY_FILES := \
+ $(LOCAL_KERNEL):kernel \
+ device/sharp/deckard/ubi.cfg:ubi.cfg \
+ device/sharp/deckard/init.sharpdeckard.rc:root/init.sharpdeckard.rc \
+ device/sharp/deckard/ueventd.sharpdeckard.rc:root/ueventd.sharpdeckard.rc
+
+PRODUCT_COPY_FILES += \
+ device/sharp/deckard/ramzswap.ko:system/lib/modules/ramzswap.ko \
+ device/sharp/deckard/unifi_sdio.ko:system/lib/modules/unifi_sdio.ko
+
+PRODUCT_COPY_FILES += \
+ frameworks/native/data/etc/tablet_core_hardware.xml:system/etc/permissions/tablet_core_hardware.xml \
+ frameworks/native/data/etc/android.hardware.location.gps.xml:system/etc/permissions/android.hardware.location.gps.xml \
+ frameworks/native/data/etc/android.hardware.wifi.xml:system/etc/permissions/android.hardware.wifi.xml
+
+# for PDK build, include only when the dir exists
+# too early to use $(TARGET_BUILD_PDK)
+ifneq ($(wildcard packages/wallpapers/LivePicker),)
+PRODUCT_COPY_FILES += \
+ packages/wallpapers/LivePicker/android.software.live_wallpaper.xml:system/etc/permissions/android.software.live_wallpaper.xml
+endif
+
+PRODUCT_COPY_FILES += \
+ device/sharp/deckard/vold.fstab:system/etc/vold.fstab \
+ device/sharp/deckard/SH_touchpanel.idc:system/usr/idc/SH_touchpanel.idc \
+ device/sharp/deckard/SH_qwerty_key.idc:system/usr/idc/SH_qwerty_key.idc \
+ frameworks/base/data/keyboards/qwerty.kl:system/usr/keylayout/SH_qwerty_key.kl \
+ frameworks/base/data/keyboards/qwerty2.kcm:system/usr/keychars/SH_qwerty_key.kcm \
+ frameworks/base/data/keyboards/qwerty.kl:system/usr/keylayout/SH_pm_key.kl \
+ frameworks/base/data/keyboards/qwerty.kcm:system/usr/keychars/SH_pm_key.kcm \
+ frameworks/base/data/fonts/MTLc3m.ttf:system/fonts/MTLc3m.ttf
+
+# Prebuilt libraries that are needed to build open-source libraries
+PRODUCT_COPY_FILES += \
+ device/sharp/deckard/export_includes:obj/SHARED_LIBRARIES/libaudio_intermediates/export_includes \
+ device/sharp/deckard/libaudio.so:obj/lib/libaudio.so \
+ device/sharp/deckard/export_includes:obj/SHARED_LIBRARIES/libloc_api_intermediates/export_includes \
+ device/sharp/deckard/libloc_api.so:obj/lib/libloc_api.so
+
+PRODUCT_PACKAGES := \
+ copybit.qsd8k \
+ gralloc.qsd8k \
+ hwcomposer.qsd8k \
+ libgenlock \
+ libmemalloc \
+ liboverlay \
+ libQcomUI \
+ libtilerenderer \
+ audio.primary.deckard \
+ libbinder.deckard \
+ librs_jni \
+ make_ext4fs \
+ setup_fs \
+ com.android.future.usb.accessory
+
+# for bugmailer
+#PRODUCT_PACKAGES += send_bug
+#PRODUCT_COPY_FILES += \
+# system/extras/bugmailer/bugmailer.sh:system/bin/bugmailer.sh \
+# system/extras/bugmailer/send_bug:system/bin/send_bug
+
+PRODUCT_PACKAGES += \
+ jctool \
+ bootsound \
+ stagefright
+
+PRODUCT_CHARACTERISTICS := tablet
+
+# we have enough storage space to hold precise GC data
+PRODUCT_TAGS += dalvik.gc.type-precise
+
+# media codec config xml file
+PRODUCT_COPY_FILES += \
+ device/sharp/deckard/media_codecs.xml:system/etc/media_codecs.xml
+
+# inherit from the non-open-source side, if present
+$(call inherit-product-if-exists, vendor/sharp/deckard/device-vendor.mk)
--- device/sharp/deckard/full_deckard.mk
+++ device/sharp/deckard/full_deckard.mk
@@ -0,0 +1,32 @@
+# Copyright (C) 2010 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+#
+# This file is the build configuration for a full Android
+# build for deckard hardware. This cleanly combines a set of
+# device-specific aspects (drivers) with a device-agnostic
+# product configuration (apps).
+#
+
+# Inherit from those products. Most specific first.
+$(call inherit-product, device/sharp/deckard/device.mk)
+# This is where we'd set a backup provider if we had one
+#$(call inherit-product, device/sample/products/backup_overlay.mk)
+$(call inherit-product, $(SRC_TARGET_DIR)/product/full_base.mk)
+
+# Discard inherited values and use our own instead.
+PRODUCT_NAME := full_deckard
+PRODUCT_DEVICE := deckard
+PRODUCT_BRAND := Android
+PRODUCT_MODEL := IS01
--- device/sharp/deckard/SH_touchpanel.idc
+++ device/sharp/deckard/SH_touchpanel.idc
@@ -0,0 +1,26 @@
+# Copyright (C) 2010 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+#
+# Input Device Configuration File for the DECKARD touch panel device.
+#
+# These calibration values are derived from empirical measurements
+# and may not be appropriate for use with other touch screens.
+# Refer to the input device configuration documentation for more details.
+#
+
+# Basic Parameters
+touch.deviceType = touchScreen
+touch.orientationAware = 1
+
--- device/sharp/deckard/SH_qwerty_key.idc
+++ device/sharp/deckard/SH_qwerty_key.idc
@@ -0,0 +1,27 @@
+# Copyright (C) 2010 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+#
+# Input Device Configuration File for the DECKARD cursor / keyboard device.
+#
+# These calibration values are derived from empirical measurements
+# and may not be appropriate for use with other touch screens.
+# Refer to the input device configuration documentation for more details.
+#
+
+# Basic Parameters
+cursor.mode = navigation
+cursor.orientationAware = 1
+keyboard.orientationAware = 1
+
--- device/sharp/deckard/system.prop
+++ device/sharp/deckard/system.prop
@@ -0,0 +1,10 @@
+ro.opengles.version = 131072
+wifi.interface=wlan0
+rild.libpath=/system/lib/libril-icera.so
+rild.libargs=-e wwan0
+ro.audio.monitorOrientation=true
+ro.audio.flinger_standbytime_ms=120000
+debug.gr.swapinterval=0
+
+# set default lcd density to HDPI
+ro.sf.lcd_density=240
--- device/sharp/deckard/ubi.cfg
+++ device/sharp/deckard/ubi.cfg
@@ -0,0 +1,8 @@
+[boot]
+mode=ubi
+image=./boot.img
+vol_id=0
+vol_size=200MiB
+vol_type=dynamic
+vol_name=boot
+vol_flags=autoresize
--- device/sharp/deckard/vendorsetup.sh
+++ device/sharp/deckard/vendorsetup.sh
@@ -0,0 +1,23 @@
+#
+# Copyright (C) 2008 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# This file is executed by build/envsetup.sh, and can use anything
+# defined in envsetup.sh.
+#
+# In particular, you can add lunch options with the add_lunch_combo
+# function: add_lunch_combo generic-eng
+
+add_lunch_combo full_deckard-userdebug
--- device/sharp/deckard/vold.fstab
+++ device/sharp/deckard/vold.fstab
@@ -0,0 +1,14 @@
+## Vold 2.0 fstab for cardhu
+
+#######################
+## Regular device mount
+##
+## Format: dev_mount <label> <mount_point> <part> <sysfs_path1...>
+## label - Label for the volume
+## mount_point - Where the volume will be mounted
+## part - Partition # (1 based), or 'auto' for first usable partition.
+## <sysfs_path> - List of sysfs paths to source devices
+######################
+
+# Mounts the first usable partition of the specified device
+dev_mount sdcard /mnt/sdcard auto /devices/platform/goldfish_mmc.0 /devices/virtual/block/stheno
--- device/sharp/deckard/media_codecs.xml
+++ device/sharp/deckard/media_codecs.xml
@@ -0,0 +1,123 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!-- Copyright (C) 2012 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<!--
+<!DOCTYPE MediaCodecs [
+<!ELEMENT MediaCodecs (Decoders,Encoders)>
+<!ELEMENT Decoders (MediaCodec*)>
+<!ELEMENT Encoders (MediaCodec*)>
+<!ELEMENT MediaCodec (Type*,Quirk*)>
+<!ATTLIST MediaCodec name CDATA #REQUIRED>
+<!ATTLIST MediaCodec type CDATA>
+<!ELEMENT Type EMPTY>
+<!ATTLIST Type name CDATA #REQUIRED>
+<!ELEMENT Quirk EMPTY>
+<!ATTLIST Quirk name CDATA #REQUIRED>
+]>
+
+There's a simple and a complex syntax to declare the availability of a
+media codec:
+
+A codec that properly follows the OpenMax spec and therefore doesn't have any
+quirks and that only supports a single content type can be declared like so:
+
+ <MediaCodec name="OMX.foo.bar" type="something/interesting" />
+
+If a codec has quirks OR supports multiple content types, the following syntax
+can be used:
+
+ <MediaCodec name="OMX.foo.bar" >
+ <Type name="something/interesting" />
+ <Type name="something/else" />
+ ...
+ <Quirk name="requires-allocate-on-input-ports" />
+ <Quirk name="requires-allocate-on-output-ports" />
+ <Quirk name="output-buffers-are-unreadable" />
+ </MediaCodec>
+
+Only the three quirks included above are recognized at this point:
+
+"requires-allocate-on-input-ports"
+ must be advertised if the component does not properly support specification
+ of input buffers using the OMX_UseBuffer(...) API but instead requires
+ OMX_AllocateBuffer to be used.
+
+"requires-allocate-on-output-ports"
+ must be advertised if the component does not properly support specification
+ of output buffers using the OMX_UseBuffer(...) API but instead requires
+ OMX_AllocateBuffer to be used.
+
+"output-buffers-are-unreadable"
+ must be advertised if the emitted output buffers of a decoder component
+ are not readable, i.e. use a custom format even though abusing one of
+ the official OMX colorspace constants.
+ Clients of such decoders will not be able to access the decoded data,
+ naturally making the component much less useful. The only use for
+ a component with this quirk is to render the output to the screen.
+ Audio decoders MUST NOT advertise this quirk.
+ Video decoders that advertise this quirk must be accompanied by a
+ corresponding color space converter for thumbnail extraction,
+ matching surfaceflinger support that can render the custom format to
+ a texture and possibly other code, so just DON'T USE THIS QUIRK.
+
+-->
+
+<MediaCodecs>
+ <Decoders>
+ <MediaCodec name="OMX.qcom.video.decoder.mpeg4" type="video/mp4v-es" >
+ <Quirk name="requires-allocate-on-output-ports" />
+ </MediaCodec>
+ <MediaCodec name="OMX.qcom.video.decoder.h263" type="video/3gpp" >
+ <Quirk name="requires-allocate-on-output-ports" />
+ </MediaCodec>
+ <MediaCodec name="OMX.qcom.video.decoder.avc" type="video/avc" >
+ <Quirk name="requires-allocate-on-output-ports" />
+ </MediaCodec>
+
+ <MediaCodec name="OMX.google.mp3.decoder" type="audio/mpeg" />
+ <MediaCodec name="OMX.google.amrnb.decoder" type="audio/3gpp" />
+ <MediaCodec name="OMX.google.amrwb.decoder" type="audio/amr-wb" />
+ <MediaCodec name="OMX.google.aac.decoder" type="audio/mp4a-latm" />
+ <MediaCodec name="OMX.google.g711.alaw.decoder" type="audio/g711-alaw" />
+ <MediaCodec name="OMX.google.g711.mlaw.decoder" type="audio/g711-mlaw" />
+ <MediaCodec name="OMX.google.vorbis.decoder" type="audio/vorbis" />
+
+ <MediaCodec name="OMX.google.mpeg4.decoder" type="video/mp4v-es" />
+ <MediaCodec name="OMX.google.h263.decoder" type="video/3gpp" />
+ <MediaCodec name="OMX.google.h264.decoder" type="video/avc" />
+ <MediaCodec name="OMX.google.vpx.decoder" type="video/x-vnd.on2.vp8" />
+ </Decoders>
+
+ <Encoders>
+ <MediaCodec name="OMX.qcom.video.encoder.mpeg4" type="video/mp4v-es" >
+ <Quirk name="requires-allocate-on-input-ports" />
+ <Quirk name="requires-allocate-on-output-ports" />
+ </MediaCodec>
+ <MediaCodec name="OMX.qcom.video.encoder.h263" type="video/3gpp" >
+ <Quirk name="requires-allocate-on-input-ports" />
+ <Quirk name="requires-allocate-on-output-ports" />
+ </MediaCodec>
+ <MediaCodec name="OMX.qcom.video.encoder.avc" type="video/avc" >
+ <Quirk name="requires-allocate-on-input-ports" />
+ <Quirk name="requires-allocate-on-output-ports" />
+ </MediaCodec>
+
+ <MediaCodec name="OMX.google.amrnb.encoder" type="audio/3gpp" />
+ <MediaCodec name="OMX.google.amrwb.encoder" type="audio/amr-wb" />
+ <MediaCodec name="OMX.google.aac.encoder" type="audio/mp4a-latm" />
+ <MediaCodec name="OMX.google.flac.encoder" type="audio/flac" />
+ </Encoders>
+</MediaCodecs>
--- device/sharp/deckard/init.sharpdeckard.rc
+++ device/sharp/deckard/init.sharpdeckard.rc
@@ -0,0 +1,228 @@
+#import init.sharpdeckard.usb.rc
+
+on early-init
+ export EXTERNAL_STORAGE /mnt/sdcard
+ mkdir /mnt/sdcard 0000 system system
+ # for backwards compatibility
+ symlink /mnt/sdcard /sdcard
+
+on post-fs
+ mount ext4 loop@/host_data/guest/system.ext4 /system rw remount
+ symlink /host_system/bin/akmd2 /system/bin/akmd2
+ symlink /host_system/bin/mediayamahaserver /system/bin/mediayamahaserver
+ symlink /host_system/bin/medousa /system/bin/medousa
+ symlink /host_system/bin/shdisp_process /system/bin/shdisp_process
+ symlink /host_system/bin/shlcdc_process /system/bin/shlcdc_process
+ symlink /host_system/bin/shsd_process /system/bin/shsd_process
+ symlink /host_system/bin/synergy_service /system/bin/synergy_service
+ symlink /host_system/bin/synergy_wifi_attach /system/bin/synergy_wifi_attach
+ symlink /host_system/bin/unififw /system/bin/unififw
+ mkdir /system/etc/firmware
+ symlink /host_system/etc/firmware/unifi-sdio-1 /system/etc/firmware/unifi-sdio-1
+ symlink /host_system/etc/gps.conf /system/etc/gps.conf
+ symlink /host_system/etc/yamaha /system/etc/yamaha
+ symlink /host_system/etc/AudioFilter.csv /system/etc/AudioFilter.csv
+ symlink /host_system/lib/hw/sensors.default.so /system/lib/hw/sensors.default.so
+ symlink /host_system/lib/libOmxAacDec.so /system/lib/libOmxAacDec.so
+ symlink /host_system/lib/libOmxAacEnc.so /system/lib/libOmxAacEnc.so
+ symlink /host_system/lib/libOmxCore.so /system/lib/libOmxCore.so
+ symlink /host_system/lib/libOmxEvrcDec.so /system/lib/libOmxEvrcDec.so
+ symlink /host_system/lib/libOmxMp3Dec.so /system/lib/libOmxMp3Dec.so
+ symlink /host_system/lib/libOmxQcelp13Dec.so /system/lib/libOmxQcelp13Dec.so
+ symlink /host_system/lib/libOmxQcelp13Enc.so /system/lib/libOmxQcelp13Enc.so
+ symlink /host_system/lib/libOmxVdec.so /system/lib/libOmxVdec.so
+ symlink /host_system/lib/libOmxVidEnc.so /system/lib/libOmxVidEnc.so
+ symlink /host_system/lib/libYamahaKill.so /system/lib/libYamahaKill.so
+ symlink /host_system/lib/libaudio.so /system/lib/libaudio.so
+ symlink /host_system/lib/libaudioyamaha.so /system/lib/libaudioyamaha.so
+ symlink /host_system/lib/libbattlog.so /system/lib/libbattlog.so
+ symlink /host_system/lib/libcommondefs.so /system/lib/libcommondefs.so
+ symlink /host_system/lib/libdiag.so /system/lib/libdiag.so
+ symlink /host_system/lib/libdsm.so /system/lib/libdsm.so
+ symlink /host_system/lib/libloc_api.so /system/lib/libloc_api.so
+ symlink /host_system/lib/libloc_api-rpc.so /system/lib/libloc_api-rpc.so
+ symlink /host_system/lib/libmediayamaha.so /system/lib/libmediayamaha.so
+ symlink /host_system/lib/libmediayamahacheck.so /system/lib/libmediayamahacheck.so
+ symlink /host_system/lib/libmediayamahaservice.so /system/lib/libmediayamahaservice.so
+ symlink /host_system/lib/libmediayamahasmw.so /system/lib/libmediayamahasmw.so
+ symlink /host_system/lib/libmediayamahautils.so /system/lib/libmediayamahautils.so
+ symlink /host_system/lib/libmm-omxcore.so /system/lib/libmm-omxcore.so
+ symlink /host_system/lib/libnv.so /system/lib/libnv.so
+ symlink /host_system/lib/libomx_aacdec_sharedlibrary.so /system/lib/libomx_aacdec_sharedlibrary.so
+ symlink /host_system/lib/libomx_amrdec_sharedlibrary.so /system/lib/libomx_amrdec_sharedlibrary.so
+ symlink /host_system/lib/libomx_amrenc_sharedlibrary.so /system/lib/libomx_amrenc_sharedlibrary.so
+ symlink /host_system/lib/libomx_avcdec_sharedlibrary.so /system/lib/libomx_avcdec_sharedlibrary.so
+ symlink /host_system/lib/libomx_m4vdec_sharedlibrary.so /system/lib/libomx_m4vdec_sharedlibrary.so
+ symlink /host_system/lib/libomx_mp3dec_sharedlibrary.so /system/lib/libomx_mp3dec_sharedlibrary.so
+ symlink /host_system/lib/libomx_sharedlibrary.so /system/lib/libomx_sharedlibrary.so
+ symlink /host_system/lib/libomx_sharedlibrary_qc.so /system/lib/libomx_sharedlibrary_qc.so
+ symlink /host_system/lib/libomx_wmadec_sharedlibrary.so /system/lib/libomx_wmadec_sharedlibrary.so
+ symlink /host_system/lib/libomx_wmvdec_sharedlibrary.so /system/lib/libomx_wmvdec_sharedlibrary.so
+ symlink /host_system/lib/liboncrpc.so /system/lib/liboncrpc.so
+ symlink /host_system/lib/libqueue.so /system/lib/libqueue.so
+ symlink /host_system/lib/libshdisp.so /system/lib/libshdisp.so
+ symlink /host_system/lib/libshkbd.so /system/lib/libshkbd.so
+ symlink /host_system/lib/libshlcdc.so /system/lib/libshlcdc.so
+ symlink /host_system/lib/libshsd.so /system/lib/libshsd.so
+ symlink /host_system/lib/libshspamp.so /system/lib/libshspamp.so
+ symlink /host_system/lib/libshtimer.so /system/lib/libshtimer.so
+ symlink /host_system/lib/libshtps.so /system/lib/libshtps.so
+ symlink /host_system/lib/libshvibrator.so /system/lib/libshvibrator.so
+ symlink /host_system/lib/libsynergy_com.so /system/lib/libsynergy_com.so
+ symlink /host_system/lib/libsynergy_liba2dp.so /system/lib/libsynergy_liba2dp.so
+ symlink /host_data/guest/adreno/system/etc/firmware/yamato_pfp.fw /system/etc/firmware/yamato_pfp.fw
+ symlink /host_data/guest/adreno/system/etc/firmware/yamato_pm4.fw /system/etc/firmware/yamato_pm4.fw
+ symlink /host_data/guest/adreno/system/lib/egl/egl.cfg /system/lib/egl/egl.cfg
+ symlink /host_data/guest/adreno/system/lib/egl/eglsubAndroid.so /system/lib/egl/eglsubAndroid.so
+ symlink /host_data/guest/adreno/system/lib/egl/libEGL_adreno200.so /system/lib/egl/libEGL_adreno200.so
+ symlink /host_data/guest/adreno/system/lib/egl/libGLES_android.so /system/lib/egl/libGLES_android.so
+ symlink /host_data/guest/adreno/system/lib/egl/libGLESv1_CM_adreno200.so /system/lib/egl/libGLESv1_CM_adreno200.so
+ symlink /host_data/guest/adreno/system/lib/egl/libGLESv2_adreno200.so /system/lib/egl/libGLESv2_adreno200.so
+ symlink /host_data/guest/adreno/system/lib/egl/libq3dtools_adreno200.so /system/lib/egl/libq3dtools_adreno200.so
+ symlink /host_data/guest/adreno/system/lib/libC2D2.so /system/lib/libC2D2.so
+ symlink /host_data/guest/adreno/system/lib/libgsl.so /system/lib/libgsl.so
+ symlink /host_data/guest/adreno/system/lib/libOpenVG.so /system/lib/libOpenVG.so
+ symlink /host_data/guest/adreno/system/lib/libsc-a2xx.so /system/lib/libsc-a2xx.so
+ rm /system/app/PinyinIME.apk
+ rm /system/app/Provision.apk
+ rm /system/app/QuickSearchBox.apk
+ symlink /host_data/guest/gapps/system/app/ChromeBookmarksSyncAdapter.apk /system/app/ChromeBookmarksSyncAdapter.apk
+ symlink /host_data/guest/gapps/system/app/GenieWidget.apk /system/app/GenieWidget.apk
+ symlink /host_data/guest/gapps/system/app/Gmail.apk /system/app/Gmail.apk
+ symlink /host_data/guest/gapps/system/app/GmsCore.apk /system/app/GmsCore.apk
+ symlink /host_data/guest/gapps/system/app/GoogleBackupTransport.apk /system/app/GoogleBackupTransport.apk
+ symlink /host_data/guest/gapps/system/app/GoogleCalendarSyncAdapter.apk /system/app/GoogleCalendarSyncAdapter.apk
+ symlink /host_data/guest/gapps/system/app/GoogleContactsSyncAdapter.apk /system/app/GoogleContactsSyncAdapter.apk
+ symlink /host_data/guest/gapps/system/app/GoogleEars.apk /system/app/GoogleEars.apk
+ symlink /host_data/guest/gapps/system/app/GoogleFeedback.apk /system/app/GoogleFeedback.apk
+ symlink /host_data/guest/gapps/system/app/GoogleLoginService.apk /system/app/GoogleLoginService.apk
+ symlink /host_data/guest/gapps/system/app/GooglePartnerSetup.apk /system/app/GooglePartnerSetup.apk
+ symlink /host_data/guest/gapps/system/app/GoogleServicesFramework.apk /system/app/GoogleServicesFramework.apk
+ symlink /host_data/guest/gapps/system/app/GoogleTTS.apk /system/app/GoogleTTS.apk
+ symlink /host_data/guest/gapps/system/app/LatinImeDictionaryPack.apk /system/app/LatinImeDictionaryPack.apk
+ symlink /host_data/guest/gapps/system/app/MediaUploader.apk /system/app/MediaUploader.apk
+ symlink /host_data/guest/gapps/system/app/NetworkLocation.apk /system/app/NetworkLocation.apk
+ symlink /host_data/guest/gapps/system/app/OneTimeInitializer.apk /system/app/OneTimeInitializer.apk
+ symlink /host_data/guest/gapps/system/app/Phonesky.apk /system/app/Phonesky.apk
+ symlink /host_data/guest/gapps/system/app/QuickSearchBox.apk /system/app/QuickSearchBox.apk
+ symlink /host_data/guest/gapps/system/app/SetupWizard.apk /system/app/SetupWizard.apk
+ symlink /host_data/guest/gapps/system/app/Talk.apk /system/app/Talk.apk
+ symlink /host_data/guest/gapps/system/app/Talkback.apk /system/app/Talkback.apk
+ symlink /host_data/guest/gapps/system/app/VoiceSearchStub.apk /system/app/VoiceSearchStub.apk
+ symlink /host_data/guest/gapps/system/etc/g.prop /system/etc/g.prop
+ symlink /host_data/guest/gapps/system/etc/permissions/com.google.android.maps.xml /system/etc/permissions/com.google.android.maps.xml
+ symlink /host_data/guest/gapps/system/etc/permissions/com.google.android.media.effects.xml /system/etc/permissions/com.google.android.media.effects.xml
+ symlink /host_data/guest/gapps/system/etc/permissions/com.google.widevine.software.drm.xml /system/etc/permissions/com.google.widevine.software.drm.xml
+ symlink /host_data/guest/gapps/system/etc/permissions/features.xml /system/etc/permissions/features.xml
+ symlink /host_data/guest/gapps/system/framework/com.google.android.maps.jar /system/framework/com.google.android.maps.jar
+ symlink /host_data/guest/gapps/system/framework/com.google.android.media.effects.jar /system/framework/com.google.android.media.effects.jar
+ symlink /host_data/guest/gapps/system/framework/com.google.widevine.software.drm.jar /system/framework/com.google.widevine.software.drm.jar
+ symlink /host_data/guest/gapps/system/lib/libfilterpack_facedetect.so /system/lib/libfilterpack_facedetect.so
+ symlink /host_data/guest/gapps/system/lib/libflint_engine_jni_api.so /system/lib/libflint_engine_jni_api.so
+ symlink /host_data/guest/gapps/system/lib/libfrsdk.so /system/lib/libfrsdk.so
+ symlink /host_data/guest/gapps/system/lib/libgcomm_jni.so /system/lib/libgcomm_jni.so
+ symlink /host_data/guest/gapps/system/lib/libgoogle_recognizer_jni.so /system/lib/libgoogle_recognizer_jni.so
+ symlink /host_data/guest/gapps/system/lib/libpicowrapper.so /system/lib/libpicowrapper.so
+ symlink /host_data/guest/gapps/system/lib/libspeexwrapper.so /system/lib/libspeexwrapper.so
+ symlink /host_data/guest/gapps/system/lib/libvideochat_jni.so /system/lib/libvideochat_jni.so
+ symlink /host_data/guest/gapps/system/lib/libvideochat_stabilize.so /system/lib/libvideochat_stabilize.so
+ symlink /host_data/guest/gapps/system/lib/libvoicesearch.so /system/lib/libvoicesearch.so
+ symlink /host_data/guest/gapps/system/lib/libvorbisencoder.so /system/lib/libvorbisencoder.so
+ symlink /host_data/guest/gapps/system/lib/libpatts_engine_jni_api.so /system/lib/libpatts_engine_jni_api.so
+ rm /system/tts/lang_pico/de-DE_gl0_sg.bin
+ rm /system/tts/lang_pico/de-DE_ta.bin
+ rm /system/tts/lang_pico/es-ES_ta.bin
+ rm /system/tts/lang_pico/es-ES_zl0_sg.bin
+ rm /system/tts/lang_pico/fr-FR_nk0_sg.bin
+ rm /system/tts/lang_pico/fr-FR_ta.bin
+ rm /system/tts/lang_pico/it-IT_cm0_sg.bin
+ rm /system/tts/lang_pico/it-IT_ta.bin
+ symlink /host_data/guest/gapps/system/tts/lang_pico/de-DE_gl0_sg.bin /system/tts/lang_pico/de-DE_gl0_sg.bin
+ symlink /host_data/guest/gapps/system/tts/lang_pico/de-DE_ta.bin /system/tts/lang_pico/de-DE_ta.bin
+ symlink /host_data/guest/gapps/system/tts/lang_pico/es-ES_ta.bin /system/tts/lang_pico/es-ES_ta.bin
+ symlink /host_data/guest/gapps/system/tts/lang_pico/es-ES_zl0_sg.bin /system/tts/lang_pico/es-ES_zl0_sg.bin
+ symlink /host_data/guest/gapps/system/tts/lang_pico/fr-FR_nk0_sg.bin /system/tts/lang_pico/fr-FR_nk0_sg.bin
+ symlink /host_data/guest/gapps/system/tts/lang_pico/fr-FR_ta.bin /system/tts/lang_pico/fr-FR_ta.bin
+ symlink /host_data/guest/gapps/system/tts/lang_pico/it-IT_cm0_sg.bin /system/tts/lang_pico/it-IT_cm0_sg.bin
+ symlink /host_data/guest/gapps/system/tts/lang_pico/it-IT_ta.bin /system/tts/lang_pico/it-IT_ta.bin
+ symlink /host_data/guest/gapps/system/usr/srec /system/usr/srec
+ mount ext4 loop@/host_data/guest/system.ext4 /system ro remount
+
+on post-fs-data
+ # JCROM theme
+ mkdir /data/theme 0775 system system
+ mkdir /data/theme/bootanime 0775 system system
+ mkdir /data/theme/frame 0775 system system
+ mkdir /data/theme/launcher 0775 system system
+ mkdir /data/theme/lockscreen 0775 system system
+ mkdir /data/theme/navikey 0775 system system
+ mkdir /data/theme/notification 0775 system system
+ mkdir /data/theme/wallpaper 0775 system system
+ mkdir /data/theme/screenshot 0775 system system
+ mkdir /data/theme/statusbar 0775 system system
+ mkdir /data/theme/navibar 0775 system system
+ mkdir /data/theme/simeji 0775 system system
+ mkdir /data/theme/sounds 0775 system system
+ mkdir /data/theme/sounds/effect 0775 system system
+ mkdir /data/theme/sounds/bootsound 0775 system system
+
+ mkdir /data/misc/wifi/sockets 0770 wifi wifi
+ mkdir /data/misc/dhcp 0770 dhcp dhcp
+ chown dhcp dhcp /data/misc/dhcp
+ chown system system /sys/bus/platform/devices/msm_sdcc.1/polling
+
+ insmod /system/lib/modules/ramzswap.ko num_devices=1 disksize_kb=24576
+ mount swap swap@/dev/block/ramzswap0 swap
+ mount swap swap@/host_data/guest/swapfile swap
+ insmod /system/lib/modules/unifi_sdio.ko
+
+ # set RLIMIT_MEMLOCK to 64MB
+ setrlimit 8 67108864 67108864
+
+service mediayamaha /system/bin/mediayamahaserver
+ class main
+ user media
+ group system audio camera inet net_bt net_bt_admin
+
+service akmd2 /system/bin/akmd2
+ class main
+
+service shlcdc_process /system/bin/shlcdc_process
+ class main
+
+service shdisp_process /system/bin/shdisp_process
+ class main
+
+service shsd_process /system/bin/shsd_process
+ class main
+
+service medousa /system/bin/medousa
+ class main
+ group sdcard_rw
+
+service synergy_service /system/bin/synergy_service -C /dev/ttyHS0 -U 4000000
+ class main
+ oneshot
+
+service wpa_supplicant /system/bin/wpa_supplicant \
+ -iwlan0 -Dwext -c/data/misc/wifi/wpa_supplicant.conf -C/data/misc/wifi/sockets
+ class main
+ socket wpa_wlan0 dgram 660 wifi wifi
+ disabled
+ oneshot
+
+service dhcpcd_wlan0 /system/bin/dhcpcd -ABKL
+ class main
+ disabled
+ oneshot
+
+service iprenew_wlan0 /system/bin/dhcpcd -n
+ class main
+ disabled
+ oneshot
+
+service jctool system/bin/jctool
+ class core
+ user root
+ group root
+ oneshot
--- device/sharp/deckard/ueventd.sharpdeckard.rc
+++ device/sharp/deckard/ueventd.sharpdeckard.rc
@@ -0,0 +1,12 @@
+/dev/kgsl-3d0 0666 root root
+/dev/genlock 0666 root root
+/dev/akm8973_dev 0640 compass system
+/dev/smb380_dev 0640 compass system
+/dev/i2c-0 0666 root root
+/dev/ae2 0666 system audio
+/dev/msm_aac* 0660 system audio
+/dev/msm_pcm* 0666 system audio
+/dev/msm_voice 0666 system audio
+/dev/msm_audio_dev_ctrl 0666 system audio
+/dev/msm_qcelp_in 0660 system audio
+/dev/msm_evrc_in 0660 system audio
--- device/asus/grouper/overlay/frameworks/base/core/res/res/values/dimens.xml
+++ device/asus/grouper/overlay/frameworks/base/core/res/res/values/dimens.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Navigation bar is taller in portrait. -->
- <dimen name="navigation_bar_height">56dp</dimen>
+ <dimen name="navigation_bar_height">48dp</dimen>
</resources>
--- frameworks/base/data/keyboards/qwerty2.kcm
+++ frameworks/base/data/keyboards/qwerty2.kcm
@@ -122,8 +122,8 @@ key L {
number: '5'
base: 'l'
shift, capslock: 'L'
- alt: ':'
- shift+alt, capslock+alt: '`'
+ alt: ';'
+ shift+alt, capslock+alt: '+'
}
key M {
@@ -158,8 +158,8 @@ key P {
number: '7'
base: 'p'
shift, capslock: 'P'
- alt: '='
- shift+alt, capslock+alt: '\u00a5'
+ alt: '@'
+ shift+alt, capslock+alt: '`'
}
key Q {
@@ -167,8 +167,8 @@ key Q {
number: '7'
base: 'q'
shift, capslock: 'Q'
- alt: '|'
- shift+alt, capslock+alt: '\u0300'
+ alt: '\t'
+ shift+alt, capslock+alt: '\t'
}
key R {
@@ -257,8 +257,8 @@ key COMMA {
number: ','
base: ','
shift: '<'
- alt: ','
- shift+alt: ','
+ alt: '['
+ shift+alt: '{'
}
key PERIOD {
@@ -266,8 +266,8 @@ key PERIOD {
number: '.'
base: '.'
shift: '>'
- alt: '.'
- shift+alt: '\u2026'
+ alt: ']'
+ shift+alt: '}'
}
key AT {
@@ -284,8 +284,8 @@ key SLASH {
number: '/'
base: '/'
shift: '?'
- alt: '?'
- shift+alt: '?'
+ alt: ':'
+ shift+alt: '*'
}
key SPACE {
@@ -302,8 +302,8 @@ key ENTER {
number: '\n'
base: '\n'
shift: '\n'
- alt: '\n'
- shift+alt: '\n'
+ alt: '0'
+ shift+alt: '0'
}
key TAB {
@@ -319,9 +319,9 @@ key 0 {
label: '0'
number: '0'
base: '0'
- shift: ')'
- alt: ')'
- shift+alt: ')'
+ shift: '~'
+ alt: '^'
+ shift+alt: '^'
}
key 1 {
@@ -337,9 +337,9 @@ key 2 {
label: '2'
number: '2'
base: '2'
- shift: '@'
- alt: '@'
- shift+alt: '@'
+ shift: '"'
+ alt: '"'
+ shift+alt: '"'
}
key 3 {
@@ -373,36 +373,36 @@ key 6 {
label: '6'
number: '6'
base: '6'
- shift: '^'
- alt: '^'
- shift+alt: '^'
+ shift: '&'
+ alt: '&'
+ shift+alt: '&'
}
key 7 {
label: '7'
number: '7'
base: '7'
- shift: '&'
- alt: '&'
- shift+alt: '&'
+ shift: '\''
+ alt: '\''
+ shift+alt: '\''
}
key 8 {
label: '8'
number: '8'
base: '8'
- shift: '*'
- alt: '*'
- shift+alt: '*'
+ shift: '('
+ alt: '('
+ shift+alt: '('
}
key 9 {
label: '9'
number: '9'
base: '9'
- shift: '('
- alt: '('
- shift+alt: '('
+ shift: ')'
+ alt: ')'
+ shift+alt: ')'
}
key GRAVE {
@@ -418,8 +418,8 @@ key MINUS {
label: '-'
number: '-'
base: '-'
- shift: '_'
- alt: '-'
+ shift: '='
+ alt: '\\'
shift+alt: '_'
}
--- system/core/mkbootimg/mkbootimg.c
+++ system/core/mkbootimg/mkbootimg.c
@@ -142,7 +142,7 @@ int main(int argc, char **argv)
} else if(!strcmp(arg, "--base")) {
unsigned base = strtoul(val, 0, 16);
hdr.kernel_addr = base + 0x00008000;
- hdr.ramdisk_addr = base + 0x01000000;
+ hdr.ramdisk_addr = base + 0x04000000;
hdr.second_addr = base + 0x00F00000;
hdr.tags_addr = base + 0x00000100;
} else if(!strcmp(arg, "--board")) {
@@ -236,10 +236,10 @@ int main(int argc, char **argv)
}
if(write(fd, &hdr, sizeof(hdr)) != sizeof(hdr)) goto fail;
- if(write_padding(fd, pagesize, sizeof(hdr))) goto fail;
+ if(write_padding(fd, pagesize*2, sizeof(hdr))) goto fail;
if(write(fd, kernel_data, hdr.kernel_size) != hdr.kernel_size) goto fail;
- if(write_padding(fd, pagesize, hdr.kernel_size)) goto fail;
+ if(write_padding(fd, pagesize*2, hdr.kernel_size)) goto fail;
if(write(fd, ramdisk_data, hdr.ramdisk_size) != hdr.ramdisk_size) goto fail;
if(write_padding(fd, pagesize, hdr.ramdisk_size)) goto fail;
--- bionic/libc/SYSCALLS.TXT
+++ bionic/libc/SYSCALLS.TXT
@@ -151,6 +151,7 @@ int lchown:lchown32 (const char*, uid_t, gid_t) 198
int mount (const char*, const char*, const char*, unsigned long, const void*) 21
int umount(const char*) stub
int umount2 (const char*, int) 52
+int swapon (const char*, int) 87
int fstat:fstat64(int, struct stat*) 197
int stat:stat64(const char *, struct stat *) 195
int lstat:lstat64(const char *, struct stat *) 196
--- bionic/libc/arch-arm/syscalls.mk
+++ bionic/libc/arch-arm/syscalls.mk
@@ -99,6 +99,7 @@ syscall_src += arch-arm/syscalls/chown.S
syscall_src += arch-arm/syscalls/lchown.S
syscall_src += arch-arm/syscalls/mount.S
syscall_src += arch-arm/syscalls/umount2.S
+syscall_src += arch-arm/syscalls/swapon.S
syscall_src += arch-arm/syscalls/fstat.S
syscall_src += arch-arm/syscalls/stat.S
syscall_src += arch-arm/syscalls/lstat.S
--- bionic/libc/include/sys/linux-syscalls.h
+++ bionic/libc/include/sys/linux-syscalls.h
@@ -92,6 +92,7 @@
#define __NR_lchown32 (__NR_SYSCALL_BASE + 198)
#define __NR_mount (__NR_SYSCALL_BASE + 21)
#define __NR_umount2 (__NR_SYSCALL_BASE + 52)
+#define __NR_swapon (__NR_SYSCALL_BASE + 87)
#define __NR_fstat64 (__NR_SYSCALL_BASE + 197)
#define __NR_stat64 (__NR_SYSCALL_BASE + 195)
#define __NR_lstat64 (__NR_SYSCALL_BASE + 196)
--- bionic/libc/include/sys/swap.h
+++ bionic/libc/include/sys/swap.h
@@ -0,0 +1,28 @@
+/*
+ */
+#ifndef _SYS_SWAP_H
+
+#define _SYS_SWAP_H 1
+#include <features.h>
+
+__BEGIN_DECLS
+
+/* The swap priority is encoded as:
+ (prio << SWAP_FLAG_PRIO_SHIFT) & SWAP_FLAG_PRIO_MASK
+*/
+#define SWAP_FLAG_PREFER 0x8000 /* Set if swap priority is specified. */
+#define SWAP_FLAG_PRIO_MASK 0x7fff
+#define SWAP_FLAG_PRIO_SHIFT 0
+
+/*
+ * Prototypes
+ */
+extern int swapon(const char *, int);
+
+#if 0 /* MISSING FROM BIONIC */
+extern int swapoff(const char *);
+#endif /* MISSING */
+
+__END_DECLS
+
+#endif /* _SYS_SWAP_H */
--- bionic/libc/arch-arm/syscalls/swapon.S
+++ bionic/libc/arch-arm/syscalls/swapon.S
@@ -0,0 +1,14 @@
+/* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
+#include <sys/linux-syscalls.h>
+
+ENTRY(swapon)
+ .save {r4, r7}
+ stmfd sp!, {r4, r7}
+ ldr r7, =__NR_swapon
+ swi #0
+ ldmfd sp!, {r4, r7}
+ movs r0, r0
+ bxpl lr
+ b __set_syscall_errno
+END(swapon)
--- system/core/init/builtins.c
+++ system/core/init/builtins.c
@@ -28,6 +28,7 @@
#include <arpa/inet.h>
#include <stdlib.h>
#include <sys/mount.h>
+#include <sys/swap.h>
#include <sys/resource.h>
#include <sys/wait.h>
#include <linux/loop.h>
@@ -375,7 +376,24 @@ int do_mount(int nargs, char **args)
source = args[2];
target = args[3];
- if (!strncmp(source, "mtd@", 4)) {
+ if (!strncmp(source, "swap@", 5)) {
+ pid_t pid;
+ pid = fork();
+ if (pid == 0) {
+ struct stat info;
+ for (n = 0; n < 300; n++) {
+ if (stat(source + 5, &info) >= 0) {
+ if (swapon(source + 5, 0) < 0) {
+ _exit(127);
+ }
+ _exit(0);
+ }
+ sleep(1);
+ }
+ _exit(127);
+ }
+ return 0;
+ } else if (!strncmp(source, "mtd@", 4)) {
n = mtd_name_to_number(source + 4);
if (n < 0) {
return -1;
--- build/core/main.mk
+++ build/core/main.mk
@@ -243,7 +243,7 @@ user_variant := $(filter userdebug user,$(TARGET_BUILD_VARIANT))
enable_target_debugging := true
ifneq (,$(user_variant))
# Target is secure in user builds.
- ADDITIONAL_DEFAULT_PROPERTIES += ro.secure=1
+ ADDITIONAL_DEFAULT_PROPERTIES += ro.secure=0
tags_to_install := user
ifeq ($(user_variant),userdebug)
--- system/core/rootdir/init.rc
+++ system/core/rootdir/init.rc
@@ -116,10 +116,29 @@ loglevel 3
on fs
# mount mtd partitions
# Mount /system rw first to give the filesystem a chance to save a checkpoint
- mount yaffs2 mtd@system /system
- mount yaffs2 mtd@system /system ro remount
- mount yaffs2 mtd@userdata /data nosuid nodev
- mount yaffs2 mtd@cache /cache nosuid nodev
+ mkdir /host_system
+ mount yaffs2 mtd@system /host_system
+ mount yaffs2 mtd@system /host_system ro remount
+ mkdir /host_data 0771 root system
+ mount ext3 /dev/block/mmcblk0p1 /host_data nosuid nodev
+ chown root system /host_data
+ chmod 0771 /host_data
+ chown root system /host_data/guest
+ chmod 0771 /host_data/guest
+# mount yaffs2 mtd@system /system
+ mount ext4 loop@/host_data/guest/system.ext4 /system
+# mount yaffs2 mtd@system /system ro remount
+ mount ext4 loop@/host_data/guest/system.ext4 /system ro remount
+# mount yaffs2 mtd@userdata /data nosuid nodev
+ rmdir /data
+ symlink /host_data/guest/data /data
+ chown system system /host_data/guest/data
+ chmod 0771 /host_data/guest/data
+# mount yaffs2 mtd@cache /cache nosuid nodev
+ rmdir /cache
+ symlink /host_data/guest/cache /cache
+ chown system cache /host_data/guest/cache
+ chmod 0770 /host_data/guest/cache
on post-fs
# once everything is setup, no need to modify /
@@ -357,7 +376,7 @@ on property:ro.debuggable=1
# adbd is controlled via property triggers in init.<platform>.usb.rc
service adbd /sbin/adbd
class core
- disabled
+# disabled
# adbd on at boot in emulator
on property:ro.kernel.qemu=1
--- system/core/rootdir/init.usb.rc
+++ system/core/rootdir/init.usb.rc
@@ -10,11 +10,11 @@ on post-fs-data
chmod 0660 /sys/class/android_usb/android0/f_rndis/ethaddr
# Used to disable USB when switching states
-on property:sys.usb.config=none
- stop adbd
- write /sys/class/android_usb/android0/enable 0
- write /sys/class/android_usb/android0/bDeviceClass 0
- setprop sys.usb.state ${sys.usb.config}
+#on property:sys.usb.config=none
+# stop adbd
+# write /sys/class/android_usb/android0/enable 0
+# write /sys/class/android_usb/android0/bDeviceClass 0
+# setprop sys.usb.state ${sys.usb.config}
# adb only USB configuration
# This should only be used during device bringup
--- hardware/msm7k/Android.mk
+++ hardware/msm7k/Android.mk
@@ -14,9 +14,9 @@
# limitations under the License.
#
-common_msm_dirs := libcopybit liblights libopencorehw librpc libstagefrighthw
+common_msm_dirs := liblights libopencorehw librpc libstagefrighthw
msm7k_dirs := $(common_msm_dirs) boot libgralloc libaudio
-qsd8k_dirs := $(common_msm_dirs) libgralloc-qsd8k libaudio-qsd8k dspcrashd
+qsd8k_dirs := $(common_msm_dirs) dspcrashd
msm7x30_dirs := liblights libgralloc-qsd8k librpc libaudio-qdsp5v2
ifeq ($(TARGET_BOARD_PLATFORM),msm7k)
--- hardware/libhardware/include/hardware/hwcomposer.h
+++ hardware/libhardware/include/hardware/hwcomposer.h
@@ -28,6 +28,8 @@
/*****************************************************************************/
+#define HWC_DEVICE_API_VERSION_0_1 HARDWARE_DEVICE_API_VERSION(0, 1)
+#define HWC_DEVICE_API_VERSION_0_3 HARDWARE_DEVICE_API_VERSION(0, 3)
#define HWC_API_VERSION 1
/**
@@ -132,6 +134,45 @@
HWC_TRANSFORM_ROT_270 = HAL_TRANSFORM_ROT_270,
};
+/* Allowed events for hwc_methods::eventControl() */
+enum {
+ HWC_EVENT_VSYNC = 0
+};
+
+struct hwc_composer_device;
+
+/*
+ * availability: HWC_DEVICE_API_VERSION_0_3
+ *
+ * struct hwc_methods cannot be embedded in other structures as
+ * sizeof(struct hwc_methods) cannot be relied upon.
+ *
+ */
+typedef struct hwc_methods {
+
+ /*************************************************************************
+ * HWC_DEVICE_API_VERSION_0_3
+ *************************************************************************/
+
+ /*
+ * eventControl(..., event, enabled)
+ * Enables or disables h/w composer events.
+ *
+ * eventControl can be called from any thread and takes effect
+ * immediately.
+ *
+ * Supported events are:
+ * HWC_EVENT_VSYNC
+ *
+ * returns -EINVAL if the "event" parameter is not one of the value above
+ * or if the "enabled" parameter is not 0 or 1.
+ */
+
+ int (*eventControl)(
+ struct hwc_composer_device* dev, int event, int enabled);
+
+} hwc_methods_t;
+
typedef struct hwc_rect {
int left;
int top;
@@ -239,6 +280,28 @@
* hooks, unless noted otherwise.
*/
void (*invalidate)(struct hwc_procs* procs);
+
+ /*
+ * (*vsync)() is called by the h/w composer HAL when a vsync event is
+ * received and HWC_EVENT_VSYNC is enabled (see: hwc_event_control).
+ *
+ * the "zero" parameter must always be 0.
+ * the "timestamp" parameter is the system monotonic clock timestamp in
+ * nanosecond of when the vsync event happened.
+ *
+ * vsync() is GUARANTEED TO NOT CALL BACK into the h/w composer HAL.
+ *
+ * It is expected that vsync() is called from a thread of at least
+ * HAL_PRIORITY_URGENT_DISPLAY with as little latency as possible,
+ * typically less than 0.5 ms.
+ *
+ * It is a (silent) error to have HWC_EVENT_VSYNC enabled when calling
+ * hwc_composer_device.set(..., 0, 0, 0) (screen off). The implementation
+ * can either stop or continue to process VSYNC events, but must not
+ * crash or cause other problems.
+ *
+ */
+ void (*vsync)(struct hwc_procs* procs, int zero, int64_t timestamp);
} hwc_procs_t;
@@ -347,7 +410,13 @@
void (*registerProcs)(struct hwc_composer_device* dev,
hwc_procs_t const* procs);
- void* reserved_proc[6];
+ void* reserved_proc[5];
+
+ /*
+ * This field is OPTIONAL and can be NULL.
+ * availability: HWC_DEVICE_API_VERSION_0_3
+ */
+ hwc_methods_t const *methods;
/*
* This API is called by Surfaceflinger to inform the HWC about the
--- hardware/qcom/display/libcopybit/Android.mk
+++ hardware/qcom/display/libcopybit/Android.mk
@@ -32,7 +32,7 @@
include $(BUILD_SHARED_LIBRARY)
else
ifneq ($(call is-chipset-in-board-platform,msm7630),true)
- ifeq ($(call is-board-platform-in-list,$(MSM7K_BOARD_PLATFORMS)),true)
+# ifeq ($(call is-board-platform-in-list,$(MSM7K_BOARD_PLATFORMS)),true)
include $(CLEAR_VARS)
ifeq ($(ARCH_ARM_HAVE_NEON),true)
LOCAL_CFLAGS += -D__ARM_HAVE_NEON
@@ -53,11 +53,9 @@
LOCAL_SRC_FILES := software_converter.cpp copybit.cpp
LOCAL_MODULE := copybit.$(TARGET_BOARD_PLATFORM)
LOCAL_MODULE_TAGS := optional
- LOCAL_C_INCLUDES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include
- LOCAL_ADDITIONAL_DEPENDENCIES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr
LOCAL_C_INCLUDES += hardware/qcom/display/libgralloc
LOCAL_CFLAGS += -DCOPYBIT_MSM7K=1
include $(BUILD_SHARED_LIBRARY)
- endif
+# endif
endif
endif
--- hardware/qcom/display/libgenlock/Android.mk
+++ hardware/qcom/display/libgenlock/Android.mk
@@ -4,9 +4,7 @@
LOCAL_PRELINK_MODULE := false
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)
LOCAL_SHARED_LIBRARIES := liblog libcutils
-LOCAL_C_INCLUDES := $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include
-LOCAL_C_INCLUDES += hardware/qcom/display/libgralloc
-LOCAL_ADDITIONAL_DEPENDENCIES := $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr
+LOCAL_C_INCLUDES := hardware/qcom/display/libgralloc
LOCAL_SRC_FILES := genlock.cpp
LOCAL_CFLAGS:= -DLOG_TAG=\"libgenlock\"
LOCAL_MODULE_TAGS := optional
--- hardware/qcom/display/libgralloc/Android.mk
+++ hardware/qcom/display/libgralloc/Android.mk
@@ -23,9 +23,7 @@
LOCAL_SHARED_LIBRARIES := liblog libcutils libGLESv1_CM libutils libmemalloc
LOCAL_SHARED_LIBRARIES += libgenlock
-LOCAL_C_INCLUDES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include
LOCAL_C_INCLUDES += hardware/qcom/display/libgenlock
-LOCAL_ADDITIONAL_DEPENDENCIES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr
LOCAL_SRC_FILES := framebuffer.cpp \
gpu.cpp \
gralloc.cpp \
@@ -59,8 +57,6 @@
include $(CLEAR_VARS)
LOCAL_PRELINK_MODULE := false
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)
-LOCAL_C_INCLUDES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include
-LOCAL_ADDITIONAL_DEPENDENCIES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr
LOCAL_SHARED_LIBRARIES := liblog libcutils libutils
LOCAL_SRC_FILES := ionalloc.cpp \
ashmemalloc.cpp \
--- hardware/qcom/display/libhwcomposer/Android.mk
+++ hardware/qcom/display/libhwcomposer/Android.mk
@@ -19,9 +19,7 @@
LOCAL_C_INCLUDES += hardware/qcom/display/libcopybit
LOCAL_C_INCLUDES += hardware/qcom/display/libgenlock
LOCAL_C_INCLUDES += hardware/qcom/display/libqcomui
-LOCAL_C_INCLUDES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include
-LOCAL_ADDITIONAL_DEPENDENCIES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr
ifeq ($(TARGET_HAVE_HDMI_OUT),true)
LOCAL_CFLAGS += -DHDMI_DUAL_DISPLAY
endif
--- hardware/qcom/display/liboverlay/Android.mk
+++ hardware/qcom/display/liboverlay/Android.mk
@@ -19,8 +19,6 @@
LOCAL_PRELINK_MODULE := false
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)
LOCAL_SHARED_LIBRARIES := liblog libcutils libutils libmemalloc
-LOCAL_C_INCLUDES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include
-LOCAL_ADDITIONAL_DEPENDENCIES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr
LOCAL_C_INCLUDES += hardware/qcom/display/libgralloc
LOCAL_SRC_FILES := \
overlayLib.cpp \
--- hardware/qcom/display/libgralloc/ionalloc.cpp
+++ hardware/qcom/display/libgralloc/ionalloc.cpp
@@ -83,7 +83,8 @@
if(data.uncached) {
// Use the sync FD to alloc and map
// when we need uncached memory
- ionSyncFd = open(ION_DEVICE, O_RDONLY|O_DSYNC);
+// ionSyncFd = open(ION_DEVICE, O_RDONLY|O_DSYNC);
+ ionSyncFd = open(ION_DEVICE, O_RDONLY);
if(ionSyncFd < 0) {
ALOGE("%s: Failed to open ion device - %s",
__FUNCTION__, strerror(errno));
--- hardware/qcom/display/libgralloc/pmem_bestfit_alloc.cpp
+++ hardware/qcom/display/libgralloc/pmem_bestfit_alloc.cpp
@@ -125,6 +125,7 @@
}
return (free_chunk->start)*kMemoryAlign;
}
+/*
// we are out of PMEM. Print pmem stats
// check if there is any leak or fragmentation
@@ -155,6 +156,7 @@
allocated = 0;
free_space = 0;
ALOGD ("----------------------------------------------");
+*/
return -ENOMEM;
}
--- hardware/qcom/display/libhwcomposer/hwcomposer.cpp
+++ hardware/qcom/display/libhwcomposer/hwcomposer.cpp
@@ -35,7 +35,6 @@
#include <EGL/egl.h>
#include <EGL/eglext.h>
-#include <ui/android_native_buffer.h>
#include <gralloc_priv.h>
#include <genlock.h>
#include <qcom_ui.h>
--- hardware/qcom/display/libtilerenderer/tilerenderer.cpp
+++ hardware/qcom/display/libtilerenderer/tilerenderer.cpp
@@ -17,7 +17,7 @@
#include <GLES2/gl2.h>
#include <EGL/egl.h>
-#include <gl2ext.h>
+#include <GLES2/gl2ext.h>
#include <OpenGLRenderer.h>
#include "tilerenderer.h"
--- frameworks/native/include/gui/IGraphicBufferAlloc.h
+++ frameworks/native/include/gui/IGraphicBufferAlloc.h
@@ -38,6 +38,15 @@ public:
*/
virtual sp<GraphicBuffer> createGraphicBuffer(uint32_t w, uint32_t h,
PixelFormat format, uint32_t usage, status_t* error) = 0;
+
+ /* Free all but one of the GraphicBuffer objects that the server is
+ * currently referencing. If bufIndex is not a valid index of the buffers
+ * the server is referencing, then all buffers are freed.
+ */
+ virtual void freeAllGraphicBuffersExcept(int bufIndex) = 0;
+
+ /* Free the GraphicBuffer at the specified index */
+ virtual void freeGraphicBufferAtIndex(int bufIndex) = 0;
};
// ----------------------------------------------------------------------------
--- frameworks/native/libs/gui/IGraphicBufferAlloc.cpp
+++ frameworks/native/libs/gui/IGraphicBufferAlloc.cpp
@@ -32,6 +32,8 @@ namespace android {
enum {
CREATE_GRAPHIC_BUFFER = IBinder::FIRST_CALL_TRANSACTION,
+ FREE_ALL_GRAPHIC_BUFFERS_EXCEPT,
+ FREE_GRAPHIC_BUFFER_AT_INDEX,
};
class BpGraphicBufferAlloc : public BpInterface<IGraphicBufferAlloc>
@@ -63,6 +65,22 @@ public:
*error = result;
return graphicBuffer;
}
+
+ virtual void freeAllGraphicBuffersExcept(int bufIdx) {
+ Parcel data, reply;
+ data.writeInterfaceToken(
+ IGraphicBufferAlloc::getInterfaceDescriptor());
+ data.writeInt32(bufIdx);
+ remote()->transact(FREE_ALL_GRAPHIC_BUFFERS_EXCEPT, data, &reply);
+ }
+
+ virtual void freeGraphicBufferAtIndex(int bufIdx) {
+ Parcel data, reply;
+ data.writeInterfaceToken(
+ IGraphicBufferAlloc::getInterfaceDescriptor());
+ data.writeInt32(bufIdx);
+ remote()->transact(FREE_GRAPHIC_BUFFER_AT_INDEX, data, &reply);
+ }
};
IMPLEMENT_META_INTERFACE(GraphicBufferAlloc, "android.ui.IGraphicBufferAlloc");
--- frameworks/native/services/surfaceflinger/SurfaceFlinger.h
+++ frameworks/native/services/surfaceflinger/SurfaceFlinger.h
@@ -98,6 +98,12 @@ public:
virtual ~GraphicBufferAlloc();
virtual sp<GraphicBuffer> createGraphicBuffer(uint32_t w, uint32_t h,
PixelFormat format, uint32_t usage, status_t* error);
+ virtual void freeAllGraphicBuffersExcept(int bufIdx);
+ virtual void freeGraphicBufferAtIndex(int bufIdx);
+private:
+ Vector<sp<GraphicBuffer> > mBuffers;
+ Mutex mLock;
+ int mFreedIndex;
};
// ---------------------------------------------------------------------------
--- frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
+++ frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
@@ -2635,7 +2635,9 @@ status_t Client::destroySurface(SurfaceID sid) {
// ---------------------------------------------------------------------------
-GraphicBufferAlloc::GraphicBufferAlloc() {}
+GraphicBufferAlloc::GraphicBufferAlloc() {
+ mFreedIndex = -1;
+}
GraphicBufferAlloc::~GraphicBufferAlloc() {}
@@ -2653,9 +2655,38 @@ sp<GraphicBuffer> GraphicBufferAlloc::createGraphicBuffer(uint32_t w, uint32_t h
w, h, strerror(-err), graphicBuffer->handle);
return 0;
}
+ Mutex::Autolock _l(mLock);
+ if (-1 != mFreedIndex) {
+ mBuffers.insertAt(graphicBuffer, mFreedIndex);
+ mFreedIndex = -1;
+ } else {
+ mBuffers.add(graphicBuffer);
+ }
return graphicBuffer;
}
+void GraphicBufferAlloc::freeAllGraphicBuffersExcept(int bufIdx) {
+ Mutex::Autolock _l(mLock);
+ if (0 <= bufIdx && bufIdx < mBuffers.size()) {
+ sp<GraphicBuffer> b(mBuffers[bufIdx]);
+ mBuffers.clear();
+ mBuffers.add(b);
+ } else {
+ mBuffers.clear();
+ }
+ mFreedIndex = -1;
+}
+
+void GraphicBufferAlloc::freeGraphicBufferAtIndex(int bufIdx) {
+ Mutex::Autolock _l(mLock);
+ if (0 <= bufIdx && bufIdx < mBuffers.size()) {
+ mBuffers.removeItemsAt(bufIdx);
+ mFreedIndex = bufIdx;
+ } else {
+ mFreedIndex = -1;
+ }
+}
+
// ---------------------------------------------------------------------------
GraphicPlane::GraphicPlane()
--- frameworks/native/opengl/include/EGL/eglext.h
+++ frameworks/native/opengl/include/EGL/eglext.h
@@ -229,6 +229,26 @@ struct ANativeWindowBuffer;
#define EGL_NATIVE_BUFFER_ANDROID 0x3140 /* eglCreateImageKHR target */
#endif
+#ifndef EGL_EGLEXT_PROTOTYPES
+#define EGL_EGLEXT_PROTOTYPES 1
+#endif
+
+#ifndef EGL_ANDROID_get_render_buffer
+#define EGL_ANDROID_get_render_buffer 1
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLClientBuffer EGLAPIENTRY eglGetRenderBufferANDROID(EGLDisplay dpy, EGLSurface draw);
+#endif
+typedef EGLClientBuffer (EGLAPIENTRYP PFNEGLGETRENDERBUFFERANDROIDPROC) (EGLDisplay dpy, EGLSurface draw);
+#endif
+
+#ifndef EGL_ANDROID_swap_rectangle
+#define EGL_ANDROID_swap_rectangle 1
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglSetSwapRectangleANDROID (EGLDisplay dpy, EGLSurface draw, EGLint left, EGLint top, EGLint width, EGLint height);
+#endif /* EGL_EGLEXT_PROTOTYPES */
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSETSWAPRECTANGLEANDROIDPROC) (EGLDisplay dpy, EGLSurface draw, EGLint left, EGLint top, EGLint width, EGLint height);
+#endif
+
#ifndef EGL_ANDROID_recordable
#define EGL_ANDROID_recordable 1
#define EGL_RECORDABLE_ANDROID 0x3142 /* EGLConfig attribute */
--- frameworks/native/opengl/include/GLES2/gl2ext.h
+++ frameworks/native/opengl/include/GLES2/gl2ext.h
@@ -16,6 +16,8 @@ extern "C" {
# define GL_APIENTRYP GL_APIENTRY*
#endif
+#define GL_GLEXT_PROTOTYPES
+
/*------------------------------------------------------------------------*
* OES extension tokens
*------------------------------------------------------------------------*/
--- frameworks/native/opengl/libagl/egl.cpp
+++ frameworks/native/opengl/libagl/egl.cpp
@@ -165,6 +165,7 @@ struct egl_surface_t
virtual EGLint getSwapBehavior() const;
virtual EGLBoolean swapBuffers();
virtual EGLBoolean setSwapRectangle(EGLint l, EGLint t, EGLint w, EGLint h);
+ virtual EGLClientBuffer getRenderBuffer() const;
protected:
GGLSurface depth;
};
@@ -208,6 +209,9 @@ EGLBoolean egl_surface_t::setSwapRectangle(
{
return EGL_FALSE;
}
+EGLClientBuffer egl_surface_t::getRenderBuffer() const {
+ return 0;
+}
// ----------------------------------------------------------------------------
@@ -233,6 +237,7 @@ struct egl_window_surface_v2_t : public egl_surface_t
virtual EGLint getRefreshRate() const;
virtual EGLint getSwapBehavior() const;
virtual EGLBoolean setSwapRectangle(EGLint l, EGLint t, EGLint w, EGLint h);
+ virtual EGLClientBuffer getRenderBuffer() const;
private:
status_t lock(ANativeWindowBuffer* buf, int usage, void** vaddr);
@@ -571,6 +576,11 @@ EGLBoolean egl_window_surface_v2_t::setSwapRectangle(
return EGL_TRUE;
}
+EGLClientBuffer egl_window_surface_v2_t::getRenderBuffer() const
+{
+ return buffer;
+}
+
EGLBoolean egl_window_surface_v2_t::bindDrawSurface(ogles_context_t* gl)
{
GGLSurface buffer;
@@ -801,6 +811,7 @@ static char const * const gExtensionsString =
// "KHR_image_pixmap "
"EGL_ANDROID_image_native_buffer "
"EGL_ANDROID_swap_rectangle "
+ "EGL_ANDROID_get_render_buffer "
;
// ----------------------------------------------------------------------------
@@ -861,6 +872,8 @@ static const extention_map_t gExtentionMap[] = {
(__eglMustCastToProperFunctionPointerType)&eglGetSyncAttribKHR },
{ "eglSetSwapRectangleANDROID",
(__eglMustCastToProperFunctionPointerType)&eglSetSwapRectangleANDROID },
+ { "eglGetRenderBufferANDROID",
+ (__eglMustCastToProperFunctionPointerType)&eglGetRenderBufferANDROID },
};
/*
@@ -2154,3 +2167,18 @@ EGLBoolean eglSetSwapRectangleANDROID(EGLDisplay dpy, EGLSurface draw,
return EGL_TRUE;
}
+
+EGLClientBuffer eglGetRenderBufferANDROID(EGLDisplay dpy, EGLSurface draw)
+{
+ if (egl_display_t::is_valid(dpy) == EGL_FALSE)
+ return setError(EGL_BAD_DISPLAY, (EGLClientBuffer)0);
+
+ egl_surface_t* d = static_cast<egl_surface_t*>(draw);
+ if (!d->isValid())
+ return setError(EGL_BAD_SURFACE, (EGLClientBuffer)0);
+ if (d->dpy != dpy)
+ return setError(EGL_BAD_DISPLAY, (EGLClientBuffer)0);
+
+ // post the surface
+ return d->getRenderBuffer();
+}
--- frameworks/native/opengl/libs/EGL/eglApi.cpp
+++ frameworks/native/opengl/libs/EGL/eglApi.cpp
@@ -70,6 +70,10 @@ static const extention_map_t sExtentionMap[] = {
(__eglMustCastToProperFunctionPointerType)&eglCreateImageKHR },
{ "eglDestroyImageKHR",
(__eglMustCastToProperFunctionPointerType)&eglDestroyImageKHR },
+ { "eglSetSwapRectangleANDROID",
+ (__eglMustCastToProperFunctionPointerType)&eglSetSwapRectangleANDROID },
+ { "eglGetRenderBufferANDROID",
+ (__eglMustCastToProperFunctionPointerType)&eglGetRenderBufferANDROID },
{ "eglGetSystemTimeFrequencyNV",
(__eglMustCastToProperFunctionPointerType)&eglGetSystemTimeFrequencyNV },
{ "eglGetSystemTimeNV",
@@ -1191,6 +1195,43 @@ EGLBoolean eglGetSyncAttribKHR(EGLDisplay dpy, EGLSyncKHR sync,
// ----------------------------------------------------------------------------
/* ANDROID extensions entry-point go here */
+EGLBoolean eglSetSwapRectangleANDROID(EGLDisplay dpy, EGLSurface draw,
+ EGLint left, EGLint top, EGLint width, EGLint height)
+{
+ clearError();
+
+ const egl_display_ptr dp = validate_display(dpy);
+ if (!dp) return EGL_FALSE;
+
+ SurfaceRef _s(dp.get(), draw);
+ if (!_s.get())
+ return setError(EGL_BAD_SURFACE, EGL_FALSE);
+
+ egl_surface_t const * const s = get_surface(draw);
+ if (s->cnx->egl.eglSetSwapRectangleANDROID) {
+ return s->cnx->egl.eglSetSwapRectangleANDROID(
+ dp->disp.dpy, s->surface, left, top, width, height);
+ }
+ return setError(EGL_BAD_DISPLAY, NULL);
+}
+
+EGLClientBuffer eglGetRenderBufferANDROID(EGLDisplay dpy, EGLSurface draw)
+{
+ clearError();
+
+ const egl_display_ptr dp = validate_display(dpy);
+ if (!dp) return EGL_FALSE;
+
+ SurfaceRef _s(dp.get(), draw);
+ if (!_s.get()) return setError(EGL_BAD_SURFACE, (EGLClientBuffer*)0);
+
+ egl_surface_t const * const s = get_surface(draw);
+ if (s->cnx->egl.eglGetRenderBufferANDROID) {
+ return s->cnx->egl.eglGetRenderBufferANDROID(
+ dp->disp.dpy, s->surface);
+ }
+ return setError(EGL_BAD_DISPLAY, (EGLClientBuffer*)0);
+}
// ----------------------------------------------------------------------------
// NVIDIA extensions
--- frameworks/base/libs/hwui/OpenGLRenderer.h
+++ frameworks/base/libs/hwui/OpenGLRenderer.h
@@ -66,6 +66,7 @@ public:
virtual bool isDeferred();
virtual void setViewport(int width, int height);
+ ANDROID_API void getViewport(int &width, int &height);
ANDROID_API int prepare(bool opaque);
virtual int prepareDirty(float left, float top, float right, float bottom, bool opaque);
--- frameworks/base/libs/hwui/OpenGLRenderer.cpp
+++ frameworks/base/libs/hwui/OpenGLRenderer.cpp
@@ -164,6 +164,11 @@ void OpenGLRenderer::setViewport(int width, int height) {
glEnableVertexAttribArray(Program::kBindingPosition);
}
+void OpenGLRenderer::getViewport(int &width, int &height) {
+ width = mWidth;
+ height = mHeight;
+}
+
int OpenGLRenderer::prepare(bool opaque) {
return prepareDirty(0.0f, 0.0f, mWidth, mHeight, opaque);
}
--- frameworks/native/include/gui/SurfaceTexture.h
+++ frameworks/native/include/gui/SurfaceTexture.h
@@ -89,7 +89,7 @@ public:
//
// This call may only be made while the OpenGL ES context to which the
// target texture belongs is bound to the calling thread.
- status_t updateTexImage();
+ status_t updateTexImage(bool isComposition = false);
// setBufferCountServer set the buffer count. If the client has requested
// a buffer count using setBufferCount, the server-buffer count will
@@ -248,7 +248,7 @@ private:
virtual ~BufferRejecter() { }
};
friend class Layer;
- status_t updateTexImage(BufferRejecter* rejecter);
+ status_t updateTexImage(BufferRejecter* rejecter, bool isComposition = false);
// createImage creates a new EGLImage from a GraphicBuffer.
EGLImageKHR createImage(EGLDisplay dpy,
@@ -329,7 +329,7 @@ private:
// glCopyTexSubImage to read from the texture. This is a hack to work
// around a GL driver limitation on the number of FBO attachments, which the
// browser's tile cache exceeds.
- const GLenum mTexTarget;
+ GLenum mTexTarget;
// EGLSlot contains the information and object references that
// SurfaceTexture maintains about a BufferQueue buffer slot.
--- frameworks/native/libs/gui/SurfaceTexture.cpp
+++ frameworks/native/libs/gui/SurfaceTexture.cpp
@@ -175,11 +175,31 @@ status_t SurfaceTexture::setDefaultBufferSize(uint32_t w, uint32_t h)
return mBufferQueue->setDefaultBufferSize(w, h);
}
-status_t SurfaceTexture::updateTexImage() {
- return SurfaceTexture::updateTexImage(NULL);
+status_t SurfaceTexture::updateTexImage(bool isComposition) {
+ return SurfaceTexture::updateTexImage(NULL, isComposition);
}
-status_t SurfaceTexture::updateTexImage(BufferRejecter* rejecter) {
+int decideTextureTarget(int pixel_format)
+{
+ int retVal;
+ switch (pixel_format) {
+ case HAL_PIXEL_FORMAT_RGBA_8888:
+ case HAL_PIXEL_FORMAT_RGBX_8888:
+ case HAL_PIXEL_FORMAT_RGB_888:
+ case HAL_PIXEL_FORMAT_RGB_565:
+ case HAL_PIXEL_FORMAT_BGRA_8888:
+ case HAL_PIXEL_FORMAT_RGBA_5551:
+ case HAL_PIXEL_FORMAT_RGBA_4444:
+ retVal = GL_TEXTURE_2D;
+ break;
+ default:
+ retVal = GL_TEXTURE_EXTERNAL_OES;
+ break;
+ }
+ return retVal;
+}
+
+status_t SurfaceTexture::updateTexImage(BufferRejecter* rejecter, bool isComposition) {
ATRACE_CALL();
ST_LOGV("updateTexImage");
Mutex::Autolock lock(mMutex);
@@ -253,6 +273,9 @@ status_t SurfaceTexture::updateTexImage(BufferRejecter* rejecter) {
} else {
image = createImage(dpy, mEGLSlots[buf].mGraphicBuffer);
mEGLSlots[buf].mEglImage = image;
+ if (isComposition) {
+ mTexTarget = decideTextureTarget(mEGLSlots[buf].mGraphicBuffer->format);
+ }
if (image == EGL_NO_IMAGE_KHR) {
// NOTE: if dpy was invalid, createImage() is guaranteed to
// fail. so we'd end up here.
--- frameworks/native/services/surfaceflinger/Layer.cpp
+++ frameworks/native/services/surfaceflinger/Layer.cpp
@@ -345,6 +345,7 @@ void Layer::onDraw(const Region& clip) const
return;
}
+ GLuint currentTextureTarget = mSurfaceTexture->getCurrentTextureTarget();
if (!isProtected()) {
// TODO: we could be more subtle with isFixedSize()
const bool useFiltering = getFiltering() || needsFiltering() || isFixedSize();
@@ -355,31 +356,35 @@ void Layer::onDraw(const Region& clip) const
mSurfaceTexture->getTransformMatrix(textureMatrix);
// Set things up for texturing.
- glBindTexture(GL_TEXTURE_EXTERNAL_OES, mTextureName);
+ glBindTexture(currentTextureTarget, mTextureName);
GLenum filter = GL_NEAREST;
if (useFiltering) {
filter = GL_LINEAR;
}
- glTexParameterx(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MAG_FILTER, filter);
- glTexParameterx(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MIN_FILTER, filter);
+ glTexParameterx(currentTextureTarget, GL_TEXTURE_MAG_FILTER, filter);
+ glTexParameterx(currentTextureTarget, GL_TEXTURE_MIN_FILTER, filter);
glMatrixMode(GL_TEXTURE);
glLoadMatrixf(textureMatrix);
glMatrixMode(GL_MODELVIEW);
+ glDisable(GL_TEXTURE_EXTERNAL_OES);
glDisable(GL_TEXTURE_2D);
- glEnable(GL_TEXTURE_EXTERNAL_OES);
+ glEnable(currentTextureTarget);
} else {
- glBindTexture(GL_TEXTURE_2D, mFlinger->getProtectedTexName());
+ glBindTexture(currentTextureTarget, mFlinger->getProtectedTexName());
glMatrixMode(GL_TEXTURE);
glLoadIdentity();
glMatrixMode(GL_MODELVIEW);
glDisable(GL_TEXTURE_EXTERNAL_OES);
- glEnable(GL_TEXTURE_2D);
+ glDisable(GL_TEXTURE_2D);
+ glEnable(currentTextureTarget);
}
+ glEnable(GL_DITHER);
drawWithOpenGL(clip);
glDisable(GL_TEXTURE_EXTERNAL_OES);
glDisable(GL_TEXTURE_2D);
+ glDisable(GL_DITHER);
}
// As documented in libhardware header, formats in the range
@@ -624,7 +629,7 @@ void Layer::lockPageFlip(bool& recomputeVisibleRegions)
Reject r(mDrawingState, currentState(), recomputeVisibleRegions);
- if (mSurfaceTexture->updateTexImage(&r) < NO_ERROR) {
+ if (mSurfaceTexture->updateTexImage(&r, true) < NO_ERROR) {
// something happened!
recomputeVisibleRegions = true;
return;
--- frameworks/native/services/surfaceflinger/DisplayHardware/HWComposer.cpp
+++ frameworks/native/services/surfaceflinger/DisplayHardware/HWComposer.cpp
@@ -298,7 +298,7 @@ bool HWComposer::VSyncThread::threadLoop() {
}
}
- const nsecs_t period = mRefreshPeriod;
+ const nsecs_t period = mRefreshPeriod * 2;
const nsecs_t now = systemTime(CLOCK_MONOTONIC);
nsecs_t next_vsync = mNextFakeVSync;
nsecs_t sleep = next_vsync - now;
--- frameworks/av/media/libstagefright/AwesomePlayer.cpp
+++ frameworks/av/media/libstagefright/AwesomePlayer.cpp
@@ -1103,6 +1103,7 @@ void AwesomePlayer::initRenderer_l() {
if (USE_SURFACE_ALLOC
&& !strncmp(component, "OMX.", 4)
&& strncmp(component, "OMX.google.", 11)
+ && strncmp(component, "OMX.qcom.video.decoder.", 23)
&& strcmp(component, "OMX.Nvidia.mpeg2v.decode")) {
// Hardware decoders avoid the CPU color conversion by decoding
// directly to ANativeBuffers, so we must use a renderer that
--- frameworks/av/media/libstagefright/OMXCodec.cpp
+++ frameworks/av/media/libstagefright/OMXCodec.cpp
@@ -245,6 +245,7 @@ uint32_t OMXCodec::getComponentQuirks(
if (list->codecHasQuirk(
index, "requires-allocate-on-output-ports")) {
quirks |= kRequiresAllocateBufferOnOutputPorts;
+ quirks |= kDefersOutputBufferAllocation;
}
if (list->codecHasQuirk(
index, "output-buffers-are-unreadable")) {
@@ -1317,6 +1318,7 @@ OMXCodec::OMXCodec(
mPaused(false),
mNativeWindow(
(!strncmp(componentName, "OMX.google.", 11)
+ || !strncmp(componentName, "OMX.qcom.video.decoder.", 23)
|| !strcmp(componentName, "OMX.Nvidia.mpeg2v.decode"))
? NULL : nativeWindow) {
mPortStatus[kPortIndexInput] = ENABLED;
@@ -1532,6 +1534,10 @@ status_t OMXCodec::allocateBuffersOnPort(OMX_U32 portIndex) {
if (mOMXLivesLocally) {
mem.clear();
+ if (!strncmp(mComponentName, "OMX.qcom.video.decoder.", 23))
+ if (def.nBufferSize < (OMX_U32)353280)
+ def.nBufferSize = (OMX_U32)353280;
+
err = mOMX->allocateBuffer(
mNode, portIndex, def.nBufferSize, &buffer,
&info.mData);
@@ -2164,6 +2170,10 @@ void OMXCodec::on_message(const omx_message &msg) {
CHECK(mQuirks & kRequiresAllocateBufferOnOutputPorts);
CHECK(mQuirks & kDefersOutputBufferAllocation);
+ if (!strncmp(mComponentName, "OMX.qcom.video.decoder.", 23))
+ if (info->mSize < (OMX_U32)353280)
+ info->mSize = (OMX_U32)353280;
+
// The qcom video decoders on Nexus don't actually allocate
// output buffer memory on a call to OMX_AllocateBuffer
// the "pBuffer" member of the OMX_BUFFERHEADERTYPE
--- frameworks/av/media/libstagefright/colorconversion/SoftwareRenderer.cpp
+++ frameworks/av/media/libstagefright/colorconversion/SoftwareRenderer.cpp
@@ -61,7 +61,7 @@ SoftwareRenderer::SoftwareRenderer(
rotationDegrees = 0;
}
- int halFormat;
+ int halFormat, minUndequeuedBufs = 0;
size_t bufWidth, bufHeight;
switch (mColorFormat) {
@@ -95,6 +95,14 @@ SoftwareRenderer::SoftwareRenderer(
CHECK(mConverter == NULL || mConverter->isValid());
CHECK_EQ(0,
+ mNativeWindow->query(
+ mNativeWindow.get(),
+ NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS, &minUndequeuedBufs));
+ CHECK_EQ(0,
+ native_window_set_buffer_count(
+ mNativeWindow.get(),
+ minUndequeuedBufs + 1));
+ CHECK_EQ(0,
native_window_set_usage(
mNativeWindow.get(),
GRALLOC_USAGE_SW_READ_NEVER | GRALLOC_USAGE_SW_WRITE_OFTEN
--- frameworks/av/media/libstagefright/colorconversion/ColorConverter.cpp
+++ frameworks/av/media/libstagefright/colorconversion/ColorConverter.cpp
@@ -21,6 +21,7 @@
#include <media/stagefright/foundation/ADebug.h>
#include <media/stagefright/ColorConverter.h>
#include <media/stagefright/MediaErrors.h>
+#include <arm_neon.h>
namespace android {
@@ -307,9 +308,11 @@ status_t ColorConverter::convertQCOMYUV420SemiPlanar(
(const uint8_t *)src.mBits + src.mCropTop * src.mWidth + src.mCropLeft;
const uint8_t *src_u =
- (const uint8_t *)src_y + src.mWidth * src.mHeight
+ (const uint8_t *)src_y + src.mWidth * ((src.mHeight & 15)
+ ? ((src.mHeight & ~15) + 16) : src.mHeight)
+ src.mCropTop * src.mWidth + src.mCropLeft;
+ if (src.cropWidth() & 7) {
for (size_t y = 0; y < src.cropHeight(); ++y) {
for (size_t x = 0; x < src.cropWidth(); x += 2) {
signed y1 = (signed)src_y[x] - 16;
@@ -358,6 +361,58 @@ status_t ColorConverter::convertQCOMYUV420SemiPlanar(
dst_ptr += dst.mWidth;
}
+ } else {
+ const int16_t UV_SUBS[8] = {128, 128, 128, 128, 128, 128, 128, 128};
+ const int16_t Y_SUBS[8] = {16, 16, 16, 16, 16, 16, 16, 16};
+ int16x8_t UV_SUBvec = vld1q_s16(UV_SUBS);
+ int16x8_t Y_SUBvec = vld1q_s16(Y_SUBS);
+ for (size_t y = 0; y < src.cropHeight(); ++y) {
+ for (size_t x = 0; x < src.cropWidth(); x += 8) {
+ uint8x8_t UVvec8 = vld1_u8(src_u + x);
+ uint8x8_t Yvec8 = vld1_u8(src_y + x);
+ int16x8_t UVvec16 = vsubq_s16((int16x8_t)vmovl_u8(UVvec8), UV_SUBvec);
+ int16x8_t Yvec16 = vsubq_s16((int16x8_t)vmovl_u8(Yvec8), Y_SUBvec);
+ int16x4_t UVvec16_low = vget_low_s16(UVvec16);
+ int16x4_t UVvec16_high = vget_high_s16(UVvec16);
+ int16x4_t Yvec16_low = vget_low_s16(Yvec16);
+ int16x4_t Yvec16_high = vget_high_s16(Yvec16);
+ int32x4_t UVvec32_low = vmovl_s16(UVvec16_low);
+ int32x4_t UVvec32_high = vmovl_s16(UVvec16_high);
+ int32x4_t Yvec32_low = vmull_n_s16(Yvec16_low, 298);
+ int32x4_t Yvec32_high = vmull_n_s16(Yvec16_high, 298);
+ int32x4x2_t UVuzp32 = vuzpq_s32(UVvec32_low, UVvec32_high);
+ int32x2_t U32_low = vget_low_s32(UVuzp32.val[0]);
+ int32x2_t U32_high = vget_high_s32(UVuzp32.val[0]);
+ int32x2x2_t Uvec32_low_ = vzip_s32(U32_low, U32_low);
+ int32x4_t* Uvec32_low = (int32x4_t*)(&Uvec32_low_);
+ int32x2x2_t Uvec32_high_ = vzip_s32(U32_high, U32_high);
+ int32x4_t* Uvec32_high = (int32x4_t*)(&Uvec32_high_);
+ int32x2_t V32_low = vget_low_s32(UVuzp32.val[1]);
+ int32x2_t V32_high = vget_high_s32(UVuzp32.val[1]);
+ int32x2x2_t Vvec32_low_ = vzip_s32(V32_low, V32_low);
+ int32x4_t* Vvec32_low = (int32x4_t*)(&Vvec32_low_);
+ int32x2x2_t Vvec32_high_ = vzip_s32(V32_high, V32_high);
+ int32x4_t* Vvec32_high = (int32x4_t*)(&Vvec32_high_);
+ int32x4_t Bvec32_low = vmlaq_n_s32(Yvec32_low, *Uvec32_low, 517);
+ int32x4_t Bvec32_high = vmlaq_n_s32(Yvec32_high, *Uvec32_high, 517);
+ int32x4_t Gvec32_low = vsubq_s32(Yvec32_low, vmlaq_n_s32(vmulq_n_s32(*Vvec32_low, 208), *Uvec32_low, 100));
+ int32x4_t Gvec32_high = vsubq_s32(Yvec32_high, vmlaq_n_s32(vmulq_n_s32(*Vvec32_high, 208), *Uvec32_high, 100));
+ int32x4_t Rvec32_low = vmlaq_n_s32(Yvec32_low, *Vvec32_low, 409);
+ int32x4_t Rvec32_high = vmlaq_n_s32(Yvec32_high, *Vvec32_high, 409);
+ uint16x8_t Bvec16 = vcombine_u16(vqmovun_s32(Bvec32_low), vqmovun_s32(Bvec32_high));
+ uint16x8_t Gvec16 = vcombine_u16(vqmovun_s32(Gvec32_low), vqmovun_s32(Gvec32_high));
+ uint16x8_t Rvec16 = vcombine_u16(vqmovun_s32(Rvec32_low), vqmovun_s32(Rvec32_high));
+ Bvec16 = vsriq_n_u16(Bvec16, Gvec16, 5);
+ Bvec16 = vsriq_n_u16(Bvec16, Rvec16, 11);
+ vst1q_u16(((uint16_t *)dst_ptr) + x, Bvec16);
+ }
+ src_y += src.mWidth;
+ if (y & 1) {
+ src_u += src.mWidth;
+ }
+ dst_ptr += dst.mWidth;
+ }
+ }
return OK;
}
--- frameworks/native/include/binder/Binder.h
+++ frameworks/native/include/binder/Binder.h
@@ -27,7 +27,11 @@ class BBinder : public IBinder
public:
BBinder();
+#ifndef LIBBINDER_DECKARD
virtual const String16& getInterfaceDescriptor() const;
+#else
+ virtual String16 getInterfaceDescriptor() const;
+#endif
virtual bool isBinderAlive() const;
virtual status_t pingBinder();
virtual status_t dump(int fd, const Vector<String16>& args);
--- frameworks/native/include/binder/BpBinder.h
+++ frameworks/native/include/binder/BpBinder.h
@@ -31,7 +31,11 @@ public:
inline int32_t handle() const { return mHandle; }
+#ifndef LIBBINDER_DECKARD
virtual const String16& getInterfaceDescriptor() const;
+#else
+ virtual String16 getInterfaceDescriptor() const;
+#endif
virtual bool isBinderAlive() const;
virtual status_t pingBinder();
virtual status_t dump(int fd, const Vector<String16>& args);
--- frameworks/native/include/binder/IBinder.h
+++ frameworks/native/include/binder/IBinder.h
@@ -57,7 +57,11 @@ public:
FLAG_ONEWAY = 0x00000001
};
+#ifndef LIBBINDER_DECKARD
IBinder();
+#else
+ inline IBinder() { }
+#endif
/**
* Check if this IBinder implements the interface named by
@@ -70,7 +74,11 @@ public:
* Return the canonical name of the interface provided by this IBinder
* object.
*/
+#ifndef LIBBINDER_DECKARD
virtual const String16& getInterfaceDescriptor() const = 0;
+#else
+ virtual String16 getInterfaceDescriptor() const = 0;
+#endif
virtual bool isBinderAlive() const = 0;
virtual status_t pingBinder() = 0;
@@ -148,7 +156,11 @@ public:
virtual BpBinder* remoteBinder();
protected:
+#ifndef LIBBINDER_DECKARD
virtual ~IBinder();
+#else
+ inline virtual ~IBinder() { }
+#endif
private:
};
--- frameworks/native/include/binder/IInterface.h
+++ frameworks/native/include/binder/IInterface.h
@@ -27,12 +27,16 @@ namespace android {
class IInterface : public virtual RefBase
{
public:
+#ifndef LIBBINDER_DECKARD
IInterface();
+#endif
sp<IBinder> asBinder();
sp<const IBinder> asBinder() const;
protected:
+#ifndef LIBBINDER_DECKARD
virtual ~IInterface();
+#endif
virtual IBinder* onAsBinder() = 0;
};
@@ -51,7 +55,11 @@ class BnInterface : public INTERFACE, public BBinder
{
public:
virtual sp<IInterface> queryLocalInterface(const String16& _descriptor);
+#ifndef LIBBINDER_DECKARD
virtual const String16& getInterfaceDescriptor() const;
+#else
+ virtual String16 getInterfaceDescriptor() const;
+#endif
protected:
virtual IBinder* onAsBinder();
@@ -71,6 +79,7 @@ protected:
// ----------------------------------------------------------------------
+#ifndef LIBBINDER_DECKARD
#define DECLARE_META_INTERFACE(INTERFACE) \
static const android::String16 descriptor; \
static android::sp<I##INTERFACE> asInterface( \
@@ -79,7 +88,16 @@ protected:
I##INTERFACE(); \
virtual ~I##INTERFACE(); \
+#else
+#define DECLARE_META_INTERFACE(INTERFACE) \
+ static const android::String16 descriptor; \
+ static android::sp<I##INTERFACE> asInterface( \
+ const android::sp<android::IBinder>& obj); \
+ virtual android::String16 getInterfaceDescriptor() const; \
+
+#endif
+#ifndef LIBBINDER_DECKARD
#define IMPLEMENT_META_INTERFACE(INTERFACE, NAME) \
const android::String16 I##INTERFACE::descriptor(NAME); \
const android::String16& \
@@ -103,6 +121,28 @@ protected:
I##INTERFACE::I##INTERFACE() { } \
I##INTERFACE::~I##INTERFACE() { } \
+#else
+#define IMPLEMENT_META_INTERFACE(INTERFACE, NAME) \
+ const android::String16 I##INTERFACE::descriptor(NAME); \
+ String16 I##INTERFACE::getInterfaceDescriptor() const { \
+ return I##INTERFACE::descriptor; \
+ } \
+ android::sp<I##INTERFACE> I##INTERFACE::asInterface( \
+ const android::sp<android::IBinder>& obj) \
+ { \
+ android::sp<I##INTERFACE> intr; \
+ if (obj != NULL) { \
+ intr = static_cast<I##INTERFACE*>( \
+ obj->queryLocalInterface( \
+ I##INTERFACE::descriptor).get()); \
+ if (intr == NULL) { \
+ intr = new Bp##INTERFACE(obj); \
+ } \
+ } \
+ return intr; \
+ } \
+
+#endif
#define CHECK_INTERFACE(interface, data, reply) \
if (!data.checkInterface(this)) { return PERMISSION_DENIED; } \
@@ -120,7 +160,11 @@ inline sp<IInterface> BnInterface<INTERFACE>::queryLocalInterface(
}
template<typename INTERFACE>
+#ifndef LIBBINDER_DECKARD
inline const String16& BnInterface<INTERFACE>::getInterfaceDescriptor() const
+#else
+inline String16 BnInterface<INTERFACE>::getInterfaceDescriptor() const
+#endif
{
return INTERFACE::getInterfaceDescriptor();
}
--- frameworks/native/include/binder/Parcel.h
+++ frameworks/native/include/binder/Parcel.h
@@ -74,8 +74,14 @@ public:
// propagating the StrictMode policy mask, populating the current
// IPCThreadState, which as an optimization may optionally be
// passed in.
+#ifndef LIBBINDER_DECKARD
bool enforceInterface(const String16& interface,
IPCThreadState* threadState = NULL) const;
+#else
+ bool enforceInterface(const String16& interface) const;
+ bool enforceInterface(const String16& interface,
+ IPCThreadState* threadState) const;
+#endif
bool checkInterface(IBinder*) const;
void freeData();
@@ -111,7 +117,12 @@ public:
// Place a file descriptor into the parcel. The given fd must remain
// valid for the lifetime of the parcel.
// The Parcel does not take ownership of the given fd unless you ask it to.
+#ifndef LIBBINDER_DECKARD
status_t writeFileDescriptor(int fd, bool takeOwnership = false);
+#else
+ status_t writeFileDescriptor(int fd);
+ status_t writeFileDescriptor(int fd, bool takeOwnership);
+#endif
// Place a file descriptor into the parcel. A dup of the fd is made, which
// will be closed once the parcel is destroyed.
--- frameworks/native/include/utils/Mutex.h
+++ frameworks/native/include/utils/Mutex.h
@@ -88,12 +88,14 @@ private:
#if defined(HAVE_PTHREADS)
+#ifndef LIBUTILS_DECKARD
inline Mutex::Mutex() {
pthread_mutex_init(&mMutex, NULL);
}
inline Mutex::Mutex(const char* name) {
pthread_mutex_init(&mMutex, NULL);
}
+#endif
inline Mutex::Mutex(int type, const char* name) {
if (type == SHARED) {
pthread_mutexattr_t attr;
@@ -105,6 +107,7 @@ inline Mutex::Mutex(int type, const char* name) {
pthread_mutex_init(&mMutex, NULL);
}
}
+#ifndef LIBUTILS_DECKARD
inline Mutex::~Mutex() {
pthread_mutex_destroy(&mMutex);
}
@@ -117,6 +120,7 @@ inline void Mutex::unlock() {
inline status_t Mutex::tryLock() {
return -pthread_mutex_trylock(&mMutex);
}
+#endif
#endif // HAVE_PTHREADS
--- frameworks/native/include/utils/Condition.h
+++ frameworks/native/include/utils/Condition.h
@@ -70,6 +70,7 @@ private:
// ---------------------------------------------------------------------------
+#ifndef LIBUTILS_DECKARD
#if defined(HAVE_PTHREADS)
inline Condition::Condition() {
@@ -126,6 +127,7 @@ inline void Condition::broadcast() {
}
#endif // HAVE_PTHREADS
+#endif
// ---------------------------------------------------------------------------
}; // namespace android
--- frameworks/native/libs/binder/Android.mk
+++ frameworks/native/libs/binder/Android.mk
@@ -43,3 +43,13 @@ LOCAL_LDLIBS += -lpthread
LOCAL_MODULE := libbinder
LOCAL_SRC_FILES := $(sources)
include $(BUILD_STATIC_LIBRARY)
+
+include $(CLEAR_VARS)
+LOCAL_CFLAGS += -DLIBBINDER_DECKARD
+LOCAL_LDLIBS += -lpthread
+LOCAL_MODULE := libbinder.deckard
+LOCAL_MODULE_TAGS := optional
+LOCAL_SHARED_LIBRARIES := liblog libcutils libutils libbinder
+LOCAL_SRC_FILES := $(sources) \
+ ../../../av/media/libmediaplayerservice/ActivityManager.cpp
+include $(BUILD_SHARED_LIBRARY)
--- frameworks/native/libs/binder/Binder.cpp
+++ frameworks/native/libs/binder/Binder.cpp
@@ -28,6 +28,7 @@ namespace android {
// ---------------------------------------------------------------------------
+#ifndef LIBBINDER_DECKARD
IBinder::IBinder()
: RefBase()
{
@@ -36,6 +37,7 @@ IBinder::IBinder()
IBinder::~IBinder()
{
}
+#endif
// ---------------------------------------------------------------------------
@@ -85,13 +87,19 @@ status_t BBinder::pingBinder()
return NO_ERROR;
}
+extern String16 gEmptyDescriptor;
+
+#ifndef LIBBINDER_DECKARD
const String16& BBinder::getInterfaceDescriptor() const
+#else
+String16 BBinder::getInterfaceDescriptor() const
+#endif
{
// This is a local static rather than a global static,
// to avoid static initializer ordering issues.
- static String16 sEmptyDescriptor;
+// static String16 sEmptyDescriptor;
ALOGW("reached BBinder::getInterfaceDescriptor (this=%p)", this);
- return sEmptyDescriptor;
+ return gEmptyDescriptor;
}
status_t BBinder::transact(
--- frameworks/native/libs/binder/BpBinder.cpp
+++ frameworks/native/libs/binder/BpBinder.cpp
@@ -103,7 +103,11 @@ bool BpBinder::isDescriptorCached() const {
return mDescriptorCache.size() ? true : false;
}
+#ifndef LIBBINDER_DECKARD
const String16& BpBinder::getInterfaceDescriptor() const
+#else
+String16 BpBinder::getInterfaceDescriptor() const
+#endif
{
if (isDescriptorCached() == false) {
Parcel send, reply;
--- frameworks/native/libs/binder/IInterface.cpp
+++ frameworks/native/libs/binder/IInterface.cpp
@@ -20,12 +20,14 @@ namespace android {
// ---------------------------------------------------------------------------
+#ifndef LIBBINDER_DECKARD
IInterface::IInterface()
: RefBase() {
}
IInterface::~IInterface() {
}
+#endif
sp<IBinder> IInterface::asBinder()
{
--- frameworks/native/libs/binder/IMemory.cpp
+++ frameworks/native/libs/binder/IMemory.cpp
@@ -63,7 +63,7 @@ private:
KeyedVector< wp<IBinder>, heap_info_t > mHeapCache;
};
-static sp<HeapCache> gHeapCache = new HeapCache();
+extern sp<HeapCache> gHeapCache;
/******************************************************************************/
--- frameworks/native/libs/binder/IPCThreadState.cpp
+++ frameworks/native/libs/binder/IPCThreadState.cpp
@@ -289,11 +289,11 @@ static const void* printCommand(TextOutput& out, const void* _cmd)
}
#endif
-static pthread_mutex_t gTLSMutex = PTHREAD_MUTEX_INITIALIZER;
-static bool gHaveTLS = false;
-static pthread_key_t gTLS = 0;
-static bool gShutdown = false;
-static bool gDisableBackgroundScheduling = false;
+extern pthread_mutex_t gTLSMutex;
+extern bool gHaveTLS;
+extern pthread_key_t gTLS;
+extern bool gShutdown;
+extern bool gDisableBackgroundScheduling;
IPCThreadState* IPCThreadState::self()
{
--- frameworks/native/libs/binder/IServiceManager.cpp
+++ frameworks/native/libs/binder/IServiceManager.cpp
@@ -46,6 +46,7 @@ sp<IServiceManager> defaultServiceManager()
return gDefaultServiceManager;
}
+#ifndef LIBBINDER_DECKARD
bool checkCallingPermission(const String16& permission)
{
return checkCallingPermission(permission, NULL, NULL);
@@ -226,5 +227,6 @@ status_t BnServiceManager::onTransact(
return BBinder::onTransact(code, data, reply, flags);
}
}
+#endif
}; // namespace android
--- frameworks/native/libs/binder/Parcel.cpp
+++ frameworks/native/libs/binder/Parcel.cpp
@@ -483,6 +483,13 @@ bool Parcel::checkInterface(IBinder* binder) const
return enforceInterface(binder->getInterfaceDescriptor());
}
+#ifdef LIBBINDER_DECKARD
+bool Parcel::enforceInterface(const String16& interface) const
+{
+ return enforceInterface(interface, NULL);
+}
+#endif
+
bool Parcel::enforceInterface(const String16& interface,
IPCThreadState* threadState) const
{
@@ -710,6 +717,13 @@ status_t Parcel::writeNativeHandle(const native_handle* handle)
return err;
}
+#ifdef LIBBINDER_DECKARD
+status_t Parcel::writeFileDescriptor(int fd)
+{
+ return writeFileDescriptor(fd, false);
+}
+#endif
+
status_t Parcel::writeFileDescriptor(int fd, bool takeOwnership)
{
flat_binder_object obj;
--- frameworks/native/libs/binder/Static.cpp
+++ frameworks/native/libs/binder/Static.cpp
@@ -24,6 +24,49 @@
namespace android {
+#ifndef LIBBINDER_DECKARD
+// ------------ Binder.cpp
+
+String16 gEmptyDescriptor;
+
+// ------------ IMemory.cpp
+
+class HeapCache : public IBinder::DeathRecipient
+{
+public:
+ HeapCache();
+ virtual ~HeapCache();
+
+ virtual void binderDied(const wp<IBinder>& who);
+
+ sp<IMemoryHeap> find_heap(const sp<IBinder>& binder);
+ void free_heap(const sp<IBinder>& binder);
+ sp<IMemoryHeap> get_heap(const sp<IBinder>& binder);
+ void dump_heaps();
+
+private:
+ // For IMemory.cpp
+ struct heap_info_t {
+ sp<IMemoryHeap> heap;
+ int32_t count;
+ };
+
+ void free_heap(const wp<IBinder>& binder);
+
+ Mutex mHeapCacheLock;
+ KeyedVector< wp<IBinder>, heap_info_t > mHeapCache;
+};
+
+sp<HeapCache> gHeapCache = new HeapCache();
+
+// ------------ IPCThreadState.cpp
+
+pthread_mutex_t gTLSMutex = PTHREAD_MUTEX_INITIALIZER;
+bool gHaveTLS = false;
+pthread_key_t gTLS = 0;
+bool gShutdown = false;
+bool gDisableBackgroundScheduling = false;
+
// ------------ ProcessState.cpp
Mutex gProcessMutex;
@@ -49,5 +92,6 @@ static LibUtilsIPCtStatics gIPCStatics;
Mutex gDefaultServiceManagerLock;
sp<IServiceManager> gDefaultServiceManager;
sp<IPermissionController> gPermissionController;
+#endif
} // namespace android
--- frameworks/native/libs/utils/Android.mk
+++ frameworks/native/libs/utils/Android.mk
@@ -110,6 +110,7 @@ ifeq ($(TARGET_OS),linux)
LOCAL_LDLIBS += -lrt -ldl
endif
+LOCAL_CFLAGS += -DLIBUTILS_DECKARD
LOCAL_C_INCLUDES += \
bionic/libc/private \
external/zlib
--- frameworks/native/libs/utils/Threads.cpp
+++ frameworks/native/libs/utils/Threads.cpp
@@ -382,7 +382,28 @@ namespace android {
*/
#if defined(HAVE_PTHREADS)
+#ifndef LIBUTILS_DECKARD
// implemented as inlines in threads.h
+#else
+Mutex::Mutex() {
+ pthread_mutex_init(&mMutex, NULL);
+}
+Mutex::Mutex(const char* name) {
+ pthread_mutex_init(&mMutex, NULL);
+}
+Mutex::~Mutex() {
+ pthread_mutex_destroy(&mMutex);
+}
+status_t Mutex::lock() {
+ return -pthread_mutex_lock(&mMutex);
+}
+void Mutex::unlock() {
+ pthread_mutex_unlock(&mMutex);
+}
+status_t Mutex::tryLock() {
+ return -pthread_mutex_trylock(&mMutex);
+}
+#endif
#elif defined(HAVE_WIN32_THREADS)
Mutex::Mutex()
@@ -457,7 +478,62 @@ status_t Mutex::tryLock()
*/
#if defined(HAVE_PTHREADS)
+#ifndef LIBUTILS_DECKARD
// implemented as inlines in threads.h
+#else
+Condition::Condition() {
+ pthread_cond_init(&mCond, NULL);
+}
+Condition::Condition(int type) {
+ if (type == SHARED) {
+ pthread_condattr_t attr;
+ pthread_condattr_init(&attr);
+ pthread_condattr_setpshared(&attr, PTHREAD_PROCESS_SHARED);
+ pthread_cond_init(&mCond, &attr);
+ pthread_condattr_destroy(&attr);
+ } else {
+ pthread_cond_init(&mCond, NULL);
+ }
+}
+Condition::~Condition() {
+ pthread_cond_destroy(&mCond);
+}
+status_t Condition::wait(Mutex& mutex) {
+ return -pthread_cond_wait(&mCond, &mutex.mMutex);
+}
+status_t Condition::waitRelative(Mutex& mutex, nsecs_t reltime) {
+#if defined(HAVE_PTHREAD_COND_TIMEDWAIT_RELATIVE)
+ struct timespec ts;
+ ts.tv_sec = reltime/1000000000;
+ ts.tv_nsec = reltime%1000000000;
+ return -pthread_cond_timedwait_relative_np(&mCond, &mutex.mMutex, &ts);
+#else // HAVE_PTHREAD_COND_TIMEDWAIT_RELATIVE
+ struct timespec ts;
+#if defined(HAVE_POSIX_CLOCKS)
+ clock_gettime(CLOCK_REALTIME, &ts);
+#else // HAVE_POSIX_CLOCKS
+ // we don't support the clocks here.
+ struct timeval t;
+ gettimeofday(&t, NULL);
+ ts.tv_sec = t.tv_sec;
+ ts.tv_nsec= t.tv_usec*1000;
+#endif // HAVE_POSIX_CLOCKS
+ ts.tv_sec += reltime/1000000000;
+ ts.tv_nsec+= reltime%1000000000;
+ if (ts.tv_nsec >= 1000000000) {
+ ts.tv_nsec -= 1000000000;
+ ts.tv_sec += 1;
+ }
+ return -pthread_cond_timedwait(&mCond, &mutex.mMutex, &ts);
+#endif // HAVE_PTHREAD_COND_TIMEDWAIT_RELATIVE
+}
+void Condition::signal() {
+ pthread_cond_signal(&mCond);
+}
+void Condition::broadcast() {
+ pthread_cond_broadcast(&mCond);
+}
+#endif
#elif defined(HAVE_WIN32_THREADS)
/*
--- bionic/linker/linker.c
+++ bionic/linker/linker.c
@@ -108,6 +108,10 @@ static const char *ldpreload_names[LDPRELOAD_MAX + 1];
static soinfo *preloads[LDPRELOAD_MAX + 1];
+static const char ldpostload_names[] = "libbinder.deckard.so";
+
+static soinfo *postloads = NULL;
+
#if LINKER_DEBUG
int debug_verbosity;
#endif
@@ -470,6 +474,13 @@ _do_lookup(soinfo *si, const char *name, unsigned *base)
}
}
+ if(postloads != NULL) {
+ lsi = postloads;
+ s = _elf_lookup(lsi, elf_hash, name);
+ if(s != NULL)
+ goto done;
+ }
+
#if ALLOW_SYMBOLS_FROM_MAIN
/* If we are resolving relocations while dlopen()ing a library, it's OK for
* the library to resolve a symbol that's defined in the executable itself,
@@ -1881,6 +1892,18 @@ static int link_image(soinfo *si, unsigned wr_offset)
}
}
+ if(si->flags & FLAG_EXE) {
+ soinfo *lsi = find_library(ldpostload_names);
+ if(lsi == 0) {
+ strlcpy(tmp_err_buf, linker_get_error(), sizeof(tmp_err_buf));
+ DL_ERR("%5d could not load needed library '%s' for '%s' (%s)",
+ pid, ldpostload_names, si->name, tmp_err_buf);
+ goto fail;
+ }
+ lsi->refcount++;
+ postloads = lsi;
+ }
+
for(d = si->dynamic; *d; d += 2) {
if(d[0] == DT_NEEDED){
DEBUG("%5d %s needs %s\n", pid, si->name, si->strtab + d[1]);
--- frameworks/av/include/media/AudioSystem.h
+++ frameworks/av/include/media/AudioSystem.h
@@ -61,6 +61,7 @@ public:
audio_io_handle_t output);
// mute/unmute stream
+ static status_t setStreamMute(int stream, bool mute);
static status_t setStreamMute(audio_stream_type_t stream, bool mute);
static status_t getStreamMute(audio_stream_type_t stream, bool* mute);
--- frameworks/av/media/libmedia/AudioSystem.cpp
+++ frameworks/av/media/libmedia/AudioSystem.cpp
@@ -130,6 +130,11 @@ status_t AudioSystem::setStreamVolume(audio_stream_type_t stream, float value,
return NO_ERROR;
}
+status_t AudioSystem::setStreamMute(int stream, bool mute)
+{
+ return setStreamMute((audio_stream_type_t)stream, mute);
+}
+
status_t AudioSystem::setStreamMute(audio_stream_type_t stream, bool mute)
{
if (uint32_t(stream) >= AUDIO_STREAM_CNT) return BAD_VALUE;
--- frameworks/base/cmds/servicemanager/service_manager.c
+++ frameworks/base/cmds/servicemanager/service_manager.c
@@ -31,6 +31,7 @@ static struct {
{ AID_MEDIA, "media.player" },
{ AID_MEDIA, "media.camera" },
{ AID_MEDIA, "media.audio_policy" },
+ { AID_MEDIA, "media.yamahaplayer" },
{ AID_DRM, "drm.drmManager" },
{ AID_NFC, "nfc" },
{ AID_RADIO, "radio.phone" },
--- hardware/libhardware_legacy/include/hardware_legacy/AudioHardwareInterface.h
+++ hardware/libhardware_legacy/include/hardware_legacy/AudioHardwareInterface.h
@@ -58,7 +58,11 @@ public:
/**
* returns the output channel mask
*/
+#ifndef AUDIO_DECKARD
virtual uint32_t channels() const = 0;
+#else
+ virtual int channelCount() const = 0;
+#endif
/**
* return audio format in 8bit or 16bit PCM format -
@@ -69,7 +73,11 @@ public:
/**
* return the frame size (number of bytes per sample).
*/
+#ifndef AUDIO_DECKARD
uint32_t frameSize() const { return popcount(channels())*((format()==AUDIO_FORMAT_PCM_16_BIT)?sizeof(int16_t):sizeof(int8_t)); }
+#else
+ uint32_t frameSize() const { return channelCount()*((format()==AudioSystem::PCM_16_BIT)?sizeof(int16_t):sizeof(int8_t)); }
+#endif
/**
* return the audio hardware driver latency in milli seconds.
@@ -83,7 +91,11 @@ public:
* This method might produce multiple PCM outputs or hardware accelerated
* codecs, such as MP3 or AAC.
*/
+#ifndef AUDIO_DECKARD
virtual status_t setVolume(float left, float right) = 0;
+#else
+ virtual status_t setVolume(float volume) = 0;
+#endif
/** write audio buffer to driver. Returns number of bytes written */
virtual ssize_t write(const void* buffer, size_t bytes) = 0;
@@ -97,6 +109,7 @@ public:
/** dump the state of the audio output device */
virtual status_t dump(int fd, const Vector<String16>& args) = 0;
+#ifndef AUDIO_DECKARD
// set/get audio output parameters. The function accepts a list of parameters
// key value pairs in the form: key1=value1;key2=value2;...
// Some keys are reserved for standard parameters (See AudioParameter class).
@@ -115,7 +128,9 @@ public:
* presented
*/
virtual status_t getNextWriteTimestamp(int64_t *timestamp);
-
+#else
+ virtual status_t Open() = 0;
+#endif
};
/**
@@ -127,14 +142,20 @@ class AudioStreamIn {
public:
virtual ~AudioStreamIn() = 0;
+#ifndef AUDIO_DECKARD
/** return audio sampling rate in hz - eg. 44100 */
virtual uint32_t sampleRate() const = 0;
+#endif
/** return the input buffer size allowed by audio driver */
virtual size_t bufferSize() const = 0;
/** return input channel mask */
+#ifndef AUDIO_DECKARD
virtual uint32_t channels() const = 0;
+#else
+ virtual int channelCount() const = 0;
+#endif
/**
* return audio format in 8bit or 16bit PCM format -
@@ -145,7 +166,11 @@ public:
/**
* return the frame size (number of bytes per sample).
*/
+#ifndef AUDIO_DECKARD
uint32_t frameSize() const { return AudioSystem::popCount(channels())*((format()==AudioSystem::PCM_16_BIT)?sizeof(int16_t):sizeof(int8_t)); }
+#else
+ uint32_t frameSize() const { return channelCount()*((format()==AudioSystem::PCM_16_BIT)?sizeof(int16_t):sizeof(int8_t)); }
+#endif
/** set the input gain for the audio driver. This method is for
* for future use */
@@ -163,6 +188,7 @@ public:
*/
virtual status_t standby() = 0;
+#ifndef AUDIO_DECKARD
// set/get audio input parameters. The function accepts a list of parameters
// key value pairs in the form: key1=value1;key2=value2;...
// Some keys are reserved for standard parameters (See AudioParameter class).
@@ -181,6 +207,7 @@ public:
virtual status_t addAudioEffect(effect_handle_t effect) = 0;
virtual status_t removeAudioEffect(effect_handle_t effect) = 0;
+#endif
};
/**
@@ -209,13 +236,37 @@ public:
/** set the audio volume of a voice call. Range is between 0.0 and 1.0 */
virtual status_t setVoiceVolume(float volume) = 0;
+#ifdef AUDIO_DECKARD
+ virtual status_t setStreamVolume(int, float) = 0;
+ virtual status_t setStreamMute(int, bool) = 0;
+ virtual status_t isStreamActive(int) = 0;
+ virtual status_t setStreamType(int) = 0;
+ virtual status_t setDinMute(bool) = 0;
+#endif
+
/**
* set the audio volume for all audio activities other than voice call.
* Range between 0.0 and 1.0. If any value other than NO_ERROR is returned,
* the software mixer will emulate this capability.
*/
virtual status_t setMasterVolume(float volume) = 0;
+#ifdef AUDIO_DECKARD
+ virtual status_t setMasterMute(bool) = 0;
+
+ /**
+ * Audio routing methods. Routes defined in include/hardware_legacy/AudioSystem.h.
+ * Audio routes can be (ROUTE_EARPIECE | ROUTE_SPEAKER | ROUTE_BLUETOOTH
+ * | ROUTE_HEADSET)
+ *
+ * setRouting sets the routes for a mode. This is called at startup. It is
+ * also called when a new device is connected, such as a wired headset is
+ * plugged in or a Bluetooth headset is paired.
+ */
+ virtual status_t setRouting(int mode, uint32_t routes) = 0;
+ virtual status_t getRouting(int mode, uint32_t* routes) = 0;
+#endif
+#ifndef AUDIO_DECKARD
/**
* Get the current master volume value for the HAL, if the HAL supports
* master volume control. AudioFlinger will query this value from the
@@ -223,6 +274,7 @@ public:
* the initial master volume across all HALs.
*/
virtual status_t getMasterVolume(float *volume) = 0;
+#endif
/**
* setMode is called when the audio mode changes. NORMAL mode is for
@@ -230,14 +282,23 @@ public:
* when a call is in progress.
*/
virtual status_t setMode(int mode) = 0;
+#ifdef AUDIO_DECKARD
+ virtual status_t getMode(int* mode) = 0;
+#endif
// mic mute
virtual status_t setMicMute(bool state) = 0;
virtual status_t getMicMute(bool* state) = 0;
// set/get global audio parameters
+#ifndef AUDIO_DECKARD
virtual status_t setParameters(const String8& keyValuePairs) = 0;
virtual String8 getParameters(const String8& keys) = 0;
+#else
+ // Temporary interface, do not use
+ // TODO: Replace with a more generic key:value get/set mechanism
+ virtual status_t setParameter(const char* key, const char* value) = 0;
+#endif
// Returns audio input buffer size according to parameters passed or 0 if one of the
// parameters is not supported
@@ -245,29 +306,60 @@ public:
/** This method creates and opens the audio hardware output stream */
virtual AudioStreamOut* openOutputStream(
+#ifndef AUDIO_DECKARD
uint32_t devices,
int *format=0,
uint32_t *channels=0,
uint32_t *sampleRate=0,
+#else
+ int format=0,
+ int channelCount=0,
+ uint32_t sampleRate=0,
+#endif
status_t *status=0) = 0;
+#ifndef AUDIO_DECKARD
virtual void closeOutputStream(AudioStreamOut* out) = 0;
+#endif
/** This method creates and opens the audio hardware input stream */
virtual AudioStreamIn* openInputStream(
+#ifndef AUDIO_DECKARD
uint32_t devices,
int *format,
uint32_t *channels,
uint32_t *sampleRate,
+#else
+ int inputSource,
+ int format,
+ int channelCount,
+ uint32_t sampleRate,
+#endif
status_t *status,
AudioSystem::audio_in_acoustics acoustics) = 0;
+#ifndef AUDIO_DECKARD
virtual void closeInputStream(AudioStreamIn* in) = 0;
+#endif
/**This method dumps the state of the audio hardware */
virtual status_t dumpState(int fd, const Vector<String16>& args) = 0;
static AudioHardwareInterface* create();
+#ifndef AUDIO_DECKARD
protected:
+#else
+ virtual status_t forcedRouting(int, unsigned int, unsigned int) = 0;
+ virtual status_t recoverRouting(int, unsigned int, unsigned int) = 0;
+ virtual status_t setVoiceMute(bool) = 0;
+
+ /**
+ * doRouting actually initiates the routing. A call to setRouting
+ * or setMode may result in a routing change. The generic logic calls
+ * doRouting when required. If the device has any special requirements these
+ * methods can be overriden.
+ */
+ virtual status_t doRouting() = 0;
+#endif
virtual status_t dump(int fd, const Vector<String16>& args) = 0;
};
--- hardware/libhardware_legacy/audio/Android.mk
+++ hardware/libhardware_legacy/audio/Android.mk
@@ -19,6 +19,24 @@ include $(BUILD_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := \
+ audio_hw_hal.cpp
+
+LOCAL_CFLAGS += -DAUDIO_DECKARD
+ifeq ($(BOARD_HAVE_BLUETOOTH),true)
+ LOCAL_CFLAGS += -DWITH_A2DP
+endif
+
+LOCAL_MODULE := audio.primary.deckard
+LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
+LOCAL_SHARED_LIBRARIES := libutils libaudio
+LOCAL_MODULE_TAGS := optional
+LOCAL_STATIC_LIBRARIES := libmedia_helper
+
+include $(BUILD_SHARED_LIBRARY)
+
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := \
AudioPolicyManagerBase.cpp \
AudioPolicyCompatClient.cpp \
audio_policy_hal.cpp
--- hardware/libhardware_legacy/audio/audio_hw_hal.cpp
+++ hardware/libhardware_legacy/audio/audio_hw_hal.cpp
@@ -44,12 +44,19 @@ struct legacy_stream_out {
struct audio_stream_out stream;
AudioStreamOut *legacy_out;
+#ifdef AUDIO_DECKARD
+ bool legacy_out_opened;
+ struct AudioHardwareInterface *legacy_out_hwif;
+#endif
};
struct legacy_stream_in {
struct audio_stream_in stream;
AudioStreamIn *legacy_in;
+#ifdef AUDIO_DECKARD
+ uint32_t legacy_in_sample_rate;
+#endif
};
/** audio_stream_out implementation **/
@@ -81,7 +88,13 @@ static uint32_t out_get_channels(const struct audio_stream *stream)
{
const struct legacy_stream_out *out =
reinterpret_cast<const struct legacy_stream_out *>(stream);
+#ifndef AUDIO_DECKARD
return out->legacy_out->channels();
+#else
+ return (out->legacy_out->channelCount() == 0) ? 0 :
+ ((out->legacy_out->channelCount() == 1) ?
+ AUDIO_CHANNEL_OUT_MONO : AUDIO_CHANNEL_OUT_STEREO);
+#endif
}
static audio_format_t out_get_format(const struct audio_stream *stream)
@@ -105,7 +118,14 @@ static int out_standby(struct audio_stream *stream)
{
struct legacy_stream_out *out =
reinterpret_cast<struct legacy_stream_out *>(stream);
+#ifndef AUDIO_DECKARD
return out->legacy_out->standby();
+#else
+ out->legacy_out_hwif->setStreamMute(AUDIO_STREAM_SYSTEM, true);
+ out->legacy_out_hwif->setStreamType(AUDIO_STREAM_DEFAULT);
+ out->legacy_out_opened = false;
+ return out->legacy_out->standby();
+#endif
}
static int out_dump(const struct audio_stream *stream, int fd)
@@ -118,18 +138,26 @@ static int out_dump(const struct audio_stream *stream, int fd)
static int out_set_parameters(struct audio_stream *stream, const char *kvpairs)
{
+#ifndef AUDIO_DECKARD
struct legacy_stream_out *out =
reinterpret_cast<struct legacy_stream_out *>(stream);
return out->legacy_out->setParameters(String8(kvpairs));
+#else
+ return 0;
+#endif
}
static char * out_get_parameters(const struct audio_stream *stream, const char *keys)
{
+#ifndef AUDIO_DECKARD
const struct legacy_stream_out *out =
reinterpret_cast<const struct legacy_stream_out *>(stream);
String8 s8;
s8 = out->legacy_out->getParameters(String8(keys));
return strdup(s8.string());
+#else
+ return NULL;
+#endif
}
static uint32_t out_get_latency(const struct audio_stream_out *stream)
@@ -144,7 +172,11 @@ static int out_set_volume(struct audio_stream_out *stream, float left,
{
struct legacy_stream_out *out =
reinterpret_cast<struct legacy_stream_out *>(stream);
+#ifndef AUDIO_DECKARD
return out->legacy_out->setVolume(left, right);
+#else
+ return out->legacy_out->setVolume((left + right) / 2);
+#endif
}
static ssize_t out_write(struct audio_stream_out *stream, const void* buffer,
@@ -152,23 +184,43 @@ static ssize_t out_write(struct audio_stream_out *stream, const void* buffer,
{
struct legacy_stream_out *out =
reinterpret_cast<struct legacy_stream_out *>(stream);
+#ifndef AUDIO_DECKARD
return out->legacy_out->write(buffer, bytes);
+#else
+ if (!out->legacy_out_opened) {
+ if (!out->legacy_out->Open()) {
+ out->legacy_out_opened = true;
+ out->legacy_out_hwif->setStreamMute(AUDIO_STREAM_SYSTEM, false);
+ out->legacy_out_hwif->setStreamType(AUDIO_STREAM_SYSTEM);
+ out->legacy_out_hwif->setStreamVolume(AUDIO_STREAM_SYSTEM, 1.0);
+ }
+ }
+ return out->legacy_out->write(buffer, bytes);
+#endif
}
static int out_get_render_position(const struct audio_stream_out *stream,
uint32_t *dsp_frames)
{
+#ifndef AUDIO_DECKARD
const struct legacy_stream_out *out =
reinterpret_cast<const struct legacy_stream_out *>(stream);
return out->legacy_out->getRenderPosition(dsp_frames);
+#else
+ return 0;
+#endif
}
static int out_get_next_write_timestamp(const struct audio_stream_out *stream,
int64_t *timestamp)
{
+#ifndef AUDIO_DECKARD
const struct legacy_stream_out *out =
reinterpret_cast<const struct legacy_stream_out *>(stream);
return out->legacy_out->getNextWriteTimestamp(timestamp);
+#else
+ return 0;
+#endif
}
static int out_add_audio_effect(const struct audio_stream *stream, effect_handle_t effect)
@@ -186,7 +238,11 @@ static uint32_t in_get_sample_rate(const struct audio_stream *stream)
{
const struct legacy_stream_in *in =
reinterpret_cast<const struct legacy_stream_in *>(stream);
+#ifndef AUDIO_DECKARD
return in->legacy_in->sampleRate();
+#else
+ return in->legacy_in_sample_rate;
+#endif
}
static int in_set_sample_rate(struct audio_stream *stream, uint32_t rate)
@@ -210,7 +266,13 @@ static uint32_t in_get_channels(const struct audio_stream *stream)
{
const struct legacy_stream_in *in =
reinterpret_cast<const struct legacy_stream_in *>(stream);
+#ifndef AUDIO_DECKARD
return in->legacy_in->channels();
+#else
+ return (in->legacy_in->channelCount() == 0) ? 0 :
+ ((in->legacy_in->channelCount() == 1) ?
+ AUDIO_CHANNEL_IN_MONO : AUDIO_CHANNEL_IN_STEREO);
+#endif
}
static audio_format_t in_get_format(const struct audio_stream *stream)
@@ -246,19 +308,27 @@ static int in_dump(const struct audio_stream *stream, int fd)
static int in_set_parameters(struct audio_stream *stream, const char *kvpairs)
{
+#ifndef AUDIO_DECKARD
struct legacy_stream_in *in =
reinterpret_cast<struct legacy_stream_in *>(stream);
return in->legacy_in->setParameters(String8(kvpairs));
+#else
+ return 0;
+#endif
}
static char * in_get_parameters(const struct audio_stream *stream,
const char *keys)
{
+#ifndef AUDIO_DECKARD
const struct legacy_stream_in *in =
reinterpret_cast<const struct legacy_stream_in *>(stream);
String8 s8;
s8 = in->legacy_in->getParameters(String8(keys));
return strdup(s8.string());
+#else
+ return NULL;
+#endif
}
static int in_set_gain(struct audio_stream_in *stream, float gain)
@@ -278,23 +348,35 @@ static ssize_t in_read(struct audio_stream_in *stream, void* buffer,
static uint32_t in_get_input_frames_lost(struct audio_stream_in *stream)
{
+#ifndef AUDIO_DECKARD
struct legacy_stream_in *in =
reinterpret_cast<struct legacy_stream_in *>(stream);
return in->legacy_in->getInputFramesLost();
+#else
+ return 0;
+#endif
}
static int in_add_audio_effect(const struct audio_stream *stream, effect_handle_t effect)
{
+#ifndef AUDIO_DECKARD
const struct legacy_stream_in *in =
reinterpret_cast<const struct legacy_stream_in *>(stream);
return in->legacy_in->addAudioEffect(effect);
+#else
+ return 0;
+#endif
}
static int in_remove_audio_effect(const struct audio_stream *stream, effect_handle_t effect)
{
+#ifndef AUDIO_DECKARD
const struct legacy_stream_in *in =
reinterpret_cast<const struct legacy_stream_in *>(stream);
return in->legacy_in->removeAudioEffect(effect);
+#else
+ return 0;
+#endif
}
/** audio_hw_device implementation **/
@@ -341,7 +423,19 @@ static int adev_init_check(const struct audio_hw_device *dev)
{
const struct legacy_audio_device *ladev = to_cladev(dev);
+#ifndef AUDIO_DECKARD
return ladev->hwif->initCheck();
+#else
+ int ret = ladev->hwif->initCheck();
+ if (!ret) {
+ ladev->hwif->setMasterMute(false);
+ ladev->hwif->setMode(AUDIO_MODE_NORMAL);
+ ladev->hwif->setRouting(AUDIO_MODE_NORMAL, AUDIO_DEVICE_OUT_SPEAKER);
+ ladev->hwif->setRouting(AUDIO_MODE_RINGTONE, AUDIO_DEVICE_OUT_SPEAKER);
+ ladev->hwif->setRouting(AUDIO_MODE_IN_CALL, AUDIO_DEVICE_OUT_EARPIECE);
+ }
+ return ret;
+#endif
}
static int adev_set_voice_volume(struct audio_hw_device *dev, float volume)
@@ -358,8 +452,12 @@ static int adev_set_master_volume(struct audio_hw_device *dev, float volume)
static int adev_get_master_volume(struct audio_hw_device *dev, float* volume)
{
+#ifndef AUDIO_DECKARD
struct legacy_audio_device *ladev = to_ladev(dev);
return ladev->hwif->getMasterVolume(volume);
+#else
+ return 0;
+#endif
}
static int adev_set_mode(struct audio_hw_device *dev, audio_mode_t mode)
@@ -383,18 +481,26 @@ static int adev_get_mic_mute(const struct audio_hw_device *dev, bool *state)
static int adev_set_parameters(struct audio_hw_device *dev, const char *kvpairs)
{
+#ifndef AUDIO_DECKARD
struct legacy_audio_device *ladev = to_ladev(dev);
return ladev->hwif->setParameters(String8(kvpairs));
+#else
+ return 0;
+#endif
}
static char * adev_get_parameters(const struct audio_hw_device *dev,
const char *keys)
{
const struct legacy_audio_device *ladev = to_cladev(dev);
+#ifndef AUDIO_DECKARD
String8 s8;
s8 = ladev->hwif->getParameters(String8(keys));
return strdup(s8.string());
+#else
+ return NULL;
+#endif
}
static size_t adev_get_input_buffer_size(const struct audio_hw_device *dev,
@@ -420,14 +526,31 @@ static int adev_open_output_stream(struct audio_hw_device *dev,
out = (struct legacy_stream_out *)calloc(1, sizeof(*out));
if (!out)
return -ENOMEM;
-
+#ifndef AUDIO_DECKARD
out->legacy_out = ladev->hwif->openOutputStream(devices, (int *) &config->format,
&config->channel_mask,
&config->sample_rate, &status);
+#else
+ out->legacy_out = ladev->hwif->openOutputStream((int) config->format,
+ (config->channel_mask == 0) ? 0 :
+ ((config->channel_mask ==
+ AUDIO_CHANNEL_OUT_MONO) ? 1 : 2),
+ config->sample_rate, &status);
+#endif
if (!out->legacy_out) {
ret = status;
goto err_open;
}
+#ifdef AUDIO_DECKARD
+ config->format = (audio_format_t) out->legacy_out->format();
+ config->channel_mask = (out->legacy_out->channelCount() == 0) ? 0 :
+ ((out->legacy_out->channelCount() == 1) ?
+ AUDIO_CHANNEL_OUT_MONO : AUDIO_CHANNEL_OUT_STEREO);
+ config->sample_rate = out->legacy_out->sampleRate();
+ out->legacy_out->standby();
+ out->legacy_out_opened = false;
+ out->legacy_out_hwif = ladev->hwif;
+#endif
out->stream.common.get_sample_rate = out_get_sample_rate;
out->stream.common.set_sample_rate = out_set_sample_rate;
@@ -462,7 +585,11 @@ static void adev_close_output_stream(struct audio_hw_device *dev,
struct legacy_audio_device *ladev = to_ladev(dev);
struct legacy_stream_out *out = reinterpret_cast<struct legacy_stream_out *>(stream);
+#ifndef AUDIO_DECKARD
ladev->hwif->closeOutputStream(out->legacy_out);
+#else
+ delete out->legacy_out;
+#endif
free(out);
}
@@ -481,14 +608,29 @@ static int adev_open_input_stream(struct audio_hw_device *dev,
in = (struct legacy_stream_in *)calloc(1, sizeof(*in));
if (!in)
return -ENOMEM;
-
+#ifndef AUDIO_DECKARD
in->legacy_in = ladev->hwif->openInputStream(devices, (int *) &config->format,
&config->channel_mask, &config->sample_rate,
+#else
+ in->legacy_in = ladev->hwif->openInputStream(1, (int) config->format,
+ (config->channel_mask == 0) ? 0 :
+ ((config->channel_mask ==
+ AUDIO_CHANNEL_IN_MONO) ? 1 : 2),
+ config->sample_rate,
+#endif
&status, (AudioSystem::audio_in_acoustics)0);
+
if (!in->legacy_in) {
ret = status;
goto err_open;
}
+#ifdef AUDIO_DECKARD
+ config->format = (audio_format_t) in->legacy_in->format();
+ config->channel_mask = (in->legacy_in->channelCount() == 0) ? 0 :
+ ((in->legacy_in->channelCount() == 1) ?
+ AUDIO_CHANNEL_IN_MONO : AUDIO_CHANNEL_IN_STEREO);
+ in->legacy_in_sample_rate = config->sample_rate;
+#endif
in->stream.common.get_sample_rate = in_get_sample_rate;
in->stream.common.set_sample_rate = in_set_sample_rate;
@@ -522,7 +664,11 @@ static void adev_close_input_stream(struct audio_hw_device *dev,
struct legacy_stream_in *in =
reinterpret_cast<struct legacy_stream_in *>(stream);
+#ifndef AUDIO_DECKARD
ladev->hwif->closeInputStream(in->legacy_in);
+#else
+ delete in->legacy_in;
+#endif
free(in);
}
--- frameworks/base/core/java/android/view/KeyEvent.java
+++ frameworks/base/core/java/android/view/KeyEvent.java
@@ -1600,6 +1600,11 @@ public class KeyEvent extends InputEvent implements Parcelable {
ev.mFlags = flags;
ev.mSource = source;
ev.mCharacters = characters;
+ if ((action == ACTION_DOWN || action == ACTION_UP) &&
+ (metaState & META_ALT_ON) != 0) {
+ if (code == KEYCODE_8) ev.mKeyCode = KEYCODE_VOLUME_DOWN;
+ if (code == KEYCODE_9) ev.mKeyCode = KEYCODE_VOLUME_UP;
+ }
return ev;
}
--- hardware/libhardware/include/hardware/sensors.h
+++ hardware/libhardware/include/hardware/sensors.h
@@ -34,6 +34,8 @@ __BEGIN_DECLS
/**
* Name of the sensors device to open
*/
+#define SENSORS_HARDWARE_CONTROL "control"
+#define SENSORS_HARDWARE_DATA "data"
#define SENSORS_HARDWARE_POLL "poll"
/**
@@ -325,6 +327,33 @@ typedef struct {
* Union of the various types of sensor data
* that can be returned.
*/
+typedef struct {
+ /* sensor identifier */
+ int sensor;
+
+ union {
+ /* x,y,z values of the given sensor */
+ sensors_vec_t vector;
+
+ /* orientation values are in degrees */
+ sensors_vec_t orientation;
+
+ /* acceleration values are in meter per second per second (m/s^2) */
+ sensors_vec_t acceleration;
+
+ /* magnetic vector values are in micro-Tesla (uT) */
+ sensors_vec_t magnetic;
+
+ /* temperature is in degrees centigrade (Celsius) */
+ float temperature;
+ };
+
+ /* time is in nanosecond */
+ int64_t time;
+
+ uint32_t reserved;
+} sensors_data_t;
+
typedef struct sensors_event_t {
/* must be sizeof(struct sensors_event_t) */
int32_t version;
@@ -431,6 +460,78 @@ struct sensor_t {
* Every device data structure must begin with hw_device_t
* followed by module specific public methods and attributes.
*/
+struct sensors_control_device_t {
+ struct hw_device_t common;
+
+ /**
+ * Returns a native_handle_t, which will be the parameter to
+ * sensors_data_device_t::open_data().
+ * The caller takes ownership of this handle. This is intended to be
+ * passed cross processes.
+ *
+ * @return a native_handle_t if successful, NULL on error
+ */
+ native_handle_t* (*open_data_source)(struct sensors_control_device_t *dev);
+
+ /** Activate/deactivate one sensor.
+ *
+ * @param handle is the handle of the sensor to change.
+ * @param enabled set to 1 to enable, or 0 to disable the sensor.
+ *
+ * @return 0 on success, negative errno code otherwise
+ */
+ int (*activate)(struct sensors_control_device_t *dev,
+ int handle, int enabled);
+
+ /**
+ * Set the delay between sensor events in ms
+ *
+ * @return 0 if successful, < 0 on error
+ */
+ int (*set_delay)(struct sensors_control_device_t *dev, int32_t ms);
+
+ /**
+ * Causes sensors_data_device_t.poll() to return -EWOULDBLOCK immediately.
+ */
+ int (*wake)(struct sensors_control_device_t *dev);
+};
+
+struct sensors_data_device_t {
+ struct hw_device_t common;
+
+ /**
+ * Prepare to read sensor data.
+ *
+ * This routine does NOT take ownership of the handle
+ * and must not close it. Typically this routine would
+ * use a duplicate of the nh parameter.
+ *
+ * @param nh from sensors_control_open.
+ *
+ * @return 0 if successful, < 0 on error
+ */
+ int (*data_open)(struct sensors_data_device_t *dev, native_handle_t* nh);
+
+ /**
+ * Caller has completed using the sensor data.
+ * The caller will not be blocked in sensors_data_poll
+ * when this routine is called.
+ *
+ * @return 0 if successful, < 0 on error
+ */
+ int (*data_close)(struct sensors_data_device_t *dev);
+
+ /**
+ * Return sensor data for one of the enabled sensors.
+ *
+ * @return sensor handle for the returned data, 0x7FFFFFFF when
+ * sensors_control_device_t.wake() is called and -errno on error
+ *
+ */
+ int (*poll)(struct sensors_data_device_t *dev,
+ sensors_data_t* data);
+};
+
struct sensors_poll_device_t {
struct hw_device_t common;
@@ -470,6 +571,26 @@ struct sensors_poll_device_t {
/** convenience API for opening and closing a device */
+static inline int sensors_control_open(const struct hw_module_t* module,
+ struct sensors_control_device_t** device) {
+ return module->methods->open(module,
+ SENSORS_HARDWARE_CONTROL, (struct hw_device_t**)device);
+}
+
+static inline int sensors_control_close(struct sensors_control_device_t* device) {
+ return device->common.close(&device->common);
+}
+
+static inline int sensors_data_open(const struct hw_module_t* module,
+ struct sensors_data_device_t** device) {
+ return module->methods->open(module,
+ SENSORS_HARDWARE_DATA, (struct hw_device_t**)device);
+}
+
+static inline int sensors_data_close(struct sensors_data_device_t* device) {
+ return device->common.close(&device->common);
+}
+
static inline int sensors_open(const struct hw_module_t* module,
struct sensors_poll_device_t** device) {
return module->methods->open(module,
--- frameworks/base/services/sensorservice/SensorDevice.h
+++ frameworks/base/services/sensorservice/SensorDevice.h
@@ -35,7 +35,8 @@ static const nsecs_t DEFAULT_EVENTS_PERIOD = 200000000; // 5 Hz
class SensorDevice : public Singleton<SensorDevice> {
friend class Singleton<SensorDevice>;
- struct sensors_poll_device_t* mSensorDevice;
+ struct sensors_control_device_t* mSensorDevice;
+ struct sensors_data_device_t* mSensorDataDevice;
struct sensors_module_t* mSensorModule;
mutable Mutex mLock; // protect mActivationCount[].rates
// fixed-size array after construction
--- frameworks/base/services/sensorservice/SensorDevice.cpp
+++ frameworks/base/services/sensorservice/SensorDevice.cpp
@@ -109,15 +109,22 @@ SensorDevice::SensorDevice()
SENSORS_HARDWARE_MODULE_ID, strerror(-err));
if (mSensorModule) {
- err = sensors_open(&mSensorModule->common, &mSensorDevice);
+ err = sensors_control_open(&mSensorModule->common, &mSensorDevice);
ALOGE_IF(err, "couldn't open device for module %s (%s)",
SENSORS_HARDWARE_MODULE_ID, strerror(-err));
+ err = sensors_data_open(&mSensorModule->common, &mSensorDataDevice);
+
+ ALOGE_IF(err, "couldn't open data device for module %s (%s)",
+ SENSORS_HARDWARE_MODULE_ID, strerror(-err));
+
if (mSensorDevice) {
sensor_t const* list;
ssize_t count = mSensorModule->get_sensors_list(mSensorModule, &list);
mActivationCount.setCapacity(count);
+ native_handle_t* hdl = mSensorDevice->open_data_source(mSensorDevice);
+ mSensorDataDevice->data_open(mSensorDataDevice, hdl);
Info model;
for (size_t i=0 ; i<size_t(count) ; i++) {
mActivationCount.add(list[i].handle, model);
@@ -166,11 +173,35 @@ status_t SensorDevice::initCheck() const {
ssize_t SensorDevice::poll(sensors_event_t* buffer, size_t count) {
if (!mSensorDevice) return NO_INIT;
- ssize_t c;
- do {
- c = mSensorDevice->poll(mSensorDevice, buffer, count);
- } while (c == -EINTR);
- return c;
+ sensors_data_t data;
+ int ret;
+ ret = mSensorDataDevice->poll(mSensorDataDevice, &data);
+ if (ret < 0) {
+ return 0;
+ }
+ buffer->version = 0;
+ buffer->sensor = (data.sensor == 0x1) ? 0 :
+ (data.sensor == 0x2) ? 1 :
+ (data.sensor == 0x4) ? 2 :
+ (data.sensor == 0x8) ? 3 :
+ (data.sensor == 0x10) ? 4 :
+ (data.sensor == 0x20) ? 5 :
+ (data.sensor == 0x40) ? 6 :
+ (data.sensor == 0x80) ? 7 :
+ (data.sensor == 0x100) ? 8 :
+ (data.sensor == 0x200) ? 9 :
+ (data.sensor == 0x400) ? 10 :
+ (data.sensor == 0x800) ? 11 :
+ (data.sensor == 0x1000) ? 12 :
+ (data.sensor == 0x2000) ? 13 :
+ (data.sensor == 0x4000) ? 14 : 15;
+ buffer->type = 0;
+ buffer->timestamp = data.time;
+ buffer->acceleration.x = data.acceleration.x;
+ buffer->acceleration.y = data.acceleration.y;
+ buffer->acceleration.z = data.acceleration.z;
+ buffer->acceleration.status = data.acceleration.status;
+ return 1;
}
status_t SensorDevice::activate(void* ident, int handle, int enabled)
@@ -233,7 +264,7 @@ status_t SensorDevice::activate(void* ident, int handle, int enabled)
{ // scope for the lock
Mutex::Autolock _l(mLock);
nsecs_t ns = info.selectDelay();
- mSensorDevice->setDelay(mSensorDevice, handle, ns);
+ mSensorDevice->set_delay(mSensorDevice, (int32_t)(ns/1000000));
}
return err;
@@ -247,7 +278,7 @@ status_t SensorDevice::setDelay(void* ident, int handle, int64_t ns)
status_t err = info.setDelayForIdent(ident, ns);
if (err < 0) return err;
ns = info.selectDelay();
- return mSensorDevice->setDelay(mSensorDevice, handle, ns);
+ return mSensorDevice->set_delay(mSensorDevice, (int32_t)(ns/1000000));
}
// ---------------------------------------------------------------------------
--- hardware/libhardware/include/hardware/gps.h
+++ hardware/libhardware/include/hardware/gps.h
@@ -39,7 +39,7 @@ typedef int64_t GpsUtcTime;
#define GPS_MAX_SVS 32
/** Requested operational mode for GPS operation. */
-typedef uint32_t GpsPositionMode;
+typedef uint16_t GpsPositionMode;
// IMPORTANT: Note that the following values must match
// constants in GpsLocationProvider.java.
/** Mode for running GPS standalone (no assistance). */
@@ -230,8 +230,6 @@ typedef uint16_t AGpsStatusValue;
/** Represents a location. */
typedef struct {
- /** set to sizeof(GpsLocation) */
- size_t size;
/** Contains GpsLocationFlags bits. */
uint16_t flags;
/** Represents latitude in degrees. */
@@ -253,15 +251,11 @@ typedef struct {
/** Represents the status. */
typedef struct {
- /** set to sizeof(GpsStatus) */
- size_t size;
GpsStatusValue status;
} GpsStatus;
/** Represents SV information. */
typedef struct {
- /** set to sizeof(GpsSvInfo) */
- size_t size;
/** Pseudo-random number for the SV. */
int prn;
/** Signal to noise ratio. */
@@ -274,9 +268,6 @@ typedef struct {
/** Represents SV status. */
typedef struct {
- /** set to sizeof(GpsSvStatus) */
- size_t size;
-
/** Number of SVs currently visible. */
int num_svs;
@@ -366,8 +357,6 @@ typedef pthread_t (* gps_create_thread)(const char* name, void (*start)(void *),
/** GPS callback structure. */
typedef struct {
- /** set to sizeof(GpsCallbacks) */
- size_t size;
gps_location_callback location_cb;
gps_status_callback status_cb;
gps_sv_status_callback sv_status_cb;
@@ -382,8 +371,6 @@ typedef struct {
/** Represents the standard GPS interface. */
typedef struct {
- /** set to sizeof(GpsInterface) */
- size_t size;
/**
* Opens the interface and provides the callback routines
* to the implemenation of this interface.
@@ -443,8 +430,6 @@ typedef struct {
/** Extended interface for XTRA support. */
typedef struct {
- /** set to sizeof(GpsXtraInterface) */
- size_t size;
/**
* Opens the XTRA interface and provides the callback routines
* to the implemenation of this interface.
@@ -468,12 +453,11 @@ typedef struct {
/** Represents the status of AGPS. */
typedef struct {
- /** set to sizeof(AGpsStatus) */
- size_t size;
-
AGpsType type;
AGpsStatusValue status;
uint32_t ipaddr;
+ /** set to sizeof(AGpsStatus) */
+ size_t size;
} AGpsStatus;
/** Callback with AGPS status information.
@@ -490,9 +474,6 @@ typedef struct {
/** Extended interface for AGPS support. */
typedef struct {
- /** set to sizeof(AGpsInterface) */
- size_t size;
-
/**
* Opens the AGPS interface and provides the callback routines
* to the implemenation of this interface.
--- development/tools/emulator/system/gps/Android.mk
+++ development/tools/emulator/system/gps/Android.mk
@@ -28,12 +28,12 @@ include $(CLEAR_VARS)
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
LOCAL_CFLAGS += -DQEMU_HARDWARE
-LOCAL_SHARED_LIBRARIES := liblog libcutils libhardware
+LOCAL_SHARED_LIBRARIES := liblog libcutils libhardware libloc_api
LOCAL_SRC_FILES := gps_qemu.c
ifeq ($(TARGET_PRODUCT),vbox_x86)
LOCAL_MODULE := gps.vbox_x86
else
-LOCAL_MODULE := gps.goldfish
+LOCAL_MODULE := gps.deckard
endif
LOCAL_MODULE_TAGS := debug
include $(BUILD_SHARED_LIBRARY)
--- development/tools/emulator/system/gps/gps_qemu.c
+++ development/tools/emulator/system/gps/gps_qemu.c
@@ -229,7 +229,7 @@ nmea_reader_init( NmeaReader* r )
r->utc_mon = -1;
r->utc_day = -1;
r->callback = NULL;
- r->fix.size = sizeof(r->fix);
+// r->fix.size = sizeof(r->fix);
nmea_reader_update_utc_diff( r );
}
@@ -562,15 +562,21 @@ nmea_reader_addc( NmeaReader* r, int c )
enum {
CMD_QUIT = 0,
CMD_START = 1,
- CMD_STOP = 2
+ CMD_STOP = 2,
+ CMD_LOCATION = 3,
+ CMD_STATUS = 4,
+ CMD_SV_STATUS = 5,
+ CMD_XTRA_DOWNLOAD = 6,
+ CMD_AGPS_STATUS = 7
};
/* this is the state of our connection to the qemu_gpsd daemon */
typedef struct {
int init;
- int fd;
GpsCallbacks callbacks;
+ GpsXtraCallbacks xtra_callbacks;
+ AGpsCallbacks agps_callbacks;
pthread_t thread;
int control[2];
} GpsState;
@@ -578,6 +584,101 @@ typedef struct {
static GpsState _gps_state[1];
+static GpsLocation sGpsLocation;
+static GpsStatus sGpsStatus;
+static GpsSvStatus sGpsSvStatus;
+static AGpsStatus sAGpsStatus;
+
+
+static void
+gps_state_location( GpsLocation* location )
+{
+ GpsState* s = _gps_state;
+ char cmd = CMD_LOCATION;
+ int ret;
+
+ memcpy(&sGpsLocation, location, sizeof(sGpsLocation));
+
+ do { ret=write( s->control[0], &cmd, 1 ); }
+ while (ret < 0 && errno == EINTR);
+
+ if (ret != 1)
+ D("%s: could not send CMD_LOCATION command: ret=%d: %s",
+ __FUNCTION__, ret, strerror(errno));
+}
+
+
+static void
+gps_state_status( GpsStatus* status )
+{
+ GpsState* s = _gps_state;
+ char cmd = CMD_STATUS;
+ int ret;
+
+ memcpy(&sGpsStatus, status, sizeof(sGpsStatus));
+
+ do { ret=write( s->control[0], &cmd, 1 ); }
+ while (ret < 0 && errno == EINTR);
+
+ if (ret != 1)
+ D("%s: could not send CMD_STATUS command: ret=%d: %s",
+ __FUNCTION__, ret, strerror(errno));
+}
+
+
+static void
+gps_state_sv_status( GpsSvStatus* sv_info )
+{
+ GpsState* s = _gps_state;
+ char cmd = CMD_SV_STATUS;
+ int ret;
+
+ memcpy(&sGpsSvStatus, sv_info, sizeof(sGpsSvStatus));
+
+ do { ret=write( s->control[0], &cmd, 1 ); }
+ while (ret < 0 && errno == EINTR);
+
+ if (ret != 1)
+ D("%s: could not send CMD_SV_STATUS command: ret=%d: %s",
+ __FUNCTION__, ret, strerror(errno));
+}
+
+
+static void
+gps_state_xtra_download_request( )
+{
+ GpsState* s = _gps_state;
+ char cmd = CMD_XTRA_DOWNLOAD;
+ int ret;
+
+ do { ret=write( s->control[0], &cmd, 1 ); }
+ while (ret < 0 && errno == EINTR);
+
+ if (ret != 1)
+ D("%s: could not send CMD_XTRA_DOWNLOAD command: ret=%d: %s",
+ __FUNCTION__, ret, strerror(errno));
+}
+
+
+static void
+gps_state_agps_status( AGpsStatus* status )
+{
+ GpsState* s = _gps_state;
+ char cmd = CMD_AGPS_STATUS;
+ int ret;
+
+ memcpy(&sAGpsStatus, status, sizeof(sAGpsStatus));
+ sAGpsStatus.size = 0;
+
+ do { ret=write( s->control[0], &cmd, 1 ); }
+ while (ret < 0 && errno == EINTR);
+
+ if (ret != 1)
+ D("%s: could not send CMD_AGPS_STATUS command: ret=%d: %s",
+ __FUNCTION__, ret, strerror(errno));
+}
+
+
static void
gps_state_done( GpsState* s )
{
@@ -591,8 +692,6 @@ gps_state_done( GpsState* s )
close( s->control[0] ); s->control[0] = -1;
close( s->control[1] ); s->control[1] = -1;
- // close connection to the QEMU GPS daemon
- close( s->fd ); s->fd = -1;
s->init = 0;
}
@@ -667,14 +766,10 @@ gps_state_thread( void* arg )
NmeaReader reader[1];
int epoll_fd = epoll_create(2);
int started = 0;
- int gps_fd = state->fd;
int control_fd = state->control[1];
- nmea_reader_init( reader );
-
// register control file descriptors for polling
epoll_register( epoll_fd, control_fd );
- epoll_register( epoll_fd, gps_fd );
D("gps thread running");
@@ -713,39 +808,36 @@ gps_state_thread( void* arg )
}
else if (cmd == CMD_START) {
if (!started) {
- D("gps thread starting location_cb=%p", state->callbacks.location_cb);
+ D("gps thread starting");
started = 1;
- nmea_reader_set_callback( reader, state->callbacks.location_cb );
}
}
else if (cmd == CMD_STOP) {
if (started) {
D("gps thread stopping");
started = 0;
- nmea_reader_set_callback( reader, NULL );
}
}
- }
- else if (fd == gps_fd)
- {
- char buff[32];
- D("gps fd event");
- for (;;) {
- int nn, ret;
-
- ret = read( fd, buff, sizeof(buff) );
- if (ret < 0) {
- if (errno == EINTR)
- continue;
- if (errno != EWOULDBLOCK)
- ALOGE("error while reading from gps daemon socket: %s:", strerror(errno));
- break;
- }
- D("received %d bytes: %.*s", ret, ret, buff);
- for (nn = 0; nn < ret; nn++)
- nmea_reader_addc( reader, buff[nn] );
+ else if (cmd == CMD_LOCATION) {
+ if (state->callbacks.location_cb)
+ state->callbacks.location_cb(&sGpsLocation);
+ }
+ else if (cmd == CMD_STATUS) {
+ if (state->callbacks.status_cb)
+ state->callbacks.status_cb(&sGpsStatus);
+ }
+ else if (cmd == CMD_SV_STATUS) {
+ if (state->callbacks.sv_status_cb)
+ state->callbacks.sv_status_cb(&sGpsSvStatus);
+ }
+ else if (cmd == CMD_XTRA_DOWNLOAD) {
+ if (state->xtra_callbacks.download_request_cb)
+ state->xtra_callbacks.download_request_cb();
+ }
+ else if (cmd == CMD_AGPS_STATUS) {
+ if (state->agps_callbacks.status_cb)
+ state->agps_callbacks.status_cb(&sAGpsStatus);
}
- D("gps fd event end");
}
else
{
@@ -763,16 +855,6 @@ gps_state_init( GpsState* state, GpsCallbacks* callbacks )
state->init = 1;
state->control[0] = -1;
state->control[1] = -1;
- state->fd = -1;
-
- state->fd = qemud_channel_open(QEMU_CHANNEL_NAME);
-
- if (state->fd < 0) {
- D("no gps emulation detected");
- return;
- }
-
- D("gps emulation will read from '%s' qemud channel", QEMU_CHANNEL_NAME );
if ( socketpair( AF_LOCAL, SOCK_STREAM, 0, state->control ) < 0 ) {
ALOGE("could not create thread control socket pair: %s", strerror(errno));
@@ -804,6 +886,110 @@ Fail:
/*****************************************************************/
/*****************************************************************/
+static const GpsInterface* sGpsInterface = NULL;
+static const GpsXtraInterface* sGpsXtraInterface = NULL;
+static const AGpsInterface* sAGpsInterface = NULL;
+
+
+GpsXtraCallbacks sGpsXtraCallbacks = {
+ gps_state_xtra_download_request,
+ NULL,
+};
+
+static int
+qemu_gps_xtra_init(GpsXtraCallbacks* callbacks)
+{
+ GpsState* s = _gps_state;
+
+ s->xtra_callbacks = *callbacks;
+
+ if (sGpsXtraInterface)
+ return sGpsXtraInterface->init(&sGpsXtraCallbacks);
+ return 0;
+}
+
+static int
+qemu_gps_xtra_inject_data(char* data, int length)
+{
+ if (sGpsXtraInterface)
+ return sGpsXtraInterface->inject_xtra_data(data, length);
+ return 0;
+}
+
+static const GpsXtraInterface qemuGpsXtraInterface = {
+ qemu_gps_xtra_init,
+ qemu_gps_xtra_inject_data,
+};
+
+
+AGpsCallbacks sAGpsCallbacks = {
+ gps_state_agps_status,
+ NULL,
+};
+
+static void
+qemu_agps_init(AGpsCallbacks* callbacks)
+{
+ GpsState* s = _gps_state;
+
+ s->agps_callbacks = *callbacks;
+
+ if (sAGpsInterface)
+ sAGpsInterface->init(&sAGpsCallbacks);
+}
+
+static int
+qemu_agps_data_conn_open(const char* apn)
+{
+ if (sAGpsInterface)
+ return sAGpsInterface->data_conn_open(apn);
+ return 0;
+}
+
+static int
+qemu_agps_data_conn_closed()
+{
+ if (sAGpsInterface)
+ return sAGpsInterface->data_conn_closed();
+ return 0;
+}
+
+static int
+qemu_agps_data_conn_failed()
+{
+ if (sAGpsInterface)
+ return sAGpsInterface->data_conn_failed();
+ return 0;
+}
+
+static int
+qemu_agps_set_server(AGpsType type, const char* hostname, int port)
+{
+ if (sAGpsInterface)
+ return sAGpsInterface->set_server(type, hostname, port);
+ return 0;
+}
+
+static const AGpsInterface qemuAGpsInterface = {
+ qemu_agps_init,
+ qemu_agps_data_conn_open,
+ qemu_agps_data_conn_closed,
+ qemu_agps_data_conn_failed,
+ qemu_agps_set_server,
+};
+
+
+GpsCallbacks sGpsCallbacks = {
+ gps_state_location,
+ gps_state_status,
+ gps_state_sv_status,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+};
static int
qemu_gps_init(GpsCallbacks* callbacks)
@@ -813,9 +999,8 @@ qemu_gps_init(GpsCallbacks* callbacks)
if (!s->init)
gps_state_init(s, callbacks);
- if (s->fd < 0)
- return -1;
-
+ if (sGpsInterface)
+ return sGpsInterface->init(&sGpsCallbacks);
return 0;
}
@@ -826,6 +1011,9 @@ qemu_gps_cleanup(void)
if (s->init)
gps_state_done(s);
+
+ if (sGpsInterface)
+ sGpsInterface->cleanup();
}
@@ -841,6 +1029,9 @@ qemu_gps_start()
D("%s: called", __FUNCTION__);
gps_state_start(s);
+
+ if (sGpsInterface)
+ return sGpsInterface->start();
return 0;
}
@@ -857,6 +1048,9 @@ qemu_gps_stop()
D("%s: called", __FUNCTION__);
gps_state_stop(s);
+
+ if (sGpsInterface)
+ return sGpsInterface->stop();
return 0;
}
@@ -864,35 +1058,52 @@ qemu_gps_stop()
static int
qemu_gps_inject_time(GpsUtcTime time, int64_t timeReference, int uncertainty)
{
+ if (sGpsInterface)
+ return sGpsInterface->inject_time(time, timeReference, uncertainty);
return 0;
}
static int
qemu_gps_inject_location(double latitude, double longitude, float accuracy)
{
+ if (sGpsInterface)
+ return sGpsInterface->inject_location(latitude, longitude, accuracy);
return 0;
}
static void
qemu_gps_delete_aiding_data(GpsAidingData flags)
{
+ if (sGpsInterface)
+ sGpsInterface->delete_aiding_data(flags);
}
-static int qemu_gps_set_position_mode(GpsPositionMode mode, int fix_frequency)
+typedef int (*gps_set_position_mode)(GpsPositionMode mode, int fix_frequency);
+
+static int qemu_gps_set_position_mode(GpsPositionMode mode, GpsPositionRecurrence recurrence,
+ uint32_t min_interval, uint32_t preferred_accuracy, uint32_t preferred_time)
{
- // FIXME - support fix_frequency
+ if (sGpsInterface)
+ return ((gps_set_position_mode)sGpsInterface->set_position_mode)(mode, (int)(min_interval/1000));
return 0;
}
static const void*
qemu_gps_get_extension(const char* name)
{
- // no extensions supported
+ if (sGpsInterface) {
+ if (!strcmp(name, GPS_XTRA_INTERFACE)) {
+ sGpsXtraInterface = (GpsXtraInterface*)sGpsInterface->get_extension(name);
+ return (const void*)&qemuGpsXtraInterface;
+ } else if (!strcmp(name, AGPS_INTERFACE)) {
+ sAGpsInterface = (AGpsInterface*)sGpsInterface->get_extension(name);
+ return (const void*)&qemuAGpsInterface;
+ }
+ }
return NULL;
}
static const GpsInterface qemuGpsInterface = {
- sizeof(GpsInterface),
qemu_gps_init,
qemu_gps_start,
qemu_gps_stop,
@@ -904,8 +1115,11 @@ static const GpsInterface qemuGpsInterface = {
qemu_gps_get_extension,
};
+const GpsInterface* gps_get_hardware_interface();
+
const GpsInterface* gps__get_gps_interface(struct gps_device_t* dev)
{
+ sGpsInterface = gps_get_hardware_interface();
return &qemuGpsInterface;
}
@@ -935,7 +1149,7 @@ const struct hw_module_t HAL_MODULE_INFO_SYM = {
.version_major = 1,
.version_minor = 0,
.id = GPS_HARDWARE_MODULE_ID,
- .name = "Goldfish GPS Module",
+ .name = "Deckard GPS Module",
.author = "The Android Open Source Project",
.methods = &gps_module_methods,
};
--- frameworks/base/services/jni/com_android_server_location_GpsLocationProvider.cpp
+++ frameworks/base/services/jni/com_android_server_location_GpsLocationProvider.cpp
@@ -136,7 +136,7 @@ static pthread_t create_thread_callback(const char* name, void (*start)(void *),
}
GpsCallbacks sGpsCallbacks = {
- sizeof(GpsCallbacks),
+// sizeof(GpsCallbacks),
location_callback,
status_callback,
sv_status_callback,
--- system/vold/DirectVolume.cpp
+++ system/vold/DirectVolume.cpp
@@ -148,6 +148,9 @@ void DirectVolume::handleDiskAdded(const char *devpath, NetlinkEvent *evt) {
mDiskNumParts = 1;
}
+ if (strcmp(devpath, "/devices/virtual/block/stheno") == 0)
+ mDiskNumParts = 0;
+
char msg[255];
int partmask = 0;
--- external/dhcpcd/Android.mk
+++ external/dhcpcd/Android.mk
@@ -26,13 +26,13 @@ LOCAL_MODULE = showlease
LOCAL_MODULE_TAGS := debug
include $(BUILD_EXECUTABLE)
-#include $(CLEAR_VARS)
-#LOCAL_MODULE := dhcpcd.conf
-#LOCAL_MODULE_TAGS := user
-#LOCAL_MODULE_CLASS := ETC
-#LOCAL_MODULE_PATH := $(etc_dir)
-#LOCAL_SRC_FILES := android.conf
-#include $(BUILD_PREBUILT)
+include $(CLEAR_VARS)
+LOCAL_MODULE := dhcpcd.conf
+LOCAL_MODULE_TAGS := user
+LOCAL_MODULE_CLASS := ETC
+LOCAL_MODULE_PATH := $(etc_dir)
+LOCAL_SRC_FILES := android.conf
+include $(BUILD_PREBUILT)
include $(CLEAR_VARS)
LOCAL_MODULE := dhcpcd-run-hooks
--- external/wpa_supplicant/Android.mk
+++ external/wpa_supplicant/Android.mk
@@ -43,7 +43,7 @@
# OpenSSL is configured without engines on Android
L_CFLAGS += -DOPENSSL_NO_ENGINE
-INCLUDES = external/openssl/include frameworks/base/cmds/keystore
+INCLUDES = external/openssl/include system/security/keystore
OBJS = config.c common.c md5.c md4.c rc4.c sha1.c des.c
OBJS_p = wpa_passphrase.c sha1.c md5.c md4.c common.c des.c
@@ -696,17 +696,17 @@
#include $(BUILD_EXECUTABLE)
#
########################
-#
-#local_target_dir := $(TARGET_OUT)/etc/wifi
-#
-#include $(CLEAR_VARS)
-#LOCAL_MODULE := wpa_supplicant.conf
-#LOCAL_MODULE_TAGS := user
-#LOCAL_MODULE_CLASS := ETC
-#LOCAL_MODULE_PATH := $(local_target_dir)
-#LOCAL_SRC_FILES := $(LOCAL_MODULE)
-#include $(BUILD_PREBUILT)
-#
+
+local_target_dir := $(TARGET_OUT)/etc/wifi
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := wpa_supplicant.conf
+LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE_CLASS := ETC
+LOCAL_MODULE_PATH := $(local_target_dir)
+LOCAL_SRC_FILES := $(LOCAL_MODULE)
+include $(BUILD_PREBUILT)
+
########################
endif # ifeq ($(WPA_BUILD_SUPPLICANT),true)
--- external/wpa_supplicant/ctrl_iface.c
+++ external/wpa_supplicant/ctrl_iface.c
@@ -1153,6 +1153,27 @@ static int wpa_supplicant_driver_cmd(struct wpa_supplicant *wpa_s,
return( ret );
}
+
+static int wpa_supplicant_signal_poll(struct wpa_supplicant *wpa_s, char *buf,
+ size_t buflen)
+{
+ int ret;
+ int lssize=20;
+ int rssisize=16;
+ char linkspeed[lssize];
+ char rssi[rssisize];
+
+ wpa_supplicant_driver_cmd(wpa_s, "LINKSPEED", linkspeed, lssize);
+ wpa_supplicant_driver_cmd(wpa_s, "RSSI", rssi, rssisize);
+
+ ret = os_snprintf(buf, buflen, "RSSI=%sLINKSPEED=%s"
+ "NOISE=0\nFREQUENCY=0\n",
+ os_strrchr(rssi,' ')+1,linkspeed+10);
+ if (ret < 0 || (unsigned int) ret > buflen)
+ return -1;
+ return ret;
+}
+
char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s,
char *buf, size_t *resp_len)
{
@@ -1310,6 +1331,9 @@ char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s,
} else if (os_strcmp(buf, "INTERFACES") == 0) {
reply_len = wpa_supplicant_global_iface_interfaces(
wpa_s->global, reply, reply_size);
+ } else if (os_strncmp(buf, "SIGNAL_POLL", 11) == 0) {
+ reply_len = wpa_supplicant_signal_poll(wpa_s, reply,
+ reply_size);
} else if (os_strncmp(buf, "DRIVER ", 7) == 0) {
reply_len = wpa_supplicant_driver_cmd(wpa_s, buf + 7, reply, reply_size);
} else {
--- hardware/libhardware_legacy/wifi/wifi.c
+++ hardware/libhardware_legacy/wifi/wifi.c
@@ -89,10 +89,12 @@
#define WIFI_DRIVER_LOADER_DELAY 1000000
+static const char WLAN0_DEVICE[] = "/sys/devices/platform/msm_sdcc.1/mmc_host/mmc1/mmc1:0001/mmc1:0001:1/net/wlan0/wireless/status";
+
static const char IFACE_DIR[] = "/data/system/wpa_supplicant";
#ifdef WIFI_DRIVER_MODULE_PATH
static const char DRIVER_MODULE_NAME[] = WIFI_DRIVER_MODULE_NAME;
-static const char DRIVER_MODULE_TAG[] = WIFI_DRIVER_MODULE_NAME " ";
+static const char DRIVER_MODULE_TAG[] = WIFI_DRIVER_MODULE_NAME;
static const char DRIVER_MODULE_PATH[] = WIFI_DRIVER_MODULE_PATH;
static const char DRIVER_MODULE_ARG[] = WIFI_DRIVER_MODULE_ARG;
#endif
@@ -131,38 +133,53 @@
static int insmod(const char *filename, const char *args)
{
- void *module;
- unsigned int size;
int ret;
+ char command0[]="echo 0 > /sys/devices/platform/bwpm/wifi";
+ char command1[]="echo 0 > /sys/bus/platform/drivers/msm_sdcc/msm_sdcc.1/polling";
+ char command2[]="echo 1 > /sys/devices/platform/bwpm/wifi";
+ char command3[]="echo 1 > /sys/bus/platform/drivers/msm_sdcc/msm_sdcc.1/polling";
- module = load_file(filename, &size);
- if (!module)
- return -1;
-
- ret = init_module(module, size, args);
-
- free(module);
-
- return ret;
-}
+ sched_yield();
+ ret=system(command0);
+ sched_yield();
+ ret=system(command1);
+ sched_yield();
+ usleep(1000000);
+ ret=system(command2);
+ sched_yield();
+ ret=system(command3);
+ sched_yield();
+ usleep(10000000);
-static int rmmod(const char *modname)
-{
- int ret = -1;
int maxtry = 10;
-
+ char text[256];
while (maxtry-- > 0) {
- ret = delete_module(modname, O_NONBLOCK | O_EXCL);
- if (ret < 0 && errno == EAGAIN)
- usleep(500000);
- else
- break;
+ if (access(WLAN0_DEVICE, R_OK) == 0) {
+ FILE *fp;
+ if ((fp = fopen(WLAN0_DEVICE, "r")) != NULL ) {
+ fgets(text, 256, fp);
+ fclose(fp);
+ if (strncmp(text, "0x0", 3) == 0) return 0;
+ }
+ } else {
+ ret=system(command0);
+ sched_yield();
+ ret=system(command1);
+ sched_yield();
+ usleep(1000000);
+ ret=system(command2);
+ sched_yield();
+ ret=system(command3);
+ sched_yield();
+ usleep(10000000);
+ }
}
+ return -1;
+}
- if (ret != 0)
- ALOGD("Unable to unload driver module \"%s\": %s\n",
- modname, strerror(errno));
- return ret;
+static int rmmod(const char *modname)
+{
+ return 0;
}
int do_dhcp_request(int *ipaddr, int *gateway, int *mask,
@@ -659,17 +676,11 @@
/* Establishes the control and monitor socket connections on the interface */
int wifi_connect_to_supplicant(const char *ifname)
{
- char path[256];
+ char path[] = "/data/misc/wifi/sockets/wlan0";
if (is_primary_interface(ifname)) {
- if (access(IFACE_DIR, F_OK) == 0) {
- snprintf(path, sizeof(path), "%s/%s", IFACE_DIR, primary_iface);
- } else {
- strlcpy(path, primary_iface, sizeof(path));
- }
return wifi_connect_on_socket_path(PRIMARY, path);
} else {
- sprintf(path, "%s/%s", CONTROL_IFACE_PATH, ifname);
return wifi_connect_on_socket_path(SECONDARY, path);
}
}
--- frameworks/base/core/jni/android_net_TrafficStats.cpp
+++ frameworks/base/core/jni/android_net_TrafficStats.cpp
@@ -120,6 +120,16 @@ static int parseIfaceStat(const char* iface, struct IfaceStat* stat) {
}
static uint64_t getIfaceStatType(const char* iface, IfaceStatType type) {
+ char filename[80];
+ switch (type) {
+ case RX_PACKETS:
+ snprintf(filename, sizeof(filename), "/sys/class/net/%s/statistics/rx_packets", iface);
+ return readNumber(filename);
+ case TX_PACKETS:
+ snprintf(filename, sizeof(filename), "/sys/class/net/%s/statistics/tx_packets", iface);
+ return readNumber(filename);
+ }
+
struct IfaceStat stat;
memset(&stat, 0, sizeof(IfaceStat));
--- frameworks/base/wifi/java/android/net/wifi/WifiMonitor.java
+++ frameworks/base/wifi/java/android/net/wifi/WifiMonitor.java
@@ -481,8 +481,8 @@ public class WifiMonitor {
if (mWifiNative.connectToSupplicant()) {
return true;
}
- if (connectTries++ < 5) {
- nap(1);
+ if (connectTries++ < 25) {
+ nap(200);
} else {
break;
}
@@ -744,9 +744,9 @@ public class WifiMonitor {
* Sleep for a period of time.
* @param secs the number of seconds to sleep
*/
- private static void nap(int secs) {
+ private static void nap(int msecs) {
try {
- Thread.sleep(secs * 1000);
+ Thread.sleep(msecs);
} catch (InterruptedException ignore) {
}
}
--- frameworks/base/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
+++ frameworks/base/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
@@ -17,6 +17,7 @@ package com.android.internal.policy.impl;
import android.app.ActivityManager;
import android.app.ActivityManagerNative;
+import android.app.IActivityManager;
import android.app.IUiModeManager;
import android.app.ProgressDialog;
import android.app.SearchManager;
@@ -1053,16 +1054,16 @@ public class PhoneWindowManager implements WindowManagerPolicy {
* DisplayMetrics.DENSITY_DEFAULT
/ DisplayMetrics.DENSITY_DEVICE;
- if (shortSizeDp < 600) {
- // 0-599dp: "phone" UI with a separate status & navigation bar
+ if (shortSizeDp < 360) {
+ // 0-359: "phone" UI with a separate status & navigation bar
mHasSystemNavBar = false;
mNavigationBarCanMove = true;
- } else if (shortSizeDp < 720) {
- // 600-719dp: "phone" UI with modifications for larger screens
+ } else if (shortSizeDp < 480) {
+ // 360-480: "phone" UI with modifications for larger screens
mHasSystemNavBar = false;
mNavigationBarCanMove = false;
} else {
- // 720dp: "tablet" UI with a single combined status & navigation bar
+ // 480dp: "tablet" UI with a single combined status & navigation bar
mHasSystemNavBar = true;
mNavigationBarCanMove = false;
}
@@ -3809,7 +3810,9 @@ public class PhoneWindowManager implements WindowManagerPolicy {
synchronized (mLock) {
int sensorRotation = mOrientationListener.getProposedRotation(); // may be -1
if (sensorRotation < 0) {
- sensorRotation = lastRotation;
+ if (mLandscapeRotation >= 0) {
+ sensorRotation = mLandscapeRotation;
+ }
}
final int preferredRotation;
@@ -4297,7 +4300,24 @@ public class PhoneWindowManager implements WindowManagerPolicy {
* goes to the home screen
* @return whether it did anything
*/
+ int mKillProcessPid = 0;
boolean goHome() {
+ mKillProcessPid = 0;
+ try {
+ IActivityManager mgr = ActivityManagerNative.getDefault();
+ java.util.List<android.app.ActivityManager.RunningAppProcessInfo> apps = mgr.getRunningAppProcesses();
+ for (android.app.ActivityManager.RunningAppProcessInfo appInfo : apps) {
+ int uid = appInfo.uid;
+ // Make sure it's a foreground user application (not system, root, phone, etc.)
+ if (uid >= android.os.Process.FIRST_APPLICATION_UID && uid <= android.os.Process.LAST_APPLICATION_UID
+ && appInfo.importance == android.app.ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREGROUND) {
+ mKillProcessPid = appInfo.pid;
+ break;
+ }
+ }
+ } catch (RemoteException remoteException) {
+ }
+
if (false) {
// This code always brings home to the front.
try {
@@ -4342,6 +4362,19 @@ public class PhoneWindowManager implements WindowManagerPolicy {
// bummer, the activity manager, which is in this process, is dead
}
}
+ if (mKillProcessPid > 0) {
+ mHandler.post(new Runnable() {
+ public void run() {
+ if (mKillProcessPid > 0) {
+ performHapticFeedbackLw(null, HapticFeedbackConstants.LONG_PRESS, false);
+ // Kill the entire pid
+ //android.widget.Toast.makeText(mContext, R.string.app_killed_message, android.widget.Toast.LENGTH_SHORT).show();
+ android.os.Process.killProcess(mKillProcessPid);
+ }
+ }
+ });
+ }
+
return true;
}
--- frameworks/base/services/java/com/android/server/wm/WindowManagerService.java
+++ frameworks/base/services/java/com/android/server/wm/WindowManagerService.java
@@ -6405,8 +6405,13 @@ public class WindowManagerService extends IWindowManager.Stub
sl = reduceConfigLayout(sl, Surface.ROTATION_90, density, unrotDh, unrotDw);
sl = reduceConfigLayout(sl, Surface.ROTATION_180, density, unrotDw, unrotDh);
sl = reduceConfigLayout(sl, Surface.ROTATION_270, density, unrotDh, unrotDw);
- outConfig.smallestScreenWidthDp = (int)(mSmallestDisplayWidth / density);
- outConfig.screenLayout = sl;
+ int sw = (int)(mSmallestDisplayWidth / density);
+ outConfig.smallestScreenWidthDp = ((sw >= 480) && (sw < 720)) ? 720 :
+ ((sw >= 360) && (sw < 480)) ? 600 : sw;
+ outConfig.screenLayout = ((sw >= 360) && ((sl & Configuration.SCREENLAYOUT_SIZE_MASK) <
+ Configuration.SCREENLAYOUT_SIZE_LARGE)) ?
+ ((sl & ~Configuration.SCREENLAYOUT_SIZE_MASK) |
+ Configuration.SCREENLAYOUT_SIZE_LARGE) : sl;
}
private int reduceCompatConfigWidthSize(int curSize, int rotation, DisplayMetrics dm,
--- frameworks/base/core/java/com/android/internal/view/RotationPolicy.java
+++ frameworks/base/core/java/com/android/internal/view/RotationPolicy.java
@@ -24,6 +24,7 @@ import android.os.Handler;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.provider.Settings;
+import android.util.DisplayMetrics;
import android.util.Log;
import android.view.IWindowManager;
import android.view.Surface;
@@ -111,7 +112,11 @@ public final class RotationPolicy {
IWindowManager wm = IWindowManager.Stub.asInterface(
ServiceManager.getService(Context.WINDOW_SERVICE));
if (enabled) {
- wm.freezeRotation(Surface.ROTATION_0);
+ if (DisplayMetrics.DENSITY_DEVICE > 160) {
+ wm.freezeRotation(Surface.ROTATION_0);
+ } else {
+ wm.freezeRotation(Surface.ROTATION_90);
+ }
} else {
wm.thawRotation();
}
--- frameworks/base/core/java/android/provider/Settings.java
+++ frameworks/base/core/java/android/provider/Settings.java
@@ -1180,7 +1180,7 @@ public final class Settings {
* END_BUTTON_BEHAVIOR default value.
* @hide
*/
- public static final int END_BUTTON_BEHAVIOR_DEFAULT = END_BUTTON_BEHAVIOR_SLEEP;
+ public static final int END_BUTTON_BEHAVIOR_DEFAULT = END_BUTTON_BEHAVIOR_HOME | END_BUTTON_BEHAVIOR_SLEEP;
/**
* Is advanced settings mode turned on. 0 == no, 1 == yes
--- frameworks/base/core/res/res/values/strings.xml
+++ frameworks/base/core/res/res/values/strings.xml
@@ -3592,4 +3592,7 @@
<!-- "Done" button for MediaRouter chooser dialog when grouping routes. [CHAR LIMIT=NONE] -->
<string name="media_route_chooser_grouping_done">Done</string>
+
+ <!--Application killed toast -->
+ <string name="app_killed_message" translatable="false">Application killed</string>
</resources>
--- frameworks/base/services/java/com/android/server/am/ActivityManagerService.java
+++ frameworks/base/services/java/com/android/server/am/ActivityManagerService.java
@@ -267,7 +267,7 @@ public final class ActivityManagerService extends ActivityManagerNative
static final int MAX_SERVICE_INACTIVITY = 30*60*1000;
// How long we wait until we timeout on key dispatching.
- static final int KEY_DISPATCHING_TIMEOUT = 5*1000;
+ static final int KEY_DISPATCHING_TIMEOUT = 30*1000;
// How long we wait until we timeout on key dispatching during instrumentation.
static final int INSTRUMENTATION_KEY_DISPATCHING_TIMEOUT = 60*1000;
--- packages/apps/Launcher2/res/layout-sw720dp/workspace.xml
+++ packages/apps/Launcher2/res/layout-sw720dp/workspace.xml
@@ -24,6 +24,8 @@
android:paddingTop="@dimen/workspace_top_padding"
android:paddingBottom="@dimen/workspace_bottom_padding"
launcher:defaultScreen="2"
+ launcher:cellCountX="@integer/cell_count_x"
+ launcher:cellCountY="@integer/cell_count_y"
launcher:pageSpacing="@dimen/workspace_page_spacing">
<include android:id="@+id/cell1" layout="@layout/workspace_screen" />
<include android:id="@+id/cell2" layout="@layout/workspace_screen" />
--- packages/apps/Launcher2/res/layout-sw720dp/workspace_nograd.xml
+++ packages/apps/Launcher2/res/layout-sw720dp/workspace_nograd.xml
@@ -24,6 +24,8 @@
android:paddingTop="@dimen/workspace_top_padding"
android:paddingBottom="@dimen/workspace_bottom_padding"
launcher:defaultScreen="2"
+ launcher:cellCountX="@integer/cell_count_x"
+ launcher:cellCountY="@integer/cell_count_y"
launcher:pageSpacing="@dimen/workspace_page_spacing">
<include android:id="@+id/cell1" layout="@layout/workspace_screen" />
<include android:id="@+id/cell2" layout="@layout/workspace_screen" />
--- packages/apps/Launcher2/res/layout-sw720dp/workspace_1.xml
+++ packages/apps/Launcher2/res/layout-sw720dp/workspace_1.xml
@@ -24,6 +24,8 @@
android:paddingTop="@dimen/workspace_top_padding"
android:paddingBottom="@dimen/workspace_bottom_padding"
launcher:defaultScreen="0"
+ launcher:cellCountX="@integer/cell_count_x"
+ launcher:cellCountY="@integer/cell_count_y"
launcher:pageSpacing="@dimen/workspace_page_spacing">
<include android:id="@id/cell1" layout="@layout/workspace_screen" />
-</com.android.launcher2.Workspace>
\ No newline at end of file
+</com.android.launcher2.Workspace>
--- packages/apps/Launcher2/res/layout-sw720dp/workspace_1_nograd.xml
+++ packages/apps/Launcher2/res/layout-sw720dp/workspace_1_nograd.xml
@@ -24,6 +24,8 @@
android:paddingTop="@dimen/workspace_top_padding"
android:paddingBottom="@dimen/workspace_bottom_padding"
launcher:defaultScreen="0"
+ launcher:cellCountX="@integer/cell_count_x"
+ launcher:cellCountY="@integer/cell_count_y"
launcher:pageSpacing="@dimen/workspace_page_spacing">
<include android:id="@id/cell1" layout="@layout/workspace_screen" />
-</com.android.launcher2.Workspace>
\ No newline at end of file
+</com.android.launcher2.Workspace>
--- packages/apps/Launcher2/res/layout-sw720dp/workspace_3.xml
+++ packages/apps/Launcher2/res/layout-sw720dp/workspace_3.xml
@@ -24,8 +24,10 @@
android:paddingTop="@dimen/workspace_top_padding"
android:paddingBottom="@dimen/workspace_bottom_padding"
launcher:defaultScreen="1"
+ launcher:cellCountX="@integer/cell_count_x"
+ launcher:cellCountY="@integer/cell_count_y"
launcher:pageSpacing="@dimen/workspace_page_spacing">
<include android:id="@id/cell1" layout="@layout/workspace_screen" />
<include android:id="@id/cell2" layout="@layout/workspace_screen" />
<include android:id="@id/cell3" layout="@layout/workspace_screen" />
-</com.android.launcher2.Workspace>
\ No newline at end of file
+</com.android.launcher2.Workspace>
--- packages/apps/Launcher2/res/layout-sw720dp/workspace_3_nograd.xml
+++ packages/apps/Launcher2/res/layout-sw720dp/workspace_3_nograd.xml
@@ -24,8 +24,10 @@
android:paddingTop="@dimen/workspace_top_padding"
android:paddingBottom="@dimen/workspace_bottom_padding"
launcher:defaultScreen="1"
+ launcher:cellCountX="@integer/cell_count_x"
+ launcher:cellCountY="@integer/cell_count_y"
launcher:pageSpacing="@dimen/workspace_page_spacing">
<include android:id="@id/cell1" layout="@layout/workspace_screen" />
<include android:id="@id/cell2" layout="@layout/workspace_screen" />
<include android:id="@id/cell3" layout="@layout/workspace_screen" />
-</com.android.launcher2.Workspace>
\ No newline at end of file
+</com.android.launcher2.Workspace>
--- packages/apps/Launcher2/res/layout-sw720dp/workspace_5.xml
+++ packages/apps/Launcher2/res/layout-sw720dp/workspace_5.xml
@@ -24,10 +24,12 @@
android:paddingTop="@dimen/workspace_top_padding"
android:paddingBottom="@dimen/workspace_bottom_padding"
launcher:defaultScreen="2"
+ launcher:cellCountX="@integer/cell_count_x"
+ launcher:cellCountY="@integer/cell_count_y"
launcher:pageSpacing="@dimen/workspace_page_spacing">
<include android:id="@id/cell1" layout="@layout/workspace_screen" />
<include android:id="@id/cell2" layout="@layout/workspace_screen" />
<include android:id="@id/cell3" layout="@layout/workspace_screen" />
<include android:id="@id/cell4" layout="@layout/workspace_screen" />
<include android:id="@id/cell5" layout="@layout/workspace_screen" />
-</com.android.launcher2.Workspace>
\ No newline at end of file
+</com.android.launcher2.Workspace>
--- packages/apps/Launcher2/res/layout-sw720dp/workspace_5_nograd.xml
+++ packages/apps/Launcher2/res/layout-sw720dp/workspace_5_nograd.xml
@@ -24,10 +24,12 @@
android:paddingTop="@dimen/workspace_top_padding"
android:paddingBottom="@dimen/workspace_bottom_padding"
launcher:defaultScreen="2"
+ launcher:cellCountX="@integer/cell_count_x"
+ launcher:cellCountY="@integer/cell_count_y"
launcher:pageSpacing="@dimen/workspace_page_spacing">
<include android:id="@id/cell1" layout="@layout/workspace_screen" />
<include android:id="@id/cell2" layout="@layout/workspace_screen" />
<include android:id="@id/cell3" layout="@layout/workspace_screen" />
<include android:id="@id/cell4" layout="@layout/workspace_screen" />
<include android:id="@id/cell5" layout="@layout/workspace_screen" />
-</com.android.launcher2.Workspace>
\ No newline at end of file
+</com.android.launcher2.Workspace>
--- packages/apps/Launcher2/res/layout-sw720dp/workspace_7.xml
+++ packages/apps/Launcher2/res/layout-sw720dp/workspace_7.xml
@@ -24,6 +24,8 @@
android:paddingTop="@dimen/workspace_top_padding"
android:paddingBottom="@dimen/workspace_bottom_padding"
launcher:defaultScreen="3"
+ launcher:cellCountX="@integer/cell_count_x"
+ launcher:cellCountY="@integer/cell_count_y"
launcher:pageSpacing="@dimen/workspace_page_spacing">
<include android:id="@id/cell1" layout="@layout/workspace_screen" />
<include android:id="@id/cell2" layout="@layout/workspace_screen" />
@@ -32,4 +34,4 @@
<include android:id="@id/cell5" layout="@layout/workspace_screen" />
<include android:id="@id/cell6" layout="@layout/workspace_screen" />
<include android:id="@id/cell7" layout="@layout/workspace_screen" />
-</com.android.launcher2.Workspace>
\ No newline at end of file
+</com.android.launcher2.Workspace>
--- packages/apps/Launcher2/res/layout-sw720dp/workspace_7_nograd.xml
+++ packages/apps/Launcher2/res/layout-sw720dp/workspace_7_nograd.xml
@@ -24,6 +24,8 @@
android:paddingTop="@dimen/workspace_top_padding"
android:paddingBottom="@dimen/workspace_bottom_padding"
launcher:defaultScreen="3"
+ launcher:cellCountX="@integer/cell_count_x"
+ launcher:cellCountY="@integer/cell_count_y"
launcher:pageSpacing="@dimen/workspace_page_spacing">
<include android:id="@id/cell1" layout="@layout/workspace_screen" />
<include android:id="@id/cell2" layout="@layout/workspace_screen" />
@@ -32,4 +34,4 @@
<include android:id="@id/cell5" layout="@layout/workspace_screen" />
<include android:id="@id/cell6" layout="@layout/workspace_screen" />
<include android:id="@id/cell7" layout="@layout/workspace_screen" />
-</com.android.launcher2.Workspace>
\ No newline at end of file
+</com.android.launcher2.Workspace>
--- packages/apps/Launcher2/res/values-sw720dp/config.xml
+++ packages/apps/Launcher2/res/values-sw720dp/config.xml
@@ -1,6 +1,8 @@
<resources>
<bool name="config_largeHeap">true</bool>
<bool name="is_large_screen">true</bool>
+ <integer name="cell_count_x">7</integer>
+ <integer name="cell_count_y">4</integer>
<!-- AllApps/Customize/AppsCustomize -->
<!-- Out of 100, the percent to shrink the workspace during spring loaded mode. -->
--- frameworks/base/core/res/res/values/config.xml
+++ frameworks/base/core/res/res/values/config.xml
@@ -387,7 +387,7 @@
<!-- Indicate whether closing the lid causes the device to go to sleep and opening
it causes the device to wake up.
The default is false. -->
- <bool name="config_lidControlsSleep">false</bool>
+ <bool name="config_lidControlsSleep">true</bool>
<!-- Control the behavior when the user long presses the power button.
0 - Nothing
--- frameworks/base/data/fonts/fallback_fonts.xml
+++ frameworks/base/data/fonts/fallback_fonts.xml
@@ -101,12 +101,12 @@
</family>
<family>
<fileset>
- <file>DroidSansFallback.ttf</file>
+ <file>MTLmr3m.ttf</file>
</fileset>
</family>
<family>
<fileset>
- <file>MTLmr3m.ttf</file>
+ <file>DroidSansFallback.ttf</file>
</fileset>
</family>
</familyset>
--- kernel/deckard/arch/arm/configs/deckard_defconfig
+++ kernel/deckard/arch/arm/configs/deckard_defconfig
@@ -35,7 +35,7 @@
CONFIG_INIT_ENV_ARG_LIMIT=32
CONFIG_LOCALVERSION="$(KERNEL_LOCAL_VERSION)-perf"
# CONFIG_LOCALVERSION_AUTO is not set
-# CONFIG_SWAP is not set
+CONFIG_SWAP=y
CONFIG_SYSVIPC=y
CONFIG_SYSVIPC_SYSCTL=y
# CONFIG_POSIX_MQUEUE is not set
@@ -184,6 +184,8 @@
CONFIG_MACH_QSD8X50_COMET=y
CONFIG_MACH_DECKARD=y
CONFIG_MSM_STACKED_MEMORY=y
+CONFIG_KERNEL_PMEM_SMI_REGION=y
+# CONFIG_PMEM_GPU0 is not set
CONFIG_MSM_DEBUG_UART_NONE=y
# CONFIG_MSM_DEBUG_UART1 is not set
# CONFIG_MSM_DEBUG_UART2 is not set
@@ -299,10 +301,10 @@
CONFIG_NO_HZ=y
CONFIG_HIGH_RES_TIMERS=y
CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
-# CONFIG_VMSPLIT_3G is not set
-CONFIG_VMSPLIT_2G=y
+CONFIG_VMSPLIT_3G=y
+# CONFIG_VMSPLIT_2G is not set
# CONFIG_VMSPLIT_1G is not set
-CONFIG_PAGE_OFFSET=0x80000000
+CONFIG_PAGE_OFFSET=0xC0000000
CONFIG_PREEMPT=y
CONFIG_HZ=100
CONFIG_AEABI=y
@@ -391,8 +393,8 @@
CONFIG_USER_WAKELOCK=y
CONFIG_EARLYSUSPEND=y
# CONFIG_NO_USER_SPACE_SCREEN_ACCESS_CONTROL is not set
-CONFIG_CONSOLE_EARLYSUSPEND=y
-# CONFIG_FB_EARLYSUSPEND is not set
+# CONFIG_CONSOLE_EARLYSUSPEND is not set
+CONFIG_FB_EARLYSUSPEND=y
# CONFIG_APM_EMULATION is not set
CONFIG_ARCH_SUSPEND_POSSIBLE=y
CONFIG_NET=y
@@ -428,7 +430,24 @@
CONFIG_TCP_CONG_CUBIC=y
CONFIG_DEFAULT_TCP_CONG="cubic"
# CONFIG_TCP_MD5SIG is not set
-# CONFIG_IPV6 is not set
+CONFIG_IPV6=y
+# CONFIG_IPV6_PRIVACY is not set
+# CONFIG_IPV6_ROUTER_PREF is not set
+# CONFIG_IPV6_OPTIMISTIC_DAD is not set
+# CONFIG_INET6_AH is not set
+# CONFIG_INET6_ESP is not set
+# CONFIG_INET6_IPCOMP is not set
+# CONFIG_IPV6_MIP6 is not set
+# CONFIG_INET6_XFRM_TUNNEL is not set
+# CONFIG_INET6_TUNNEL is not set
+# CONFIG_INET6_XFRM_MODE_TRANSPORT is not set
+# CONFIG_INET6_XFRM_MODE_TUNNEL is not set
+# CONFIG_INET6_XFRM_MODE_BEET is not set
+# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set
+# CONFIG_IPV6_SIT is not set
+# CONFIG_IPV6_TUNNEL is not set
+# CONFIG_IPV6_MULTIPLE_TABLES is not set
+# CONFIG_IPV6_MROUTE is not set
# CONFIG_NETLABEL is not set
CONFIG_ANDROID_PARANOID_NETWORK=y
# CONFIG_NETWORK_SECMARK is not set
@@ -480,19 +499,14 @@
#
# CONFIG_NF_DEFRAG_IPV4 is not set
# CONFIG_IP_NF_QUEUE is not set
-CONFIG_IP_NF_IPTABLES=y
-# CONFIG_IP_NF_MATCH_ADDRTYPE is not set
-# CONFIG_IP_NF_MATCH_AH is not set
-# CONFIG_IP_NF_MATCH_ECN is not set
-# CONFIG_IP_NF_MATCH_TTL is not set
-CONFIG_IP_NF_FILTER=y
-# CONFIG_IP_NF_TARGET_REJECT is not set
-# CONFIG_IP_NF_TARGET_LOG is not set
-# CONFIG_IP_NF_TARGET_ULOG is not set
-# CONFIG_IP_NF_MANGLE is not set
-# CONFIG_IP_NF_RAW is not set
-# CONFIG_IP_NF_SECURITY is not set
+# CONFIG_IP_NF_IPTABLES is not set
# CONFIG_IP_NF_ARPTABLES is not set
+
+#
+# IPv6: Netfilter Configuration
+#
+# CONFIG_IP6_NF_QUEUE is not set
+# CONFIG_IP6_NF_IPTABLES is not set
# CONFIG_IP_DCCP is not set
# CONFIG_IP_SCTP is not set
# CONFIG_TIPC is not set
@@ -602,6 +616,8 @@
# CONFIG_DEBUG_DRIVER is not set
# CONFIG_DEBUG_DEVRES is not set
# CONFIG_SYS_HYPERVISOR is not set
+CONFIG_GENLOCK=y
+CONFIG_GENLOCK_MISCDEVICE=y
# CONFIG_CONNECTOR is not set
CONFIG_MTD=y
# CONFIG_MTD_DEBUG is not set
@@ -767,7 +783,17 @@
# CONFIG_SCSI_DEBUG is not set
# CONFIG_SCSI_DH is not set
# CONFIG_ATA is not set
-# CONFIG_MD is not set
+CONFIG_MD=y
+# CONFIG_BLK_DEV_MD is not set
+CONFIG_BLK_DEV_DM=y
+# CONFIG_DM_DEBUG is not set
+CONFIG_DM_CRYPT=y
+# CONFIG_DM_SNAPSHOT is not set
+# CONFIG_DM_MIRROR is not set
+# CONFIG_DM_ZERO is not set
+# CONFIG_DM_MULTIPATH is not set
+# CONFIG_DM_DELAY is not set
+CONFIG_DM_UEVENT=y
CONFIG_NETDEVICES=y
CONFIG_DUMMY=y
# CONFIG_BONDING is not set
@@ -910,8 +936,8 @@
CONFIG_VT_CONSOLE=y
CONFIG_HW_CONSOLE=y
# CONFIG_VT_HW_CONSOLE_BINDING is not set
-# CONFIG_DEVMEM is not set
-# CONFIG_DEVKMEM is not set
+CONFIG_DEVMEM=y
+CONFIG_DEVKMEM=y
# CONFIG_SERIAL_NONSTANDARD is not set
#
@@ -943,8 +969,6 @@
# CONFIG_TCG_TPM is not set
# CONFIG_DCC_TTY is not set
CONFIG_Q6_VENC=y
-CONFIG_MSM_KGSL=y
-CONFIG_MSM_KGSL_DRM=y
CONFIG_MSM_Q6VDEC=y
CONFIG_I2C=y
CONFIG_I2C_BOARDINFO=y
@@ -1097,8 +1121,6 @@
# CONFIG_MT9T013 is not set
CONFIG_MT9D112=y
# CONFIG_MT9P012 is not set
-# CONFIG_MSM_CAMERA_AF_FOXCONN is not set
-# CONFIG_MSM_CAMERA_AF_BAM is not set
# CONFIG_S5K3E2FX is not set
# CONFIG_VB6801 is not set
# CONFIG_MSM_CAMERA_FLASH is not set
@@ -1113,6 +1135,17 @@
# CONFIG_DRM_MGA is not set
# CONFIG_DRM_VIA is not set
# CONFIG_DRM_SAVAGE is not set
+CONFIG_MSM_KGSL=y
+# CONFIG_MSM_KGSL_CFF_DUMP is not set
+# CONFIG_MSM_KGSL_PSTMRTMDMP_CP_STAT_NO_DETAIL is not set
+# CONFIG_MSM_KGSL_PSTMRTMDMP_NO_IB_DUMP is not set
+# CONFIG_MSM_KGSL_PSTMRTMDMP_RB_HEX is not set
+# CONFIG_MSM_KGSL_DRM is not set
+CONFIG_KGSL_PER_PROCESS_PAGE_TABLE=y
+CONFIG_MSM_KGSL_PAGE_TABLE_SIZE=0xFFF0000
+CONFIG_MSM_KGSL_PAGE_TABLE_COUNT=8
+CONFIG_MSM_KGSL_MMU_PAGE_FAULT=y
+# CONFIG_MSM_KGSL_DISABLE_SHADOW_WRITES is not set
# CONFIG_VGASTATE is not set
CONFIG_VIDEO_OUTPUT_CONTROL=y
CONFIG_FB=y
@@ -1205,12 +1238,7 @@
#
# CONFIG_VGA_CONSOLE is not set
CONFIG_DUMMY_CONSOLE=y
-CONFIG_FRAMEBUFFER_CONSOLE=y
-# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set
-# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
-# CONFIG_FONTS is not set
-CONFIG_FONT_8x8=y
-CONFIG_FONT_8x16=y
+# CONFIG_FRAMEBUFFER_CONSOLE is not set
# CONFIG_LOGO is not set
CONFIG_SOUND=y
# CONFIG_SOUND_OSS_CORE is not set
@@ -1286,6 +1314,7 @@
CONFIG_USB_FUNCTION_DIAG=y
CONFIG_USB_FUNCTION_ETHER=y
CONFIG_USB_FUNCTION_SERIAL=y
+# CONFIG_USB_FUNCTION_RMNET is not set
CONFIG_USB_FUNCTION_MDLM=y
CONFIG_USB_FUNCTION_OBEX=y
CONFIG_USB_FUNCTION_MTP=y
@@ -1315,7 +1344,9 @@
CONFIG_MMC_MSM_SDIO_SUPPORT=y
# CONFIG_MMC_MSM_CARD_HW_DETECTION is not set
CONFIG_MMC_MSM_SDC1_SUPPORT=y
+# CONFIG_MMC_MSM_SDC1_8_BIT_SUPPORT is not set
CONFIG_MMC_MSM_SDC2_SUPPORT=y
+# CONFIG_MMC_MSM_SDC2_8_BIT_SUPPORT is not set
# CONFIG_MMC_MSM_SDC3_SUPPORT is not set
# CONFIG_MMC_MSM_SDC4_SUPPORT is not set
# CONFIG_MEMSTICK is not set
@@ -1425,7 +1456,7 @@
CONFIG_ANDROID_TIMED_OUTPUT=y
CONFIG_ANDROID_TIMED_GPIO=y
CONFIG_ANDROID_LOW_MEMORY_KILLER=y
-# CONFIG_ANDROID_ENGINEERING is not set
+CONFIG_ANDROID_ENGINEERING=y
#
# File systems
@@ -1439,9 +1470,15 @@
CONFIG_EXT3_FS_XATTR=y
# CONFIG_EXT3_FS_POSIX_ACL is not set
# CONFIG_EXT3_FS_SECURITY is not set
-# CONFIG_EXT4_FS is not set
+CONFIG_EXT4_FS=y
+# CONFIG_EXT4DEV_COMPAT is not set
+CONFIG_EXT4_FS_XATTR=y
+# CONFIG_EXT4_FS_POSIX_ACL is not set
+# CONFIG_EXT4_FS_SECURITY is not set
CONFIG_JBD=y
# CONFIG_JBD_DEBUG is not set
+CONFIG_JBD2=y
+# CONFIG_JBD2_DEBUG is not set
CONFIG_FS_MBCACHE=y
# CONFIG_REISERFS_FS is not set
# CONFIG_JFS_FS is not set
@@ -1504,7 +1541,12 @@
# CONFIG_YAFFS_ALWAYS_CHECK_CHUNK_ERASED is not set
CONFIG_YAFFS_SHORT_NAMES_IN_RAM=y
# CONFIG_JFFS2_FS is not set
-# CONFIG_UBIFS_FS is not set
+CONFIG_UBIFS_FS=y
+CONFIG_UBIFS_FS_XATTR=y
+# CONFIG_UBIFS_FS_ADVANCED_COMPR is not set
+CONFIG_UBIFS_FS_LZO=y
+CONFIG_UBIFS_FS_ZLIB=y
+# CONFIG_UBIFS_FS_DEBUG is not set
# CONFIG_CRAMFS is not set
# CONFIG_SQUASHFS is not set
# CONFIG_VXFS_FS is not set
@@ -1664,9 +1706,7 @@
# CONFIG_SECURITY_NETWORK is not set
CONFIG_SECURITY_PATH=y
# CONFIG_SECURITY_FILE_CAPABILITIES is not set
-CONFIG_SECURITY_DECKARD=y
-CONFIG_SECURITY_DECKARD_SYSTEM_DEV_PATH="/dev/block/mtdblock5"
-CONFIG_SECURITY_DECKARD_CHROOT_PATH=""
+# CONFIG_SECURITY_DECKARD is not set
CONFIG_CRYPTO=y
#
@@ -1675,10 +1715,14 @@
# CONFIG_CRYPTO_FIPS is not set
CONFIG_CRYPTO_ALGAPI=y
CONFIG_CRYPTO_ALGAPI2=y
+CONFIG_CRYPTO_AEAD2=y
+CONFIG_CRYPTO_BLKCIPHER=y
+CONFIG_CRYPTO_BLKCIPHER2=y
CONFIG_CRYPTO_HASH=y
CONFIG_CRYPTO_HASH2=y
-# CONFIG_CRYPTO_MANAGER is not set
-# CONFIG_CRYPTO_MANAGER2 is not set
+CONFIG_CRYPTO_RNG2=y
+CONFIG_CRYPTO_MANAGER=y
+CONFIG_CRYPTO_MANAGER2=y
# CONFIG_CRYPTO_GF128MUL is not set
# CONFIG_CRYPTO_NULL is not set
# CONFIG_CRYPTO_CRYPTD is not set
@@ -1695,10 +1739,10 @@
#
# Block modes
#
-# CONFIG_CRYPTO_CBC is not set
+CONFIG_CRYPTO_CBC=y
# CONFIG_CRYPTO_CTR is not set
# CONFIG_CRYPTO_CTS is not set
-# CONFIG_CRYPTO_ECB is not set
+CONFIG_CRYPTO_ECB=y
# CONFIG_CRYPTO_LRW is not set
# CONFIG_CRYPTO_PCBC is not set
# CONFIG_CRYPTO_XTS is not set
@@ -1720,7 +1764,7 @@
# CONFIG_CRYPTO_RMD160 is not set
# CONFIG_CRYPTO_RMD256 is not set
# CONFIG_CRYPTO_RMD320 is not set
-# CONFIG_CRYPTO_SHA1 is not set
+CONFIG_CRYPTO_SHA1=y
CONFIG_CRYPTO_SHA256=y
# CONFIG_CRYPTO_SHA512 is not set
# CONFIG_CRYPTO_TGR192 is not set
@@ -1731,7 +1775,7 @@
#
# CONFIG_CRYPTO_AES is not set
# CONFIG_CRYPTO_ANUBIS is not set
-# CONFIG_CRYPTO_ARC4 is not set
+CONFIG_CRYPTO_ARC4=y
# CONFIG_CRYPTO_BLOWFISH is not set
# CONFIG_CRYPTO_CAMELLIA is not set
# CONFIG_CRYPTO_CAST5 is not set
@@ -1743,7 +1787,8 @@
# CONFIG_CRYPTO_SEED is not set
# CONFIG_CRYPTO_SERPENT is not set
# CONFIG_CRYPTO_TEA is not set
-# CONFIG_CRYPTO_TWOFISH is not set
+CONFIG_CRYPTO_TWOFISH=y
+CONFIG_CRYPTO_TWOFISH_COMMON=y
#
# Compression
--- kernel/deckard/Makefile
+++ kernel/deckard/Makefile
@@ -346,7 +346,6 @@
KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
-fno-strict-aliasing -fno-common \
- -Werror \
-Werror-implicit-function-declaration
KBUILD_AFLAGS := -D__ASSEMBLY__
--- kernel/deckard/arch/arm/mm/proc-macros.S
+++ kernel/deckard/arch/arm/mm/proc-macros.S
@@ -61,17 +61,27 @@
.endm
/*
- * cache_line_size - get the cache line size from the CSIDR register
- * (available on ARMv7+). It assumes that the CSSR register was configured
- * to access the L1 data cache CSIDR.
+ * dcache_line_size - get the minimum D-cache line size from the CTR register
+ * on ARMv7.
*/
.macro dcache_line_size, reg, tmp
- mrc p15, 1, \tmp, c0, c0, 0 @ read CSIDR
- and \tmp, \tmp, #7 @ cache line size encoding
- mov \reg, #16 @ size offset
+ mrc p15, 0, \tmp, c0, c0, 1 @ read ctr
+ lsr \tmp, \tmp, #16
+ and \tmp, \tmp, #0xf @ cache line size encoding
+ mov \reg, #4 @ bytes per word
mov \reg, \reg, lsl \tmp @ actual cache line size
.endm
+/*
+ * icache_line_size - get the minimum I-cache line size from the CTR register
+ * on ARMv7.
+ */
+ .macro icache_line_size, reg, tmp
+ mrc p15, 0, \tmp, c0, c0, 1 @ read ctr
+ and \tmp, \tmp, #0xf @ cache line size encoding
+ mov \reg, #4 @ bytes per word
+ mov \reg, \reg, lsl \tmp @ actual cache line size
+ .endm
/*
* Sanity check the PTE configuration for the code below - which makes
--- kernel/deckard/arch/arm/mm/cache-v7.S
+++ kernel/deckard/arch/arm/mm/cache-v7.S
@@ -149,18 +149,37 @@
ENTRY(v7_coherent_user_range)
dcache_line_size r2, r3
sub r3, r2, #1
- bic r0, r0, r3
-1: mcr p15, 0, r0, c7, c11, 1 @ clean D line to the point of unification
- dsb
- mcr p15, 0, r0, c7, c5, 1 @ invalidate I line
- add r0, r0, r2
- cmp r0, r1
+ bic r12, r0, r3
+1:
+ USER( mcr p15, 0, r12, c7, c11, 1 ) @ clean D line to the point of unification
+ add r12, r12, r2
+ cmp r12, r1
blo 1b
+ dsb
+ icache_line_size r2, r3
+ sub r3, r2, #1
+ bic r12, r0, r3
+2:
+ USER( mcr p15, 0, r12, c7, c5, 1 ) @ invalidate I line
+ add r12, r12, r2
+ cmp r12, r1
+ blo 2b
+3:
mov r0, #0
mcr p15, 0, r0, c7, c5, 6 @ invalidate BTB
dsb
isb
mov pc, lr
+
+/*
+ * Fault handling for the cache operation above. If the virtual address in r0
+ * isn't mapped, just try the next page.
+ */
+9001:
+ mov r12, r12, lsr #12
+ mov r12, r12, lsl #12
+ add r12, r12, #4096
+ b 3b
ENDPROC(v7_coherent_kern_range)
ENDPROC(v7_coherent_user_range)
--- kernel/deckard/arch/arm/include/asm/cacheflush.h
+++ kernel/deckard/arch/arm/include/asm/cacheflush.h
@@ -365,7 +365,7 @@
* Harvard caches are synchronised for the user space address range.
* This is used for the ARM private sys_cacheflush system call.
*/
-#define flush_cache_user_range(vma,start,end) \
+#define flush_cache_user_range(start,end) \
__cpuc_coherent_user_range((start) & PAGE_MASK, PAGE_ALIGN(end))
/*
--- kernel/deckard/arch/arm/kernel/traps.c
+++ kernel/deckard/arch/arm/kernel/traps.c
@@ -424,6 +424,7 @@
static inline void
do_cache_op(unsigned long start, unsigned long end, int flags)
{
+ struct mm_struct *mm = current->active_mm;
struct vm_area_struct *vma;
#ifdef CONFIG_ARCH_MSM_ARM11
@@ -441,15 +442,19 @@
}
#endif
- vma = find_vma(current->active_mm, start);
+ down_read(&mm->mmap_sem);
+ vma = find_vma(mm, start);
if (vma && vma->vm_start < end) {
if (start < vma->vm_start)
start = vma->vm_start;
if (end > vma->vm_end)
end = vma->vm_end;
- flush_cache_user_range(vma, start, end);
+ up_read(&mm->mmap_sem);
+ flush_cache_user_range(start, end);
+ return;
}
+ up_read(&mm->mmap_sem);
}
/*
--- kernel/deckard/arch/arm/mm/fault.c
+++ kernel/deckard/arch/arm/mm/fault.c
@@ -455,7 +455,7 @@
{ do_bad, SIGILL, BUS_ADRALN, "alignment exception" },
{ do_bad, SIGKILL, 0, "terminal exception" },
{ do_bad, SIGILL, BUS_ADRALN, "alignment exception" },
- { do_bad, SIGBUS, 0, "external abort on linefetch" },
+ { do_translation_fault, SIGSEGV, SEGV_MAPERR, "I-cache maintenance fault" },
{ do_translation_fault, SIGSEGV, SEGV_MAPERR, "section translation fault" },
{ do_bad, SIGBUS, 0, "external abort on linefetch" },
{ do_page_fault, SIGSEGV, SEGV_MAPERR, "page translation fault" },
--- kernel/deckard/drivers/char/Makefile
+++ kernel/deckard/drivers/char/Makefile
@@ -121,7 +121,6 @@
obj-$(CONFIG_MSM_Q6VDEC) += msm_q6vdec.o
obj-$(CONFIG_Q6_VENC) += msm_q6venc.o
-obj-$(CONFIG_MSM_KGSL) += msm_kgsl/
# Files generated that shall be removed upon make clean
clean-files := consolemap_deftbl.c defkeymap.c
--- kernel/deckard/drivers/char/Kconfig
+++ kernel/deckard/drivers/char/Kconfig
@@ -1125,20 +1125,6 @@
help
Kernel driver for MSM QDSP6 video encoding.
-config MSM_KGSL
- tristate "MSM 3D Graphics driver"
- default n
- depends on FB && ARM && (ARCH_QSD8X50 || ARCH_MSM7X27 || ARCH_MSM7X30) && !MSM_HW3D
- select GENERIC_ALLOCATOR
- select FW_LOADER
- ---help---
- 3D graphics driver. Required to use hardware accelerated
- OpenGL ES 2.0 and 1.1.
-
-config MSM_KGSL_DRM
- bool "Build a DRM interface for the MSM_KGSL driver"
- depends on MSM_KGSL && DRM
-
source "drivers/s390/char/Kconfig"
config MSM_Q6VDEC
--- kernel/deckard/drivers/video/Kconfig
+++ kernel/deckard/drivers/video/Kconfig
@@ -9,6 +9,8 @@
source "drivers/gpu/drm/Kconfig"
+source "drivers/gpu/msm/Kconfig"
+
config VGASTATE
tristate
default n
--- kernel/deckard/drivers/gpu/Makefile
+++ kernel/deckard/drivers/gpu/Makefile
@@ -1 +1,2 @@
obj-y += drm/
+obj-$(CONFIG_MSM_KGSL) += msm/
--- kernel/deckard/arch/arm/mach-msm/Kconfig
+++ kernel/deckard/arch/arm/mach-msm/Kconfig
@@ -174,6 +174,20 @@
memory. When present this memory bank is used for a high speed
shared memory interface. When not present regular RAM is used.
+config KERNEL_PMEM_SMI_REGION
+ bool "Enable in-kernel PMEM region for SMI"
+ default n
+ depends on ARCH_QSD8X50 && !PMEM_GPU0
+ help
+ Enable the in-kernel PMEM alloator to use SMI memory.
+
+config PMEM_GPU0
+ bool "Enable PMEM GPU0 region"
+ default y
+ depends on ARCH_QSD8X50 && ANDROID_PMEM
+ help
+ Enable the PMEM GPU0 device
+
config MSM_DEBUG_UART
int
default 1 if MSM_DEBUG_UART1
--- kernel/deckard/include/linux/android_pmem.h
+++ kernel/deckard/include/linux/android_pmem.h
@@ -58,6 +58,7 @@
#define PMEM_CLEAN_CACHES _IOW(PMEM_IOCTL_MAGIC, 12, unsigned int)
#define PMEM_INV_CACHES _IOW(PMEM_IOCTL_MAGIC, 13, unsigned int)
+#define PMEM_ALLOCATE_ALIGNED _IOW(PMEM_IOCTL_MAGIC, 15, unsigned int)
struct pmem_region {
unsigned long offset;
unsigned long len;
@@ -69,6 +70,11 @@
unsigned long length;
};
+struct pmem_allocation {
+ unsigned long size;
+ unsigned int align;
+};
+
#ifdef __KERNEL__
int get_pmem_file(unsigned int fd, unsigned long *start, unsigned long *vstart,
unsigned long *end, struct file **filp);
@@ -96,7 +102,7 @@
#define PMEM_MEMTYPE_MASK 0x7
#define PMEM_INVALID_MEMTYPE 0x0
#define PMEM_MEMTYPE_EBI1 0x1
-#define PMEM_MEMTYPE_RESERVED_INVALID1 0x2
+#define PMEM_MEMTYPE_SMI 0x2
#define PMEM_MEMTYPE_RESERVED_INVALID2 0x3
#define PMEM_MEMTYPE_RESERVED_INVALID3 0x4
#define PMEM_MEMTYPE_RESERVED_INVALID4 0x5
@@ -115,6 +121,7 @@
/* kernel api names for board specific data structures */
#define PMEM_KERNEL_EBI1_DATA_NAME "pmem_kernel_ebi1"
+#define PMEM_KERNEL_SMI_DATA_NAME "pmem_kernel_smi"
struct android_pmem_platform_data
{
--- kernel/deckard/include/linux/anon_inodes.h
+++ kernel/deckard/include/linux/anon_inodes.h
@@ -8,6 +8,9 @@
#ifndef _LINUX_ANON_INODES_H
#define _LINUX_ANON_INODES_H
+struct file *anon_inode_getfile(const char *name,
+ const struct file_operations *fops,
+ void *priv, int flags);
int anon_inode_getfd(const char *name, const struct file_operations *fops,
void *priv, int flags);
--- kernel/deckard/include/linux/ashmem.h
+++ kernel/deckard/include/linux/ashmem.h
@@ -44,5 +44,12 @@
#define ASHMEM_UNPIN _IOW(__ASHMEMIOC, 8, struct ashmem_pin)
#define ASHMEM_GET_PIN_STATUS _IO(__ASHMEMIOC, 9)
#define ASHMEM_PURGE_ALL_CACHES _IO(__ASHMEMIOC, 10)
+#define ASHMEM_CACHE_FLUSH_RANGE _IO(__ASHMEMIOC, 11)
+#define ASHMEM_CACHE_CLEAN_RANGE _IO(__ASHMEMIOC, 12)
+#define ASHMEM_CACHE_INV_RANGE _IO(__ASHMEMIOC, 13)
+
+int get_ashmem_file(int fd, struct file **filp, struct file **vm_file,
+ unsigned long *len);
+void put_ashmem_file(struct file *file);
#endif /* _LINUX_ASHMEM_H */
--- kernel/deckard/include/linux/err.h
+++ kernel/deckard/include/linux/err.h
@@ -34,6 +34,11 @@
return IS_ERR_VALUE((unsigned long)ptr);
}
+static inline long __must_check IS_ERR_OR_NULL(const void *ptr)
+{
+ return !ptr || IS_ERR_VALUE((unsigned long)ptr);
+}
+
/**
* ERR_CAST - Explicitly cast an error-valued pointer to another pointer type
* @ptr: The pointer to cast.
--- kernel/deckard/include/linux/idr.h
+++ kernel/deckard/include/linux/idr.h
@@ -106,6 +106,7 @@
int idr_get_new_above(struct idr *idp, void *ptr, int starting_id, int *id);
int idr_for_each(struct idr *idp,
int (*fn)(int id, void *p, void *data), void *data);
+void *idr_get_next(struct idr *idp, int *nextid);
void *idr_replace(struct idr *idp, void *ptr, int id);
void idr_remove(struct idr *idp, int id);
void idr_remove_all(struct idr *idp);
--- kernel/deckard/include/linux/mm.h
+++ kernel/deckard/include/linux/mm.h
@@ -13,6 +13,7 @@
#include <linux/prio_tree.h>
#include <linux/debug_locks.h>
#include <linux/mm_types.h>
+#include <linux/pfn.h>
struct mempolicy;
struct anon_vma;
--- kernel/deckard/include/linux/mod_devicetable.h
+++ kernel/deckard/include/linux/mod_devicetable.h
@@ -454,4 +454,12 @@
#define DMI_MATCH(a, b) { a, b }
+#define PLATFORM_NAME_SIZE 20
+
+struct platform_device_id {
+ char name[PLATFORM_NAME_SIZE];
+ kernel_ulong_t driver_data
+ __attribute__((aligned(sizeof(kernel_ulong_t))));
+};
+
#endif /* LINUX_MOD_DEVICETABLE_H */
--- kernel/deckard/include/linux/of.h
+++ kernel/deckard/include/linux/of.h
@@ -21,6 +21,8 @@
#include <asm/prom.h>
+typedef u32 phandle;
+
/* flag descriptions */
#define OF_DYNAMIC 1 /* node and properties were allocated via kmalloc */
#define OF_DETACHED 2 /* node has been detached from the device tree */
--- kernel/deckard/include/linux/pm.h
+++ kernel/deckard/include/linux/pm.h
@@ -278,6 +278,36 @@
{ .event = PM_EVENT_AUTO_RESUME, })
/**
+ * Device run-time power management status.
+ *
+ * These status labels are used internally by the PM core to indicate the
+ * current status of a device with respect to the PM core operations. They do
+ * not reflect the actual power state of the device or its status as seen by the
+ * driver.
+ *
+ * RPM_ACTIVE Device is fully operational. Indicates that the device
+ * bus type's ->runtime_resume() callback has completed
+ * successfully.
+ *
+ * RPM_SUSPENDED Device bus type's ->runtime_suspend() callback has
+ * completed successfully. The device is regarded as
+ * suspended.
+ *
+ * RPM_RESUMING Device bus type's ->runtime_resume() callback is being
+ * executed.
+ *
+ * RPM_SUSPENDING Device bus type's ->runtime_suspend() callback is being
+ * executed.
+ */
+
+enum rpm_status {
+ RPM_ACTIVE = 0,
+ RPM_RESUMING,
+ RPM_SUSPENDED,
+ RPM_SUSPENDING,
+};
+
+/**
* Device power management states
*
* These state labels are used internally by the PM core to indicate the current
--- kernel/deckard/include/linux/timer.h
+++ kernel/deckard/include/linux/timer.h
@@ -88,6 +88,9 @@
extern int del_timer(struct timer_list * timer);
extern int __mod_timer(struct timer_list *timer, unsigned long expires);
extern int mod_timer(struct timer_list *timer, unsigned long expires);
+extern int mod_timer_pending(struct timer_list *timer, unsigned long expires);
+
+#define TIMER_NOT_PINNED 0
/*
* The jiffies value which is added to now, when there is no timer
--- kernel/deckard/include/linux/tracepoint.h
+++ kernel/deckard/include/linux/tracepoint.h
@@ -34,6 +34,9 @@
#define TPPROTO(args...) args
#define TPARGS(args...) args
+#define TP_PROTO(args...) args
+#define TP_ARGS(args...) args
+
#ifdef CONFIG_TRACEPOINTS
/*
@@ -115,6 +118,138 @@
{ }
#endif /* CONFIG_TRACEPOINTS */
+#define PARAMS(args...) args
+
+#ifndef TRACE_EVENT
+/*
+ * For use with the TRACE_EVENT macro:
+ *
+ * We define a tracepoint, its arguments, its printk format
+ * and its 'fast binay record' layout.
+ *
+ * Firstly, name your tracepoint via TRACE_EVENT(name : the
+ * 'subsystem_event' notation is fine.
+ *
+ * Think about this whole construct as the
+ * 'trace_sched_switch() function' from now on.
+ *
+ *
+ * TRACE_EVENT(sched_switch,
+ *
+ * *
+ * * A function has a regular function arguments
+ * * prototype, declare it via TP_PROTO():
+ * *
+ *
+ * TP_PROTO(struct rq *rq, struct task_struct *prev,
+ * struct task_struct *next),
+ *
+ * *
+ * * Define the call signature of the 'function'.
+ * * (Design sidenote: we use this instead of a
+ * * TP_PROTO1/TP_PROTO2/TP_PROTO3 ugliness.)
+ * *
+ *
+ * TP_ARGS(rq, prev, next),
+ *
+ * *
+ * * Fast binary tracing: define the trace record via
+ * * TP_STRUCT__entry(). You can think about it like a
+ * * regular C structure local variable definition.
+ * *
+ * * This is how the trace record is structured and will
+ * * be saved into the ring buffer. These are the fields
+ * * that will be exposed to user-space in
+ * * /sys/kernel/debug/tracing/events/<*>/format.
+ * *
+ * * The declared 'local variable' is called '__entry'
+ * *
+ * * __field(pid_t, prev_prid) is equivalent to a standard declariton:
+ * *
+ * * pid_t prev_pid;
+ * *
+ * * __array(char, prev_comm, TASK_COMM_LEN) is equivalent to:
+ * *
+ * * char prev_comm[TASK_COMM_LEN];
+ * *
+ *
+ * TP_STRUCT__entry(
+ * __array( char, prev_comm, TASK_COMM_LEN )
+ * __field( pid_t, prev_pid )
+ * __field( int, prev_prio )
+ * __array( char, next_comm, TASK_COMM_LEN )
+ * __field( pid_t, next_pid )
+ * __field( int, next_prio )
+ * ),
+ *
+ * *
+ * * Assign the entry into the trace record, by embedding
+ * * a full C statement block into TP_fast_assign(). You
+ * * can refer to the trace record as '__entry' -
+ * * otherwise you can put arbitrary C code in here.
+ * *
+ * * Note: this C code will execute every time a trace event
+ * * happens, on an active tracepoint.
+ * *
+ *
+ * TP_fast_assign(
+ * memcpy(__entry->next_comm, next->comm, TASK_COMM_LEN);
+ * __entry->prev_pid = prev->pid;
+ * __entry->prev_prio = prev->prio;
+ * memcpy(__entry->prev_comm, prev->comm, TASK_COMM_LEN);
+ * __entry->next_pid = next->pid;
+ * __entry->next_prio = next->prio;
+ * ),
+ *
+ * *
+ * * Formatted output of a trace record via TP_printk().
+ * * This is how the tracepoint will appear under ftrace
+ * * plugins that make use of this tracepoint.
+ * *
+ * * (raw-binary tracing wont actually perform this step.)
+ * *
+ *
+ * TP_printk("task %s:%d [%d] ==> %s:%d [%d]",
+ * __entry->prev_comm, __entry->prev_pid, __entry->prev_prio,
+ * __entry->next_comm, __entry->next_pid, __entry->next_prio),
+ *
+ * );
+ *
+ * This macro construct is thus used for the regular printk format
+ * tracing setup, it is used to construct a function pointer based
+ * tracepoint callback (this is used by programmatic plugins and
+ * can also by used by generic instrumentation like SystemTap), and
+ * it is also used to expose a structured trace record in
+ * /sys/kernel/debug/tracing/events/.
+ *
+ * A set of (un)registration functions can be passed to the variant
+ * TRACE_EVENT_FN to perform any (un)registration work.
+ */
+
+#define DECLARE_EVENT_CLASS(name, proto, args, tstruct, assign, print)
+#define DEFINE_EVENT(template, name, proto, args) \
+ DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
+#define DEFINE_EVENT_PRINT(template, name, proto, args, print) \
+ DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
+#define DEFINE_EVENT_CONDITION(template, name, proto, \
+ args, cond) \
+ DECLARE_TRACE_CONDITION(name, PARAMS(proto), \
+ PARAMS(args), PARAMS(cond))
+
+#define TRACE_EVENT(name, proto, args, struct, assign, print) \
+ DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
+#define TRACE_EVENT_FN(name, proto, args, struct, \
+ assign, print, reg, unreg) \
+ DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
+#define TRACE_EVENT_CONDITION(name, proto, args, cond, \
+ struct, assign, print) \
+ DECLARE_TRACE_CONDITION(name, PARAMS(proto), \
+ PARAMS(args), PARAMS(cond))
+
+#define TRACE_EVENT_FLAGS(event, flag)
+
+#endif /* ifdef TRACE_EVENT (see note above) */
+
/*
* Connect a probe to a tracepoint.
* Internal API, should not be used directly.
--- kernel/deckard/include/linux/wait.h
+++ kernel/deckard/include/linux/wait.h
@@ -378,6 +378,49 @@
} while (0)
/**
+ * wait_io_event_interruptible - sleep until an io condition gets true
+ * @wq: the waitqueue to wait on
+ * @condition: a C expression for the event to wait for
+ *
+ * The process is put to sleep (TASK_INTERRUPTIBLE) until the
+ * @condition evaluates to true or a signal is received.
+ * The @condition is checked each time the waitqueue @wq is woken up.
+ *
+ * wake_up() has to be called after changing any variable that could
+ * change the result of the wait condition.
+ *
+ * The function will return -ERESTARTSYS if it was interrupted by a
+ * signal and 0 if @condition evaluated to true.
+ */
+#define wait_io_event_interruptible(wq, condition) \
+({ \
+ int __ret = 0; \
+ if (!(condition)) \
+ __wait_io_event_interruptible(wq, condition, __ret); \
+ __ret; \
+})
+
+#define __wait_io_event_interruptible_timeout(wq, condition, ret) \
+do { \
+ DEFINE_WAIT(__wait); \
+ \
+ for (;;) { \
+ prepare_to_wait(&wq, &__wait, TASK_INTERRUPTIBLE); \
+ if (condition) \
+ break; \
+ if (!signal_pending(current)) { \
+ ret = io_schedule_timeout(ret); \
+ if (!ret) \
+ break; \
+ continue; \
+ } \
+ ret = -ERESTARTSYS; \
+ break; \
+ } \
+ finish_wait(&wq, &__wait); \
+} while (0)
+
+/**
* wait_event_killable - sleep until a condition gets true
* @wq: the waitqueue to wait on
* @condition: a C expression for the event to wait for
--- kernel/deckard/arch/arm/include/asm/io.h
+++ kernel/deckard/arch/arm/include/asm/io.h
@@ -191,6 +191,9 @@
#define writel(v,c) __raw_writel((__force __u32) \
cpu_to_le32(v),__mem_pci(c))
+#define writel_relaxed(v,c) ((void)__raw_writel((__force u32) \
+ cpu_to_le32(v),__mem_pci(c)))
+
#define writesb(p,d,l) __raw_writesb(__mem_pci(p),d,l)
#define writesw(p,d,l) __raw_writesw(__mem_pci(p),d,l)
#define writesl(p,d,l) __raw_writesl(__mem_pci(p),d,l)
--- kernel/deckard/arch/arm/include/asm/memory.h
+++ kernel/deckard/arch/arm/include/asm/memory.h
@@ -121,6 +121,11 @@
#define __phys_to_pfn(paddr) ((paddr) >> PAGE_SHIFT)
#define __pfn_to_phys(pfn) ((pfn) << PAGE_SHIFT)
+/*
+ * Convert a page to/from a physical address
+ */
+#define phys_to_page(phys) (pfn_to_page(__phys_to_pfn(phys)))
+
#ifndef __ASSEMBLY__
/*
--- kernel/deckard/arch/arm/mach-msm/devices.h
+++ kernel/deckard/arch/arm/mach-msm/devices.h
@@ -74,6 +74,9 @@
extern struct clk msm_clocks_8x50[];
extern unsigned msm_num_clocks_8x50;
+extern struct platform_device msm_kgsl_3d0;
+extern struct platform_device msm_kgsl_2d0;
+extern struct platform_device msm_kgsl_2d1;
void __init msm_fb_register_device(char *name, void *data);
void __init msm_camera_register_device(void *, uint32_t, void *);
--- kernel/deckard/arch/arm/mach-msm/board-deckard.c
+++ kernel/deckard/arch/arm/mach-msm/board-deckard.c
@@ -121,25 +121,24 @@
#define TOUCHPAD_SUSPEND 34
#define TOUCHPAD_IRQ 38
-#define MSM_PMEM_MDP_SIZE 0x2075000
+#define MSM_PMEM_MDP_SIZE 0x1000000
#define SMEM_SPINLOCK_I2C 6
-#define MSM_PMEM_ADSP_SIZE 0x1C00000
-#define MSM_PMEM_GPU1_SIZE 0x800000
+#define MSM_PMEM_ADSP_SIZE 0xC00000
#define MSM_FB_SIZE 0x1C2000
#define MSM_AUDIO_SIZE 0x80000
#define MSM_GPU_PHYS_SIZE SZ_2M
#define MSM_SMI_BASE 0x2b00000
-#define MSM_SMI_SIZE 0x1500000
+#define MSM_SMI_SIZE 0x400000
#define MSM_FB_BASE MSM_SMI_BASE
#define MSM_GPU_PHYS_BASE (MSM_FB_BASE + MSM_FB_SIZE)
-#define MSM_PMEM_GPU0_BASE (MSM_GPU_PHYS_BASE + MSM_GPU_PHYS_SIZE)
-#define MSM_PMEM_GPU0_SIZE (MSM_SMI_SIZE - MSM_FB_SIZE - MSM_GPU_PHYS_SIZE)
+#define MSM_PMEM_SMIPOOL_BASE (MSM_GPU_PHYS_BASE + MSM_GPU_PHYS_SIZE)
+#define MSM_PMEM_SMIPOOL_SIZE (MSM_SMI_SIZE - MSM_FB_SIZE - MSM_GPU_PHYS_SIZE)
-#define PMEM_KERNEL_EBI1_SIZE 0
+#define PMEM_KERNEL_EBI1_SIZE 0x28000
#define PMIC_VREG_WLAN_LEVEL 2600
#define PMIC_VREG_GP6_LEVEL 2900
@@ -595,6 +594,21 @@
.cached = 0,
};
+#ifdef CONFIG_KERNEL_PMEM_SMI_REGION
+
+static struct android_pmem_platform_data android_pmem_kernel_smi_pdata = {
+ .name = PMEM_KERNEL_SMI_DATA_NAME,
+ /* if no allocator_type, defaults to PMEM_ALLOCATORTYPE_BITMAP,
+ * the only valid choice at this time. The board structure is
+ * set to all zeros by the C runtime initialization and that is now
+ * the enum value of PMEM_ALLOCATORTYPE_BITMAP, now forced to 0 in
+ * include/linux/android_pmem.h.
+ */
+ .cached = 0,
+};
+
+#endif
+
static struct android_pmem_platform_data android_pmem_pdata = {
.name = "pmem",
.allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
@@ -607,17 +621,11 @@
.cached = 0,
};
-static struct android_pmem_platform_data android_pmem_gpu0_pdata = {
- .name = "pmem_gpu0",
- .start = MSM_PMEM_GPU0_BASE,
- .size = MSM_PMEM_GPU0_SIZE,
- .allocator_type = PMEM_ALLOCATORTYPE_BUDDYBESTFIT,
- .cached = 0,
-};
-
-static struct android_pmem_platform_data android_pmem_gpu1_pdata = {
- .name = "pmem_gpu1",
- .allocator_type = PMEM_ALLOCATORTYPE_BUDDYBESTFIT,
+static struct android_pmem_platform_data android_pmem_smipool_pdata = {
+ .name = "pmem_smipool",
+ .start = MSM_PMEM_SMIPOOL_BASE,
+ .size = MSM_PMEM_SMIPOOL_SIZE,
+ .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
.cached = 0,
};
@@ -633,23 +641,25 @@
.dev = { .platform_data = &android_pmem_adsp_pdata },
};
-static struct platform_device android_pmem_gpu0_device = {
+static struct platform_device android_pmem_smipool_device = {
.name = "android_pmem",
.id = 2,
- .dev = { .platform_data = &android_pmem_gpu0_pdata },
+ .dev = { .platform_data = &android_pmem_smipool_pdata },
};
-static struct platform_device android_pmem_gpu1_device = {
+static struct platform_device android_pmem_kernel_ebi1_device = {
.name = "android_pmem",
.id = 3,
- .dev = { .platform_data = &android_pmem_gpu1_pdata },
+ .dev = { .platform_data = &android_pmem_kernel_ebi1_pdata },
};
-static struct platform_device android_pmem_kernel_ebi1_device = {
+#ifdef CONFIG_KERNEL_PMEM_SMI_REGION
+static struct platform_device android_pmem_kernel_smi_device = {
.name = "android_pmem",
- .id = 5,
- .dev = { .platform_data = &android_pmem_kernel_ebi1_pdata },
+ .id = 4,
+ .dev = { .platform_data = &android_pmem_kernel_smi_pdata },
};
+#endif
static struct resource msm_fb_resources[] = {
{
@@ -1191,36 +1201,42 @@
#endif
#endif
-static struct resource kgsl_resources[] = {
- {
- .name = "kgsl_reg_memory",
+static struct resource kgsl_3d0_resources[] = {
+ {
+ .name = KGSL_3D0_REG_MEMORY,
.start = 0xA0000000,
.end = 0xA001ffff,
.flags = IORESOURCE_MEM,
- },
- {
- .name = "kgsl_phys_memory",
- .start = MSM_GPU_PHYS_BASE,
- .end = MSM_GPU_PHYS_BASE + MSM_GPU_PHYS_SIZE - 1,
- .flags = IORESOURCE_MEM,
- },
- {
+ },
+ {
+ .name = KGSL_3D0_IRQ,
.start = INT_GRAPHICS,
.end = INT_GRAPHICS,
.flags = IORESOURCE_IRQ,
- },
+ },
};
-static struct kgsl_platform_data kgsl_pdata = {
- .max_axi_freq = 128000, /*Max for 8K*/
+
+static struct kgsl_device_platform_data kgsl_3d0_pdata = {
+ .pwrlevel = {
+ {
+ .gpu_freq = 0,
+ .bus_freq = 128000000,
+ },
+ },
+ .init_level = 0,
+ .num_levels = 1,
+ .set_grp_async = NULL,
+ .idle_timeout = HZ/5,
+ .clk_map = KGSL_CLK_CORE | KGSL_CLK_MEM,
};
-static struct platform_device msm_device_kgsl = {
- .name = "kgsl",
- .id = -1,
- .num_resources = ARRAY_SIZE(kgsl_resources),
- .resource = kgsl_resources,
+struct platform_device msm_kgsl_3d0 = {
+ .name = "kgsl-3d0",
+ .id = 0,
+ .num_resources = ARRAY_SIZE(kgsl_3d0_resources),
+ .resource = kgsl_3d0_resources,
.dev = {
- .platform_data = &kgsl_pdata,
+ .platform_data = &kgsl_3d0_pdata,
},
};
@@ -2012,10 +2028,12 @@
&msm_device_smd,
&msm_device_dmov,
&android_pmem_kernel_ebi1_device,
+#ifdef CONFIG_KERNEL_PMEM_SMI_REGION
+ &android_pmem_kernel_smi_device,
+#endif
&android_pmem_device,
&android_pmem_adsp_device,
- &android_pmem_gpu0_device,
- &android_pmem_gpu1_device,
+ &android_pmem_smipool_device,
&msm_device_nand,
&msm_device_i2c,
&qsd_device_spi,
@@ -2035,7 +2053,7 @@
&msm_device_uart3,
#endif
&msm_device_pmic_leds,
- &msm_device_kgsl,
+ &msm_kgsl_3d0,
&hs_device,
&sh_pm_device,
@@ -2070,12 +2088,6 @@
msm_init_sirc();
}
-static void kgsl_phys_memory_init(void)
-{
- request_mem_region(kgsl_resources[1].start,
- resource_size(&kgsl_resources[1]), "kgsl");
-}
-
static void __init qsd8x50_init_host(void)
{
if (machine_is_qsd8x50_ffa())
@@ -2530,6 +2542,22 @@
}
__early_param("pmem_kernel_ebi1_size=", pmem_kernel_ebi1_size_setup);
+#ifdef CONFIG_KERNEL_PMEM_SMI_REGION
+static unsigned pmem_kernel_smi_size = MSM_PMEM_SMIPOOL_SIZE;
+static void __init pmem_kernel_smi_size_setup(char **p)
+{
+ pmem_kernel_smi_size = memparse(*p, p);
+
+ /* Make sure that we don't allow more SMI memory then is
+ available - the kernel mapping code has no way of knowing
+ if it has gone over the edge */
+
+ if (pmem_kernel_smi_size > MSM_PMEM_SMIPOOL_SIZE)
+ pmem_kernel_smi_size = MSM_PMEM_SMIPOOL_SIZE;
+}
+__early_param("pmem_kernel_smi_size=", pmem_kernel_smi_size_setup);
+#endif
+
static unsigned pmem_mdp_size = MSM_PMEM_MDP_SIZE;
static void __init pmem_mdp_size_setup(char **p)
{
@@ -2544,13 +2572,6 @@
}
__early_param("pmem_adsp_size=", pmem_adsp_size_setup);
-static unsigned pmem_gpu1_size = MSM_PMEM_GPU1_SIZE;
-static void __init pmem_gpu1_size_setup(char **p)
-{
- pmem_gpu1_size = memparse(*p, p);
-}
-__early_param("pmem_gpu1_size=", pmem_gpu1_size_setup);
-
static unsigned audio_size = MSM_AUDIO_SIZE;
static void __init audio_size_setup(char **p)
{
@@ -2594,7 +2615,6 @@
spi_register_board_info(msm_spi_board_info,
ARRAY_SIZE(msm_spi_board_info));
msm_pm_set_platform_data(msm_pm_data);
- kgsl_phys_memory_init();
#ifdef CONFIG_SURF_FFA_GPIO_KEYPAD
if (machine_is_qsd8x50_ffa())
@@ -2623,6 +2643,24 @@
" ebi1 pmem arena\n", size, addr, __pa(addr));
}
+#ifdef CONFIG_KERNEL_PMEM_SMI_REGION
+ size = pmem_kernel_smi_size;
+ if (size > MSM_PMEM_SMIPOOL_SIZE) {
+ printk(KERN_ERR "pmem kernel smi arena size %lu is too big\n",
+ size);
+
+ size = MSM_PMEM_SMIPOOL_SIZE;
+ }
+
+ android_pmem_kernel_smi_pdata.start = MSM_PMEM_SMIPOOL_BASE;
+ android_pmem_kernel_smi_pdata.size = size;
+
+ pr_info("allocating %lu bytes at %lx (%lx physical)"
+ "for pmem kernel smi arena\n", size,
+ (long unsigned int) MSM_PMEM_SMIPOOL_BASE,
+ __pa(MSM_PMEM_SMIPOOL_BASE));
+#endif
+
size = pmem_mdp_size;
if (size) {
addr = alloc_bootmem(size);
@@ -2641,15 +2679,6 @@
"pmem arena\n", size, addr, __pa(addr));
}
- size = pmem_gpu1_size;
- if (size) {
- addr = alloc_bootmem_aligned(size, 0x100000);
- android_pmem_gpu1_pdata.start = __pa(addr);
- android_pmem_gpu1_pdata.size = size;
- pr_info("allocating %lu bytes at %p (%lx physical) for gpu1 "
- "pmem arena\n", size, addr, __pa(addr));
- }
-
size = MSM_FB_SIZE;
addr = (void *)MSM_FB_BASE;
msm_fb_resources[0].start = (unsigned long)addr;
--- kernel/deckard/arch/arm/mach-msm/board-qsd8x50.c
+++ kernel/deckard/arch/arm/mach-msm/board-qsd8x50.c
@@ -1303,39 +1303,6 @@
#define bt_power_init(x) do {} while (0)
#endif
-static struct resource kgsl_resources[] = {
- {
- .name = "kgsl_reg_memory",
- .start = 0xA0000000,
- .end = 0xA001ffff,
- .flags = IORESOURCE_MEM,
- },
- {
- .name = "kgsl_phys_memory",
- .start = MSM_GPU_PHYS_BASE,
- .end = MSM_GPU_PHYS_BASE + MSM_GPU_PHYS_SIZE - 1,
- .flags = IORESOURCE_MEM,
- },
- {
- .start = INT_GRAPHICS,
- .end = INT_GRAPHICS,
- .flags = IORESOURCE_IRQ,
- },
-};
-static struct kgsl_platform_data kgsl_pdata = {
- .max_axi_freq = 128000, /*Max for 8K*/
-};
-
-static struct platform_device msm_device_kgsl = {
- .name = "kgsl",
- .id = -1,
- .num_resources = ARRAY_SIZE(kgsl_resources),
- .resource = kgsl_resources,
- .dev = {
- .platform_data = &kgsl_pdata,
- },
-};
-
static struct platform_device msm_device_pmic_leds = {
.name = "pmic-leds",
.id = -1,
@@ -2135,7 +2102,7 @@
&msm_device_uart3,
#endif
&msm_device_pmic_leds,
- &msm_device_kgsl,
+ &msm_kgsl_3d0,
&hs_device,
#if defined(CONFIG_TSIF) || defined(CONFIG_TSIF_MODULE)
&msm_device_tsif,
@@ -2166,12 +2133,6 @@
msm_init_sirc();
}
-static void kgsl_phys_memory_init(void)
-{
- request_mem_region(kgsl_resources[1].start,
- resource_size(&kgsl_resources[1]), "kgsl");
-}
-
static void __init qsd8x50_init_host(void)
{
if (machine_is_qsd8x50_ffa())
@@ -2593,7 +2554,6 @@
spi_register_board_info(msm_spi_board_info,
ARRAY_SIZE(msm_spi_board_info));
msm_pm_set_platform_data(msm_pm_data);
- kgsl_phys_memory_init();
#ifdef CONFIG_SURF_FFA_GPIO_KEYPAD
if (machine_is_qsd8x50_ffa())
--- kernel/deckard/arch/arm/mach-msm/sh_sleepcheck.c
+++ kernel/deckard/arch/arm/mach-msm/sh_sleepcheck.c
@@ -24,7 +24,7 @@
#include <linux/wakelock.h>
#include <linux/pm.h>
#include <mach/msm_rpcrouter.h>
-#include <smd_private.h>
+#include "smd_private.h"
#include <sharp/sh_sleepcheck.h>
/* ==========================================================================================
--- kernel/deckard/drivers/base/Kconfig
+++ kernel/deckard/drivers/base/Kconfig
@@ -126,4 +126,18 @@
bool
default n
+config GENLOCK
+ bool "Enable a generic cross-process locking mechanism"
+ depends on ANON_INODES
+ help
+ Enable a generic cross-process locking API to provide protection
+ for shared memory objects such as graphics buffers.
+
+config GENLOCK_MISCDEVICE
+ bool "Enable a misc-device for userspace to access the genlock engine"
+ depends on GENLOCK
+ help
+ Create a miscdevice for the purposes of allowing userspace to create
+ and interact with locks created using genlock.
+
endmenu
--- kernel/deckard/drivers/base/Makefile
+++ kernel/deckard/drivers/base/Makefile
@@ -6,6 +6,7 @@
attribute_container.o transport_class.o
obj-y += power/
obj-$(CONFIG_HAS_DMA) += dma-mapping.o
+obj-$(CONFIG_GENLOCK) += genlock.o
obj-$(CONFIG_ISA) += isa.o
obj-$(CONFIG_FW_LOADER) += firmware_class.o
obj-$(CONFIG_NUMA) += node.o
--- kernel/deckard/drivers/base/genlock.c
+++ kernel/deckard/drivers/base/genlock.c
@@ -22,6 +22,7 @@
#include <linux/anon_inodes.h>
#include <linux/miscdevice.h>
#include <linux/genlock.h>
+#include <linux/hardirq.h>
/* Lock states - can either be unlocked, held as an exclusive write lock or a
* shared read lock
--- kernel/deckard/drivers/gpu/msm/adreno.h
+++ kernel/deckard/drivers/gpu/msm/adreno.h
@@ -17,7 +17,7 @@
#include "adreno_drawctxt.h"
#include "adreno_ringbuffer.h"
-#define DEVICE_3D_NAME "kgsl-3d"
+#define DEVICE_3D_NAME "kgsl-3d0"
#define DEVICE_3D0_NAME "kgsl-3d0"
#define ADRENO_DEVICE(device) \
--- kernel/deckard/drivers/gpu/msm/adreno.c
+++ kernel/deckard/drivers/gpu/msm/adreno.c
@@ -436,6 +436,8 @@
adreno_dev->pix_shader_start = adreno_gpulist[i].pix_shader_start;
}
+static struct platform_device_id adreno_id_table[];
+
static int __devinit
adreno_probe(struct platform_device *pdev)
{
@@ -443,7 +445,7 @@
struct adreno_device *adreno_dev;
int status = -EINVAL;
- device = (struct kgsl_device *)pdev->id_entry->driver_data;
+ device = (struct kgsl_device *)adreno_id_table[0].driver_data;
adreno_dev = ADRENO_DEVICE(device);
device->parentdev = &pdev->dev;
@@ -477,7 +479,7 @@
struct kgsl_device *device;
struct adreno_device *adreno_dev;
- device = (struct kgsl_device *)pdev->id_entry->driver_data;
+ device = (struct kgsl_device *)adreno_id_table[0].driver_data;
adreno_dev = ADRENO_DEVICE(device);
kgsl_pwrscale_detach_policy(device);
@@ -1358,7 +1360,6 @@
.remove = __devexit_p(adreno_remove),
.suspend = kgsl_suspend_driver,
.resume = kgsl_resume_driver,
- .id_table = adreno_id_table,
.driver = {
.owner = THIS_MODULE,
.name = DEVICE_3D_NAME,
--- kernel/deckard/drivers/gpu/msm/kgsl.c
+++ kernel/deckard/drivers/gpu/msm/kgsl.c
@@ -473,21 +473,9 @@
return kgsl_resume_device(device);
}
-static int kgsl_runtime_suspend(struct device *dev)
-{
- return 0;
-}
-
-static int kgsl_runtime_resume(struct device *dev)
-{
- return 0;
-}
-
const struct dev_pm_ops kgsl_pm_ops = {
.suspend = kgsl_suspend,
.resume = kgsl_resume,
- .runtime_suspend = kgsl_runtime_suspend,
- .runtime_resume = kgsl_runtime_resume,
};
EXPORT_SYMBOL(kgsl_pm_ops);
--- kernel/deckard/drivers/gpu/msm/kgsl_iommu.c
+++ kernel/deckard/drivers/gpu/msm/kgsl_iommu.c
@@ -47,7 +47,7 @@
void *kgsl_iommu_create_pagetable(void)
{
- struct iommu_domain *domain = iommu_domain_alloc(0);
+ struct iommu_domain *domain = iommu_domain_alloc();
if (!domain)
KGSL_CORE_ERR("Failed to create iommu domain\n");
@@ -238,7 +238,8 @@
if (range == 0 || gpuaddr == 0)
return 0;
- ret = iommu_unmap_range(domain, gpuaddr, range);
+// ret = iommu_unmap_range(domain, gpuaddr, range);
+ ret = -1;
if (ret)
KGSL_CORE_ERR("iommu_unmap_range(%p, %x, %d) failed "
"with err: %d\n", domain, gpuaddr,
--- kernel/deckard/drivers/gpu/msm/kgsl_mmu.c
+++ kernel/deckard/drivers/gpu/msm/kgsl_mmu.c
@@ -406,9 +406,9 @@
pagetable->max_entries = KGSL_PAGETABLE_ENTRIES(
CONFIG_MSM_KGSL_PAGE_TABLE_SIZE);
- pagetable->pool = gen_pool_create(PAGE_SHIFT, -1);
+ pagetable->pool = gen_pool_create(KGSL_MMU_ALIGN_SHIFT, -1);
if (pagetable->pool == NULL) {
- KGSL_CORE_ERR("gen_pool_create(%d) failed\n", PAGE_SHIFT);
+ KGSL_CORE_ERR("gen_pool_create(%d) failed\n", KGSL_MMU_ALIGN_SHIFT);
goto err_alloc;
}
@@ -537,8 +537,7 @@
memdesc->gpuaddr = memdesc->physaddr;
return 0;
}
- memdesc->gpuaddr = gen_pool_alloc_aligned(pagetable->pool,
- memdesc->size, KGSL_MMU_ALIGN_SHIFT);
+ memdesc->gpuaddr = gen_pool_alloc(pagetable->pool, memdesc->size);
if (memdesc->gpuaddr == 0) {
KGSL_CORE_ERR("gen_pool_alloc(%d) failed\n", memdesc->size);
--- kernel/deckard/drivers/gpu/msm/kgsl_pwrctrl.c
+++ kernel/deckard/drivers/gpu/msm/kgsl_pwrctrl.c
@@ -39,7 +39,7 @@
.map = KGSL_CLK_SRC,
},
{
- .name = "core_clk",
+ .name = "imem_clk",
.map = KGSL_CLK_CORE,
},
{
@@ -47,7 +47,7 @@
.map = KGSL_CLK_IFACE,
},
{
- .name = "mem_clk",
+ .name = "imem_clk",
.map = KGSL_CLK_MEM,
},
{
@@ -500,7 +500,7 @@
pwr->nap_allowed = pdata->nap_allowed;
pwr->interval_timeout = pdata->idle_timeout;
- pwr->ebi1_clk = clk_get(&pdev->dev, "bus_clk");
+ pwr->ebi1_clk = clk_get(&pdev->dev, "ebi1_clk");
if (IS_ERR(pwr->ebi1_clk))
pwr->ebi1_clk = NULL;
else
--- kernel/deckard/drivers/gpu/msm/kgsl_sharedmem.c
+++ kernel/deckard/drivers/gpu/msm/kgsl_sharedmem.c
@@ -11,7 +11,6 @@
*
*/
#include <linux/vmalloc.h>
-#include <linux/memory_alloc.h>
#include <asm/cacheflush.h>
#include "kgsl.h"
@@ -357,7 +356,7 @@
if (memdesc->hostptr)
iounmap(memdesc->hostptr);
- free_contiguous_memory_by_paddr(memdesc->physaddr);
+// free_contiguous_memory_by_paddr(memdesc->physaddr);
}
static void kgsl_coherent_free(struct kgsl_memdesc *memdesc)
@@ -569,7 +568,8 @@
memdesc->size = size;
memdesc->pagetable = pagetable;
memdesc->ops = &kgsl_ebimem_ops;
- memdesc->physaddr = allocate_contiguous_ebi_nomap(size, SZ_8K);
+// memdesc->physaddr = allocate_contiguous_ebi_nomap(size, SZ_8K);
+ memdesc->physaddr = 0;
if (memdesc->physaddr == 0) {
KGSL_CORE_ERR("allocate_contiguous_ebi_nomap(%d) failed\n",
--- kernel/deckard/drivers/input/touchscreen/msm-i2ctps.c
+++ kernel/deckard/drivers/input/touchscreen/msm-i2ctps.c
@@ -83,6 +83,9 @@
#define TPS_ERROR_WIDE SH_TOUCH_MAX_DISTANCE /* Wide range */
#define TPS_ERROR_3DOWN SH_TOUCH_MAX_DISTANCE /* Three point pushing */
+#define SH_TOUCH_DELTA 16
+#define SH_TOUCH_MAX_PRESSURE 255
+
/* Adjustable parameter */
#define POS_X0 0
#define POS_X1 120
@@ -169,9 +172,10 @@
{
uint8_t mbValid;;
/* Event processing function */
- void (*mpReportKey)(InputDev *);
- void (*mpReportWit)(InputDev *, uint16_t, uint16_t);
- void (*mpReportPos)(InputDev *, uint16_t, uint16_t);
+ void (*mpReportKey)(InputDev *, int mt);
+ void (*mpReportKey2)(InputDev *, int mt);
+ void (*mpReportPos)(InputDev *, uint16_t, uint16_t, uint16_t, int mt);
+ void (*mpReportPos2)(InputDev *, uint16_t, uint16_t, uint16_t, int mt);
} TpsDispatch;
@@ -214,6 +218,9 @@
static int gnResult = 0;
+static uint16_t oldPosX, oldPosY;
+static int oldDeltaX, oldDeltaY, oldState;
+
/*+-------------------------------------------------------------------------+*/
/*| PROTO TYPE DECLARE |*/
/*+-------------------------------------------------------------------------+*/
@@ -263,14 +270,14 @@
static void ShTps_RoundValue(short *pValue);
static int ShTps_SetAdjustParam(I2cTpsRec *poTpsRec, uint16_t *pParam);
static void ShTps_AdjustPt(short *pX, short *pY);
-static void ShTps_KeyOn(InputDev *pInDev);
-static void ShTps_KeyOff(InputDev *pInDev);
-static void ShTps_WidOff(InputDev *pInDev, uint16_t wDeltaX, uint16_t wDeltaY);
-static void ShTps_WidSet(InputDev *pInDev, uint16_t wDeltaX, uint16_t wDeltaY);
-static void ShTps_WidWid(InputDev *pInDev, uint16_t wDeltaX, uint16_t wDeltaY);
-static void ShTps_Wid3Dn(InputDev *pInDev, uint16_t wDeltaX, uint16_t wDeltaY);
-static void ShTps_PosSet(InputDev *pInDev, uint16_t wPosX, uint16_t wPosY);
-static void ShTps_PosErr(InputDev *pInDev, uint16_t wPosX, uint16_t wPosY);
+static void ShTps_KeyOn(InputDev *pInDev, int mt);
+static void ShTps_KeyOff(InputDev *pInDev, int mt);
+static void ShTps_PosSet(InputDev *pInDev, uint16_t wPosX, uint16_t wPosY, uint16_t wDistance, int mt);
+static void ShTps_PosSet2(InputDev *pInDev, uint16_t wPosX, uint16_t wPosY, uint16_t wDistance, int mt);
+static void ShTps_PosOff(InputDev *pInDev, uint16_t wPosX, uint16_t wPosY, uint16_t wDistance, int mt);
+static void ShTps_PosOff2(InputDev *pInDev, uint16_t wPosX, uint16_t wPosY, uint16_t wDistance, int mt);
+static void ShTps_PosErr(InputDev *pInDev, uint16_t wPosX, uint16_t wPosY, uint16_t wDistance, int mt);
+static void ShTps_PosErr2(InputDev *pInDev, uint16_t wPosX, uint16_t wPosY, uint16_t wDistance, int mt);
static int ShTps_FwWrite(I2cTpsRec *poTpsRec, TpsFwData *pTpsFirmData);
static int ShTps_FwWriteMain(TpsFwData *pTpsFirmData);
@@ -289,43 +296,43 @@
{
/* [EVENT] HOVER */
{
- { 0, NULL, NULL, NULL, }, /* [STATE] HOVER */
- { 1, ShTps_KeyOff, NULL, NULL, }, /* [STATE] SDOWN */
- { 1, ShTps_KeyOff, ShTps_WidOff, NULL, }, /* [STATE] MDOWN */
- { 1, ShTps_KeyOff, ShTps_WidOff, NULL, }, /* [STATE] WIDE */
- { 1, ShTps_KeyOff, ShTps_WidOff, NULL, }, /* [STATE] 3DOWN */
+ { 0, NULL, NULL, NULL, NULL, }, /* [STATE] HOVER */
+ { 1, ShTps_KeyOff, NULL, ShTps_PosOff, NULL, }, /* [STATE] SDOWN */
+ { 1, ShTps_KeyOff, ShTps_KeyOff, ShTps_PosOff, ShTps_PosOff2, }, /* [STATE] MDOWN */
+ { 1, ShTps_KeyOff, ShTps_KeyOff, ShTps_PosOff, ShTps_PosOff2, }, /* [STATE] WIDE */
+ { 1, ShTps_KeyOff, ShTps_KeyOff, ShTps_PosOff, ShTps_PosOff2, }, /* [STATE] 3DOWN */
},
/* [EVENT] SDOWN */
{
- { 1, ShTps_KeyOn, NULL, ShTps_PosSet, }, /* [STATE] HOVER */
- { 1, NULL, NULL, ShTps_PosSet, }, /* [STATE] SDOWN */
- { 1, NULL, ShTps_WidOff, ShTps_PosSet, }, /* [STATE] MDOWN */
- { 0, NULL, NULL, NULL, }, /* [STATE] WIDE */
- { 0, NULL, NULL, NULL, }, /* [STATE] 3DOWN */
+ { 1, ShTps_KeyOn, NULL, ShTps_PosSet, NULL, }, /* [STATE] HOVER */
+ { 1, NULL, NULL, ShTps_PosSet, NULL, }, /* [STATE] SDOWN */
+ { 1, NULL, ShTps_KeyOff, ShTps_PosSet, ShTps_PosOff2, }, /* [STATE] MDOWN */
+ { 0, NULL, NULL, NULL, NULL, }, /* [STATE] WIDE */
+ { 0, NULL, NULL, NULL, NULL, }, /* [STATE] 3DOWN */
},
/* [EVENT] MDOWN */
{
- { 1, ShTps_KeyOn, ShTps_WidSet, ShTps_PosSet, }, /* [STATE] HOVER */
- { 1, NULL, ShTps_WidSet, ShTps_PosSet, }, /* [STATE] SDOWN */
- { 1, NULL, ShTps_WidSet, ShTps_PosSet, }, /* [STATE] MDOWN */
- { 0, NULL, NULL, NULL, }, /* [STATE] WIDE */
- { 0, NULL, NULL, NULL, }, /* [STATE] 3DOWN */
+ { 1, ShTps_KeyOn, ShTps_KeyOn, ShTps_PosSet, ShTps_PosSet2, }, /* [STATE] HOVER */
+ { 1, NULL, ShTps_KeyOn, ShTps_PosSet, ShTps_PosSet2, }, /* [STATE] SDOWN */
+ { 1, NULL, NULL, ShTps_PosSet, ShTps_PosSet2, }, /* [STATE] MDOWN */
+ { 0, NULL, NULL, NULL, NULL, }, /* [STATE] WIDE */
+ { 0, NULL, NULL, NULL, NULL, }, /* [STATE] 3DOWN */
},
/* [EVENT] WIDE */
{
- { 1, ShTps_KeyOn, ShTps_WidWid, ShTps_PosErr, }, /* [STATE] HOVER */
- { 1, NULL, ShTps_WidWid, ShTps_PosErr, }, /* [STATE] SDOWN */
- { 1, NULL, ShTps_WidWid, ShTps_PosErr, }, /* [STATE] MDOWN */
- { 0, NULL, NULL, NULL, }, /* [STATE] WIDE */
- { 0, NULL, NULL, NULL, }, /* [STATE] 3DOWN */
+ { 1, ShTps_KeyOn, ShTps_KeyOn, ShTps_PosErr, ShTps_PosErr2, }, /* [STATE] HOVER */
+ { 1, NULL, ShTps_KeyOn, ShTps_PosErr, ShTps_PosErr2, }, /* [STATE] SDOWN */
+ { 1, NULL, NULL, ShTps_PosErr, ShTps_PosErr2, }, /* [STATE] MDOWN */
+ { 0, NULL, NULL, NULL, NULL, }, /* [STATE] WIDE */
+ { 0, NULL, NULL, NULL, NULL, }, /* [STATE] 3DOWN */
},
/* [EVENT] 3DOWN */
{
- { 1, ShTps_KeyOn, ShTps_Wid3Dn, ShTps_PosErr, }, /* [STATE] HOVER */
- { 1, NULL, ShTps_Wid3Dn, ShTps_PosErr, }, /* [STATE] SDOWN */
- { 1, NULL, ShTps_Wid3Dn, ShTps_PosErr, }, /* [STATE] MDOWN */
- { 0, NULL, NULL, NULL, }, /* [STATE] WIDE */
- { 0, NULL, NULL, NULL, }, /* [STATE] 3DOWN */
+ { 1, ShTps_KeyOn, ShTps_KeyOn, ShTps_PosErr, ShTps_PosErr2, }, /* [STATE] HOVER */
+ { 1, NULL, ShTps_KeyOn, ShTps_PosErr, ShTps_PosErr2, }, /* [STATE] SDOWN */
+ { 1, NULL, NULL, ShTps_PosErr, ShTps_PosErr2, }, /* [STATE] MDOWN */
+ { 0, NULL, NULL, NULL, NULL, }, /* [STATE] WIDE */
+ { 0, NULL, NULL, NULL, NULL, }, /* [STATE] 3DOWN */
},
};
@@ -792,11 +799,18 @@
__set_bit(ABS_Y, pInDev->absbit);
__set_bit(ABS_TOOL_WIDTH, pInDev->absbit);
__set_bit(BTN_TOUCH, pInDev->keybit);
+ __set_bit(ABS_MT_POSITION_X, pInDev->absbit);
+ __set_bit(ABS_MT_POSITION_Y, pInDev->absbit);
+ __set_bit(ABS_MT_TOUCH_MAJOR, pInDev->absbit);
+ __set_bit(BTN_2, pInDev->keybit);
input_set_drvdata(pInDev, poTpsRec);
/* Event parameter range set */
input_set_abs_params(pInDev, ABS_X, 0, SH_TOUCH_MAX_X, 0, 0);
input_set_abs_params(pInDev, ABS_Y, 0, SH_TOUCH_MAX_Y, 0, 0);
input_set_abs_params(pInDev, ABS_TOOL_WIDTH, 0, SH_TOUCH_MAX_DISTANCE, 0, 0);
+ input_set_abs_params(pInDev, ABS_MT_POSITION_X, 0, SH_TOUCH_MAX_X, 0, 0);
+ input_set_abs_params(pInDev, ABS_MT_POSITION_Y, 0, SH_TOUCH_MAX_Y, 0, 0);
+ input_set_abs_params(pInDev, ABS_MT_TOUCH_MAJOR, 0, SH_TOUCH_MAX_PRESSURE, 0, 0);
}
else
{
@@ -989,6 +1003,7 @@
uint8_t bData[7];
uint16_t wPosX, wPosY;
uint16_t wDeltaX, wDeltaY;
+ uint16_t wDistance;
int nNextState;
#ifdef TPS_PRNDEB
const char *StaName[] = { "HOVER ", "SDOWN ", "MDOWN ", "WIDE ", "3DOWN "};
@@ -1027,6 +1042,7 @@
wPosY = (uint16_t)bData[3] + ((uint16_t)(bData[2] & 0x0f) << 8);
wDeltaX = (uint16_t)bData[4] + ((uint16_t)(bData[5] & 0xf0) << 4);
wDeltaY = (uint16_t)bData[6] + ((uint16_t)(bData[5] & 0x0f) << 8);
+ wDistance = 0;
#ifdef TPS_PRNLOG
printk(KERN_DEBUG "[ShTps]Int %02X,(%4d,%4d)(%4d,%4d)\n", bData[ 0], wPosX, wPosY, wDeltaX, wDeltaY);
@@ -1048,6 +1064,76 @@
}
else
{
+ if(nNextState == TPS_STATE_MDOWN)
+ {
+ wDistance = ShTps_GetHypotLength(wDeltaX, wDeltaY);
+
+ if(wPosX - oldPosX > SH_TOUCH_DELTA ||
+ (oldPosX - wPosX <= SH_TOUCH_DELTA && oldDeltaX < 0))
+ {
+ wPosX -= wDeltaX / 2;
+ wDeltaX = wPosX + wDeltaX;
+ }
+ else
+ {
+ wPosX += wDeltaX / 2;
+ wDeltaX = wPosX - wDeltaX;
+ }
+ if(wPosY - oldPosY > SH_TOUCH_DELTA ||
+ (oldPosY - wPosY <= SH_TOUCH_DELTA && oldDeltaY < 0))
+ {
+ wPosY -= wDeltaY / 2;
+ wDeltaY = wPosY + wDeltaY;
+ }
+ else
+ {
+ wPosY += wDeltaY / 2;
+ wDeltaY = wPosY - wDeltaY;
+ }
+
+ if(wDeltaX > SH_TOUCH_MAX_X)
+ {
+ wDeltaX = SH_TOUCH_MAX_X;
+ }
+#ifdef TPS_ROTATE_180
+ wDeltaX = SH_TOUCH_MAX_X - wDeltaX;
+#endif /* TPS_ROTATE_180 */
+ if(wDeltaY > SH_TOUCH_MAX_Y)
+ {
+ wDeltaY = SH_TOUCH_MAX_Y;
+ }
+#ifdef TPS_ROTATE_180
+ wDeltaY = SH_TOUCH_MAX_Y - wDeltaY;
+#endif /* TPS_ROTATE_180 */
+ /* The correction is effective */
+ if(poTpsRec->mbAdjustEnable != 0)
+ {
+ /* Coordinates are corrected. */
+ ShTps_AdjustPt(&wDeltaX, &wDeltaY);
+#ifdef TPS_PRNDEB
+printk(KERN_DEBUG "[ShTps]Adjust (%4d,%4d)\n", wDeltaX, wDeltaY);
+#endif /* TPS_PRNDEB */
+ }
+ }
+
+ oldDeltaX = wPosX - oldPosX;
+ oldDeltaY = wPosY - oldPosY;
+ oldPosX = wPosX;
+ oldPosY = wPosY;
+ if(nNextState == TPS_STATE_SDOWN)
+ {
+ if(oldState == 2)
+ {
+ oldState = 1;
+ goto skip;
+ }
+ oldState = oldState + 1;
+ }
+ else
+ {
+ oldState = 0;
+ }
+
if(wPosX > SH_TOUCH_MAX_X)
{
wPosX = SH_TOUCH_MAX_X;
@@ -1073,23 +1159,33 @@
}
}
}
+ else
+ {
+ oldState = 0;
+ }
/* Can it change? */
if(gTpsDispatch[nNextState][poTpsRec->mnState].mbValid != 0)
{
- /* Report[BTN_TOUCH] */
+ int mt;
+
if(gTpsDispatch[nNextState][poTpsRec->mnState].mpReportKey != NULL)
{
- gTpsDispatch[nNextState][poTpsRec->mnState].mpReportKey(pInDev);
+ gTpsDispatch[nNextState][poTpsRec->mnState].mpReportKey(pInDev, 0);
}
- /* Report[ABS_TOOL_WIDTH] */
- if(gTpsDispatch[nNextState][poTpsRec->mnState].mpReportWit != NULL)
+ if(gTpsDispatch[nNextState][poTpsRec->mnState].mpReportKey2 != NULL)
{
- gTpsDispatch[nNextState][poTpsRec->mnState].mpReportWit(pInDev, wDeltaX, wDeltaY);
+ gTpsDispatch[nNextState][poTpsRec->mnState].mpReportKey2(pInDev, 1);
}
- /* Report[ABS_X][ABS_Y] */
- if(gTpsDispatch[nNextState][poTpsRec->mnState].mpReportPos != NULL)
+ for (mt = 0; mt < 2; mt++)
{
- gTpsDispatch[nNextState][poTpsRec->mnState].mpReportPos(pInDev, wPosX, wPosY);
+ if(gTpsDispatch[nNextState][poTpsRec->mnState].mpReportPos != NULL)
+ {
+ gTpsDispatch[nNextState][poTpsRec->mnState].mpReportPos(pInDev, wPosX, wPosY, wDistance, mt);
+ }
+ if(mt && gTpsDispatch[nNextState][poTpsRec->mnState].mpReportPos2 != NULL)
+ {
+ gTpsDispatch[nNextState][poTpsRec->mnState].mpReportPos2(pInDev, wDeltaX, wDeltaY, wDistance, mt);
+ }
}
input_sync(pInDev);
#ifdef TPS_PRNDEB
@@ -1103,6 +1199,7 @@
printk(KERN_DEBUG "[ShTps]State[%s]->[%s] NG\n", StaName[poTpsRec->mnState], StaName[nNextState]);
#endif /* TPS_PRNDEB */
}
+skip:
/* Enabling interrupt */
enable_irq(MSM_GPIO_TO_INT(poTpsRec->mnIrqPin));
mutex_unlock(&goTpsAccessMutex);
@@ -1148,6 +1245,11 @@
uint16_t wResult;
uint32_t dwX, dwY;
+ if(wX > SH_TOUCH_MAX_X)
+ wX = SH_TOUCH_MAX_X;
+ if(wY > SH_TOUCH_MAX_Y)
+ wY = SH_TOUCH_MAX_Y;
+
if(wX == 0)
return wY;
if(wY == 0)
@@ -1350,15 +1452,26 @@
/* It returns it to the state of HOVER */
if(gTpsDispatch[TPS_STATE_HOVER][poTpsRec->mnState].mbValid != 0)
{
- /* Report[BTN_TOUCH] */
+ int mt;
+
if(gTpsDispatch[TPS_STATE_HOVER][poTpsRec->mnState].mpReportKey != NULL)
{
- gTpsDispatch[TPS_STATE_HOVER][poTpsRec->mnState].mpReportKey(poTpsRec->mpoInDev);
+ gTpsDispatch[TPS_STATE_HOVER][poTpsRec->mnState].mpReportKey(poTpsRec->mpoInDev, 0);
}
- /* Report[ABS_TOOL_WIDTH] */
- if(gTpsDispatch[TPS_STATE_HOVER][poTpsRec->mnState].mpReportWit != NULL)
+ if(gTpsDispatch[TPS_STATE_HOVER][poTpsRec->mnState].mpReportKey2 != NULL)
{
- gTpsDispatch[TPS_STATE_HOVER][poTpsRec->mnState].mpReportWit(poTpsRec->mpoInDev, 0, 0);
+ gTpsDispatch[TPS_STATE_HOVER][poTpsRec->mnState].mpReportKey2(poTpsRec->mpoInDev, 1);
+ }
+ for (mt = 0; mt < 2; mt++)
+ {
+ if(gTpsDispatch[TPS_STATE_HOVER][poTpsRec->mnState].mpReportPos != NULL)
+ {
+ gTpsDispatch[TPS_STATE_HOVER][poTpsRec->mnState].mpReportPos(poTpsRec->mpoInDev, 0, 0, 0, mt);
+ }
+ if(mt && gTpsDispatch[TPS_STATE_HOVER][poTpsRec->mnState].mpReportPos2 != NULL)
+ {
+ gTpsDispatch[TPS_STATE_HOVER][poTpsRec->mnState].mpReportPos2(poTpsRec->mpoInDev, 0, 0, 0, mt);
+ }
}
input_sync(poTpsRec->mpoInDev);
}
@@ -1693,79 +1806,113 @@
*pY = MINMAX(0, SH_TOUCH_MAX_Y, *pY);
}
-static void ShTps_KeyOn(InputDev *pInDev)
+static void ShTps_KeyOn(InputDev *pInDev, int mt)
{
#ifdef TPS_PRNDEB
printk(KERN_DEBUG "[ShTps]KeyOn\n");
#endif /* TPS_PRNDEB */
- /* Touching down */
- input_report_key(pInDev, BTN_TOUCH, KPD_KEYPRESS);
+ if (mt)
+ input_report_key(pInDev, BTN_2, KPD_KEYPRESS);
+ else
+ input_report_key(pInDev, BTN_TOUCH, KPD_KEYPRESS);
}
-static void ShTps_KeyOff(InputDev *pInDev)
+static void ShTps_KeyOff(InputDev *pInDev, int mt)
{
#ifdef TPS_PRNDEB
printk(KERN_DEBUG "[ShTps]KeyOff\n");
#endif /* Touching up */
- /* Touching up */
- input_report_key(pInDev, BTN_TOUCH, KPD_KEYRELEASE);
+ if (mt)
+ input_report_key(pInDev, BTN_2, KPD_KEYRELEASE);
+ else
+ input_report_key(pInDev, BTN_TOUCH, KPD_KEYRELEASE);
}
-static void ShTps_WidOff(InputDev *pInDev, uint16_t wDeltaX, uint16_t wDeltaY)
+static void ShTps_PosSet(InputDev *pInDev, uint16_t wPosX, uint16_t wPosY, uint16_t wDistance, int mt)
{
#ifdef TPS_PRNDEB
-printk(KERN_DEBUG "[ShTps]WidOff(0)\n");
+printk(KERN_DEBUG "[ShTps]PosSet(%d,%d)\n", wPosX, wPosY);
#endif /* TPS_PRNDEB */
- /* ABS_TOOL_WIDTH Reset */
- input_report_abs(pInDev, ABS_TOOL_WIDTH, 0);
+ if (mt)
+ {
+ input_report_abs(pInDev, ABS_MT_POSITION_X, wPosX);
+ input_report_abs(pInDev, ABS_MT_POSITION_Y, wPosY);
+ input_report_abs(pInDev, ABS_MT_TOUCH_MAJOR, SH_TOUCH_MAX_PRESSURE);
+ input_mt_sync(pInDev);
+ return;
+ }
+
+ /* Coordinates set */
+ input_report_abs(pInDev, ABS_X, wPosX);
+ input_report_abs(pInDev, ABS_Y, wPosY);
}
-static void ShTps_WidSet(InputDev *pInDev, uint16_t wDeltaX, uint16_t wDeltaY)
+static void ShTps_PosSet2(InputDev *pInDev, uint16_t wPosX, uint16_t wPosY, uint16_t wDistance, int mt)
{
- uint16_t wDistance;
-
- /** Maximum size excess */
- if(wDeltaX > SH_TOUCH_MAX_X) {
- wDeltaX = SH_TOUCH_MAX_X;
- } if(wDeltaY > SH_TOUCH_MAX_Y) {
- wDeltaY = SH_TOUCH_MAX_Y;
+ if (mt)
+ {
+ ShTps_PosSet(pInDev, wPosX, wPosY, wDistance, mt);
+ return;
}
- wDistance = ShTps_GetHypotLength(wDeltaX, wDeltaY);
+
#ifdef TPS_PRNDEB
printk(KERN_DEBUG "[ShTps]WidSet(%d)\n", wDistance);
#endif /* TPS_PRNDEB */
+
input_report_abs(pInDev, ABS_TOOL_WIDTH, wDistance);
}
-static void ShTps_WidWid(InputDev *pInDev, uint16_t wDeltaX, uint16_t wDeltaY)
+static void ShTps_PosOff(InputDev *pInDev, uint16_t wPosX, uint16_t wPosY, uint16_t wDistance, int mt)
{
#ifdef TPS_PRNDEB
-printk(KERN_DEBUG "[ShTps]WidWid(%d)\n", TPS_ERROR_WIDE);
+printk(KERN_DEBUG "[ShTps]PosOff(0)\n");
#endif /* TPS_PRNDEB */
- /* error report */
- input_report_abs(pInDev, ABS_TOOL_WIDTH, TPS_ERROR_WIDE);
+ if (mt)
+ {
+ input_report_abs(pInDev, ABS_MT_TOUCH_MAJOR, 0);
+ input_mt_sync(pInDev);
+ return;
+ }
}
-static void ShTps_Wid3Dn(InputDev *pInDev, uint16_t wDeltaX, uint16_t wDeltaY)
+static void ShTps_PosOff2(InputDev *pInDev, uint16_t wPosX, uint16_t wPosY, uint16_t wDistance, int mt)
{
#ifdef TPS_PRNDEB
-printk(KERN_DEBUG "[ShTps]Wid3Dn(%d)\n", TPS_ERROR_3DOWN);
+printk(KERN_DEBUG "[ShTps]PosOff(0)\n");
#endif /* TPS_PRNDEB */
- /* error report */
- input_report_abs(pInDev, ABS_TOOL_WIDTH, TPS_ERROR_3DOWN);
+ if (mt)
+ {
+ ShTps_PosOff(pInDev, wPosX, wPosY, wDistance, mt);
+ return;
+ }
+
+ input_report_abs(pInDev, ABS_TOOL_WIDTH, 0);
}
-static void ShTps_PosSet(InputDev *pInDev, uint16_t wPosX, uint16_t wPosY)
+static void ShTps_PosErr(InputDev *pInDev, uint16_t wPosX, uint16_t wPosY, uint16_t wDistance, int mt)
{
#ifdef TPS_PRNDEB
-printk(KERN_DEBUG "[ShTps]PosSet(%d,%d)\n", wPosX, wPosY);
+printk(KERN_DEBUG "[ShTps]PosErr(%d,%d)\n", TPS_ERROR_POS_X, TPS_ERROR_POS_Y);
#endif /* TPS_PRNDEB */
- /* Coordinates set */
- input_report_abs(pInDev, ABS_X, wPosX);
- input_report_abs(pInDev, ABS_Y, wPosY);
+ if (mt)
+ {
+ input_report_abs(pInDev, ABS_MT_POSITION_X, TPS_ERROR_POS_X);
+ input_report_abs(pInDev, ABS_MT_POSITION_Y, TPS_ERROR_POS_Y);
+ input_report_abs(pInDev, ABS_MT_TOUCH_MAJOR, SH_TOUCH_MAX_PRESSURE);
+ input_mt_sync(pInDev);
+ return;
+ }
+
+ /* error report */
+ input_report_abs(pInDev, ABS_X, TPS_ERROR_POS_X);
+ input_report_abs(pInDev, ABS_Y, TPS_ERROR_POS_Y);
}
-static void ShTps_PosErr(InputDev *pInDev, uint16_t wPosX, uint16_t wPosY)
+static void ShTps_PosErr2(InputDev *pInDev, uint16_t wPosX, uint16_t wPosY, uint16_t wDistance, int mt)
{
#ifdef TPS_PRNDEB
printk(KERN_DEBUG "[ShTps]PosErr(%d,%d)\n", TPS_ERROR_POS_X, TPS_ERROR_POS_Y);
#endif /* TPS_PRNDEB */
- /* error report */
- input_report_abs(pInDev, ABS_X, TPS_ERROR_POS_X);
- input_report_abs(pInDev, ABS_Y, TPS_ERROR_POS_Y);
+ if (mt)
+ {
+ ShTps_PosErr(pInDev, wPosX, wPosY, wDistance, mt);
+ return;
+ }
+
+ input_report_abs(pInDev, ABS_TOOL_WIDTH, TPS_ERROR_WIDE);
}
/*+-----------------------------------------------------------------------------+*/
--- kernel/deckard/drivers/misc/pmem.c
+++ kernel/deckard/drivers/misc/pmem.c
@@ -39,9 +39,6 @@
#define PMEM_INITIAL_NUM_BITMAP_ALLOCATIONS (64)
-#define PMEM_1M (1 << 20)
-#define PMEM_1M_MASK (0xfff00000)
-
#define PMEM_32BIT_WORD_ORDER (5)
#define PMEM_BITS_PER_WORD_MASK (BITS_PER_LONG - 1)
@@ -116,11 +113,6 @@
#define DLOG(x...) do {} while (0)
#endif
-enum pmem_align {
- PMEM_ALIGN_4K,
- PMEM_ALIGN_1M,
-};
-
struct pmem_info {
struct miscdevice dev;
/* physical start address of the remaped pmem space */
@@ -140,7 +132,7 @@
int (*allocate)(const int,
const unsigned long,
- const enum pmem_align);
+ const unsigned int);
int (*free)(int, int);
unsigned long (*len)(int, struct pmem_data *);
unsigned long (*start_addr)(int, struct pmem_data *);
@@ -209,6 +201,12 @@
const int fallback_memtype;
int info_id;
} kapi_memtypes[] = {
+#ifdef CONFIG_KERNEL_PMEM_SMI_REGION
+ { PMEM_KERNEL_SMI_DATA_NAME,
+ PMEM_MEMTYPE_SMI,
+ PMEM_MEMTYPE_EBI1, /* Fall back to EBI1 automatically */
+ -1 },
+#endif
{ PMEM_KERNEL_EBI1_DATA_NAME,
PMEM_MEMTYPE_EBI1,
PMEM_INVALID_MEMTYPE, /* MUST be set invalid if no fallback */
@@ -780,7 +778,7 @@
static int pmem_allocator_all_or_nothing(const int id,
const unsigned long len,
- const enum pmem_align align)
+ const unsigned int align)
{
/* caller should hold the lock on arena_mutex! */
DLOG("all or nothing\n");
@@ -793,7 +791,7 @@
static int pmem_allocator_buddy_bestfit(const int id,
const unsigned long len,
- const enum pmem_align align)
+ unsigned int align)
{
/* caller should hold the lock on arena_mutex! */
int curr;
@@ -892,20 +890,20 @@
static int
bitmap_allocate_contiguous(uint32_t *bitp, int num_bits_to_alloc,
- int total_bits, int spacing)
+ int total_bits, int spacing, int start_bit)
{
int bit_start, last_bit, word_index;
if (num_bits_to_alloc <= 0)
return -1;
- for (bit_start = 0; ;
- bit_start = (last_bit +
+ for (bit_start = start_bit; ;
+ bit_start = ((last_bit +
(word_index << PMEM_32BIT_WORD_ORDER) + spacing - 1)
- & ~(spacing - 1)) {
+ & ~(spacing - 1)) + start_bit) {
int bit_end = bit_start + num_bits_to_alloc, total_words;
- if (bit_end >= total_bits)
+ if (bit_end > total_bits)
return -1; /* out of contiguous memory */
word_index = bit_start >> PMEM_32BIT_WORD_ORDER;
@@ -949,8 +947,9 @@
static int reserve_quanta(const unsigned int quanta_needed,
const int id,
- const enum pmem_align align)
+ unsigned int align)
{
+ /* alignment should be a valid power of 2 */
int ret = -1, start_bit = 0, spacing = 1;
/* Sanity check */
@@ -963,24 +962,24 @@
return -1;
}
- if (align == PMEM_ALIGN_1M) {
- start_bit = bit_from_paddr(id,
- (pmem[id].base + PMEM_1M - 1) & PMEM_1M_MASK);
- if (start_bit <= -1) {
+ start_bit = bit_from_paddr(id,
+ (pmem[id].base + align - 1) & ~(align - 1));
+ if (start_bit <= -1) {
#if PMEM_DEBUG
- printk(KERN_ALERT
- "pmem: %s: bit_from_paddr fails for"
- " 1M alignment.\n", __func__);
+ printk(KERN_ALERT
+ "pmem: %s: bit_from_paddr fails for"
+ " %u alignment.\n", __func__, align);
#endif
- return -1;
- }
- spacing = PMEM_1M / pmem[id].quantum;
+ return -1;
}
+ spacing = align / pmem[id].quantum;
+ spacing = spacing > 1 ? spacing : 1;
ret = bitmap_allocate_contiguous(pmem[id].allocator.bitmap.bitmap,
quanta_needed,
(pmem[id].size + pmem[id].quantum - 1) / pmem[id].quantum,
- spacing);
+ spacing,
+ start_bit);
#if PMEM_DEBUG
if (ret < 0)
@@ -995,13 +994,13 @@
static int pmem_allocator_bitmap(const int id,
const unsigned long len,
- const enum pmem_align align)
+ const unsigned int align)
{
/* caller should hold the lock on arena_mutex! */
int bitnum, i;
unsigned int quanta_needed;
- DLOG("bitmap id %d, len %ld, align %d\n", id, len, align);
+ DLOG("bitmap id %d, len %ld, align %u\n", id, len, align);
if (!pmem[id].allocator.bitmap.bitm_alloc) {
#if PMEM_DEBUG
printk(KERN_ALERT "pmem: bitm_alloc not present! id: %d\n",
@@ -1316,7 +1315,7 @@
mutex_lock(&pmem[id].arena_mutex);
index = pmem[id].allocate(id,
vma->vm_end - vma->vm_start,
- PMEM_ALIGN_4K);
+ SZ_4K);
mutex_unlock(&pmem[id].arena_mutex);
data->index = index;
}
@@ -1603,15 +1602,15 @@
int32_t pmem_kalloc(const size_t size, const uint32_t flags)
{
int info_id, i, memtype, fallback = 0;
- enum pmem_align align;
+ unsigned int align;
int32_t index = -1;
switch (flags & PMEM_ALIGNMENT_MASK) {
case PMEM_ALIGNMENT_4K:
- align = PMEM_ALIGN_4K;
+ align = SZ_4K;
break;
case PMEM_ALIGNMENT_1M:
- align = PMEM_ALIGN_1M;
+ align = SZ_1M;
break;
default:
printk(KERN_ALERT "pmem: %s: Invalid alignment %#x\n",
@@ -1645,7 +1644,7 @@
}
#if PMEM_DEBUG
- if (align != PMEM_ALIGN_4K &&
+ if (align != SZ_4K &&
(pmem[info_id].allocator_type ==
PMEM_ALLOCATORTYPE_ALLORNOTHING ||
pmem[info_id].allocator_type ==
@@ -2146,9 +2145,12 @@
}
case PMEM_ALLOCATE:
{
+ int ret = 0;
DLOG("allocate, id %d\n", id);
down_write(&data->sem);
if (has_allocation(file)) {
+ pr_err("pmem: Existing allocation found on "
+ "this file descrpitor\n");
up_write(&data->sem);
return -EINVAL;
}
@@ -2156,11 +2158,59 @@
mutex_lock(&pmem[id].arena_mutex);
data->index = pmem[id].allocate(id,
arg,
- PMEM_ALIGN_4K);
+ SZ_4K);
mutex_unlock(&pmem[id].arena_mutex);
+ ret = data->index == -1 ? -ENOMEM :
+ data->index;
+ up_write(&data->sem);
+ return ret;
+ }
+ case PMEM_ALLOCATE_ALIGNED:
+ {
+ struct pmem_allocation alloc;
+ int ret = 0;
+ if (copy_from_user(&alloc, (void __user *)arg,
+ sizeof(struct pmem_allocation)))
+ return -EFAULT;
+ DLOG("allocate id align %d %u\n", id, alloc.align);
+ down_write(&data->sem);
+ if (has_allocation(file)) {
+ pr_err("pmem: Existing allocation found on "
+ "this file descrpitor\n");
+ up_write(&data->sem);
+ return -EINVAL;
+ }
+
+ if (alloc.align & (alloc.align - 1)) {
+ pr_err("pmem: Alignment is not a power of 2\n");
+ return -EINVAL;
+ }
+
+ if (alloc.align != SZ_4K &&
+ (pmem[id].allocator_type !=
+ PMEM_ALLOCATORTYPE_BITMAP)) {
+ pr_err("pmem: Non 4k alignment requires bitmap"
+ " allocator\n");
+ return -EINVAL;
+ }
+
+ if (alloc.align > SZ_1M ||
+ alloc.align < SZ_4K) {
+ pr_err("pmem: Invalid Alignment (%u) "
+ "specified\n", alloc.align);
+ return -EINVAL;
+ }
+
+ mutex_lock(&pmem[id].arena_mutex);
+ data->index = pmem[id].allocate(id,
+ alloc.size,
+ alloc.align);
+ mutex_unlock(&pmem[id].arena_mutex);
+ ret = data->index == -1 ? -ENOMEM :
+ data->index;
up_write(&data->sem);
- break;
+ return ret;
}
case PMEM_CONNECT:
DLOG("connect\n");
--- kernel/deckard/drivers/video/msm/msm_fb.c
+++ kernel/deckard/drivers/video/msm/msm_fb.c
@@ -912,7 +912,22 @@
var->yres = panel_info->yres;
var->xres_virtual = panel_info->xres;
var->yres_virtual = panel_info->yres * mfd->fb_page;
- var->bits_per_pixel = bpp * 8, /* FrameBuffer color depth */
+ var->bits_per_pixel = bpp * 8; /* FrameBuffer color depth */
+ if (mfd->dest == DISPLAY_LCD) {
+ var->reserved[4] = panel_info->lcd.refx100 / 100;
+ } else {
+ var->reserved[4] = panel_info->clk_rate /
+ ((panel_info->lcdc.h_back_porch +
+ panel_info->lcdc.h_front_porch +
+ panel_info->lcdc.h_pulse_width +
+ panel_info->xres) *
+ (panel_info->lcdc.v_back_porch +
+ panel_info->lcdc.v_front_porch +
+ panel_info->lcdc.v_pulse_width +
+ panel_info->yres));
+ }
+ pr_debug("reserved[4] %u\n", var->reserved[4]);
+
/*
* id field for fb app
*/
--- kernel/deckard/fs/anon_inodes.c
+++ kernel/deckard/fs/anon_inodes.c
@@ -53,6 +53,83 @@
};
/**
+ * anon_inode_getfile - creates a new file instance by hooking it up to an
+ * anonymous inode, and a dentry that describe the "class"
+ * of the file
+ *
+ * @name: [in] name of the "class" of the new file
+ * @fops: [in] file operations for the new file
+ * @priv: [in] private data for the new file (will be file's private_data)
+ * @flags: [in] flags
+ *
+ * Creates a new file by hooking it on a single inode. This is useful for files
+ * that do not need to have a full-fledged inode in order to operate correctly.
+ * All the files created with anon_inode_getfile() will share a single inode,
+ * hence saving memory and avoiding code duplication for the file/inode/dentry
+ * setup. Returns the newly created file* or an error pointer.
+ */
+struct file *anon_inode_getfile(const char *name,
+ const struct file_operations *fops,
+ void *priv, int flags)
+{
+ struct qstr this;
+ struct dentry *dentry;
+ struct file *file;
+ int error;
+
+ if (IS_ERR(anon_inode_inode))
+ return ERR_PTR(-ENODEV);
+
+ if (fops->owner && !try_module_get(fops->owner))
+ return ERR_PTR(-ENOENT);
+
+ /*
+ * Link the inode to a directory entry by creating a unique name
+ * using the inode sequence number.
+ */
+ error = -ENOMEM;
+ this.name = name;
+ this.len = strlen(name);
+ this.hash = 0;
+ dentry = d_alloc(anon_inode_mnt->mnt_sb->s_root, &this);
+ if (!dentry)
+ goto err_module;
+
+ /*
+ * We know the anon_inode inode count is always greater than zero,
+ * so we can avoid doing an igrab() and we can use an open-coded
+ * atomic_inc().
+ */
+ atomic_inc(&anon_inode_inode->i_count);
+
+ dentry->d_op = &anon_inodefs_dentry_operations;
+ /* Do not publish this dentry inside the global dentry hash table */
+ dentry->d_flags &= ~DCACHE_UNHASHED;
+ d_instantiate(dentry, anon_inode_inode);
+
+ error = -ENFILE;
+ file = alloc_file(anon_inode_mnt, dentry,
+ FMODE_READ | FMODE_WRITE, fops);
+ if (!file)
+ goto err_dput;
+ file->f_mapping = anon_inode_inode->i_mapping;
+
+ file->f_pos = 0;
+ file->f_flags = O_RDWR | (flags & O_NONBLOCK);
+ file->f_version = 0;
+ file->private_data = priv;
+
+ return file;
+
+err_dput:
+ dput(dentry);
+err_module:
+ module_put(fops->owner);
+ return ERR_PTR(error);
+}
+EXPORT_SYMBOL_GPL(anon_inode_getfile);
+
+/**
* anon_inode_getfd - creates a new file instance by hooking it up to an
* anonymous inode, and a dentry that describe the "class"
* of the file
--- kernel/deckard/kernel/timer.c
+++ kernel/deckard/kernel/timer.c
@@ -636,6 +636,74 @@
EXPORT_SYMBOL(__mod_timer);
+static inline int
+__mod_timer_pending(struct timer_list *timer, unsigned long expires,
+ bool pending_only, int pinned)
+{
+ struct tvec_base *base, *new_base;
+ unsigned long flags;
+ int ret = 0;
+
+ timer_stats_timer_set_start_info(timer);
+ BUG_ON(!timer->function);
+
+ base = lock_timer_base(timer, &flags);
+
+ if (timer_pending(timer)) {
+ detach_timer(timer, 0);
+ ret = 1;
+ } else {
+ if (pending_only)
+ goto out_unlock;
+ }
+
+ debug_timer_activate(timer);
+
+ new_base = __get_cpu_var(tvec_bases);
+
+ if (base != new_base) {
+ /*
+ * We are trying to schedule the timer on the local CPU.
+ * However we can't change timer's base while it is running,
+ * otherwise del_timer_sync() can't detect that the timer's
+ * handler yet has not finished. This also guarantees that
+ * the timer is serialized wrt itself.
+ */
+ if (likely(base->running_timer != timer)) {
+ /* See the comment in lock_timer_base() */
+ timer_set_base(timer, NULL);
+ spin_unlock(&base->lock);
+ base = new_base;
+ spin_lock(&base->lock);
+ timer_set_base(timer, base);
+ }
+ }
+
+ timer->expires = expires;
+ internal_add_timer(base, timer);
+
+out_unlock:
+ spin_unlock_irqrestore(&base->lock, flags);
+
+ return ret;
+}
+
+/**
+ * mod_timer_pending - modify a pending timer's timeout
+ * @timer: the pending timer to be modified
+ * @expires: new timeout in jiffies
+ *
+ * mod_timer_pending() is the same for pending timers as mod_timer(),
+ * but will not re-activate and modify already deleted timers.
+ *
+ * It is useful for unserialized use of timers.
+ */
+int mod_timer_pending(struct timer_list *timer, unsigned long expires)
+{
+ return __mod_timer_pending(timer, expires, true, TIMER_NOT_PINNED);
+}
+EXPORT_SYMBOL(mod_timer_pending);
+
/**
* add_timer_on - start a timer on a particular CPU
* @timer: the timer to be added
--- kernel/deckard/lib/idr.c
+++ kernel/deckard/lib/idr.c
@@ -579,6 +579,52 @@
EXPORT_SYMBOL(idr_for_each);
/**
+ * idr_get_next - lookup next object of id to given id.
+ * @idp: idr handle
+ * @nextidp: pointer to lookup key
+ *
+ * Returns pointer to registered object with id, which is next number to
+ * given id. After being looked up, *@nextidp will be updated for the next
+ * iteration.
+ */
+
+void *idr_get_next(struct idr *idp, int *nextidp)
+{
+ struct idr_layer *p, *pa[MAX_LEVEL];
+ struct idr_layer **paa = &pa[0];
+ int id = *nextidp;
+ int n, max;
+
+ /* find first ent */
+ n = idp->layers * IDR_BITS;
+ max = 1 << n;
+ p = rcu_dereference(idp->top);
+ if (!p)
+ return NULL;
+
+ while (id < max) {
+ while (n > 0 && p) {
+ n -= IDR_BITS;
+ *paa++ = p;
+ p = rcu_dereference(p->ary[(id >> n) & IDR_MASK]);
+ }
+
+ if (p) {
+ *nextidp = id;
+ return p;
+ }
+
+ id += 1 << n;
+ while (n < fls(id)) {
+ n += IDR_BITS;
+ p = *--paa;
+ }
+ }
+ return NULL;
+}
+EXPORT_SYMBOL(idr_get_next);
+
+/**
* idr_replace - replace pointer for given id
* @idp: idr handle
* @ptr: pointer you want associated with the id
--- kernel/deckard/mm/ashmem.c
+++ kernel/deckard/mm/ashmem.c
@@ -29,6 +29,7 @@
#include <linux/mutex.h>
#include <linux/shmem_fs.h>
#include <linux/ashmem.h>
+#include <asm/cacheflush.h>
#define ASHMEM_NAME_PREFIX "dev/ashmem/"
#define ASHMEM_NAME_PREFIX_LEN (sizeof(ASHMEM_NAME_PREFIX) - 1)
@@ -45,6 +46,8 @@
struct list_head unpinned_list; /* list of all ashmem areas */
struct file *file; /* the shmem-based backing file */
size_t size; /* size of the mapping, in bytes */
+ unsigned long vm_start; /* Start address of vm_area
+ * which maps this ashmem */
unsigned long prot_mask; /* allowed prot bits, as vm_flags */
};
@@ -255,6 +258,7 @@
vma->vm_file = asma->file;
}
vma->vm_flags |= VM_CAN_NONLINEAR;
+ asma->vm_start = vma->vm_start;
out:
mutex_unlock(&ashmem_mutex);
@@ -555,6 +559,30 @@
return ret;
}
+static int ashmem_cache_op(struct ashmem_area *asma,
+ void (*cache_func)(unsigned long vstart, unsigned long length,
+ unsigned long pstart))
+{
+#ifdef CONFIG_OUTER_CACHE
+ unsigned long vaddr;
+#endif
+ mutex_lock(&ashmem_mutex);
+#ifndef CONFIG_OUTER_CACHE
+ cache_func(asma->vm_start, asma->size, 0);
+#else
+ for (vaddr = asma->vm_start; vaddr < asma->vm_start + asma->size;
+ vaddr += PAGE_SIZE) {
+ unsigned long physaddr;
+ physaddr = virtaddr_to_physaddr(vaddr);
+ if (!physaddr)
+ return -EINVAL;
+ cache_func(vaddr, PAGE_SIZE, physaddr);
+ }
+#endif
+ mutex_unlock(&ashmem_mutex);
+ return 0;
+}
+
static long ashmem_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
struct ashmem_area *asma = file->private_data;
@@ -595,11 +623,73 @@
ashmem_shrink(ret, GFP_KERNEL);
}
break;
+ case ASHMEM_CACHE_FLUSH_RANGE:
+ ret = ashmem_cache_op(asma, &clean_and_invalidate_caches);
+ break;
+ case ASHMEM_CACHE_CLEAN_RANGE:
+ ret = ashmem_cache_op(asma, &clean_caches);
+ break;
+ case ASHMEM_CACHE_INV_RANGE:
+ ret = ashmem_cache_op(asma, &invalidate_caches);
+ break;
}
return ret;
}
+static int is_ashmem_file(struct file *file)
+{
+ char fname[256], *name;
+ name = dentry_path(file->f_dentry, fname, 256);
+ return strcmp(name, "/ashmem") ? 0 : 1;
+}
+
+int get_ashmem_file(int fd, struct file **filp, struct file **vm_file,
+ unsigned long *len)
+{
+ int ret = -1;
+ struct file *file = fget(fd);
+ *filp = NULL;
+ *vm_file = NULL;
+ if (unlikely(file == NULL)) {
+ pr_err("ashmem: %s: requested data from file "
+ "descriptor that doesn't exist.\n", __func__);
+ } else {
+ char currtask_name[FIELD_SIZEOF(struct task_struct, comm) + 1];
+ pr_debug("filp %p rdev %d pid %u(%s) file %p(%ld)"
+ " dev id: %d\n", filp,
+ file->f_dentry->d_inode->i_rdev,
+ current->pid, get_task_comm(currtask_name, current),
+ file, file_count(file),
+ MINOR(file->f_dentry->d_inode->i_rdev));
+ if (is_ashmem_file(file)) {
+ struct ashmem_area *asma = file->private_data;
+ *filp = file;
+ *vm_file = asma->file;
+ *len = asma->size;
+ ret = 0;
+ } else {
+ pr_err("file descriptor is not an ashmem "
+ "region fd: %d\n", fd);
+ fput(file);
+ }
+ }
+ return ret;
+}
+EXPORT_SYMBOL(get_ashmem_file);
+
+void put_ashmem_file(struct file *file)
+{
+ char currtask_name[FIELD_SIZEOF(struct task_struct, comm) + 1];
+ pr_debug("rdev %d pid %u(%s) file %p(%ld)" " dev id: %d\n",
+ file->f_dentry->d_inode->i_rdev, current->pid,
+ get_task_comm(currtask_name, current), file,
+ file_count(file), MINOR(file->f_dentry->d_inode->i_rdev));
+ if (file && is_ashmem_file(file))
+ fput(file);
+}
+EXPORT_SYMBOL(put_ashmem_file);
+
static struct file_operations ashmem_fops = {
.owner = THIS_MODULE,
.open = ashmem_open,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment