diff options
27 files changed, 379 insertions, 92 deletions
diff --git a/AndroidProducts.mk b/AndroidProducts.mk index 77183bba..3310b9c3 100644 --- a/AndroidProducts.mk +++ b/AndroidProducts.mk @@ -1,3 +1,4 @@ PRODUCT_MAKEFILES := \ $(LOCAL_DIR)/kernel-tests/goldfish_kernel_tests_x86_64.mk \ - $(LOCAL_DIR)/sdk_phone_x86_vendor.mk + $(LOCAL_DIR)/sdk_phone_x86_vendor.mk \ + $(LOCAL_DIR)/fvp.mk diff --git a/camera/Thumbnail.cpp b/camera/Thumbnail.cpp index 8f901a31..d3472a4b 100644 --- a/camera/Thumbnail.cpp +++ b/camera/Thumbnail.cpp @@ -27,40 +27,14 @@ #include <vector> /* - * The NV21 format is a YUV format with an 8-bit Y-component and the U and V + * The YU12 format is a YUV format with an 8-bit Y-component and the U and V * components are stored as 8 bits each but they are shared between a block of * 2x2 pixels. So when calculating bits per pixel the 16 bits of U and V are * shared between 4 pixels leading to 4 bits of U and V per pixel. Together * with the 8 bits of Y this gives us 12 bits per pixel.. * - * The components are not grouped by pixels but separated into one Y-plane and - * one interleaved U and V-plane. The first half of the byte sequence is all of - * the Y data laid out in a linear fashion. After that the interleaved U and V- - * plane starts with one byte of V followed by one byte of U followed by one - * byte of V and so on. Each byte of U or V is associated with a 2x2 pixel block - * in a linear fashion. - * - * For an 8 by 4 pixel image the layout would be: - * - * +-----+-----+-----+-----+-----+-----+-----+-----+ - * | Y0 | Y1 | Y2 | Y3 | Y4 | Y5 | Y6 | Y7 | - * +-----+-----+-----+-----+-----+-----+-----+-----+ - * | Y8 | Y9 | Y10 | Y11 | Y12 | Y13 | Y14 | Y15 | - * +-----+-----+-----+-----+-----+-----+-----+-----+ - * | Y16 | Y17 | Y18 | Y19 | Y20 | Y21 | Y22 | Y23 | - * +-----+-----+-----+-----+-----+-----+-----+-----+ - * | Y24 | Y25 | Y26 | Y27 | Y28 | Y29 | Y30 | Y31 | - * +-----+-----+-----+-----+-----+-----+-----+-----+ - * | V0 | U0 | V1 | U1 | V2 | U2 | V3 | U3 | - * +-----+-----+-----+-----+-----+-----+-----+-----+ - * | V4 | U4 | V5 | U5 | V6 | U6 | V7 | U7 | - * +-----+-----+-----+-----+-----+-----+-----+-----+ - * - * In this image V0 and U0 are the V and U components for the 2x2 block of - * pixels whose Y components are Y0, Y1, Y8 and Y9. V1 and U1 are matched with - * the Y components Y2, Y3, Y10, Y11, and so on for that row. For the next row - * of V and U the V4 and U4 components would be paired with Y16, Y17, Y24 and - * Y25. + * The components are not grouped by pixels but separated into one Y-plane, one + * U-plane and one V-plane. */ namespace android { @@ -69,20 +43,9 @@ static bool createRawThumbnail(const unsigned char* sourceImage, int sourceWidth, int sourceHeight, int thumbnailWidth, int thumbnailHeight, std::vector<unsigned char>* thumbnail) { - // Deinterleave the U and V planes into separate planes, this is because - // libyuv requires the planes to be separate when scaling - const size_t sourceUVPlaneSize = (sourceWidth * sourceHeight) / 4; - // Put both U and V planes in one buffer, one after the other, to reduce - // memory fragmentation and number of allocations - std::vector<unsigned char> sourcePlanes(sourceUVPlaneSize * 2); const unsigned char* ySourcePlane = sourceImage; - unsigned char* uSourcePlane = &sourcePlanes[0]; - unsigned char* vSourcePlane = &sourcePlanes[sourceUVPlaneSize]; - - for (size_t i = 0; i < sourceUVPlaneSize; ++i) { - vSourcePlane[i] = sourceImage[sourceWidth * sourceHeight + i * 2 + 0]; - uSourcePlane[i] = sourceImage[sourceWidth * sourceHeight + i * 2 + 1]; - } + const unsigned char* uSourcePlane = sourceImage + sourceWidth * sourceHeight; + const unsigned char* vSourcePlane = uSourcePlane + sourceWidth * sourceHeight / 4; // Create enough space in the output vector for the result thumbnail->resize((thumbnailWidth * thumbnailHeight * 12) / 8); @@ -92,8 +55,8 @@ static bool createRawThumbnail(const unsigned char* sourceImage, const size_t destUVPlaneSize = (thumbnailWidth * thumbnailHeight) / 4; std::vector<unsigned char> destPlanes(destUVPlaneSize * 2); unsigned char* yDestPlane = &(*thumbnail)[0]; - unsigned char* uDestPlane = &destPlanes[0]; - unsigned char* vDestPlane = &destPlanes[destUVPlaneSize]; + unsigned char* uDestPlane = yDestPlane + thumbnailWidth * thumbnailHeight; + unsigned char* vDestPlane = uDestPlane + thumbnailWidth * thumbnailHeight / 4; // The strides for the U and V planes are half the width because the U and V // components are common to 2x2 pixel blocks @@ -112,14 +75,6 @@ static bool createRawThumbnail(const unsigned char* sourceImage, return false; } - // Now we need to interleave the downscaled U and V planes into the - // output buffer to make it NV21 encoded - const size_t uvPlanesOffset = thumbnailWidth * thumbnailHeight; - for (size_t i = 0; i < destUVPlaneSize; ++i) { - (*thumbnail)[uvPlanesOffset + i * 2 + 0] = vDestPlane[i]; - (*thumbnail)[uvPlanesOffset + i * 2 + 1] = uDestPlane[i]; - } - return true; } diff --git a/camera/fake-pipeline2/Scene.cpp b/camera/fake-pipeline2/Scene.cpp index 11beee7d..1bfd216a 100644 --- a/camera/fake-pipeline2/Scene.cpp +++ b/camera/fake-pipeline2/Scene.cpp @@ -42,8 +42,8 @@ namespace android { const int Scene::kSceneWidth = 20; const int Scene::kSceneHeight = 20; -const int Scene::kMaxWidth = 640; -const int Scene::kMaxHeight = 480; +const int Scene::kMaxWidth = 20; +const int Scene::kMaxHeight = 20; const uint8_t Scene::kScene[Scene::kSceneWidth * Scene::kSceneHeight] = { // 5 10 15 20 @@ -343,13 +343,13 @@ void Scene::calculateScene(nsecs_t time) { // Handshake model constants. // Frequencies measured in a nanosecond timebase -const float Scene::kHorizShakeFreq1 = 2 * M_PI * 2 / 1e9; // 2 Hz -const float Scene::kHorizShakeFreq2 = 2 * M_PI * 13 / 1e9; // 13 Hz -const float Scene::kVertShakeFreq1 = 2 * M_PI * 3 / 1e9; // 3 Hz -const float Scene::kVertShakeFreq2 = 2 * M_PI * 11 / 1e9; // 1 Hz +const float Scene::kHorizShakeFreq1 = 2 * M_PI * 1 / 1e9; // 1 Hz +const float Scene::kHorizShakeFreq2 = 2 * M_PI * 1 / 1e9; // 1 Hz +const float Scene::kVertShakeFreq1 = 2 * M_PI * 1 / 1e9; // 1 Hz +const float Scene::kVertShakeFreq2 = 2 * M_PI * 1 / 1e9; // 1 Hz const float Scene::kFreq1Magnitude = 5; const float Scene::kFreq2Magnitude = 1; -const float Scene::kShakeFraction = 0.03; // As a fraction of a scene tile +const float Scene::kShakeFraction = 0.2; // As a fraction of a scene tile // RGB->YUV, Jpeg standard const float Scene::kRgb2Yuv[12] = { diff --git a/camera/fake-pipeline2/Sensor.cpp b/camera/fake-pipeline2/Sensor.cpp index fcbc4cda..ab984efe 100644 --- a/camera/fake-pipeline2/Sensor.cpp +++ b/camera/fake-pipeline2/Sensor.cpp @@ -17,6 +17,7 @@ //#define LOG_NDEBUG 0 //#define LOG_NNDEBUG 0 #define LOG_TAG "EmulatedCamera2_Sensor" +#define ATRACE_TAG ATRACE_TAG_CAMERA #ifdef LOG_NNDEBUG #define ALOGVV(...) ALOGV(__VA_ARGS__) @@ -25,6 +26,7 @@ #endif #include <log/log.h> +#include <utils/Trace.h> #include "../EmulatedFakeCamera2.h" #include "Sensor.h" @@ -227,6 +229,7 @@ status_t Sensor::readyToRun() { } bool Sensor::threadLoop() { + ATRACE_CALL(); /** * Sensor capture operation main loop. * @@ -387,6 +390,7 @@ bool Sensor::threadLoop() { }; void Sensor::captureRaw(uint8_t *img, uint32_t gain, uint32_t stride) { + ATRACE_CALL(); float totalGain = gain/100.0 * kBaseGainFactor; float noiseVarGain = totalGain * totalGain; float readNoiseVar = kReadNoiseVarBeforeGain * noiseVarGain @@ -428,6 +432,7 @@ void Sensor::captureRaw(uint8_t *img, uint32_t gain, uint32_t stride) { } void Sensor::captureRGBA(uint8_t *img, uint32_t gain, uint32_t width, uint32_t height) { + ATRACE_CALL(); float totalGain = gain/100.0 * kBaseGainFactor; // In fixed-point math, calculate total scaling from electrons to 8bpp int scale64x = 64 * totalGain * 255 / kMaxRawValue; @@ -466,6 +471,7 @@ void Sensor::captureRGBA(uint8_t *img, uint32_t gain, uint32_t width, uint32_t h } void Sensor::captureRGB(uint8_t *img, uint32_t gain, uint32_t width, uint32_t height) { + ATRACE_CALL(); float totalGain = gain/100.0 * kBaseGainFactor; // In fixed-point math, calculate total scaling from electrons to 8bpp int scale64x = 64 * totalGain * 255 / kMaxRawValue; @@ -501,6 +507,7 @@ void Sensor::captureRGB(uint8_t *img, uint32_t gain, uint32_t width, uint32_t he } void Sensor::captureYU12(uint8_t *img, uint32_t gain, uint32_t width, uint32_t height) { + ATRACE_CALL(); float totalGain = gain/100.0 * kBaseGainFactor; // Using fixed-point math with 6 bits of fractional precision. // In fixed-point math, calculate total scaling from electrons to 8bpp @@ -560,6 +567,7 @@ void Sensor::captureYU12(uint8_t *img, uint32_t gain, uint32_t width, uint32_t h } void Sensor::captureDepth(uint8_t *img, uint32_t gain, uint32_t width, uint32_t height) { + ATRACE_CALL(); float totalGain = gain/100.0 * kBaseGainFactor; // In fixed-point math, calculate scaling factor to 13bpp millimeters int scale64x = 64 * totalGain * 8191 / kMaxRawValue; @@ -591,7 +599,7 @@ void Sensor::captureDepth(uint8_t *img, uint32_t gain, uint32_t width, uint32_t } void Sensor::captureDepthCloud(uint8_t *img) { - + ATRACE_CALL(); android_depth_points *cloud = reinterpret_cast<android_depth_points*>(img); cloud->num_points = 16; diff --git a/camera/jpeg-stub/Compressor.cpp b/camera/jpeg-stub/Compressor.cpp index 3fe0bd6c..02a05fd7 100644 --- a/camera/jpeg-stub/Compressor.cpp +++ b/camera/jpeg-stub/Compressor.cpp @@ -33,7 +33,6 @@ bool Compressor::compress(const unsigned char* data, // provide here so just return. return false; } - return compressData(data, exifData); } @@ -80,24 +79,6 @@ bool Compressor::configureCompressor(int width, int height, int quality) { return true; } -static void deinterleave(const uint8_t* vuPlanar, std::vector<uint8_t>& uRows, - std::vector<uint8_t>& vRows, int rowIndex, int width, - int height, int stride) { - int numRows = (height - rowIndex) / 2; - if (numRows > 8) numRows = 8; - for (int row = 0; row < numRows; ++row) { - int offset = ((rowIndex >> 1) + row) * stride; - const uint8_t* vu = vuPlanar + offset; - for (int i = 0; i < (width >> 1); ++i) { - int index = row * (width >> 1) + i; - uRows[index] = vu[1]; - vRows[index] = vu[0]; - vu += 2; - } - } -} - - bool Compressor::compressData(const unsigned char* data, ExifData* exifData) { const uint8_t* y[16]; const uint8_t* cb[8]; @@ -108,9 +89,8 @@ bool Compressor::compressData(const unsigned char* data, ExifData* exifData) { int width = mCompressInfo.image_width; int height = mCompressInfo.image_height; const uint8_t* yPlanar = data; - const uint8_t* vuPlanar = data + (width * height); - std::vector<uint8_t> uRows(8 * (width >> 1)); - std::vector<uint8_t> vRows(8 * (width >> 1)); + const uint8_t* uPlanar = yPlanar + width * height; + const uint8_t* vPlanar = uPlanar + width * height / 4; // NOTE! DANGER! Do not construct any non-trivial objects below setjmp! // The compiler will not generate code to destroy them during the return @@ -128,10 +108,6 @@ bool Compressor::compressData(const unsigned char* data, ExifData* exifData) { // process 16 lines of Y and 8 lines of U/V each time. while (mCompressInfo.next_scanline < mCompressInfo.image_height) { - //deinterleave u and v - deinterleave(vuPlanar, uRows, vRows, mCompressInfo.next_scanline, - width, height, width); - // Jpeg library ignores the rows whose indices are greater than height. for (i = 0; i < 16; i++) { // y row @@ -140,11 +116,10 @@ bool Compressor::compressData(const unsigned char* data, ExifData* exifData) { // construct u row and v row if ((i & 1) == 0) { // height and width are both halved because of downsampling - offset = (i >> 1) * (width >> 1); - cb[i/2] = &uRows[offset]; - cr[i/2] = &vRows[offset]; + cb[i/2] = uPlanar + (mCompressInfo.next_scanline + i) * width / 4; + cr[i/2] = vPlanar + (mCompressInfo.next_scanline + i) * width / 4; } - } + } jpeg_write_raw_data(&mCompressInfo, const_cast<JSAMPIMAGE>(planes), 16); } diff --git a/camera/qemu-pipeline3/QemuSensor.cpp b/camera/qemu-pipeline3/QemuSensor.cpp index f4560d0a..db2a66a3 100644 --- a/camera/qemu-pipeline3/QemuSensor.cpp +++ b/camera/qemu-pipeline3/QemuSensor.cpp @@ -21,6 +21,7 @@ //#define LOG_NNDEBUG 0 #define LOG_TAG "EmulatedCamera3_QemuSensor" +#define ATRACE_TAG ATRACE_TAG_CAMERA #ifdef LOG_NNDEBUG #define ALOGVV(...) ALOGV(__VA_ARGS__) @@ -35,6 +36,7 @@ #include <cstdlib> #include <linux/videodev2.h> #include <log/log.h> +#include <utils/Trace.h> namespace android { @@ -187,6 +189,7 @@ status_t QemuSensor::readyToRun() { } bool QemuSensor::threadLoop() { + ATRACE_CALL(); /* * Stages are out-of-order relative to a single frame's processing, but * in-order in time. @@ -343,6 +346,7 @@ bool QemuSensor::threadLoop() { void QemuSensor::captureRGBA(uint8_t *img, uint32_t width, uint32_t height, uint32_t stride, int64_t *timestamp) { + ATRACE_CALL(); status_t res; if (width != (uint32_t)mLastRequestWidth || height != (uint32_t)mLastRequestHeight) { @@ -412,6 +416,7 @@ void QemuSensor::captureRGB(uint8_t *img, uint32_t width, uint32_t height, uint3 } void QemuSensor::captureYU12(uint8_t *img, uint32_t width, uint32_t height, uint32_t stride, int64_t *timestamp) { + ATRACE_CALL(); status_t res; if (width != (uint32_t)mLastRequestWidth || height != (uint32_t)mLastRequestHeight) { @@ -0,0 +1,103 @@ +# +# Copyright 2019 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. +# + +PRODUCT_USE_DYNAMIC_PARTITIONS := true +PRODUCT_FULL_TREBLE_OVERRIDE := true + +# +# All components inherited here go to system image +# +$(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit.mk) +$(call inherit-product, $(SRC_TARGET_DIR)/product/mainline_system.mk) + +PRODUCT_ARTIFACT_PATH_REQUIREMENT_WHITELIST += \ + root/init.zygote64_32.rc \ + +# +# All components inherited here go to product image +# +$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_product.mk) + +# +# All components inherited here go to vendor image +# +$(call inherit-product, $(SRC_TARGET_DIR)/product/media_vendor.mk) + +PRODUCT_PACKAGES += \ + android.hardware.audio@2.0-service \ + android.hardware.audio@4.0-impl:32 \ + android.hardware.audio.effect@4.0-impl:32 \ + android.hardware.drm@1.0-service \ + android.hardware.drm@1.0-impl \ + android.hardware.drm@1.2-service.clearkey \ + android.hardware.gatekeeper@1.0-service.software \ + android.hardware.graphics.allocator@2.0-service \ + android.hardware.graphics.allocator@2.0-impl \ + android.hardware.graphics.composer@2.1-service \ + android.hardware.graphics.composer@2.1-impl \ + android.hardware.graphics.mapper@2.0-impl \ + android.hardware.health@2.0-service.goldfish \ + android.hardware.keymaster@4.0-service \ + android.hardware.keymaster@4.0-impl \ + libEGL_swiftshader \ + libGLESv1_CM_swiftshader \ + libGLESv2_swiftshader \ + +PRODUCT_PACKAGE_OVERLAYS := device/generic/goldfish/overlay + +PRODUCT_NAME := fvp +PRODUCT_DEVICE := fvpbase +PRODUCT_BRAND := Android +PRODUCT_MODEL := AOSP on FVP + +PRODUCT_COPY_FILES += \ + device/generic/goldfish/data/etc/handheld_core_hardware.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/handheld_core_hardware.xml \ + frameworks/native/data/etc/android.hardware.ethernet.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.ethernet.xml \ + device/generic/goldfish/fvpbase/fstab.fvpbase:$(TARGET_COPY_OUT_VENDOR)/etc/fstab.fvpbase \ + device/generic/goldfish/fvpbase/fstab.fvpbase.initrd:$(TARGET_COPY_OUT_RAMDISK)/fstab.fvpbase \ + device/generic/goldfish/fvpbase/init.fvpbase.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/hw/init.fvpbase.rc \ + device/generic/goldfish/fvpbase/init.insmod.sh:$(TARGET_COPY_OUT_VENDOR)/bin/init.insmod.sh \ + frameworks/av/services/audiopolicy/config/audio_policy_configuration_generic.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio_policy_configuration.xml \ + frameworks/av/services/audiopolicy/config/primary_audio_policy_configuration.xml:$(TARGET_COPY_OUT_VENDOR)/etc/primary_audio_policy_configuration.xml \ + frameworks/av/services/audiopolicy/config/r_submix_audio_policy_configuration.xml:$(TARGET_COPY_OUT_VENDOR)/etc/r_submix_audio_policy_configuration.xml \ + frameworks/av/services/audiopolicy/config/audio_policy_volumes.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio_policy_volumes.xml \ + frameworks/av/services/audiopolicy/config/default_volume_tables.xml:$(TARGET_COPY_OUT_VENDOR)/etc/default_volume_tables.xml \ + frameworks/av/services/audiopolicy/config/surround_sound_configuration_5_0.xml:$(TARGET_COPY_OUT_VENDOR)/etc/surround_sound_configuration_5_0.xml \ + +PRODUCT_DEFAULT_PROPERTY_OVERRIDES += \ + ro.hardware.egl=swiftshader \ + debug.sf.nobootanimation=1 \ + +PRODUCT_REQUIRES_INSECURE_EXECMEM_FOR_SWIFTSHADER := true + +# It's almost always faster to dexopt on the host even in eng builds. +WITH_DEXPREOPT_BOOT_IMG_AND_SYSTEM_SERVER_ONLY := false + +BOARD_VENDOR_KERNEL_MODULES := \ + $(OUT_DIR)/target/product/$(PRODUCT_DEVICE)/boot/amba-clcd.ko \ + $(OUT_DIR)/target/product/$(PRODUCT_DEVICE)/boot/ambakmi.ko \ + $(OUT_DIR)/target/product/$(PRODUCT_DEVICE)/boot/armmmci.ko \ + $(OUT_DIR)/target/product/$(PRODUCT_DEVICE)/boot/cfbcopyarea.ko \ + $(OUT_DIR)/target/product/$(PRODUCT_DEVICE)/boot/cfbfillrect.ko \ + $(OUT_DIR)/target/product/$(PRODUCT_DEVICE)/boot/cfbimgblt.ko \ + $(OUT_DIR)/target/product/$(PRODUCT_DEVICE)/boot/fb.ko \ + $(OUT_DIR)/target/product/$(PRODUCT_DEVICE)/boot/fixed.ko \ + $(OUT_DIR)/target/product/$(PRODUCT_DEVICE)/boot/mmc_block.ko \ + $(OUT_DIR)/target/product/$(PRODUCT_DEVICE)/boot/mmc_core.ko \ + $(OUT_DIR)/target/product/$(PRODUCT_DEVICE)/boot/mousedev.ko \ + $(OUT_DIR)/target/product/$(PRODUCT_DEVICE)/boot/psmouse.ko + +DEVICE_MANIFEST_FILE := device/generic/goldfish/fvpbase/manifest.xml diff --git a/fvpbase/BoardConfig.mk b/fvpbase/BoardConfig.mk new file mode 100644 index 00000000..234645e7 --- /dev/null +++ b/fvpbase/BoardConfig.mk @@ -0,0 +1,51 @@ +# Copyright (C) 2019 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. +# + +TARGET_ARCH := arm64 +TARGET_ARCH_VARIANT := armv8-a +TARGET_CPU_VARIANT := generic +TARGET_CPU_ABI := arm64-v8a + +TARGET_2ND_ARCH := arm +TARGET_2ND_CPU_ABI := armeabi-v7a +TARGET_2ND_CPU_ABI2 := armeabi +TARGET_2ND_ARCH_VARIANT := armv8-a +TARGET_2ND_CPU_VARIANT := generic + +include build/make/target/board/BoardConfigMainlineCommon.mk + +TARGET_NO_KERNEL := true + +BOARD_USES_SYSTEM_OTHER_ODEX := + +BUILD_QEMU_IMAGES := true +TARGET_USERIMAGES_SPARSE_EXT_DISABLED := true + +BOARD_BUILD_SUPER_IMAGE_BY_DEFAULT := true + +BOARD_SUPER_PARTITION_SIZE := 3229614080 +BOARD_SUPER_PARTITION_GROUPS := fvp_dynamic_partitions +BOARD_FVP_DYNAMIC_PARTITIONS_SIZE := 3221225472 +BOARD_FVP_DYNAMIC_PARTITIONS_PARTITION_LIST := system vendor +TARGET_COPY_OUT_PRODUCT := system/product +TARGET_COPY_OUT_SYSTEM_EXT := system/system_ext + +BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE := ext4 + +BOARD_USERDATAIMAGE_PARTITION_SIZE := 576716800 + +BOARD_SEPOLICY_DIRS += device/generic/goldfish/fvpbase/sepolicy + +TARGET_EXPERIMENTAL_MTE := true diff --git a/fvpbase/fstab.fvpbase b/fvpbase/fstab.fvpbase new file mode 100644 index 00000000..6c62809c --- /dev/null +++ b/fvpbase/fstab.fvpbase @@ -0,0 +1,8 @@ +# Android fstab file. +#<src> <mnt_point> <type> <mnt_flags and options> <fs_mgr_flags> +# The filesystem that contains the filesystem checker binary (typically /system) cannot +# specify MF_CHECK, and must come before any filesystems that do specify MF_CHECK +system /system ext4 ro,barrier=1 wait,logical,first_stage_mount +vendor /vendor ext4 ro,barrier=1 wait,logical,first_stage_mount +/dev/block/mmcblk0 /data ext4 noatime,nosuid,nodev,nomblk_io_submit,errors=panic wait,check,quota +/devices/*/block/vde auto auto defaults voldmanaged=sdcard:auto,encryptable=userdata diff --git a/fvpbase/fstab.fvpbase.initrd b/fvpbase/fstab.fvpbase.initrd new file mode 100644 index 00000000..56056634 --- /dev/null +++ b/fvpbase/fstab.fvpbase.initrd @@ -0,0 +1,4 @@ +# Android fstab file. +#<dev> <mnt_point> <type> <mnt_flags options> <fs_mgr_flags> +system /system ext4 ro,barrier=1 wait,logical,first_stage_mount +vendor /vendor ext4 ro,barrier=1 wait,logical,first_stage_mount diff --git a/fvpbase/init.fvpbase.rc b/fvpbase/init.fvpbase.rc new file mode 100644 index 00000000..41b6d7cf --- /dev/null +++ b/fvpbase/init.fvpbase.rc @@ -0,0 +1,12 @@ +service insmod_sh /vendor/bin/init.insmod.sh + user root + group root system + disabled + oneshot + +on init + start insmod_sh + +on fs + wait_for_prop vendor.all.modules.ready 1 + mount_all /vendor/etc/fstab.fvpbase diff --git a/fvpbase/init.insmod.sh b/fvpbase/init.insmod.sh new file mode 100644 index 00000000..f06a3827 --- /dev/null +++ b/fvpbase/init.insmod.sh @@ -0,0 +1,18 @@ +#!/vendor/bin/sh -e + +insmod /vendor/lib/modules/fb.ko +insmod /vendor/lib/modules/cfbcopyarea.ko +insmod /vendor/lib/modules/cfbfillrect.ko +insmod /vendor/lib/modules/cfbimgblt.ko +insmod /vendor/lib/modules/amba-clcd.ko + +insmod /vendor/lib/modules/fixed.ko +insmod /vendor/lib/modules/mmc_core.ko +insmod /vendor/lib/modules/mmc_block.ko +insmod /vendor/lib/modules/armmmci.ko + +insmod /vendor/lib/modules/ambakmi.ko +insmod /vendor/lib/modules/mousedev.ko +insmod /vendor/lib/modules/psmouse.ko + +setprop vendor.all.modules.ready 1 diff --git a/fvpbase/manifest.xml b/fvpbase/manifest.xml new file mode 100644 index 00000000..bd369aee --- /dev/null +++ b/fvpbase/manifest.xml @@ -0,0 +1,102 @@ +<manifest version="1.0" type="device" target-level="3"> + <hal format="hidl"> + <name>android.hardware.audio</name> + <transport>hwbinder</transport> + <version>4.0</version> + <interface> + <name>IDevicesFactory</name> + <instance>default</instance> + </interface> + </hal> + <hal format="hidl"> + <name>android.hardware.audio.effect</name> + <transport>hwbinder</transport> + <version>4.0</version> + <interface> + <name>IEffectsFactory</name> + <instance>default</instance> + </interface> + </hal> + <hal format="hidl"> + <name>android.hardware.configstore</name> + <transport>hwbinder</transport> + <version>1.1</version> + <interface> + <name>ISurfaceFlingerConfigs</name> + <instance>default</instance> + </interface> + </hal> + <hal format="hidl"> + <name>android.hardware.drm</name> + <transport>hwbinder</transport> + <version>1.0</version> + <interface> + <name>ICryptoFactory</name> + <instance>default</instance> + </interface> + <interface> + <name>IDrmFactory</name> + <instance>default</instance> + </interface> + <fqname>@1.2::ICryptoFactory/clearkey</fqname> + <fqname>@1.2::IDrmFactory/clearkey</fqname> + </hal> + <hal format="hidl"> + <name>android.hardware.graphics.allocator</name> + <transport>hwbinder</transport> + <version>2.0</version> + <interface> + <name>IAllocator</name> + <instance>default</instance> + </interface> + </hal> + <hal format="hidl"> + <name>android.hardware.graphics.composer</name> + <transport>hwbinder</transport> + <version>2.1</version> + <interface> + <name>IComposer</name> + <instance>default</instance> + </interface> + </hal> + <hal format="hidl"> + <name>android.hardware.graphics.mapper</name> + <transport arch="32+64">passthrough</transport> + <version>2.0</version> + <interface> + <name>IMapper</name> + <instance>default</instance> + </interface> + </hal> + <hal format="hidl"> + <name>android.hardware.health</name> + <transport>hwbinder</transport> + <version>2.0</version> + <interface> + <name>IHealth</name> + <instance>default</instance> + </interface> + </hal> + <hal format="hidl"> + <name>android.hardware.keymaster</name> + <transport>hwbinder</transport> + <version>4.0</version> + <interface> + <name>IKeymasterDevice</name> + <instance>default</instance> + </interface> + </hal> + <hal format="hidl"> + <name>android.hardware.media.omx</name> + <transport>hwbinder</transport> + <version>1.0</version> + <interface> + <name>IOmx</name> + <instance>default</instance> + </interface> + <interface> + <name>IOmxStore</name> + <instance>default</instance> + </interface> + </hal> +</manifest> diff --git a/fvpbase/sepolicy/file.te b/fvpbase/sepolicy/file.te new file mode 100644 index 00000000..b3bd582b --- /dev/null +++ b/fvpbase/sepolicy/file.te @@ -0,0 +1 @@ +type varrun_file, file_type, data_file_type, mlstrustedobject; diff --git a/fvpbase/sepolicy/file_contexts b/fvpbase/sepolicy/file_contexts new file mode 100644 index 00000000..29ff279c --- /dev/null +++ b/fvpbase/sepolicy/file_contexts @@ -0,0 +1,8 @@ +/data/vendor/var/run(/.*)? u:object_r:varrun_file:s0 +/dev/block/mmcblk0 u:object_r:userdata_block_device:s0 +/vendor/bin/hw/android\.hardware\.gatekeeper@1\.0-service.software u:object_r:hal_gatekeeper_default_exec:s0 +/vendor/bin/hw/android\.hardware\.health@2\.0-service.goldfish u:object_r:hal_health_default_exec:s0 +/vendor/bin/init\.insmod\.sh u:object_r:init_insmod_sh_exec:s0 +/vendor/lib(64)?/libEGL_swiftshader\.so u:object_r:same_process_hal_file:s0 +/vendor/lib(64)?/libGLESv1_CM_swiftshader\.so u:object_r:same_process_hal_file:s0 +/vendor/lib(64)?/libGLESv2_swiftshader\.so u:object_r:same_process_hal_file:s0 diff --git a/fvpbase/sepolicy/hal_graphics_allocator_default.te b/fvpbase/sepolicy/hal_graphics_allocator_default.te new file mode 100644 index 00000000..6676f578 --- /dev/null +++ b/fvpbase/sepolicy/hal_graphics_allocator_default.te @@ -0,0 +1,4 @@ +allow hal_graphics_allocator_default graphics_device:dir search; +allow hal_graphics_allocator_default graphics_device:chr_file { ioctl open read write map rw_file_perms }; +allow hal_graphics_allocator_default dumpstate:fd use; +allow hal_graphics_allocator_default dumpstate:fifo_file write; diff --git a/fvpbase/sepolicy/healthd.te b/fvpbase/sepolicy/healthd.te new file mode 100644 index 00000000..80db9b72 --- /dev/null +++ b/fvpbase/sepolicy/healthd.te @@ -0,0 +1,4 @@ +# Allow to read /sys/class/power_supply directory +allow healthd sysfs:dir r_dir_perms; + +allow healthd self:capability2 wake_alarm; diff --git a/fvpbase/sepolicy/init_insmod_sh.te b/fvpbase/sepolicy/init_insmod_sh.te new file mode 100644 index 00000000..52a0ad84 --- /dev/null +++ b/fvpbase/sepolicy/init_insmod_sh.te @@ -0,0 +1,14 @@ +type init_insmod_sh, domain; +type init_insmod_sh_exec, exec_type, vendor_file_type, file_type; + +init_daemon_domain(init_insmod_sh) + +allow init_insmod_sh vendor_shell_exec:file rx_file_perms; +allow init_insmod_sh vendor_toolbox_exec:file rx_file_perms; + +# Set the vendor.all.modules.ready property +set_prop(init_insmod_sh, vendor_device_prop) + +# Allow insmod +allow init_insmod_sh self:capability sys_module; +allow init_insmod_sh vendor_file:system module_load; diff --git a/fvpbase/sepolicy/property.te b/fvpbase/sepolicy/property.te new file mode 100644 index 00000000..f014ad52 --- /dev/null +++ b/fvpbase/sepolicy/property.te @@ -0,0 +1 @@ +type vendor_device_prop, property_type; diff --git a/fvpbase/sepolicy/property_contexts b/fvpbase/sepolicy/property_contexts new file mode 100644 index 00000000..c389bdd3 --- /dev/null +++ b/fvpbase/sepolicy/property_contexts @@ -0,0 +1 @@ +vendor.all.modules.ready u:object_r:vendor_device_prop:s0 diff --git a/fvpbase/sepolicy/surfaceflinger.te b/fvpbase/sepolicy/surfaceflinger.te new file mode 100644 index 00000000..95236305 --- /dev/null +++ b/fvpbase/sepolicy/surfaceflinger.te @@ -0,0 +1 @@ +allow surfaceflinger self:process execmem; diff --git a/sepolicy/common/bootanim.te b/sepolicy/common/bootanim.te index bc84ee73..4d011e10 100644 --- a/sepolicy/common/bootanim.te +++ b/sepolicy/common/bootanim.te @@ -4,6 +4,7 @@ allow bootanim ashmem_device:chr_file execute; dontaudit bootanim system_data_file:dir read; allow bootanim graphics_device:chr_file { read ioctl open }; +allow bootanim gpu_device:chr_file { read ioctl open }; typeattribute bootanim system_writes_vendor_properties_violators; set_prop(bootanim, qemu_prop) diff --git a/sepolicy/common/file_contexts b/sepolicy/common/file_contexts index 23734639..6bcc6732 100644 --- a/sepolicy/common/file_contexts +++ b/sepolicy/common/file_contexts @@ -15,6 +15,9 @@ /dev/goldfish_sync u:object_r:qemu_device:s0 /dev/goldfish_address_space u:object_r:qemu_device:s0 /dev/qemu_.* u:object_r:qemu_device:s0 +/dev/dri/card0 u:object_r:gpu_device:s0 +/dev/dri/controlD64 u:object_r:gpu_device:s0 +/dev/dri/renderD128 u:object_r:gpu_device:s0 /dev/ttyGF[0-9]* u:object_r:serial_device:s0 /dev/ttyS2 u:object_r:console_device:s0 /vendor/bin/init\.ranchu-core\.sh u:object_r:goldfish_setup_exec:s0 diff --git a/sepolicy/common/hal_graphics_allocator_default.te b/sepolicy/common/hal_graphics_allocator_default.te index 6676f578..527cabdb 100644 --- a/sepolicy/common/hal_graphics_allocator_default.te +++ b/sepolicy/common/hal_graphics_allocator_default.te @@ -1,4 +1,6 @@ allow hal_graphics_allocator_default graphics_device:dir search; allow hal_graphics_allocator_default graphics_device:chr_file { ioctl open read write map rw_file_perms }; +allow hal_graphics_allocator_default gpu_device:dir search; +allow hal_graphics_allocator_default gpu_device:chr_file { ioctl open read write map rw_file_perms }; allow hal_graphics_allocator_default dumpstate:fd use; allow hal_graphics_allocator_default dumpstate:fifo_file write; diff --git a/sepolicy/common/hal_graphics_composer_default.te b/sepolicy/common/hal_graphics_composer_default.te index e9205cda..3b0c862f 100644 --- a/sepolicy/common/hal_graphics_composer_default.te +++ b/sepolicy/common/hal_graphics_composer_default.te @@ -1,3 +1,4 @@ #============= hal_graphics_composer_default ============== allow hal_graphics_composer_default vndbinder_device:chr_file { ioctl open read write map }; - +allow hal_graphics_composer_default graphics_device:chr_file { ioctl open read write map }; +allow hal_graphics_composer_default gpu_device:chr_file { ioctl open read write map }; diff --git a/sepolicy/common/surfaceflinger.te b/sepolicy/common/surfaceflinger.te index 2bba8a78..575ec1bd 100644 --- a/sepolicy/common/surfaceflinger.te +++ b/sepolicy/common/surfaceflinger.te @@ -1,5 +1,6 @@ allow surfaceflinger self:process execmem; allow surfaceflinger ashmem_device:chr_file execute; +allow surfaceflinger gpu_device:chr_file { ioctl open read write map }; typeattribute surfaceflinger system_writes_vendor_properties_violators; set_prop(surfaceflinger, qemu_prop) diff --git a/ueventd.ranchu.rc b/ueventd.ranchu.rc index 38ad757f..db426342 100644 --- a/ueventd.ranchu.rc +++ b/ueventd.ranchu.rc @@ -4,3 +4,6 @@ /dev/ttyS* 0666 system system /dev/goldfish_sync 0666 system system /dev/goldfish_address_space 0666 system system +/dev/dri/card0 0660 system graphics +/dev/dri/controlD64 0660 system graphics +/dev/dri/renderD128 0666 system graphics |