msm8998: Update display HAL to AU_LINUX_ANDROID_LA.UM.6.4.9.07.00.00.279.156

d0e57317 libmemtrack: Fix fd leak in kgsl function
f4c795824 hwc2: Fixes to find the right display mode
7736da3d6 hwc2: Add dataspace to dump
10c55d8f7 hwc2: Featurize dataspace support
46448c761 hwc2: Fix color mode setting
3bd5933a7 gralloc1: Add additional tracing
85bd493cd sdm: Reduce log severity for modes without attributes
ee517cd4e hwc2: Additional dataspace checks
df807f7a9 hwc2: Fix Hwc2Test.SET_VSYNC_ENABLED_no_callback_no_power
c993df564 hwc2: Fix cursor tests
16489f7fc hwc2: Do not return error if socket is not available
2a41010ef display: Add support to set color mode by ID
b58fcd56f hwc: Do not snprintf in trace unless needed
151591a70 hwc2: Remove power manager dependency
cf2f3d66b Revert "liblight: Add brightness level extension support"
232c50094 libdrmutils: Fix kernel dependency
043ed03b6 gralloc1: Support GRALLOC1_CAPABILITY_RELEASE_IMPLY_DELETE

Change-Id: I6765c7899433a0cb865e7aae092cb0a06adca59a
This commit is contained in:
Naseer Ahmed 2017-05-17 13:18:31 -04:00 committed by Thierry Strudel
parent d6edb8b0dc
commit 86f0be319b
37 changed files with 199 additions and 142 deletions

View File

@ -8,7 +8,8 @@ include $(BUILD_COPY_HEADERS)
include $(CLEAR_VARS)
LOCAL_MODULE := libgpu_tonemapper
LOCAL_VENDOR_MODULE := true
LOCAL_MODULE_PATH_32 := $(TARGET_OUT_VENDOR)/lib
LOCAL_MODULE_PATH_64 := $(TARGET_OUT_VENDOR)/lib64
LOCAL_MODULE_TAGS := optional
LOCAL_C_INCLUDES := $(TARGET_OUT_HEADERS)/qcom/display/
LOCAL_C_INCLUDES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include

View File

@ -3,7 +3,8 @@ include $(LOCAL_PATH)/../common.mk
include $(CLEAR_VARS)
LOCAL_MODULE := hdmi_cec.$(TARGET_BOARD_PLATFORM)
LOCAL_VENDOR_MODULE := true
LOCAL_MODULE_PATH_32 := $(TARGET_OUT_VENDOR)/lib
LOCAL_MODULE_PATH_64 := $(TARGET_OUT_VENDOR)/lib64
LOCAL_MODULE_RELATIVE_PATH := hw
LOCAL_MODULE_TAGS := optional
LOCAL_C_INCLUDES := $(common_includes)

View File

@ -23,7 +23,8 @@ include $(BUILD_COPY_HEADERS)
ifneq ($(TARGET_USES_GRALLOC1), true)
LOCAL_MODULE := copybit.$(TARGET_BOARD_PLATFORM)
LOCAL_VENDOR_MODULE := true
LOCAL_MODULE_PATH_32 := $(TARGET_OUT_VENDOR)/lib
LOCAL_MODULE_PATH_64 := $(TARGET_OUT_VENDOR)/lib64
LOCAL_MODULE_RELATIVE_PATH := hw
LOCAL_MODULE_TAGS := optional
LOCAL_C_INCLUDES := $(common_includes) $(kernel_includes)

View File

