graphics: Initial exynos9610 support
* Copied from exynos9630
Change-Id: Ia09b4a100670d81021b94a7504446f9e66096828
diff --git a/exynos9610/libhwc2.1/Android.mk b/exynos9610/libhwc2.1/Android.mk
new file mode 100644
index 0000000..4466ad3
--- /dev/null
+++ b/exynos9610/libhwc2.1/Android.mk
@@ -0,0 +1,28 @@
+# Copyright (C) 2008 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.
+
+ifndef TARGET_SOC_BASE
+ TARGET_SOC_BASE := $(TARGET_SOC)
+endif
+
+LOCAL_SRC_FILES += \
+ ../../$(TARGET_SOC_BASE)/libhwc2.1/device/ExynosDeviceModule.cpp \
+ ../../$(TARGET_SOC_BASE)/libhwc2.1/device/ExynosResourceManagerModule.cpp \
+ ../../$(TARGET_SOC_BASE)/libhwc2.1/display/ExynosDisplayFbInterfaceModule.cpp \
+ ../../$(TARGET_SOC_BASE)/libhwc2.1/primarydisplay/ExynosPrimaryDisplayModule.cpp \
+ ../../$(TARGET_SOC_BASE)/libhwc2.1/primarydisplay/ExynosPrimaryDisplayFbInterfaceModule.cpp \
+ ../../$(TARGET_SOC_BASE)/libhwc2.1/externaldisplay/ExynosExternalDisplayModule.cpp \
+ ../../$(TARGET_SOC_BASE)/libhwc2.1/externaldisplay/ExynosExternalDisplayFbInterfaceModule.cpp \
+ ../../$(TARGET_SOC_BASE)/libhwc2.1/virtualdisplay/ExynosVirtualDisplayModule.cpp \
+ ../../$(TARGET_SOC_BASE)/libhwc2.1/resources/ExynosMPPModule.cpp
diff --git a/exynos9610/libhwc2.1/CpuPerfInfo.h b/exynos9610/libhwc2.1/CpuPerfInfo.h
new file mode 100644
index 0000000..1470b93
--- /dev/null
+++ b/exynos9610/libhwc2.1/CpuPerfInfo.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2012 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.
+ */
+
+#ifndef CPU_PERF_INFO_H
+#define CPU_PERF_INFO_H
+
+#define CPU_CLUSTER0_MASK 0x3f /* Little cluster */
+#define CPU_CLUSTER1_MASK 0xc0 /* Big cluster */
+#define EPIC_LIBRARY_PATH "/vendor/lib64/libepic_helper.so"
+#define BOOST_SCENARIO_NAME "mem_boosting"
+#define BOOST_SCENARIO_NUM 2001
+
+#endif
diff --git a/exynos9610/libhwc2.1/DeconHeader.h b/exynos9610/libhwc2.1/DeconHeader.h
new file mode 100644
index 0000000..8da0f3a
--- /dev/null
+++ b/exynos9610/libhwc2.1/DeconHeader.h
@@ -0,0 +1,145 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call into the kernel available to libc. It contains only constants,
+ *** structures, and macros generated from the original header, and thus,
+ *** contains no copyrightable information.
+ ***
+ *** To edit the content of this header, modify the corresponding
+ *** source file (e.g. under external/kernel-headers/original/) then
+ *** run bionic/libc/kernel/tools/update_all.py
+ ***
+ *** Any manual change here will be lost the next time this script will
+ *** be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef ___SAMSUNG_DECON_H__
+#define ___SAMSUNG_DECON_H__
+#include "DeconCommonHeader.h"
+#define S3C_FB_MAX_WIN (4)
+#define MAX_DECON_WIN (4)
+#define DECON_WIN_UPDATE_IDX MAX_DECON_WIN
+#define MAX_PLANE_CNT (3)
+#define SUCCESS_EXYNOS_SMC 0
+#define HDR_CAPABILITIES_NUM 4
+typedef unsigned int u32;
+#ifdef USES_ARCH_ARM64
+typedef uint64_t dma_addr_t;
+#else
+typedef uint32_t dma_addr_t;
+#endif
+#define MAX_RES_NUMBER 5
+#define MAX_FMT_CNT 64
+#define MAX_DPP_CNT 7
+
+struct lcd_res_info {
+ unsigned int width;
+ unsigned int height;
+ unsigned int dsc_en;
+ unsigned int dsc_width;
+ unsigned int dsc_height;
+};
+struct lcd_mres_info {
+ unsigned int mres_en;
+ unsigned int mres_number;
+ struct lcd_res_info res_info[MAX_RES_NUMBER];
+};
+struct decon_win_rect {
+ int x;
+ int y;
+ u32 w;
+ u32 h;
+};
+struct decon_rect {
+ u32 left;
+ u32 top;
+ u32 right;
+ u32 bottom;
+};
+enum decon_idma_type {
+ IDMA_G0 = 0,
+ IDMA_G1,
+ IDMA_GF,
+ IDMA_VGS0,
+ ODMA_WB,
+ MAX_DECON_DMA_TYPE,
+};
+struct decon_user_window {
+ int x;
+ int y;
+};
+struct dpp_params {
+ dma_addr_t addr[MAX_PLANE_CNT];
+ enum dpp_rotate rot;
+ enum dpp_csc_eq eq_mode;
+ enum dpp_comp_src comp_src;
+ enum dpp_hdr_standard hdr_std;
+ u32 min_luminance;
+ u32 max_luminance;
+};
+struct decon_frame {
+ int x;
+ int y;
+ u32 w;
+ u32 h;
+ u32 f_w;
+ u32 f_h;
+};
+struct decon_win_config {
+ enum {
+ DECON_WIN_STATE_DISABLED = 0,
+ DECON_WIN_STATE_COLOR,
+ DECON_WIN_STATE_BUFFER,
+ DECON_WIN_STATE_UPDATE,
+ DECON_WIN_STATE_CURSOR,
+ } state;
+ union {
+ __u32 color;
+ struct {
+ int fd_idma[3];
+#ifdef USE_HDR_INTERFACE
+ int fd_lut;
+#endif
+ int acq_fence;
+ int rel_fence;
+ int plane_alpha;
+ enum decon_blending blending;
+ enum decon_idma_type idma_type;
+ enum decon_pixel_format format;
+ struct dpp_params dpp_parm;
+ struct decon_win_rect block_area;
+ struct decon_win_rect transparent_area;
+ struct decon_win_rect opaque_area;
+ struct decon_frame src;
+ };
+ };
+ struct decon_frame dst;
+ bool protection;
+ bool compression;
+};
+struct decon_win_config_data {
+ int present_fence;
+ int fd_odma;
+#ifdef USE_DQE_INTERFACE
+ int fd_dqe;
+#endif
+ struct decon_win_config config[MAX_DECON_WIN + 2];
+};
+struct decon_disp_info {
+ enum hwc_ver ver;
+ enum decon_psr_mode psr_mode;
+ struct lcd_mres_info mres_info;
+ u32 chip_ver;
+ uint8_t reverved[128];
+};
+struct decon_dual_display_blank_data {
+ enum {
+ DECON_PRIMARY_DISPLAY = 0,
+ DECON_SECONDARY_DISPLAY,
+ } display_type;
+ int blank;
+};
+#endif
diff --git a/exynos9610/libhwc2.1/ExynosHWCModule.h b/exynos9610/libhwc2.1/ExynosHWCModule.h
new file mode 100644
index 0000000..2306624
--- /dev/null
+++ b/exynos9610/libhwc2.1/ExynosHWCModule.h
@@ -0,0 +1,152 @@
+/*
+ * Copyright (C) 2012 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.
+ */
+
+#ifndef ANDROID_EXYNOS_HWC_MODULE_H_
+#define ANDROID_EXYNOS_HWC_MODULE_H_
+
+#include "ExynosHWC.h"
+#include "DeconHeader.h"
+#include "ExynosHWCHelper.h"
+
+#define HWC_VERSION HWC_DEVICE_API_VERSION_1_5
+
+#define VSYNC_DEV_PREFIX "/sys/devices/platform/"
+#define PSR_DEV_NAME "14800000.decon_f/psr_info"
+#define DP_LINK_NAME "13090000.displayport"
+#define DP_UEVENT_NAME "change@/devices/platform/%s/extcon/extcon0"
+#define DP_CABLE_STATE_NAME "/sys/devices/platform/%s/extcon/extcon0/cable.%d/state"
+#define DOZE_VSYNC_PERIOD 33333333
+#define FORCE_DISABLE_DR
+
+#define IDMA(x) static_cast<decon_idma_type>(x)
+
+enum {
+ HWC_DISPLAY_NONE_BIT = 0
+};
+
+/*
+ * pre_assign_info: all display_descriptors that want to reserve
+ */
+struct exynos_mpp_t {
+ int physicalType;
+ int logicalType;
+ char name[16];
+ uint32_t physical_index;
+ uint32_t logical_index;
+ uint32_t pre_assign_info;
+};
+
+/*
+ * This is base window index of primary display for each display mode.
+ * External display base window is always 0
+ */
+const dpp_channel_map_t IDMA_CHANNEL_MAP[] = {
+ {MPP_DPP_G, 0, IDMA_G0, IDMA(0)},
+ {MPP_DPP_G, 1, IDMA_G1, IDMA(1)},
+ {MPP_DPP_GF, 0, IDMA_GF, IDMA(2)},
+ {MPP_DPP_VGS, 0, IDMA_VGS0, IDMA(3)},
+ {MPP_P_TYPE_MAX, 0, ODMA_WB, IDMA(4)}, // not idma but..
+ {static_cast<mpp_phycal_type_t>(MAX_DECON_DMA_TYPE), 0, MAX_DECON_DMA_TYPE, IDMA(5)}
+};
+
+#define MAX_NAME_SIZE 32
+struct exynos_display_t {
+ uint32_t type;
+ uint32_t index;
+ char display_name[MAX_NAME_SIZE];
+ char decon_node_name[MAX_NAME_SIZE];
+ char vsync_node_name[MAX_NAME_SIZE];
+};
+
+
+#define PRIMARY_MAIN_EXTERNAL_WINCNT 2
+#define EXTERNAL_MAIN_EXTERNAL_WINCNT 4
+
+#define DISPLAY_MODE_MASK_LEN 8
+#define DISPLAY_MODE_MASK_BIT 0xff
+
+/* Decon WB */
+//#define DECON_WB_DEV_NAME "/dev/graphics/fb2"
+#define DECON_PRIMARY_DEV_NAME "/dev/graphics/fb0"
+#define DECON_WB_DEV_NAME "/dev/graphics/fb1"
+#define DECON_EXTERNAL_DEV_NAME "/dev/graphics/fb1"
+#define DECON_PAD_WB 8
+#define DECON_WB_SUBDEV_NAME "exynos-decon2"
+#define DECON_EXT_BASE_WINDOW 0
+#define PRIMARY_MAIN_BASE_WIN 2
+#define EXTERNAL_MAIN_BASE_WIN 4
+
+#define G2D_MAX_SRC_NUM 7
+#define DEFAULT_MPP_DST_YUV_FORMAT HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_SPN_SBWC
+
+enum {
+ DISPLAY_MODE_PRIMARY_MAIN = 0, /* This is default mode */
+ DISPLAY_MODE_EXTERNAL_MAIN,
+ DISPLAY_MODE_NUM
+};
+
+
+const uint32_t PRIMARY_DISP_BASE_WIN[] = {PRIMARY_MAIN_BASE_WIN, EXTERNAL_MAIN_BASE_WIN};
+
+#define EXTERNAL_MAIN_DISPLAY_START_BIT (DISPLAY_MODE_MASK_LEN * DISPLAY_MODE_EXTERNAL_MAIN)
+enum {
+ EXTERNAL_MAIN_DISPLAY_PRIMARY_BIT = 1 << (EXTERNAL_MAIN_DISPLAY_START_BIT + HWC_DISPLAY_PRIMARY),
+ EXTERNAL_MAIN_DISPLAY_EXTERNAL_BIT = 1 << (EXTERNAL_MAIN_DISPLAY_START_BIT + HWC_DISPLAY_EXTERNAL),
+ EXTERNAL_MAIN_DISPLAY_VIRTUAL_BIT = 1 << (EXTERNAL_MAIN_DISPLAY_START_BIT + HWC_DISPLAY_VIRTUAL),
+};
+
+const exynos_mpp_t AVAILABLE_OTF_MPP_UNITS[] = {
+ {MPP_DPP_G, MPP_LOGICAL_DPP_G, "DPP_G0", 0, 0, HWC_DISPLAY_PRIMARY_BIT|EXTERNAL_MAIN_DISPLAY_PRIMARY_BIT},
+ {MPP_DPP_G, MPP_LOGICAL_DPP_G, "DPP_G1", 1, 0, HWC_DISPLAY_EXTERNAL_BIT|EXTERNAL_MAIN_DISPLAY_EXTERNAL_BIT},
+ {MPP_DPP_GF, MPP_LOGICAL_DPP_GF, "DPP_GF0", 0, 0, HWC_DISPLAY_PRIMARY_BIT|EXTERNAL_MAIN_DISPLAY_EXTERNAL_BIT},
+ {MPP_DPP_VGS, MPP_LOGICAL_DPP_VGS, "DPP_VGS0", 0, 0, HWC_DISPLAY_EXTERNAL_BIT|EXTERNAL_MAIN_DISPLAY_EXTERNAL_BIT},
+};
+
+const exynos_mpp_t AVAILABLE_M2M_MPP_UNITS[] = {
+ {MPP_MSC, MPP_LOGICAL_MSC, "MSC0_PRI", 0, 0, HWC_DISPLAY_PRIMARY_BIT|EXTERNAL_MAIN_DISPLAY_PRIMARY_BIT},
+ {MPP_MSC, MPP_LOGICAL_MSC_YUV, "MSC0_EXT", 0, 1, HWC_DISPLAY_EXTERNAL_BIT|EXTERNAL_MAIN_DISPLAY_EXTERNAL_BIT},
+ {MPP_G2D, MPP_LOGICAL_G2D_YUV, "G2D0-YUV_PRI", 0, 0, HWC_DISPLAY_PRIMARY_BIT|EXTERNAL_MAIN_DISPLAY_PRIMARY_BIT},
+ {MPP_G2D, MPP_LOGICAL_G2D_YUV, "G2D0-YUV_EXT", 0, 1, HWC_DISPLAY_EXTERNAL_BIT|EXTERNAL_MAIN_DISPLAY_EXTERNAL_BIT},
+ {MPP_G2D, MPP_LOGICAL_G2D_RGB, "G2D0-RGB_PRI", 0, 2, HWC_DISPLAY_PRIMARY_BIT|EXTERNAL_MAIN_DISPLAY_PRIMARY_BIT},
+ {MPP_G2D, MPP_LOGICAL_G2D_RGB, "G2D0-RGB_EXT", 0, 3, HWC_DISPLAY_EXTERNAL_BIT|EXTERNAL_MAIN_DISPLAY_EXTERNAL_BIT},
+ {MPP_G2D, MPP_LOGICAL_G2D_COMBO, "G2D0-COMBO_VIR", 0, 4, HWC_DISPLAY_VIRTUAL_BIT},
+};
+
+const exynos_display_t AVAILABLE_DISPLAY_UNITS[] = {
+ {HWC_DISPLAY_PRIMARY, 0, "PrimaryDisplay", "/dev/graphics/fb0", "14850000.decon_f/vsync"},
+ {HWC_DISPLAY_EXTERNAL, 0, "ExternalDisplay", "/dev/graphics/fb1", "14850000.decon_t/vsync"},
+ {HWC_DISPLAY_VIRTUAL, 0, "VirtualDisplay", {}, {}},
+};
+
+#define DISPLAY_COUNT sizeof(AVAILABLE_DISPLAY_UNITS)/sizeof(exynos_display_t)
+
+const uint32_t ATTRIBUTE_PRIORITY_LIST[] = {
+};
+
+struct display_resource_info_t {
+ uint32_t displayId;
+ /* If this variable has a non-zero value, the display uses resource sets by defined value */
+ uint32_t fix_setcnt;
+ /* Small number have higher priority than bigger one.
+ * Range of priority is from 0 to (NUM_OF_DISPLAY_NEEDED_OTFMPP -1) */
+ uint32_t dpp_priority;
+ uint32_t attr_priority[MAX_ATTRIBUTE_NUM];
+};
+
+const display_resource_info_t RESOURCE_INFO_TABLE[] = {
+};
+
+#endif
diff --git a/exynos9610/libhwc2.1/ExynosResourceRestriction.h b/exynos9610/libhwc2.1/ExynosResourceRestriction.h
new file mode 100644
index 0000000..39802c5
--- /dev/null
+++ b/exynos9610/libhwc2.1/ExynosResourceRestriction.h
@@ -0,0 +1,239 @@
+/*
+ * Copyright (C) 2012 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.
+ */
+
+#ifndef EXYNOS_RESOURCE_RESTRICTION_H_
+#define EXYNOS_RESOURCE_RESTRICTION_H_
+
+#include "ExynosHWCModule.h"
+/*******************************************************************
+ * Structures for restrictions
+ * ****************************************************************/
+#define RESTRICTION_NONE 0
+
+#define USE_MODULE_ATTR
+
+/* Basic supported features */
+static feature_support_t feature_table[] =
+{
+ {MPP_DPP_G,
+ MPP_ATTR_BLOCK_MODE | MPP_ATTR_WINDOW_UPDATE | MPP_ATTR_DIM
+ },
+
+ {MPP_DPP_GF,
+ MPP_ATTR_AFBC | MPP_ATTR_BLOCK_MODE | MPP_ATTR_WINDOW_UPDATE | MPP_ATTR_DIM
+ },
+
+ {MPP_DPP_VGS,
+ MPP_ATTR_BLOCK_MODE | MPP_ATTR_WINDOW_UPDATE | MPP_ATTR_SCALE | MPP_ATTR_DIM
+ },
+
+ {MPP_MSC,
+ MPP_ATTR_FLIP_H | MPP_ATTR_FLIP_V | MPP_ATTR_ROT_90 |
+ MPP_ATTR_USE_CAPA
+ },
+
+ {MPP_G2D,
+ MPP_ATTR_AFBC | MPP_ATTR_FLIP_H | MPP_ATTR_FLIP_V | MPP_ATTR_ROT_90 |
+ MPP_ATTR_HDR10 | MPP_ATTR_USE_CAPA | MPP_ATTR_DIM
+ }
+};
+
+/**************************************************************************************
+ * HAL_PIXEL_FORMATs
+enum {
+ HAL_PIXEL_FORMAT_RGBA_8888 = 1,
+ HAL_PIXEL_FORMAT_RGBX_8888 = 2,
+ HAL_PIXEL_FORMAT_RGB_888 = 3,
+ HAL_PIXEL_FORMAT_RGB_565 = 4,
+ HAL_PIXEL_FORMAT_BGRA_8888 = 5,
+ HAL_PIXEL_FORMAT_YV12 = 0x32315659, // YCrCb 4:2:0 Planar
+ HAL_PIXEL_FORMAT_YCbCr_422_SP = 0x10, // NV16
+ HAL_PIXEL_FORMAT_YCrCb_420_SP = 0x11, // NV21
+ HAL_PIXEL_FORMAT_YCbCr_422_I = 0x14, // YUY2
+ HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_P_M = 0x101,
+ HAL_PIXEL_FORMAT_EXYNOS_CbYCrY_422_I = 0x103,
+ HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_SP_M = 0x105,
+ HAL_PIXEL_FORMAT_EXYNOS_YCrCb_422_SP = 0x106,
+ HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_SP_M_TILED= 0x107,
+ HAL_PIXEL_FORMAT_EXYNOS_ARGB_8888 = 0x108,
+ HAL_PIXEL_FORMAT_EXYNOS_YCrCb_422_I = 0x116,
+ HAL_PIXEL_FORMAT_EXYNOS_CrYCbY_422_I = 0x118,
+ HAL_PIXEL_FORMAT_EXYNOS_YV12_M = 0x11C,
+ HAL_PIXEL_FORMAT_EXYNOS_YCrCb_420_SP_M = 0x11D,
+ HAL_PIXEL_FORMAT_EXYNOS_YCrCb_420_SP_M_FULL = 0x11E,
+ HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_P = 0x11F,
+ HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_SP = 0x120,
+ HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_SP_M_PRIV = 0x121,
+ // contiguous(single fd) custom formats
+ HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_PN = 0x122,
+ HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_SPN = 0x123,
+ HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_SPN_TILED = 0x124,
+ // 10-bit format (8bit + separated 2bit)
+ HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_SP_M_S10B = 0x125,
+ // 10-bit contiguous(single fd, 8bit + separated 2bit) custom formats
+ HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_SPN_S10B = 0x126,
+};
+*************************************************************************************/
+
+const restriction_key restriction_format_table[] =
+{
+ {MPP_DPP_G, NODE_NONE, HAL_PIXEL_FORMAT_RGB_565, 0},
+ {MPP_DPP_G, NODE_NONE, HAL_PIXEL_FORMAT_RGBA_8888, 0},
+ {MPP_DPP_G, NODE_NONE, HAL_PIXEL_FORMAT_RGBX_8888, 0},
+ {MPP_DPP_G, NODE_NONE, HAL_PIXEL_FORMAT_BGRA_8888, 0},
+ {MPP_DPP_G, NODE_NONE, HAL_PIXEL_FORMAT_RGBA_1010102, 0},
+ {MPP_DPP_GF, NODE_NONE, HAL_PIXEL_FORMAT_RGB_565, 0},
+ {MPP_DPP_GF, NODE_NONE, HAL_PIXEL_FORMAT_RGBA_8888, 0},
+ {MPP_DPP_GF, NODE_NONE, HAL_PIXEL_FORMAT_RGBX_8888, 0},
+ {MPP_DPP_GF, NODE_NONE, HAL_PIXEL_FORMAT_BGRA_8888, 0},
+ {MPP_DPP_GF, NODE_NONE, HAL_PIXEL_FORMAT_RGBA_1010102, 0},
+ {MPP_DPP_VGS, NODE_NONE, HAL_PIXEL_FORMAT_RGB_565, 0},
+ {MPP_DPP_VGS, NODE_NONE, HAL_PIXEL_FORMAT_RGBA_8888, 0},
+ {MPP_DPP_VGS, NODE_NONE, HAL_PIXEL_FORMAT_RGBX_8888, 0},
+ {MPP_DPP_VGS, NODE_NONE, HAL_PIXEL_FORMAT_BGRA_8888, 0},
+ {MPP_DPP_VGS, NODE_NONE, HAL_PIXEL_FORMAT_RGBA_1010102, 0},
+ {MPP_DPP_VGS, NODE_NONE, HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_SP_M, 0},
+ {MPP_DPP_VGS, NODE_NONE, HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_SP_M_PRIV, 0},
+ {MPP_DPP_VGS, NODE_NONE, HAL_PIXEL_FORMAT_EXYNOS_YCrCb_420_SP_M, 0},
+ {MPP_DPP_VGS, NODE_NONE, HAL_PIXEL_FORMAT_EXYNOS_YCrCb_420_SP_M_FULL, 0},
+ {MPP_DPP_VGS, NODE_NONE, HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_SPN, 0},
+ {MPP_DPP_VGS, NODE_NONE, HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_SP_M_S10B, 0},
+ {MPP_DPP_VGS, NODE_NONE, HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_SPN_S10B, 0},
+ {MPP_MSC, NODE_NONE, HAL_PIXEL_FORMAT_RGB_565, 0},
+ {MPP_MSC, NODE_NONE, HAL_PIXEL_FORMAT_RGB_888, 0},
+ {MPP_MSC, NODE_NONE, HAL_PIXEL_FORMAT_RGBA_8888, 0},
+ {MPP_MSC, NODE_NONE, HAL_PIXEL_FORMAT_RGBX_8888, 0},
+ {MPP_MSC, NODE_NONE, HAL_PIXEL_FORMAT_BGRA_8888, 0},
+ {MPP_MSC, NODE_NONE, HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_SP_M, 0},
+ {MPP_MSC, NODE_NONE, HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_SP_M_PRIV, 0},
+ {MPP_MSC, NODE_NONE, HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_SP_M_TILED, 0},
+ {MPP_MSC, NODE_NONE, HAL_PIXEL_FORMAT_EXYNOS_YCrCb_420_SP_M, 0},
+ {MPP_MSC, NODE_NONE, HAL_PIXEL_FORMAT_EXYNOS_YCrCb_420_SP_M_FULL, 0},
+ {MPP_MSC, NODE_NONE, HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_SPN, 0},
+ {MPP_MSC, NODE_NONE, HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_SP_M_S10B, 0},
+ {MPP_MSC, NODE_NONE, HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_SPN_S10B, 0},
+ {MPP_MSC, NODE_NONE, HAL_PIXEL_FORMAT_YCrCb_420_SP, 0},
+ {MPP_MSC, NODE_NONE, HAL_PIXEL_FORMAT_YV12, 0},
+ {MPP_MSC, NODE_NONE, HAL_PIXEL_FORMAT_EXYNOS_YV12_M, 0},
+ {MPP_MSC, NODE_NONE, HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_P_M, 0},
+ {MPP_MSC, NODE_NONE, HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_PN, 0},
+ {MPP_MSC, NODE_NONE, HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_SPN_TILED, 0},
+ {MPP_G2D, NODE_NONE, HAL_PIXEL_FORMAT_RGB_565, 0},
+ {MPP_G2D, NODE_NONE, HAL_PIXEL_FORMAT_RGB_888, 0},
+ {MPP_G2D, NODE_NONE, HAL_PIXEL_FORMAT_RGBA_8888, 0},
+ {MPP_G2D, NODE_NONE, HAL_PIXEL_FORMAT_RGBX_8888, 0},
+ {MPP_G2D, NODE_NONE, HAL_PIXEL_FORMAT_BGRA_8888, 0},
+ {MPP_G2D, NODE_NONE, HAL_PIXEL_FORMAT_RGBA_1010102, 0},
+ {MPP_G2D, NODE_NONE, HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_SP_M, 0},
+ {MPP_G2D, NODE_NONE, HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_SP_M_PRIV, 0},
+ {MPP_G2D, NODE_NONE, HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_SP_M_TILED, 0},
+ {MPP_G2D, NODE_NONE, HAL_PIXEL_FORMAT_EXYNOS_YCrCb_420_SP_M, 0},
+ {MPP_G2D, NODE_NONE, HAL_PIXEL_FORMAT_EXYNOS_YCrCb_420_SP_M_FULL, 0},
+ {MPP_G2D, NODE_NONE, HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_SPN, 0},
+ {MPP_G2D, NODE_NONE, HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_SP_M_S10B, 0},
+ {MPP_G2D, NODE_NONE, HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_SPN_S10B, 0},
+ {MPP_G2D, NODE_NONE, HAL_PIXEL_FORMAT_YCrCb_420_SP, 0},
+ {MPP_G2D, NODE_NONE, HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_SPN_TILED, 0}
+};
+
+const restriction_size_element restriction_size_table_rgb[] =
+{
+ {{MPP_DPP_G, NODE_SRC, HAL_PIXEL_FORMAT_NONE, 0},
+ { 1, 1, 65535, 8191, 16, 16, 1, 1, 4096, 4096, 16, 16, 1, 1, 1, 1}},
+ {{MPP_DPP_GF, NODE_SRC, HAL_PIXEL_FORMAT_NONE, 0},
+ { 1, 1, 65535, 8191, 16, 16, 1, 1, 4096, 4096, 16, 16, 1, 1, 1, 1}},
+ {{MPP_DPP_VGS, NODE_SRC, HAL_PIXEL_FORMAT_NONE, 0},
+ { 2, 8, 65535, 8191, 16, 16, 1, 1, 4096, 4096, 16, 16, 1, 1, 1, 1}},
+ {{MPP_MSC, NODE_SRC, HAL_PIXEL_FORMAT_NONE, 0},
+ { 16, 64, 8192, 8192, 16, 16, 1, 1, 8192, 8192, 16, 16, 1, 1, 1, 1}},
+ {{MPP_DPP_G, NODE_DST, HAL_PIXEL_FORMAT_NONE, 0},
+ { 1, 1, 65535, 8191, 16, 16, 1, 1, 4096, 4096, 16, 16, 1, 1, 1, 1}},
+ {{MPP_DPP_GF, NODE_DST, HAL_PIXEL_FORMAT_NONE, 0},
+ { 1, 1, 65535, 8191, 16, 16, 1, 1, 4096, 4096, 16, 16, 1, 1, 1, 1}},
+ {{MPP_DPP_VGS, NODE_DST, HAL_PIXEL_FORMAT_NONE, 0},
+ { 2, 8, 65535, 8191, 16, 16, 1, 1, 4096, 4096, 16, 16, 1, 1, 1, 1}},
+ {{MPP_MSC, NODE_DST, HAL_PIXEL_FORMAT_NONE, 0},
+ { 16, 64, 8192, 8192, 4, 4, 1, 1, 8192, 8192, 4, 4, 1, 1, 1, 1}},
+ /* MPP_G2D maxUpScale = max crop size / min crop size */
+ {{MPP_G2D, NODE_NONE, HAL_PIXEL_FORMAT_NONE, 0},
+ { 8192, 8192, 8192, 8192, 1, 1, 1, 1, 8192, 8192, 1, 1, 1, 1, 1, 1}}
+};
+
+const restriction_size_element restriction_size_table_yuv[] =
+{
+ {{MPP_DPP_G, NODE_SRC, HAL_PIXEL_FORMAT_NONE, 0},
+ { 1, 1, 65534, 8190, 32, 32, 2, 2, 4096, 4096, 32, 32, 2, 2, 2, 2}},
+ {{MPP_DPP_GF, NODE_SRC, HAL_PIXEL_FORMAT_NONE, 0},
+ { 1, 1, 65534, 8190, 32, 32, 2, 2, 4096, 4096, 32, 32, 2, 2, 2, 2}},
+ {{MPP_DPP_VGS, NODE_SRC, HAL_PIXEL_FORMAT_NONE, 0},
+ { 2, 8, 65534, 8190, 32, 32, 2, 2, 4096, 4096, 32, 32, 2, 2, 2, 2}},
+ {{MPP_MSC, NODE_SRC, HAL_PIXEL_FORMAT_NONE, 0},
+ { 16, 64, 8192, 8192, 16, 16, 2, 2, 8192, 8192, 16, 16, 2, 2, 2, 2}},
+ /* MPP_G2D maxUpScale = max crop size / min crop size */
+ {{MPP_G2D, NODE_SRC, HAL_PIXEL_FORMAT_NONE, 0},
+ { 4, 8192, 8192, 8192, 2, 2, 2, 2, 8192, 8192, 1, 1, 1, 1, 1, 1}},
+ {{MPP_DPP_G, NODE_DST, HAL_PIXEL_FORMAT_NONE, 0},
+ { 1, 1, 65535, 8191, 16, 16, 1, 1, 4096, 4096, 16, 16, 1, 1, 1, 1}},
+ {{MPP_DPP_GF, NODE_DST, HAL_PIXEL_FORMAT_NONE, 0},
+ { 1, 1, 65535, 8191, 16, 16, 1, 1, 4096, 4096, 16, 16, 1, 1, 1, 1}},
+ {{MPP_DPP_VGS, NODE_DST, HAL_PIXEL_FORMAT_NONE, 0},
+ { 2, 8, 65535, 8191, 16, 16, 1, 1, 4096, 4096, 16, 16, 1, 1, 1, 1}},
+ {{MPP_MSC, NODE_DST, HAL_PIXEL_FORMAT_NONE, 0},
+ { 16, 64, 8192, 8192, 4, 4, 2, 2, 8192, 8192, 4, 4, 2, 2, 2, 2}},
+ /* MPP_G2D maxUpScale = max crop size / min crop size */
+ {{MPP_G2D, NODE_DST, HAL_PIXEL_FORMAT_NONE, 0},
+ { 8192, 8192, 8192, 8192, 2, 2, 2, 2, 8192, 8192, 2, 2, 2, 2, 2, 2}}
+};
+
+const restriction_table_element restriction_tables[RESTRICTION_MAX] =
+{
+ {RESTRICTION_RGB, restriction_size_table_rgb, sizeof(restriction_size_table_rgb)/sizeof(restriction_size_element)},
+ {RESTRICTION_YUV, restriction_size_table_yuv, sizeof(restriction_size_table_yuv)/sizeof(restriction_size_element)}
+};
+
+static ppc_table ppc_table_map = {
+ {PPC_IDX(MPP_G2D,PPC_FORMAT_YUV420,PPC_ROT_NO), {1.4, 1.3, 1.7, 2.5, 5.9, 1.3, 1.5}},
+ {PPC_IDX(MPP_G2D,PPC_FORMAT_YUV420,PPC_ROT), {1.0, 0.9, 1.6, 2.6, 3.5, 0.9, 1.6}},
+
+ {PPC_IDX(MPP_G2D,PPC_FORMAT_YUV422,PPC_ROT_NO), {1.5, 1.1, 1.8, 2.5, 3.5, 1.1, 1.7}},
+ {PPC_IDX(MPP_G2D,PPC_FORMAT_YUV422,PPC_ROT), {1.3, 1.0, 1.5, 2.6, 3.2, 1.0, 1.6}},
+
+ {PPC_IDX(MPP_G2D,PPC_FORMAT_RGB32,PPC_ROT_NO), {1.5, 1.1, 1.8, 2.5, 3.5, 1.1, 1.7}},
+ {PPC_IDX(MPP_G2D,PPC_FORMAT_RGB32,PPC_ROT), {1.3, 1.0, 1.5, 2.6, 3.2, 1.0, 1.6}},
+
+ {PPC_IDX(MPP_G2D,PPC_FORMAT_YUV8_2,PPC_ROT_NO), {0.9, 0.9, 1.3, 1.5, 2.0, 0.7, 1.2}},
+ {PPC_IDX(MPP_G2D,PPC_FORMAT_YUV8_2,PPC_ROT), {0.4, 0.4, 1.1, 1.0, 1.8, 0.4, 1.2}},
+
+ {PPC_IDX(MPP_G2D,PPC_FORMAT_AFBC,PPC_ROT_NO), {1.5, 0.8, 0.8, 1.2, 1.6, 0.8, 1.4}},
+ {PPC_IDX(MPP_G2D,PPC_FORMAT_AFBC,PPC_ROT), {1.5, 0.8, 0.8, 1.2, 1.6, 0.8, 1.4}},
+
+ {PPC_IDX(MPP_MSC,PPC_FORMAT_YUV420,PPC_ROT_NO), {5.4, }},
+ {PPC_IDX(MPP_MSC,PPC_FORMAT_YUV420,PPC_ROT), {4.86, }},
+
+ {PPC_IDX(MPP_MSC,PPC_FORMAT_YUV422,PPC_ROT_NO), {3.6, }},
+ {PPC_IDX(MPP_MSC,PPC_FORMAT_YUV422,PPC_ROT), {3.24, }},
+
+ {PPC_IDX(MPP_MSC,PPC_FORMAT_P010,PPC_ROT_NO), {4.86, }},
+ {PPC_IDX(MPP_MSC,PPC_FORMAT_P010,PPC_ROT), {4.37, }},
+
+ {PPC_IDX(MPP_MSC,PPC_FORMAT_YUV8_2,PPC_ROT_NO), {4.37, }},
+ {PPC_IDX(MPP_MSC,PPC_FORMAT_YUV8_2,PPC_ROT), {3.94, }},
+
+ {PPC_IDX(MPP_MSC,PPC_FORMAT_RGB32,PPC_ROT_NO), {1.8, }},
+ {PPC_IDX(MPP_MSC,PPC_FORMAT_RGB32,PPC_ROT), {1.62, }}
+};
+
+#endif
diff --git a/exynos9610/libhwc2.1/device/ExynosDeviceModule.cpp b/exynos9610/libhwc2.1/device/ExynosDeviceModule.cpp
new file mode 100644
index 0000000..3932d12
--- /dev/null
+++ b/exynos9610/libhwc2.1/device/ExynosDeviceModule.cpp
@@ -0,0 +1,90 @@
+/*
+ * Copyright (C) 2012 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 "ExynosDisplay.h"
+#include "ExynosLayer.h"
+#include "ExynosDeviceModule.h"
+#include "ExynosGraphicBuffer.h"
+
+using vendor::graphics::ExynosGraphicBufferMeta;
+
+ExynosDeviceModule::ExynosDeviceModule()
+{
+}
+
+ExynosDeviceModule::~ExynosDeviceModule() {
+}
+
+bool ExynosDeviceModule::getCPUPerfInfo(int display, int config, int32_t *cpuIDs, int32_t *minClock) {
+ ExynosDisplay *_display = mDisplays[display];
+ if (_display == NULL) return false;
+
+ if (config == SF_PERF_MODE_SET)
+ *cpuIDs = CPU_CLUSTER1_MASK;
+ else if (config == SF_PERF_MODE_RESET)
+ *cpuIDs = CPU_CLUSTER0_MASK | CPU_CLUSTER1_MASK;
+ else {
+ ALOGI("%s:: config is invalid : [display %d] %d", __func__, display, config);
+ return false;
+ }
+
+ *minClock = 0;
+
+ return true;
+}
+
+int32_t ExynosDeviceModule::presentDisplay(ExynosDisplay *display,
+ int32_t *outPresentFence)
+{
+#if defined(EPIC_LIBRARY_PATH) && !defined(BUILD_IN_UNIVERSAL)
+ constexpr uint32_t standard_layer_nums = 3;
+ if ((mEPICAcquireConditional && mEPICFreeConditional) &&
+ (display->mType == HWC_DISPLAY_PRIMARY)) {
+ bool isUsingEPIC = false;
+ bool ret = true;
+
+ if (mBoostingEPICHandle == 0 && mEPICRequestFcnPtr)
+ mBoostingEPICHandle = mEPICRequestFcnPtr(BOOST_SCENARIO_NUM);
+
+ if ((display->mLayers.size() >= standard_layer_nums) &&
+ display->mLayers[0]->mLayerBuffer &&
+ isFormatYUV(ExynosGraphicBufferMeta::get_format(display->mLayers[0]->mLayerBuffer))) {
+ for (uint32_t i = 1; i < standard_layer_nums; i++) {
+ ExynosLayer* layer = display->mLayers[i];
+ if (WIDTH(layer->mPreprocessedInfo.displayFrame) > (display->mXres * 9 / 10) &&
+ HEIGHT(layer->mPreprocessedInfo.displayFrame) > (display->mYres * 9 / 10) &&
+ (layer->mTransform != 0) &&
+ (layer->mLayerBuffer && (!isAFBCCompressed(layer->mLayerBuffer)))) {
+ isUsingEPIC = true;
+ break;
+ }
+ }
+ }
+
+ if (isUsingEPIC && !mEPICState && mBoostingEPICHandle) {
+ ret = mEPICAcquireConditional(mBoostingEPICHandle, BOOST_SCENARIO_NAME, strlen(BOOST_SCENARIO_NAME));
+ mEPICState = true;
+ } else if (!isUsingEPIC && mEPICState && mBoostingEPICHandle) {
+ ret = mEPICFreeConditional(mBoostingEPICHandle, BOOST_SCENARIO_NAME, strlen(BOOST_SCENARIO_NAME));
+ mEPICState = false;
+ }
+
+ if (ret == false)
+ ALOGE("%s:: EPIC function call has problem", __func__);
+ }
+#endif
+ return ExynosDevice::presentDisplay(display, outPresentFence);
+}
diff --git a/exynos9610/libhwc2.1/device/ExynosDeviceModule.h b/exynos9610/libhwc2.1/device/ExynosDeviceModule.h
new file mode 100644
index 0000000..81ccdc4
--- /dev/null
+++ b/exynos9610/libhwc2.1/device/ExynosDeviceModule.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2012 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.
+ */
+
+#ifndef EXYNOS_DEVICE_MODULE_H
+#define EXYNOS_DEVICE_MODULE_H
+
+#include "ExynosDevice.h"
+#include "CpuPerfInfo.h"
+
+class ExynosDeviceModule : public ExynosDevice {
+ public:
+ ExynosDeviceModule();
+ ~ExynosDeviceModule();
+ bool getCPUPerfInfo(int display, int config, int32_t *cpuIDs, int32_t *minClock);
+ enum {
+ SF_PERF_MODE_SET = -1,
+ SF_PERF_MODE_RESET = -2,
+ };
+ virtual int32_t presentDisplay(ExynosDisplay *display,
+ int32_t *outPresentFence) override;
+ bool mEPICState = false;
+ epic_handle mBoostingEPICHandle = 0;
+};
+
+#endif
diff --git a/exynos9610/libhwc2.1/device/ExynosResourceManagerModule.cpp b/exynos9610/libhwc2.1/device/ExynosResourceManagerModule.cpp
new file mode 100644
index 0000000..25d0fa3
--- /dev/null
+++ b/exynos9610/libhwc2.1/device/ExynosResourceManagerModule.cpp
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2012 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 "ExynosResourceManagerModule.h"
+#include "ExynosPrimaryDisplayModule.h"
+#include "ExynosMPPModule.h"
+#include "ExynosLayer.h"
+#include "ExynosHWCHelper.h"
+#include "ExynosGraphicBuffer.h"
+
+using namespace vendor::graphics;
+
+ExynosResourceManagerModule::ExynosResourceManagerModule()
+ : ExynosResourceManager()
+{
+}
+
+ExynosResourceManagerModule::~ExynosResourceManagerModule()
+{
+}
+
+int32_t ExynosResourceManagerModule::prepareResources()
+{
+ int32_t ret = ExynosResourceManager::prepareResources();
+ for (size_t i = 0; i < mDisplays.size(); i++) {
+ if (mDisplays[i]->mPlugState == false)
+ continue;
+ for (size_t j = 0; j < mM2mMPPs.size(); j++) {
+ if ((mM2mMPPs[j]->mPhysicalType == MPP_G2D) &&
+ (mM2mMPPs[j]->mReservedDisplayInfo.displayIdentifier.id ==
+ mDisplays[i]->mDisplayId))
+ ((ExynosMPPModule*)mM2mMPPs[j])->mHdrCoefInterface = mDisplays[i]->mHdrCoefInterface;
+ }
+ }
+ return ret;
+}
+
+void ExynosResourceManagerModule::preAssignWindows()
+{
+ ExynosPrimaryDisplayModule *primaryDisplay =
+ (ExynosPrimaryDisplayModule *)getDisplay(getDisplayId(HWC_DISPLAY_PRIMARY, 0));
+ primaryDisplay->mBaseWindowIndex = 0;
+ primaryDisplay->mMaxWindowNum =
+ primaryDisplay->mDisplayInterface->getMaxWindowNum();
+
+ bool externalConnected = false;
+ for (auto display: mDisplays) {
+ if ((display == nullptr) ||
+ (display->mType == HWC_DISPLAY_PRIMARY) ||
+ (display->mUseDpu == false))
+ continue;
+ if (display->mPlugState == true) {
+ if (display->mType == HWC_DISPLAY_EXTERNAL)
+ externalConnected = true;
+ }
+ }
+
+ if (externalConnected) {
+ primaryDisplay->mBaseWindowIndex = PRIMARY_DISP_BASE_WIN[mDeviceInfo.displayMode];
+ primaryDisplay->mMaxWindowNum -= PRIMARY_DISP_BASE_WIN[mDeviceInfo.displayMode];
+ }
+}
diff --git a/exynos9610/libhwc2.1/device/ExynosResourceManagerModule.h b/exynos9610/libhwc2.1/device/ExynosResourceManagerModule.h
new file mode 100644
index 0000000..fb1dead
--- /dev/null
+++ b/exynos9610/libhwc2.1/device/ExynosResourceManagerModule.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2012 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.
+ */
+#ifndef _EXYNOS_RESOURCE_MANAGER_MODULE_H
+#define _EXYNOS_RESOURCE_MANAGER_MODULE_H
+
+#include "ExynosResourceManager.h"
+
+class ExynosLayer;
+
+class ExynosResourceManagerModule : public ExynosResourceManager {
+ public:
+ ExynosResourceManagerModule();
+ virtual ~ExynosResourceManagerModule();
+ virtual int32_t prepareResources() override;
+ virtual void preAssignWindows() override;
+};
+
+#endif // _EXYNOS_RESOURCE_MANAGER_MODULE_H
diff --git a/exynos9610/libhwc2.1/display/ExynosDisplayFbInterfaceModule.cpp b/exynos9610/libhwc2.1/display/ExynosDisplayFbInterfaceModule.cpp
new file mode 100644
index 0000000..4fd1b67
--- /dev/null
+++ b/exynos9610/libhwc2.1/display/ExynosDisplayFbInterfaceModule.cpp
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2012 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 "ExynosDisplayFbInterfaceModule.h"
+
+decon_idma_type getDPPChannel(uint32_t type, uint32_t index) {
+ for (auto &chMap : IDMA_CHANNEL_MAP) {
+ if((chMap.type == type) && (chMap.index == index))
+ return chMap.channel;
+ }
+ return MAX_DECON_DMA_TYPE;
+}
diff --git a/exynos9610/libhwc2.1/display/ExynosDisplayFbInterfaceModule.h b/exynos9610/libhwc2.1/display/ExynosDisplayFbInterfaceModule.h
new file mode 100644
index 0000000..d32baae
--- /dev/null
+++ b/exynos9610/libhwc2.1/display/ExynosDisplayFbInterfaceModule.h
@@ -0,0 +1,23 @@
+/*
+ * Copyright (C) 2012 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.
+ */
+
+#ifndef EXYNOS_DISPLAY_FB_INTERFACE_MODULE_H
+#define EXYNOS_DISPLAY_FB_INTERFACE_MODULE_H
+
+#include "ExynosDisplayFbInterface.h"
+
+decon_idma_type getDPPChannel(uint32_t type, uint32_t index);
+#endif
diff --git a/exynos9610/libhwc2.1/externaldisplay/ExynosExternalDisplayFbInterfaceModule.cpp b/exynos9610/libhwc2.1/externaldisplay/ExynosExternalDisplayFbInterfaceModule.cpp
new file mode 100644
index 0000000..a7c3d90
--- /dev/null
+++ b/exynos9610/libhwc2.1/externaldisplay/ExynosExternalDisplayFbInterfaceModule.cpp
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2021 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 "ExynosDisplayFbInterfaceModule.h"
+#include "ExynosExternalDisplayFbInterfaceModule.h"
+
+ExynosExternalDisplayFbInterfaceModule::ExynosExternalDisplayFbInterfaceModule()
+: ExynosExternalDisplayFbInterface()
+{
+}
+
+ExynosExternalDisplayFbInterfaceModule::~ExynosExternalDisplayFbInterfaceModule()
+{
+}
+
+decon_idma_type ExynosExternalDisplayFbInterfaceModule::getDeconDMAType(
+ uint32_t type, uint32_t index)
+{
+ return getDPPChannel(type, index);
+}
diff --git a/exynos9610/libhwc2.1/externaldisplay/ExynosExternalDisplayFbInterfaceModule.h b/exynos9610/libhwc2.1/externaldisplay/ExynosExternalDisplayFbInterfaceModule.h
new file mode 100644
index 0000000..683fb71
--- /dev/null
+++ b/exynos9610/libhwc2.1/externaldisplay/ExynosExternalDisplayFbInterfaceModule.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2021 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.
+ */
+
+#ifndef EXYNOS_EXTERNALDISPLAY_FB_INTERFACE_MODULE_H
+#define EXYNOS_EXTERNALDISPLAY_FB_INTERFACE_MODULE_H
+
+#include "ExynosDisplayFbInterface.h"
+#include "ExynosExternalDisplayFbInterface.h"
+
+class ExynosExternalDisplayFbInterfaceModule : public ExynosExternalDisplayFbInterface {
+ public:
+ ExynosExternalDisplayFbInterfaceModule();
+ virtual ~ExynosExternalDisplayFbInterfaceModule();
+ virtual decon_idma_type getDeconDMAType(
+ uint32_t type, uint32_t index) override;
+};
+#endif
diff --git a/exynos9610/libhwc2.1/externaldisplay/ExynosExternalDisplayModule.cpp b/exynos9610/libhwc2.1/externaldisplay/ExynosExternalDisplayModule.cpp
new file mode 100644
index 0000000..e93c0cb
--- /dev/null
+++ b/exynos9610/libhwc2.1/externaldisplay/ExynosExternalDisplayModule.cpp
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2012 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.
+ */
+//#define LOG_NDEBUG 0
+#include "ExynosExternalDisplayModule.h"
+#include "ExynosPrimaryDisplayModule.h"
+
+#ifdef USES_VIRTUAL_DISPLAY
+#include "ExynosVirtualDisplayModule.h"
+#endif
+
+#include "ExynosHWCDebug.h"
+#include "ExynosHWCHelper.h"
+
+#define SKIP_FRAME_COUNT 3
+
+ExynosExternalDisplayModule::ExynosExternalDisplayModule(DisplayIdentifier node)
+ : ExynosExternalDisplay(node)
+{
+
+}
+
+ExynosExternalDisplayModule::~ExynosExternalDisplayModule ()
+{
+
+}
diff --git a/exynos9610/libhwc2.1/externaldisplay/ExynosExternalDisplayModule.h b/exynos9610/libhwc2.1/externaldisplay/ExynosExternalDisplayModule.h
new file mode 100644
index 0000000..3eaad1b
--- /dev/null
+++ b/exynos9610/libhwc2.1/externaldisplay/ExynosExternalDisplayModule.h
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2012 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.
+ */
+#ifndef EXYNOS_EXTERNAL_DISPLAY_MODULE_H
+#define EXYNOS_EXTERNAL_DISPLAY_MODULE_H
+
+#include "ExynosDisplay.h"
+#include "ExynosExternalDisplay.h"
+
+class ExynosExternalDisplayModule : public ExynosExternalDisplay {
+ public:
+ ExynosExternalDisplayModule(DisplayIdentifier node);
+ ~ExynosExternalDisplayModule();
+};
+
+#endif
diff --git a/exynos9610/libhwc2.1/primarydisplay/ExynosPrimaryDisplayFbInterfaceModule.cpp b/exynos9610/libhwc2.1/primarydisplay/ExynosPrimaryDisplayFbInterfaceModule.cpp
new file mode 100644
index 0000000..e3a191d
--- /dev/null
+++ b/exynos9610/libhwc2.1/primarydisplay/ExynosPrimaryDisplayFbInterfaceModule.cpp
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2021 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 "ExynosDisplayFbInterfaceModule.h"
+#include "ExynosPrimaryDisplayFbInterfaceModule.h"
+
+ExynosPrimaryDisplayFbInterfaceModule::ExynosPrimaryDisplayFbInterfaceModule()
+: ExynosPrimaryDisplayFbInterface()
+{
+}
+
+ExynosPrimaryDisplayFbInterfaceModule::~ExynosPrimaryDisplayFbInterfaceModule()
+{
+}
+
+decon_idma_type ExynosPrimaryDisplayFbInterfaceModule::getDeconDMAType(
+ uint32_t type, uint32_t index)
+{
+ return getDPPChannel(type, index);
+}
diff --git a/exynos9610/libhwc2.1/primarydisplay/ExynosPrimaryDisplayFbInterfaceModule.h b/exynos9610/libhwc2.1/primarydisplay/ExynosPrimaryDisplayFbInterfaceModule.h
new file mode 100644
index 0000000..90bab0a
--- /dev/null
+++ b/exynos9610/libhwc2.1/primarydisplay/ExynosPrimaryDisplayFbInterfaceModule.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2021 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.
+ */
+
+#ifndef EXYNOS_PRIMARYDISPLAY_FB_INTERFACE_MODULE_H
+#define EXYNOS_PRIMARYDISPLAY_FB_INTERFACE_MODULE_H
+
+#include "ExynosDisplayFbInterface.h"
+#include "ExynosPrimaryDisplayFbInterface.h"
+
+class ExynosPrimaryDisplayFbInterfaceModule : public ExynosPrimaryDisplayFbInterface {
+ public:
+ ExynosPrimaryDisplayFbInterfaceModule();
+ virtual ~ExynosPrimaryDisplayFbInterfaceModule();
+ virtual decon_idma_type getDeconDMAType(
+ uint32_t type, uint32_t index) override;
+};
+#endif
diff --git a/exynos9610/libhwc2.1/primarydisplay/ExynosPrimaryDisplayModule.cpp b/exynos9610/libhwc2.1/primarydisplay/ExynosPrimaryDisplayModule.cpp
new file mode 100644
index 0000000..50cf0c8
--- /dev/null
+++ b/exynos9610/libhwc2.1/primarydisplay/ExynosPrimaryDisplayModule.cpp
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2012 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 "ExynosPrimaryDisplayModule.h"
+#include "ExynosHWCDebug.h"
+
+ExynosPrimaryDisplayModule::ExynosPrimaryDisplayModule(DisplayIdentifier node)
+ : ExynosPrimaryDisplay(node)
+{
+}
+
+ExynosPrimaryDisplayModule::~ExynosPrimaryDisplayModule () {
+}
+
+int32_t ExynosPrimaryDisplayModule::getHdrCapabilities(uint32_t *outNumTypes,
+ int32_t *outTypes, float *outMaxLuminance,
+ float *outMaxAverageLuminance, float *outMinLuminance) {
+ DISPLAY_LOGD(eDebugHWC, "HWC2: %s, %d", __func__, __LINE__);
+
+ if (outNumTypes == NULL || outMaxLuminance == NULL ||
+ outMaxAverageLuminance == NULL || outMinLuminance == NULL) {
+ return HWC2_ERROR_BAD_PARAMETER;
+ }
+
+ if (outTypes == NULL) {
+ /*
+ * This function is always called twice.
+ * outTypes is NULL in the first call and
+ * outType is valid pointer in the second call.
+ * Get information only in the first call.
+ * Use saved information in the second call.
+ */
+ if (mDisplayInterface->updateHdrCapabilities(mHdrTypes, &mMaxLuminance,
+ &mMaxAverageLuminance, &mMinLuminance) != NO_ERROR)
+ return HWC2_ERROR_BAD_CONFIG;
+ }
+
+ *outMaxLuminance = mMaxLuminance;
+ *outMaxAverageLuminance = mMaxAverageLuminance;
+ *outMinLuminance = mMinLuminance;
+
+ uint32_t vectorSize = static_cast<uint32_t>(mHdrTypes.size());
+ if (outTypes != NULL) {
+ if (*outNumTypes != vectorSize) {
+ DISPLAY_LOGE("%s:: Invalid parameter (outNumTypes: %u, mHdrTypes.size: %u)",
+ __func__, *outNumTypes, vectorSize);
+ return HWC2_ERROR_BAD_PARAMETER;
+ }
+ for (uint32_t i = 0; i < vectorSize; i++)
+ outTypes[i] = mHdrTypes[i];
+
+ ALOGI("%s: hdrTypeNum(%u), maxLuminance(%f), maxAverageLuminance(%f), minLuminance(%f)",
+ __func__, vectorSize, *outMaxLuminance,
+ *outMaxAverageLuminance, *outMinLuminance);
+ } else {
+ *outNumTypes = vectorSize;
+ }
+
+ return HWC2_ERROR_NONE;
+}
diff --git a/exynos9610/libhwc2.1/primarydisplay/ExynosPrimaryDisplayModule.h b/exynos9610/libhwc2.1/primarydisplay/ExynosPrimaryDisplayModule.h
new file mode 100644
index 0000000..6a87c42
--- /dev/null
+++ b/exynos9610/libhwc2.1/primarydisplay/ExynosPrimaryDisplayModule.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2012 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.
+ */
+#ifndef EXYNOS_DISPLAY_MODULE_H
+#define EXYNOS_DISPLAY_MODULE_H
+
+#include "ExynosDisplay.h"
+#include "ExynosPrimaryDisplay.h"
+#include "ExynosHWCDebug.h"
+
+class ExynosPrimaryDisplayModule : public ExynosPrimaryDisplay {
+ public:
+ ExynosPrimaryDisplayModule(DisplayIdentifier node);
+ ~ExynosPrimaryDisplayModule();
+ virtual int32_t getHdrCapabilities(uint32_t *outNumTypes, int32_t * /*android_hdr_t*/ outTypes, float *outMaxLuminance,
+ float *outMaxAverageLuminance, float *outMinLuminance);
+};
+
+#endif
diff --git a/exynos9610/libhwc2.1/resources/ExynosMPPModule.cpp b/exynos9610/libhwc2.1/resources/ExynosMPPModule.cpp
new file mode 100644
index 0000000..aa19e02
--- /dev/null
+++ b/exynos9610/libhwc2.1/resources/ExynosMPPModule.cpp
@@ -0,0 +1,269 @@
+/*
+ * Copyright (C) 2012 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 "ExynosMPPModule.h"
+#include "ExynosHWCDebug.h"
+#include <hardware/exynos/hdrInterface.h>
+
+ExynosMPPModule::ExynosMPPModule(uint32_t physicalType, uint32_t logicalType,
+ const char *name, uint32_t physicalIndex, uint32_t logicalIndex,
+ uint32_t preAssignInfo, uint32_t mppType)
+ : ExynosMPP(physicalType, logicalType, name, physicalIndex, logicalIndex, preAssignInfo, mppType)
+{
+}
+
+ExynosMPPModule::~ExynosMPPModule()
+{
+}
+
+uint32_t ExynosMPPModule::getMPPClock()
+{
+ if (mPhysicalType == MPP_G2D)
+ return 667000;
+ else
+ return 0;
+}
+
+bool ExynosMPPModule::isDataspaceSupportedByMPP(struct exynos_image &src, struct exynos_image &dst)
+{
+ if ((mLogicalType == MPP_LOGICAL_G2D_YUV) &&
+ (hasHdrInfo(src)) && (dst.exynosFormat == HAL_PIXEL_FORMAT_YCBCR_P010) &&
+ (src.dataSpace == dst.dataSpace))
+ return false;
+ return ExynosMPP::isDataspaceSupportedByMPP(src, dst);
+}
+
+#ifdef USE_HDR_INTERFACE
+bool ExynosMPPModule::isQualifiedHDRPipeRestriction(DisplayInfo &display,
+ struct exynos_image &src, struct exynos_image &dst)
+{
+ bool ret = true;
+ if (mPhysicalType == MPP_G2D) {
+ android_dataspace_t src_dataSpace = src.dataSpace;
+ android_dataspace_t dst_dataSpace = getDstDataspace(dst.exynosFormat.halFormat(), display, dst.dataSpace);
+ int hdrError = 0;
+ struct hdrCoef output[MPP_G2D_HDR_PIPE_NUM];
+ int hdr_map[MPP_G2D_HDR_PIPE_NUM];
+
+ /* If G2D doesn't support WCG and color mode is NATIVE,
+ * G2D can composit layers without WCG processing.
+ * So we will return true forcely if it meets the condition. */
+ if ((mMaxSrcLayerNum > 1) && ((mAttr & MPP_ATTR_WCG) == 0) &&
+ (display.colorMode == HAL_COLOR_MODE_NATIVE))
+ return true;
+
+ memset(&output, 0, sizeof(struct hdrCoef) * MPP_G2D_HDR_PIPE_NUM);
+ memset(&hdr_map, 0, sizeof(int) * MPP_G2D_HDR_PIPE_NUM);
+
+ if (hasHdrInfo(src) && src.metaParcel)
+ mAssignedLuminance.push(src.metaParcel->sHdrStaticInfo.sType1.mMaxDisplayLuminance/10000);
+ else
+ mAssignedLuminance.push(0);
+
+ /* Google gave guide that HAL_DATSPACE_UNKNOWN should trigger
+ the same behavior in HWC as HAL_DATASPACE_V0_SRGB. (11251035)
+ So we modified data space from UNKNOWN to V0_SRGB */
+ if (src_dataSpace == HAL_DATASPACE_UNKNOWN) {
+ if (src.exynosFormat.isRgb())
+ src_dataSpace = HAL_DATASPACE_V0_SRGB;
+ else
+ src_dataSpace = HAL_DATASPACE_V0_BT601_625;
+ }
+ mAssignedDataspace.push(src_dataSpace);
+ if (dst_dataSpace == HAL_DATASPACE_UNKNOWN)
+ dst_dataSpace = HAL_DATASPACE_V0_SRGB;
+
+ if ((hdrError = mHdrCoefInterface->getHdrCoef(
+ const_cast<android_dataspace *>(mAssignedDataspace.array()),
+ const_cast<int *>(mAssignedLuminance.array()),
+ mAssignedDataspace.size(), dst_dataSpace, 0,
+ output, hdr_map)) < 0) {
+ ret = false;
+ /* TODO: Need to change to check enum */
+ if (hdrError != -2)
+ MPP_LOGE("%s:: getHdrCoef error(%d)", __func__, hdrError);
+ MPP_LOGD(eDebugMPP, "getHdrCoef ret(%d)", hdrError);
+ }
+
+ mAssignedDataspace.pop();
+ mAssignedLuminance.pop();
+ }
+ return ret;
+}
+
+int32_t ExynosMPPModule::resetMPP()
+{
+ int32_t ret = ExynosMPP::resetMPP();
+ if (mPhysicalType == MPP_G2D) {
+ mAssignedDataspace.clear();
+ mAssignedLuminance.clear();
+ }
+ return ret;
+}
+
+int32_t ExynosMPPModule::resetAssignedState()
+{
+ int32_t ret = ExynosMPP::resetAssignedState();
+ for (int i = (int)mAssignedSources.size(); i-- > 0;) {
+ if (mPhysicalType == MPP_G2D) {
+ mAssignedDataspace.removeItemsAt(i);
+ mAssignedLuminance.removeItemsAt(i);
+ }
+ }
+ return ret;
+}
+
+int32_t ExynosMPPModule::resetAssignedState(ExynosMPPSource *mppSource)
+{
+ int32_t ret = ExynosMPP::resetAssignedState(mppSource);
+ for (int i = (int)mAssignedSources.size(); i-- > 0;) {
+ if (mAssignedSources[i] == mppSource) {
+ if (mPhysicalType == MPP_G2D) {
+ mAssignedDataspace.removeItemsAt(i);
+ mAssignedLuminance.removeItemsAt(i);
+ }
+ }
+ }
+ return ret;
+}
+
+bool ExynosMPPModule::isAssignableState(DisplayInfo &display, struct exynos_image &src, struct exynos_image &dst)
+{
+ bool ret = ExynosMPP::isAssignableState(display, src, dst);
+ if (ret)
+ return isQualifiedHDRPipeRestriction(display, src, dst);
+ else
+ return false;
+}
+
+int32_t ExynosMPPModule::setG2DColorConversionInfo()
+{
+ int32_t ret = 0;
+ if (mPhysicalType == MPP_G2D) {
+ struct hdrCoef output[MPP_G2D_HDR_PIPE_NUM];
+ int hdr_map[MPP_G2D_HDR_PIPE_NUM];
+ int hdrError = 0;
+ int sourceNum = mAssignedSources.size();
+ memset(&output, 0, sizeof(struct hdrCoef) * MPP_G2D_HDR_PIPE_NUM);
+ memset(&hdr_map, 0, sizeof(int) * MPP_G2D_HDR_PIPE_NUM);
+ Vector<android_dataspace> assignedDataspace;
+ Vector<int> assignedLuminance;
+ android_dataspace_t dst_dataSpace = mDstImgs[mCurrentDstBuf].dataspace;
+ String8 log;
+
+ /* If G2D doesn't support WCG and color mode is NATIVE,
+ * G2D can composit layers without WCG processing.
+ * So we will return true forcely if it meets the condition. */
+ if ((mMaxSrcLayerNum > 1) && ((mAttr & MPP_ATTR_WCG) == 0) &&
+ (mAssignedDisplayInfo.displayIdentifier.id != UINT32_MAX) &&
+ (mAssignedDisplayInfo.colorMode == HAL_COLOR_MODE_NATIVE)) {
+ mAcrylicHandle->clearLibHdrCoefficient();
+ return ret;
+ }
+
+ if (sourceNum > 1) {
+ assignedDataspace.add(HAL_DATASPACE_V0_SRGB);
+ assignedLuminance.add(0);
+ }
+
+ for (size_t i = 0; i < sourceNum; i++) {
+ android_dataspace src_dataSpace = mAssignedSources[i]->mSrcImg.dataSpace;
+ /* Google gave guide that HAL_DATSPACE_UNKNOWN should trigger
+ the same behavior in HWC as HAL_DATASPACE_V0_SRGB. (11251035)
+ So we modified data space from UNKNOWN to V0_SRGB */
+ if (src_dataSpace == HAL_DATASPACE_UNKNOWN) {
+ if (mAssignedSources[i]->mSrcImg.exynosFormat.isRgb())
+ src_dataSpace = HAL_DATASPACE_V0_SRGB;
+ else
+ src_dataSpace = HAL_DATASPACE_V0_BT601_625;
+ }
+ assignedDataspace.add(src_dataSpace);
+ if (hasHdrInfo(mAssignedSources[i]->mSrcImg) &&
+ mAssignedSources[i]->mSrcImg.metaParcel)
+ assignedLuminance.add(mAssignedSources[i]->mSrcImg.metaParcel->sHdrStaticInfo.sType1.mMaxDisplayLuminance/10000);
+ else
+ assignedLuminance.add(0);
+ }
+ if (dst_dataSpace == HAL_DATASPACE_UNKNOWN)
+ dst_dataSpace = HAL_DATASPACE_V0_SRGB;
+
+ if ((hdrError = mHdrCoefInterface->getHdrCoef(
+ const_cast<android_dataspace *>(assignedDataspace.array()),
+ const_cast<int *>(assignedLuminance.array()),
+ assignedDataspace.size(), dst_dataSpace, 0,
+ output, hdr_map)) == NO_ERROR) {
+ /* Propagate hdr coef to libacryl */
+ mAcrylicHandle->setLibHdrCoefficient(hdr_map, output);
+ } else {
+ if (hdrError < 0)
+ MPP_LOGE("%s:: getHdrCoef error(%d)", __func__, hdrError);
+ /*
+ * It is error case if the return value is minus.
+ * There is no layer that needs conversion
+ * if return value is positive number.
+ * Clear hdr coef setting for libacryl in those cases
+ */
+ /* Clear hdr coef setting to libacryl */
+ mAcrylicHandle->clearLibHdrCoefficient();
+ }
+ }
+ return ret;
+}
+
+int32_t ExynosMPPModule::assignMPP(DisplayInfo &display, ExynosMPPSource *mppSource)
+{
+ int32_t ret = ExynosMPP::assignMPP(display, mppSource);
+ if (mPhysicalType == MPP_G2D) {
+ android_dataspace src_dataSpace = mppSource->mSrcImg.dataSpace;
+ if ((mNeedSolidColorLayer == true) && (mAssignedDataspace.size() == 0)) {
+ mAssignedDataspace.add(HAL_DATASPACE_V0_SRGB);
+ mAssignedLuminance.add(0);
+ }
+ /* Google gave guide that HAL_DATSPACE_UNKNOWN should trigger
+ the same behavior in HWC as HAL_DATASPACE_V0_SRGB. (11251035)
+ So we modified data space from UNKNOWN to V0_SRGB */
+ if (src_dataSpace == HAL_DATASPACE_UNKNOWN) {
+ if (mppSource->mSrcImg.exynosFormat.isRgb())
+ src_dataSpace = HAL_DATASPACE_V0_SRGB;
+ else
+ src_dataSpace = HAL_DATASPACE_V0_BT601_625;
+ }
+ mAssignedDataspace.add(src_dataSpace);
+ if (hasHdrInfo(mppSource->mSrcImg) && mppSource->mSrcImg.metaParcel)
+ mAssignedLuminance.add(mppSource->mSrcImg.metaParcel->sHdrStaticInfo.sType1.mMaxDisplayLuminance/10000);
+ else
+ mAssignedLuminance.add(0);
+ }
+ return ret;
+}
+
+int32_t ExynosMPPModule::doPostProcessingInternal()
+{
+ int32_t ret = 0;
+ if (mAcrylicHandle == NULL) {
+ MPP_LOGE("%s:: mAcrylicHandle is NULL", __func__);
+ return -EINVAL;
+ }
+ if (mPhysicalType == MPP_G2D) {
+ if ((ret = setG2DColorConversionInfo()) != NO_ERROR) {
+ MPP_LOGE("%s:: fail to setColorConversionInfo ret %d", __func__, ret);
+ return ret;
+ }
+ }
+
+ return ExynosMPP::doPostProcessingInternal();
+}
+#endif
diff --git a/exynos9610/libhwc2.1/resources/ExynosMPPModule.h b/exynos9610/libhwc2.1/resources/ExynosMPPModule.h
new file mode 100644
index 0000000..853b9cd
--- /dev/null
+++ b/exynos9610/libhwc2.1/resources/ExynosMPPModule.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2012 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.
+ */
+#ifndef _EXYNOS_MPP_MODULE_H
+#define _EXYNOS_MPP_MODULE_H
+
+#include "ExynosMPP.h"
+#define MPP_G2D_HDR_PIPE_NUM 4
+
+class ExynosMPPModule : public ExynosMPP {
+ public:
+ ExynosMPPModule(uint32_t physicalType, uint32_t logicalType, const char *name,
+ uint32_t physicalIndex, uint32_t logicalIndex, uint32_t preAssignInfo, uint32_t mppType);
+ ~ExynosMPPModule();
+ virtual bool isDataspaceSupportedByMPP(struct exynos_image &src, struct exynos_image &dst);
+ protected:
+ virtual uint32_t getMPPClock();
+
+ public:
+#ifdef USE_HDR_INTERFACE
+ int mHdrMap[MPP_G2D_HDR_PIPE_NUM];
+ Vector<android_dataspace> mAssignedDataspace;
+ Vector<int> mAssignedLuminance;
+ hdrInterface *mHdrCoefInterface;
+ bool isQualifiedHDRPipeRestriction(DisplayInfo &display,
+ struct exynos_image &src, struct exynos_image &dst);
+ virtual int32_t resetMPP();
+ virtual int32_t resetAssignedState();
+ virtual int32_t resetAssignedState(ExynosMPPSource *mppSource);
+ virtual bool isAssignableState(DisplayInfo &display, struct exynos_image &src, struct exynos_image &dst);
+ int32_t setG2DColorConversionInfo();
+ virtual int32_t assignMPP(DisplayInfo &display, ExynosMPPSource *mppSource);
+ virtual int32_t doPostProcessingInternal();
+#endif
+};
+
+#endif
diff --git a/exynos9610/libhwc2.1/virtualdisplay/ExynosVirtualDisplayModule.cpp b/exynos9610/libhwc2.1/virtualdisplay/ExynosVirtualDisplayModule.cpp
new file mode 100644
index 0000000..060906a
--- /dev/null
+++ b/exynos9610/libhwc2.1/virtualdisplay/ExynosVirtualDisplayModule.cpp
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2012 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.
+ */
+#undef LOG_TAG
+#define LOG_TAG "virtualdisplaymodule"
+
+#include "ExynosVirtualDisplayModule.h"
+
+ExynosVirtualDisplayModule::ExynosVirtualDisplayModule(DisplayIdentifier node)
+ : ExynosVirtualDisplay(node)
+{
+ mGLESFormat = HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_SP_M;
+
+ mBaseWindowIndex = 0;
+ mMaxWindowNum = 0;
+}
+
+ExynosVirtualDisplayModule::~ExynosVirtualDisplayModule ()
+{
+
+}
diff --git a/exynos9610/libhwc2.1/virtualdisplay/ExynosVirtualDisplayModule.h b/exynos9610/libhwc2.1/virtualdisplay/ExynosVirtualDisplayModule.h
new file mode 100644
index 0000000..e8475cc
--- /dev/null
+++ b/exynos9610/libhwc2.1/virtualdisplay/ExynosVirtualDisplayModule.h
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2012 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.
+ */
+#ifndef EXYNOS_VIRTUAL_DISPLAY_MODULE_H
+#define EXYNOS_VIRTUAL_DISPLAY_MODULE_H
+
+#include "ExynosDisplay.h"
+#include "ExynosVirtualDisplay.h"
+
+class ExynosVirtualDisplayModule : public ExynosVirtualDisplay {
+public:
+ ExynosVirtualDisplayModule(DisplayIdentifier node);
+ ~ExynosVirtualDisplayModule();
+};
+
+#endif