Syncro with arco's work
This commit is contained in:
parent
244f261e7e
commit
c76980ded8
@ -1,5 +1,4 @@
|
||||
#
|
||||
# Copyright (C) 2008 The Android Open Source Project
|
||||
# Copyright (C) 2009 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.
|
||||
@ -12,8 +11,12 @@
|
||||
# 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.
|
||||
#
|
||||
|
||||
$(call inherit-product, device/common/gps/gps_as_supl.mk)
|
||||
$(call inherit-product-if-exists, device/htc/tattoo/device_tattoo_as-vendor.mk)
|
||||
$(call inherit-product, device/htc/tattoo/device_tattoo.mk)
|
||||
LOCAL_PATH := $(my-dir)
|
||||
subdir_makefiles := \
|
||||
$(LOCAL_PATH)/libcopybit/Android.mk \
|
||||
$(LOCAL_PATH)/libgralloc/Android.mk \
|
||||
$(LOCAL_PATH)/liblights/Android.mk \
|
||||
$(LOCAL_PATH)/libsensors/Android.mk
|
||||
|
||||
include $(subdir_makefiles)
|
@ -1,23 +1,6 @@
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
file := $(TARGET_ROOT_OUT)/init.bahamas.rc
|
||||
ALL_PREBUILT += $(file)
|
||||
$(file) : $(LOCAL_PATH)/init.bahamas.rc | $(ACP)
|
||||
$(transform-prebuilt-to-target)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_SRC_FILES := bahamas-keypad.kcm
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
include $(BUILD_KEY_CHAR_MAP)
|
||||
|
||||
# This will install the file in /system/etc
|
||||
#
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE_CLASS := ETC
|
||||
LOCAL_MODULE := vold.fstab
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
LOCAL_SRC_FILES := $(LOCAL_MODULE)
|
||||
include $(BUILD_PREBUILT)
|
||||
|
||||
-include device/htc/tattoo/AndroidBoardVendor.mk
|
||||
|
29
AndroidProducts.mk
Normal file
29
AndroidProducts.mk
Normal file
@ -0,0 +1,29 @@
|
||||
#
|
||||
# Copyright (C) 2009 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 should set PRODUCT_MAKEFILES to a list of product makefiles
|
||||
# to expose to the build system. LOCAL_DIR will already be set to
|
||||
# the directory containing this file.
|
||||
#
|
||||
# This file may not rely on the value of any variable other than
|
||||
# LOCAL_DIR; do not use any conditionals, and do not look up the
|
||||
# value of any variable that isn't set in this file or in a file that
|
||||
# it includes.
|
||||
#
|
||||
|
||||
PRODUCT_MAKEFILES := \
|
||||
$(LOCAL_DIR)/tattoo.mk
|
121
BoardConfig.mk
121
BoardConfig.mk
@ -8,21 +8,28 @@
|
||||
# against the traditional rules of inheritance).
|
||||
USE_CAMERA_STUB := true
|
||||
|
||||
# Fake building with froyo cam, as old libcam is not here yet
|
||||
BOARD_USE_FROYO_LIBCAMERA := true
|
||||
|
||||
# inherit from the proprietary version
|
||||
-include device/htc/tattoo/BoardConfigVendor.mk
|
||||
|
||||
# ARMv6-compatible processor rev 5 (v6l)
|
||||
TARGET_BOARD_PLATFORM := msm7k
|
||||
TARGET_ARCH_VARIANT := armv6j
|
||||
#TARGET_ARCH_VARIANT := armv7-a
|
||||
TARGET_CPU_ABI := armeabi-v6j
|
||||
TARGET_CPU_ABI2 := armeabi
|
||||
|
||||
TARGET_CPU_ABI := armeabi
|
||||
TARGET_BOOTLOADER_BOARD_NAME := bahamas
|
||||
|
||||
TARGET_NO_BOOTLOADER := true
|
||||
TARGET_NO_RADIOIMAGE := true
|
||||
TARGET_NO_RECOVERY := true
|
||||
#TARGET_NO_RECOVERY := false
|
||||
TARGET_NO_RECOVERY := false
|
||||
|
||||
BOARD_USE_FROYO_LIBCAMERA := true
|
||||
BOARD_LDPI_RECOVERY := true
|
||||
|
||||
TARGET_PREBUILT_RECOVERY_KERNEL := device/htc/tattoo/custom/recovery_kernel
|
||||
TARGET_PREBUILT_KERNEL := device/htc/tattoo/custom/kernel
|
||||
|
||||
# Wifi related defines
|
||||
BOARD_WPA_SUPPLICANT_DRIVER := CUSTOM
|
||||
@ -32,98 +39,64 @@ WIFI_DRIVER_MODULE_PATH := "/system/lib/modules/wlan.ko"
|
||||
WIFI_DRIVER_MODULE_ARG := ""
|
||||
WIFI_DRIVER_MODULE_NAME := "wlan"
|
||||
WIFI_FIRMWARE_LOADER := "wlan_loader"
|
||||
|
||||
TARGET_BOOTLOADER_BOARD_NAME := bahamas
|
||||
|
||||
TARGET_BOOTLOADER_LIBS := \
|
||||
libboot_board_dream_sapphire_combined \
|
||||
libboot_arch_msm7k \
|
||||
libboot_arch_armv6
|
||||
|
||||
TARGET_BOOTLOADER_LINK_SCRIPT := \
|
||||
hardware/msm7k/boot/boot.ld
|
||||
WIFI_DRIVER_FW_STA_PATH := "/etc/firmware/tiinit_5.3.53.bts"
|
||||
WIFI_DRIVER_FW_AP_PATH := "/etc/wifi/Fw1251r1c.bin"
|
||||
|
||||
TARGET_PROVIDES_INIT_RC := false
|
||||
|
||||
BOARD_KERNEL_CMDLINE := no_console_suspend=1 console=null
|
||||
BOARD_KERNEL_BASE := 0x02E00000
|
||||
|
||||
BOARD_USES_GENERIC_AUDIO := false
|
||||
|
||||
# Use HTC USB Function Switch to enable tethering via USB
|
||||
BOARD_USE_HTC_USB_FUNCTION_SWITCH := true
|
||||
|
||||
BOARD_USE_USB_MASS_STORAGE_SWITCH := true
|
||||
|
||||
BOARD_HAVE_BLUETOOTH := true
|
||||
|
||||
# For the FM Radio
|
||||
BOARD_HAVE_FM_RADIO := false
|
||||
BOARD_WITH_A2DP := true
|
||||
|
||||
BOARD_HAS_LIMITED_EGL:=true
|
||||
|
||||
BOARD_VENDOR_USE_AKMD := akm8973
|
||||
|
||||
BOARD_VENDOR_QCOM_AMSS_VERSION := 1355
|
||||
|
||||
TARGET_HARDWARE_3D := false
|
||||
BOARD_HAS_LIMITED_EGL := true
|
||||
|
||||
BOARD_GPS_LIBRARIES := libgps librpc
|
||||
TARGET_HARDWARE_3D := false
|
||||
|
||||
# OpenGL drivers config file path
|
||||
BOARD_EGL_CFG := device/htc/tattoo/egl.cfg
|
||||
|
||||
|
||||
# Use libcamera2
|
||||
BOARD_USES_OLD_CAMERA_HACK := true
|
||||
|
||||
# No authoring clock for OpenCore on DS
|
||||
BOARD_NO_PV_AUTHORING_CLOCK := true
|
||||
# No authoring clock for OpenCore
|
||||
# BOARD_NO_PV_AUTHORING_CLOCK := true
|
||||
|
||||
BOARD_USES_QCOM_LIBS := true
|
||||
|
||||
BOARD_USES_GPSSHIM := true
|
||||
|
||||
BOARD_GPS_NEEDS_XTRA := true
|
||||
|
||||
BOARD_GPS_LIBRARIES := libgps librpc
|
||||
|
||||
TARGET_LIBAGL_USE_GRALLOC_COPYBITS := true
|
||||
|
||||
BOARD_NO_RGBX_8888 := true
|
||||
|
||||
JS_ENGINE := v8
|
||||
|
||||
TARGET_RELEASETOOLS_EXTENSIONS := device/htc/common
|
||||
|
||||
|
||||
TARGET_OTA_ASSERT_DEVICE := bahamas
|
||||
PRODUCT_BUILD_PROP_OVERRIDES += TARGET_BOOTLOADER_BOARD_NAME=bahamas
|
||||
|
||||
# # cat /proc/mtd
|
||||
# dev: size erasesize name
|
||||
# mtd0: 00040000 00020000 "misc"
|
||||
# mtd0: 000a0000 00020000 "misc"
|
||||
# mtd1: 00500000 00020000 "recovery"
|
||||
# mtd2: 00280000 00020000 "boot"
|
||||
# mtd3: 05a00000 00020000 "system"
|
||||
# mtd4: 05000000 00020000 "cache"
|
||||
# mtd5: 127c0000 00020000 "userdata"
|
||||
# Changed for bahamas
|
||||
BOARD_BOOTIMAGE_MAX_SIZE := $(call image-size-from-data-size,0x00280000)
|
||||
BOARD_RECOVERYIMAGE_MAX_SIZE := $(call image-size-from-data-size,0x00500000)
|
||||
BOARD_SYSTEMIMAGE_MAX_SIZE := $(call image-size-from-data-size,0x09600000)
|
||||
BOARD_USERDATAIMAGE_MAX_SIZE := $(call image-size-from-data-size,0x0a520000)
|
||||
|
||||
# The size of a block that can be marked bad.
|
||||
BOARD_FLASH_BLOCK_SIZE := 153600
|
||||
|
||||
# Stagefright fully enabled
|
||||
BUILD_WITH_FULL_STAGEFRIGHT := true
|
||||
|
||||
|
||||
# JIT built in, but disabled by default
|
||||
WITH_JIT := true
|
||||
ENABLE_JSC_JIT := true
|
||||
|
||||
# Stop compiling test_* binaries for eng tag
|
||||
#STOP_TEST_BINS := true
|
||||
|
||||
# Build kernel
|
||||
TARGET_PREBUILT_KERNEL := device/htc/tattoo/kernel
|
||||
LOCAL_KERNEL := device/htc/tattoo/kernel
|
||||
|
||||
# Ginger
|
||||
#BOARD_LDPI_RECOVERY := true
|
||||
BOARD_LDPI_RECOVERY := false
|
||||
|
||||
#BOARD_NO_RGBX_8888 := true
|
||||
|
||||
#TARGET_LIBAGL_USE_GRALLOC_COPYBITS := true
|
||||
|
||||
#BOARD_USE_HTC_USB_FUNCTION_SWITCH := true
|
||||
|
||||
#BOARD_USE_USB_MASS_STORAGE_SWITCH := true
|
||||
|
||||
#BOARD_USE_NEW_LIBRIL_HTC := true
|
||||
# mtd3: 09600000 00020000 "system"
|
||||
# mtd4: 09600000 00020000 "cache"
|
||||
# mtd5: 0a520000 00020000 "userdata"
|
||||
# Changed for Tattoo
|
||||
BOARD_BOOTIMAGE_PARTITION_SIZE := 0x00280000
|
||||
BOARD_RECOVERYIMAGE_PARTITION_SIZE := 0x00500000
|
||||
BOARD_SYSTEMIMAGE_PARTITION_SIZE := 0x09600000
|
||||
BOARD_USERDATAIMAGE_PARTITION_SIZE := 0x0a520000
|
||||
BOARD_FLASH_BLOCK_SIZE := 131072
|
||||
|
@ -14,9 +14,4 @@
|
||||
|
||||
# This file is generated by device/htc/tattoo/setup-makefiles.sh
|
||||
|
||||
PRODUCT_SPECIFIC_DEFINES += TARGET_PRELINKER_MAP=$(TOP)/device/htc/tattoo/prelink-linux-arm-tattoo.map
|
||||
|
||||
BOARD_GPS_LIBRARIES := libgps
|
||||
|
||||
USE_CAMERA_STUB := false
|
||||
|
||||
|
@ -1,2 +0,0 @@
|
||||
9.0
|
||||
- Initial release with camera started
|
49
CleanSpec.mk
Normal file
49
CleanSpec.mk
Normal file
@ -0,0 +1,49 @@
|
||||
# Copyright (C) 2007 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.
|
||||
#
|
||||
|
||||
# If you don't need to do a full clean build but would like to touch
|
||||
# a file or delete some intermediate files, add a clean step to the end
|
||||
# of the list. These steps will only be run once, if they haven't been
|
||||
# run before.
|
||||
#
|
||||
# E.g.:
|
||||
# $(call add-clean-step, touch -c external/sqlite/sqlite3.h)
|
||||
# $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libz_intermediates)
|
||||
#
|
||||
# Always use "touch -c" and "rm -f" or "rm -rf" to gracefully deal with
|
||||
# files that are missing or have been moved.
|
||||
#
|
||||
# Use $(PRODUCT_OUT) to get to the "out/target/product/blah/" directory.
|
||||
# Use $(OUT_DIR) to refer to the "out" directory.
|
||||
#
|
||||
# If you need to re-do something that's already mentioned, just copy
|
||||
# the command and add it to the bottom of the list. E.g., if a change
|
||||
# that you made last week required touching a file and a change you
|
||||
# made today requires touching the same file, just copy the old
|
||||
# touch step and add it to the end of the list.
|
||||
#
|
||||
# ************************************************
|
||||
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
|
||||
# ************************************************
|
||||
|
||||
# For example:
|
||||
#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/AndroidTests_intermediates)
|
||||
#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/core_intermediates)
|
||||
#$(call add-clean-step, find $(OUT_DIR) -type f -name "IGTalkSession*" -print0 | xargs -0 rm -f)
|
||||
#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/data/*)
|
||||
|
||||
# ************************************************
|
||||
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
|
||||
# ************************************************
|
42
KernelModules.mk
Normal file
42
KernelModules.mk
Normal file
@ -0,0 +1,42 @@
|
||||
# Kernel Modules TO BE COPIED
|
||||
PRODUCT_COPY_FILES += \
|
||||
device/htc/tattoo/custom/modules/2.6.29-Kalim/modules.usbmap:system/lib/modules/2.6.29-Kalim/modules.usbmap \
|
||||
device/htc/tattoo/custom/modules/2.6.29-Kalim/modules.alias:system/lib/modules/2.6.29-Kalim/modules.alias \
|
||||
device/htc/tattoo/custom/modules/2.6.29-Kalim/modules.symbols:system/lib/modules/2.6.29-Kalim/modules.symbols \
|
||||
device/htc/tattoo/custom/modules/2.6.29-Kalim/modules.isapnpmap:system/lib/modules/2.6.29-Kalim/modules.isapnpmap \
|
||||
device/htc/tattoo/custom/modules/2.6.29-Kalim/modules.ofmap:system/lib/modules/2.6.29-Kalim/modules.ofmap \
|
||||
device/htc/tattoo/custom/modules/2.6.29-Kalim/modules.ccwmap:system/lib/modules/2.6.29-Kalim/modules.ccwmap \
|
||||
device/htc/tattoo/custom/modules/2.6.29-Kalim/modules.pcimap:system/lib/modules/2.6.29-Kalim/modules.pcimap \
|
||||
device/htc/tattoo/custom/modules/2.6.29-Kalim/modules.ieee1394map:system/lib/modules/2.6.29-Kalim/modules.ieee1394map \
|
||||
device/htc/tattoo/custom/modules/2.6.29-Kalim/modules.seriomap:system/lib/modules/2.6.29-Kalim/modules.seriomap \
|
||||
device/htc/tattoo/custom/modules/2.6.29-Kalim/kernel/net/ipv6/xfrm6_mode_ro.ko:system/lib/modules/2.6.29-Kalim/kernel/net/ipv6/xfrm6_mode_ro.ko \
|
||||
device/htc/tattoo/custom/modules/2.6.29-Kalim/kernel/net/ipv6/xfrm6_mode_tunnel.ko:system/lib/modules/2.6.29-Kalim/kernel/net/ipv6/xfrm6_mode_tunnel.ko \
|
||||
device/htc/tattoo/custom/modules/2.6.29-Kalim/kernel/net/ipv6/mip6.ko:system/lib/modules/2.6.29-Kalim/kernel/net/ipv6/mip6.ko \
|
||||
device/htc/tattoo/custom/modules/2.6.29-Kalim/kernel/net/ipv6/sit.ko:system/lib/modules/2.6.29-Kalim/kernel/net/ipv6/sit.ko \
|
||||
device/htc/tattoo/custom/modules/2.6.29-Kalim/kernel/net/ipv6/esp6.ko:system/lib/modules/2.6.29-Kalim/kernel/net/ipv6/esp6.ko \
|
||||
device/htc/tattoo/custom/modules/2.6.29-Kalim/kernel/net/ipv6/ip6_tunnel.ko:system/lib/modules/2.6.29-Kalim/kernel/net/ipv6/ip6_tunnel.ko \
|
||||
device/htc/tattoo/custom/modules/2.6.29-Kalim/kernel/net/ipv6/xfrm6_mode_transport.ko:system/lib/modules/2.6.29-Kalim/kernel/net/ipv6/xfrm6_mode_transport.ko \
|
||||
device/htc/tattoo/custom/modules/2.6.29-Kalim/kernel/net/ipv6/xfrm6_tunnel.ko:system/lib/modules/2.6.29-Kalim/kernel/net/ipv6/xfrm6_tunnel.ko \
|
||||
device/htc/tattoo/custom/modules/2.6.29-Kalim/kernel/net/ipv6/ipcomp6.ko:system/lib/modules/2.6.29-Kalim/kernel/net/ipv6/ipcomp6.ko \
|
||||
device/htc/tattoo/custom/modules/2.6.29-Kalim/kernel/net/ipv6/ipv6.ko:system/lib/modules/2.6.29-Kalim/kernel/net/ipv6/ipv6.ko \
|
||||
device/htc/tattoo/custom/modules/2.6.29-Kalim/kernel/net/ipv6/ah6.ko:system/lib/modules/2.6.29-Kalim/kernel/net/ipv6/ah6.ko \
|
||||
device/htc/tattoo/custom/modules/2.6.29-Kalim/kernel/net/ipv6/tunnel6.ko:system/lib/modules/2.6.29-Kalim/kernel/net/ipv6/tunnel6.ko \
|
||||
device/htc/tattoo/custom/modules/2.6.29-Kalim/kernel/net/ipv6/xfrm6_mode_beet.ko:system/lib/modules/2.6.29-Kalim/kernel/net/ipv6/xfrm6_mode_beet.ko \
|
||||
device/htc/tattoo/custom/modules/2.6.29-Kalim/kernel/net/netfilter/xt_TCPMSS.ko:system/lib/modules/2.6.29-Kalim/kernel/net/netfilter/xt_TCPMSS.ko \
|
||||
device/htc/tattoo/custom/modules/2.6.29-Kalim/kernel/net/xfrm/xfrm_ipcomp.ko:system/lib/modules/2.6.29-Kalim/kernel/net/xfrm/xfrm_ipcomp.ko \
|
||||
device/htc/tattoo/custom/modules/2.6.29-Kalim/kernel/net/ipv4/tunnel4.ko:system/lib/modules/2.6.29-Kalim/kernel/net/ipv4/tunnel4.ko \
|
||||
device/htc/tattoo/custom/modules/2.6.29-Kalim/kernel/drivers/staging/ramzswap/ramzswap.ko:system/lib/modules/2.6.29-Kalim/kernel/drivers/staging/ramzswap/ramzswap.ko \
|
||||
device/htc/tattoo/custom/modules/2.6.29-Kalim/kernel/drivers/hid/hid-dummy.ko:system/lib/modules/2.6.29-Kalim/kernel/drivers/hid/hid-dummy.ko \
|
||||
device/htc/tattoo/custom/modules/2.6.29-Kalim/kernel/fs/ext4/ext4.ko:system/lib/modules/2.6.29-Kalim/kernel/fs/ext4/ext4.ko \
|
||||
device/htc/tattoo/custom/modules/2.6.29-Kalim/kernel/fs/jbd2/jbd2.ko:system/lib/modules/2.6.29-Kalim/kernel/fs/jbd2/jbd2.ko \
|
||||
device/htc/tattoo/custom/modules/2.6.29-Kalim/kernel/crypto/deflate.ko:system/lib/modules/2.6.29-Kalim/kernel/crypto/deflate.ko \
|
||||
device/htc/tattoo/custom/modules/2.6.29-Kalim/kernel/lib/crc16.ko:system/lib/modules/2.6.29-Kalim/kernel/lib/crc16.ko \
|
||||
device/htc/tattoo/custom/modules/2.6.29-Kalim/modules.order:system/lib/modules/2.6.29-Kalim/modules.order \
|
||||
device/htc/tattoo/custom/modules/2.6.29-Kalim/modules.devname:system/lib/modules/2.6.29-Kalim/modules.devname \
|
||||
device/htc/tattoo/custom/modules/2.6.29-Kalim/modules.alias.bin:system/lib/modules/2.6.29-Kalim/modules.alias.bin \
|
||||
device/htc/tattoo/custom/modules/2.6.29-Kalim/modules.symbols.bin:system/lib/modules/2.6.29-Kalim/modules.symbols.bin \
|
||||
device/htc/tattoo/custom/modules/2.6.29-Kalim/modules.inputmap:system/lib/modules/2.6.29-Kalim/modules.inputmap \
|
||||
device/htc/tattoo/custom/modules/2.6.29-Kalim/modules.dep:system/lib/modules/2.6.29-Kalim/modules.dep \
|
||||
device/htc/tattoo/custom/modules/2.6.29-Kalim/modules.dep.bin:system/lib/modules/2.6.29-Kalim/modules.dep.bin \
|
||||
device/htc/tattoo/custom/modules/2.6.29-Kalim/modules.softdep:system/lib/modules/2.6.29-Kalim/modules.softdep \
|
||||
device/htc/tattoo/custom/modules/wlan.ko:system/lib/modules/wlan.ko
|
15
custom/10calibrate_screen
Normal file
15
custom/10calibrate_screen
Normal file
@ -0,0 +1,15 @@
|
||||
#!/system/bin/sh
|
||||
|
||||
SETTINGSDB=/data/data/com.android.providers.settings/databases/settings.db
|
||||
if [ ! -f $SETTINGSDB ] ;
|
||||
then
|
||||
exit
|
||||
fi
|
||||
|
||||
CALIBRATION=`sqlite3 $SETTINGSDB "select value from system where name='calibration_points';"`
|
||||
if [ ! -z $CALIBRATION ] ;
|
||||
then
|
||||
echo ">>> Calibrating touch screen with calibration points: " $CALIBRATION
|
||||
echo $CALIBRATION > /sys/class/input/input1/calibration_points
|
||||
fi
|
||||
|
Binary file not shown.
1308
custom/apns-conf.xml
Normal file
1308
custom/apns-conf.xml
Normal file
File diff suppressed because it is too large
Load Diff
BIN
custom/app/FancyWidget.apk
Normal file
BIN
custom/app/FancyWidget.apk
Normal file
Binary file not shown.
BIN
custom/app/HTCCalibrate.apk
Normal file
BIN
custom/app/HTCCalibrate.apk
Normal file
Binary file not shown.
168
custom/backuptool.sh
Normal file
168
custom/backuptool.sh
Normal file
@ -0,0 +1,168 @@
|
||||
#!/sbin/sh
|
||||
#
|
||||
# Backup and restore proprietary Android system files
|
||||
#
|
||||
|
||||
C=/tmp/backupdir
|
||||
S=/system
|
||||
V=KalimAz
|
||||
|
||||
PROCEED=1;
|
||||
|
||||
check_prereq() {
|
||||
if ( ! grep -q "^ro.modversion=.*$V.*" /system/build.prop );
|
||||
then
|
||||
echo "Not backing up files from incompatible version.";
|
||||
PROCEED=0;
|
||||
fi
|
||||
}
|
||||
|
||||
check_installscript() {
|
||||
if [ -f "/tmp/.installscript" ];
|
||||
then
|
||||
echo "/tmp/.installscript found. Skipping backuptool."
|
||||
PROCEED=0;
|
||||
fi
|
||||
}
|
||||
|
||||
get_files() {
|
||||
cat <<EOF
|
||||
app/CarHomeGoogle.apk
|
||||
app/CarHomeLauncher.apk
|
||||
app/Facebook.apk
|
||||
app/FOTAKill.apk
|
||||
app/GenieWidget.apk
|
||||
app/Gmail.apk
|
||||
app/GoogleBackupTransport.apk
|
||||
app/GoogleCalendarSyncAdapter.apk
|
||||
app/GoogleContactsSyncAdapter.apk
|
||||
app/GoogleFeedback.apk
|
||||
app/GooglePartnerSetup.apk
|
||||
app/GoogleQuickSearchBox.apk app/QuickSearchBox.apk
|
||||
app/GoogleServicesFramework.apk
|
||||
app/googlevoice.apk
|
||||
app/HtcCopyright.apk
|
||||
app/HtcEmailPolicy.apk
|
||||
app/HtcSettings.apk
|
||||
app/kickback.apk
|
||||
app/LatinImeTutorial.apk
|
||||
app/Maps.apk
|
||||
app/MapsSapphire.apk
|
||||
app/MarketUpdater.apk
|
||||
app/MediaUploader.apk
|
||||
app/NetworkLocation.apk
|
||||
app/OneTimeInitializer.apk
|
||||
app/PassionQuickOffice.apk
|
||||
app/Quickoffice.apk
|
||||
app/SetupWizard.apk app/Provision.apk
|
||||
app/soundback.apk
|
||||
app/Street.apk
|
||||
app/Talk.apk
|
||||
app/talkback.apk
|
||||
app/Twitter.apk
|
||||
app/Vending.apk
|
||||
app/VoiceSearch.apk
|
||||
app/YouTube.apk
|
||||
etc/permissions/com.google.android.maps.xml
|
||||
etc/permissions/features.xml
|
||||
framework/com.google.android.maps.jar
|
||||
lib/libspeech.so
|
||||
lib/libvoicesearch.so
|
||||
etc/hosts
|
||||
etc/custom_backup_list.txt
|
||||
EOF
|
||||
}
|
||||
|
||||
get_custom_files() {
|
||||
local L
|
||||
if [ -f "$C/custom_backup_list.txt" ];
|
||||
then
|
||||
[ ! -f $C/fixed_custom_backup_list.txt ] && tr -d '\r' < $C/custom_backup_list.txt \
|
||||
> $C/fixed_custom_backup_list.txt
|
||||
L=`cat $C/fixed_custom_backup_list.txt`
|
||||
cat <<EOF
|
||||
$L
|
||||
EOF
|
||||
fi
|
||||
}
|
||||
|
||||
backup_file() {
|
||||
if [ -e "$1" ];
|
||||
then
|
||||
if [ -n "$2" ];
|
||||
then
|
||||
echo "$2 $1" | md5sum -c -
|
||||
if [ $? -ne 0 ];
|
||||
then
|
||||
echo "MD5Sum check for $1 failed!";
|
||||
exit $?;
|
||||
fi
|
||||
fi
|
||||
|
||||
local F=`basename $1`
|
||||
|
||||
# dont backup any apps that have odex files, they are useless
|
||||
if ( echo $F | grep -q "\.apk$" ) && [ -e `echo $1 | sed -e 's/\.apk$/\.odex/'` ];
|
||||
then
|
||||
echo "Skipping odexed apk $1";
|
||||
else
|
||||
cp -p $1 $C/$F
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
restore_file() {
|
||||
local FILE=`basename $1`
|
||||
local DIR=`dirname $1`
|
||||
if [ -e "$C/$FILE" ];
|
||||
then
|
||||
if [ ! -d "$DIR" ];
|
||||
then
|
||||
mkdir -p $DIR;
|
||||
fi
|
||||
cp -p $C/$FILE $1;
|
||||
if [ -n "$2" ];
|
||||
then
|
||||
rm $2;
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
check_installscript;
|
||||
|
||||
case "$1" in
|
||||
backup)
|
||||
mount $S
|
||||
check_prereq;
|
||||
if [ $PROCEED -ne 0 ];
|
||||
then
|
||||
rm -rf $C
|
||||
mkdir -p $C
|
||||
for file_list in get_files get_custom_files; do
|
||||
$file_list | while read FILE REPLACEMENT; do
|
||||
backup_file $S/$FILE
|
||||
done
|
||||
done
|
||||
fi
|
||||
umount $S
|
||||
;;
|
||||
restore)
|
||||
check_prereq;
|
||||
if [ $PROCEED -ne 0 ];
|
||||
then
|
||||
for file_list in get_files get_custom_files; do
|
||||
$file_list | while read FILE REPLACEMENT; do
|
||||
R=""
|
||||
[ -n "$REPLACEMENT" ] && R="$S/$REPLACEMENT"
|
||||
restore_file $S/$FILE $R
|
||||
done
|
||||
done
|
||||
rm -rf $C
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {backup|restore}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
exit 0
|
BIN
custom/bootanimation.zip
Normal file
BIN
custom/bootanimation.zip
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
33
custom/compcache
Normal file
33
custom/compcache
Normal file
@ -0,0 +1,33 @@
|
||||
#!/system/bin/sh
|
||||
#
|
||||
# Compcache manager
|
||||
# shade@chemlab.org (cyanogen)
|
||||
#
|
||||
|
||||
DEV=/dev/block/ramzswap0
|
||||
MODULE=ramzswap
|
||||
MODULES_DIR=/system/lib/modules/`uname -r`
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
echo 3 > /proc/sys/vm/drop_caches
|
||||
echo 30 > /proc/sys/vm/swappiness
|
||||
modprobe $MODULE
|
||||
rzscontrol $DEV --disksize_kb=$2 --init
|
||||
swapon $DEV
|
||||
;;
|
||||
|
||||
stop)
|
||||
swapoff $DEV >/dev/null 2>&1
|
||||
rmmod $MODULE >/dev/null 2>&1
|
||||
;;
|
||||
stats)
|
||||
rzscontrol $DEV --stats
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start <size>|stop|stats}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
exit 0
|
||||
|
Binary file not shown.
BIN
custom/dropbear
BIN
custom/dropbear
Binary file not shown.
Binary file not shown.
16557
custom/hosts
Normal file
16557
custom/hosts
Normal file
File diff suppressed because it is too large
Load Diff
BIN
custom/kernel
Executable file
BIN
custom/kernel
Executable file
Binary file not shown.
BIN
custom/modules/2.6.29-Kalim/kernel/crypto/deflate.ko
Normal file
BIN
custom/modules/2.6.29-Kalim/kernel/crypto/deflate.ko
Normal file
Binary file not shown.
BIN
custom/modules/2.6.29-Kalim/kernel/drivers/hid/hid-dummy.ko
Normal file
BIN
custom/modules/2.6.29-Kalim/kernel/drivers/hid/hid-dummy.ko
Normal file
Binary file not shown.
Binary file not shown.
BIN
custom/modules/2.6.29-Kalim/kernel/fs/ext4/ext4.ko
Normal file
BIN
custom/modules/2.6.29-Kalim/kernel/fs/ext4/ext4.ko
Normal file
Binary file not shown.
BIN
custom/modules/2.6.29-Kalim/kernel/fs/jbd2/jbd2.ko
Normal file
BIN
custom/modules/2.6.29-Kalim/kernel/fs/jbd2/jbd2.ko
Normal file
Binary file not shown.
BIN
custom/modules/2.6.29-Kalim/kernel/lib/crc16.ko
Normal file
BIN
custom/modules/2.6.29-Kalim/kernel/lib/crc16.ko
Normal file
Binary file not shown.
Binary file not shown.
BIN
custom/modules/2.6.29-Kalim/kernel/net/ipv6/ah6.ko
Normal file
BIN
custom/modules/2.6.29-Kalim/kernel/net/ipv6/ah6.ko
Normal file
Binary file not shown.
BIN
custom/modules/2.6.29-Kalim/kernel/net/ipv6/esp6.ko
Normal file
BIN
custom/modules/2.6.29-Kalim/kernel/net/ipv6/esp6.ko
Normal file
Binary file not shown.
Binary file not shown.
BIN
custom/modules/2.6.29-Kalim/kernel/net/ipv6/ipcomp6.ko
Normal file
BIN
custom/modules/2.6.29-Kalim/kernel/net/ipv6/ipcomp6.ko
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
custom/modules/2.6.29-Kalim/kernel/net/ipv6/xfrm6_mode_beet.ko
Normal file
BIN
custom/modules/2.6.29-Kalim/kernel/net/ipv6/xfrm6_mode_beet.ko
Normal file
Binary file not shown.
BIN
custom/modules/2.6.29-Kalim/kernel/net/ipv6/xfrm6_mode_ro.ko
Normal file
BIN
custom/modules/2.6.29-Kalim/kernel/net/ipv6/xfrm6_mode_ro.ko
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
custom/modules/2.6.29-Kalim/kernel/net/ipv6/xfrm6_tunnel.ko
Normal file
BIN
custom/modules/2.6.29-Kalim/kernel/net/ipv6/xfrm6_tunnel.ko
Normal file
Binary file not shown.
Binary file not shown.
BIN
custom/modules/2.6.29-Kalim/kernel/net/xfrm/xfrm_ipcomp.ko
Normal file
BIN
custom/modules/2.6.29-Kalim/kernel/net/xfrm/xfrm_ipcomp.ko
Normal file
Binary file not shown.
15
custom/modules/2.6.29-Kalim/modules.alias
Normal file
15
custom/modules/2.6.29-Kalim/modules.alias
Normal file
@ -0,0 +1,15 @@
|
||||
# Aliases extracted from modules themselves.
|
||||
alias ip6t_TCPMSS xt_TCPMSS
|
||||
alias ipt_TCPMSS xt_TCPMSS
|
||||
alias net-pf-10 ipv6
|
||||
alias xfrm-type-10-51 ah6
|
||||
alias xfrm-type-10-50 esp6
|
||||
alias xfrm-type-10-108 ipcomp6
|
||||
alias xfrm-type-10-41 xfrm6_tunnel
|
||||
alias xfrm-mode-10-0 xfrm6_mode_transport
|
||||
alias xfrm-mode-10-1 xfrm6_mode_tunnel
|
||||
alias xfrm-mode-10-2 xfrm6_mode_ro
|
||||
alias xfrm-mode-10-4 xfrm6_mode_beet
|
||||
alias xfrm-type-10-43 mip6
|
||||
alias xfrm-type-10-60 mip6
|
||||
alias sit0 sit
|
BIN
custom/modules/2.6.29-Kalim/modules.alias.bin
Normal file
BIN
custom/modules/2.6.29-Kalim/modules.alias.bin
Normal file
Binary file not shown.
1
custom/modules/2.6.29-Kalim/modules.ccwmap
Normal file
1
custom/modules/2.6.29-Kalim/modules.ccwmap
Normal file
@ -0,0 +1 @@
|
||||
# ccw module match_flags cu_type cu_model dev_type dev_model
|
22
custom/modules/2.6.29-Kalim/modules.dep
Normal file
22
custom/modules/2.6.29-Kalim/modules.dep
Normal file
@ -0,0 +1,22 @@
|
||||
kernel/fs/ext4/ext4.ko: kernel/fs/jbd2/jbd2.ko kernel/lib/crc16.ko
|
||||
kernel/fs/jbd2/jbd2.ko:
|
||||
kernel/crypto/deflate.ko:
|
||||
kernel/drivers/hid/hid-dummy.ko:
|
||||
kernel/drivers/staging/ramzswap/ramzswap.ko:
|
||||
kernel/net/netfilter/xt_TCPMSS.ko:
|
||||
kernel/net/ipv4/tunnel4.ko:
|
||||
kernel/net/xfrm/xfrm_ipcomp.ko:
|
||||
kernel/net/ipv6/ipv6.ko:
|
||||
kernel/net/ipv6/ah6.ko: kernel/net/ipv6/ipv6.ko
|
||||
kernel/net/ipv6/esp6.ko: kernel/net/ipv6/ipv6.ko
|
||||
kernel/net/ipv6/ipcomp6.ko: kernel/net/xfrm/xfrm_ipcomp.ko kernel/net/ipv6/xfrm6_tunnel.ko kernel/net/ipv6/tunnel6.ko kernel/net/ipv6/ipv6.ko
|
||||
kernel/net/ipv6/xfrm6_tunnel.ko: kernel/net/ipv6/tunnel6.ko kernel/net/ipv6/ipv6.ko
|
||||
kernel/net/ipv6/tunnel6.ko: kernel/net/ipv6/ipv6.ko
|
||||
kernel/net/ipv6/xfrm6_mode_transport.ko:
|
||||
kernel/net/ipv6/xfrm6_mode_tunnel.ko: kernel/net/ipv6/ipv6.ko
|
||||
kernel/net/ipv6/xfrm6_mode_ro.ko:
|
||||
kernel/net/ipv6/xfrm6_mode_beet.ko: kernel/net/ipv6/ipv6.ko
|
||||
kernel/net/ipv6/mip6.ko: kernel/net/ipv6/ipv6.ko
|
||||
kernel/net/ipv6/sit.ko: kernel/net/ipv4/tunnel4.ko kernel/net/ipv6/ipv6.ko
|
||||
kernel/net/ipv6/ip6_tunnel.ko: kernel/net/ipv6/tunnel6.ko kernel/net/ipv6/ipv6.ko
|
||||
kernel/lib/crc16.ko:
|
BIN
custom/modules/2.6.29-Kalim/modules.dep.bin
Normal file
BIN
custom/modules/2.6.29-Kalim/modules.dep.bin
Normal file
Binary file not shown.
1
custom/modules/2.6.29-Kalim/modules.devname
Normal file
1
custom/modules/2.6.29-Kalim/modules.devname
Normal file
@ -0,0 +1 @@
|
||||
# Device nodes to trigger on-demand module loading.
|
1
custom/modules/2.6.29-Kalim/modules.ieee1394map
Normal file
1
custom/modules/2.6.29-Kalim/modules.ieee1394map
Normal file
@ -0,0 +1 @@
|
||||
# ieee1394 module match_flags vendor_id model_id specifier_id version
|
1
custom/modules/2.6.29-Kalim/modules.inputmap
Normal file
1
custom/modules/2.6.29-Kalim/modules.inputmap
Normal file
@ -0,0 +1 @@
|
||||
# module matchBits bustype vendor product version evBits keyBits relBits absBits mscBits ledBits sndBits ffBits [swBits] driver_info
|
1
custom/modules/2.6.29-Kalim/modules.isapnpmap
Normal file
1
custom/modules/2.6.29-Kalim/modules.isapnpmap
Normal file
@ -0,0 +1 @@
|
||||
# isapnp module cardvendor carddevice driver_data vendor function ...
|
1
custom/modules/2.6.29-Kalim/modules.ofmap
Normal file
1
custom/modules/2.6.29-Kalim/modules.ofmap
Normal file
@ -0,0 +1 @@
|
||||
# of module name type compatible
|
22
custom/modules/2.6.29-Kalim/modules.order
Normal file
22
custom/modules/2.6.29-Kalim/modules.order
Normal file
@ -0,0 +1,22 @@
|
||||
kernel/fs/ext4/ext4.ko
|
||||
kernel/fs/jbd2/jbd2.ko
|
||||
kernel/crypto/deflate.ko
|
||||
kernel/drivers/hid/hid-dummy.ko
|
||||
kernel/drivers/staging/ramzswap/ramzswap.ko
|
||||
kernel/net/netfilter/xt_TCPMSS.ko
|
||||
kernel/net/ipv4/tunnel4.ko
|
||||
kernel/net/xfrm/xfrm_ipcomp.ko
|
||||
kernel/net/ipv6/ipv6.ko
|
||||
kernel/net/ipv6/ah6.ko
|
||||
kernel/net/ipv6/esp6.ko
|
||||
kernel/net/ipv6/ipcomp6.ko
|
||||
kernel/net/ipv6/xfrm6_tunnel.ko
|
||||
kernel/net/ipv6/tunnel6.ko
|
||||
kernel/net/ipv6/xfrm6_mode_transport.ko
|
||||
kernel/net/ipv6/xfrm6_mode_tunnel.ko
|
||||
kernel/net/ipv6/xfrm6_mode_ro.ko
|
||||
kernel/net/ipv6/xfrm6_mode_beet.ko
|
||||
kernel/net/ipv6/mip6.ko
|
||||
kernel/net/ipv6/sit.ko
|
||||
kernel/net/ipv6/ip6_tunnel.ko
|
||||
kernel/lib/crc16.ko
|
1
custom/modules/2.6.29-Kalim/modules.pcimap
Normal file
1
custom/modules/2.6.29-Kalim/modules.pcimap
Normal file
@ -0,0 +1 @@
|
||||
# pci module vendor device subvendor subdevice class class_mask driver_data
|
1
custom/modules/2.6.29-Kalim/modules.seriomap
Normal file
1
custom/modules/2.6.29-Kalim/modules.seriomap
Normal file
@ -0,0 +1 @@
|
||||
# serio module type extra id proto
|
2
custom/modules/2.6.29-Kalim/modules.softdep
Normal file
2
custom/modules/2.6.29-Kalim/modules.softdep
Normal file
@ -0,0 +1,2 @@
|
||||
# Soft dependencies extracted from modules themselves.
|
||||
# Copy, with a .conf extension, to /etc/modprobe.d to use it with modprobe.
|
112
custom/modules/2.6.29-Kalim/modules.symbols
Normal file
112
custom/modules/2.6.29-Kalim/modules.symbols
Normal file
@ -0,0 +1,112 @@
|
||||
# Aliases for symbols, used by symbol_request().
|
||||
alias symbol:jbd2_journal_try_to_free_buffers jbd2
|
||||
alias symbol:jbd2_journal_start_commit jbd2
|
||||
alias symbol:ip6_local_out ipv6
|
||||
alias symbol:jbd2_journal_load jbd2
|
||||
alias symbol:jbd2_journal_flush jbd2
|
||||
alias symbol:ipv6_getsockopt ipv6
|
||||
alias symbol:xfrm6_tunnel_alloc_spi xfrm6_tunnel
|
||||
alias symbol:ip6_route_me_harder ipv6
|
||||
alias symbol:ip6_frag_match ipv6
|
||||
alias symbol:inet6_add_protocol ipv6
|
||||
alias symbol:inet6_csk_search_req ipv6
|
||||
alias symbol:ndisc_build_skb ipv6
|
||||
alias symbol:ip6_dst_blackhole ipv6
|
||||
alias symbol:in6_dev_finish_destroy ipv6
|
||||
alias symbol:jbd2_journal_init_dev jbd2
|
||||
alias symbol:jbd2_journal_update_format jbd2
|
||||
alias symbol:inet6_del_protocol ipv6
|
||||
alias symbol:jbd2_journal_blocks_per_page jbd2
|
||||
alias symbol:ndisc_send_skb ipv6
|
||||
alias symbol:xfrm6_tunnel_register tunnel6
|
||||
alias symbol:xfrm4_tunnel_register tunnel4
|
||||
alias symbol:jbd2_journal_restart jbd2
|
||||
alias symbol:jbd2_journal_destroy jbd2
|
||||
alias symbol:ipcomp_init_state xfrm_ipcomp
|
||||
alias symbol:inet6_hash_frag ipv6
|
||||
alias symbol:jbd2_journal_get_undo_access jbd2
|
||||
alias symbol:icmpv6msg_statistics ipv6
|
||||
alias symbol:xfrm6_rcv ipv6
|
||||
alias symbol:xfrm6_tunnel_spi_lookup xfrm6_tunnel
|
||||
alias symbol:jbd2_journal_init_jbd_inode jbd2
|
||||
alias symbol:nf_ip6_checksum ipv6
|
||||
alias symbol:__ipv6_isatap_ifid ipv6
|
||||
alias symbol:jbd2_journal_abort jbd2
|
||||
alias symbol:crc16 crc16
|
||||
alias symbol:ipv6_chk_prefix ipv6
|
||||
alias symbol:ip6_xmit ipv6
|
||||
alias symbol:jbd2_journal_unlock_updates jbd2
|
||||
alias symbol:xfrm6_tunnel_deregister tunnel6
|
||||
alias symbol:xfrm4_tunnel_deregister tunnel4
|
||||
alias symbol:crc16_table crc16
|
||||
alias symbol:jbd2_journal_wipe jbd2
|
||||
alias symbol:ipv6_dev_get_saddr ipv6
|
||||
alias symbol:ip6_sk_dst_lookup ipv6
|
||||
alias symbol:xfrm6_prepare_output ipv6
|
||||
alias symbol:icmpv6_send ipv6
|
||||
alias symbol:ip6_frag_init ipv6
|
||||
alias symbol:net_ipv6_ctl_path ipv6
|
||||
alias symbol:ipv6_dup_options ipv6
|
||||
alias symbol:jbd2_journal_set_features jbd2
|
||||
alias symbol:xfrm6_rcv_spi ipv6
|
||||
alias symbol:jbd2_journal_lock_updates jbd2
|
||||
alias symbol:tcp6_gro_receive ipv6
|
||||
alias symbol:xfrm6_tunnel_free_spi xfrm6_tunnel
|
||||
alias symbol:xfrm6_find_1stfragopt ipv6
|
||||
alias symbol:jbd2_journal_clear_features jbd2
|
||||
alias symbol:inet6_csk_bind_conflict ipv6
|
||||
alias symbol:ip6_route_output ipv6
|
||||
alias symbol:ipv6_push_nfrag_opts ipv6
|
||||
alias symbol:ipcomp_destroy xfrm_ipcomp
|
||||
alias symbol:jbd2_journal_get_create_access jbd2
|
||||
alias symbol:jbd2_journal_init_inode jbd2
|
||||
alias symbol:rawv6_mh_filter_register ipv6
|
||||
alias symbol:rawv6_mh_filter_unregister ipv6
|
||||
alias symbol:jbd2_journal_release_buffer jbd2
|
||||
alias symbol:ipv6_setsockopt ipv6
|
||||
alias symbol:inet6_csk_reqsk_queue_hash_add ipv6
|
||||
alias symbol:register_inet6addr_notifier ipv6
|
||||
alias symbol:jbd2_journal_forget jbd2
|
||||
alias symbol:jbd2_journal_start jbd2
|
||||
alias symbol:jbd2_journal_force_commit_nested jbd2
|
||||
alias symbol:jbd2_journal_check_used_features jbd2
|
||||
alias symbol:icmpv6_err_convert ipv6
|
||||
alias symbol:ipcomp_input xfrm_ipcomp
|
||||
alias symbol:inet6_sk_rebuild_header ipv6
|
||||
alias symbol:icmpv6_statistics ipv6
|
||||
alias symbol:fl6_sock_lookup ipv6
|
||||
alias symbol:jbd2_journal_set_triggers jbd2
|
||||
alias symbol:xfrm6_input_addr ipv6
|
||||
alias symbol:ndisc_mc_map ipv6
|
||||
alias symbol:inet6_csk_addr2sockaddr ipv6
|
||||
alias symbol:inet6_release ipv6
|
||||
alias symbol:tcp6_gro_complete ipv6
|
||||
alias symbol:rt6_lookup ipv6
|
||||
alias symbol:jbd2_journal_check_available_features jbd2
|
||||
alias symbol:jbd2_journal_stop jbd2
|
||||
alias symbol:jbd2_journal_extend jbd2
|
||||
alias symbol:jbd2_journal_ack_err jbd2
|
||||
alias symbol:jbd2_journal_begin_ordered_truncate jbd2
|
||||
alias symbol:jbd2_journal_file_inode jbd2
|
||||
alias symbol:ipv6_opt_accepted ipv6
|
||||
alias symbol:jbd2_journal_errno jbd2
|
||||
alias symbol:inet6_csk_xmit ipv6
|
||||
alias symbol:inet6_register_protosw ipv6
|
||||
alias symbol:ip6_dst_lookup ipv6
|
||||
alias symbol:jbd2_log_wait_commit jbd2
|
||||
alias symbol:inet6_getname ipv6
|
||||
alias symbol:jbd2_journal_clear_err jbd2
|
||||
alias symbol:jbd2_journal_release_jbd_inode jbd2
|
||||
alias symbol:ipcomp_output xfrm_ipcomp
|
||||
alias symbol:jbd2_journal_revoke jbd2
|
||||
alias symbol:inet6_destroy_sock ipv6
|
||||
alias symbol:jbd2_journal_get_write_access jbd2
|
||||
alias symbol:jbd2_journal_invalidatepage jbd2
|
||||
alias symbol:inet6_unregister_protosw ipv6
|
||||
alias symbol:inet6_ioctl ipv6
|
||||
alias symbol:inet6_bind ipv6
|
||||
alias symbol:jbd2_journal_dirty_metadata jbd2
|
||||
alias symbol:jbd2_journal_force_commit jbd2
|
||||
alias symbol:unregister_inet6addr_notifier ipv6
|
||||
alias symbol:ipv6_chk_addr ipv6
|
||||
alias symbol:ipv6_find_tlv ipv6
|
BIN
custom/modules/2.6.29-Kalim/modules.symbols.bin
Normal file
BIN
custom/modules/2.6.29-Kalim/modules.symbols.bin
Normal file
Binary file not shown.
1
custom/modules/2.6.29-Kalim/modules.usbmap
Normal file
1
custom/modules/2.6.29-Kalim/modules.usbmap
Normal file
@ -0,0 +1 @@
|
||||
# usb module match_flags idVendor idProduct bcdDevice_lo bcdDevice_hi bDeviceClass bDeviceSubClass bDeviceProtocol bInterfaceClass bInterfaceSubClass bInterfaceProtocol driver_info
|
1
custom/modules/2.6.29-Kalim/source
Symbolic link
1
custom/modules/2.6.29-Kalim/source
Symbolic link
@ -0,0 +1 @@
|
||||
/home/calimochoazucarado/android/Enviado_a_GITHUB/kernel.kalimochoAz
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1 +0,0 @@
|
||||
root:x:0:0:root:/root:/system/bin/sh
|
BIN
custom/recovery_kernel
Executable file
BIN
custom/recovery_kernel
Executable file
Binary file not shown.
BIN
custom/recovery_kernel.arco
Normal file
BIN
custom/recovery_kernel.arco
Normal file
Binary file not shown.
BIN
custom/rzscontrol
Executable file → Normal file
BIN
custom/rzscontrol
Executable file → Normal file
Binary file not shown.
@ -1,11 +1,4 @@
|
||||
# - OOM killer simply kill the task that triggered the out-of-memory condition.
|
||||
# This avoids the expensive tasklist scan to save CPU time.
|
||||
vm.oom_kill_allocating_task=1
|
||||
|
||||
# - retaining dentry and inode caches instead of reclaiming them by default
|
||||
# to increase battery life.
|
||||
vm.vfs_cache_pressure=10
|
||||
|
||||
# - set page-cluster to 0, ie, 1 page per swapping
|
||||
vm.page-cluster=0
|
||||
|
||||
# Scheduler-Tuning
|
||||
kernel.sched_latency_ns = 60000000
|
||||
kernel.sched_min_granularity_ns = 2000000
|
||||
kernel.sched_wakeup_granularity_ns = 5000000
|
||||
|
@ -1,91 +0,0 @@
|
||||
# libgps is necessary to complete the compilation
|
||||
PRODUCT_COPY_FILES += \
|
||||
device/htc/tattoo/custom/logo.rle:root/logo.rle \
|
||||
device/htc/tattoo/proprietary/libgps.so:obj/lib/libgps.so
|
||||
|
||||
# Files in /system/etc
|
||||
PRODUCT_COPY_FILES += \
|
||||
device/htc/tattoo/custom/passwd:system/etc/passwd \
|
||||
device/htc/tattoo/custom/sysctl.conf:system/etc/sysctl.conf \
|
||||
device/htc/tattoo/custom/permissions/android.hardware.camera.autofocus.xml:system/etc/permissions/android.hardware.camera.autofocus.xml \
|
||||
device/htc/tattoo/custom/placeholder:system/lib/modules/placeholder \
|
||||
device/htc/tattoo/custom/modules/ip6_tunnel.ko:system/lib/modules/ip6_tunnel.ko \
|
||||
device/htc/tattoo/custom/modules/ipv6.ko:system/lib/modules/ipv6.ko \
|
||||
device/htc/tattoo/custom/modules/mip6.ko:system/lib/modules/mip6.ko \
|
||||
device/htc/tattoo/custom/modules/ramzswap.ko:system/lib/modules/ramzswap.ko \
|
||||
device/htc/tattoo/custom/modules/sit.ko:system/lib/modules/sit.ko \
|
||||
device/htc/tattoo/custom/modules/tunnel4.ko:system/lib/modules/tunnel4.ko \
|
||||
device/htc/tattoo/custom/modules/tunnel6.ko:system/lib/modules/tunnel6.ko \
|
||||
device/htc/tattoo/custom/modules/wlan.ko:system/lib/modules/wlan.ko \
|
||||
device/htc/tattoo/custom/modules/xfrm6_mode_beet.ko:system/lib/modules/xfrm6_mode_beet.ko \
|
||||
device/htc/tattoo/custom/modules/xfrm6_mode_transport.ko:system/lib/modules/xfrm6_mode_transport.ko \
|
||||
device/htc/tattoo/custom/modules/xfrm6_mode_tunnel.ko:system/lib/modules/xfrm6_mode_tunnel.ko \
|
||||
device/htc/tattoo/custom/modules/xt_TCPMSS.ko:system/lib/modules/xt_TCPMSS.ko \
|
||||
device/htc/tattoo/custom/modules/tattoo-hack.ko:system/lib/modules/tattoo-hack.ko
|
||||
|
||||
# Tattoo Calibration app
|
||||
PRODUCT_COPY_FILES += \
|
||||
device/htc/tattoo/custom/TattooCalibration.apk:system/app/TattooCalibration.apk
|
||||
|
||||
# proprietary for /system/sbin
|
||||
PRODUCT_COPY_FILES += \
|
||||
device/htc/tattoo/custom/dropbear:system/xbin/dropbear \
|
||||
device/htc/tattoo/custom/dropbearkey:system/xbin/dropbearkey \
|
||||
device/htc/tattoo/custom/rzscontrol:system/xbin/rzscontrol
|
||||
|
||||
# proprietary for /system/usr/keychars and /system/usr/keylayout
|
||||
PRODUCT_COPY_FILES += \
|
||||
device/htc/tattoo/proprietary/qwerty2.kcm.bin:system/usr/keychars/qwerty2.kcm.bin \
|
||||
device/htc/tattoo/proprietary/qwerty.kcm.bin:system/usr/keychars/qwerty.kcm.bin
|
||||
|
||||
# boot partition
|
||||
PRODUCT_COPY_FILES += \
|
||||
device/htc/tattoo/custom/modules/tattoo-hack.ko:root/lib/modules/tattoo-hack.ko \
|
||||
|
||||
# Other bin stuff
|
||||
PRODUCT_COPY_FILES += \
|
||||
device/htc/tattoo/proprietary/akm8973:system/bin/akm8973
|
||||
|
||||
# proprietary stuff
|
||||
PRODUCT_COPY_FILES += \
|
||||
device/htc/tattoo/proprietary/AudioPara4.csv:system/etc/AudioPara4.csv \
|
||||
device/htc/tattoo/proprietary/AudioFilter.csv:system/etc/AudioFilter.csv \
|
||||
device/htc/tattoo/proprietary/AudioPreProcess.csv:system/etc/AudioPreProcess.csv \
|
||||
device/htc/tattoo/proprietary/Fw1251r1c.bin:system/etc/wifi/Fw1251r1c.bin \
|
||||
device/htc/tattoo/proprietary/tiwlan.ini:system/etc/wifi/tiwlan.ini \
|
||||
device/htc/tattoo/proprietary/libA2DP.so:system/lib/libA2DP.so \
|
||||
device/htc/tattoo/proprietary/libaudioeq.so:system/lib/libaudioeq.so \
|
||||
device/htc/tattoo/proprietary/libGLES_qcom.so:system/lib/egl/libGLES_qcom.so \
|
||||
device/htc/tattoo/proprietary/libgps.so:system/lib/libgps.so \
|
||||
device/htc/tattoo/proprietary/liboemcamera.so:system/lib/liboemcamera.so \
|
||||
device/htc/tattoo/proprietary/libOmxH264Dec.so:system/lib/libOmxH264Dec.so \
|
||||
device/htc/tattoo/proprietary/libOmxMpeg4Dec.so:system/lib/libOmxMpeg4Dec.so \
|
||||
device/htc/tattoo/proprietary/libOmxVidEnc.so:system/lib/libOmxVidEnc.so \
|
||||
device/htc/tattoo/proprietary/libmmcamera.so:system/lib/libmmcamera.so \
|
||||
device/htc/tattoo/proprietary/libmm-qcamera-tgt.so:system/lib/libmm-qcamera-tgt.so \
|
||||
device/htc/tattoo/proprietary/libqcamera.so:system/lib/libqcamera.so \
|
||||
device/htc/tattoo/proprietary/libmmjpeg.so:system/lib/libmmjpeg.so \
|
||||
device/htc/tattoo/proprietary/libmm-adspsvc.so:system/lib/libmm-adspsvc.so \
|
||||
device/htc/tattoo/proprietary/libhtc_acoustic.so:system/lib/libhtc_acoustic.so \
|
||||
device/htc/tattoo/proprietary/libhtc_ril.so:system/lib/libhtc_ril.so \
|
||||
device/htc/tattoo/proprietary/brf6300.bin:system/etc/firmware/brf6300.bin \
|
||||
device/htc/tattoo/proprietary/brf6350.bin:system/etc/firmware/brf6350.bin \
|
||||
device/htc/tattoo/proprietary/bahamas-keypad.kl:system/usr/keylayout/bahamas-keypad.kl \
|
||||
device/htc/tattoo/proprietary/h2w_headset.kl:system/usr/keylayout/h2w_headset.kl \
|
||||
device/htc/tattoo/proprietary/qwerty.kl:system/usr/keylayout/qwerty.kl \
|
||||
device/htc/tattoo/proprietary/agps_rm:/system/etc/agps_rm \
|
||||
device/htc/tattoo/proprietary/libt9.so:system/lib/libt9.so \
|
||||
device/htc/tattoo/proprietary/voicemail-conf.xml:system/etc/voicemail-conf.xml \
|
||||
device/htc/tattoo/proprietary/spn-conf.xml:system/etc/spn-conf.xml \
|
||||
device/htc/tattoo/proprietary/sensors.bahamas.so:system/lib/hw/sensors.bahamas.so
|
||||
|
||||
ifdef WITH_WINDOWS_MEDIA
|
||||
PRODUCT_COPY_FILES += \
|
||||
device/htc/tattoo/proprietary/libomx_wmadec_sharedlibrary.so:system/lib/libomx_wmadec_sharedlibrary.so \
|
||||
device/htc/tattoo/proprietary/libomx_wmvdec_sharedlibrary.so:system/lib/libomx_wmvdec_sharedlibrary.so \
|
||||
device/htc/tattoo/proprietary/libpvasfcommon.so:system/lib/libpvasfcommon.so \
|
||||
device/htc/tattoo/proprietary/libpvasflocalpbreg.so:system/lib/libpvasflocalpbreg.so \
|
||||
device/htc/tattoo/proprietary/libpvasflocalpb.so:system/lib/libpvasflocalpb.so \
|
||||
device/htc/tattoo/proprietary/pvasflocal.cfg:system/etc/pvasflocal.cfg
|
||||
endif
|
||||
|
BIN
firmware/Fw1251r1c.bin
Normal file
BIN
firmware/Fw1251r1c.bin
Normal file
Binary file not shown.
BIN
firmware/brf6300.bin
Normal file
BIN
firmware/brf6300.bin
Normal file
Binary file not shown.
BIN
firmware/brf6350.bin
Normal file
BIN
firmware/brf6350.bin
Normal file
Binary file not shown.
BIN
firmware/tiinit_5.3.53.bts
Normal file
BIN
firmware/tiinit_5.3.53.bts
Normal file
Binary file not shown.
@ -1,39 +0,0 @@
|
||||
# Copyright (C) 2009 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 tattoo 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, $(SRC_TARGET_DIR)/product/languages_full.mk)
|
||||
$(call inherit-product, $(SRC_TARGET_DIR)/product/languages_full.mk)
|
||||
$(call inherit-product, device/htc/tattoo/device_tattoo_eu.mk)
|
||||
|
||||
# stuff common to all HTC phones
|
||||
$(call inherit-product, device/htc/common/common.mk)
|
||||
|
||||
$(call inherit-product, $(SRC_TARGET_DIR)/product/full.mk)
|
||||
|
||||
PRODUCT_MODEL := tattoo
|
||||
#PRODUCT_LOCALES := es_ES
|
||||
ro.product.locale.language=es
|
||||
ro.product.locale.region=ES
|
||||
ro.product.name=Kalim2010
|
||||
ro.rommanager.developerid=KalimochoAzucarado
|
||||
ro.modversion=CyanogenMod-6.2.0-RC1-Kalim
|
||||
ro.build.date.utc=1293591804
|
34
init.bahamas.rc
Executable file → Normal file
34
init.bahamas.rc
Executable file → Normal file
@ -20,22 +20,28 @@ on boot
|
||||
mkdir /data/misc/dhcp 0770 dhcp dhcp
|
||||
chown dhcp dhcp /data/misc/dhcp
|
||||
|
||||
# write screen calibration
|
||||
write /sys/class/input/input1/calibration_points 794,867,213,863,502,493,798,120,198,139
|
||||
|
||||
# bluetooth power up/down interface
|
||||
chown bluetooth bluetooth /sys/class/rfkill/rfkill0/type
|
||||
chown bluetooth bluetooth /sys/class/rfkill/rfkill0/state
|
||||
chmod 0660 /sys/class/rfkill/rfkill0/state
|
||||
chown bluetooth bluetooth /sys/devices/platform/msm_serial_hs.0/serial_lock_cpu
|
||||
chmod 0660 /sys/devices/platform/msm_serial_hs.0/serial_lock_cpu
|
||||
|
||||
# write screen calibration
|
||||
write /sys/class/input/input1/calibration 8
|
||||
write /sys/class/input/input1/calibration_points 824,855,206,865,509,502,826,139,201,142
|
||||
# Permissions for Liblights.
|
||||
chown system system /sys/class/leds/green/brightness
|
||||
chown system system /sys/class/leds/green/blink
|
||||
chown system system /sys/class/leds/amber/brightness
|
||||
chown system system /sys/class/leds/amber/blink
|
||||
chown system system /sys/class/leds/button-backlight/brightness
|
||||
chown system system /sys/class/leds/lcd-backlight/brightness
|
||||
|
||||
on property:init.svc.wpa_supplicant=stopped
|
||||
start dhcp-release
|
||||
# Revise su permisions to ensure all users can use it
|
||||
chmod 06755 /system/xbin/su
|
||||
|
||||
on property:init.svc.dhcp-release=stopped
|
||||
stop dhcpcd
|
||||
# cpufreq configurations
|
||||
write /sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate 40000
|
||||
write /sys/devices/system/cpu/cpu0/cpufreq/ondemand/up_threshold 85
|
||||
|
||||
# compass/accelerometer daemon
|
||||
service akm8973 /system/bin/akm8973
|
||||
@ -50,15 +56,15 @@ service wlan_loader /system/bin/wlan_loader \
|
||||
|
||||
service wpa_supplicant /system/bin/wpa_supplicant \
|
||||
-Dtiwlan0 -itiwlan0 -c/data/misc/wifi/wpa_supplicant.conf -q
|
||||
# we will start as root and wpa_supplicant will switch to user wifi
|
||||
# after setting up the capabilities required for WEXT
|
||||
# user wifi
|
||||
# group wifi inet keystore
|
||||
socket wpa_tiwlan0 dgram 660 wifi wifi
|
||||
disabled
|
||||
oneshot
|
||||
|
||||
service dhcpcd /system/bin/dhcpcd -BKL -d tiwlan0
|
||||
disabled
|
||||
oneshot
|
||||
|
||||
service dhcp-release /system/bin/dhcpcd -k tiwlan0
|
||||
service dhcpcd /system/bin/dhcpcd -ABKL
|
||||
disabled
|
||||
oneshot
|
||||
|
||||
|
BIN
keychars/qwerty.kcm.bin
Normal file
BIN
keychars/qwerty.kcm.bin
Normal file
Binary file not shown.
BIN
keychars/qwerty2.kcm.bin
Normal file
BIN
keychars/qwerty2.kcm.bin
Normal file
Binary file not shown.
89
keylayout/bahamas-keypad.kl
Normal file
89
keylayout/bahamas-keypad.kl
Normal file
@ -0,0 +1,89 @@
|
||||
key 107 ENDCALL WAKE_DROPPED
|
||||
key 158 BACK
|
||||
key 139 MENU WAKE_DROPPED
|
||||
key 231 CALL
|
||||
key 102 HOME
|
||||
key 217 SEARCH
|
||||
|
||||
key 105 DPAD_LEFT
|
||||
key 106 DPAD_RIGHT
|
||||
key 108 DPAD_DOWN
|
||||
key 103 DPAD_UP
|
||||
key 232 DPAD_CENTER
|
||||
|
||||
key 115 VOLUME_UP WAKE
|
||||
key 114 VOLUME_DOWN WAKE
|
||||
|
||||
##### useless #####
|
||||
# key 399 GRAVE
|
||||
# key 2 1
|
||||
# key 3 2
|
||||
# key 4 3
|
||||
# key 5 4
|
||||
# key 6 5
|
||||
# key 7 6
|
||||
# key 8 7
|
||||
# key 9 8
|
||||
# key 10 9
|
||||
# key 11 0
|
||||
# key 230 SOFT_RIGHT WAKE
|
||||
# key 60 SOFT_RIGHT WAKE
|
||||
# key 62 ENDCALL WAKE_DROPPED
|
||||
# key 229 MENU WAKE_DROPPED
|
||||
# key 59 MENU WAKE_DROPPED
|
||||
# key 228 POUND
|
||||
# key 227 STAR
|
||||
# key 61 CALL WAKE_DROPPED
|
||||
# key 116 POWER WAKE
|
||||
# key 211 FOCUS
|
||||
# key 212 CAMERA
|
||||
#
|
||||
# key 16 Q
|
||||
# key 17 W
|
||||
# key 18 E
|
||||
# key 19 R
|
||||
# key 20 T
|
||||
# key 21 Y
|
||||
# key 22 U
|
||||
# key 23 I
|
||||
# key 24 O
|
||||
# key 25 P
|
||||
# key 26 LEFT_BRACKET
|
||||
# key 27 RIGHT_BRACKET
|
||||
# key 43 BACKSLASH
|
||||
#
|
||||
# key 30 A
|
||||
# key 31 S
|
||||
# key 32 D
|
||||
# key 33 F
|
||||
# key 34 G
|
||||
# key 35 H
|
||||
# key 36 J
|
||||
# key 37 K
|
||||
# key 38 L
|
||||
# key 39 SEMICOLON
|
||||
# key 40 APOSTROPHE
|
||||
# key 14 DEL
|
||||
#
|
||||
# key 44 Z
|
||||
# key 45 X
|
||||
# key 46 C
|
||||
# key 47 V
|
||||
# key 48 B
|
||||
# key 49 N
|
||||
# key 50 M
|
||||
# key 51 COMMA
|
||||
# key 52 PERIOD
|
||||
# key 53 SLASH
|
||||
# key 28 ENTER
|
||||
#
|
||||
# key 56 ALT_LEFT
|
||||
# key 42 SHIFT_LEFT
|
||||
# key 15 TAB
|
||||
# key 57 SPACE
|
||||
# key 150 EXPLORER
|
||||
# key 155 ENVELOPE
|
||||
#
|
||||
# key 12 MINUS
|
||||
# key 13 EQUALS
|
||||
# key 215 AT
|
9
keylayout/h2w_headset.kl
Normal file
9
keylayout/h2w_headset.kl
Normal file
@ -0,0 +1,9 @@
|
||||
key 107 ENDCALL WAKE_DROPPED
|
||||
key 113 MUTE WAKE
|
||||
key 114 VOLUME_DOWN WAKE
|
||||
key 115 VOLUME_UP WAKE
|
||||
key 163 MEDIA_NEXT WAKE
|
||||
key 164 MEDIA_PLAY_PAUSE WAKE
|
||||
key 165 MEDIA_PREVIOUS WAKE
|
||||
key 226 HEADSETHOOK WAKE
|
||||
key 231 CALL WAKE_DROPPED
|
89
keylayout/qwerty.kl
Normal file
89
keylayout/qwerty.kl
Normal file
@ -0,0 +1,89 @@
|
||||
key 399 GRAVE
|
||||
key 2 1
|
||||
key 3 2
|
||||
key 4 3
|
||||
key 5 4
|
||||
key 6 5
|
||||
key 7 6
|
||||
key 8 7
|
||||
key 9 8
|
||||
key 10 9
|
||||
key 11 0
|
||||
key 158 BACK WAKE_DROPPED
|
||||
key 230 SOFT_RIGHT WAKE
|
||||
key 60 SOFT_RIGHT WAKE
|
||||
key 107 ENDCALL WAKE_DROPPED
|
||||
key 62 ENDCALL WAKE_DROPPED
|
||||
key 229 MENU WAKE_DROPPED
|
||||
key 139 MENU WAKE_DROPPED
|
||||
key 59 MENU WAKE_DROPPED
|
||||
key 127 SEARCH WAKE_DROPPED
|
||||
key 217 SEARCH WAKE_DROPPED
|
||||
key 228 POUND
|
||||
key 227 STAR
|
||||
key 231 CALL WAKE_DROPPED
|
||||
key 61 CALL WAKE_DROPPED
|
||||
key 232 DPAD_CENTER WAKE_DROPPED
|
||||
key 108 DPAD_DOWN WAKE_DROPPED
|
||||
key 103 DPAD_UP WAKE_DROPPED
|
||||
key 102 HOME WAKE
|
||||
key 105 DPAD_LEFT WAKE_DROPPED
|
||||
key 106 DPAD_RIGHT WAKE_DROPPED
|
||||
key 115 VOLUME_UP
|
||||
key 114 VOLUME_DOWN
|
||||
key 116 POWER WAKE
|
||||
key 212 CAMERA
|
||||
|
||||
key 16 Q
|
||||
key 17 W
|
||||
key 18 E
|
||||
key 19 R
|
||||
key 20 T
|
||||
key 21 Y
|
||||
key 22 U
|
||||
key 23 I
|
||||
key 24 O
|
||||
key 25 P
|
||||
key 26 LEFT_BRACKET
|
||||
key 27 RIGHT_BRACKET
|
||||
key 43 BACKSLASH
|
||||
|
||||
key 30 A
|
||||
key 31 S
|
||||
key 32 D
|
||||
key 33 F
|
||||
key 34 G
|
||||
key 35 H
|
||||
key 36 J
|
||||
key 37 K
|
||||
key 38 L
|
||||
key 39 SEMICOLON
|
||||
key 40 APOSTROPHE
|
||||
key 14 DEL
|
||||
|
||||
key 44 Z
|
||||
key 45 X
|
||||
key 46 C
|
||||
key 47 V
|
||||
key 48 B
|
||||
key 49 N
|
||||
key 50 M
|
||||
key 51 COMMA
|
||||
key 52 PERIOD
|
||||
key 53 SLASH
|
||||
key 28 ENTER
|
||||
|
||||
key 56 ALT_LEFT
|
||||
key 100 ALT_RIGHT
|
||||
key 42 SHIFT_LEFT
|
||||
key 54 SHIFT_RIGHT
|
||||
key 15 TAB
|
||||
key 57 SPACE
|
||||
key 150 EXPLORER
|
||||
key 155 ENVELOPE
|
||||
|
||||
key 12 MINUS
|
||||
key 13 EQUALS
|
||||
key 215 AT
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
#
|
||||
# Copyright (C) 2008 The Android Open Source Project
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@ -12,8 +11,19 @@
|
||||
# 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.
|
||||
#
|
||||
|
||||
$(call inherit-product, device/common/gps/gps_us_supl.mk)
|
||||
$(call inherit-product-if-exists, device/htc/tattoo/device_tattoo_us-vendor.mk)
|
||||
$(call inherit-product, device/htc/tattoo/device_tattoo.mk)
|
||||
|
||||
LOCAL_PATH:= $(call my-dir)
|
||||
# HAL module implemenation, not prelinked and stored in
|
||||
# hw/<COPYPIX_HARDWARE_MODULE_ID>.<ro.board.platform>.so
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
LOCAL_PRELINK_MODULE := false
|
||||
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
|
||||
LOCAL_SHARED_LIBRARIES := liblog
|
||||
LOCAL_SRC_FILES := copybit.cpp
|
||||
LOCAL_MODULE := copybit.bahamas
|
||||
LOCAL_C_INCLUDES += hardware/msm7k/libgralloc
|
||||
LOCAL_CFLAGS += -DCOPYBIT_MSM7K=1
|
||||
include $(BUILD_SHARED_LIBRARY)
|
190
libcopybit/NOTICE
Normal file
190
libcopybit/NOTICE
Normal file
@ -0,0 +1,190 @@
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
484
libcopybit/copybit.cpp
Normal file
484
libcopybit/copybit.cpp
Normal file
@ -0,0 +1,484 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
|
||||
#define LOG_TAG "copybit"
|
||||
|
||||
#include <cutils/log.h>
|
||||
|
||||
#include <linux/msm_mdp.h>
|
||||
#include <linux/fb.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/mman.h>
|
||||
|
||||
#include <hardware/copybit.h>
|
||||
|
||||
#include "gralloc_priv.h"
|
||||
|
||||
#define DEBUG_MDP_ERRORS 1
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
#if defined(COPYBIT_MSM7K)
|
||||
#define MAX_SCALE_FACTOR (4)
|
||||
#define MAX_DIMENSION (4096)
|
||||
#elif defined(COPYBIT_QSD8K)
|
||||
#define MAX_SCALE_FACTOR (8)
|
||||
#define MAX_DIMENSION (2048)
|
||||
#else
|
||||
#error "Unsupported MDP version"
|
||||
#endif
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
/** State information for each device instance */
|
||||
struct copybit_context_t {
|
||||
struct copybit_device_t device;
|
||||
int mFD;
|
||||
uint8_t mAlpha;
|
||||
uint8_t mFlags;
|
||||
};
|
||||
|
||||
/**
|
||||
* Common hardware methods
|
||||
*/
|
||||
|
||||
static int open_copybit(const struct hw_module_t* module, const char* name,
|
||||
struct hw_device_t** device);
|
||||
|
||||
static struct hw_module_methods_t copybit_module_methods = {
|
||||
open: open_copybit
|
||||
};
|
||||
|
||||
/*
|
||||
* The COPYBIT Module
|
||||
*/
|
||||
struct copybit_module_t HAL_MODULE_INFO_SYM = {
|
||||
common: {
|
||||
tag: HARDWARE_MODULE_TAG,
|
||||
version_major: 1,
|
||||
version_minor: 0,
|
||||
id: COPYBIT_HARDWARE_MODULE_ID,
|
||||
name: "QCT MSM7K COPYBIT Module",
|
||||
author: "Google, Inc.",
|
||||
methods: ©bit_module_methods
|
||||
}
|
||||
};
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
/** min of int a, b */
|
||||
static inline int min(int a, int b) {
|
||||
return (a<b) ? a : b;
|
||||
}
|
||||
|
||||
/** max of int a, b */
|
||||
static inline int max(int a, int b) {
|
||||
return (a>b) ? a : b;
|
||||
}
|
||||
|
||||
/** scale each parameter by mul/div. Assume div isn't 0 */
|
||||
static inline void MULDIV(uint32_t *a, uint32_t *b, int mul, int div) {
|
||||
if (mul != div) {
|
||||
*a = (mul * *a) / div;
|
||||
*b = (mul * *b) / div;
|
||||
}
|
||||
}
|
||||
|
||||
/** Determine the intersection of lhs & rhs store in out */
|
||||
static void intersect(struct copybit_rect_t *out,
|
||||
const struct copybit_rect_t *lhs,
|
||||
const struct copybit_rect_t *rhs) {
|
||||
out->l = max(lhs->l, rhs->l);
|
||||
out->t = max(lhs->t, rhs->t);
|
||||
out->r = min(lhs->r, rhs->r);
|
||||
out->b = min(lhs->b, rhs->b);
|
||||
}
|
||||
|
||||
/** convert COPYBIT_FORMAT to MDP format */
|
||||
static int get_format(int format) {
|
||||
switch (format) {
|
||||
case COPYBIT_FORMAT_RGB_565: return MDP_RGB_565;
|
||||
case COPYBIT_FORMAT_RGBX_8888: return MDP_RGBX_8888;
|
||||
case COPYBIT_FORMAT_RGB_888: return MDP_RGB_888;
|
||||
case COPYBIT_FORMAT_RGBA_8888: return MDP_RGBA_8888;
|
||||
case COPYBIT_FORMAT_BGRA_8888: return MDP_BGRA_8888;
|
||||
case COPYBIT_FORMAT_YCrCb_420_SP: return MDP_Y_CBCR_H2V2;
|
||||
case COPYBIT_FORMAT_YCbCr_422_SP: return MDP_Y_CRCB_H2V1;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/** convert from copybit image to mdp image structure */
|
||||
static void set_image(struct mdp_img *img, const struct copybit_image_t *rhs)
|
||||
{
|
||||
private_handle_t* hnd = (private_handle_t*)rhs->handle;
|
||||
img->width = rhs->w;
|
||||
img->height = rhs->h;
|
||||
img->format = get_format(rhs->format);
|
||||
img->offset = hnd->offset;
|
||||
#if defined(COPYBIT_MSM7K)
|
||||
if (hnd->flags & private_handle_t::PRIV_FLAGS_USES_GPU) {
|
||||
img->offset += hnd->map_offset;
|
||||
img->memory_id = hnd->gpu_fd;
|
||||
if (img->format == MDP_RGBA_8888) {
|
||||
// msm7201A GPU only supports BGRA_8888 destinations
|
||||
img->format = MDP_BGRA_8888;
|
||||
}
|
||||
} else {
|
||||
img->memory_id = hnd->fd;
|
||||
}
|
||||
#else
|
||||
img->memory_id = hnd->fd;
|
||||
#endif
|
||||
}
|
||||
/** setup rectangles */
|
||||
static void set_rects(struct copybit_context_t *dev,
|
||||
struct mdp_blit_req *e,
|
||||
const struct copybit_rect_t *dst,
|
||||
const struct copybit_rect_t *src,
|
||||
const struct copybit_rect_t *scissor) {
|
||||
struct copybit_rect_t clip;
|
||||
intersect(&clip, scissor, dst);
|
||||
|
||||
e->dst_rect.x = clip.l;
|
||||
e->dst_rect.y = clip.t;
|
||||
e->dst_rect.w = clip.r - clip.l;
|
||||
e->dst_rect.h = clip.b - clip.t;
|
||||
|
||||
uint32_t W, H;
|
||||
if (dev->mFlags & COPYBIT_TRANSFORM_ROT_90) {
|
||||
e->src_rect.x = (clip.t - dst->t) + src->t;
|
||||
e->src_rect.y = (dst->r - clip.r) + src->l;
|
||||
e->src_rect.w = (clip.b - clip.t);
|
||||
e->src_rect.h = (clip.r - clip.l);
|
||||
W = dst->b - dst->t;
|
||||
H = dst->r - dst->l;
|
||||
} else {
|
||||
e->src_rect.x = (clip.l - dst->l) + src->l;
|
||||
e->src_rect.y = (clip.t - dst->t) + src->t;
|
||||
e->src_rect.w = (clip.r - clip.l);
|
||||
e->src_rect.h = (clip.b - clip.t);
|
||||
W = dst->r - dst->l;
|
||||
H = dst->b - dst->t;
|
||||
}
|
||||
MULDIV(&e->src_rect.x, &e->src_rect.w, src->r - src->l, W);
|
||||
MULDIV(&e->src_rect.y, &e->src_rect.h, src->b - src->t, H);
|
||||
if (dev->mFlags & COPYBIT_TRANSFORM_FLIP_V) {
|
||||
e->src_rect.y = e->src.height - (e->src_rect.y + e->src_rect.h);
|
||||
}
|
||||
if (dev->mFlags & COPYBIT_TRANSFORM_FLIP_H) {
|
||||
e->src_rect.x = e->src.width - (e->src_rect.x + e->src_rect.w);
|
||||
}
|
||||
}
|
||||
|
||||
/** setup mdp request */
|
||||
static void set_infos(struct copybit_context_t *dev, struct mdp_blit_req *req) {
|
||||
req->alpha = dev->mAlpha;
|
||||
req->transp_mask = MDP_TRANSP_NOP;
|
||||
req->flags = dev->mFlags | MDP_BLEND_FG_PREMULT;
|
||||
}
|
||||
|
||||
/** copy the bits */
|
||||
static int msm_copybit(struct copybit_context_t *dev, void const *list)
|
||||
{
|
||||
int err = ioctl(dev->mFD, MSMFB_BLIT,
|
||||
(struct mdp_blit_req_list const*)list);
|
||||
LOGE_IF(err<0, "copyBits failed (%s)", strerror(errno));
|
||||
if (err == 0) {
|
||||
return 0;
|
||||
} else {
|
||||
#if DEBUG_MDP_ERRORS
|
||||
struct mdp_blit_req_list const* l = (struct mdp_blit_req_list const*)list;
|
||||
for (int i=0 ; i<l->count ; i++) {
|
||||
LOGD("%d: src={w=%d, h=%d, f=%d, rect={%d,%d,%d,%d}}\n"
|
||||
" dst={w=%d, h=%d, f=%d, rect={%d,%d,%d,%d}}\n"
|
||||
" flags=%08lx"
|
||||
,
|
||||
i,
|
||||
l->req[i].src.width,
|
||||
l->req[i].src.height,
|
||||
l->req[i].src.format,
|
||||
l->req[i].src_rect.x,
|
||||
l->req[i].src_rect.y,
|
||||
l->req[i].src_rect.w,
|
||||
l->req[i].src_rect.h,
|
||||
l->req[i].dst.width,
|
||||
l->req[i].dst.height,
|
||||
l->req[i].dst.format,
|
||||
l->req[i].dst_rect.x,
|
||||
l->req[i].dst_rect.y,
|
||||
l->req[i].dst_rect.w,
|
||||
l->req[i].dst_rect.h,
|
||||
l->req[i].flags
|
||||
);
|
||||
}
|
||||
#endif
|
||||
return -errno;
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Set a parameter to value */
|
||||
static int set_parameter_copybit(
|
||||
struct copybit_device_t *dev,
|
||||
int name,
|
||||
int value)
|
||||
{
|
||||
struct copybit_context_t* ctx = (struct copybit_context_t*)dev;
|
||||
int status = 0;
|
||||
if (ctx) {
|
||||
switch(name) {
|
||||
case COPYBIT_ROTATION_DEG:
|
||||
switch (value) {
|
||||
case 0:
|
||||
ctx->mFlags &= ~0x7;
|
||||
break;
|
||||
case 90:
|
||||
ctx->mFlags &= ~0x7;
|
||||
ctx->mFlags |= MDP_ROT_90;
|
||||
break;
|
||||
case 180:
|
||||
ctx->mFlags &= ~0x7;
|
||||
ctx->mFlags |= MDP_ROT_180;
|
||||
break;
|
||||
case 270:
|
||||
ctx->mFlags &= ~0x7;
|
||||
ctx->mFlags |= MDP_ROT_270;
|
||||
break;
|
||||
default:
|
||||
LOGE("Invalid value for COPYBIT_ROTATION_DEG");
|
||||
status = -EINVAL;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case COPYBIT_PLANE_ALPHA:
|
||||
if (value < 0) value = 0;
|
||||
if (value >= 256) value = 255;
|
||||
ctx->mAlpha = value;
|
||||
break;
|
||||
case COPYBIT_DITHER:
|
||||
if (value == COPYBIT_ENABLE) {
|
||||
ctx->mFlags |= MDP_DITHER;
|
||||
} else if (value == COPYBIT_DISABLE) {
|
||||
ctx->mFlags &= ~MDP_DITHER;
|
||||
}
|
||||
break;
|
||||
case COPYBIT_BLUR:
|
||||
if (value == COPYBIT_ENABLE) {
|
||||
ctx->mFlags |= MDP_BLUR;
|
||||
} else if (value == COPYBIT_DISABLE) {
|
||||
ctx->mFlags &= ~MDP_BLUR;
|
||||
}
|
||||
break;
|
||||
case COPYBIT_TRANSFORM:
|
||||
ctx->mFlags &= ~0x7;
|
||||
ctx->mFlags |= value & 0x7;
|
||||
break;
|
||||
default:
|
||||
status = -EINVAL;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
status = -EINVAL;
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
/** Get a static info value */
|
||||
static int get(struct copybit_device_t *dev, int name)
|
||||
{
|
||||
struct copybit_context_t* ctx = (struct copybit_context_t*)dev;
|
||||
int value;
|
||||
if (ctx) {
|
||||
switch(name) {
|
||||
case COPYBIT_MINIFICATION_LIMIT:
|
||||
value = MAX_SCALE_FACTOR;
|
||||
break;
|
||||
case COPYBIT_MAGNIFICATION_LIMIT:
|
||||
value = MAX_SCALE_FACTOR;
|
||||
break;
|
||||
case COPYBIT_SCALING_FRAC_BITS:
|
||||
value = 32;
|
||||
break;
|
||||
case COPYBIT_ROTATION_STEP_DEG:
|
||||
value = 90;
|
||||
break;
|
||||
default:
|
||||
value = -EINVAL;
|
||||
}
|
||||
} else {
|
||||
value = -EINVAL;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
/** do a stretch blit type operation */
|
||||
static int stretch_copybit(
|
||||
struct copybit_device_t *dev,
|
||||
struct copybit_image_t const *dst,
|
||||
struct copybit_image_t const *src,
|
||||
struct copybit_rect_t const *dst_rect,
|
||||
struct copybit_rect_t const *src_rect,
|
||||
struct copybit_region_t const *region)
|
||||
{
|
||||
struct copybit_context_t* ctx = (struct copybit_context_t*)dev;
|
||||
int status = 0;
|
||||
if (ctx) {
|
||||
struct {
|
||||
uint32_t count;
|
||||
struct mdp_blit_req req[12];
|
||||
} list;
|
||||
|
||||
if (ctx->mAlpha < 255) {
|
||||
switch (src->format) {
|
||||
// we don't support plane alpha with RGBA formats
|
||||
case COPYBIT_FORMAT_RGBA_8888:
|
||||
case COPYBIT_FORMAT_BGRA_8888:
|
||||
case COPYBIT_FORMAT_RGBA_5551:
|
||||
case COPYBIT_FORMAT_RGBA_4444:
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
if (src_rect->l < 0 || src_rect->r > src->w ||
|
||||
src_rect->t < 0 || src_rect->b > src->h) {
|
||||
// this is always invalid
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (src->w > MAX_DIMENSION || src->h > MAX_DIMENSION)
|
||||
return -EINVAL;
|
||||
|
||||
if (dst->w > MAX_DIMENSION || dst->h > MAX_DIMENSION)
|
||||
return -EINVAL;
|
||||
|
||||
const uint32_t maxCount = sizeof(list.req)/sizeof(list.req[0]);
|
||||
const struct copybit_rect_t bounds = { 0, 0, dst->w, dst->h };
|
||||
struct copybit_rect_t clip;
|
||||
list.count = 0;
|
||||
status = 0;
|
||||
while ((status == 0) && region->next(region, &clip)) {
|
||||
intersect(&clip, &bounds, &clip);
|
||||
mdp_blit_req* req = &list.req[list.count];
|
||||
set_infos(ctx, req);
|
||||
set_image(&req->dst, dst);
|
||||
set_image(&req->src, src);
|
||||
set_rects(ctx, req, dst_rect, src_rect, &clip);
|
||||
|
||||
if (req->src_rect.w<=0 || req->src_rect.h<=0)
|
||||
continue;
|
||||
|
||||
if (req->dst_rect.w<=0 || req->dst_rect.h<=0)
|
||||
continue;
|
||||
|
||||
if (++list.count == maxCount) {
|
||||
status = msm_copybit(ctx, &list);
|
||||
list.count = 0;
|
||||
}
|
||||
}
|
||||
if ((status == 0) && list.count) {
|
||||
status = msm_copybit(ctx, &list);
|
||||
}
|
||||
} else {
|
||||
status = -EINVAL;
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
/** Perform a blit type operation */
|
||||
static int blit_copybit(
|
||||
struct copybit_device_t *dev,
|
||||
struct copybit_image_t const *dst,
|
||||
struct copybit_image_t const *src,
|
||||
struct copybit_region_t const *region)
|
||||
{
|
||||
struct copybit_rect_t dr = { 0, 0, dst->w, dst->h };
|
||||
struct copybit_rect_t sr = { 0, 0, src->w, src->h };
|
||||
return stretch_copybit(dev, dst, src, &dr, &sr, region);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Close the copybit device */
|
||||
static int close_copybit(struct hw_device_t *dev)
|
||||
{
|
||||
struct copybit_context_t* ctx = (struct copybit_context_t*)dev;
|
||||
if (ctx) {
|
||||
close(ctx->mFD);
|
||||
free(ctx);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** Open a new instance of a copybit device using name */
|
||||
static int open_copybit(const struct hw_module_t* module, const char* name,
|
||||
struct hw_device_t** device)
|
||||
{
|
||||
int status = -EINVAL;
|
||||
copybit_context_t *ctx;
|
||||
ctx = (copybit_context_t *)malloc(sizeof(copybit_context_t));
|
||||
memset(ctx, 0, sizeof(*ctx));
|
||||
|
||||
ctx->device.common.tag = HARDWARE_DEVICE_TAG;
|
||||
ctx->device.common.version = 1;
|
||||
ctx->device.common.module = const_cast<hw_module_t*>(module);
|
||||
ctx->device.common.close = close_copybit;
|
||||
ctx->device.set_parameter = set_parameter_copybit;
|
||||
ctx->device.get = get;
|
||||
ctx->device.blit = blit_copybit;
|
||||
ctx->device.stretch = stretch_copybit;
|
||||
ctx->mAlpha = MDP_ALPHA_NOP;
|
||||
ctx->mFlags = 0;
|
||||
ctx->mFD = open("/dev/graphics/fb0", O_RDWR, 0);
|
||||
|
||||
if (ctx->mFD < 0) {
|
||||
status = errno;
|
||||
LOGE("Error opening frame buffer errno=%d (%s)",
|
||||
status, strerror(status));
|
||||
status = -status;
|
||||
} else {
|
||||
struct fb_fix_screeninfo finfo;
|
||||
if (ioctl(ctx->mFD, FBIOGET_FSCREENINFO, &finfo) == 0) {
|
||||
if (strcmp(finfo.id, "msmfb") == 0) {
|
||||
/* Success */
|
||||
status = 0;
|
||||
} else {
|
||||
LOGE("Error not msm frame buffer");
|
||||
status = -EINVAL;
|
||||
}
|
||||
} else {
|
||||
LOGE("Error executing ioctl for screen info");
|
||||
status = -errno;
|
||||
}
|
||||
}
|
||||
|
||||
if (status == 0) {
|
||||
*device = &ctx->device.common;
|
||||
} else {
|
||||
close_copybit(&ctx->device.common);
|
||||
}
|
||||
return status;
|
||||
}
|
34
libgralloc/Android.mk
Normal file
34
libgralloc/Android.mk
Normal file
@ -0,0 +1,34 @@
|
||||
# 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.
|
||||
|
||||
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
# HAL module implemenation, not prelinked and stored in
|
||||
# hw/<OVERLAY_HARDWARE_MODULE_ID>.<ro.product.board>.so
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
LOCAL_PRELINK_MODULE := false
|
||||
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
|
||||
LOCAL_SHARED_LIBRARIES := liblog libcutils
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
allocator.cpp \
|
||||
gralloc.cpp \
|
||||
framebuffer.cpp \
|
||||
mapper.cpp
|
||||
|
||||
LOCAL_MODULE := gralloc.bahamas
|
||||
LOCAL_CFLAGS:= -DLOG_TAG=\"gralloc\"
|
||||
include $(BUILD_SHARED_LIBRARY)
|
0
libgralloc/MODULE_LICENSE_APACHE2
Normal file
0
libgralloc/MODULE_LICENSE_APACHE2
Normal file
190
libgralloc/NOTICE
Normal file
190
libgralloc/NOTICE
Normal file
@ -0,0 +1,190 @@
|
||||
|
||||
Copyright (c) 2008-2009, 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.
|
||||
|
||||
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.
|
||||
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
165
libgralloc/allocator.cpp
Normal file
165
libgralloc/allocator.cpp
Normal file
@ -0,0 +1,165 @@
|
||||
/*
|
||||
* Copyright (C) 2009 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.
|
||||
*/
|
||||
|
||||
#include <cutils/log.h>
|
||||
|
||||
#include "allocator.h"
|
||||
|
||||
|
||||
// align all the memory blocks on a cache-line boundary
|
||||
const int SimpleBestFitAllocator::kMemoryAlign = 32;
|
||||
|
||||
SimpleBestFitAllocator::SimpleBestFitAllocator()
|
||||
: mHeapSize(0)
|
||||
{
|
||||
}
|
||||
|
||||
SimpleBestFitAllocator::SimpleBestFitAllocator(size_t size)
|
||||
: mHeapSize(0)
|
||||
{
|
||||
setSize(size);
|
||||
}
|
||||
|
||||
SimpleBestFitAllocator::~SimpleBestFitAllocator()
|
||||
{
|
||||
while(!mList.isEmpty()) {
|
||||
delete mList.remove(mList.head());
|
||||
}
|
||||
}
|
||||
|
||||
ssize_t SimpleBestFitAllocator::setSize(size_t size)
|
||||
{
|
||||
Locker::Autolock _l(mLock);
|
||||
if (mHeapSize != 0) return -EINVAL;
|
||||
size_t pagesize = getpagesize();
|
||||
mHeapSize = ((size + pagesize-1) & ~(pagesize-1));
|
||||
chunk_t* node = new chunk_t(0, mHeapSize / kMemoryAlign);
|
||||
mList.insertHead(node);
|
||||
return size;
|
||||
}
|
||||
|
||||
|
||||
size_t SimpleBestFitAllocator::size() const
|
||||
{
|
||||
return mHeapSize;
|
||||
}
|
||||
|
||||
ssize_t SimpleBestFitAllocator::allocate(size_t size, uint32_t flags)
|
||||
{
|
||||
Locker::Autolock _l(mLock);
|
||||
if (mHeapSize == 0) return -EINVAL;
|
||||
ssize_t offset = alloc(size, flags);
|
||||
return offset;
|
||||
}
|
||||
|
||||
ssize_t SimpleBestFitAllocator::deallocate(size_t offset)
|
||||
{
|
||||
Locker::Autolock _l(mLock);
|
||||
if (mHeapSize == 0) return -EINVAL;
|
||||
chunk_t const * const freed = dealloc(offset);
|
||||
if (freed) {
|
||||
return 0;
|
||||
}
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
ssize_t SimpleBestFitAllocator::alloc(size_t size, uint32_t flags)
|
||||
{
|
||||
if (size == 0) {
|
||||
return 0;
|
||||
}
|
||||
size = (size + kMemoryAlign-1) / kMemoryAlign;
|
||||
chunk_t* free_chunk = 0;
|
||||
chunk_t* cur = mList.head();
|
||||
|
||||
size_t pagesize = getpagesize();
|
||||
while (cur) {
|
||||
int extra = ( -cur->start & ((pagesize/kMemoryAlign)-1) ) ;
|
||||
|
||||
// best fit
|
||||
if (cur->free && (cur->size >= (size+extra))) {
|
||||
if ((!free_chunk) || (cur->size < free_chunk->size)) {
|
||||
free_chunk = cur;
|
||||
}
|
||||
if (cur->size == size) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
cur = cur->next;
|
||||
}
|
||||
|
||||
if (free_chunk) {
|
||||
const size_t free_size = free_chunk->size;
|
||||
free_chunk->free = 0;
|
||||
free_chunk->size = size;
|
||||
if (free_size > size) {
|
||||
int extra = ( -free_chunk->start & ((pagesize/kMemoryAlign)-1) ) ;
|
||||
if (extra) {
|
||||
chunk_t* split = new chunk_t(free_chunk->start, extra);
|
||||
free_chunk->start += extra;
|
||||
mList.insertBefore(free_chunk, split);
|
||||
}
|
||||
|
||||
LOGE_IF(((free_chunk->start*kMemoryAlign)&(pagesize-1)),
|
||||
"page is not aligned!!!");
|
||||
|
||||
const ssize_t tail_free = free_size - (size+extra);
|
||||
if (tail_free > 0) {
|
||||
chunk_t* split = new chunk_t(
|
||||
free_chunk->start + free_chunk->size, tail_free);
|
||||
mList.insertAfter(free_chunk, split);
|
||||
}
|
||||
}
|
||||
return (free_chunk->start)*kMemoryAlign;
|
||||
}
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
SimpleBestFitAllocator::chunk_t* SimpleBestFitAllocator::dealloc(size_t start)
|
||||
{
|
||||
start = start / kMemoryAlign;
|
||||
chunk_t* cur = mList.head();
|
||||
while (cur) {
|
||||
if (cur->start == start) {
|
||||
LOG_FATAL_IF(cur->free,
|
||||
"block at offset 0x%08lX of size 0x%08lX already freed",
|
||||
cur->start*kMemoryAlign, cur->size*kMemoryAlign);
|
||||
|
||||
// merge freed blocks together
|
||||
chunk_t* freed = cur;
|
||||
cur->free = 1;
|
||||
do {
|
||||
chunk_t* const p = cur->prev;
|
||||
chunk_t* const n = cur->next;
|
||||
if (p && (p->free || !cur->size)) {
|
||||
freed = p;
|
||||
p->size += cur->size;
|
||||
mList.remove(cur);
|
||||
delete cur;
|
||||
}
|
||||
cur = n;
|
||||
} while (cur && cur->free);
|
||||
|
||||
LOG_FATAL_IF(!freed->free,
|
||||
"freed block at offset 0x%08lX of size 0x%08lX is not free!",
|
||||
freed->start * kMemoryAlign, freed->size * kMemoryAlign);
|
||||
|
||||
return freed;
|
||||
}
|
||||
cur = cur->next;
|
||||
}
|
||||
return 0;
|
||||
}
|
129
libgralloc/allocator.h
Normal file
129
libgralloc/allocator.h
Normal file
@ -0,0 +1,129 @@
|
||||
/*
|
||||
* Copyright (C) 2009 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.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef GRALLOC_ALLOCATOR_H_
|
||||
#define GRALLOC_ALLOCATOR_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "gr.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
/*
|
||||
* A simple templatized doubly linked-list implementation
|
||||
*/
|
||||
|
||||
template <typename NODE>
|
||||
class LinkedList
|
||||
{
|
||||
NODE* mFirst;
|
||||
NODE* mLast;
|
||||
|
||||
public:
|
||||
LinkedList() : mFirst(0), mLast(0) { }
|
||||
bool isEmpty() const { return mFirst == 0; }
|
||||
NODE const* head() const { return mFirst; }
|
||||
NODE* head() { return mFirst; }
|
||||
NODE const* tail() const { return mLast; }
|
||||
NODE* tail() { return mLast; }
|
||||
|
||||
void insertAfter(NODE* node, NODE* newNode) {
|
||||
newNode->prev = node;
|
||||
newNode->next = node->next;
|
||||
if (node->next == 0) mLast = newNode;
|
||||
else node->next->prev = newNode;
|
||||
node->next = newNode;
|
||||
}
|
||||
|
||||
void insertBefore(NODE* node, NODE* newNode) {
|
||||
newNode->prev = node->prev;
|
||||
newNode->next = node;
|
||||
if (node->prev == 0) mFirst = newNode;
|
||||
else node->prev->next = newNode;
|
||||
node->prev = newNode;
|
||||
}
|
||||
|
||||
void insertHead(NODE* newNode) {
|
||||
if (mFirst == 0) {
|
||||
mFirst = mLast = newNode;
|
||||
newNode->prev = newNode->next = 0;
|
||||
} else {
|
||||
newNode->prev = 0;
|
||||
newNode->next = mFirst;
|
||||
mFirst->prev = newNode;
|
||||
mFirst = newNode;
|
||||
}
|
||||
}
|
||||
|
||||
void insertTail(NODE* newNode) {
|
||||
if (mLast == 0) {
|
||||
insertHead(newNode);
|
||||
} else {
|
||||
newNode->prev = mLast;
|
||||
newNode->next = 0;
|
||||
mLast->next = newNode;
|
||||
mLast = newNode;
|
||||
}
|
||||
}
|
||||
|
||||
NODE* remove(NODE* node) {
|
||||
if (node->prev == 0) mFirst = node->next;
|
||||
else node->prev->next = node->next;
|
||||
if (node->next == 0) mLast = node->prev;
|
||||
else node->next->prev = node->prev;
|
||||
return node;
|
||||
}
|
||||
};
|
||||
|
||||
class SimpleBestFitAllocator
|
||||
{
|
||||
public:
|
||||
|
||||
SimpleBestFitAllocator();
|
||||
SimpleBestFitAllocator(size_t size);
|
||||
~SimpleBestFitAllocator();
|
||||
|
||||
ssize_t setSize(size_t size);
|
||||
|
||||
ssize_t allocate(size_t size, uint32_t flags = 0);
|
||||
ssize_t deallocate(size_t offset);
|
||||
size_t size() const;
|
||||
|
||||
private:
|
||||
struct chunk_t {
|
||||
chunk_t(size_t start, size_t size)
|
||||
: start(start), size(size), free(1), prev(0), next(0) {
|
||||
}
|
||||
size_t start;
|
||||
size_t size : 28;
|
||||
int free : 4;
|
||||
mutable chunk_t* prev;
|
||||
mutable chunk_t* next;
|
||||
};
|
||||
|
||||
ssize_t alloc(size_t size, uint32_t flags);
|
||||
chunk_t* dealloc(size_t start);
|
||||
|
||||
static const int kMemoryAlign;
|
||||
mutable Locker mLock;
|
||||
LinkedList<chunk_t> mList;
|
||||
size_t mHeapSize;
|
||||
};
|
||||
|
||||
#endif /* GRALLOC_ALLOCATOR_H_ */
|
419
libgralloc/framebuffer.cpp
Normal file
419
libgralloc/framebuffer.cpp
Normal file
@ -0,0 +1,419 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <sys/mman.h>
|
||||
|
||||
#include <dlfcn.h>
|
||||
|
||||
#include <cutils/ashmem.h>
|
||||
#include <cutils/log.h>
|
||||
|
||||
#include <hardware/hardware.h>
|
||||
#include <hardware/gralloc.h>
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <cutils/log.h>
|
||||
#include <cutils/atomic.h>
|
||||
|
||||
#include <linux/fb.h>
|
||||
#include "linux/msm_mdp.h"
|
||||
|
||||
#include "gralloc_priv.h"
|
||||
#include "gr.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
// numbers of buffers for page flipping
|
||||
#define NUM_BUFFERS 2
|
||||
|
||||
|
||||
enum {
|
||||
PAGE_FLIP = 0x00000001,
|
||||
LOCKED = 0x00000002
|
||||
};
|
||||
|
||||
struct fb_context_t {
|
||||
framebuffer_device_t device;
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static void
|
||||
msm_copy_buffer(buffer_handle_t handle, int fd, int width, int height,
|
||||
int x, int y, int w, int h);
|
||||
|
||||
static int fb_setSwapInterval(struct framebuffer_device_t* dev,
|
||||
int interval)
|
||||
{
|
||||
fb_context_t* ctx = (fb_context_t*)dev;
|
||||
if (interval < dev->minSwapInterval || interval > dev->maxSwapInterval)
|
||||
return -EINVAL;
|
||||
// FIXME: implement fb_setSwapInterval
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int fb_setUpdateRect(struct framebuffer_device_t* dev,
|
||||
int l, int t, int w, int h)
|
||||
{
|
||||
if (((w|h) <= 0) || ((l|t)<0))
|
||||
return -EINVAL;
|
||||
|
||||
fb_context_t* ctx = (fb_context_t*)dev;
|
||||
private_module_t* m = reinterpret_cast<private_module_t*>(
|
||||
dev->common.module);
|
||||
m->info.reserved[0] = 0x54445055; // "UPDT";
|
||||
m->info.reserved[1] = (uint16_t)l | ((uint32_t)t << 16);
|
||||
m->info.reserved[2] = (uint16_t)(l+w) | ((uint32_t)(t+h) << 16);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int fb_post(struct framebuffer_device_t* dev, buffer_handle_t buffer)
|
||||
{
|
||||
if (private_handle_t::validate(buffer) < 0)
|
||||
return -EINVAL;
|
||||
|
||||
fb_context_t* ctx = (fb_context_t*)dev;
|
||||
|
||||
private_handle_t const* hnd = reinterpret_cast<private_handle_t const*>(buffer);
|
||||
private_module_t* m = reinterpret_cast<private_module_t*>(
|
||||
dev->common.module);
|
||||
|
||||
if (hnd->flags & private_handle_t::PRIV_FLAGS_FRAMEBUFFER) {
|
||||
const size_t offset = hnd->base - m->framebuffer->base;
|
||||
m->info.activate = FB_ACTIVATE_VBL;
|
||||
m->info.yoffset = offset / m->finfo.line_length;
|
||||
if (ioctl(m->framebuffer->fd, FBIOPUT_VSCREENINFO, &m->info) == -1) {
|
||||
LOGE("FBIOPUT_VSCREENINFO failed");
|
||||
m->base.unlock(&m->base, buffer);
|
||||
return -errno;
|
||||
}
|
||||
m->currentBuffer = buffer;
|
||||
|
||||
} else {
|
||||
// If we can't do the page_flip, just copy the buffer to the front
|
||||
// FIXME: use copybit HAL instead of memcpy
|
||||
|
||||
void* fb_vaddr;
|
||||
void* buffer_vaddr;
|
||||
|
||||
m->base.lock(&m->base, m->framebuffer,
|
||||
GRALLOC_USAGE_SW_WRITE_RARELY,
|
||||
0, 0, m->info.xres, m->info.yres,
|
||||
&fb_vaddr);
|
||||
|
||||
m->base.lock(&m->base, buffer,
|
||||
GRALLOC_USAGE_SW_READ_RARELY,
|
||||
0, 0, m->info.xres, m->info.yres,
|
||||
&buffer_vaddr);
|
||||
|
||||
//memcpy(fb_vaddr, buffer_vaddr, m->finfo.line_length * m->info.yres);
|
||||
|
||||
msm_copy_buffer(m->framebuffer, m->framebuffer->fd,
|
||||
m->info.xres, m->info.yres,
|
||||
m->info.xoffset, m->info.yoffset,
|
||||
m->info.width, m->info.height);
|
||||
|
||||
m->base.unlock(&m->base, buffer);
|
||||
m->base.unlock(&m->base, m->framebuffer);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
int mapFrameBufferLocked(struct private_module_t* module)
|
||||
{
|
||||
// already initialized...
|
||||
if (module->framebuffer) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
char const * const device_template[] = {
|
||||
"/dev/graphics/fb%u",
|
||||
"/dev/fb%u",
|
||||
0 };
|
||||
|
||||
int fd = -1;
|
||||
int i=0;
|
||||
char name[64];
|
||||
|
||||
while ((fd==-1) && device_template[i]) {
|
||||
snprintf(name, 64, device_template[i], 0);
|
||||
fd = open(name, O_RDWR, 0);
|
||||
i++;
|
||||
}
|
||||
if (fd < 0)
|
||||
return -errno;
|
||||
|
||||
struct fb_fix_screeninfo finfo;
|
||||
if (ioctl(fd, FBIOGET_FSCREENINFO, &finfo) == -1)
|
||||
return -errno;
|
||||
|
||||
struct fb_var_screeninfo info;
|
||||
if (ioctl(fd, FBIOGET_VSCREENINFO, &info) == -1)
|
||||
return -errno;
|
||||
|
||||
info.reserved[0] = 0;
|
||||
info.reserved[1] = 0;
|
||||
info.reserved[2] = 0;
|
||||
info.xoffset = 0;
|
||||
info.yoffset = 0;
|
||||
info.activate = FB_ACTIVATE_NOW;
|
||||
|
||||
/*
|
||||
* Explicitly request 5/6/5
|
||||
*/
|
||||
info.bits_per_pixel = 16;
|
||||
info.red.offset = 11;
|
||||
info.red.length = 5;
|
||||
info.green.offset = 5;
|
||||
info.green.length = 6;
|
||||
info.blue.offset = 0;
|
||||
info.blue.length = 5;
|
||||
info.transp.offset = 0;
|
||||
info.transp.length = 0;
|
||||
|
||||
/*
|
||||
* Request NUM_BUFFERS screens (at lest 2 for page flipping)
|
||||
*/
|
||||
info.yres_virtual = info.yres * NUM_BUFFERS;
|
||||
|
||||
|
||||
uint32_t flags = PAGE_FLIP;
|
||||
if (ioctl(fd, FBIOPUT_VSCREENINFO, &info) == -1) {
|
||||
info.yres_virtual = info.yres;
|
||||
flags &= ~PAGE_FLIP;
|
||||
LOGW("FBIOPUT_VSCREENINFO failed, page flipping not supported");
|
||||
}
|
||||
|
||||
if (info.yres_virtual < info.yres * 2) {
|
||||
// we need at least 2 for page-flipping
|
||||
info.yres_virtual = info.yres;
|
||||
flags &= ~PAGE_FLIP;
|
||||
LOGW("page flipping not supported (yres_virtual=%d, requested=%d)",
|
||||
info.yres_virtual, info.yres*2);
|
||||
}
|
||||
|
||||
if (ioctl(fd, FBIOGET_VSCREENINFO, &info) == -1)
|
||||
return -errno;
|
||||
|
||||
int refreshRate = 1000000000000000LLU /
|
||||
(
|
||||
uint64_t( info.upper_margin + info.lower_margin + info.yres )
|
||||
* ( info.left_margin + info.right_margin + info.xres )
|
||||
* info.pixclock
|
||||
);
|
||||
|
||||
if (refreshRate == 0) {
|
||||
// bleagh, bad info from the driver
|
||||
refreshRate = 60*1000; // 60 Hz
|
||||
}
|
||||
|
||||
if (int(info.width) <= 0 || int(info.height) <= 0) {
|
||||
// the driver doesn't return that information
|
||||
// default to 160 dpi
|
||||
info.width = ((info.xres * 25.4f)/160.0f + 0.5f);
|
||||
info.height = ((info.yres * 25.4f)/160.0f + 0.5f);
|
||||
}
|
||||
|
||||
float xdpi = (info.xres * 25.4f) / info.width;
|
||||
float ydpi = (info.yres * 25.4f) / info.height;
|
||||
float fps = refreshRate / 1000.0f;
|
||||
|
||||
LOGI( "using (fd=%d)\n"
|
||||
"id = %s\n"
|
||||
"xres = %d px\n"
|
||||
"yres = %d px\n"
|
||||
"xres_virtual = %d px\n"
|
||||
"yres_virtual = %d px\n"
|
||||
"bpp = %d\n"
|
||||
"r = %2u:%u\n"
|
||||
"g = %2u:%u\n"
|
||||
"b = %2u:%u\n",
|
||||
fd,
|
||||
finfo.id,
|
||||
info.xres,
|
||||
info.yres,
|
||||
info.xres_virtual,
|
||||
info.yres_virtual,
|
||||
info.bits_per_pixel,
|
||||
info.red.offset, info.red.length,
|
||||
info.green.offset, info.green.length,
|
||||
info.blue.offset, info.blue.length
|
||||
);
|
||||
|
||||
LOGI( "width = %d mm (%f dpi)\n"
|
||||
"height = %d mm (%f dpi)\n"
|
||||
"refresh rate = %.2f Hz\n",
|
||||
info.width, xdpi,
|
||||
info.height, ydpi,
|
||||
fps
|
||||
);
|
||||
|
||||
|
||||
if (ioctl(fd, FBIOGET_FSCREENINFO, &finfo) == -1)
|
||||
return -errno;
|
||||
|
||||
if (finfo.smem_len <= 0)
|
||||
return -errno;
|
||||
|
||||
|
||||
module->flags = flags;
|
||||
module->info = info;
|
||||
module->finfo = finfo;
|
||||
module->xdpi = xdpi;
|
||||
module->ydpi = ydpi;
|
||||
module->fps = fps;
|
||||
|
||||
/*
|
||||
* map the framebuffer
|
||||
*/
|
||||
|
||||
int err;
|
||||
size_t fbSize = roundUpToPageSize(finfo.line_length * info.yres_virtual);
|
||||
module->framebuffer = new private_handle_t(dup(fd), fbSize,
|
||||
private_handle_t::PRIV_FLAGS_USES_PMEM);
|
||||
|
||||
module->numBuffers = info.yres_virtual / info.yres;
|
||||
module->bufferMask = 0;
|
||||
|
||||
void* vaddr = mmap(0, fbSize, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
|
||||
if (vaddr == MAP_FAILED) {
|
||||
LOGE("Error mapping the framebuffer (%s)", strerror(errno));
|
||||
return -errno;
|
||||
}
|
||||
module->framebuffer->base = intptr_t(vaddr);
|
||||
|
||||
memset(vaddr, 0, fbSize);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mapFrameBuffer(struct private_module_t* module)
|
||||
{
|
||||
pthread_mutex_lock(&module->lock);
|
||||
int err = mapFrameBufferLocked(module);
|
||||
pthread_mutex_unlock(&module->lock);
|
||||
return err;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static int fb_close(struct hw_device_t *dev)
|
||||
{
|
||||
fb_context_t* ctx = (fb_context_t*)dev;
|
||||
if (ctx) {
|
||||
free(ctx);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int fb_device_open(hw_module_t const* module, const char* name,
|
||||
hw_device_t** device)
|
||||
{
|
||||
int status = -EINVAL;
|
||||
if (!strcmp(name, GRALLOC_HARDWARE_FB0)) {
|
||||
alloc_device_t* gralloc_device;
|
||||
status = gralloc_open(module, &gralloc_device);
|
||||
if (status < 0)
|
||||
return status;
|
||||
|
||||
/* initialize our state here */
|
||||
fb_context_t *dev = (fb_context_t*)malloc(sizeof(*dev));
|
||||
memset(dev, 0, sizeof(*dev));
|
||||
|
||||
/* initialize the procs */
|
||||
dev->device.common.tag = HARDWARE_DEVICE_TAG;
|
||||
dev->device.common.version = 0;
|
||||
dev->device.common.module = const_cast<hw_module_t*>(module);
|
||||
dev->device.common.close = fb_close;
|
||||
dev->device.setSwapInterval = fb_setSwapInterval;
|
||||
dev->device.post = fb_post;
|
||||
dev->device.setUpdateRect = 0;
|
||||
|
||||
private_module_t* m = (private_module_t*)module;
|
||||
status = mapFrameBuffer(m);
|
||||
if (status >= 0) {
|
||||
int stride = m->finfo.line_length / (m->info.bits_per_pixel >> 3);
|
||||
const_cast<uint32_t&>(dev->device.flags) = 0;
|
||||
const_cast<uint32_t&>(dev->device.width) = m->info.xres;
|
||||
const_cast<uint32_t&>(dev->device.height) = m->info.yres;
|
||||
const_cast<int&>(dev->device.stride) = stride;
|
||||
const_cast<int&>(dev->device.format) = HAL_PIXEL_FORMAT_RGB_565;
|
||||
const_cast<float&>(dev->device.xdpi) = m->xdpi;
|
||||
const_cast<float&>(dev->device.ydpi) = m->ydpi;
|
||||
const_cast<float&>(dev->device.fps) = m->fps;
|
||||
const_cast<int&>(dev->device.minSwapInterval) = 1;
|
||||
const_cast<int&>(dev->device.maxSwapInterval) = 1;
|
||||
|
||||
if (m->finfo.reserved[0] == 0x5444 &&
|
||||
m->finfo.reserved[1] == 0x5055) {
|
||||
dev->device.setUpdateRect = fb_setUpdateRect;
|
||||
LOGD("UPDATE_ON_DEMAND supported");
|
||||
}
|
||||
|
||||
*device = &dev->device.common;
|
||||
}
|
||||
|
||||
// Close the gralloc module
|
||||
gralloc_close(gralloc_device);
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
/* Copy a pmem buffer to the framebuffer */
|
||||
|
||||
static void
|
||||
msm_copy_buffer(buffer_handle_t handle, int fd, int width, int height,
|
||||
int x, int y, int w, int h)
|
||||
{
|
||||
struct {
|
||||
unsigned int count;
|
||||
mdp_blit_req req;
|
||||
} blit;
|
||||
private_handle_t *priv = (private_handle_t*) handle;
|
||||
|
||||
memset(&blit, 0, sizeof(blit));
|
||||
blit.count = 1;
|
||||
|
||||
blit.req.flags = 0;
|
||||
blit.req.alpha = 0xff;
|
||||
blit.req.transp_mask = 0xffffffff;
|
||||
|
||||
blit.req.src.width = width;
|
||||
blit.req.src.height = height;
|
||||
blit.req.src.offset = 0;
|
||||
blit.req.src.memory_id = priv->fd;
|
||||
|
||||
blit.req.dst.width = width;
|
||||
blit.req.dst.height = height;
|
||||
blit.req.dst.offset = 0;
|
||||
blit.req.dst.memory_id = fd;
|
||||
blit.req.dst.format = MDP_RGB_565;
|
||||
|
||||
blit.req.src_rect.x = blit.req.dst_rect.x = x;
|
||||
blit.req.src_rect.y = blit.req.dst_rect.y = y;
|
||||
blit.req.src_rect.w = blit.req.dst_rect.w = w;
|
||||
blit.req.src_rect.h = blit.req.dst_rect.h = h;
|
||||
|
||||
if (ioctl(fd, MSMFB_BLIT, &blit))
|
||||
LOGE("MSMFB_BLIT failed = %d", -errno);
|
||||
}
|
64
libgralloc/gr.h
Normal file
64
libgralloc/gr.h
Normal file
@ -0,0 +1,64 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef GR_H_
|
||||
#define GR_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#ifdef HAVE_ANDROID_OS // just want PAGE_SIZE define
|
||||
# include <asm/page.h>
|
||||
#else
|
||||
# include <sys/user.h>
|
||||
#endif
|
||||
#include <limits.h>
|
||||
#include <sys/cdefs.h>
|
||||
#include <hardware/gralloc.h>
|
||||
#include <pthread.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <cutils/native_handle.h>
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
struct private_module_t;
|
||||
struct private_handle_t;
|
||||
|
||||
inline size_t roundUpToPageSize(size_t x) {
|
||||
return (x + (PAGE_SIZE-1)) & ~(PAGE_SIZE-1);
|
||||
}
|
||||
|
||||
int mapFrameBufferLocked(struct private_module_t* module);
|
||||
int terminateBuffer(gralloc_module_t const* module, private_handle_t* hnd);
|
||||
int mapBuffer(gralloc_module_t const* module, private_handle_t* hnd);
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
class Locker {
|
||||
pthread_mutex_t mutex;
|
||||
public:
|
||||
class Autolock {
|
||||
Locker& locker;
|
||||
public:
|
||||
inline Autolock(Locker& locker) : locker(locker) { locker.lock(); }
|
||||
inline ~Autolock() { locker.unlock(); }
|
||||
};
|
||||
inline Locker() { pthread_mutex_init(&mutex, 0); }
|
||||
inline ~Locker() { pthread_mutex_destroy(&mutex); }
|
||||
inline void lock() { pthread_mutex_lock(&mutex); }
|
||||
inline void unlock() { pthread_mutex_unlock(&mutex); }
|
||||
};
|
||||
|
||||
#endif /* GR_H_ */
|
602
libgralloc/gralloc.cpp
Normal file
602
libgralloc/gralloc.cpp
Normal file
@ -0,0 +1,602 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <limits.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <sys/mman.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#include <cutils/ashmem.h>
|
||||
#include <cutils/log.h>
|
||||
#include <cutils/atomic.h>
|
||||
|
||||
#include <hardware/hardware.h>
|
||||
#include <hardware/gralloc.h>
|
||||
|
||||
#include <linux/msm_hw3d.h>
|
||||
#include <linux/android_pmem.h>
|
||||
|
||||
#include "gralloc_priv.h"
|
||||
#include "allocator.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
// NOTE: must be the same than in oem.h
|
||||
#define ALLOCATORREGION_RESERVED_SIZE (1200<<10)
|
||||
#define FB_ARENA HW3D_EBI
|
||||
|
||||
|
||||
|
||||
static SimpleBestFitAllocator sAllocator;
|
||||
static SimpleBestFitAllocator sAllocatorGPU(ALLOCATORREGION_RESERVED_SIZE);
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
struct gralloc_context_t {
|
||||
alloc_device_t device;
|
||||
/* our private data here */
|
||||
};
|
||||
|
||||
static int gralloc_alloc_buffer(alloc_device_t* dev,
|
||||
size_t size, int usage, buffer_handle_t* pHandle);
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
int fb_device_open(const hw_module_t* module, const char* name,
|
||||
hw_device_t** device);
|
||||
|
||||
static int gralloc_device_open(const hw_module_t* module, const char* name,
|
||||
hw_device_t** device);
|
||||
|
||||
extern int gralloc_lock(gralloc_module_t const* module,
|
||||
buffer_handle_t handle, int usage,
|
||||
int l, int t, int w, int h,
|
||||
void** vaddr);
|
||||
|
||||
extern int gralloc_unlock(gralloc_module_t const* module,
|
||||
buffer_handle_t handle);
|
||||
|
||||
extern int gralloc_register_buffer(gralloc_module_t const* module,
|
||||
buffer_handle_t handle);
|
||||
|
||||
extern int gralloc_unregister_buffer(gralloc_module_t const* module,
|
||||
buffer_handle_t handle);
|
||||
|
||||
extern int gralloc_perform(struct gralloc_module_t const* module,
|
||||
int operation, ... );
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static struct hw_module_methods_t gralloc_module_methods = {
|
||||
open: gralloc_device_open
|
||||
};
|
||||
|
||||
struct private_module_t HAL_MODULE_INFO_SYM = {
|
||||
base: {
|
||||
common: {
|
||||
tag: HARDWARE_MODULE_TAG,
|
||||
version_major: 1,
|
||||
version_minor: 0,
|
||||
id: GRALLOC_HARDWARE_MODULE_ID,
|
||||
name: "Graphics Memory Allocator Module",
|
||||
author: "The Android Open Source Project",
|
||||
methods: &gralloc_module_methods
|
||||
},
|
||||
registerBuffer: gralloc_register_buffer,
|
||||
unregisterBuffer: gralloc_unregister_buffer,
|
||||
lock: gralloc_lock,
|
||||
unlock: gralloc_unlock,
|
||||
perform: gralloc_perform,
|
||||
},
|
||||
framebuffer: 0,
|
||||
flags: 0,
|
||||
numBuffers: 0,
|
||||
bufferMask: 0,
|
||||
lock: PTHREAD_MUTEX_INITIALIZER,
|
||||
currentBuffer: 0,
|
||||
pmem_master: -1,
|
||||
pmem_master_base: 0,
|
||||
master_phys: 0,
|
||||
gpu: -1,
|
||||
gpu_base: 0,
|
||||
fb_map_offset: 0
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static int gralloc_alloc_framebuffer_locked(alloc_device_t* dev,
|
||||
size_t size, int usage, buffer_handle_t* pHandle)
|
||||
{
|
||||
private_module_t* m = reinterpret_cast<private_module_t*>(
|
||||
dev->common.module);
|
||||
|
||||
// allocate the framebuffer
|
||||
if (m->framebuffer == NULL) {
|
||||
// initialize the framebuffer, the framebuffer is mapped once
|
||||
// and forever.
|
||||
int err = mapFrameBufferLocked(m);
|
||||
if (err < 0) {
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
||||
const uint32_t bufferMask = m->bufferMask;
|
||||
const uint32_t numBuffers = m->numBuffers;
|
||||
const size_t bufferSize = m->finfo.line_length * m->info.yres;
|
||||
if (numBuffers == 1) {
|
||||
// If we have only one buffer, we never use page-flipping. Instead,
|
||||
// we return a regular buffer which will be memcpy'ed to the main
|
||||
// screen when post is called.
|
||||
int newUsage = (usage & ~GRALLOC_USAGE_HW_FB) | GRALLOC_USAGE_HW_2D;
|
||||
return gralloc_alloc_buffer(dev, bufferSize, newUsage, pHandle);
|
||||
}
|
||||
|
||||
if (bufferMask >= ((1LU<<numBuffers)-1)) {
|
||||
// We ran out of buffers.
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
// create a "fake" handles for it
|
||||
intptr_t vaddr = intptr_t(m->framebuffer->base);
|
||||
private_handle_t* hnd = new private_handle_t(dup(m->framebuffer->fd), size,
|
||||
private_handle_t::PRIV_FLAGS_USES_PMEM |
|
||||
private_handle_t::PRIV_FLAGS_FRAMEBUFFER);
|
||||
|
||||
// find a free slot
|
||||
for (uint32_t i=0 ; i<numBuffers ; i++) {
|
||||
if ((bufferMask & (1LU<<i)) == 0) {
|
||||
m->bufferMask |= (1LU<<i);
|
||||
break;
|
||||
}
|
||||
vaddr += bufferSize;
|
||||
}
|
||||
|
||||
hnd->base = vaddr;
|
||||
hnd->offset = vaddr - intptr_t(m->framebuffer->base);
|
||||
*pHandle = hnd;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int gralloc_alloc_framebuffer(alloc_device_t* dev,
|
||||
size_t size, int usage, buffer_handle_t* pHandle)
|
||||
{
|
||||
private_module_t* m = reinterpret_cast<private_module_t*>(
|
||||
dev->common.module);
|
||||
pthread_mutex_lock(&m->lock);
|
||||
int err = gralloc_alloc_framebuffer_locked(dev, size, usage, pHandle);
|
||||
pthread_mutex_unlock(&m->lock);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
static int init_pmem_area_locked(private_module_t* m)
|
||||
{
|
||||
int err = 0;
|
||||
int master_fd = open("/dev/pmem", O_RDWR, 0);
|
||||
if (master_fd >= 0) {
|
||||
|
||||
size_t size;
|
||||
pmem_region region;
|
||||
if (ioctl(master_fd, PMEM_GET_TOTAL_SIZE, ®ion) < 0) {
|
||||
LOGE("PMEM_GET_TOTAL_SIZE failed, limp mode");
|
||||
size = 8<<20; // 8 MiB
|
||||
} else {
|
||||
size = region.len;
|
||||
}
|
||||
sAllocator.setSize(size);
|
||||
|
||||
void* base = mmap(0, size,
|
||||
PROT_READ|PROT_WRITE, MAP_SHARED, master_fd, 0);
|
||||
if (base == MAP_FAILED) {
|
||||
err = -errno;
|
||||
base = 0;
|
||||
close(master_fd);
|
||||
master_fd = -1;
|
||||
}
|
||||
m->pmem_master = master_fd;
|
||||
m->pmem_master_base = base;
|
||||
} else {
|
||||
err = -errno;
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
static int init_pmem_area(private_module_t* m)
|
||||
{
|
||||
pthread_mutex_lock(&m->lock);
|
||||
int err = m->pmem_master;
|
||||
if (err == -1) {
|
||||
// first time, try to initialize pmem
|
||||
err = init_pmem_area_locked(m);
|
||||
if (err) {
|
||||
m->pmem_master = err;
|
||||
}
|
||||
} else if (err < 0) {
|
||||
// pmem couldn't be initialized, never use it
|
||||
} else {
|
||||
// pmem OK
|
||||
err = 0;
|
||||
}
|
||||
pthread_mutex_unlock(&m->lock);
|
||||
return err;
|
||||
}
|
||||
|
||||
static int init_gpu_area_locked(private_module_t* m)
|
||||
{
|
||||
int err = 0;
|
||||
int gpu = open("/dev/msm_hw3dm", O_RDWR, 0);
|
||||
LOGE_IF(gpu<0, "could not open hw3dm (%s)", strerror(errno));
|
||||
if (gpu >= 0) {
|
||||
struct hw3d_region regions[HW3D_NUM_REGIONS];
|
||||
if (ioctl(gpu, HW3D_GET_REGIONS, regions) < 0) {
|
||||
LOGE("HW3D_GET_REGIONS failed (%s)", strerror(errno));
|
||||
err = -errno;
|
||||
} else {
|
||||
LOGD("smi: offset=%08lx, len=%08lx, phys=%p",
|
||||
regions[HW3D_SMI].map_offset,
|
||||
regions[HW3D_SMI].len,
|
||||
regions[HW3D_SMI].phys);
|
||||
LOGD("ebi: offset=%08lx, len=%08lx, phys=%p",
|
||||
regions[HW3D_EBI].map_offset,
|
||||
regions[HW3D_EBI].len,
|
||||
regions[HW3D_EBI].phys);
|
||||
LOGD("reg: offset=%08lx, len=%08lx, phys=%p",
|
||||
regions[HW3D_REGS].map_offset,
|
||||
regions[HW3D_REGS].len,
|
||||
regions[HW3D_REGS].phys);
|
||||
|
||||
void* base = mmap(0, ALLOCATORREGION_RESERVED_SIZE,
|
||||
PROT_READ|PROT_WRITE, MAP_SHARED,
|
||||
gpu, regions[FB_ARENA].map_offset);
|
||||
|
||||
if (base == MAP_FAILED) {
|
||||
LOGE("mmap EBI1 (%s)", strerror(errno));
|
||||
err = -errno;
|
||||
base = 0;
|
||||
close(gpu);
|
||||
gpu = -1;
|
||||
}
|
||||
|
||||
m->fb_map_offset = regions[FB_ARENA].map_offset;
|
||||
m->gpu = gpu;
|
||||
m->gpu_base = base;
|
||||
}
|
||||
} else {
|
||||
err = -errno;
|
||||
m->gpu = 0;
|
||||
m->gpu_base = 0;
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
static int init_gpu_area(private_module_t* m)
|
||||
{
|
||||
pthread_mutex_lock(&m->lock);
|
||||
int err = m->gpu;
|
||||
if (err == -1) {
|
||||
// first time, try to initialize gpu
|
||||
err = init_gpu_area_locked(m);
|
||||
if (err) {
|
||||
m->gpu = err;
|
||||
}
|
||||
} else if (err < 0) {
|
||||
// gpu couldn't be initialized, never use it
|
||||
} else {
|
||||
// gpu OK
|
||||
err = 0;
|
||||
}
|
||||
pthread_mutex_unlock(&m->lock);
|
||||
return err;
|
||||
}
|
||||
|
||||
static int gralloc_alloc_buffer(alloc_device_t* dev,
|
||||
size_t size, int usage, buffer_handle_t* pHandle)
|
||||
{
|
||||
int err = 0;
|
||||
int flags = 0;
|
||||
|
||||
int fd = -1;
|
||||
int gpu_fd = -1;
|
||||
void* base = 0;
|
||||
int offset = 0;
|
||||
|
||||
size = roundUpToPageSize(size);
|
||||
|
||||
if (usage & GRALLOC_USAGE_HW_TEXTURE) {
|
||||
// enable pmem in that case, so our software GL can fallback to
|
||||
// the copybit module.
|
||||
flags |= private_handle_t::PRIV_FLAGS_USES_PMEM;
|
||||
}
|
||||
|
||||
if (usage & GRALLOC_USAGE_HW_2D) {
|
||||
flags |= private_handle_t::PRIV_FLAGS_USES_PMEM;
|
||||
}
|
||||
|
||||
if ((flags & private_handle_t::PRIV_FLAGS_USES_PMEM) == 0) {
|
||||
try_ashmem:
|
||||
fd = ashmem_create_region("gralloc-buffer", size);
|
||||
if (fd < 0) {
|
||||
LOGE("couldn't create ashmem (%s)", strerror(errno));
|
||||
err = -errno;
|
||||
}
|
||||
} else if ((usage & GRALLOC_USAGE_HW_RENDER) == 0) {
|
||||
private_module_t* m = reinterpret_cast<private_module_t*>(
|
||||
dev->common.module);
|
||||
|
||||
err = init_pmem_area(m);
|
||||
if (err == 0) {
|
||||
// PMEM buffers are always mmapped
|
||||
base = m->pmem_master_base;
|
||||
offset = sAllocator.allocate(size);
|
||||
if (offset < 0) {
|
||||
// no more pmem memory
|
||||
err = -ENOMEM;
|
||||
} else {
|
||||
struct pmem_region sub = { offset, size };
|
||||
|
||||
// now create the "sub-heap"
|
||||
fd = open("/dev/pmem", O_RDWR, 0);
|
||||
err = fd < 0 ? fd : 0;
|
||||
|
||||
// and connect to it
|
||||
if (err == 0)
|
||||
err = ioctl(fd, PMEM_CONNECT, m->pmem_master);
|
||||
|
||||
// and make it available to the client process
|
||||
if (err == 0)
|
||||
err = ioctl(fd, PMEM_MAP, &sub);
|
||||
|
||||
if (err < 0) {
|
||||
err = -errno;
|
||||
close(fd);
|
||||
sAllocator.deallocate(offset);
|
||||
fd = -1;
|
||||
}
|
||||
memset((char*)base + offset, 0, size);
|
||||
//LOGD_IF(!err, "allocating pmem size=%d, offset=%d", size, offset);
|
||||
}
|
||||
} else {
|
||||
if ((usage & GRALLOC_USAGE_HW_2D) == 0) {
|
||||
// the caller didn't request PMEM, so we can try something else
|
||||
flags &= ~private_handle_t::PRIV_FLAGS_USES_PMEM;
|
||||
err = 0;
|
||||
goto try_ashmem;
|
||||
} else {
|
||||
LOGE("couldn't open pmem (%s)", strerror(errno));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// looks like we want 3D...
|
||||
flags &= ~private_handle_t::PRIV_FLAGS_USES_PMEM;
|
||||
flags |= private_handle_t::PRIV_FLAGS_USES_GPU;
|
||||
|
||||
private_module_t* m = reinterpret_cast<private_module_t*>(
|
||||
dev->common.module);
|
||||
|
||||
err = init_gpu_area(m);
|
||||
if (err == 0) {
|
||||
// GPU buffers are always mmapped
|
||||
base = m->gpu_base;
|
||||
|
||||
// When a process holding GPU surfaces gets killed, it may take
|
||||
// up to a few seconds until SurfaceFlinger is notified and can
|
||||
// release the memory. So it's useful to wait a little bit here.
|
||||
long sleeptime = 0;
|
||||
int retry = 8; // roughly 5 seconds
|
||||
do {
|
||||
offset = sAllocatorGPU.allocate(size);
|
||||
if (offset < 0) {
|
||||
// no more pmem memory
|
||||
LOGW("%d KiB allocation failed in GPU memory, retrying...",
|
||||
size/1024);
|
||||
err = -ENOMEM;
|
||||
sleeptime += 250000;
|
||||
usleep(sleeptime);
|
||||
} else {
|
||||
LOGD("allocating GPU size=%d, offset=%d", size, offset);
|
||||
fd = open("/dev/null", O_RDONLY); // just so marshalling doesn't fail
|
||||
gpu_fd = m->gpu;
|
||||
memset((char*)base + offset, 0, size);
|
||||
err = 0;
|
||||
}
|
||||
} while ((err == -ENOMEM) && (retry-- > 0));
|
||||
|
||||
} else {
|
||||
// not enough memory, try ashmem
|
||||
flags &= ~private_handle_t::PRIV_FLAGS_USES_GPU;
|
||||
err = 0;
|
||||
goto try_ashmem;
|
||||
}
|
||||
}
|
||||
|
||||
if (err == 0) {
|
||||
private_handle_t* hnd = new private_handle_t(fd, size, flags);
|
||||
if (base == NULL) {
|
||||
gralloc_module_t* module = reinterpret_cast<gralloc_module_t*>(
|
||||
dev->common.module);
|
||||
err = mapBuffer(module, hnd);
|
||||
if (err == 0) {
|
||||
*pHandle = hnd;
|
||||
}
|
||||
} else {
|
||||
private_module_t* m = reinterpret_cast<private_module_t*>(
|
||||
dev->common.module);
|
||||
hnd->offset = offset;
|
||||
hnd->base = int(base)+offset;
|
||||
hnd->gpu_fd = gpu_fd;
|
||||
hnd->map_offset = m->fb_map_offset;
|
||||
*pHandle = hnd;
|
||||
}
|
||||
}
|
||||
|
||||
LOGE_IF(err, "gralloc failed err=%s", strerror(-err));
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static int gralloc_alloc(alloc_device_t* dev,
|
||||
int w, int h, int format, int usage,
|
||||
buffer_handle_t* pHandle, int* pStride)
|
||||
{
|
||||
if (!pHandle || !pStride)
|
||||
return -EINVAL;
|
||||
|
||||
size_t size, stride;
|
||||
|
||||
int bpp = 0;
|
||||
switch (format) {
|
||||
case HAL_PIXEL_FORMAT_RGBA_8888:
|
||||
case HAL_PIXEL_FORMAT_RGBX_8888:
|
||||
case HAL_PIXEL_FORMAT_BGRA_8888:
|
||||
bpp = 4;
|
||||
break;
|
||||
case HAL_PIXEL_FORMAT_RGB_888:
|
||||
bpp = 3;
|
||||
break;
|
||||
case HAL_PIXEL_FORMAT_RGB_565:
|
||||
case HAL_PIXEL_FORMAT_RGBA_5551:
|
||||
case HAL_PIXEL_FORMAT_RGBA_4444:
|
||||
bpp = 2;
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (usage & GRALLOC_USAGE_HW_RENDER) {
|
||||
/* buffers MUST be aligned to the NEXT 8 pixels multiple any other
|
||||
* alignments will fail do to assumptions in the driver */
|
||||
const int pixelAlignment = 8;
|
||||
const int mask = pixelAlignment - 1;
|
||||
stride = (w + mask) & ~mask;
|
||||
size = stride * h * bpp;
|
||||
} else {
|
||||
const int align = 4;
|
||||
size_t bpr = (w*bpp + (align-1)) & ~(align-1);
|
||||
size = bpr * h;
|
||||
stride = bpr / bpp;
|
||||
}
|
||||
|
||||
int err;
|
||||
if (usage & GRALLOC_USAGE_HW_FB) {
|
||||
err = gralloc_alloc_framebuffer(dev, size, usage, pHandle);
|
||||
} else {
|
||||
err = gralloc_alloc_buffer(dev, size, usage, pHandle);
|
||||
}
|
||||
|
||||
if (err < 0) {
|
||||
return err;
|
||||
}
|
||||
|
||||
*pStride = stride;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int gralloc_free(alloc_device_t* dev,
|
||||
buffer_handle_t handle)
|
||||
{
|
||||
if (private_handle_t::validate(handle) < 0)
|
||||
return -EINVAL;
|
||||
|
||||
private_handle_t const* hnd = reinterpret_cast<private_handle_t const*>(handle);
|
||||
if (hnd->flags & private_handle_t::PRIV_FLAGS_FRAMEBUFFER) {
|
||||
// free this buffer
|
||||
private_module_t* m = reinterpret_cast<private_module_t*>(
|
||||
dev->common.module);
|
||||
const size_t bufferSize = m->finfo.line_length * m->info.yres;
|
||||
int index = (hnd->base - m->framebuffer->base) / bufferSize;
|
||||
m->bufferMask &= ~(1<<index);
|
||||
} else {
|
||||
if (hnd->flags & private_handle_t::PRIV_FLAGS_USES_PMEM) {
|
||||
if (hnd->fd >= 0) {
|
||||
struct pmem_region sub = { hnd->offset, hnd->size };
|
||||
int err = ioctl(hnd->fd, PMEM_UNMAP, &sub);
|
||||
LOGE_IF(err<0, "PMEM_UNMAP failed (%s), "
|
||||
"fd=%d, sub.offset=%lu, sub.size=%lu",
|
||||
strerror(errno), hnd->fd, hnd->offset, hnd->size);
|
||||
if (err == 0) {
|
||||
// we can't deallocate the memory in case of UNMAP failure
|
||||
// because it would give that process access to someone else's
|
||||
// surfaces, which would be a security breach.
|
||||
sAllocator.deallocate(hnd->offset);
|
||||
}
|
||||
}
|
||||
} else if (hnd->flags & private_handle_t::PRIV_FLAGS_USES_GPU) {
|
||||
LOGD("freeing GPU buffer at %d", hnd->offset);
|
||||
sAllocatorGPU.deallocate(hnd->offset);
|
||||
}
|
||||
|
||||
gralloc_module_t* module = reinterpret_cast<gralloc_module_t*>(
|
||||
dev->common.module);
|
||||
terminateBuffer(module, const_cast<private_handle_t*>(hnd));
|
||||
}
|
||||
|
||||
close(hnd->fd);
|
||||
delete hnd;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static int gralloc_close(struct hw_device_t *dev)
|
||||
{
|
||||
gralloc_context_t* ctx = reinterpret_cast<gralloc_context_t*>(dev);
|
||||
if (ctx) {
|
||||
/* TODO: keep a list of all buffer_handle_t created, and free them
|
||||
* all here.
|
||||
*/
|
||||
free(ctx);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int gralloc_device_open(const hw_module_t* module, const char* name,
|
||||
hw_device_t** device)
|
||||
{
|
||||
int status = -EINVAL;
|
||||
if (!strcmp(name, GRALLOC_HARDWARE_GPU0)) {
|
||||
gralloc_context_t *dev;
|
||||
dev = (gralloc_context_t*)malloc(sizeof(*dev));
|
||||
|
||||
/* initialize our state here */
|
||||
memset(dev, 0, sizeof(*dev));
|
||||
|
||||
/* initialize the procs */
|
||||
dev->device.common.tag = HARDWARE_DEVICE_TAG;
|
||||
dev->device.common.version = 0;
|
||||
dev->device.common.module = const_cast<hw_module_t*>(module);
|
||||
dev->device.common.close = gralloc_close;
|
||||
|
||||
dev->device.alloc = gralloc_alloc;
|
||||
dev->device.free = gralloc_free;
|
||||
|
||||
*device = &dev->device.common;
|
||||
status = 0;
|
||||
} else {
|
||||
status = fb_device_open(module, name, device);
|
||||
}
|
||||
return status;
|
||||
}
|
120
libgralloc/gralloc_priv.h
Normal file
120
libgralloc/gralloc_priv.h
Normal file
@ -0,0 +1,120 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef GRALLOC_PRIV_H_
|
||||
#define GRALLOC_PRIV_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#include <limits.h>
|
||||
#include <sys/cdefs.h>
|
||||
#include <hardware/gralloc.h>
|
||||
#include <pthread.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <cutils/native_handle.h>
|
||||
|
||||
#include <linux/fb.h>
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
struct private_module_t;
|
||||
struct private_handle_t;
|
||||
|
||||
struct private_module_t {
|
||||
gralloc_module_t base;
|
||||
|
||||
struct private_handle_t* framebuffer;
|
||||
uint32_t flags;
|
||||
uint32_t numBuffers;
|
||||
uint32_t bufferMask;
|
||||
pthread_mutex_t lock;
|
||||
buffer_handle_t currentBuffer;
|
||||
int pmem_master;
|
||||
void* pmem_master_base;
|
||||
unsigned long master_phys;
|
||||
int gpu;
|
||||
void* gpu_base;
|
||||
int fb_map_offset;
|
||||
|
||||
struct fb_var_screeninfo info;
|
||||
struct fb_fix_screeninfo finfo;
|
||||
float xdpi;
|
||||
float ydpi;
|
||||
float fps;
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
struct private_handle_t : public native_handle {
|
||||
#else
|
||||
struct private_handle_t {
|
||||
native_handle_t nativeHandle;
|
||||
#endif
|
||||
|
||||
enum {
|
||||
PRIV_FLAGS_FRAMEBUFFER = 0x00000001,
|
||||
PRIV_FLAGS_USES_PMEM = 0x00000002,
|
||||
PRIV_FLAGS_USES_GPU = 0x00000004,
|
||||
};
|
||||
|
||||
// file-descriptors
|
||||
int fd;
|
||||
// ints
|
||||
int magic;
|
||||
int flags;
|
||||
int size;
|
||||
int offset;
|
||||
int gpu_fd; // stored as an int, b/c we don't want it marshalled
|
||||
|
||||
// FIXME: the attributes below should be out-of-line
|
||||
int base;
|
||||
int map_offset;
|
||||
int pid;
|
||||
|
||||
#ifdef __cplusplus
|
||||
static const int sNumInts = 8;
|
||||
static const int sNumFds = 1;
|
||||
static const int sMagic = 'gmsm';
|
||||
|
||||
private_handle_t(int fd, int size, int flags) :
|
||||
fd(fd), magic(sMagic), flags(flags), size(size), offset(0),
|
||||
base(0), pid(getpid())
|
||||
{
|
||||
version = sizeof(native_handle);
|
||||
numInts = sNumInts;
|
||||
numFds = sNumFds;
|
||||
}
|
||||
~private_handle_t() {
|
||||
magic = 0;
|
||||
}
|
||||
|
||||
static int validate(const native_handle* h) {
|
||||
const private_handle_t* hnd = (const private_handle_t*)h;
|
||||
if (!h || h->version != sizeof(native_handle) ||
|
||||
h->numInts != sNumInts || h->numFds != sNumFds ||
|
||||
hnd->magic != sMagic)
|
||||
{
|
||||
LOGE("invalid gralloc handle (at %p)", h);
|
||||
return -EINVAL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif /* GRALLOC_PRIV_H_ */
|
241
libgralloc/mapper.cpp
Normal file
241
libgralloc/mapper.cpp
Normal file
@ -0,0 +1,241 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <limits.h>
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include <sys/mman.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#include <cutils/log.h>
|
||||
#include <cutils/atomic.h>
|
||||
|
||||
#include <hardware/hardware.h>
|
||||
#include <hardware/gralloc.h>
|
||||
|
||||
#include <linux/android_pmem.h>
|
||||
|
||||
#include "gralloc_priv.h"
|
||||
|
||||
|
||||
// we need this for now because pmem cannot mmap at an offset
|
||||
#define PMEM_HACK 1
|
||||
|
||||
/* desktop Linux needs a little help with gettid() */
|
||||
#if defined(ARCH_X86) && !defined(HAVE_ANDROID_OS)
|
||||
#define __KERNEL__
|
||||
# include <linux/unistd.h>
|
||||
pid_t gettid() { return syscall(__NR_gettid);}
|
||||
#undef __KERNEL__
|
||||
#endif
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static int gralloc_map(gralloc_module_t const* module,
|
||||
buffer_handle_t handle,
|
||||
void** vaddr)
|
||||
{
|
||||
private_handle_t* hnd = (private_handle_t*)handle;
|
||||
if (!(hnd->flags & private_handle_t::PRIV_FLAGS_FRAMEBUFFER)) {
|
||||
size_t size = hnd->size;
|
||||
#if PMEM_HACK
|
||||
size += hnd->offset;
|
||||
#endif
|
||||
void* mappedAddress = mmap(0, size,
|
||||
PROT_READ|PROT_WRITE, MAP_SHARED, hnd->fd, 0);
|
||||
if (mappedAddress == MAP_FAILED) {
|
||||
LOGE("Could not mmap handle %p, fd=%d (%s)",
|
||||
handle, hnd->fd, strerror(errno));
|
||||
hnd->base = 0;
|
||||
return -errno;
|
||||
}
|
||||
hnd->base = intptr_t(mappedAddress) + hnd->offset;
|
||||
//LOGD("gralloc_map() succeeded fd=%d, off=%d, size=%d, vaddr=%p",
|
||||
// hnd->fd, hnd->offset, hnd->size, mappedAddress);
|
||||
}
|
||||
*vaddr = (void*)hnd->base;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int gralloc_unmap(gralloc_module_t const* module,
|
||||
buffer_handle_t handle)
|
||||
{
|
||||
private_handle_t* hnd = (private_handle_t*)handle;
|
||||
if (!(hnd->flags & private_handle_t::PRIV_FLAGS_FRAMEBUFFER)) {
|
||||
void* base = (void*)hnd->base;
|
||||
size_t size = hnd->size;
|
||||
#if PMEM_HACK
|
||||
base = (void*)(intptr_t(base) - hnd->offset);
|
||||
size += hnd->offset;
|
||||
#endif
|
||||
//LOGD("unmapping from %p, size=%d, flags=%08x", base, size, hnd->flags);
|
||||
if (munmap(base, size) < 0) {
|
||||
LOGE("Could not unmap %s", strerror(errno));
|
||||
}
|
||||
}
|
||||
hnd->base = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static pthread_mutex_t sMapLock = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
int gralloc_register_buffer(gralloc_module_t const* module,
|
||||
buffer_handle_t handle)
|
||||
{
|
||||
if (private_handle_t::validate(handle) < 0)
|
||||
return -EINVAL;
|
||||
|
||||
// if this handle was created in this process, then we keep it as is.
|
||||
int err = 0;
|
||||
private_handle_t* hnd = (private_handle_t*)handle;
|
||||
if (hnd->pid != getpid()) {
|
||||
hnd->base = NULL;
|
||||
if (!(hnd->flags & private_handle_t::PRIV_FLAGS_USES_GPU)) {
|
||||
void *vaddr;
|
||||
err = gralloc_map(module, handle, &vaddr);
|
||||
}
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
int gralloc_unregister_buffer(gralloc_module_t const* module,
|
||||
buffer_handle_t handle)
|
||||
{
|
||||
if (private_handle_t::validate(handle) < 0)
|
||||
return -EINVAL;
|
||||
|
||||
// never unmap buffers that were created in this process
|
||||
private_handle_t* hnd = (private_handle_t*)handle;
|
||||
if (hnd->pid != getpid()) {
|
||||
if (hnd->base) {
|
||||
gralloc_unmap(module, handle);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int mapBuffer(gralloc_module_t const* module,
|
||||
private_handle_t* hnd)
|
||||
{
|
||||
void* vaddr;
|
||||
return gralloc_map(module, hnd, &vaddr);
|
||||
}
|
||||
|
||||
int terminateBuffer(gralloc_module_t const* module,
|
||||
private_handle_t* hnd)
|
||||
{
|
||||
if (hnd->base) {
|
||||
// this buffer was mapped, unmap it now
|
||||
if (hnd->flags & private_handle_t::PRIV_FLAGS_USES_PMEM) {
|
||||
if (hnd->pid != getpid()) {
|
||||
// ... unless it's a "master" pmem buffer, that is a buffer
|
||||
// mapped in the process it's been allocated.
|
||||
// (see gralloc_alloc_buffer())
|
||||
gralloc_unmap(module, hnd);
|
||||
}
|
||||
} else if (hnd->flags & private_handle_t::PRIV_FLAGS_USES_GPU) {
|
||||
// XXX: for now do nothing here
|
||||
} else {
|
||||
gralloc_unmap(module, hnd);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int gralloc_lock(gralloc_module_t const* module,
|
||||
buffer_handle_t handle, int usage,
|
||||
int l, int t, int w, int h,
|
||||
void** vaddr)
|
||||
{
|
||||
// this is called when a buffer is being locked for software
|
||||
// access. in thin implementation we have nothing to do since
|
||||
// not synchronization with the h/w is needed.
|
||||
// typically this is used to wait for the h/w to finish with
|
||||
// this buffer if relevant. the data cache may need to be
|
||||
// flushed or invalidated depending on the usage bits and the
|
||||
// hardware.
|
||||
|
||||
if (private_handle_t::validate(handle) < 0)
|
||||
return -EINVAL;
|
||||
|
||||
private_handle_t* hnd = (private_handle_t*)handle;
|
||||
*vaddr = (void*)hnd->base;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int gralloc_unlock(gralloc_module_t const* module,
|
||||
buffer_handle_t handle)
|
||||
{
|
||||
// we're done with a software buffer. nothing to do in this
|
||||
// implementation. typically this is used to flush the data cache.
|
||||
|
||||
if (private_handle_t::validate(handle) < 0)
|
||||
return -EINVAL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
int gralloc_perform(struct gralloc_module_t const* module,
|
||||
int operation, ... )
|
||||
{
|
||||
int res = -EINVAL;
|
||||
va_list args;
|
||||
va_start(args, operation);
|
||||
|
||||
switch (operation) {
|
||||
case GRALLOC_MODULE_PERFORM_CREATE_HANDLE_FROM_BUFFER: {
|
||||
int fd = va_arg(args, int);
|
||||
size_t size = va_arg(args, size_t);
|
||||
size_t offset = va_arg(args, size_t);
|
||||
void* base = va_arg(args, void*);
|
||||
|
||||
// validate that it's indeed a pmem buffer
|
||||
pmem_region region;
|
||||
if (ioctl(fd, PMEM_GET_SIZE, ®ion) < 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
native_handle_t** handle = va_arg(args, native_handle_t**);
|
||||
private_handle_t* hnd = (private_handle_t*)native_handle_create(
|
||||
private_handle_t::sNumFds, private_handle_t::sNumInts);
|
||||
hnd->magic = private_handle_t::sMagic;
|
||||
hnd->fd = fd;
|
||||
hnd->flags = private_handle_t::PRIV_FLAGS_USES_PMEM;
|
||||
hnd->size = size;
|
||||
hnd->offset = offset;
|
||||
hnd->base = intptr_t(base) + offset;
|
||||
*handle = (native_handle_t *)hnd;
|
||||
res = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
va_end(args);
|
||||
return res;
|
||||
}
|
@ -1,4 +1,3 @@
|
||||
#
|
||||
# Copyright (C) 2008 The Android Open Source Project
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@ -12,8 +11,23 @@
|
||||
# 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.
|
||||
#
|
||||
|
||||
$(call inherit-product, device/common/gps/gps_eu_supl.mk)
|
||||
$(call inherit-product-if-exists, device/htc/tattoo/device_tattoo_eu-vendor.mk)
|
||||
$(call inherit-product, device/htc/tattoo/device_tattoo.mk)
|
||||
LOCAL_PATH:= $(call my-dir)
|
||||
|
||||
ifneq ($(TARGET_SIMULATOR),true)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := lights.bahamas
|
||||
|
||||
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
|
||||
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
|
||||
LOCAL_SRC_FILES := lights.c
|
||||
LOCAL_SHARED_LIBRARIES := liblog
|
||||
LOCAL_PRELINK_MODULE := false
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
||||
endif # !TARGET_SIMULATOR
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user