summaryrefslogtreecommitdiff
path: root/sdm/libs/core
diff options
context:
space:
mode:
authorDaniel Mentz <danielmentz@google.com>2018-03-20 11:19:39 -0700
committerDaniel Mentz <danielmentz@google.com>2018-03-20 17:55:45 -0700
commit78efde6a7b70faf8ac933b2ef649d252e86592e3 (patch)
treec7832a42fd70603f62e76677f6d3dceb49beabb3 /sdm/libs/core
parent00b6586a5f7bc0381137fc1edf48813186d9e342 (diff)
parentaf258e6e07ee239a601164acc51312e7f5815be0 (diff)
downloaddisplay-78efde6a7b70faf8ac933b2ef649d252e86592e3.tar.gz
Merge remote-tracking branch 'goog/qcom/release/LA.UM.7.3.9.08.00.00.385.203' into pi-dev
Conflicts: gralloc/gr_priv_handle.h Bug: 75978020 Change-Id: I01b5024291614ec49da247a9ae283c7bb5283e03
Diffstat (limited to 'sdm/libs/core')
-rw-r--r--sdm/libs/core/display_base.cpp4
-rw-r--r--sdm/libs/core/drm/hw_color_manager_drm.cpp33
-rw-r--r--sdm/libs/core/drm/hw_device_drm.cpp46
-rw-r--r--sdm/libs/core/drm/hw_device_drm.h1
-rw-r--r--sdm/libs/core/drm/hw_events_drm.cpp42
-rw-r--r--sdm/libs/core/drm/hw_tv_drm.cpp29
-rw-r--r--sdm/libs/core/drm/hw_tv_drm.h3
7 files changed, 119 insertions, 39 deletions
diff --git a/sdm/libs/core/display_base.cpp b/sdm/libs/core/display_base.cpp
index c7ee460f..dfd844be 100644
--- a/sdm/libs/core/display_base.cpp
+++ b/sdm/libs/core/display_base.cpp
@@ -488,9 +488,11 @@ DisplayError DisplayBase::SetDisplayState(DisplayState state) {
default:
DLOGE("Spurious state = %d transition requested.", state);
- break;
+ return kErrorParameters;
}
+ DisablePartialUpdateOneFrame();
+
if (error == kErrorNone) {
active_ = active;
state_ = state;
diff --git a/sdm/libs/core/drm/hw_color_manager_drm.cpp b/sdm/libs/core/drm/hw_color_manager_drm.cpp
index 7563647b..295dafdb 100644
--- a/sdm/libs/core/drm/hw_color_manager_drm.cpp
+++ b/sdm/libs/core/drm/hw_color_manager_drm.cpp
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2017, The Linux Foundation. All rights reserved.
+* Copyright (c) 2017-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
@@ -797,14 +797,43 @@ DisplayError HWColorManagerDrm::GetDrmDither(const PPFeatureInfo &in_data,
DRMPPFeatureInfo *out_data) {
DisplayError ret = kErrorNone;
#ifdef PP_DRM_ENABLE
+ struct SDEDitherCfg *sde_dither = NULL;
+ struct drm_msm_dither *mdp_dither = NULL;
+
if (!out_data) {
DLOGE("Invalid input parameter for dither");
return kErrorParameters;
}
- out_data->id = kPPFeaturesMax;
+ sde_dither = (struct SDEDitherCfg *)in_data.GetConfigData();
+ out_data->id = kFeatureDither;
out_data->type = sde_drm::kPropBlob;
out_data->version = in_data.feature_version_;
+ out_data->payload_size = sizeof(struct drm_msm_dither);
+
+ if (in_data.enable_flags_ & kOpsDisable) {
+ out_data->payload = NULL;
+ return ret;
+ } else if (!(in_data.enable_flags_ & kOpsEnable)) {
+ out_data->payload = NULL;
+ return kErrorParameters;
+ }
+
+ mdp_dither = new drm_msm_dither();
+ if (!mdp_dither) {
+ DLOGE("Failed to allocate memory for dither");
+ return kErrorMemory;
+ }
+
+ mdp_dither->flags = 0;
+ std::memcpy(mdp_dither->matrix, sde_dither->dither_matrix,
+ sizeof(sde_dither->dither_matrix));
+ mdp_dither->temporal_en = sde_dither->temporal_en;
+ mdp_dither->c0_bitdepth = sde_dither->g_y_depth;
+ mdp_dither->c1_bitdepth = sde_dither->b_cb_depth;
+ mdp_dither->c2_bitdepth = sde_dither->r_cr_depth;
+ mdp_dither->c3_bitdepth = 0;
+ out_data->payload = mdp_dither;
#endif
return ret;
}
diff --git a/sdm/libs/core/drm/hw_device_drm.cpp b/sdm/libs/core/drm/hw_device_drm.cpp
index c734f4cd..d5bf482d 100644
--- a/sdm/libs/core/drm/hw_device_drm.cpp
+++ b/sdm/libs/core/drm/hw_device_drm.cpp
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2017, The Linux Foundation. All rights reserved.
+* Copyright (c) 2017-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
@@ -57,6 +57,7 @@
#include <unordered_map>
#include <utility>
#include <vector>
+#include <limits>
#include "hw_device_drm.h"
#include "hw_info_interface.h"
@@ -737,6 +738,7 @@ DisplayError HWDeviceDRM::PowerOff() {
return kErrorUndefined;
}
+ SetFullROI();
drm_atomic_intf_->Perform(DRMOps::CONNECTOR_SET_POWER_MODE, token_.conn_id, DRMPowerMode::OFF);
drm_atomic_intf_->Perform(DRMOps::CRTC_SET_ACTIVE, token_.crtc_id, 0);
int ret = drm_atomic_intf_->Commit(true /* synchronous */, false /* retain_planes */);
@@ -918,14 +920,17 @@ void HWDeviceDRM::SetupAtomic(HWLayers *hw_layers, bool validate) {
drm_atomic_intf_->Perform(DRMOps::CRTC_SET_LLCC_IB, token_.crtc_id, qos_data.llcc_ib_bps);
drm_atomic_intf_->Perform(DRMOps::CRTC_SET_DRAM_AB, token_.crtc_id, qos_data.dram_ab_bps);
drm_atomic_intf_->Perform(DRMOps::CRTC_SET_DRAM_IB, token_.crtc_id, qos_data.dram_ib_bps);
+ drm_atomic_intf_->Perform(DRMOps::CRTC_SET_ROT_PREFILL_BW, token_.crtc_id,
+ qos_data.rot_prefill_bw_bps);
drm_atomic_intf_->Perform(DRMOps::CRTC_SET_ROT_CLK, token_.crtc_id, qos_data.rot_clock_hz);
drm_atomic_intf_->Perform(DRMOps::CRTC_SET_SECURITY_LEVEL, token_.crtc_id, crtc_security_level);
- DLOGI_IF(kTagDriverConfig, "System Clock=%d Hz, Core: AB=%llu Bps, IB=%llu Bps, " \
- "LLCC: AB=%llu Bps, IB=%llu Bps, DRAM AB=%llu Bps, IB=%llu Bps Rot Clock=%d",
+ DLOGI_IF(kTagDriverConfig, "%s::%s System Clock=%d Hz, Core: AB=%llu Bps, IB=%llu Bps, " \
+ "LLCC: AB=%llu Bps, IB=%llu Bps, DRAM AB=%llu Bps, IB=%llu Bps, "\
+ "Rot: Bw=%llu Bps, Clock=%d Hz", validate ? "Validate" : "Commit", device_name_,
qos_data.clock_hz, qos_data.core_ab_bps, qos_data.core_ib_bps, qos_data.llcc_ab_bps,
qos_data.llcc_ib_bps, qos_data.dram_ab_bps, qos_data.dram_ib_bps,
- qos_data.rot_clock_hz);
+ qos_data.rot_prefill_bw_bps, qos_data.rot_clock_hz);
// Set refresh rate
if (vrefresh_) {
@@ -1258,13 +1263,18 @@ DisplayError HWDeviceDRM::GetPPFeaturesVersion(PPFeatureVersion *vers) {
DisplayError HWDeviceDRM::SetPPFeatures(PPFeaturesConfig *feature_list) {
int ret = 0;
PPFeatureInfo *feature = NULL;
+ DRMPPFeatureInfo kernel_params = {};
+ bool crtc_feature = true;
while (true) {
- DRMPPFeatureInfo kernel_params = {};
+ crtc_feature = true;
ret = feature_list->RetrieveNextFeature(&feature);
if (ret)
break;
-
+ kernel_params.id = HWColorManagerDrm::ToDrmFeatureId(feature->feature_id_);
+ drm_mgr_intf_->GetCrtcPPInfo(0, &kernel_params);
+ if (kernel_params.version == std::numeric_limits<uint32_t>::max())
+ crtc_feature = false;
if (feature) {
DLOGV_IF(kTagDriverConfig, "feature_id = %d", feature->feature_id_);
auto drm_features = DrmPPfeatureMap_.find(feature->feature_id_);
@@ -1279,9 +1289,11 @@ DisplayError HWDeviceDRM::SetPPFeatures(PPFeaturesConfig *feature_list) {
continue;
}
ret = HWColorManagerDrm::GetDrmFeature[drm_feature](*feature, &kernel_params);
- if (!ret)
- drm_atomic_intf_->Perform(DRMOps::CRTC_SET_POST_PROC, token_.crtc_id, &kernel_params);
- HWColorManagerDrm::FreeDrmFeatureData(&kernel_params);
+ if (!ret && crtc_feature)
+ drm_atomic_intf_->Perform(DRMOps::CRTC_SET_POST_PROC, token_.crtc_id, &kernel_params);
+ else if (!ret && !crtc_feature)
+ drm_atomic_intf_->Perform(DRMOps::CONNECTOR_SET_POST_PROC, token_.conn_id, &kernel_params);
+ HWColorManagerDrm::FreeDrmFeatureData(&kernel_params);
}
}
}
@@ -1484,8 +1496,7 @@ DisplayError HWDeviceDRM::GetMixerAttributes(HWMixerAttributes *mixer_attributes
}
void HWDeviceDRM::GetDRMDisplayToken(sde_drm::DRMDisplayToken *token) const {
- token->conn_id = token_.conn_id;
- token->crtc_id = token_.crtc_id;
+ *token = token_;
}
void HWDeviceDRM::UpdateMixerAttributes() {
@@ -1549,4 +1560,17 @@ void HWDeviceDRM::SetMultiRectMode(const uint32_t flags, DRMMultiRectMode *targe
}
}
+void HWDeviceDRM::SetFullROI() {
+ // Reset the CRTC ROI and connector ROI only for the panel that supports partial update
+ if (!hw_panel_info_.partial_update) {
+ return;
+ }
+ uint32_t index = current_mode_index_;
+ DRMRect crtc_rects = {0, 0, mixer_attributes_.width, mixer_attributes_.height};
+ DRMRect conn_rects = {0, 0, display_attributes_[index].x_pixels,
+ display_attributes_[index].y_pixels};
+ drm_atomic_intf_->Perform(DRMOps::CRTC_SET_ROI, token_.crtc_id, 1, &crtc_rects);
+ drm_atomic_intf_->Perform(DRMOps::CONNECTOR_SET_ROI, token_.conn_id, 1, &conn_rects);
+}
+
} // namespace sdm
diff --git a/sdm/libs/core/drm/hw_device_drm.h b/sdm/libs/core/drm/hw_device_drm.h
index b08c0e66..3af3b77d 100644
--- a/sdm/libs/core/drm/hw_device_drm.h
+++ b/sdm/libs/core/drm/hw_device_drm.h
@@ -133,6 +133,7 @@ class HWDeviceDRM : public HWInterface {
bool IsResolutionSwitchEnabled() const { return resolution_switch_enabled_; }
void SetTopology(sde_drm::DRMTopology drm_topology, HWTopology *hw_topology);
void SetMultiRectMode(const uint32_t flags, sde_drm::DRMMultiRectMode *target);
+ void SetFullROI();
class Registry {
public:
diff --git a/sdm/libs/core/drm/hw_events_drm.cpp b/sdm/libs/core/drm/hw_events_drm.cpp
index 86a3f544..4d1eea9a 100644
--- a/sdm/libs/core/drm/hw_events_drm.cpp
+++ b/sdm/libs/core/drm/hw_events_drm.cpp
@@ -64,19 +64,18 @@ DisplayError HWEventsDRM::InitializePollFd() {
switch (event_data.event_type) {
case HWEvent::VSYNC: {
- if (!is_primary_) {
- // TODO(user): Once secondary support is added, use a different fd by calling drmOpen
- break;
- }
-
poll_fds_[i].events = POLLIN | POLLPRI | POLLERR;
- DRMMaster *master = nullptr;
- int ret = DRMMaster::GetInstance(&master);
- if (ret < 0) {
- DLOGE("Failed to acquire DRMMaster instance");
- return kErrorNotSupported;
+ if (is_primary_) {
+ DRMMaster *master = nullptr;
+ int ret = DRMMaster::GetInstance(&master);
+ if (ret < 0) {
+ DLOGE("Failed to acquire DRMMaster instance");
+ return kErrorNotSupported;
+ }
+ master->GetHandle(&poll_fds_[i].fd);
+ } else {
+ poll_fds_[i].fd = drmOpen("msm_drm", nullptr);
}
- master->GetHandle(&poll_fds_[i].fd);
vsync_index_ = i;
} break;
case HWEvent::EXIT: {
@@ -197,11 +196,8 @@ DisplayError HWEventsDRM::Init(int display_type, HWEventHandler *event_handler,
return kErrorResources;
}
- if (is_primary_) {
- RegisterVSync();
- vsync_registered_ = true;
- }
-
+ RegisterVSync();
+ vsync_registered_ = true;
RegisterPanelDead(true);
RegisterIdleNotify(true);
RegisterIdlePowerCollapse(true);
@@ -226,9 +222,6 @@ DisplayError HWEventsDRM::SetEventState(HWEvent event, bool enable, void *arg) {
switch (event) {
case HWEvent::VSYNC: {
std::lock_guard<std::mutex> lock(vsync_mutex_);
- if (!is_primary_) {
- break;
- }
vsync_enabled_ = enable;
if (vsync_enabled_ && !vsync_registered_) {
RegisterVSync();
@@ -261,7 +254,9 @@ DisplayError HWEventsDRM::CloseFds() {
for (uint32_t i = 0; i < event_data_list_.size(); i++) {
switch (event_data_list_[i].event_type) {
case HWEvent::VSYNC:
- // TODO(user): close for secondary
+ if (!is_primary_) {
+ Sys::close_(poll_fds_[i].fd);
+ }
poll_fds_[i].fd = -1;
break;
case HWEvent::EXIT:
@@ -347,9 +342,10 @@ void *HWEventsDRM::DisplayEventHandler() {
}
DisplayError HWEventsDRM::RegisterVSync() {
- // TODO(user): For secondary use DRM_VBLANK_HIGH_CRTC_MASK and DRM_VBLANK_HIGH_CRTC_SHIFT
- drmVBlank vblank{};
- vblank.request.type = (drmVBlankSeqType)(DRM_VBLANK_RELATIVE | DRM_VBLANK_EVENT);
+ drmVBlank vblank {};
+ uint32_t high_crtc = token_.crtc_index << DRM_VBLANK_HIGH_CRTC_SHIFT;
+ vblank.request.type = (drmVBlankSeqType)(DRM_VBLANK_RELATIVE | DRM_VBLANK_EVENT |
+ (high_crtc & DRM_VBLANK_HIGH_CRTC_MASK));
vblank.request.sequence = 1;
// DRM hack to pass in context to unused field signal. Driver will write this to the node being
// polled on, and will be read as part of drm event handling and sent to handler
diff --git a/sdm/libs/core/drm/hw_tv_drm.cpp b/sdm/libs/core/drm/hw_tv_drm.cpp
index f1d0d80b..245b5738 100644
--- a/sdm/libs/core/drm/hw_tv_drm.cpp
+++ b/sdm/libs/core/drm/hw_tv_drm.cpp
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2017, The Linux Foundation. All rights reserved.
+* Copyright (c) 2017-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
@@ -37,6 +37,7 @@
#include <drm_res_mgr.h>
#include <stdio.h>
#include <unistd.h>
+#include <fcntl.h>
#include <string>
#include <vector>
#include <map>
@@ -290,5 +291,31 @@ void HWTVDRM::DumpHDRMetaData(HWHDRLayerInfo::HDROperation operation) {
hdr_metadata_.white_point_x, hdr_metadata_.white_point_y, hdr_metadata_.eotf);
}
+DisplayError HWTVDRM::OnMinHdcpEncryptionLevelChange(uint32_t min_enc_level) {
+ DisplayError error = kErrorNone;
+ int fd = -1;
+ char data[kMaxStringLength] = {'\0'};
+
+ snprintf(data, sizeof(data), "/sys/devices/virtual/hdcp/msm_hdcp/min_level_change");
+
+ fd = Sys::open_(data, O_WRONLY);
+ if (fd < 0) {
+ DLOGE("File '%s' could not be opened. errno = %d, desc = %s", data, errno, strerror(errno));
+ return kErrorHardware;
+ }
+
+ snprintf(data, sizeof(data), "%d", min_enc_level);
+
+ ssize_t err = Sys::pwrite_(fd, data, strlen(data), 0);
+ if (err <= 0) {
+ DLOGE("Write failed, Error = %s", strerror(errno));
+ error = kErrorHardware;
+ }
+
+ Sys::close_(fd);
+
+ return error;
+}
+
} // namespace sdm
diff --git a/sdm/libs/core/drm/hw_tv_drm.h b/sdm/libs/core/drm/hw_tv_drm.h
index 5661bc27..49384a2f 100644
--- a/sdm/libs/core/drm/hw_tv_drm.h
+++ b/sdm/libs/core/drm/hw_tv_drm.h
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2017, The Linux Foundation. All rights reserved.
+* Copyright (c) 2017-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:
@@ -48,6 +48,7 @@ class HWTVDRM : public HWDeviceDRM {
virtual DisplayError Standby();
virtual DisplayError Commit(HWLayers *hw_layers);
virtual void PopulateHWPanelInfo();
+ virtual DisplayError OnMinHdcpEncryptionLevelChange(uint32_t min_enc_level);
private:
DisplayError UpdateHDRMetaData(HWLayers *hw_layers);