Angler no longer supports vr.high_performance in Android O
Test: ran a VR app and verified VR mode is unsupported
Bug: 36570787
Change-Id: I0c546a3d42b71d852e6705cb2446fa5ba8854275
diff --git a/device.mk b/device.mk
index ecf37d0..c95c6a5 100644
--- a/device.mk
+++ b/device.mk
@@ -161,7 +161,6 @@
frameworks/native/data/etc/android.software.verified_boot.xml:system/etc/permissions/android.software.verified_boot.xml \
frameworks/native/data/etc/com.nxp.mifare.xml:system/etc/permissions/com.nxp.mifare.xml \
frameworks/native/data/etc/android.hardware.opengles.aep.xml:system/etc/permissions/android.hardware.opengles.aep.xml \
- frameworks/native/data/etc/android.hardware.vr.high_performance.xml:system/etc/permissions/android.hardware.vr.high_performance.xml \
frameworks/native/data/etc/android.hardware.vulkan.level-0.xml:system/etc/permissions/android.hardware.vulkan.level.xml \
frameworks/native/data/etc/android.hardware.vulkan.version-1_0_3.xml:system/etc/permissions/android.hardware.vulkan.version.xml
@@ -395,11 +394,6 @@
ro.hwui.text_large_cache_width=2048 \
ro.hwui.text_large_cache_height=1024
-# VR HAL
-PRODUCT_PACKAGES += \
- vr.angler \
- android.hardware.vr@1.0-impl
-
# Enable low power video mode for 4K encode
PRODUCT_PROPERTY_OVERRIDES += \
vidc.debug.perf.mode=2 \
diff --git a/power/power.c b/power/power.c
index 357ee2a..8442a4b 100644
--- a/power/power.c
+++ b/power/power.c
@@ -97,7 +97,6 @@
static int slack_node_rw_failed = 0;
static int display_hint_sent;
static int sustained_performance_mode = 0;
-static int vr_mode = 0;
int display_boost;
static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
@@ -264,10 +263,10 @@
int duration_hint = 0;
static struct timespec previous_boost_timespec = {0, 0};
- // If we are in sustained performance mode or VR mode, touch boost
+ // If we are in sustained performance mode, touch boost
// should be ignored.
pthread_mutex_lock(&lock);
- if (sustained_performance_mode || vr_mode) {
+ if (sustained_performance_mode) {
pthread_mutex_unlock(&lock);
return;
}
@@ -372,52 +371,19 @@
sizeof(resources)/sizeof(resources[0]),
resources);
sysfs_write(GPU_MAX_FREQ_PATH, "305000000");
- if (vr_mode == 0) {
- handle_hotplug = interaction_with_handle(handle_hotplug, duration,
- sizeof(resources_hotplug)/sizeof(resources_hotplug[0]),
- resources_hotplug);
- }
+ handle_hotplug = interaction_with_handle(handle_hotplug, duration,
+ sizeof(resources_hotplug)/sizeof(resources_hotplug[0]),
+ resources_hotplug);
sustained_performance_mode = 1;
} else if (sustained_performance_mode == 1){
release_request(handle);
sysfs_write(GPU_MAX_FREQ_PATH, "600000000");
- if (vr_mode == 0) {
- release_request(handle_hotplug);
- }
+ release_request(handle_hotplug);
sustained_performance_mode = 0;
}
pthread_mutex_unlock(&lock);
}
break;
- case POWER_HINT_VR_MODE:
- {
- static int handle_vr = 0;
- pthread_mutex_lock(&lock);
- if (data && vr_mode == 0) {
- int resources[] = {0x206};
- int duration = 0;
- handle_vr = interaction_with_handle(handle_vr, duration,
- sizeof(resources)/sizeof(resources[0]),
- resources);
- sysfs_write(GPU_MIN_FREQ_PATH, "305000000");
- sysfs_write(BUS_SPEED_PATH, "7904");
- if (sustained_performance_mode == 0) {
- handle_hotplug = interaction_with_handle(handle_hotplug, duration,
- sizeof(resources_hotplug)/sizeof(resources_hotplug[0]),
- resources_hotplug);
- }
- vr_mode = 1;
- } else if (vr_mode == 1){
- release_request(handle_vr);
- sysfs_write(GPU_MIN_FREQ_PATH, "180000000");
- sysfs_write(BUS_SPEED_PATH, "0");
- if (sustained_performance_mode == 0) {
- release_request(handle_hotplug);
- }
- vr_mode = 0;
- }
- pthread_mutex_unlock(&lock);
- }
}
}
diff --git a/vr/Android.mk b/vr/Android.mk
deleted file mode 100644
index b35f550..0000000
--- a/vr/Android.mk
+++ /dev/null
@@ -1,26 +0,0 @@
-# Copyright 2016 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)
-
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := vr.c
-LOCAL_MODULE_RELATIVE_PATH := hw
-LOCAL_SHARED_LIBRARIES := liblog libcutils
-LOCAL_CFLAGS += -Wno-unused-parameter
-LOCAL_MODULE := vr.angler
-LOCAL_MODULE_TAGS := optional
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/vr/vr.c b/vr/vr.c
deleted file mode 100644
index 8857f9a..0000000
--- a/vr/vr.c
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Copyright (C) 2016 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 "VrHALImpl"
-
-#include <cutils/log.h>
-
-#include <errno.h>
-#include <fcntl.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-
-#include <hardware/vr.h>
-#include <hardware/hardware.h>
-
-
-// Angler has two inflight numbers. By default, inflight=15 and inflight_low_latency=4.
-// Inflight is only used when there is a single GL context, when there is more than one
-// context, inflight_low_latency is used. Since we are only interested in affecting
-// performance when there is context preemption, we only have to modify the low latency
-// parameter.
-static const int DEFAULT_GPU_INFLIGHT = 4;
-static const int VR_MODE_GPU_INFLIGHT = 2;
-static const char* GPU_INFLIGHT_PATH = "/sys/class/kgsl/kgsl-3d0/dispatch/inflight_low_latency";
-
-/**
- * Write 'len' characters from 'input' character array into file at path 'outFile.'
- *
- * Return 0 on success, or a negative error code.
- */
-static int write_string(const char* input, size_t len, const char* outFile) {
- int fd = -1;
- ssize_t err = 0;
-
- // Check input strings.
- if (input == NULL || outFile == NULL) {
- ALOGE("%s: Invalid input to write", __FUNCTION__);
- return -1;
- }
-
- // Open file, check for errors.
- fd = open(outFile, O_WRONLY);
- if (fd < 0) {
- ALOGE("%s: Failed to open file %s, error %s (%d)", __FUNCTION__, outFile, strerror(errno),
- -errno);
- return -errno;
- }
-
- // Write file, check for errors.
- err = write(fd, input, len);
- if (err < 0) {
- ALOGE("%s: Failed to write file %s, error %s (%d)", __FUNCTION__, outFile, strerror(errno),
- -errno);
- close(fd);
- return -errno;
- }
-
- // Close and return success.
- close(fd);
- return 0;
-}
-
-/**
- * Write integer 'input' formatted as a character string into the file at path 'outFile.'
- *
- * Return 0 on success, or a negative error code.
- */
-static int write_int(int input, const char* outFile) {
- char buffer[128] = {0,};
- int bytes = snprintf(buffer, sizeof(buffer), "%d", input);
-
- if (bytes < 0 || (size_t) bytes >= sizeof(buffer)) {
- ALOGE("%s: Failed to format integer %d", __FUNCTION__, input);
- return -EINVAL;
- }
-
- return write_string(buffer, (size_t) bytes, outFile);
-}
-
-// Set global display/GPU/scheduler configuration to used for VR apps.
-static void set_vr_performance_configuration() {
- int err = 0;
-
- // Set in-flight buffers to 2.
- err = write_int(VR_MODE_GPU_INFLIGHT, GPU_INFLIGHT_PATH);
-
- if (err < 0) {
- ALOGW("%s: Error while setting configuration for VR mode.", __FUNCTION__);
- }
-}
-
-// Reset to default global display/GPU/scheduler configuration.
-static void unset_vr_performance_configuration() {
- int err = 0;
-
- // Set in-flight buffers back to default (15).
- err = write_int(DEFAULT_GPU_INFLIGHT, GPU_INFLIGHT_PATH);
-
- if (err < 0) {
- ALOGW("%s: Error while setting configuration for VR mode.", __FUNCTION__);
- }
-}
-
-static void vr_init(struct vr_module *module) {
- // NOOP
-}
-
-static void vr_set_vr_mode(struct vr_module *module, bool enabled) {
- if (enabled) {
- set_vr_performance_configuration();
- } else {
- unset_vr_performance_configuration();
- }
-}
-
-static struct hw_module_methods_t vr_module_methods = {
- .open = NULL, // There are no devices for this HAL interface.
-};
-
-
-vr_module_t HAL_MODULE_INFO_SYM = {
- .common = {
- .tag = HARDWARE_MODULE_TAG,
- .module_api_version = VR_MODULE_API_VERSION_1_0,
- .hal_api_version = HARDWARE_HAL_API_VERSION,
- .id = VR_HARDWARE_MODULE_ID,
- .name = "Angler VR HAL",
- .author = "The Android Open Source Project",
- .methods = &vr_module_methods,
- },
-
- .init = vr_init,
- .set_vr_mode = vr_set_vr_mode,
-};