Merge branch 'lineage-15.1-caf-8996' of https://github.com/LineageOS/android_hardware_qcom_display into mido-los-15.1-new

This commit is contained in:
followmsi 2018-03-11 17:09:24 +01:00
commit 07b4c5ad97
13 changed files with 114 additions and 19 deletions

View File

@ -1,5 +1,8 @@
#Common headers
display_top := $(call my-dir)
display_config_version := $(shell \
if [ -d "$(TOP)/vendor/qcom/opensource/interfaces/display/config/1.1" ];\
then echo DISPLAY_CONFIG_1_1; fi)
#Common C flags
common_flags := -DDEBUG_CALC_FPS -Wno-missing-field-initializers
@ -9,6 +12,10 @@ ifeq ($(TARGET_IS_HEADLESS), true)
LOCAL_CLANG := false
endif
ifeq ($(display_config_version), DISPLAY_CONFIG_1_1)
common_flags += -DDISPLAY_CONFIG_1_1
endif
ifeq ($(TARGET_USES_COLOR_METADATA), true)
common_flags += -DUSE_COLOR_METADATA
endif

View File

@ -694,8 +694,11 @@ gralloc1_error_t BufferManager::Perform(int operation, va_list args) {
break;
}
break;
} else if (getMetaData(hnd, GET_COLOR_SPACE, color_space) != 0) {
*color_space = 0;
}
if (getMetaData(hnd, GET_COLOR_SPACE, &color_metadata) != 0) {
#else
if (getMetaData(hnd, GET_COLOR_SPACE, color_space) != 0) {
*color_space = 0;
}
#endif

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014 - 2016, The Linux Foundation. All rights reserved.
* Copyright (c) 2014 - 2016, 2018 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
@ -220,6 +220,15 @@ class CoreInterface {
*/
virtual DisplayError GetFirstDisplayInterfaceType(HWDisplayInterfaceInfo *hw_disp_info) = 0;
/*! @brief Method to check color transform supported or not.
@details Client shall use this method to determine if target supports color transform or not
@return bool
*/
virtual bool IsColorTransformSupported() = 0;
protected:
virtual ~CoreInterface() { }

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014 - 2017, The Linux Foundation. All rights reserved.
* Copyright (c) 2014 - 2018, 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 met:
@ -181,5 +181,8 @@ DisplayError CoreImpl::GetFirstDisplayInterfaceType(HWDisplayInterfaceInfo *hw_d
return hw_info_intf_->GetFirstDisplayInterfaceType(hw_disp_info);
}
bool CoreImpl::IsColorTransformSupported() {
return (hw_resource_.has_ppp) ? false : true;
}
} // namespace sdm

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014 - 2016, The Linux Foundation. All rights reserved.
* Copyright (c) 2014 - 2016, 2018 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 met:
@ -58,6 +58,7 @@ class CoreImpl : public CoreInterface {
virtual DisplayError DestroyDisplay(DisplayInterface *intf);
virtual DisplayError SetMaxBandwidthMode(HWBwModes mode);
virtual DisplayError GetFirstDisplayInterfaceType(HWDisplayInterfaceInfo *hw_disp_info);
virtual bool IsColorTransformSupported();
protected:
Locker locker_;

View File

@ -115,6 +115,10 @@ DisplayError HWDevice::Deinit() {
device_fd_ = -1;
}
if (stored_retire_fence >= 0) {
Sys::close_(stored_retire_fence);
stored_retire_fence = -1;
}
return kErrorNone;
}

View File

@ -15,6 +15,10 @@ LOCAL_CFLAGS := -Wno-missing-field-initializers -Wno-unused-par
-std=c++11 -fcolor-diagnostics\
-DLOG_TAG=\"SDM\" $(common_flags) \
-I $(display_top)/sdm/libs/hwc
ifeq ($(TARGET_EXCLUDES_DISPLAY_PP), true)
LOCAL_CFLAGS += -DEXCLUDE_DISPLAY_PP
endif
LOCAL_CLANG := true
# TODO: Remove libui after addressing gpu_tonemapper issues
@ -28,6 +32,10 @@ ifneq ($(TARGET_USES_GRALLOC1), true)
LOCAL_SHARED_LIBRARIES += libmemalloc
endif
ifeq ($(display_config_version), DISPLAY_CONFIG_1_1)
LOCAL_SHARED_LIBRARIES += vendor.display.config@1.1_vendor
endif
LOCAL_SRC_FILES := hwc_session.cpp \
hwc_session_services.cpp \
hwc_display.cpp \

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014-2017, The Linux Foundation. All rights reserved.
* Copyright (c) 2014-2018, The Linux Foundation. All rights reserved.
* Not a Contribution.
*
* Copyright 2015 The Android Open Source Project
@ -89,8 +89,11 @@ HWC2::Error HWCColorMode::DeInit() {
uint32_t HWCColorMode::GetColorModeCount() {
uint32_t count = UINT32(color_mode_transform_map_.size());
DLOGI("Supported color mode count = %d", count);
#ifdef EXCLUDE_DISPLAY_PP
return count;
#else
return std::max(1U, count);
#endif
}
HWC2::Error HWCColorMode::GetColorModes(uint32_t *out_num_modes,
@ -202,8 +205,10 @@ void HWCColorMode::PopulateColorModes() {
// SDM returns modes which is string combination of mode + transform.
DisplayError error = display_intf_->GetColorModeCount(&color_mode_count);
if (error != kErrorNone || (color_mode_count == 0)) {
#ifndef EXCLUDE_DISPLAY_PP
DLOGW("GetColorModeCount failed, use native color mode");
PopulateTransform(HAL_COLOR_MODE_NATIVE, "native", "identity");
#endif
return;
}
@ -401,6 +406,9 @@ int HWCDisplay::Deinit() {
}
delete client_target_;
for (auto hwc_layer : layer_set_) {
delete hwc_layer;
}
if (color_mode_) {
color_mode_->DeInit();
@ -462,6 +470,7 @@ void HWCDisplay::BuildLayerStack() {
metadata_refresh_rate_ = 0;
auto working_primaries = ColorPrimaries_BT709_5;
bool secure_display_active = false;
layer_stack_.flags.animating = animating_;
// Add one layer for fb target
// TODO(user): Add blit target layers
@ -1735,13 +1744,14 @@ void HWCDisplay::MarkLayersForGPUBypass() {
}
void HWCDisplay::MarkLayersForClientComposition() {
// ClientComposition - GPU comp, to acheive this, set skip flag so that
// ClientComposition - GPU comp, to achieve this, set skip flag so that
// SDM does not handle this layer and hwc_layer composition will be
// set correctly at the end of Prepare.
for (auto hwc_layer : layer_set_) {
Layer *layer = hwc_layer->GetSDMLayer();
layer->flags.skip = true;
}
layer_stack_.flags.skip_present = true;
}
void HWCDisplay::ApplyScanAdjustment(hwc_rect_t *display_frame) {

View File

@ -210,6 +210,11 @@ class HWCDisplay : public DisplayEventHandler {
float* out_max_luminance,
float* out_max_average_luminance,
float* out_min_luminance);
virtual HWC2::Error SetDisplayAnimating(bool animating) {
animating_ = animating;
validated_ = false;
return HWC2::Error::None;
}
protected:
// Maximum number of layers supported by display manager.
@ -300,6 +305,7 @@ class HWCDisplay : public DisplayEventHandler {
DisplayClass display_class_;
uint32_t geometry_changes_ = GeometryChanges::kNone;
bool skip_validate_ = false;
bool animating_ = false;
};
inline int HWCDisplay::Perform(uint32_t operation, ...) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014 - 2017, The Linux Foundation. All rights reserved.
* Copyright (c) 2014 - 2018, 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
@ -173,13 +173,15 @@ HWC2::Error HWCDisplayPrimary::Validate(uint32_t *out_num_types, uint32_t *out_n
return status;
}
// Fill in the remaining blanks in the layers and add them to the SDM layerstack
BuildLayerStack();
if (color_tranform_failed_) {
// Must fall back to client composition
MarkLayersForClientComposition();
}
// Fill in the remaining blanks in the layers and add them to the SDM layerstack
BuildLayerStack();
// Checks and replaces layer stack for solid fill
SolidFillPrepare();
@ -213,7 +215,10 @@ HWC2::Error HWCDisplayPrimary::Validate(uint32_t *out_num_types, uint32_t *out_n
}
if (layer_set_.empty()) {
flush_ = true;
// Avoid flush for Command mode panel.
DisplayConfigFixedInfo display_config;
display_intf_->GetConfig(&display_config);
flush_ = !display_config.is_cmdmode;
return status;
}
@ -288,7 +293,7 @@ HWC2::Error HWCDisplayPrimary::SetColorTransform(const float *matrix,
}
auto status = color_mode_->SetColorTransform(matrix, hint);
if (status != HWC2::Error::None) {
if ((hint != HAL_COLOR_TRANSFORM_IDENTITY) && (status != HWC2::Error::None)) {
DLOGE("failed for hint = %d", hint);
color_tranform_failed_ = true;
return status;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014-2017, The Linux Foundation. All rights reserved.
* Copyright (c) 2014-2018, The Linux Foundation. All rights reserved.
* Not a Contribution.
*
* Copyright 2015 The Android Open Source Project
@ -299,16 +299,25 @@ void HWCSession::GetCapabilities(struct hwc2_device *device, uint32_t *outCount,
}
int value = 0;
uint32_t count = 0;
bool disable_skip_validate = false;
HWCSession *hwc_session = static_cast<HWCSession *>(device);
bool color_transform_supported = hwc_session->core_intf_->IsColorTransformSupported();
if (Debug::Get()->GetProperty("sdm.debug.disable_skip_validate", &value) == kErrorNone) {
disable_skip_validate = (value == 1);
}
uint32_t count = 1 + (disable_skip_validate ? 0 : 1);
count += (color_transform_supported) ? 1 : 0;
count += (!disable_skip_validate) ? 1 : 0;
if (outCapabilities != nullptr && (*outCount >= count)) {
outCapabilities[0] = HWC2_CAPABILITY_SKIP_CLIENT_COLOR_TRANSFORM;
int i = 0;
if (color_transform_supported) {
outCapabilities[i++] = HWC2_CAPABILITY_SKIP_CLIENT_COLOR_TRANSFORM;
}
if (!disable_skip_validate) {
outCapabilities[1] = HWC2_CAPABILITY_SKIP_VALIDATE;
outCapabilities[i++] = HWC2_CAPABILITY_SKIP_VALIDATE;
}
}
*outCount = count;
@ -502,7 +511,9 @@ static int32_t GetHdrCapabilities(hwc2_device_t* device, hwc2_display_t display,
}
static uint32_t GetMaxVirtualDisplayCount(hwc2_device_t *device) {
return 1;
char property[PROPERTY_VALUE_MAX];
property_get("debug.sdm.support_writeback", property, "1");
return (uint32_t) atoi(property);
}
static int32_t GetReleaseFences(hwc2_device_t *device, hwc2_display_t display,
@ -1071,7 +1082,7 @@ android::status_t HWCSession::HandleGetDisplayAttributesForConfig(const android:
int error = android::BAD_VALUE;
DisplayConfigVariableInfo display_attributes;
if (dpy > HWC_DISPLAY_VIRTUAL) {
if (dpy < HWC_DISPLAY_PRIMARY || dpy >= HWC_NUM_DISPLAY_TYPES || config < 0) {
return android::BAD_VALUE;
}
@ -1220,6 +1231,10 @@ android::status_t HWCSession::SetColorModeOverride(const android::Parcel *input_
auto mode = static_cast<android_color_mode_t>(input_parcel->readInt32());
auto device = static_cast<hwc2_device_t *>(this);
if (display >= HWC_NUM_DISPLAY_TYPES) {
return -EINVAL;
}
SEQUENCE_WAIT_SCOPE_LOCK(locker_[display]);
auto err = CallDisplayFunction(device, display, &HWCDisplay::SetColorMode, mode);
if (err != HWC2_ERROR_NONE)
@ -1535,7 +1550,7 @@ int HWCSession::GetVsyncPeriod(int disp) {
android::status_t HWCSession::GetVisibleDisplayRect(const android::Parcel *input_parcel,
android::Parcel *output_parcel) {
int dpy = input_parcel->readInt32();
if (dpy < HWC_DISPLAY_PRIMARY || dpy > HWC_DISPLAY_VIRTUAL) {
if (dpy < HWC_DISPLAY_PRIMARY || dpy >= HWC_NUM_DISPLAY_TYPES) {
return android::BAD_VALUE;
}

View File

@ -20,7 +20,12 @@
#ifndef __HWC_SESSION_H__
#define __HWC_SESSION_H__
#ifdef DISPLAY_CONFIG_1_1
#include <vendor/display/config/1.1/IDisplayConfig.h>
#else
#include <vendor/display/config/1.0/IDisplayConfig.h>
#endif
#include <core/core_interface.h>
#include <utils/locker.h>
@ -35,7 +40,11 @@
namespace sdm {
#ifdef DISPLAY_CONFIG_1_1
using vendor::display::config::V1_1::IDisplayConfig;
#else
using ::vendor::display::config::V1_0::IDisplayConfig;
#endif
using ::android::hardware::Return;
// Create a singleton uevent listener thread valid for life of hardware composer process.
@ -205,6 +214,11 @@ class HWCSession : hwc2_device_t, HWCUEventListener, IDisplayConfig, public qCli
Return<int32_t> setCameraLaunchStatus(uint32_t on) override;
Return<void> displayBWTransactionPending(displayBWTransactionPending_cb _hidl_cb) override;
// Methods from ::android::hardware::display::config::V1_1::IDisplayConfig follow.
#ifdef DISPLAY_CONFIG_1_1
Return<int32_t> setDisplayAnimating(uint64_t display_id, bool animating) override;
#endif
// QClient methods
virtual android::status_t notifyCallback(uint32_t command, const android::Parcel *input_parcel,
android::Parcel *output_parcel);

View File

@ -480,4 +480,14 @@ Return<void> HWCSession::displayBWTransactionPending(displayBWTransactionPending
return Void();
}
#ifdef DISPLAY_CONFIG_1_1
// Methods from ::vendor::hardware::display::config::V1_1::IDisplayConfig follow.
Return<int32_t> HWCSession::setDisplayAnimating(uint64_t display_id, bool animating ) {
SEQUENCE_WAIT_SCOPE_LOCK(locker_[display_id]);
return CallDisplayFunction(static_cast<hwc2_device_t *>(this), display_id,
&HWCDisplay::SetDisplayAnimating, animating);
}
#endif
} // namespace sdm