summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWiwit Rifa'i <wiwitrifai@google.com>2023-09-14 20:38:47 +0800
committerWiwit Rifa'i <wiwitrifai@google.com>2023-09-18 20:32:50 +0800
commita38adefca986c1eb301b3be4ce229ae77683c740 (patch)
tree87e2a4f59d294c19a0e8a7c116424ab413e3be13
parent58ed9009e38d66a8b56172cc09ddbf8ba0d13da7 (diff)
downloadcommon-a38adefca986c1eb301b3be4ce229ae77683c740.tar.gz
libhwc2.1: avoid copying exynos_image unnecessarily
The size of exynos_image is not small so we should not copy exynos_image if it's unnecessary. Bug: 295892886 Test: trigger assignResource using hwc-tester & check simpleperf Change-Id: I460e5f57b8fe1291482b49bc9dcc5da6ead5a060
-rw-r--r--libhwc2.1/libresource/ExynosMPP.cpp6
-rw-r--r--libhwc2.1/libresource/ExynosMPP.h4
-rw-r--r--libhwc2.1/libresource/ExynosResourceManager.cpp8
-rw-r--r--libhwc2.1/libresource/ExynosResourceManager.h5
4 files changed, 12 insertions, 11 deletions
diff --git a/libhwc2.1/libresource/ExynosMPP.cpp b/libhwc2.1/libresource/ExynosMPP.cpp
index 5045cde..afc72f3 100644
--- a/libhwc2.1/libresource/ExynosMPP.cpp
+++ b/libhwc2.1/libresource/ExynosMPP.cpp
@@ -125,14 +125,12 @@ ExynosMPPSource::ExynosMPPSource(uint32_t sourceType, void *source)
mMidImg.releaseFenceFd = -1;
}
-void ExynosMPPSource::setExynosImage(exynos_image src_img, exynos_image dst_img)
-{
+void ExynosMPPSource::setExynosImage(const exynos_image& src_img, const exynos_image& dst_img) {
mSrcImg = src_img;
mDstImg = dst_img;
}
-void ExynosMPPSource::setExynosMidImage(exynos_image mid_img)
-{
+void ExynosMPPSource::setExynosMidImage(const exynos_image& mid_img) {
mMidImg = mid_img;
}
diff --git a/libhwc2.1/libresource/ExynosMPP.h b/libhwc2.1/libresource/ExynosMPP.h
index 0877841..7ea3fbe 100644
--- a/libhwc2.1/libresource/ExynosMPP.h
+++ b/libhwc2.1/libresource/ExynosMPP.h
@@ -451,8 +451,8 @@ class ExynosMPPSource {
ExynosMPPSource();
ExynosMPPSource(uint32_t sourceType, void *source);
~ExynosMPPSource(){};
- void setExynosImage(exynos_image src_img, exynos_image dst_img);
- void setExynosMidImage(exynos_image mid_img);
+ void setExynosImage(const exynos_image& src_img, const exynos_image& dst_img);
+ void setExynosMidImage(const exynos_image& mid_img);
uint32_t mSourceType;
void *mSource;
diff --git a/libhwc2.1/libresource/ExynosResourceManager.cpp b/libhwc2.1/libresource/ExynosResourceManager.cpp
index 41de2cf..4e90717 100644
--- a/libhwc2.1/libresource/ExynosResourceManager.cpp
+++ b/libhwc2.1/libresource/ExynosResourceManager.cpp
@@ -808,9 +808,11 @@ int32_t ExynosResourceManager::updateExynosComposition(ExynosDisplay *display)
return ret;
}
-int32_t ExynosResourceManager::changeLayerFromClientToDevice(ExynosDisplay *display, ExynosLayer *layer,
- uint32_t layer_index, exynos_image m2m_out_img, ExynosMPP *m2mMPP, ExynosMPP *otfMPP)
-{
+int32_t ExynosResourceManager::changeLayerFromClientToDevice(ExynosDisplay* display,
+ ExynosLayer* layer,
+ uint32_t layer_index,
+ const exynos_image& m2m_out_img,
+ ExynosMPP* m2mMPP, ExynosMPP* otfMPP) {
int ret = NO_ERROR;
if ((ret = display->removeClientCompositionLayer(layer_index)) != NO_ERROR) {
ALOGD("removeClientCompositionLayer return error(%d)", ret);
diff --git a/libhwc2.1/libresource/ExynosResourceManager.h b/libhwc2.1/libresource/ExynosResourceManager.h
index e996554..c8f308f 100644
--- a/libhwc2.1/libresource/ExynosResourceManager.h
+++ b/libhwc2.1/libresource/ExynosResourceManager.h
@@ -187,8 +187,9 @@ class ExynosResourceManager {
struct exynos_image &dst, ExynosMPPSource *mppSrc);
private:
- int32_t changeLayerFromClientToDevice(ExynosDisplay *display, ExynosLayer *layer,
- uint32_t layer_index, exynos_image m2m_out_img, ExynosMPP *m2mMPP, ExynosMPP *otfMPP);
+ int32_t changeLayerFromClientToDevice(ExynosDisplay* display, ExynosLayer* layer,
+ uint32_t layer_index, const exynos_image& m2m_out_img,
+ ExynosMPP* m2mMPP, ExynosMPP* otfMPP);
void dump(const restriction_classification_t, String8 &result) const;
sp<DstBufMgrThread> mDstBufMgrThread;