Merge changes Id8595dcb,I50c4227d,Ic7b31bbd,I26ef3b1a,I4c9727ad into pi-dev

* changes:
  hwc2: Check for color modes support
  sdm: allow commits in doze_suspend as well.
  hwc: Fix request flag reset and Present() bailout
  sdm: hwc2: Add support for TWM entry and exit.
  hwc2: Determine virtual display presence based on target specific property
This commit is contained in:
TreeHugger Robot 2018-05-11 00:07:42 +00:00 committed by Android (Google) Code Review
commit 9711b52606
10 changed files with 93 additions and 29 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013-2014, 2016, The Linux Foundation. All rights reserved.
* Copyright (c) 2013-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
@ -316,6 +316,22 @@ int getPanelBrightness() {
return panel_brightness;
}
int setStandByMode(int mode) {
status_t err = (status_t) FAILED_TRANSACTION;
sp<IQService> binder = getBinder();
Parcel inParcel, outParcel;
if(binder != NULL) {
inParcel.writeInt32(mode);
err = binder->dispatch(IQService::SET_STAND_BY_MODE,
&inParcel, &outParcel);
if(err) {
ALOGE("%s() failed with err %d", __FUNCTION__, err);
}
}
return err;
}
}// namespace
// ----------------------------------------------------------------------------

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013 - 2016 The Linux Foundation. All rights reserved.
* Copyright (c) 2013 - 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
@ -158,6 +158,7 @@ int setPanelBrightness(int level);
// Retrieves the current panel brightness value
int getPanelBrightness();
int setStandByMode(int mode);
}; //namespace
#endif

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2010 The Android Open Source Project
* Copyright (C) 2012-2014, 2016 The Linux Foundation. All rights reserved.
* Copyright (C) 2012-2014, 2016, 2018 The Linux Foundation. All rights reserved.
*
* Not a Contribution, Apache license notifications and license are
* retained for attribution purposes only.
@ -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_STAND_BY_MODE = 36, //Set stand by mode for MDP3 hardware.
COMMAND_LIST_END = 400,
};

View File

