Merge "hwc2: Fix out of bound check in getDisplayAttributes()"
diff --git a/include/color_metadata.h b/include/color_metadata.h
index aff6fc9..3ddf757 100644
--- a/include/color_metadata.h
+++ b/include/color_metadata.h
@@ -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 met:
@@ -30,6 +30,7 @@
#else
#include <stdbool.h>
#endif
+#include <stdint.h>
typedef enum ColorRange {
Range_Limited = 0,
@@ -136,6 +137,7 @@
uint32_t crPostLutTargetValue[3*33];
} ColorRemappingInfo;
+#define HDR_DYNAMIC_META_DATA_SZ 1024
typedef struct ColorMetaData {
// Default values based on sRGB, needs to be overridden in gralloc
// based on the format and size.
@@ -147,6 +149,11 @@
MasteringDisplay masteringDisplayInfo;
ContentLightLevel contentLightLevel;
ColorRemappingInfo cRI;
+
+ // Dynamic meta data elements
+ bool dynamicMetaDataValid;
+ uint32_t dynamicMetaDataLen;
+ uint8_t dynamicMetaDataPayload[HDR_DYNAMIC_META_DATA_SZ];
} ColorMetaData;
typedef struct Color10Bit {
diff --git a/libdrmutils/drm_interface.h b/libdrmutils/drm_interface.h
index d64d904..6bf7f97 100644
--- a/libdrmutils/drm_interface.h
+++ b/libdrmutils/drm_interface.h
@@ -443,22 +443,10 @@
COMMAND,
};
-/* Per Connector Info*/
-struct DRMConnectorInfo {
- uint32_t mmWidth;
- uint32_t mmHeight;
- uint32_t type;
- std::vector<drmModeModeInfo> modes;
+/* Per mode info */
+struct DRMModeInfo {
+ drmModeModeInfo mode;
DRMTopology topology;
- std::string panel_name;
- DRMPanelMode panel_mode;
- bool is_primary;
- // Valid only if DRMPanelMode is VIDEO
- bool dynamic_fps;
- // FourCC format enum and modifier
- std::vector<std::pair<uint32_t, uint64_t>> formats_supported;
- // Valid only if type is DRM_MODE_CONNECTOR_VIRTUAL
- uint32_t max_linewidth;
// Valid only if mode is command
int num_roi;
int xstart;
@@ -468,6 +456,23 @@
int wmin;
int hmin;
bool roi_merge;
+};
+
+/* Per Connector Info*/
+struct DRMConnectorInfo {
+ uint32_t mmWidth;
+ uint32_t mmHeight;
+ uint32_t type;
+ std::vector<DRMModeInfo> modes;
+ std::string panel_name;
+ DRMPanelMode panel_mode;
+ bool is_primary;
+ // Valid only if DRMPanelMode is VIDEO
+ bool dynamic_fps;
+ // FourCC format enum and modifier
+ std::vector<std::pair<uint32_t, uint64_t>> formats_supported;
+ // Valid only if type is DRM_MODE_CONNECTOR_VIRTUAL
+ uint32_t max_linewidth;
DRMRotation panel_orientation;
drm_panel_hdr_properties panel_hdr_prop;
uint32_t transfer_time_us;
diff --git a/sdm/include/core/display_interface.h b/sdm/include/core/display_interface.h
index 080f7a1..92efd9f 100644
--- a/sdm/include/core/display_interface.h
+++ b/sdm/include/core/display_interface.h
@@ -689,6 +689,12 @@
LayerBufferFormat format,
const ColorMetaData &color_metadata) = 0;
+ /*
+ * Returns a string consisting of a dump of SDM's display and layer related state
+ * as programmed to driver
+ */
+ virtual std::string Dump() = 0;
+
protected:
virtual ~DisplayInterface() { }
};
diff --git a/sdm/include/core/dump_interface.h b/sdm/include/core/dump_interface.h
deleted file mode 100644
index 6882e5d..0000000
--- a/sdm/include/core/dump_interface.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
-* Copyright (c) 2014, 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:
-* * Redistributions of source code must retain the above copyright notice, this list of
-* conditions and the following disclaimer.
-* * Redistributions in binary form must reproduce the above copyright notice, this list of
-* conditions and the following disclaimer in the documentation and/or other materials provided
-* with the distribution.
-* * Neither the name of The Linux Foundation nor the names of its contributors may be used to
-* endorse or promote products derived from this software without specific prior written
-* permission.
-*
-* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
-* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
-* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/*! @file dump_interface.h
- @brief Interface file for dump options provided by display manager.
-
-*/
-#ifndef __DUMP_INTERFACE_H__
-#define __DUMP_INTERFACE_H__
-
-#include <stdint.h>
-
-#include "sdm_types.h"
-
-namespace sdm {
-
-/*! @brief Display dump interface.
-
- @details This class defines dump methods provided by display manager.
-
-*/
-class DumpInterface {
- public:
- /*! @brief Method to get dump information in form of a string.
-
- @details Client shall use this method to get current snapshot of display manager context as a
- formatted string for logging or dumping purposes.
-
- @param[inout] buffer String buffer allocated by the client. Filled with null terminated dump
- information upon return.
- @param[in] length Length of the string buffer. Length shall be offset adjusted if any.
-
- @return \link DisplayError \endlink
-
- @warning Client shall ensure that this interface is not used while a display is being either
- created or destroyed through display core.
- */
- static DisplayError GetDump(char *buffer, uint32_t length);
-
- protected:
- virtual ~DumpInterface() { }
-};
-
-} // namespace sdm
-
-#endif // __DUMP_INTERFACE_H__
-
diff --git a/sdm/include/private/color_interface.h b/sdm/include/private/color_interface.h
index 94be13d..884df5e 100644
--- a/sdm/include/private/color_interface.h
+++ b/sdm/include/private/color_interface.h
@@ -51,6 +51,21 @@
typedef DisplayError (*DestroyColorInterface)(DisplayType type);
+class ColorModeInterface {
+ public:
+ virtual DisplayError ColorIntfGetActiveColorParam(uint32_t hint, uint32_t display_id,
+ void* data) = 0;
+ virtual DisplayError ColorIntfSetActiveColorParam(uint32_t hint, uint32_t display_id,
+ void* data) = 0;
+ virtual DisplayError ColorIntfSetHdrInterface(void *hdr_intf) = 0;
+
+ protected:
+ virtual ~ColorModeInterface() {}
+};
+
+extern "C" ColorModeInterface* GetColorModeInterface(DisplayType type);
+extern "C" void ReleaseColorModeInterface(DisplayType type);
+
class ColorInterface {
public:
virtual DisplayError ColorSVCRequestRoute(const PPDisplayAPIPayload &in_payload,
diff --git a/sdm/include/private/color_params.h b/sdm/include/private/color_params.h
index f65fabf..6de858c 100644
--- a/sdm/include/private/color_params.h
+++ b/sdm/include/private/color_params.h
@@ -96,6 +96,8 @@
static const std::string kVivid = "vivid";
static const std::string kSharp = "sharp";
static const std::string kStandard = "standard";
+static const std::string kAmazon = "amazon";
+static const std::string kNetflix = "netflix";
// Enum to identify type of dynamic range of color mode.
enum DynamicRangeType {
diff --git a/sdm/libs/core/Android.mk b/sdm/libs/core/Android.mk
index aba66c6..d8c9f85 100644
--- a/sdm/libs/core/Android.mk
+++ b/sdm/libs/core/Android.mk
@@ -32,7 +32,6 @@
comp_manager.cpp \
strategy.cpp \
resource_default.cpp \
- dump_impl.cpp \
color_manager.cpp \
hw_events_interface.cpp \
hw_info_interface.cpp \
@@ -68,7 +67,6 @@
$(SDM_HEADER_PATH)/core/core_interface.h \
$(SDM_HEADER_PATH)/core/debug_interface.h \
$(SDM_HEADER_PATH)/core/display_interface.h \
- $(SDM_HEADER_PATH)/core/dump_interface.h \
$(SDM_HEADER_PATH)/core/layer_buffer.h \
$(SDM_HEADER_PATH)/core/layer_stack.h \
$(SDM_HEADER_PATH)/core/sdm_types.h \
diff --git a/sdm/libs/core/comp_manager.cpp b/sdm/libs/core/comp_manager.cpp
index 400b6b9..3acdcf0 100644
--- a/sdm/libs/core/comp_manager.cpp
+++ b/sdm/libs/core/comp_manager.cpp
@@ -454,10 +454,6 @@
display_comp_ctx->pu_constraints.enable = enable;
}
-void CompManager::AppendDump(char *buffer, uint32_t length) {
- SCOPE_LOCK(locker_);
-}
-
DisplayError CompManager::ValidateScaling(const LayerRect &crop, const LayerRect &dst,
bool rotate90) {
BufferLayout layout = Debug::IsUbwcTiledFrameBuffer() ? kUBWC : kLinear;
diff --git a/sdm/libs/core/comp_manager.h b/sdm/libs/core/comp_manager.h
index 6cc33cf..7fe4482 100644
--- a/sdm/libs/core/comp_manager.h
+++ b/sdm/libs/core/comp_manager.h
@@ -33,11 +33,10 @@
#include "strategy.h"
#include "resource_default.h"
#include "hw_interface.h"
-#include "dump_impl.h"
namespace sdm {
-class CompManager : public DumpImpl {
+class CompManager {
public:
DisplayError Init(const HWResourceInfo &hw_res_info_, ExtensionInterface *extension_intf,
BufferAllocator *buffer_allocator, BufferSyncHandler *buffer_sync_handler,
@@ -75,9 +74,6 @@
bool enable);
DisplayError ControlDpps(bool enable);
- // DumpImpl method
- virtual void AppendDump(char *buffer, uint32_t length);
-
private:
static const int kMaxThermalLevel = 3;
static const int kSafeModeThreshold = 4;
diff --git a/sdm/libs/core/display_base.cpp b/sdm/libs/core/display_base.cpp
index 51aa012..1e948a2 100644
--- a/sdm/libs/core/display_base.cpp
+++ b/sdm/libs/core/display_base.cpp
@@ -28,6 +28,10 @@
#include <utils/formats.h>
#include <utils/rect.h>
#include <utils/utils.h>
+
+#include <iomanip>
+#include <map>
+#include <sstream>
#include <string>
#include <vector>
#include <algorithm>
@@ -83,6 +87,15 @@
}
}
+ color_mgr_ = ColorManagerProxy::CreateColorManagerProxy(display_type_, hw_intf_,
+ display_attributes_, hw_panel_info_);
+
+ if (!color_mgr_) {
+ DLOGW("Unable to create ColorManagerProxy for display = %d", display_type_);
+ } else if (InitializeColorModes() != kErrorNone) {
+ DLOGW("InitColorModes failed for display = %d", display_type_);
+ }
+
error = comp_manager_->RegisterDisplay(display_type_, display_attributes_, hw_panel_info_,
mixer_attributes_, fb_config_, &display_comp_ctx_);
if (error != kErrorNone) {
@@ -100,14 +113,6 @@
DisplayBase::SetMaxMixerStages(max_mixer_stages);
}
- color_mgr_ = ColorManagerProxy::CreateColorManagerProxy(display_type_, hw_intf_,
- display_attributes_, hw_panel_info_);
- if (!color_mgr_) {
- DLOGW("Unable to create ColorManagerProxy for display = %d", display_type_);
- } else if (InitializeColorModes() != kErrorNone) {
- DLOGW("InitColorModes failed for display = %d", display_type_);
- }
-
Debug::Get()->GetProperty("sdm.disable_hdr_lut_gen", &disable_hdr_lut_gen_);
// TODO(user): Temporary changes, to be removed when DRM driver supports
// Partial update with Destination scaler enabled.
@@ -116,6 +121,7 @@
return kErrorNone;
CleanupOnError:
+ ClearColorInfo();
if (display_comp_ctx_) {
comp_manager_->UnregisterDisplay(display_comp_ctx_);
}
@@ -126,15 +132,7 @@
DisplayError DisplayBase::Deinit() {
{ // Scope for lock
lock_guard<recursive_mutex> obj(recursive_mutex_);
- color_modes_.clear();
- color_mode_map_.clear();
- color_mode_attr_map_.clear();
-
- if (color_mgr_) {
- delete color_mgr_;
- color_mgr_ = NULL;
- }
-
+ ClearColorInfo();
comp_manager_->UnregisterDisplay(display_comp_ctx_);
}
HWEventsInterface::Destroy(hw_events_intf_);
@@ -528,21 +526,21 @@
return error;
}
-void DisplayBase::AppendDump(char *buffer, uint32_t length) {
+std::string DisplayBase::Dump() {
lock_guard<recursive_mutex> obj(recursive_mutex_);
HWDisplayAttributes attrib;
uint32_t active_index = 0;
uint32_t num_modes = 0;
+ std::ostringstream os;
+
hw_intf_->GetNumDisplayAttributes(&num_modes);
hw_intf_->GetActiveConfig(&active_index);
hw_intf_->GetDisplayAttributes(active_index, &attrib);
- DumpImpl::AppendString(buffer, length, "\n-----------------------");
- DumpImpl::AppendString(buffer, length, "\ndevice type: %u", display_type_);
- DumpImpl::AppendString(buffer, length, "\nstate: %u, vsync on: %u, max. mixer stages: %u",
- state_, INT(vsync_enable_), max_mixer_stages_);
- DumpImpl::AppendString(buffer, length, "\nnum configs: %u, active config index: %u",
- num_modes, active_index);
+ os << "device type:" << display_type_;
+ os << "\nstate: " << state_ << " vsync on: " << vsync_enable_ << " max. mixer stages: "
+ << max_mixer_stages_;
+ os << "\nnum configs: " << num_modes << " active config index: " << active_index;
DisplayConfigVariableInfo &info = attrib;
@@ -552,50 +550,48 @@
}
if (num_hw_layers == 0) {
- DumpImpl::AppendString(buffer, length, "\nNo hardware layers programmed");
- return;
+ os << "\nNo hardware layers programmed";
+ return os.str();
}
LayerBuffer *out_buffer = hw_layers_.info.stack->output_buffer;
if (out_buffer) {
- DumpImpl::AppendString(buffer, length, "\nres:%u x %u format: %s", out_buffer->width,
- out_buffer->height, GetFormatString(out_buffer->format));
+ os << "\nres: " << out_buffer->width << "x" << out_buffer->height << " format: "
+ << GetFormatString(out_buffer->format);
} else {
- DumpImpl::AppendString(buffer, length, "\nres:%u x %u, dpi:%.2f x %.2f, fps:%u,"
- "vsync period: %u", info.x_pixels, info.y_pixels, info.x_dpi,
- info.y_dpi, info.fps, info.vsync_period_ns);
+ os.precision(2);
+ os << "\nres: " << info.x_pixels << "x" << info.y_pixels << " dpi: " << std::fixed <<
+ info.x_dpi << "x" << std::fixed << info.y_dpi << " fps: " << info.fps <<
+ " vsync period: " << info.vsync_period_ns;
}
- DumpImpl::AppendString(buffer, length, "\n");
-
HWLayersInfo &layer_info = hw_layers_.info;
-
for (uint32_t i = 0; i < layer_info.left_frame_roi.size(); i++) {
LayerRect &l_roi = layer_info.left_frame_roi.at(i);
LayerRect &r_roi = layer_info.right_frame_roi.at(i);
- DumpImpl::AppendString(buffer, length, "\nROI%d(L T R B) : LEFT(%d %d %d %d)", i,
- INT(l_roi.left), INT(l_roi.top), INT(l_roi.right), INT(l_roi.bottom));
+ os << "\nROI(LTRB)#" << i << " LEFT(" << INT(l_roi.left) << " " << INT(l_roi.top) << " " <<
+ INT(l_roi.right) << " " << INT(l_roi.bottom) << ")";
if (IsValid(r_roi)) {
- DumpImpl::AppendString(buffer, length, ", RIGHT(%d %d %d %d)", INT(r_roi.left),
- INT(r_roi.top), INT(r_roi.right), INT(r_roi.bottom));
+ os << " RIGHT(" << INT(r_roi.left) << " " << INT(r_roi.top) << " " << INT(r_roi.right) << " "
+ << INT(r_roi.bottom) << ")";
}
}
LayerRect &fb_roi = layer_info.partial_fb_roi;
if (IsValid(fb_roi)) {
- DumpImpl::AppendString(buffer, length, "\nPartial FB ROI(L T R B) : (%d %d %d %d)",
- INT(fb_roi.left), INT(fb_roi.top), INT(fb_roi.right), INT(fb_roi.bottom));
+ os << "\nPartial FB ROI(LTRB):(" << INT(fb_roi.left) << " " << INT(fb_roi.top) << " " <<
+ INT(fb_roi.right) << " " << INT(fb_roi.bottom) << ")";
}
- const char *header = "\n| Idx | Comp Type | Split | WB | Pipe | W x H | Format | Src Rect (L T R B) | Dst Rect (L T R B) | Z | Flags | Deci(HxV) | CS | Rng |"; //NOLINT
- const char *newline = "\n|-----|-------------|--------|----|--------|-------------|--------------------------|---------------------|---------------------|----|------------|-----------|----|-----|"; //NOLINT
- const char *format = "\n| %3s | %11s " "| %6s " "| %2s | 0x%04x | %4d x %4d | %24s " "| %4d %4d %4d %4d " "| %4d %4d %4d %4d " "| %2s | %10s " "| %9s | %2s | %3s |"; //NOLINT
+ const char *header = "\n| Idx | Comp Type | Split | Pipe | W x H | Format | Src Rect (L T R B) | Dst Rect (L T R B) | Z | Flags | Deci(HxV) | CS | Rng |"; //NOLINT
+ const char *newline = "\n|-----|------------|-----------|------|-------------|--------------------------|---------------------|---------------------|----|------------|-----------|----|-----|"; //NOLINT
+ const char *format = "\n| %3s | %10s | %9s | %4d | %4d x %4d | %24s | %4d %4d %4d %4d | %4d %4d %4d %4d | %2s | %10s | %9s | %2s | %3s |"; //NOLINT
- DumpImpl::AppendString(buffer, length, "\n");
- DumpImpl::AppendString(buffer, length, newline);
- DumpImpl::AppendString(buffer, length, header);
- DumpImpl::AppendString(buffer, length, newline);
+ os << "\n";
+ os << newline;
+ os << header;
+ os << newline;
for (uint32_t i = 0; i < num_hw_layers; i++) {
uint32_t layer_index = hw_layers_.info.index.at(i);
@@ -607,33 +603,29 @@
HWLayerConfig &layer_config = hw_layers_.config[i];
HWRotatorSession &hw_rotator_session = layer_config.hw_rotator_session;
- char idx[8] = { 0 };
const char *comp_type = GetName(sdm_layer->composition);
const char *buffer_format = GetFormatString(input_buffer->format);
- const char *comp_split[2] = { "Comp-1", "Comp-2" };
+ const char *pipe_split[2] = { "Pipe-1", "Pipe-2" };
+ char idx[8];
snprintf(idx, sizeof(idx), "%d", layer_index);
for (uint32_t count = 0; count < hw_rotator_session.hw_block_count; count++) {
- char writeback_id[8] = { "I" };
+ char row[1024];
HWRotateInfo &rotate = hw_rotator_session.hw_rotate_info[count];
LayerRect &src_roi = rotate.src_roi;
LayerRect &dst_roi = rotate.dst_roi;
- char rot[8] = { 0 };
- int pipe_id = 0;
+ char rot[12] = { 0 };
- if (hw_rotator_session.mode == kRotatorOffline) {
- snprintf(writeback_id, sizeof(writeback_id), "%d", rotate.writeback_id);
- pipe_id = rotate.pipe_id;
- }
- snprintf(rot, sizeof(rot), "Rot-%d", count + 1);
- DumpImpl::AppendString(buffer, length, format, idx, comp_type, rot,
- writeback_id, pipe_id, input_buffer->width,
- input_buffer->height, buffer_format, INT(src_roi.left),
- INT(src_roi.top), INT(src_roi.right), INT(src_roi.bottom),
- INT(dst_roi.left), INT(dst_roi.top), INT(dst_roi.right),
- INT(dst_roi.bottom), "-", "- ", "- ", "-", "-");
+ snprintf(rot, sizeof(rot), "Rot-%s-%d", hw_rotator_session.mode == kRotatorInline ?
+ "inl" : "off", count + 1);
+ snprintf(row, sizeof(row), format, idx, comp_type, rot,
+ 0, input_buffer->width, input_buffer->height, buffer_format,
+ INT(src_roi.left), INT(src_roi.top), INT(src_roi.right), INT(src_roi.bottom),
+ INT(dst_roi.left), INT(dst_roi.top), INT(dst_roi.right), INT(dst_roi.bottom),
+ "-", "- ", "- ", "-", "-");
+ os << row;
// print the below only once per layer block, fill with spaces for rest.
idx[0] = 0;
comp_type = "";
@@ -644,6 +636,27 @@
buffer_format = GetFormatString(input_buffer->format);
}
+ if (layer_config.use_solidfill_stage) {
+ LayerRect src_roi = layer_config.hw_solidfill_stage.roi;
+ const char *decimation = "";
+ char flags[16] = { 0 };
+ char z_order[8] = { 0 };
+ const char *color_primary = "";
+ const char *range = "";
+ char row[1024] = { 0 };
+
+ snprintf(z_order, sizeof(z_order), "%d", layer_config.hw_solidfill_stage.z_order);
+ snprintf(flags, sizeof(flags), "0x%08x", hw_layer.flags.flags);
+ snprintf(row, sizeof(row), format, idx, comp_type, pipe_split[0],
+ 0, INT(src_roi.right), INT(src_roi.bottom),
+ buffer_format, INT(src_roi.left), INT(src_roi.top),
+ INT(src_roi.right), INT(src_roi.bottom), INT(src_roi.left),
+ INT(src_roi.top), INT(src_roi.right), INT(src_roi.bottom),
+ z_order, flags, decimation, color_primary, range);
+ os << row;
+ continue;
+ }
+
for (uint32_t count = 0; count < 2; count++) {
char decimation[16] = { 0 };
char flags[16] = { 0 };
@@ -671,20 +684,24 @@
snprintf(color_primary, sizeof(color_primary), "%d", color_metadata.colorPrimaries);
snprintf(range, sizeof(range), "%d", color_metadata.range);
- DumpImpl::AppendString(buffer, length, format, idx, comp_type, comp_split[count],
- "-", pipe.pipe_id, input_buffer->width, input_buffer->height,
- buffer_format, INT(src_roi.left), INT(src_roi.top),
- INT(src_roi.right), INT(src_roi.bottom), INT(dst_roi.left),
- INT(dst_roi.top), INT(dst_roi.right), INT(dst_roi.bottom),
- z_order, flags, decimation, color_primary, range);
+ char row[1024];
+ snprintf(row, sizeof(row), format, idx, comp_type, pipe_split[count],
+ pipe.pipe_id, input_buffer->width, input_buffer->height,
+ buffer_format, INT(src_roi.left), INT(src_roi.top),
+ INT(src_roi.right), INT(src_roi.bottom), INT(dst_roi.left),
+ INT(dst_roi.top), INT(dst_roi.right), INT(dst_roi.bottom),
+ z_order, flags, decimation, color_primary, range);
+ os << row;
// print the below only once per layer block, fill with spaces for rest.
idx[0] = 0;
comp_type = "";
}
-
- DumpImpl::AppendString(buffer, length, newline);
}
+
+ os << newline << "\n";
+
+ return os.str();
}
const char * DisplayBase::GetName(const LayerComposition &composition) {
@@ -883,44 +900,15 @@
if (!found_hdr || !color_mode) {
return kErrorParameters;
}
- auto it_mode = color_mode_attr_map_.find(current_color_mode_);
- if (it_mode == color_mode_attr_map_.end()) {
- DLOGE("Failed: Unknown Mode : %s", current_color_mode_.c_str());
- return kErrorNotSupported;
- }
-
*found_hdr = false;
- std::string cur_color_gamut, cur_pic_quality;
- // get the attributes of current color mode
- GetValueOfModeAttribute(it_mode->second, kColorGamutAttribute, &cur_color_gamut);
- GetValueOfModeAttribute(it_mode->second, kPictureQualityAttribute, &cur_pic_quality);
-
- // found the corresponding HDR mode id which
- // has the same attributes with current SDR mode.
+ // get the default HDR mode which is value of picture quality equal to "standard"
for (auto &it_hdr : color_mode_attr_map_) {
- std::string dynamic_range, color_gamut, pic_quality;
+ std::string dynamic_range, pic_quality;
GetValueOfModeAttribute(it_hdr.second, kDynamicRangeAttribute, &dynamic_range);
- GetValueOfModeAttribute(it_hdr.second, kColorGamutAttribute, &color_gamut);
GetValueOfModeAttribute(it_hdr.second, kPictureQualityAttribute, &pic_quality);
- if (dynamic_range == kHdr && cur_color_gamut == color_gamut &&
- cur_pic_quality == pic_quality) {
+ if (dynamic_range == kHdr && pic_quality == kStandard) {
*color_mode = it_hdr.first;
*found_hdr = true;
- DLOGV_IF(kTagQDCM, "corresponding hdr mode = %s", color_mode->c_str());
- return kErrorNone;
- }
- }
-
- // The corresponding HDR mode was not be found,
- // apply the first HDR mode that we encouter.
- for (auto &it_hdr : color_mode_attr_map_) {
- std::string dynamic_range;
- GetValueOfModeAttribute(it_hdr.second, kDynamicRangeAttribute, &dynamic_range);
- if (dynamic_range == kHdr) {
- *color_mode = it_hdr.first;
- *found_hdr = true;
- DLOGV_IF(kTagQDCM, "First hdr mode = %s", color_mode->c_str());
- return kErrorNone;
}
}
@@ -969,10 +957,28 @@
DisplayError DisplayBase::ApplyDefaultDisplayMode() {
lock_guard<recursive_mutex> obj(recursive_mutex_);
- if (color_mgr_)
- return color_mgr_->ApplyDefaultDisplayMode();
- else
+ DisplayError error = kErrorNone;
+ if (color_mgr_) {
+ error = color_mgr_->ApplyDefaultDisplayMode();
+ // Apply default mode failed
+ if (error != kErrorNone) {
+ DLOGI("default mode not found");
+ return error;
+ }
+ DeInitializeColorModes();
+ // Default mode apply is called during first frame, if file system
+ // where mode files is present, ColorManager will not find any modes.
+ // Once boot animation is complete we re-try to apply the modes, since
+ // file system should be mounted. InitColorModes needs to called again
+ error = InitializeColorModes();
+ if (error != kErrorNone) {
+ DLOGE("failed to initial modes\n");
+ return error;
+ }
+ } else {
return kErrorParameters;
+ }
+ return kErrorNone;
}
DisplayError DisplayBase::SetCursorPosition(int x, int y) {
@@ -1625,4 +1631,21 @@
mixer_height != display_height);
}
+void DisplayBase::ClearColorInfo() {
+ color_modes_.clear();
+ color_mode_map_.clear();
+ color_mode_attr_map_.clear();
+
+ if (color_mgr_) {
+ delete color_mgr_;
+ color_mgr_ = NULL;
+ }
+}
+
+void DisplayBase::DeInitializeColorModes() {
+ color_mode_map_.clear();
+ color_modes_.clear();
+ color_mode_attr_map_.clear();
+ num_color_modes_ = 0;
+}
} // namespace sdm
diff --git a/sdm/libs/core/display_base.h b/sdm/libs/core/display_base.h
index 9696a3f..014ea11 100644
--- a/sdm/libs/core/display_base.h
+++ b/sdm/libs/core/display_base.h
@@ -44,7 +44,7 @@
using std::recursive_mutex;
using std::lock_guard;
-class DisplayBase : public DisplayInterface, DumpImpl {
+class DisplayBase : public DisplayInterface {
public:
DisplayBase(DisplayType display_type, DisplayEventHandler *event_handler,
HWDeviceType hw_device_type, BufferSyncHandler *buffer_sync_handler,
@@ -118,6 +118,7 @@
virtual DisplayError GetClientTargetSupport(uint32_t width, uint32_t height,
LayerBufferFormat format,
const ColorMetaData &color_metadata);
+ virtual std::string Dump();
protected:
DisplayError BuildLayerStackStats(LayerStack *layer_stack);
@@ -130,9 +131,6 @@
DisplayError ValidateScaling(uint32_t width, uint32_t height);
DisplayError ValidateDataspace(const ColorMetaData &color_metadata);
- // DumpImpl method
- void AppendDump(char *buffer, uint32_t length);
-
const char *GetName(const LayerComposition &composition);
DisplayError ReconfigureDisplay();
bool NeedsMixerReconfiguration(LayerStack *layer_stack, uint32_t *new_mixer_width,
@@ -140,6 +138,7 @@
DisplayError ReconfigureMixer(uint32_t width, uint32_t height);
bool NeedsDownScale(const LayerRect &src_rect, const LayerRect &dst_rect, bool needs_rotation);
DisplayError InitializeColorModes();
+ void DeInitializeColorModes();
DisplayError SetColorModeInternal(const std::string &color_mode);
DisplayError GetValueOfModeAttribute(const AttrVal &attr, const std::string &type,
std::string *value);
@@ -147,6 +146,7 @@
bool IsSupportColorModeAttribute(const std::string &color_mode);
DisplayState GetLastPowerMode();
void SetPUonDestScaler();
+ void ClearColorInfo();
recursive_mutex recursive_mutex_;
DisplayType display_type_;
diff --git a/sdm/libs/core/display_hdmi.h b/sdm/libs/core/display_hdmi.h
index dde3858..64aa6c7 100644
--- a/sdm/libs/core/display_hdmi.h
+++ b/sdm/libs/core/display_hdmi.h
@@ -29,7 +29,6 @@
#include <map>
#include "display_base.h"
-#include "dump_impl.h"
#include "hw_events_interface.h"
namespace sdm {
diff --git a/sdm/libs/core/display_primary.h b/sdm/libs/core/display_primary.h
index 44ae2b4..a4dd4b8 100644
--- a/sdm/libs/core/display_primary.h
+++ b/sdm/libs/core/display_primary.h
@@ -28,7 +28,6 @@
#include <vector>
#include "display_base.h"
-#include "dump_impl.h"
#include "hw_events_interface.h"
namespace sdm {
diff --git a/sdm/libs/core/display_virtual.h b/sdm/libs/core/display_virtual.h
index f9cc737..eeade9d 100644
--- a/sdm/libs/core/display_virtual.h
+++ b/sdm/libs/core/display_virtual.h
@@ -27,7 +27,6 @@
#include <private/hw_info_types.h>
#include "display_base.h"
-#include "dump_impl.h"
namespace sdm {
diff --git a/sdm/libs/core/drm/hw_device_drm.cpp b/sdm/libs/core/drm/hw_device_drm.cpp
index c1e14ee..e129a7d 100644
--- a/sdm/libs/core/drm/hw_device_drm.cpp
+++ b/sdm/libs/core/drm/hw_device_drm.cpp
@@ -333,29 +333,29 @@
}
DisplayError HWDeviceDRM::Init() {
- default_mode_ = (DRMLibLoader::GetInstance()->IsLoaded() == false);
+ DRMMaster *drm_master = {};
+ DRMMaster::GetInstance(&drm_master);
+ drm_master->GetHandle(&dev_fd_);
+ DRMLibLoader::GetInstance()->FuncGetDRMManager()(dev_fd_, &drm_mgr_intf_);
- if (!default_mode_) {
- DRMMaster *drm_master = {};
- DRMMaster::GetInstance(&drm_master);
- drm_master->GetHandle(&dev_fd_);
- DRMLibLoader::GetInstance()->FuncGetDRMManager()(dev_fd_, &drm_mgr_intf_);
- if (drm_mgr_intf_->RegisterDisplay(disp_type_, &token_)) {
- DLOGE("RegisterDisplay failed for %s", device_name_);
- return kErrorResources;
- }
-
- drm_mgr_intf_->CreateAtomicReq(token_, &drm_atomic_intf_);
- } else {
- display_attributes_.push_back(HWDisplayAttributes());
- PopulateDisplayAttributes(current_mode_index_);
+ if (drm_mgr_intf_->RegisterDisplay(disp_type_, &token_)) {
+ DLOGE("RegisterDisplay failed for %s", device_name_);
+ return kErrorResources;
}
+ drm_mgr_intf_->CreateAtomicReq(token_, &drm_atomic_intf_);
+ drm_mgr_intf_->GetConnectorInfo(token_.conn_id, &connector_info_);
hw_info_intf_->GetHWResourceInfo(&hw_resource_);
+
+ InitializeConfigs();
+ PopulateHWPanelInfo();
+ UpdateMixerAttributes();
+
// TODO(user): In future, remove has_qseed3 member, add version and pass version to constructor
if (hw_resource_.has_qseed3) {
hw_scale_ = new HWScaleDRM(HWScaleDRM::Version::V2);
}
+
return kErrorNone;
}
@@ -384,7 +384,7 @@
current_mode_index_ = 0;
// Update current mode with preferred mode
for (uint32_t mode_index = 0; mode_index < connector_info_.modes.size(); mode_index++) {
- if (connector_info_.modes[mode_index].type & DRM_MODE_TYPE_PREFERRED) {
+ if (connector_info_.modes[mode_index].mode.type & DRM_MODE_TYPE_PREFERRED) {
current_mode_index_ = mode_index;
break;
}
@@ -392,10 +392,10 @@
display_attributes_.resize(connector_info_.modes.size());
- uint32_t width = connector_info_.modes[current_mode_index_].hdisplay;
- uint32_t height = connector_info_.modes[current_mode_index_].vdisplay;
+ uint32_t width = connector_info_.modes[current_mode_index_].mode.hdisplay;
+ uint32_t height = connector_info_.modes[current_mode_index_].mode.vdisplay;
for (uint32_t i = 0; i < connector_info_.modes.size(); i++) {
- auto &mode = connector_info_.modes[i];
+ auto &mode = connector_info_.modes[i].mode;
if (mode.hdisplay != width || mode.vdisplay != height) {
resolution_switch_enabled_ = true;
}
@@ -420,10 +420,10 @@
res_mgr->GetMode(&mode);
res_mgr->GetDisplayDimInMM(&mm_width, &mm_height);
} else {
- mode = connector_info_.modes[index];
+ mode = connector_info_.modes[index].mode;
mm_width = connector_info_.mmWidth;
mm_height = connector_info_.mmHeight;
- topology = connector_info_.topology;
+ topology = connector_info_.modes[index].topology;
}
display_attributes_[index].x_pixels = mode.hdisplay;
@@ -490,29 +490,29 @@
display_attributes_[index].x_pixels / 2;
}
- hw_panel_info_.partial_update = connector_info_.num_roi;
- hw_panel_info_.left_roi_count = UINT32(connector_info_.num_roi);
- hw_panel_info_.right_roi_count = UINT32(connector_info_.num_roi);
- hw_panel_info_.left_align = connector_info_.xstart;
- hw_panel_info_.top_align = connector_info_.ystart;
- hw_panel_info_.width_align = connector_info_.walign;
- hw_panel_info_.height_align = connector_info_.halign;
- hw_panel_info_.min_roi_width = connector_info_.wmin;
- hw_panel_info_.min_roi_height = connector_info_.hmin;
- hw_panel_info_.needs_roi_merge = connector_info_.roi_merge;
+ hw_panel_info_.partial_update = connector_info_.modes[index].num_roi;
+ hw_panel_info_.left_roi_count = UINT32(connector_info_.modes[index].num_roi);
+ hw_panel_info_.right_roi_count = UINT32(connector_info_.modes[index].num_roi);
+ hw_panel_info_.left_align = connector_info_.modes[index].xstart;
+ hw_panel_info_.top_align = connector_info_.modes[index].ystart;
+ hw_panel_info_.width_align = connector_info_.modes[index].walign;
+ hw_panel_info_.height_align = connector_info_.modes[index].halign;
+ hw_panel_info_.min_roi_width = connector_info_.modes[index].wmin;
+ hw_panel_info_.min_roi_height = connector_info_.modes[index].hmin;
+ hw_panel_info_.needs_roi_merge = connector_info_.modes[index].roi_merge;
hw_panel_info_.dynamic_fps = connector_info_.dynamic_fps;
- drmModeModeInfo current_mode = connector_info_.modes[current_mode_index_];
+ drmModeModeInfo current_mode = connector_info_.modes[current_mode_index_].mode;
if (hw_panel_info_.dynamic_fps) {
uint32_t min_fps = current_mode.vrefresh;
uint32_t max_fps = current_mode.vrefresh;
for (uint32_t mode_index = 0; mode_index < connector_info_.modes.size(); mode_index++) {
- if ((current_mode.vdisplay == connector_info_.modes[mode_index].vdisplay) &&
- (current_mode.hdisplay == connector_info_.modes[mode_index].hdisplay)) {
- if (min_fps > connector_info_.modes[mode_index].vrefresh) {
- min_fps = connector_info_.modes[mode_index].vrefresh;
+ if ((current_mode.vdisplay == connector_info_.modes[mode_index].mode.vdisplay) &&
+ (current_mode.hdisplay == connector_info_.modes[mode_index].mode.hdisplay)) {
+ if (min_fps > connector_info_.modes[mode_index].mode.vrefresh) {
+ min_fps = connector_info_.modes[mode_index].mode.vrefresh;
}
- if (max_fps < connector_info_.modes[mode_index].vrefresh) {
- max_fps = connector_info_.modes[mode_index].vrefresh;
+ if (max_fps < connector_info_.modes[mode_index].mode.vrefresh) {
+ max_fps = connector_info_.modes[mode_index].mode.vrefresh;
}
}
}
@@ -676,13 +676,21 @@
DLOGE("Invalid mode index %d mode size %d", index, UINT32(display_attributes_.size()));
return kErrorParameters;
}
+
current_mode_index_ = index;
- // TODO(user): Topology/panel roi alignment information will be updated as a part of next commit
- // which is too late for the requested mode that has different panel alignments. So driver needs
- // to update panel/topology information for all modes during probe to reslove this issue.
PopulateHWPanelInfo();
UpdateMixerAttributes();
- switch_mode_ = true;
+
+ DLOGI("Display attributes[%d]: WxH: %dx%d, DPI: %fx%f, FPS: %d, LM_SPLIT: %d, V_BACK_PORCH: %d," \
+ " V_FRONT_PORCH: %d, V_PULSE_WIDTH: %d, V_TOTAL: %d, H_TOTAL: %d, CLK: %dKHZ, TOPOLOGY: %d",
+ index, display_attributes_[index].x_pixels, display_attributes_[index].y_pixels,
+ display_attributes_[index].x_dpi, display_attributes_[index].y_dpi,
+ display_attributes_[index].fps, display_attributes_[index].is_device_split,
+ display_attributes_[index].v_back_porch, display_attributes_[index].v_front_porch,
+ display_attributes_[index].v_pulse_width, display_attributes_[index].v_total,
+ display_attributes_[index].h_total, display_attributes_[index].clock_khz,
+ display_attributes_[index].topology);
+
return kErrorNone;
}
@@ -701,6 +709,10 @@
return kErrorUndefined;
}
+ if (first_cycle_) {
+ return kErrorNone;
+ }
+
drm_atomic_intf_->Perform(DRMOps::CRTC_SET_ACTIVE, token_.crtc_id, 1);
drm_atomic_intf_->Perform(DRMOps::CONNECTOR_SET_POWER_MODE, token_.conn_id, DRMPowerMode::ON);
int ret = drm_atomic_intf_->Commit(true /* synchronous */, true /* retain_planes */);
@@ -771,7 +783,7 @@
HWQosData &qos_data = hw_layers->qos_data;
DRMSecurityLevel crtc_security_level = DRMSecurityLevel::SECURE_NON_SECURE;
uint32_t index = current_mode_index_;
- drmModeModeInfo current_mode = connector_info_.modes[index];
+ drmModeModeInfo current_mode = connector_info_.modes[index].mode;
solid_fills_.clear();
@@ -908,14 +920,20 @@
// Set refresh rate
if (vrefresh_) {
for (uint32_t mode_index = 0; mode_index < connector_info_.modes.size(); mode_index++) {
- if ((current_mode.vdisplay == connector_info_.modes[mode_index].vdisplay) &&
- (current_mode.hdisplay == connector_info_.modes[mode_index].hdisplay) &&
- (vrefresh_ == connector_info_.modes[mode_index].vrefresh)) {
- current_mode = connector_info_.modes[mode_index];
+ if ((current_mode.vdisplay == connector_info_.modes[mode_index].mode.vdisplay) &&
+ (current_mode.hdisplay == connector_info_.modes[mode_index].mode.hdisplay) &&
+ (vrefresh_ == connector_info_.modes[mode_index].mode.vrefresh)) {
+ current_mode = connector_info_.modes[mode_index].mode;
break;
}
}
}
+
+ if (first_cycle_) {
+ drm_atomic_intf_->Perform(DRMOps::CONNECTOR_SET_CRTC, token_.conn_id, token_.crtc_id);
+ drm_atomic_intf_->Perform(DRMOps::CONNECTOR_SET_POWER_MODE, token_.conn_id, DRMPowerMode::ON);
+ }
+
drm_atomic_intf_->Perform(DRMOps::CRTC_SET_MODE, token_.crtc_id, ¤t_mode);
drm_atomic_intf_->Perform(DRMOps::CRTC_SET_ACTIVE, token_.crtc_id, 1);
@@ -1082,11 +1100,11 @@
if (vrefresh_) {
// Update current mode index if refresh rate is changed
- drmModeModeInfo current_mode = connector_info_.modes[current_mode_index_];
+ drmModeModeInfo current_mode = connector_info_.modes[current_mode_index_].mode;
for (uint32_t mode_index = 0; mode_index < connector_info_.modes.size(); mode_index++) {
- if ((current_mode.vdisplay == connector_info_.modes[mode_index].vdisplay) &&
- (current_mode.hdisplay == connector_info_.modes[mode_index].hdisplay) &&
- (vrefresh_ == connector_info_.modes[mode_index].vrefresh)) {
+ if ((current_mode.vdisplay == connector_info_.modes[mode_index].mode.vdisplay) &&
+ (current_mode.hdisplay == connector_info_.modes[mode_index].mode.hdisplay) &&
+ (vrefresh_ == connector_info_.modes[mode_index].mode.vrefresh)) {
current_mode_index_ = mode_index;
break;
}
@@ -1094,12 +1112,7 @@
vrefresh_ = 0;
}
- if (switch_mode_) {
- // Reload connector info for updated info after 1st commit
- drm_mgr_intf_->GetConnectorInfo(token_.conn_id, &connector_info_);
- PopulateHWPanelInfo();
- switch_mode_ = false;
- }
+ first_cycle_ = false;
return kErrorNone;
}
@@ -1281,11 +1294,11 @@
DisplayError HWDeviceDRM::SetRefreshRate(uint32_t refresh_rate) {
// Check if requested refresh rate is valid
- drmModeModeInfo current_mode = connector_info_.modes[current_mode_index_];
+ drmModeModeInfo current_mode = connector_info_.modes[current_mode_index_].mode;
for (uint32_t mode_index = 0; mode_index < connector_info_.modes.size(); mode_index++) {
- if ((current_mode.vdisplay == connector_info_.modes[mode_index].vdisplay) &&
- (current_mode.hdisplay == connector_info_.modes[mode_index].hdisplay) &&
- (refresh_rate == connector_info_.modes[mode_index].vrefresh)) {
+ if ((current_mode.vdisplay == connector_info_.modes[mode_index].mode.vdisplay) &&
+ (current_mode.hdisplay == connector_info_.modes[mode_index].mode.hdisplay) &&
+ (refresh_rate == connector_info_.modes[mode_index].mode.vrefresh)) {
vrefresh_ = refresh_rate;
DLOGV_IF(kTagDriverConfig, "Set refresh rate to %d", refresh_rate);
return kErrorNone;
diff --git a/sdm/libs/core/drm/hw_device_drm.h b/sdm/libs/core/drm/hw_device_drm.h
index e02d936..16355c8 100644
--- a/sdm/libs/core/drm/hw_device_drm.h
+++ b/sdm/libs/core/drm/hw_device_drm.h
@@ -183,7 +183,6 @@
std::vector<sde_drm::DRMSolidfillStage> solid_fills_ {};
bool resolution_switch_enabled_ = false;
uint32_t vrefresh_ = 0;
- bool switch_mode_ = false;
bool autorefresh_ = false;
};
diff --git a/sdm/libs/core/drm/hw_peripheral_drm.cpp b/sdm/libs/core/drm/hw_peripheral_drm.cpp
index e78c862..44c22e7 100644
--- a/sdm/libs/core/drm/hw_peripheral_drm.cpp
+++ b/sdm/libs/core/drm/hw_peripheral_drm.cpp
@@ -35,7 +35,6 @@
using sde_drm::DRMDisplayType;
using sde_drm::DRMOps;
-using sde_drm::DRMTopology;
using sde_drm::DRMPowerMode;
namespace sdm {
@@ -57,41 +56,11 @@
scalar_data_.resize(hw_resource_.hw_dest_scalar_info.count);
- drm_mgr_intf_->GetConnectorInfo(token_.conn_id, &connector_info_);
- if (connector_info_.topology == DRMTopology::UNKNOWN) {
- connector_info_.topology = DRMTopology::DUAL_LM;
- if (connector_info_.modes[current_mode_index_].hdisplay <= 1080) {
- connector_info_.topology = DRMTopology::SINGLE_LM;
- }
- }
-
- InitializeConfigs();
- PopulateHWPanelInfo();
- UpdateMixerAttributes();
-
return kErrorNone;
}
DisplayError HWPeripheralDRM::Validate(HWLayers *hw_layers) {
- // Hijack the first validate to setup pipeline. This is a stopgap solution
HWLayersInfo &hw_layer_info = hw_layers->info;
- if (first_cycle_) {
- drm_atomic_intf_->Perform(DRMOps::CONNECTOR_SET_CRTC, token_.conn_id, token_.crtc_id);
- drm_atomic_intf_->Perform(DRMOps::CONNECTOR_SET_POWER_MODE, token_.conn_id, DRMPowerMode::ON);
- drm_atomic_intf_->Perform(DRMOps::CRTC_SET_MODE, token_.crtc_id,
- &connector_info_.modes[current_mode_index_]);
- drm_atomic_intf_->Perform(DRMOps::CRTC_SET_ACTIVE, token_.crtc_id, 1);
- if (drm_atomic_intf_->Commit(true /* synchronous */, false /* retain pipes*/)) {
- DLOGE("Setting up CRTC %d, Connector %d for %s failed",
- token_.crtc_id, token_.conn_id, device_name_);
- return kErrorResources;
- }
- // Reload connector info for updated info after 1st commit
- drm_mgr_intf_->GetConnectorInfo(token_.conn_id, &connector_info_);
- PopulateDisplayAttributes(current_mode_index_);
- PopulateHWPanelInfo();
- first_cycle_ = false;
- }
SetDestScalarData(hw_layer_info);
return HWDeviceDRM::Validate(hw_layers);
@@ -104,14 +73,6 @@
return HWDeviceDRM::Commit(hw_layers);
}
-DisplayError HWPeripheralDRM::PowerOn() {
- if (first_cycle_) {
- return kErrorNone;
- }
-
- return HWDeviceDRM::PowerOn();
-}
-
void HWPeripheralDRM::ResetDisplayParams() {
sde_dest_scalar_data_ = {};
for (uint32_t j = 0; j < scalar_data_.size(); j++) {
diff --git a/sdm/libs/core/drm/hw_peripheral_drm.h b/sdm/libs/core/drm/hw_peripheral_drm.h
index 0b596ad..e4b33cf 100644
--- a/sdm/libs/core/drm/hw_peripheral_drm.h
+++ b/sdm/libs/core/drm/hw_peripheral_drm.h
@@ -46,7 +46,6 @@
virtual DisplayError Init();
virtual DisplayError Validate(HWLayers *hw_layers);
virtual DisplayError Commit(HWLayers *hw_layers);
- virtual DisplayError PowerOn();
virtual DisplayError Flush();
private:
void SetDestScalarData(HWLayersInfo hw_layer_info);
diff --git a/sdm/libs/core/drm/hw_tv_drm.cpp b/sdm/libs/core/drm/hw_tv_drm.cpp
index b2075a8..565652e 100644
--- a/sdm/libs/core/drm/hw_tv_drm.cpp
+++ b/sdm/libs/core/drm/hw_tv_drm.cpp
@@ -67,54 +67,26 @@
device_name_ = "TV Display Device";
}
-DisplayError HWTVDRM::Init() {
- DisplayError error = HWDeviceDRM::Init();
- if (error != kErrorNone) {
- DLOGE("Init failed for %s", device_name_);
- return error;
- }
- drm_mgr_intf_->GetConnectorInfo(token_.conn_id, &connector_info_);
-
- InitializeConfigs();
-
- return error;
-}
-
DisplayError HWTVDRM::SetDisplayAttributes(uint32_t index) {
if (index >= connector_info_.modes.size()) {
DLOGE("Invalid mode index %d mode size %d", index, UINT32(connector_info_.modes.size()));
return kErrorNotSupported;
}
- if (first_cycle_) {
- drm_atomic_intf_->Perform(DRMOps::CONNECTOR_SET_CRTC, token_.conn_id, token_.crtc_id);
- }
-
- drm_atomic_intf_->Perform(DRMOps::CRTC_SET_MODE, token_.crtc_id, &connector_info_.modes[index]);
- drm_atomic_intf_->Perform(DRMOps::CRTC_SET_ACTIVE, token_.crtc_id, 1);
-
- // Commit to setup pipeline with mode, which then tells us the topology etc
- if (drm_atomic_intf_->Commit(true /* synchronous */, false /* retain_planes*/)) {
- DLOGE("Setting up CRTC %d, Connector %d for %s failed", token_.crtc_id,
- token_.conn_id, device_name_);
- return kErrorResources;
- }
-
- DLOGI("Setup CRTC %d, Connector %d for %s", token_.crtc_id, token_.conn_id, device_name_);
- first_cycle_ = false;
-
- // Reload connector info for updated info after 1st commit
- drm_mgr_intf_->GetConnectorInfo(token_.conn_id, &connector_info_);
- if (index >= connector_info_.modes.size()) {
- DLOGE("Invalid mode index %d mode size %d", index, UINT32(connector_info_.modes.size()));
- return kErrorNotSupported;
- }
-
current_mode_index_ = index;
- PopulateDisplayAttributes(index);
PopulateHWPanelInfo();
UpdateMixerAttributes();
+ DLOGI("Display attributes[%d]: WxH: %dx%d, DPI: %fx%f, FPS: %d, LM_SPLIT: %d, V_BACK_PORCH: %d," \
+ " V_FRONT_PORCH: %d, V_PULSE_WIDTH: %d, V_TOTAL: %d, H_TOTAL: %d, CLK: %dKHZ, TOPOLOGY: %d",
+ index, display_attributes_[index].x_pixels, display_attributes_[index].y_pixels,
+ display_attributes_[index].x_dpi, display_attributes_[index].y_dpi,
+ display_attributes_[index].fps, display_attributes_[index].is_device_split,
+ display_attributes_[index].v_back_porch, display_attributes_[index].v_front_porch,
+ display_attributes_[index].v_pulse_width, display_attributes_[index].v_total,
+ display_attributes_[index].h_total, display_attributes_[index].clock_khz,
+ display_attributes_[index].topology);
+
return kErrorNone;
}
@@ -134,15 +106,15 @@
}
for (size_t idex = 0; idex < connector_info_.modes.size(); idex ++) {
- if ((height == connector_info_.modes[idex].vdisplay) &&
- (width == connector_info_.modes[idex].hdisplay) &&
- (fps == connector_info_.modes[idex].vrefresh)) {
- if ((format >> 1) & (connector_info_.modes[idex].flags >> kBitYUV)) {
+ if ((height == connector_info_.modes[idex].mode.vdisplay) &&
+ (width == connector_info_.modes[idex].mode.hdisplay) &&
+ (fps == connector_info_.modes[idex].mode.vrefresh)) {
+ if ((format >> 1) & (connector_info_.modes[idex].mode.flags >> kBitYUV)) {
*index = UINT32(idex);
break;
}
- if (format & (connector_info_.modes[idex].flags >> kBitRGB)) {
+ if (format & (connector_info_.modes[idex].mode.flags >> kBitRGB)) {
*index = UINT32(idex);
break;
}
diff --git a/sdm/libs/core/drm/hw_tv_drm.h b/sdm/libs/core/drm/hw_tv_drm.h
index ff07ac2..54ce327 100644
--- a/sdm/libs/core/drm/hw_tv_drm.h
+++ b/sdm/libs/core/drm/hw_tv_drm.h
@@ -40,7 +40,6 @@
HWInfoInterface *hw_info_intf);
protected:
- virtual DisplayError Init();
virtual DisplayError SetDisplayAttributes(uint32_t index);
virtual DisplayError GetConfigIndex(char *mode, uint32_t *index);
virtual DisplayError PowerOff();
diff --git a/sdm/libs/core/drm/hw_virtual_drm.cpp b/sdm/libs/core/drm/hw_virtual_drm.cpp
index 5f07fd3..28d81bb 100644
--- a/sdm/libs/core/drm/hw_virtual_drm.cpp
+++ b/sdm/libs/core/drm/hw_virtual_drm.cpp
@@ -39,12 +39,15 @@
#define __CLASS__ "HWVirtualDRM"
+using std::vector;
+
using sde_drm::DRMDisplayType;
using sde_drm::DRMConnectorInfo;
using sde_drm::DRMRect;
using sde_drm::DRMOps;
using sde_drm::DRMPowerMode;
using sde_drm::DRMSecureMode;
+
namespace sdm {
HWVirtualDRM::HWVirtualDRM(BufferSyncHandler *buffer_sync_handler,
@@ -83,24 +86,29 @@
}
DisplayError HWVirtualDRM::SetWbConfigs(const HWDisplayAttributes &display_attributes) {
- int ret = -EINVAL;
- int mode_index = -1;
- // Add new connector mode to the list
drmModeModeInfo mode = {};
+ vector<drmModeModeInfo> modes;
+
mode.hdisplay = mode.hsync_start = mode.hsync_end = mode.htotal =
UINT16(display_attributes.x_pixels);
mode.vdisplay = mode.vsync_start = mode.vsync_end = mode.vtotal =
UINT16(display_attributes.y_pixels);
mode.vrefresh = UINT32(display_attributes.fps);
mode.clock = (mode.htotal * mode.vtotal * mode.vrefresh) / 1000;
- connector_info_.modes.push_back(mode);
+ snprintf(mode.name, DRM_DISPLAY_MODE_LEN, "%dx%d", mode.hdisplay, mode.vdisplay);
+ modes.push_back(mode);
+ for (auto &item : connector_info_.modes) {
+ modes.push_back(item.mode);
+ }
// Inform the updated mode list to the driver
struct sde_drm_wb_cfg wb_cfg = {};
wb_cfg.connector_id = token_.conn_id;
wb_cfg.flags = SDE_DRM_WB_CFG_FLAGS_CONNECTED;
- wb_cfg.count_modes = UINT32(connector_info_.modes.size());
- wb_cfg.modes = (uint64_t)connector_info_.modes.data();
+ wb_cfg.count_modes = UINT32(modes.size());
+ wb_cfg.modes = (uint64_t)modes.data();
+
+ int ret = -EINVAL;
#ifdef DRM_IOCTL_SDE_WB_CONFIG
ret = drmIoctl(dev_fd_, DRM_IOCTL_SDE_WB_CONFIG, &wb_cfg);
#endif
@@ -109,45 +117,19 @@
DumpConnectorModeInfo();
return kErrorHardware;
}
- // Reload connector info for updated info after null commit
- drm_mgr_intf_->GetConnectorInfo(token_.conn_id, &connector_info_);
- // TODO(user): Remove this code once driver populates appropriate topology based on virtual
- // display configuration
- if (connector_info_.topology == sde_drm::DRMTopology::UNKNOWN) {
- uint32_t max_width = 0;
- for (uint32_t i = 0; i < (uint32_t)connector_info_.modes.size(); i++) {
- max_width = std::max(max_width, UINT32(connector_info_.modes[i].hdisplay));
- }
- connector_info_.topology = sde_drm::DRMTopology::SINGLE_LM;
- if (max_width > hw_resource_.max_mixer_width) {
- connector_info_.topology = sde_drm::DRMTopology::DUAL_LM_MERGE;
- }
- }
- InitializeConfigs();
-
- GetModeIndex(display_attributes, &mode_index);
- if (mode_index < 0) {
- DLOGE("Mode not found for resolution %dx%d fps %d", display_attributes.x_pixels,
- display_attributes.y_pixels, UINT32(display_attributes.fps));
- DumpConnectorModeInfo();
- return kErrorNotSupported;
- }
- current_mode_index_ = UINT32(mode_index);
-
- DumpConnectorModeInfo();
return kErrorNone;
}
void HWVirtualDRM::DumpConnectorModeInfo() {
for (uint32_t i = 0; i < (uint32_t)connector_info_.modes.size(); i++) {
- DLOGI("Mode[%d]: Name: %s\tvref: %d\thdisp: %d\t hsync_s: %d\thsync_e:%d\thtotal: %d\t" \
- "vdisp: %d\tvsync_s: %d\tvsync_e: %d\tvtotal: %d\n", i, connector_info_.modes[i].name,
- connector_info_.modes[i].vrefresh, connector_info_.modes[i].hdisplay,
- connector_info_.modes[i].hsync_start, connector_info_.modes[i].hsync_end,
- connector_info_.modes[i].htotal, connector_info_.modes[i].vdisplay,
- connector_info_.modes[i].vsync_start, connector_info_.modes[i].vsync_end,
- connector_info_.modes[i].vtotal);
+ DLOGI("Mode[%d] Name:%s vref:%d hdisp:%d hsync_s:%d hsync_e:%d htotal:%d " \
+ "vdisp:%d vsync_s:%d vsync_e:%d vtotal:%d\n", i, connector_info_.modes[i].mode.name,
+ connector_info_.modes[i].mode.vrefresh, connector_info_.modes[i].mode.hdisplay,
+ connector_info_.modes[i].mode.hsync_start, connector_info_.modes[i].mode.hsync_end,
+ connector_info_.modes[i].mode.htotal, connector_info_.modes[i].mode.vdisplay,
+ connector_info_.modes[i].mode.vsync_start, connector_info_.modes[i].mode.vsync_end,
+ connector_info_.modes[i].mode.vtotal);
}
}
@@ -155,12 +137,6 @@
LayerBuffer *output_buffer = hw_layers->info.stack->output_buffer;
DisplayError err = kErrorNone;
- if (first_cycle_) {
- drm_atomic_intf_->Perform(DRMOps::CONNECTOR_SET_CRTC, token_.conn_id, token_.crtc_id);
- drm_atomic_intf_->Perform(DRMOps::CONNECTOR_SET_POWER_MODE, token_.conn_id, DRMPowerMode::ON);
- first_cycle_ = false;
- }
-
registry_.RegisterCurrent(hw_layers);
registry_.MapBufferToFbId(output_buffer);
uint32_t fb_id = registry_.GetFbId(output_buffer->planes[0].fd);
@@ -181,11 +157,6 @@
DisplayError HWVirtualDRM::Validate(HWLayers *hw_layers) {
LayerBuffer *output_buffer = hw_layers->info.stack->output_buffer;
- if (first_cycle_) {
- drm_atomic_intf_->Perform(DRMOps::CONNECTOR_SET_CRTC, token_.conn_id, token_.crtc_id);
- drm_atomic_intf_->Perform(DRMOps::CONNECTOR_SET_POWER_MODE, token_.conn_id, DRMPowerMode::ON);
- }
-
registry_.MapBufferToFbId(output_buffer);
uint32_t fb_id = registry_.GetFbId(output_buffer->planes[0].fd);
@@ -203,30 +174,36 @@
int mode_index = -1;
GetModeIndex(display_attributes, &mode_index);
+
if (mode_index < 0) {
DisplayError error = SetWbConfigs(display_attributes);
if (error != kErrorNone) {
return error;
}
- } else {
- current_mode_index_ = UINT32(mode_index);
}
+
+ // Reload connector info for updated info
+ drm_mgr_intf_->GetConnectorInfo(token_.conn_id, &connector_info_);
+ GetModeIndex(display_attributes, &mode_index);
+
+ if (mode_index < 0) {
+ DLOGE("Mode not found for resolution %dx%d fps %d", display_attributes.x_pixels,
+ display_attributes.y_pixels, UINT32(display_attributes.fps));
+ DumpConnectorModeInfo();
+ return kErrorNotSupported;
+ }
+
+ current_mode_index_ = UINT32(mode_index);
+ InitializeConfigs();
PopulateHWPanelInfo();
UpdateMixerAttributes();
DLOGI("New WB Resolution: %dx%d cur_mode_index %d", display_attributes.x_pixels,
display_attributes.y_pixels, current_mode_index_);
+
return kErrorNone;
}
-DisplayError HWVirtualDRM::PowerOn() {
- if (first_cycle_) {
- return kErrorNone;
- }
-
- return HWDeviceDRM::PowerOn();
-}
-
DisplayError HWVirtualDRM::GetPPFeaturesVersion(PPFeatureVersion *vers) {
return kErrorNone;
}
@@ -234,9 +211,9 @@
void HWVirtualDRM::GetModeIndex(const HWDisplayAttributes &display_attributes, int *mode_index) {
*mode_index = -1;
for (uint32_t i = 0; i < connector_info_.modes.size(); i++) {
- if (display_attributes.x_pixels == connector_info_.modes[i].hdisplay &&
- display_attributes.y_pixels == connector_info_.modes[i].vdisplay &&
- display_attributes.fps == connector_info_.modes[i].vrefresh) {
+ if (display_attributes.x_pixels == connector_info_.modes[i].mode.hdisplay &&
+ display_attributes.y_pixels == connector_info_.modes[i].mode.vdisplay &&
+ display_attributes.fps == connector_info_.modes[i].mode.vrefresh) {
*mode_index = INT32(i);
break;
}
diff --git a/sdm/libs/core/drm/hw_virtual_drm.h b/sdm/libs/core/drm/hw_virtual_drm.h
index 29ef7b2..257e08a 100644
--- a/sdm/libs/core/drm/hw_virtual_drm.h
+++ b/sdm/libs/core/drm/hw_virtual_drm.h
@@ -47,7 +47,6 @@
return kErrorNotSupported;
}
virtual DisplayError SetDisplayAttributes(const HWDisplayAttributes &display_attributes);
- virtual DisplayError PowerOn();
protected:
virtual DisplayError Validate(HWLayers *hw_layers);
diff --git a/sdm/libs/core/dump_impl.cpp b/sdm/libs/core/dump_impl.cpp
deleted file mode 100644
index 655b210..0000000
--- a/sdm/libs/core/dump_impl.cpp
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
-* Copyright (c) 2014, 2016, 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:
-* * Redistributions of source code must retain the above copyright notice, this list of
-* conditions and the following disclaimer.
-* * Redistributions in binary form must reproduce the above copyright notice, this list of
-* conditions and the following disclaimer in the documentation and/or other materials provided
-* with the distribution.
-* * Neither the name of The Linux Foundation nor the names of its contributors may be used to
-* endorse or promote products derived from this software without specific prior written
-* permission.
-*
-* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
-* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
-* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#include <stdarg.h>
-#include <stdio.h>
-#include <string.h>
-#include <utils/constants.h>
-
-#include "dump_impl.h"
-
-namespace sdm {
-
-DumpImpl* DumpImpl::dump_list_[] = { 0 };
-uint32_t DumpImpl::dump_count_ = 0;
-
-DisplayError DumpInterface::GetDump(char *buffer, uint32_t length) {
- if (!buffer || !length) {
- return kErrorParameters;
- }
-
- buffer[0] = '\0';
- DumpImpl::AppendString(buffer, length, "\n-------- Snapdragon Display Manager --------");
- for (uint32_t i = 0; i < DumpImpl::dump_count_; i++) {
- DumpImpl::dump_list_[i]->AppendDump(buffer, length);
- }
- DumpImpl::AppendString(buffer, length, "\n\n");
-
- return kErrorNone;
-}
-
-DumpImpl::DumpImpl() {
- Register(this);
-}
-
-DumpImpl::~DumpImpl() {
- Unregister(this);
-}
-
-void DumpImpl::AppendString(char *buffer, uint32_t length, const char *format, ...) {
- uint32_t filled = UINT32(strlen(buffer));
- // Reserve one byte for null terminating character
- if ((filled + 1) >= length) {
- return;
- }
- buffer += filled;
-
- va_list list;
- va_start(list, format);
- vsnprintf(buffer, length - filled -1, format, list);
-}
-
-// Every object is created or destroyed through display core only, which itself protects the
-// the access, so no need to protect registration or de-registration.
-void DumpImpl::Register(DumpImpl *dump_impl) {
- if (dump_count_ < kMaxDumpObjects) {
- dump_list_[dump_count_] = dump_impl;
- dump_count_++;
- }
-}
-
-void DumpImpl::Unregister(DumpImpl *dump_impl) {
- for (uint32_t i = 0; i < dump_count_; i++) {
- if (dump_list_[i] == dump_impl) {
- dump_count_--;
- for (; i < dump_count_; i++) {
- dump_list_[i] = dump_list_[i + 1];
- }
- }
- }
-}
-
-} // namespace sdm
-
diff --git a/sdm/libs/core/dump_impl.h b/sdm/libs/core/dump_impl.h
deleted file mode 100644
index 68e7584..0000000
--- a/sdm/libs/core/dump_impl.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
-* Copyright (c) 2014, 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:
-* * Redistributions of source code must retain the above copyright notice, this list of
-* conditions and the following disclaimer.
-* * Redistributions in binary form must reproduce the above copyright notice, this list of
-* conditions and the following disclaimer in the documentation and/or other materials provided
-* with the distribution.
-* * Neither the name of The Linux Foundation nor the names of its contributors may be used to
-* endorse or promote products derived from this software without specific prior written
-* permission.
-*
-* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
-* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
-* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#ifndef __DUMP_IMPL_H__
-#define __DUMP_IMPL_H__
-
-#include <core/dump_interface.h>
-
-namespace sdm {
-
-class DumpImpl {
- public:
- // To be implemented in the modules which will add dump information to final dump buffer.
- // buffer address & length will be already adjusted before calling into these modules.
- virtual void AppendDump(char *buffer, uint32_t length) = 0;
- static void AppendString(char *buffer, uint32_t length, const char *format, ...);
-
- protected:
- DumpImpl();
- virtual ~DumpImpl();
-
- private:
- static const uint32_t kMaxDumpObjects = 32;
-
- static void Register(DumpImpl *dump_impl);
- static void Unregister(DumpImpl *dump_impl);
-
- static DumpImpl *dump_list_[kMaxDumpObjects];
- static uint32_t dump_count_;
-
- friend class DumpInterface;
-};
-
-} // namespace sdm
-
-#endif // __DUMP_IMPL_H__
-
diff --git a/sdm/libs/hwc2/display_null.h b/sdm/libs/hwc2/display_null.h
index cde9991..f6c0dda 100644
--- a/sdm/libs/hwc2/display_null.h
+++ b/sdm/libs/hwc2/display_null.h
@@ -97,6 +97,7 @@
MAKE_NO_OP(SetCompositionState(LayerComposition, bool))
MAKE_NO_OP(GetClientTargetSupport(uint32_t, uint32_t, LayerBufferFormat,
const ColorMetaData &))
+ std::string Dump() { return ""; }
private:
bool active_ = false;
diff --git a/sdm/libs/hwc2/hwc_color_manager.cpp b/sdm/libs/hwc2/hwc_color_manager.cpp
index 5b6720a..8023b6a 100644
--- a/sdm/libs/hwc2/hwc_color_manager.cpp
+++ b/sdm/libs/hwc2/hwc_color_manager.cpp
@@ -37,7 +37,6 @@
#include <hardware/hwcomposer_defs.h>
#include <QService.h>
-#include <core/dump_interface.h>
#include <utils/constants.h>
#include <utils/debug.h>
#include <core/buffer_allocator.h>
diff --git a/sdm/libs/hwc2/hwc_display.cpp b/sdm/libs/hwc2/hwc_display.cpp
index 7928235..a89147c 100644
--- a/sdm/libs/hwc2/hwc_display.cpp
+++ b/sdm/libs/hwc2/hwc_display.cpp
@@ -1989,7 +1989,7 @@
std::string HWCDisplay::Dump() {
std::ostringstream os;
- os << "-------------------------------" << std::endl;
+ os << "\n------------HWC----------------\n";
os << "HWC2 display_id: " << id_ << std::endl;
for (auto layer : layer_set_) {
auto sdm_layer = layer->GetSDMLayer();
@@ -2009,10 +2009,19 @@
os << " buffer_id: " << std::hex << "0x" << sdm_layer->input_buffer.buffer_id << std::dec
<< std::endl;
}
+
if (color_mode_) {
+ os << "\n----------Color Modes---------\n";
color_mode_->Dump(&os);
}
- os << "-------------------------------" << std::endl;
+
+ if (display_intf_) {
+ os << "\n------------SDM----------------\n";
+ os << display_intf_->Dump();
+ }
+
+ os << "\n";
+
return os.str();
}
diff --git a/sdm/libs/hwc2/hwc_display.h b/sdm/libs/hwc2/hwc_display.h
index 1fe43af..c775bc7 100644
--- a/sdm/libs/hwc2/hwc_display.h
+++ b/sdm/libs/hwc2/hwc_display.h
@@ -122,7 +122,7 @@
virtual DisplayError SetMixerResolution(uint32_t width, uint32_t height);
virtual DisplayError GetMixerResolution(uint32_t *width, uint32_t *height);
virtual void GetPanelResolution(uint32_t *width, uint32_t *height);
- virtual std::string Dump(void);
+ virtual std::string Dump();
// Captures frame output in the buffer specified by output_buffer_info. The API is
// non-blocking and the client is expected to check operation status later on.
diff --git a/sdm/libs/hwc2/hwc_display_primary.cpp b/sdm/libs/hwc2/hwc_display_primary.cpp
index 50f5aeb..d728afa 100644
--- a/sdm/libs/hwc2/hwc_display_primary.cpp
+++ b/sdm/libs/hwc2/hwc_display_primary.cpp
@@ -379,9 +379,12 @@
DLOGI("SecureDisplay state changed from %d to %d Needs Flush!!", secure_display_active_,
secure_display_active);
secure_display_active_ = secure_display_active;
- skip_prepare_ = true;
+
+ // Avoid flush for Command mode panel.
+ DisplayConfigFixedInfo display_config;
+ display_intf_->GetConfig(&display_config);
+ skip_prepare_ = !display_config.is_cmdmode;
}
- return;
}
void HWCDisplayPrimary::ForceRefreshRate(uint32_t refresh_rate) {
diff --git a/sdm/libs/hwc2/hwc_session.cpp b/sdm/libs/hwc2/hwc_session.cpp
index e0ac992..a7f210a 100644
--- a/sdm/libs/hwc2/hwc_session.cpp
+++ b/sdm/libs/hwc2/hwc_session.cpp
@@ -17,7 +17,6 @@
* limitations under the License.
*/
-#include <core/dump_interface.h>
#include <core/buffer_allocator.h>
#include <private/color_params.h>
#include <utils/constants.h>
@@ -402,22 +401,20 @@
if (!device || !out_size) {
return;
}
+
auto *hwc_session = static_cast<HWCSession *>(device);
const size_t max_dump_size = 8192;
if (out_buffer == nullptr) {
*out_size = max_dump_size;
} else {
- char sdm_dump[4096];
- DumpInterface::GetDump(sdm_dump, 4096); // TODO(user): Fix this workaround
- std::string s("");
+ std::string s {};
for (int id = HWC_DISPLAY_PRIMARY; id <= HWC_DISPLAY_VIRTUAL; id++) {
SEQUENCE_WAIT_SCOPE_LOCK(locker_[id]);
if (hwc_session->hwc_display_[id]) {
s += hwc_session->hwc_display_[id]->Dump();
}
}
- s += sdm_dump;
auto copied = s.copy(out_buffer, std::min(s.size(), max_dump_size), 0);
*out_size = UINT32(copied);
}
@@ -536,21 +533,43 @@
int32_t HWCSession::PresentDisplay(hwc2_device_t *device, hwc2_display_t display,
int32_t *out_retire_fence) {
HWCSession *hwc_session = static_cast<HWCSession *>(device);
- DTRACE_SCOPED();
- SEQUENCE_EXIT_SCOPE_LOCK(locker_[display]);
- if (!device) {
- return HWC2_ERROR_BAD_DISPLAY;
- }
- if (out_retire_fence == nullptr) {
- return HWC2_ERROR_BAD_PARAMETER;
- }
+ bool notify_hotplug = false;
auto status = HWC2::Error::BadDisplay;
- // TODO(user): Handle virtual display/HDMI concurrency
- if (hwc_session->hwc_display_[display]) {
- status = hwc_session->hwc_display_[display]->Present(out_retire_fence);
- // This is only indicative of how many times SurfaceFlinger posts
- // frames to the display.
- CALC_FPS();
+ DTRACE_SCOPED();
+ {
+ SEQUENCE_EXIT_SCOPE_LOCK(locker_[display]);
+ if (!device) {
+ return HWC2_ERROR_BAD_DISPLAY;
+ }
+
+ if (out_retire_fence == nullptr) {
+ return HWC2_ERROR_BAD_PARAMETER;
+ }
+
+ // TODO(user): Handle virtual display/HDMI concurrency
+ if (hwc_session->hwc_display_[display]) {
+ status = hwc_session->hwc_display_[display]->Present(out_retire_fence);
+ // This is only indicative of how many times SurfaceFlinger posts
+ // frames to the display.
+ CALC_FPS();
+ }
+ }
+
+ // Handle Pending external display connection
+ if (hwc_session->external_pending_connect_ && (display == HWC_DISPLAY_PRIMARY)) {
+ Locker::ScopeLock lock_e(locker_[HWC_DISPLAY_EXTERNAL]);
+ Locker::ScopeLock lock_v(locker_[HWC_DISPLAY_VIRTUAL]);
+
+ if (!hwc_session->hwc_display_[HWC_DISPLAY_VIRTUAL]) {
+ DLOGD("Process pending external display connection");
+ hwc_session->ConnectDisplay(HWC_DISPLAY_EXTERNAL);
+ hwc_session->external_pending_connect_ = false;
+ notify_hotplug = true;
+ }
+ }
+
+ if (notify_hotplug) {
+ hwc_session->HotPlug(HWC_DISPLAY_EXTERNAL, HWC2::Connection::Connected);
}
return INT32(status);
@@ -572,6 +591,7 @@
hwc_session->callbacks_.Hotplug(HWC_DISPLAY_PRIMARY, HWC2::Connection::Connected);
}
}
+ hwc_session->need_invalidate_ = false;
hwc_session->callbacks_lock_.Broadcast();
return INT32(error);
}