@ -2,16 +2,19 @@ LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := libdrmutils
LOCAL_VENDOR_MODULE := true
LOCAL_MODULE_PATH_32 := $(TARGET_OUT_VENDOR)/lib
LOCAL_MODULE_PATH_64 := $(TARGET_OUT_VENDOR)/lib64
LOCAL_MODULE_TAGS := optional
LOCAL_C_INCLUDES := external/libdrm \
$(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include
LOCAL_C_INCLUDES := external/libdrm
LOCAL_SHARED_LIBRARIES := libdrm libdl
LOCAL_CFLAGS := -DLOG_TAG=\"DRMUTILS\" -Wall -std=c++11 -Werror -fno-operator-names
LOCAL_CLANG := true
ifeq ($(TARGET_COMPILE_WITH_MSM_KERNEL),true)
LOCAL_ADDITIONAL_DEPENDENCIES := $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr
LOCAL_ADDITIONAL_DEPENDENCIES := $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr
LOCAL_C_INCLUDES := $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include
endif
LOCAL_SRC_FILES := drm_master.cpp drm_res_mgr.cpp drm_lib_loader.cpp
LOCAL_COPY_HEADERS_TO := qcom/display
LOCAL_COPY_HEADERS := drm_master.h drm_res_mgr.h drm_lib_loader.h drm_logger.h drm_interface.h

View File

@ -18,7 +18,8 @@ include $(LOCAL_PATH)/../common.mk
include $(CLEAR_VARS)
LOCAL_MODULE := gralloc.$(TARGET_BOARD_PLATFORM)
LOCAL_VENDOR_MODULE := true
LOCAL_MODULE_PATH_32 := $(TARGET_OUT_VENDOR)/lib
LOCAL_MODULE_PATH_64 := $(TARGET_OUT_VENDOR)/lib64
LOCAL_MODULE_RELATIVE_PATH := hw
LOCAL_MODULE_TAGS := optional
LOCAL_C_INCLUDES := $(common_includes) $(kernel_includes)
@ -38,7 +39,9 @@ include $(BUILD_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libmemalloc
LOCAL_VENDOR_MODULE := true
LOCAL_MODULE_PATH_32 := $(TARGET_OUT_VENDOR)/lib
LOCAL_MODULE_PATH_64 := $(TARGET_OUT_VENDOR)/lib64
LOCAL_MODULE_TAGS := optional
LOCAL_C_INCLUDES := $(common_includes) $(kernel_includes)
LOCAL_SHARED_LIBRARIES := $(common_libs) libqdutils libdl
LOCAL_CFLAGS := $(common_flags) -DLOG_TAG=\"qdmemalloc\" -Wno-sign-conversion

View File

@ -4,7 +4,8 @@ include $(LOCAL_PATH)/../common.mk
include $(CLEAR_VARS)
LOCAL_MODULE := gralloc.$(TARGET_BOARD_PLATFORM)
LOCAL_VENDOR_MODULE := true
LOCAL_MODULE_PATH_32 := $(TARGET_OUT_VENDOR)/lib
LOCAL_MODULE_PATH_64 := $(TARGET_OUT_VENDOR)/lib64
LOCAL_MODULE_RELATIVE_PATH := hw
LOCAL_MODULE_TAGS := optional
LOCAL_C_INCLUDES := $(common_includes) \

View File

@ -207,6 +207,7 @@ gralloc1_error_t BufferManager::FreeBuffer(std::shared_ptr<Buffer> buf) {
private_handle_t * handle = const_cast<private_handle_t *>(hnd);
handle->fd = -1;
handle->fd_metadata = -1;
delete handle;
return GRALLOC1_ERROR_NONE;
}

View File

@ -27,7 +27,10 @@
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#define ATRACE_TAG (ATRACE_TAG_GRAPHICS | ATRACE_TAG_HAL)
#include <cutils/log.h>
#include <utils/Trace.h>
#include <cutils/trace.h>
#include <sync/sync.h>
#include <algorithm>
#include <sstream>
@ -103,11 +106,12 @@ int GrallocImpl::CloseDevice(hw_device_t *device __unused) {
void GrallocImpl::GetCapabilities(struct gralloc1_device *device, uint32_t *out_count,
int32_t /*gralloc1_capability_t*/ *out_capabilities) {
if (device != nullptr) {
if (out_capabilities != nullptr && *out_count >= 2) {
if (out_capabilities != nullptr && *out_count >= 3) {
out_capabilities[0] = GRALLOC1_CAPABILITY_TEST_ALLOCATE;
out_capabilities[1] = GRALLOC1_CAPABILITY_LAYERED_BUFFERS;
out_capabilities[2] = GRALLOC1_CAPABILITY_RELEASE_IMPLY_DELETE;
}
*out_count = 2;
*out_count = 3;
}
return;
}
@ -420,6 +424,7 @@ gralloc1_error_t GrallocImpl::LockBuffer(gralloc1_device_t *device, buffer_handl
gralloc1_consumer_usage_t cons_usage,
const gralloc1_rect_t *region, void **out_data,
int32_t acquire_fence) {
ATRACE_CALL();
gralloc1_error_t status = CheckDeviceAndHandle(device, buffer);
if (status != GRALLOC1_ERROR_NONE) {
CloseFdIfValid(acquire_fence);
@ -427,7 +432,9 @@ gralloc1_error_t GrallocImpl::LockBuffer(gralloc1_device_t *device, buffer_handl
}
if (acquire_fence > 0) {
ATRACE_BEGIN("fence wait");
int error = sync_wait(acquire_fence, 1000);
ATRACE_END();
CloseFdIfValid(acquire_fence);
if (error < 0) {
ALOGE("%s: sync_wait timedout! error = %s", __FUNCTION__, strerror(errno));

View File

@ -36,6 +36,8 @@
#include <cutils/log.h>
#include <errno.h>
#include <utils/Trace.h>
#include <cutils/trace.h>
#include <string>
#include "gralloc_priv.h"
#include "gr_utils.h"
@ -77,21 +79,29 @@ int IonAlloc::AllocBuffer(AllocData *data) {
ion_alloc_data.heap_id_mask = data->heap_id;
ion_alloc_data.flags = data->flags;
ion_alloc_data.flags |= data->uncached ? 0 : ION_FLAG_CACHED;
std::string tag_name{};
if (ATRACE_ENABLED()) {
tag_name = "ION_IOC_ALLOC size: " + std::to_string(data->size);
}
ATRACE_BEGIN(tag_name.c_str());
if (ioctl(ion_dev_fd_, INT(ION_IOC_ALLOC), &ion_alloc_data)) {
err = -errno;
ALOGE("ION_IOC_ALLOC failed with error - %s", strerror(errno));
return err;
}
ATRACE_END();
fd_data.handle = ion_alloc_data.handle;
handle_data.handle = ion_alloc_data.handle;
ATRACE_BEGIN("ION_IOC_MAP");
if (ioctl(ion_dev_fd_, INT(ION_IOC_MAP), &fd_data)) {
err = -errno;
ALOGE("%s: ION_IOC_MAP failed with error - %s", __FUNCTION__, strerror(errno));
ioctl(ion_dev_fd_, INT(ION_IOC_FREE), &handle_data);
return err;
}
ATRACE_END();
data->fd = fd_data.fd;
data->ion_handle = handle_data.handle;

View File

@ -115,6 +115,7 @@ uint32_t GetBppForUncompressedRGB(int format) {
case HAL_PIXEL_FORMAT_XRGB_2101010:
case HAL_PIXEL_FORMAT_BGRA_1010102:
case HAL_PIXEL_FORMAT_ABGR_2101010:
case HAL_PIXEL_FORMAT_BGRX_1010102:
case HAL_PIXEL_FORMAT_XBGR_2101010:
bpp = 4;
break;

View File

@ -17,16 +17,14 @@ LOCAL_PATH:= $(call my-dir)
# hw/<COPYPIX_HARDWARE_MODULE_ID>.<ro.board.platform>.so
include $(CLEAR_VARS)
LOCAL_C_INCLUDES += $(TARGET_OUT_HEADERS)/common/inc
LOCAL_C_INCLUDES += $(TARGET_OUT_HEADERS)/qdcm/inc
LOCAL_SRC_FILES := lights.c lights_prv.cpp
LOCAL_SRC_FILES := lights.c
LOCAL_MODULE_RELATIVE_PATH := hw
LOCAL_SHARED_LIBRARIES := liblog libcutils libsdm-disp-apis
LOCAL_SHARED_LIBRARIES := liblog
LOCAL_CFLAGS := -DLOG_TAG=\"qdlights\"
LOCAL_CLANG := true
LOCAL_MODULE := lights.$(TARGET_BOARD_PLATFORM)
LOCAL_MODULE_TAGS := optional
LOCAL_VENDOR_MODULE := true
LOCAL_MODULE_PATH_32 := $(TARGET_OUT_VENDOR)/lib
LOCAL_MODULE_PATH_64 := $(TARGET_OUT_VENDOR)/lib64
include $(BUILD_SHARED_LIBRARY)

View File

@ -20,7 +20,7 @@
// #define LOG_NDEBUG 0
#include <cutils/log.h>
#include <cutils/properties.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
@ -33,7 +33,6 @@
#include <sys/types.h>
#include <hardware/lights.h>
#include "lights_prv.h"
#ifndef DEFAULT_LOW_PERSISTENCE_MODE_BRIGHTNESS
#define DEFAULT_LOW_PERSISTENCE_MODE_BRIGHTNESS 0x80
@ -47,7 +46,6 @@ static struct light_state_t g_notification;
static struct light_state_t g_battery;
static int g_last_backlight_mode = BRIGHTNESS_MODE_USER;
static int g_attention = 0;
static int g_brightness_max = 0;
char const*const RED_LED_FILE
= "/sys/class/leds/red/brightness";
@ -165,28 +163,6 @@ set_light_backlight(struct light_device_t* dev,
return err;
}
static int
set_light_backlight_ext(struct light_device_t* dev,
struct light_state_t const* state)
{
int err = 0;
if(!dev) {
return -1;
}
int brightness = state->color & 0x00ffffff;
pthread_mutex_lock(&g_lock);
if (brightness >= 0 && brightness <= g_brightness_max) {
set_brightness_ext_level(brightness);
}
pthread_mutex_unlock(&g_lock);
return err;
}
static int
set_speaker_light_locked(struct light_device_t* dev,
struct light_state_t const* state)
@ -242,15 +218,15 @@ set_speaker_light_locked(struct light_device_t* dev,
if (red) {
if (write_int(RED_BLINK_FILE, blink))
write_int(RED_LED_FILE, 0);
}
}
if (green) {
if (write_int(GREEN_BLINK_FILE, blink))
write_int(GREEN_LED_FILE, 0);
}
}
if (blue) {
if (write_int(BLUE_BLINK_FILE, blink))
write_int(BLUE_LED_FILE, 0);
}
}
} else {
write_int(RED_LED_FILE, red);
write_int(GREEN_LED_FILE, green);
@ -345,19 +321,9 @@ static int open_lights(const struct hw_module_t* module, char const* name,
int (*set_light)(struct light_device_t* dev,
struct light_state_t const* state);
if (0 == strcmp(LIGHT_ID_BACKLIGHT, name)) {
char property[PROPERTY_VALUE_MAX];
property_get("persist.extend.brightness", property, "0");
if(!(strncmp(property, "1", PROPERTY_VALUE_MAX)) ||
!(strncmp(property, "true", PROPERTY_VALUE_MAX))) {
property_get("persist.display.max_brightness", property, "255");
g_brightness_max = atoi(property);
set_brightness_ext_init();
set_light = set_light_backlight_ext;
} else
set_light = set_light_backlight;
} else if (0 == strcmp(LIGHT_ID_BATTERY, name))
if (0 == strcmp(LIGHT_ID_BACKLIGHT, name))
set_light = set_light_backlight;
else if (0 == strcmp(LIGHT_ID_BATTERY, name))
set_light = set_light_battery;
else if (0 == strcmp(LIGHT_ID_NOTIFICATIONS, name))
set_light = set_light_notifications;

View File

@ -19,7 +19,8 @@ LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE_RELATIVE_PATH := hw
LOCAL_VENDOR_MODULE := true
LOCAL_MODULE_PATH_32 := $(TARGET_OUT_VENDOR)/lib
LOCAL_MODULE_PATH_64 := $(TARGET_OUT_VENDOR)/lib64
LOCAL_C_INCLUDES += hardware/libhardware/include
LOCAL_CFLAGS := -Wconversion -Wall -Werror -Wno-sign-conversion
LOCAL_CLANG := true

View File

@ -93,31 +93,41 @@ int kgsl_memtrack_get_memory(pid_t pid, enum memtrack_type type,
continue;
}
if (size == 0)
if (size == 0) {
fclose(fp);
return -EINVAL;
}
if (unaccounted_size + size < size)
if (unaccounted_size + size < size) {
fclose(fp);
return -ERANGE;
}
if (type == MEMTRACK_TYPE_GL && strcmp(line_type, "gpumem") == 0) {
if (flags[6] == 'Y') {
if (accounted_size + mapsize < accounted_size)
if (accounted_size + mapsize < accounted_size) {
fclose(fp);
return -ERANGE;
}
accounted_size += mapsize;
if (mapsize > size)
if (mapsize > size) {
fclose(fp);
return -EINVAL;
}
unaccounted_size += size - mapsize;
} else
} else {
unaccounted_size += size;
}
} else if (type == MEMTRACK_TYPE_GRAPHICS && strcmp(line_type, "ion") == 0) {
if (strcmp(line_usage, "egl_surface") == 0)
if (strcmp(line_usage, "egl_surface") == 0) {
unaccounted_size += size;
else if (egl_surface_count == 0)
}
else if (egl_surface_count == 0) {
unaccounted_size += size / (egl_image_count ? egl_image_count : 1);
}
}
}

View File

@ -3,7 +3,8 @@ include $(LOCAL_PATH)/../common.mk
include $(CLEAR_VARS)
LOCAL_MODULE := libqdutils
LOCAL_VENDOR_MODULE := true
LOCAL_MODULE_PATH_32 := $(TARGET_OUT_VENDOR)/lib
LOCAL_MODULE_PATH_64 := $(TARGET_OUT_VENDOR)/lib64
LOCAL_MODULE_TAGS := optional
LOCAL_SHARED_LIBRARIES := $(common_libs) libbinder libqservice
LOCAL_C_INCLUDES := $(common_includes) $(kernel_includes)
@ -31,5 +32,7 @@ LOCAL_CFLAGS += -DLOG_TAG=\"DisplayMetaData\"
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE := libqdMetaData
LOCAL_VENDOR_MODULE := true
LOCAL_MODULE_PATH_32 := $(TARGET_OUT_VENDOR)/lib
LOCAL_MODULE_PATH_64 := $(TARGET_OUT_VENDOR)/lib64
include $(BUILD_SHARED_LIBRARY)

View File

@ -3,7 +3,8 @@ include $(LOCAL_PATH)/../common.mk
include $(CLEAR_VARS)
LOCAL_MODULE := libqservice
LOCAL_VENDOR_MODULE := true
LOCAL_MODULE_PATH_32 := $(TARGET_OUT_VENDOR)/lib
LOCAL_MODULE_PATH_64 := $(TARGET_OUT_VENDOR)/lib64
LOCAL_MODULE_TAGS := optional
LOCAL_C_INCLUDES := $(common_includes) $(kernel_includes)
LOCAL_SHARED_LIBRARIES := $(common_libs) libbinder

View File

@ -75,6 +75,7 @@ public:
SET_LAYER_MIXER_RESOLUTION = 33, // Enables client to set layer mixer resolution.
SET_COLOR_MODE = 34, // Overrides the QDCM mode on the display
GET_HDR_CAPABILITIES = 35, // Get HDR capabilities for legacy HWC interface
SET_COLOR_MODE_BY_ID = 36, // Overrides the QDCM mode using the given mode ID
COMMAND_LIST_END = 400,
};

View File

@ -539,6 +539,13 @@ class DisplayInterface {
*/
virtual DisplayError SetColorMode(const std::string &color_mode) = 0;
/*! @brief Method to set the color mode by ID. This method is used for debugging only.
@param[in] mode_name Mode ID which needs to be set
@return \link DisplayError \endlink
*/
virtual DisplayError SetColorModeById(int32_t color_mode_id) = 0;
/*! @brief Method to set the color transform
@param[in] length Mode name which needs to be set

View File

@ -89,7 +89,7 @@ static const std::string kHdr = "hdr";
static const std::string kSdr = "sdr";
static const std::string kNative = "native";
static const std::string kDcip3 = "dci_p3";
static const std::string kDcip3 = "dcip3";
static const std::string kSrgb = "srgb";
static const std::string kDisplayP3 = "display_p3";

View File

@ -3,7 +3,8 @@ include $(CLEAR_VARS)
include $(LOCAL_PATH)/../../../common.mk
LOCAL_MODULE := libsdmcore
LOCAL_VENDOR_MODULE := true
LOCAL_MODULE_PATH_32 := $(TARGET_OUT_VENDOR)/lib
LOCAL_MODULE_PATH_64 := $(TARGET_OUT_VENDOR)/lib64
LOCAL_MODULE_TAGS := optional
LOCAL_C_INCLUDES := $(common_includes) $(kernel_includes)
LOCAL_HEADER_LIBRARIES := display_headers

View File

@ -731,7 +731,7 @@ DisplayError DisplayBase::GetColorModeAttr(const std::string &color_mode, AttrVa
auto it = color_mode_attr_map_.find(color_mode);
if (it == color_mode_attr_map_.end()) {
DLOGE("Failed: Mode %s without attribute", color_mode.c_str());
DLOGI("Mode %s has no attribute", color_mode.c_str());
return kErrorNotSupported;
}
*attr = it->second;
@ -803,6 +803,10 @@ DisplayError DisplayBase::SetColorMode(const std::string &color_mode) {
return error;
}
DisplayError DisplayBase::SetColorModeById(int32_t color_mode_id) {
return color_mgr_->ColorMgrSetMode(color_mode_id);
}
DisplayError DisplayBase::SetColorModeInternal(const std::string &color_mode) {
DLOGV_IF(kTagQDCM, "Color Mode = %s", color_mode.c_str());

View File

@ -95,6 +95,7 @@ class DisplayBase : public DisplayInterface, DumpImpl {
virtual DisplayError GetColorModes(uint32_t *mode_count, std::vector<std::string> *color_modes);
virtual DisplayError GetColorModeAttr(const std::string &color_mode, AttrVal *attr);
virtual DisplayError SetColorMode(const std::string &color_mode);
virtual DisplayError SetColorModeById(int32_t color_mode_id);
virtual DisplayError SetColorTransform(const uint32_t length, const double *color_transform);
virtual DisplayError GetDefaultColorMode(std::string *color_mode);
virtual DisplayError ApplyDefaultDisplayMode(void);

View File

@ -4,7 +4,8 @@ include $(LOCAL_PATH)/../../../common.mk
ifeq ($(use_hwc2),false)
LOCAL_MODULE := hwcomposer.$(TARGET_BOARD_PLATFORM)
LOCAL_VENDOR_MODULE := true
LOCAL_MODULE_PATH_32 := $(TARGET_OUT_VENDOR)/lib
LOCAL_MODULE_PATH_64 := $(TARGET_OUT_VENDOR)/lib64
LOCAL_MODULE_RELATIVE_PATH := hw
LOCAL_MODULE_TAGS := optional
LOCAL_C_INCLUDES := $(common_includes)

View File

@ -150,9 +150,11 @@ void HWCDebugHandler::Verbose(DebugTag tag, const char *format, ...) {
void HWCDebugHandler::BeginTrace(const char *class_name, const char *function_name,
const char *custom_string) {
char name[PATH_MAX] = {0};
snprintf(name, sizeof(name), "%s::%s::%s", class_name, function_name, custom_string);
atrace_begin(ATRACE_TAG, name);
if (atrace_is_tag_enabled(ATRACE_TAG)) {
char name[PATH_MAX] = {0};
snprintf(name, sizeof(name), "%s::%s::%s", class_name, function_name, custom_string);
atrace_begin(ATRACE_TAG, name);
}
}
void HWCDebugHandler::EndTrace() {

View File

@ -5,7 +5,8 @@ include $(LOCAL_PATH)/../../../common.mk
ifeq ($(use_hwc2),true)
LOCAL_MODULE := hwcomposer.$(TARGET_BOARD_PLATFORM)
LOCAL_VENDOR_MODULE := true
LOCAL_MODULE_PATH_32 := $(TARGET_OUT_VENDOR)/lib
LOCAL_MODULE_PATH_64 := $(TARGET_OUT_VENDOR)/lib64
LOCAL_MODULE_RELATIVE_PATH := hw
LOCAL_MODULE_TAGS := optional
LOCAL_C_INCLUDES := $(common_includes)
@ -19,7 +20,7 @@ LOCAL_CLANG := true
LOCAL_SHARED_LIBRARIES := libsdmcore libqservice libbinder libhardware libhardware_legacy \
libutils libcutils libsync libqdutils libqdMetaData libdl \
libpowermanager libsdmutils libc++ liblog libdrmutils
libsdmutils libc++ liblog libdrmutils
ifneq ($(TARGET_USES_GRALLOC1), true)
LOCAL_SHARED_LIBRARIES += libmemalloc
@ -44,5 +45,9 @@ else
LOCAL_SRC_FILES += hwc_buffer_allocator.cpp
endif
ifeq ($(TARGET_HAS_WIDE_COLOR_DISPLAY), true)
LOCAL_CFLAGS += -DFEATURE_WIDE_COLOR
endif
include $(BUILD_SHARED_LIBRARY)
endif

View File

@ -106,10 +106,6 @@ DisplayError HWCBufferAllocator::FreeBuffer(BufferInfo *buffer_info) {
alloc_buffer_info->fd = -1;
alloc_buffer_info->stride = 0;
alloc_buffer_info->size = 0;
// Works around b/36355756
if (hnd != nullptr) {
delete hnd;
}
buffer_info->private_data = NULL;
return err;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, The Linux Foundation. All rights reserved.
* Copyright (c) 2016-2017, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@ -46,6 +46,8 @@ class HWCCallbacks {
HWC2::Error Register(HWC2::Callback, hwc2_callback_data_t callback_data,
hwc2_function_pointer_t pointer);
bool VsyncCallbackRegistered() { return (vsync_ != nullptr && vsync_data_ != nullptr); }
private:
hwc2_callback_data_t hotplug_data_ = nullptr;
hwc2_callback_data_t refresh_data_ = nullptr;

View File

@ -28,7 +28,6 @@
*/
#include <dlfcn.h>
#include <powermanager/IPowerManager.h>
#include <cutils/sockets.h>
#include <cutils/native_handle.h>
#include <utils/String16.h>
@ -386,17 +385,6 @@ HWCQDCMModeManager *HWCQDCMModeManager::CreateQDCMModeMgr() {
// retrieve system GPU idle timeout value for later to recover.
mode_mgr->entry_timeout_ = UINT32(HWCDebugHandler::GetIdleTimeoutMs());
// acquire the binder handle to Android system PowerManager for later use.
android::sp<android::IBinder> binder =
android::defaultServiceManager()->checkService(android::String16("power"));
if (binder == NULL) {
DLOGW("Application can't connect to power manager service");
delete mode_mgr;
mode_mgr = NULL;
} else {
mode_mgr->power_mgr_ = android::interface_cast<android::IPowerManager>(binder);
}
}
return mode_mgr;
@ -407,30 +395,6 @@ HWCQDCMModeManager::~HWCQDCMModeManager() {
::close(socket_fd_);
}
int HWCQDCMModeManager::AcquireAndroidWakeLock(bool enable) {
int ret = 0;
if (enable) {
if (wakelock_token_ == NULL) {
android::sp<android::IBinder> binder = new android::BBinder();
android::status_t status = power_mgr_->acquireWakeLock(
(kFullWakeLock | kAcquireCauseWakeup | kONAfterRelease), binder,
android::String16(kTagName), android::String16(kPackageName));
if (status == android::NO_ERROR) {
wakelock_token_ = binder;
}
}
} else {
if (wakelock_token_ != NULL && power_mgr_ != NULL) {
power_mgr_->releaseWakeLock(wakelock_token_, 0);
wakelock_token_.clear();
wakelock_token_ = NULL;
}
}
return ret;
}
int HWCQDCMModeManager::EnableActiveFeatures(bool enable,
const HWCQDCMModeManager::ActiveFeatureCMD &cmds,
bool *was_running) {
@ -441,8 +405,8 @@ int HWCQDCMModeManager::EnableActiveFeatures(bool enable,
};
if (socket_fd_ < 0) {
DLOGW("No socket connection available!");
return -EFAULT;
DLOGW("No socket connection available - assuming dpps is not enabled");
return 0;
}
if (!enable) { // if client requesting to disable it.
@ -486,7 +450,6 @@ int HWCQDCMModeManager::EnableQDCMMode(bool enable, HWCDisplay *hwc_display) {
ret = EnableActiveFeatures((enable ? false : true), kActiveFeatureCMD[kCABLFeature],
&cabl_was_running_);
ret = AcquireAndroidWakeLock(enable);
// if enter QDCM mode, disable GPU fallback idle timeout.
if (hwc_display) {

View File

@ -32,7 +32,6 @@
#include <stdlib.h>
#include <binder/Parcel.h>
#include <powermanager/IPowerManager.h>
#include <binder/BinderService.h>
#include <core/sdm_types.h>
#include <utils/locker.h>
@ -94,7 +93,6 @@ class HWCQDCMModeManager {
bool cabl_was_running_ = false;
int socket_fd_ = -1;
android::sp<android::IBinder> wakelock_token_ = NULL;
android::sp<android::IPowerManager> power_mgr_ = NULL;
uint32_t entry_timeout_ = 0;
static const char *const kSocketName;
static const char *const kTagName;

View File

@ -111,6 +111,10 @@ HWC2::Error HWCColorMode::GetColorModes(uint32_t *out_num_modes,
HWC2::Error HWCColorMode::SetColorMode(android_color_mode_t mode) {
// first mode in 2D matrix is the mode (identity)
if (color_mode_transform_map_.find(mode) == color_mode_transform_map_.end()) {
DLOGE("Could not find mode: %d", mode);
return HWC2::Error::BadParameter;
}
auto status = HandleColorModeTransform(mode, current_color_transform_, color_matrix_);
if (status != HWC2::Error::None) {
DLOGE("failed for mode = %d", mode);
@ -119,6 +123,15 @@ HWC2::Error HWCColorMode::SetColorMode(android_color_mode_t mode) {
return status;
}
HWC2::Error HWCColorMode::SetColorModeById(int32_t color_mode_id) {
DLOGI("Applying mode: %d", color_mode_id);
DisplayError error = display_intf_->SetColorModeById(color_mode_id);
if (error != kErrorNone) {
return HWC2::Error::BadParameter;
}
return HWC2::Error::None;
}
HWC2::Error HWCColorMode::SetColorTransform(const float *matrix, android_color_transform_t hint) {
if (!matrix) {
return HWC2::Error::BadParameter;
@ -202,8 +215,8 @@ void HWCColorMode::PopulateColorModes() {
DLOGV_IF(kTagQDCM, "Color Mode[%d] = %s", i, mode_string.c_str());
AttrVal attr;
error = display_intf_->GetColorModeAttr(mode_string, &attr);
std::string color_gamut, dynamic_range, pic_quality;
if (!attr.empty()) {
std::string color_gamut, dynamic_range, pic_quality;
for (auto &it : attr) {
if (it.first.find(kColorGamutAttribute) != std::string::npos) {
color_gamut = it.second;
@ -224,12 +237,15 @@ void HWCColorMode::PopulateColorModes() {
PopulateTransform(HAL_COLOR_MODE_SRGB, mode_string, color_transform);
} else if ((color_gamut == kDcip3) &&
(pic_quality.empty() || pic_quality == kStandard)) {
PopulateTransform(HAL_COLOR_MODE_DCI_P3, mode_string, color_transform);
PopulateTransform(HAL_COLOR_MODE_DISPLAY_P3, mode_string, color_transform);
} else if ((color_gamut == kDisplayP3) &&
(pic_quality.empty() || pic_quality == kStandard)) {
PopulateTransform(HAL_COLOR_MODE_DISPLAY_P3, mode_string, color_transform);
}
} else {
}
// Look at the mode name, if no color gamut is found
if (color_gamut.empty()) {
if (mode_string.find("hal_native") != std::string::npos) {
PopulateTransform(HAL_COLOR_MODE_NATIVE, mode_string, mode_string);
} else if (mode_string.find("hal_srgb") != std::string::npos) {
@ -433,10 +449,12 @@ void HWCDisplay::BuildLayerStack() {
layer->flags.solid_fill = true;
}
#ifdef FEATURE_WIDE_COLOR
if (!hwc_layer->SupportedDataspace()) {
layer->flags.skip = true;
DLOGW_IF(kTagStrategy, "Unsupported dataspace: 0x%x", hwc_layer->GetLayerDataspace());
}
#endif
working_primaries = WidestPrimaries(working_primaries,
layer->input_buffer.color_metadata.colorPrimaries);
@ -521,6 +539,7 @@ void HWCDisplay::BuildLayerStack() {
}
#ifdef FEATURE_WIDE_COLOR
for (auto hwc_layer : layer_set_) {
auto layer = hwc_layer->GetSDMLayer();
if (layer->input_buffer.color_metadata.colorPrimaries != working_primaries &&
@ -531,6 +550,7 @@ void HWCDisplay::BuildLayerStack() {
layer_stack_.flags.skip_present = true;
}
}
#endif
// TODO(user): Set correctly when SDM supports geometry_changes as bitmask
layer_stack_.flags.geometry_changed = UINT32(geometry_changes_ > 0);
@ -584,7 +604,7 @@ HWC2::Error HWCDisplay::SetVsyncEnabled(HWC2::Vsync enabled) {
DLOGV("Display ID: %d enabled: %s", id_, to_string(enabled).c_str());
DisplayError error = kErrorNone;
if (shutdown_pending_) {
if (shutdown_pending_ || !callbacks_->VsyncCallbackRegistered()) {
return HWC2::Error::None;
}
@ -1474,8 +1494,20 @@ HWC2::Error HWCDisplay::SetCursorPosition(hwc2_layer_t layer, int x, int y) {
return HWC2::Error::None;
}
// TODO(user): Validate layer
// TODO(user): Check if we're in a validate/present cycle
if (GetHWCLayer(layer) == nullptr) {
return HWC2::Error::BadLayer;
}
DisplayState state;
if (display_intf_->GetDisplayState(&state) == kErrorNone) {
if (state != kStateOn) {
return HWC2::Error::None;
}
}
if (!validated_) {
return HWC2::Error::NotValidated;
}
auto error = display_intf_->SetCursorPosition(x, y);
if (error != kErrorNone) {
@ -1726,14 +1758,16 @@ std::string HWCDisplay::Dump() {
for (auto layer : layer_set_) {
auto sdm_layer = layer->GetSDMLayer();
auto transform = sdm_layer->transform;
os << "layer: " << layer->GetId();
os << "layer: " << std::setw(4) << layer->GetId();
os << " z: " << layer->GetZ();
os << " compositon: " <<
to_string(layer->GetClientRequestedCompositionType()).c_str();
os << "/" <<
to_string(layer->GetDeviceSelectedCompositionType()).c_str();
os << " alpha: " << std::to_string(sdm_layer->plane_alpha).c_str();
os << " format: " << GetFormatString(sdm_layer->input_buffer.format);
os << " format: " << std::setw(22) << GetFormatString(sdm_layer->input_buffer.format);
os << " dataspace:" << std::hex << "0x" << std::setw(8) << std::setfill('0')
<< layer->GetLayerDataspace() << std::dec << std::setfill(' ');
os << " transform: " << transform.rotation << "/" << transform.flip_horizontal <<
"/"<< transform.flip_vertical;
os << " buffer_id: " << std::hex << "0x" << sdm_layer->input_buffer.buffer_id << std::dec

View File

@ -59,6 +59,7 @@ class HWCColorMode {
uint32_t GetColorModeCount();
HWC2::Error GetColorModes(uint32_t *out_num_modes, android_color_mode_t *out_modes);
HWC2::Error SetColorMode(android_color_mode_t mode);
HWC2::Error SetColorModeById(int32_t color_mode_id);
HWC2::Error SetColorTransform(const float *matrix, android_color_transform_t hint);
private:
@ -155,6 +156,9 @@ class HWCDisplay : public DisplayEventHandler {
virtual HWC2::Error SetColorMode(android_color_mode_t mode) {
return HWC2::Error::Unsupported;
}
virtual HWC2::Error SetColorModeById(int32_t color_mode_id) {
return HWC2::Error::Unsupported;
}
virtual HWC2::Error SetColorTransform(const float *matrix, android_color_transform_t hint) {
return HWC2::Error::Unsupported;
}

View File

@ -255,6 +255,18 @@ HWC2::Error HWCDisplayPrimary::SetColorMode(android_color_mode_t mode) {
return status;
}
HWC2::Error HWCDisplayPrimary::SetColorModeById(int32_t color_mode_id) {
auto status = color_mode_->SetColorModeById(color_mode_id);
if (status != HWC2::Error::None) {
DLOGE("failed for mode = %d", color_mode_id);
return status;
}
callbacks_->Refresh(HWC_DISPLAY_PRIMARY);
return status;
}
HWC2::Error HWCDisplayPrimary::SetColorTransform(const float *matrix,
android_color_transform_t hint) {
if (!matrix) {

View File

@ -57,6 +57,7 @@ class HWCDisplayPrimary : public HWCDisplay {
virtual HWC2::Error Present(int32_t *out_retire_fence);
virtual HWC2::Error GetColorModes(uint32_t *out_num_modes, android_color_mode_t *out_modes);
virtual HWC2::Error SetColorMode(android_color_mode_t mode);
virtual HWC2::Error SetColorModeById(int32_t color_mode_id);
virtual HWC2::Error SetColorTransform(const float *matrix, android_color_transform_t hint);
virtual int Perform(uint32_t operation, ...);
virtual void SetSecureDisplay(bool secure_display_active);

View File

@ -395,12 +395,6 @@ LayerBufferFormat HWCLayer::GetSDMFormat(const int32_t &source, const int flags)
case HAL_PIXEL_FORMAT_YCbCr_420_TP10_UBWC:
format = kFormatYCbCr420TP10Ubwc;
break;
case HAL_PIXEL_FORMAT_RGBA_1010102:
format = kFormatRGBA1010102Ubwc;
break;
case HAL_PIXEL_FORMAT_RGBX_1010102:
format = kFormatRGBX1010102Ubwc;
break;
default:
DLOGE("Unsupported format type for UBWC %d", source);
return kFormatInvalid;
@ -614,6 +608,12 @@ bool HWCLayer::SupportedDataspace() {
case HAL_DATASPACE_TRANSFER_HLG:
sdm_transfer = Transfer_HLG;
break;
case HAL_DATASPACE_TRANSFER_LINEAR:
sdm_transfer = Transfer_Linear;
break;
case HAL_DATASPACE_TRANSFER_GAMMA2_2:
sdm_transfer = Transfer_Gamma2_2;
break;
default:
return false;
}
@ -635,7 +635,7 @@ bool HWCLayer::SupportedDataspace() {
case HAL_DATASPACE_STANDARD_DCI_P3:
sdm_primaries = ColorPrimaries_DCIP3;
break;
case HAL_DATASPACE_BT2020:
case HAL_DATASPACE_STANDARD_BT2020:
sdm_primaries = ColorPrimaries_BT2020;
break;
default:

View File

@ -872,6 +872,10 @@ android::status_t HWCSession::notifyCallback(uint32_t command, const android::Pa
status = SetColorModeOverride(input_parcel);
break;
case qService::IQService::SET_COLOR_MODE_BY_ID:
status = SetColorModeById(input_parcel);
break;
default:
DLOGW("QService command = %d is not supported", command);
return -EINVAL;
@ -1245,6 +1249,16 @@ android::status_t HWCSession::SetColorModeOverride(const android::Parcel *input_
return 0;
}
android::status_t HWCSession::SetColorModeById(const android::Parcel *input_parcel) {
auto display = static_cast<hwc2_display_t >(input_parcel->readInt32());
auto mode = input_parcel->readInt32();
auto device = static_cast<hwc2_device_t *>(this);
auto err = CallDisplayFunction(device, display, &HWCDisplay::SetColorModeById, mode);
if (err != HWC2_ERROR_NONE)
return -EINVAL;
return 0;
}
void HWCSession::DynamicDebug(const android::Parcel *input_parcel) {
int type = input_parcel->readInt32();
bool enable = (input_parcel->readInt32() > 0);

View File

@ -170,6 +170,8 @@ class HWCSession : hwc2_device_t, public qClient::BnQClient {
android::status_t SetColorModeOverride(const android::Parcel *input_parcel);
android::status_t SetColorModeById(const android::Parcel *input_parcel);
static Locker locker_;
CoreInterface *core_intf_ = NULL;
HWCDisplay *hwc_display_[HWC_NUM_DISPLAY_TYPES] = {NULL};

View File

@ -3,7 +3,8 @@ include $(CLEAR_VARS)
include $(LOCAL_PATH)/../../../common.mk
LOCAL_MODULE := libsdmutils
LOCAL_VENDOR_MODULE := true
LOCAL_MODULE_PATH_32 := $(TARGET_OUT_VENDOR)/lib
LOCAL_MODULE_PATH_64 := $(TARGET_OUT_VENDOR)/lib64
LOCAL_MODULE_TAGS := optional
LOCAL_C_INCLUDES := $(common_includes)
LOCAL_HEADER_LIBRARIES := display_headers