diff options
author | HyunKyung Kim <hk310.kim@samsung.com> | 2019-05-31 10:09:45 +0900 |
---|---|---|
committer | HyunKyung Kim <hk310.kim@samsung.com> | 2020-03-02 10:16:09 +0900 |
commit | 19ab03883b7a90ae7d0a94beb9c8aea25ff57375 (patch) | |
tree | da0bad9341018f13391bbba85594722ea8ef9df1 /libhwc2.1/libdisplayinterface/ExynosDeviceInterface.cpp | |
parent | 4192310c5d57777142501aa7086c9ab805d1d38c (diff) |
libhwc2.1: Update restriction and feature regardless of interface type
Update restriction and feature table regardless of interface type
using mDPUInfo.
mDPUInfo would be updated by updateRestrictions() according
to interface type.
Change-Id: I2e8e388be626932d8b4a1594c8337867d862c160
Signed-off-by: HyunKyung Kim <hk310.kim@samsung.com>
Diffstat (limited to 'libhwc2.1/libdisplayinterface/ExynosDeviceInterface.cpp')
-rw-r--r-- | libhwc2.1/libdisplayinterface/ExynosDeviceInterface.cpp | 183 |
1 files changed, 183 insertions, 0 deletions
diff --git a/libhwc2.1/libdisplayinterface/ExynosDeviceInterface.cpp b/libhwc2.1/libdisplayinterface/ExynosDeviceInterface.cpp new file mode 100644 index 0000000..e3f50ba --- /dev/null +++ b/libhwc2.1/libdisplayinterface/ExynosDeviceInterface.cpp @@ -0,0 +1,183 @@ +/* + * Copyright (C) 2019 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "ExynosDeviceInterface.h" +#include "ExynosHWCDebug.h" +#include "ExynosDevice.h" +#include "ExynosResourceManager.h" +#include "ExynosMPP.h" +#include <unordered_set> + +extern feature_support_t feature_table[]; + +void ExynosDeviceInterface::printDppRestriction(struct dpp_ch_restriction res) +{ + ALOGD("========================================================="); + ALOGD("id: %d", res.id); + ALOGD("dpp_restriction"); + ALOGD("src_f_w (%d, %d, %d)", res.restriction.src_f_w.min, res.restriction.src_f_w.max, res.restriction.src_f_w.align); + ALOGD("src_f_h (%d, %d, %d)", res.restriction.src_f_h.min, res.restriction.src_f_h.max, res.restriction.src_f_h.align); + ALOGD("src_w (%d, %d, %d)", res.restriction.src_w.min, res.restriction.src_w.max, res.restriction.src_w.align); + ALOGD("src_h (%d, %d, %d)", res.restriction.src_h.min, res.restriction.src_h.max, res.restriction.src_h.align); + ALOGD("src_x_align(%d), src_y_align(%d)", res.restriction.src_x_align, res.restriction.src_y_align); + + ALOGD("dst_f_w (%d, %d, %d)", res.restriction.dst_f_w.min, res.restriction.dst_f_w.max, res.restriction.dst_f_w.align); + ALOGD("dst_f_h (%d, %d, %d)", res.restriction.dst_f_h.min, res.restriction.dst_f_h.max, res.restriction.dst_f_h.align); + ALOGD("dst_w (%d, %d, %d)", res.restriction.dst_w.min, res.restriction.dst_w.max, res.restriction.dst_w.align); + ALOGD("dst_h (%d, %d, %d)", res.restriction.dst_h.min, res.restriction.dst_h.max, res.restriction.dst_h.align); + ALOGD("dst_x_align(%d), dst_y_align(%d)", res.restriction.dst_x_align, res.restriction.dst_y_align); + ALOGD("src_h_rot_max(%d)", res.restriction.src_h_rot_max); + + ALOGD("blk_w (%d, %d, %d)", res.restriction.blk_w.min, res.restriction.blk_w.max, res.restriction.blk_w.align); + ALOGD("blk_h (%d, %d, %d)", res.restriction.blk_h.min, res.restriction.blk_h.max, res.restriction.blk_h.align); + ALOGD("blk_x_align(%d), blk_y_align(%d)", res.restriction.blk_x_align, res.restriction.blk_y_align); + + ALOGD("format cnt: %d", res.restriction.format_cnt); + for(int i = 0; i < res.restriction.format_cnt; i++) { + ALOGD("[%d] format: %d", i, res.restriction.format[i]); + } + + ALOGD("scale down: %d, up: %d", res.restriction.scale_down, res.restriction.scale_up); + ALOGD("attr: 0x%lx", res.attr); +} + +int32_t ExynosDeviceInterface::makeDPURestrictions() { + int32_t ret = 0; + + struct dpp_restrictions_info *dpuInfo = &mDPUInfo.dpuInfo; + HDEBUGLOGD(eDebugDefault, "DPP ver : %d, cnt : %d", dpuInfo->ver, dpuInfo->dpp_cnt); + ExynosResourceManager *resourceManager = mExynosDevice->mResourceManager; + + /* format resctriction */ + for (int i = 0; i < dpuInfo->dpp_cnt; i++){ + dpp_restriction r = dpuInfo->dpp_ch[i].restriction; + HDEBUGLOGD(eDebugDefault, "id : %d, format count : %d", i, r.format_cnt); + } + + /* Check attribute overlap */ + std::unordered_set<unsigned long> attrs; + for (size_t i = 0; i < dpuInfo->dpp_cnt; ++i) { + const dpp_ch_restriction &r = dpuInfo->dpp_ch[i]; + if (attrs.count(r.attr)) + mDPUInfo.overlap[i] = true; + else + attrs.insert(r.attr); + HDEBUGLOGD(eDebugDefault, "Index : %zu, overlap %d", i, mDPUInfo.overlap[i]); + } + + for (int i = 0; i < dpuInfo->dpp_cnt; i++){ + if (mDPUInfo.overlap[i]) continue; + dpp_restriction r = dpuInfo->dpp_ch[i].restriction; + mpp_phycal_type_t hwType = resourceManager->getPhysicalType(i); + for (int j = 0; j < r.format_cnt; j++){ + restriction_key_t queried_format; + queried_format.hwType = hwType; + queried_format.nodeType = NODE_NONE; + /* r.format[j] is HAL format */ + queried_format.format = r.format[j]; + queried_format.reserved = 0; + resourceManager->makeFormatRestrictions(queried_format); + HDEBUGLOGD(eDebugDefault, "%s : %d", getMPPStr(hwType).string(), r.format[j]); + } + } + + for (int i = 0; i < dpuInfo->dpp_cnt; i++){ + if (mDPUInfo.overlap[i]) continue; + const dpp_restriction &r = dpuInfo->dpp_ch[i].restriction; + + /* RGB size restrictions */ + restriction_size rSize; + rSize.maxDownScale = r.scale_down; + rSize.maxUpScale = r.scale_up; + rSize.maxFullWidth = r.dst_f_w.max; + rSize.maxFullHeight = r.dst_f_h.max; + rSize.minFullWidth = r.dst_f_w.min; + rSize.minFullHeight = r.dst_f_h.min;; + rSize.fullWidthAlign = r.dst_x_align; + rSize.fullHeightAlign = r.dst_y_align;; + rSize.maxCropWidth = r.src_w.max; + rSize.maxCropHeight = r.src_h.max; + rSize.minCropWidth = r.src_w.min; + rSize.minCropHeight = r.src_h.min; + rSize.cropXAlign = r.src_x_align; + rSize.cropYAlign = r.src_y_align; + rSize.cropWidthAlign = r.blk_x_align; + rSize.cropHeightAlign = r.blk_y_align; + + mpp_phycal_type_t hwType = resourceManager->getPhysicalType(i); + resourceManager->makeSizeRestrictions(hwType, rSize, RESTRICTION_RGB); + + /* YUV size restrictions */ + rSize.minCropWidth = 32; //r.src_w.min; + rSize.minCropHeight = 32; //r.src_h.min; + rSize.fullWidthAlign = max(r.dst_x_align, YUV_CHROMA_H_SUBSAMPLE); + rSize.fullHeightAlign = max(r.dst_y_align, YUV_CHROMA_V_SUBSAMPLE); + rSize.cropXAlign = max(r.src_x_align, YUV_CHROMA_H_SUBSAMPLE); + rSize.cropYAlign = max(r.src_y_align, YUV_CHROMA_V_SUBSAMPLE); + rSize.cropWidthAlign = max(r.blk_x_align, YUV_CHROMA_H_SUBSAMPLE); + rSize.cropHeightAlign = max(r.blk_y_align, YUV_CHROMA_V_SUBSAMPLE); + + resourceManager->makeSizeRestrictions(hwType, rSize, RESTRICTION_YUV); + } + return ret; +} + +int32_t ExynosDeviceInterface::updateFeatureTable() { + const struct dpp_restrictions_info &dpuInfo = mDPUInfo.dpuInfo; + if (mExynosDevice->mResourceManager == NULL) + return -1; + + const ExynosResourceManager &resourceManager = *(mExynosDevice->mResourceManager); + const uint32_t featureTableCnt = resourceManager.getFeatureTableSize(); + + const int attrMapCnt = sizeof(dpu_attr_map_table)/sizeof(dpu_attr_map_t); + const int dpp_cnt = dpuInfo.dpp_cnt; + + HDEBUGLOGD(eDebugDefault, "Before"); + for (uint32_t j = 0; j < featureTableCnt; j++){ + HDEBUGLOGD(eDebugDefault, "type : %d, feature : 0x%lx", + feature_table[j].hwType, + (unsigned long)feature_table[j].attr); + } + + // dpp count + for (int i = 0; i < dpp_cnt; i++){ + dpp_ch_restriction c_r = dpuInfo.dpp_ch[i]; + if (mDPUInfo.overlap[i]) continue; + HDEBUGLOGD(eDebugDefault, "DPU attr : (ch:%d), 0x%lx", i, (unsigned long)c_r.attr); + mpp_phycal_type_t hwType = resourceManager.getPhysicalType(i); + // feature table count + for (uint32_t j = 0; j < featureTableCnt; j++){ + if (feature_table[j].hwType == hwType) { + // dpp attr count + for (int k = 0; k < attrMapCnt; k++) { + if (c_r.attr & (1 << dpu_attr_map_table[k].dpp_attr)) { + feature_table[j].attr |= dpu_attr_map_table[k].hwc_attr; + } + } + } + } + } + + HDEBUGLOGD(eDebugDefault, "After"); + for (uint32_t j = 0; j < featureTableCnt; j++){ + HDEBUGLOGD(eDebugDefault, "type : %d, feature : 0x%lx", + feature_table[j].hwType, + (unsigned long)feature_table[j].attr); + } + return 0; +} + |