@ -444,15 +444,9 @@ DisplayError DisplayBase::SetDisplayState(DisplayState state) {
break;
case kStateDoze:
error = hw_intf_->DozeSuspend();
active = true;
break;
case kStateDozeSuspend:
error = hw_intf_->DozeSuspend();
if (display_type_ != kPrimary) {
active = true;
}
active = true;
break;
case kStateStandby:

View File

@ -457,6 +457,9 @@ void HWCDisplay::BuildLayerStack() {
metadata_refresh_rate_ = 0;
auto working_primaries = ColorPrimaries_BT709_5;
uint32_t color_mode_count = 0;
display_intf_->GetColorModeCount(&color_mode_count);
// Add one layer for fb target
// TODO(user): Add blit target layers
for (auto hwc_layer : layer_set_) {
@ -523,7 +526,7 @@ void HWCDisplay::BuildLayerStack() {
bool hdr_layer = layer->input_buffer.color_metadata.colorPrimaries == ColorPrimaries_BT2020 &&
(layer->input_buffer.color_metadata.transfer == Transfer_SMPTE_ST2084 ||
layer->input_buffer.color_metadata.transfer == Transfer_HLG);
if (hdr_layer && !disable_hdr_handling_) {
if (hdr_layer && !disable_hdr_handling_ && color_mode_count) {
// dont honor HDR when its handling is disabled
layer->input_buffer.flags.hdr = true;
layer_stack_.flags.hdr_present = true;
@ -1102,10 +1105,6 @@ HWC2::Error HWCDisplay::GetHdrCapabilities(uint32_t *out_num_types, int32_t *out
HWC2::Error HWCDisplay::CommitLayerStack(void) {
if (shutdown_pending_ || layer_set_.empty()) {
return HWC2::Error::None;
}
if (skip_validate_ && !CanSkipValidate()) {
validated_.reset(type_);
}
@ -1115,6 +1114,10 @@ HWC2::Error HWCDisplay::CommitLayerStack(void) {
return HWC2::Error::NotValidated;
}
if (shutdown_pending_ || layer_set_.empty()) {
return HWC2::Error::None;
}
DumpInputBuffers();
if (!flush_) {
@ -1199,8 +1202,10 @@ HWC2::Error HWCDisplay::PostCommitLayerStack(int32_t *out_retire_fence) {
close(layer_buffer->acquire_fence_fd);
layer_buffer->acquire_fence_fd = -1;
}
layer->request.flags = {};
}
client_target_->GetSDMLayer()->request.flags = {};
*out_retire_fence = -1;
if (!flush_) {
// if swapinterval property is set to 0 then close and reset the list retire fence
@ -1220,8 +1225,6 @@ HWC2::Error HWCDisplay::PostCommitLayerStack(int32_t *out_retire_fence) {
geometry_changes_ = GeometryChanges::kNone;
flush_ = false;
ClearRequestFlags();
return status;
}
@ -1881,12 +1884,6 @@ void HWCDisplay::CloseAcquireFds() {
}
}
void HWCDisplay::ClearRequestFlags() {
for (Layer *layer : layer_stack_.layers) {
layer->request.flags = {};
}
}
std::string HWCDisplay::Dump() {
std::ostringstream os;
os << "-------------------------------" << std::endl;

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
@ -148,6 +148,9 @@ class HWCDisplay : public DisplayEventHandler {
virtual int SetState(bool connected) {
return kErrorNotSupported;
}
virtual DisplayError SetStandByMode(bool enable) {
return kErrorNotSupported;
}
int SetPanelBrightness(int level);
int GetPanelBrightness(int *level);
int ToggleScreenUpdates(bool enable);
@ -237,7 +240,6 @@ class HWCDisplay : public DisplayEventHandler {
bool IsLayerUpdating(const Layer *layer);
uint32_t SanitizeRefreshRate(uint32_t req_refresh_rate);
virtual void CloseAcquireFds();
virtual void ClearRequestFlags();
virtual void GetUnderScanConfig() { }
enum {

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
@ -594,4 +594,28 @@ DisplayError HWCDisplayPrimary::GetMixerResolution(uint32_t *width, uint32_t *he
return display_intf_->GetMixerResolution(width, height);
}
DisplayError HWCDisplayPrimary::SetStandByMode(bool enable) {
if (enable) {
if (!display_null_.IsActive()) {
stored_display_intf_ = display_intf_;
display_intf_ = &display_null_;
display_null_.SetActive(true);
DLOGD("Null display is connected successfully");
} else {
DLOGD("Null display is already connected.");
}
} else {
if (display_null_.IsActive()) {
display_intf_ = stored_display_intf_;
validated_.reset();
display_null_.SetActive(false);
DLOGD("Display is connected successfully");
} else {
DLOGD("Display is already connected.");
}
}
return kErrorNone;
}
} // 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
@ -34,6 +34,7 @@
#include "cpuhint.h"
#include "hwc_display.h"
#include "display_null.h"
namespace sdm {
@ -67,6 +68,7 @@ class HWCDisplayPrimary : public HWCDisplay {
virtual int GetFrameCaptureStatus() { return frame_capture_status_; }
virtual DisplayError SetDetailEnhancerConfig(const DisplayDetailEnhancerData &de_data);
virtual DisplayError ControlPartialUpdate(bool enable, uint32_t *pending);
virtual DisplayError SetStandByMode(bool enable);
private:
HWCDisplayPrimary(CoreInterface *core_intf, BufferAllocator *buffer_allocator,
@ -102,6 +104,11 @@ class HWCDisplayPrimary : public HWCDisplay {
BufferInfo output_buffer_info_ = {};
void *output_buffer_base_ = nullptr;
int default_mode_status_ = 0;
//Null display
DisplayNull display_null_;
DisplayInterface *stored_display_intf_ = NULL;
};
} // namespace sdm

View File

@ -491,7 +491,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,
@ -1013,6 +1015,10 @@ android::status_t HWCSession::notifyCallback(uint32_t command, const android::Pa
status = SetColorModeOverride(input_parcel);
break;
case qService::IQService::SET_STAND_BY_MODE:
status = SetStandByMode(input_parcel);
break;
default:
DLOGW("QService command = %d is not supported", command);
return -EINVAL;
@ -1499,6 +1505,21 @@ android::status_t HWCSession::GetVisibleDisplayRect(const android::Parcel *input
return android::NO_ERROR;
}
android::status_t HWCSession::SetStandByMode(const android::Parcel *input_parcel) {
SCOPE_LOCK(locker_);
bool enable = (input_parcel->readInt32() > 0);
if (!hwc_display_[HWC_DISPLAY_PRIMARY]) {
DLOGI("Primary display is not initialized");
return -EINVAL;
}
hwc_display_[HWC_DISPLAY_PRIMARY]->SetStandByMode(enable);
return android::NO_ERROR;
}
void HWCSession::Refresh(hwc2_display_t display) {
SCOPE_LOCK(callbacks_lock_);
HWC2::Error err = callbacks_.Refresh(display);

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
@ -218,6 +218,7 @@ class HWCSession : hwc2_device_t, HWCUEventListener, IDisplayConfig, public qCli
android::Parcel *output_parcel);
android::status_t SetMixerResolution(const android::Parcel *input_parcel);
android::status_t SetColorModeOverride(const android::Parcel *input_parcel);
android::status_t SetStandByMode(const android::Parcel *input_parcel);
void Refresh(hwc2_display_t display);
void HotPlug(hwc2_display_t display, HWC2::Connection state);