Merge "sdm: drm: Add support for global dither feature"

This commit is contained in:
Linux Build Service Account
2018-03-08 16:02:06 -08:00
committed by Gerrit - the friendly Code Review server
3 changed files with 51 additions and 7 deletions

View File

@@ -316,6 +316,12 @@ enum struct DRMOps {
* uint32_t - CRTC ID
*/
CONNECTOR_SET_CRTC,
/*
* Op: Sets PP feature
* Arg: uint32_t - Connector ID
* DRMPPFeatureInfo * - PP feature data pointer
*/
CONNECTOR_SET_POST_PROC,
/*
* Op: Sets connector hdr metadata
* Arg: uint32_t - Connector ID
@@ -538,6 +544,7 @@ struct DRMPPFeatureInfo {
uint32_t version;
uint32_t payload_size;
void *payload;
uint32_t object_type;
};
enum DRMCscType {

View File

@@ -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;
}

View File

@@ -57,6 +57,7 @@
#include <unordered_map>
#include <utility>
#include <vector>
#include <limits>
#include "hw_device_drm.h"
#include "hw_info_interface.h"
@@ -1261,13 +1262,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_);
@@ -1282,9 +1288,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);
}
}
}