From 25887f5a784db35c78c4efd57ba834b15c20a94b Mon Sep 17 00:00:00 2001 From: Jan Altensen Date: Sun, 4 Aug 2019 04:02:48 +0200 Subject: [PATCH] libhwcutils: fix compilation Change-Id: Ic3fb26468380dc892c27c53d8bc50c6ce771483f --- libhwcutils/ExynosHWCUtils.cpp | 39 ++-------------------------------- libhwcutils/ExynosHWCUtils.h | 2 -- libhwcutils/ExynosMPPv2.cpp | 38 ++++++++++++++------------------- 3 files changed, 18 insertions(+), 61 deletions(-) diff --git a/libhwcutils/ExynosHWCUtils.cpp b/libhwcutils/ExynosHWCUtils.cpp index ffbf39f..5734a84 100644 --- a/libhwcutils/ExynosHWCUtils.cpp +++ b/libhwcutils/ExynosHWCUtils.cpp @@ -72,7 +72,7 @@ void dumpMPPImage(exynos_mpp_img &c) ALOGV("\tx = %u, y = %u, w = %u, h = %u, fw = %u, fh = %u", c.x, c.y, c.w, c.h, c.fw, c.fh); ALOGV("\tf = %u", c.format); - ALOGV("\taddr = {%d, %d, %d}, rot = %u, cacheable = %u, drmMode = %u", + ALOGV("\taddr = {%lu, %lu, %lu}, rot = %u, cacheable = %u, drmMode = %u", c.yaddr, c.uaddr, c.vaddr, c.rot, c.cacheable, c.drmMode); ALOGV("\tnarrowRgb = %u, acquireFenceFd = %d, releaseFenceFd = %d, mem_type = %u", c.narrowRgb, c.acquireFenceFd, c.releaseFenceFd, c.mem_type); @@ -83,7 +83,7 @@ void dumpMPPImage(uint32_t type, exynos_mpp_img &c) HDEBUGLOGD(type, "\tx = %u, y = %u, w = %u, h = %u, fw = %u, fh = %u", c.x, c.y, c.w, c.h, c.fw, c.fh); HDEBUGLOGD(type, "\tf = %u", c.format); - HDEBUGLOGD(type, "\taddr = {%d, %d, %d}, rot = %u, cacheable = %u, drmMode = %u", + HDEBUGLOGD(type, "\taddr = {%lu, %lu, %lu}, rot = %u, cacheable = %u, drmMode = %u", c.yaddr, c.uaddr, c.vaddr, c.rot, c.cacheable, c.drmMode); HDEBUGLOGD(type, "\tnarrowRgb = %u, acquireFenceFd = %d, releaseFenceFd = %d, mem_type = %u", c.narrowRgb, c.acquireFenceFd, c.releaseFenceFd, c.mem_type); @@ -296,9 +296,6 @@ bool compareYuvLayerConfig(int videoLayers, uint32_t index, video_layer_config *pre_src_data, video_layer_config *pre_dst_data) { private_handle_t *src_handle = private_handle_t::dynamicCast(layer.handle); - buffer_handle_t dst_buf; - private_handle_t *dst_handle; - int ret = 0; bool reconfigure = 1; video_layer_config new_src_cfg, new_dst_cfg; @@ -458,35 +455,3 @@ void adjustRect(hwc_rect_t &rect, int32_t width, int32_t height) if (rect.bottom > height) rect.bottom = height; } - -uint32_t halDataSpaceToV4L2ColorSpace(uint32_t data_space) -{ - switch (data_space) { - case HAL_DATASPACE_BT2020: - case HAL_DATASPACE_BT2020_FULL: - return V4L2_COLORSPACE_BT2020; - case HAL_DATASPACE_DCI_P3: - case HAL_DATASPACE_DCI_P3_FULL: - return V4L2_COLORSPACE_DCI_P3; - default: - return V4L2_COLORSPACE_DEFAULT; - } - return V4L2_COLORSPACE_DEFAULT; -} - -unsigned int isNarrowRgb(int format, uint32_t data_space) -{ - if (format == HAL_PIXEL_FORMAT_EXYNOS_YCrCb_420_SP_M_FULL) - return 0; - else { - if (isFormatRgb(format)) - return 0; - else { - if ((data_space == HAL_DATASPACE_BT2020_FULL) || - (data_space == HAL_DATASPACE_DCI_P3_FULL)) - return 0; - else - return 1; - } - } -} diff --git a/libhwcutils/ExynosHWCUtils.h b/libhwcutils/ExynosHWCUtils.h index 977af92..91a36e2 100644 --- a/libhwcutils/ExynosHWCUtils.h +++ b/libhwcutils/ExynosHWCUtils.h @@ -138,6 +138,4 @@ uint32_t hwcApiVersion(const hwc_composer_device_1_t* hwc); uint32_t hwcHeaderVersion(const hwc_composer_device_1_t* hwc); bool hwcHasApiVersion(const hwc_composer_device_1_t* hwc, uint32_t version); -uint32_t halDataSpaceToV4L2ColorSpace(uint32_t data_space); -unsigned int isNarrowRgb(int format, uint32_t data_space); #endif diff --git a/libhwcutils/ExynosMPPv2.cpp b/libhwcutils/ExynosMPPv2.cpp index 872b6a9..a33bf32 100644 --- a/libhwcutils/ExynosMPPv2.cpp +++ b/libhwcutils/ExynosMPPv2.cpp @@ -163,7 +163,7 @@ bool ExynosMPP::isFormatSupportedByMPP(int format) } } -bool ExynosMPP::isCSCSupportedByMPP(int src_format, int dst_format, uint32_t dataSpace) +bool ExynosMPP::isCSCSupportedByMPP(int src_format __unused, int dst_format __unused, uint32_t dataSpace __unused) { return true; } @@ -270,8 +270,10 @@ int ExynosMPP::isProcessingSupported(hwc_layer_1_t &layer, int dst_format) return -eMPPUnsupportedFormat; else if (!isFormatSupportedByMPP(dst_format)) return -eMPPUnsupportedFormat; +#if 0 else if (!isCSCSupportedByMPP(handle->format, dst_format, layer.dataSpace)) return -eMPPUnsupportedCSC; +#endif else if (!mCanBlend && (handle->format == HAL_PIXEL_FORMAT_RGBA_8888 || handle->format == HAL_PIXEL_FORMAT_BGRA_8888) && layer.blending != HWC_BLENDING_NONE) @@ -548,7 +550,7 @@ bool ExynosMPP::setupDoubleOperation(exynos_mpp_img &srcImg, exynos_mpp_img &mid midImg.drmMode = srcImg.drmMode; midImg.format = midFormat; midImg.mem_type = MPP_MEM_DMABUF; - midImg.narrowRgb = isNarrowRgb(midFormat, layer.dataSpace); + midImg.narrowRgb = midFormat != HAL_PIXEL_FORMAT_EXYNOS_YCrCb_420_SP_M_FULL; } return needDoubleOperation; @@ -591,7 +593,10 @@ void ExynosMPP::setupDst(exynos_mpp_img &srcImg, exynos_mpp_img &dstImg, if (dstFormat == HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_SP_M_PRIV) dstImg.format = HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_SP_M; dstImg.mem_type = MPP_MEM_DMABUF; - dstImg.narrowRgb = isNarrowRgb(srcHandle->format, layer.dataSpace); + if (srcHandle->format == HAL_PIXEL_FORMAT_EXYNOS_YCrCb_420_SP_M_FULL) + dstImg.narrowRgb = 0; + else + dstImg.narrowRgb = !isFormatRgb(srcHandle->format); } void ExynosMPP::setupBlendCfg(exynos_mpp_img __unused &srcImg, exynos_mpp_img &dstImg, @@ -840,15 +845,14 @@ int ExynosMPP::processM2M(hwc_layer_1_t &layer, int dstFormat, hwc_frect_t *sour ATRACE_CALL(); HDEBUGLOGD(eDebugMPP, "configuring mType(%u) mIndex(%u) for memory-to-memory", mType, mIndex); +#ifdef USES_VIRTUAL_DISPLAY alloc_device_t* allocDevice = mAllocDevice; +#endif + private_handle_t *srcHandle = private_handle_t::dynamicCast(layer.handle); buffer_handle_t dstBuf; private_handle_t *dstHandle; - buffer_handle_t midBuf; - private_handle_t *midHandle; int ret = 0; - int dstAlign; - unsigned int colorspace = halDataSpaceToV4L2ColorSpace(layer.dataSpace); exynos_mpp_img srcImg, dstImg; memset(&srcImg, 0, sizeof(srcImg)); @@ -1008,7 +1012,7 @@ int ExynosMPP::processM2M(hwc_layer_1_t &layer, int dstFormat, hwc_frect_t *sour ALOGE("failed to stop mType(%u) mIndex(%u)", mType, mIndex); goto err_gsc_config; } - ret = setCSCProperty(mMPPHandle, 0, !midImg.narrowRgb, colorspace); + ret = setCSCProperty(mMPPHandle, 0, !midImg.narrowRgb, 1); ret = configMPP(mMPPHandle, &srcImg, &midImg); if (ret < 0) { ALOGE("failed to configure mType(%u) mIndex(%u)", mType, mIndex); @@ -1031,7 +1035,7 @@ int ExynosMPP::processM2M(hwc_layer_1_t &layer, int dstFormat, hwc_frect_t *sour } midImg.acquireFenceFd = midImg.releaseFenceFd; - ret = setCSCProperty(mMPPHandle, 0, !dstImg.narrowRgb, colorspace); + ret = setCSCProperty(mMPPHandle, 0, !dstImg.narrowRgb, 1); ret = configMPP(mMPPHandle, &midImg, &dstImg); if (ret < 0) { ALOGE("failed to configure mType(%u) mIndex(%u)", mType, mIndex); @@ -1115,8 +1119,6 @@ int ExynosMPP::processM2MWithB(hwc_layer_1_t &layer1, hwc_layer_1_t &layer2, int private_handle_t *dstHandle; struct SrcBlendInfo srcblendinfo; int ret = 0; - int dstAlign; - unsigned int colorspace = V4L2_COLORSPACE_DEFAULT; exynos_mpp_img srcImg, dstImg; memset(&srcImg, 0, sizeof(srcImg)); @@ -1179,11 +1181,7 @@ int ExynosMPP::processM2MWithB(hwc_layer_1_t &layer1, hwc_layer_1_t &layer2, int midImg.vaddr = midHandle->fd2; } - if (isFormatRgb(srcHandle->format) == false) - colorspace = halDataSpaceToV4L2ColorSpace(layer1.dataSpace); - else - colorspace = halDataSpaceToV4L2ColorSpace(layer2.dataSpace); - ret = setCSCProperty(mMPPHandle, 0, !midImg.narrowRgb, colorspace); + ret = setCSCProperty(mMPPHandle, 0, !midImg.narrowRgb, 1); HDEBUGLOGD(eDebugMPP, "src configuration:\n"); dumpMPPImage(eDebugMPP, srcImg); @@ -1218,7 +1216,7 @@ int ExynosMPP::processM2MWithB(hwc_layer_1_t &layer1, hwc_layer_1_t &layer2, int /* if src1 is one plane NV12 format, uaddr should be src2's address. if src1 is two plane NV12 format, vaddr should be src2's address. */ - if (srcImg.uaddr == -1) + if (srcImg.uaddr == (unsigned long)-1) srcImg.uaddr = src2Handle->fd; else srcImg.vaddr = src2Handle->fd; @@ -1262,11 +1260,7 @@ int ExynosMPP::processM2MWithB(hwc_layer_1_t &layer1, hwc_layer_1_t &layer2, int HDEBUGLOGD(eDebugMPP, "Blend Information:\n"); dumpBlendMPPImage(eDebugMPP, srcblendinfo); - if (isFormatRgb(srcHandle->format) == false) - colorspace = halDataSpaceToV4L2ColorSpace(layer1.dataSpace); - else - colorspace = halDataSpaceToV4L2ColorSpace(layer2.dataSpace); - ret = setCSCProperty(mMPPHandle, 0, !dstImg.narrowRgb, colorspace); + ret = setCSCProperty(mMPPHandle, 0, !dstImg.narrowRgb, 1); ret = configBlendMpp(mMPPHandle, &srcImg, &dstImg, &srcblendinfo); if (ret < 0) { -- 2.20.1