Merge "Revert "For msm8996, replacing LOCAL_COPY_HEADERS with LOCAL_EXPORT_C_INCLUDE_DIRS, for VNDK""
am: b2ce73994c
Change-Id: Ia744826d24ba2c5bd1e35b722f29e8cd361ba01c
diff --git a/Android.mk b/Android.mk
index d9aa722..9829818 100644
--- a/Android.mk
+++ b/Android.mk
@@ -19,8 +19,8 @@
ifneq ($(filter msm8996,$(TARGET_BOARD_PLATFORM)),)
include $(call all-named-subdir-makefiles,msm8996)
else
- ifneq ($(filter msmcobalt,$(TARGET_BOARD_PLATFORM)),)
- include $(call all-named-subdir-makefiles,msmcobalt)
+ ifneq ($(filter msm8998,$(TARGET_BOARD_PLATFORM)),)
+ include $(call all-named-subdir-makefiles,msm8998)
endif
endif
endif
diff --git a/msm8226/common.mk b/msm8226/common.mk
index a96d2d0..e8a434e 100644
--- a/msm8226/common.mk
+++ b/msm8226/common.mk
@@ -62,6 +62,6 @@
# available in the build tree.
# If the macro is not present, the headers are picked from hardware/qcom/msmXXXX
# failing which, they are picked from bionic.
- common_deps += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr
- kernel_includes += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include
+ common_deps += $(BOARD_KERNEL_HEADER_DEPENDENCIES)
+ kernel_includes += $(BOARD_KERNEL_HEADER_DIR)
endif
diff --git a/msm8996/sdm/libs/core/display_base.cpp b/msm8996/sdm/libs/core/display_base.cpp
index 2f6e577..adab52b 100644
--- a/msm8996/sdm/libs/core/display_base.cpp
+++ b/msm8996/sdm/libs/core/display_base.cpp
@@ -757,7 +757,7 @@
SDEDisplayMode *sde_display_mode = it->second;
- DLOGD("Color Mode Name = %s corresponding mode_id = %d", sde_display_mode->name,
+ DLOGV_IF(kTagQDCM, "Color Mode Name = %s corresponding mode_id = %d", sde_display_mode->name,
sde_display_mode->id);
DisplayError error = kErrorNone;
error = color_mgr_->ColorMgrSetMode(sde_display_mode->id);
diff --git a/msm8996/sdm/libs/hwc2/hwc_display.cpp b/msm8996/sdm/libs/hwc2/hwc_display.cpp
index 8bba9ed..fe140fe 100644
--- a/msm8996/sdm/libs/hwc2/hwc_display.cpp
+++ b/msm8996/sdm/libs/hwc2/hwc_display.cpp
@@ -154,7 +154,7 @@
current_color_mode_ = mode;
current_color_transform_ = hint;
CopyColorTransformMatrix(matrix, color_matrix_);
- DLOGI("Setting Color Mode = %d Transform Hint = %d Success", mode, hint);
+ DLOGV_IF(kTagQDCM, "Setting Color Mode = %d Transform Hint = %d Success", mode, hint);
return HWC2::Error::None;
}
@@ -774,14 +774,23 @@
}
HWC2::Error HWCDisplay::AcceptDisplayChanges() {
- if (!validated_ && !layer_set_.empty()) {
+ if (layer_set_.empty()) {
+ return HWC2::Error::None;
+ }
+
+ if (!validated_) {
return HWC2::Error::NotValidated;
}
for (const auto& change : layer_changes_) {
auto hwc_layer = layer_map_[change.first];
auto composition = change.second;
- hwc_layer->UpdateClientCompositionType(composition);
+
+ if (hwc_layer == nullptr) {
+ DLOGW("Null layer: %" PRIu64, change.first);
+ } else {
+ hwc_layer->UpdateClientCompositionType(composition);
+ }
}
return HWC2::Error::None;
}
diff --git a/msm8996/sdm/libs/hwc2/hwc_session.cpp b/msm8996/sdm/libs/hwc2/hwc_session.cpp
index 60db660..e4d6cac 100644
--- a/msm8996/sdm/libs/hwc2/hwc_session.cpp
+++ b/msm8996/sdm/libs/hwc2/hwc_session.cpp
@@ -215,7 +215,9 @@
// HWC2 functions returned in GetFunction
// Defined in the same order as in the HWC2 header
-static int32_t AcceptDisplayChanges(hwc2_device_t *device, hwc2_display_t display) {
+int32_t HWCSession::AcceptDisplayChanges(hwc2_device_t *device,
+ hwc2_display_t display) {
+ SCOPE_LOCK(locker_);
return HWCSession::CallDisplayFunction(device, display, &HWCDisplay::AcceptDisplayChanges);
}
@@ -590,7 +592,7 @@
switch (descriptor) {
case HWC2::FunctionDescriptor::AcceptDisplayChanges:
- return AsFP<HWC2_PFN_ACCEPT_DISPLAY_CHANGES>(AcceptDisplayChanges);
+ return AsFP<HWC2_PFN_ACCEPT_DISPLAY_CHANGES>(HWCSession::AcceptDisplayChanges);
case HWC2::FunctionDescriptor::CreateLayer:
return AsFP<HWC2_PFN_CREATE_LAYER>(CreateLayer);
case HWC2::FunctionDescriptor::CreateVirtualDisplay:
diff --git a/msm8996/sdm/libs/hwc2/hwc_session.h b/msm8996/sdm/libs/hwc2/hwc_session.h
index ce3e27f..7ae59ed 100644
--- a/msm8996/sdm/libs/hwc2/hwc_session.h
+++ b/msm8996/sdm/libs/hwc2/hwc_session.h
@@ -82,6 +82,7 @@
// HWC2 Functions that require a concrete implementation in hwc session
// and hence need to be member functions
+ static int32_t AcceptDisplayChanges(hwc2_device_t *device, hwc2_display_t display);
static int32_t CreateLayer(hwc2_device_t *device, hwc2_display_t display,
hwc2_layer_t *out_layer_id);
static int32_t CreateVirtualDisplay(hwc2_device_t *device, uint32_t width, uint32_t height,
diff --git a/msmcobalt/Android.mk b/msm8998/Android.mk
similarity index 86%
rename from msmcobalt/Android.mk
rename to msm8998/Android.mk
index b8b893c..60a48f5 100644
--- a/msmcobalt/Android.mk
+++ b/msm8998/Android.mk
@@ -1,5 +1,5 @@
sdm-libs := sdm/libs
-display-hals := libqservice libqdutils $(sdm-libs)/utils $(sdm-libs)/core
+display-hals := include libqservice libqdutils $(sdm-libs)/utils $(sdm-libs)/core
ifneq ($(TARGET_IS_HEADLESS), true)
display-hals += libcopybit liblight libmemtrack hdmi_cec \
diff --git a/msmcobalt/Makefile.am b/msm8998/Makefile.am
similarity index 100%
rename from msmcobalt/Makefile.am
rename to msm8998/Makefile.am
diff --git a/msmcobalt/common.mk b/msm8998/common.mk
similarity index 93%
rename from msmcobalt/common.mk
rename to msm8998/common.mk
index d7370ed..063dd4b 100644
--- a/msmcobalt/common.mk
+++ b/msm8998/common.mk
@@ -5,6 +5,10 @@
common_flags := -DDEBUG_CALC_FPS -Wno-missing-field-initializers
common_flags += -Wconversion -Wall -Werror -std=c++11
+ifeq ($(call is-board-platform-in-list, msmcobalt msm8998), true)
+common_flags += -DUSE_COLOR_METADATA
+endif
+
use_hwc2 := false
ifeq ($(TARGET_USES_HWC2), true)
use_hwc2 := true
@@ -17,6 +21,7 @@
common_includes += $(display_top)/libcopybit
endif
+common_includes += $(display_top)/include
common_includes += $(display_top)/sdm/include
common_header_export_path := qcom/display
diff --git a/msmcobalt/configure.ac b/msm8998/configure.ac
similarity index 100%
rename from msmcobalt/configure.ac
rename to msm8998/configure.ac
diff --git a/msmcobalt/hdmi_cec/Android.mk b/msm8998/hdmi_cec/Android.mk
similarity index 100%
rename from msmcobalt/hdmi_cec/Android.mk
rename to msm8998/hdmi_cec/Android.mk
diff --git a/msmcobalt/hdmi_cec/QHDMIClient.cpp b/msm8998/hdmi_cec/QHDMIClient.cpp
similarity index 100%
rename from msmcobalt/hdmi_cec/QHDMIClient.cpp
rename to msm8998/hdmi_cec/QHDMIClient.cpp
diff --git a/msmcobalt/hdmi_cec/QHDMIClient.h b/msm8998/hdmi_cec/QHDMIClient.h
similarity index 100%
rename from msmcobalt/hdmi_cec/QHDMIClient.h
rename to msm8998/hdmi_cec/QHDMIClient.h
diff --git a/msmcobalt/hdmi_cec/qhdmi_cec.cpp b/msm8998/hdmi_cec/qhdmi_cec.cpp
similarity index 100%
rename from msmcobalt/hdmi_cec/qhdmi_cec.cpp
rename to msm8998/hdmi_cec/qhdmi_cec.cpp
diff --git a/msmcobalt/hdmi_cec/qhdmi_cec.h b/msm8998/hdmi_cec/qhdmi_cec.h
similarity index 100%
rename from msmcobalt/hdmi_cec/qhdmi_cec.h
rename to msm8998/hdmi_cec/qhdmi_cec.h
diff --git a/msm8998/include/Android.mk b/msm8998/include/Android.mk
new file mode 100644
index 0000000..4d0d9f7
--- /dev/null
+++ b/msm8998/include/Android.mk
@@ -0,0 +1,9 @@
+LOCAL_PATH:= $(call my-dir)
+include $(LOCAL_PATH)/../common.mk
+include $(CLEAR_VARS)
+
+LOCAL_COPY_HEADERS_TO := $(common_header_export_path)
+LOCAL_COPY_HEADERS := color_metadata.h
+
+include $(BUILD_COPY_HEADERS)
+
diff --git a/msm8998/include/color_metadata.h b/msm8998/include/color_metadata.h
new file mode 100644
index 0000000..328cb0e
--- /dev/null
+++ b/msm8998/include/color_metadata.h
@@ -0,0 +1,180 @@
+/*
+* Copyright (c) 2016, 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 met:
+* * Redistributions of source code must retain the above copyright notice, this list of
+* conditions and the following disclaimer.
+* * Redistributions in binary form must reproduce the above copyright notice, this list of
+* conditions and the following disclaimer in the documentation and/or other materials provided
+* with the distribution.
+* * Neither the name of The Linux Foundation nor the names of its contributors may be used to
+* endorse or promote products derived from this software without specific prior written
+* permission.
+*
+* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+* NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef __COLOR_METADATA_H__
+#define __COLOR_METADATA_H__
+
+#ifdef __cplusplus
+extern "C" {
+#else
+#include <stdbool.h>
+#endif
+
+typedef enum ColorRange {
+ Range_Limited = 0,
+ Range_Full = 1,
+ Range_Max = 0xff,
+} ColorRange;
+
+// The following values matches the HEVC spec
+typedef enum ColorPrimaries {
+ // Unused = 0;
+ ColorPrimaries_BT709_5 = 1, // ITU-R BT.709-5 or equivalent
+ /* Unspecified = 2, Reserved = 3*/
+ ColorPrimaries_BT470_6M = 4, // ITU-R BT.470-6 System M or equivalent
+ ColorPrimaries_BT601_6_625 = 5, // ITU-R BT.601-6 625 or equivalent
+ ColorPrimaries_BT601_6_525 = 6, // ITU-R BT.601-6 525 or equivalent
+ ColorPrimaries_SMPTE_240M = 7, // SMPTE_240M
+ ColorPrimaries_GenericFilm = 8, // Generic Film
+ ColorPrimaries_BT2020 = 9, // ITU-R BT.2020 or equivalent
+ ColorPrimaries_SMPTE_ST428 = 10, // SMPTE_240M
+ ColorPrimaries_AdobeRGB = 11,
+ ColorPrimaries_DCIP3 = 12,
+ ColorPrimaries_Max = 0xff,
+} ColorPrimaries;
+
+typedef enum GammaTransfer {
+ // Unused = 0;
+ Transfer_sRGB = 1, // ITR-BT.709-5
+ /* Unspecified = 2, Reserved = 3 */
+ Transfer_Gamma2_2 = 4,
+ Transfer_Gamma2_8 = 5,
+ Transfer_SMPTE_170M = 6, // BT.601-6 525 or 625
+ Transfer_SMPTE_240M = 7, // SMPTE_240M
+ Transfer_Linear = 8,
+ Transfer_HLG = 9,
+ Transfer_XvYCC = 11, // IEC 61966-2-4
+ Transfer_BT1361 = 12, // Rec.ITU-R BT.1361 extended gamut
+ Transfer_SMPTE_ST2084 = 16, // 2084
+ // transfers unlikely to be required by Android
+ Transfer_ST_428 = 17, // SMPTE ST 428-1
+ Transfer_Max = 0xff,
+} GammaTransfer;
+
+typedef enum MatrixCoEfficients {
+ MatrixCoEff_Identity = 0,
+ MatrixCoEff_BT709_5 = 1,
+ /* Unspecified = 2, Reserved = 3 */
+ MatrixCoEff_BT601_6_625 = 5,
+ MatrixCoEff_BT601_6_525 = 6,
+ MatrixCoEff_SMPTE240M = 7, // used with 601_525_Unadjusted
+ MatrixCoEff_BT2020 = 9,
+ MatrixCoEff_BT2020Constant = 10,
+ MatrixCoEff_BT601_6_Unadjusted = 11, // Used with BT601_625(KR=0.222, KB=0.071)
+ MatrixCoEff_DCIP3 = 12,
+ MatrixCoEff_Max = 0xff,
+} MatrixCoEfficients;
+
+typedef struct Primaries {
+ uint32_t rgbPrimaries[3][2]; // unit 1/50000;
+ uint32_t whitePoint[2]; // unit 1/50000;
+} Primaries;
+
+typedef struct MasteringDisplay {
+ bool colorVolumeSEIEnabled;
+ Primaries primaries;
+ uint32_t maxDisplayLuminance; // unit: cd/m^2.
+ uint32_t minDisplayLuminance; // unit: 1/10000 cd/m^2.
+} MasteringDisplay;
+
+typedef struct ContentLightLevel {
+ bool lightLevelSEIEnabled;
+ uint32_t maxContentLightLevel; // unit: cd/m^2.
+ uint32_t minPicAverageLightLevel; // unit: 1/10000 cd/m^2.
+} ContentLightLevel;
+
+typedef struct ColorRemappingInfo {
+ bool criEnabled;
+ uint32_t crId;
+ uint32_t crCancelFlag;
+ uint32_t crPersistenceFlag;
+ uint32_t crVideoSignalInfoPresentFlag;
+ uint32_t crRange;
+ ColorPrimaries crPrimaries;
+ GammaTransfer crTransferFunction;
+ MatrixCoEfficients crMatrixCoefficients;
+ uint32_t crInputBitDepth;
+ uint32_t crOutputBitDepth;
+ uint32_t crPreLutNumValMinusOne[3];
+ uint32_t crPreLutCodedValue[3*33];
+ uint32_t crPreLutTargetValue[3*33];
+ uint32_t crMatrixPresentFlag;
+ uint32_t crLog2MatrixDenom;
+ int32_t crCoefficients[3*3];
+ uint32_t crPostLutNumValMinusOne[3];
+ uint32_t crPostLutCodedValue[3*33];
+ uint32_t crPostLutTargetValue[3*33];
+} ColorRemappingInfo;
+
+typedef struct ColorMetaData {
+ // Default values based on sRGB, needs to be overridden in gralloc
+ // based on the format and size.
+ ColorPrimaries colorPrimaries;
+ ColorRange range;
+ GammaTransfer transfer;
+ MatrixCoEfficients matrixCoefficients;
+
+ MasteringDisplay masteringDisplayInfo;
+ ContentLightLevel contentLightLevel;
+ ColorRemappingInfo cRI;
+} ColorMetaData;
+
+typedef struct Color10Bit {
+ uint32_t R: 10;
+ uint32_t G: 10;
+ uint32_t B: 10;
+ uint32_t A: 2;
+} Color10Bit;
+
+typedef struct Lut3d {
+ uint16_t dim; // dimension of each side of LUT cube (ex: 13, 17)in lutEntries
+ uint16_t gridSize; // number of elements in the gridEntries
+ /* Matrix ordering convension
+ for (b = 0; b < dim; b++) {
+ for (g = 0; g < dim; g++) {
+ for (r = 0; r < dim; r++) {
+ read/write [mR mG mB] associated w/ 3DLUT[r][g][b] to/from file
+ }
+ }
+ } */
+ Color10Bit *lutEntries;
+ bool validLutEntries; // Indicates if entries are valid and can be used.
+ /*
+ The grid is a 1D LUT for each of the R,G,B channels that can be
+ used to apply an independent nonlinear transformation to each
+ channel before it is used as a coordinate for addressing
+ the uniform 3D LUT. This effectively creates a non-uniformly
+ sampled 3D LUT. This is useful for having independent control
+ of the sampling grid density along each dimension for greater
+ precision in spite of having a relatively small number of samples.i
+ */
+ Color10Bit *gridEntries;
+ bool validGridEntries; // Indicates if entries are valid and can be used.
+} Lut3d;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // __COLOR_METADATA_H__
diff --git a/msmcobalt/libcopybit/Android.mk b/msm8998/libcopybit/Android.mk
similarity index 100%
rename from msmcobalt/libcopybit/Android.mk
rename to msm8998/libcopybit/Android.mk
diff --git a/msmcobalt/libcopybit/MODULE_LICENSE_APACHE2 b/msm8998/libcopybit/MODULE_LICENSE_APACHE2
similarity index 100%
rename from msmcobalt/libcopybit/MODULE_LICENSE_APACHE2
rename to msm8998/libcopybit/MODULE_LICENSE_APACHE2
diff --git a/msmcobalt/libcopybit/NOTICE b/msm8998/libcopybit/NOTICE
similarity index 100%
rename from msmcobalt/libcopybit/NOTICE
rename to msm8998/libcopybit/NOTICE
diff --git a/msmcobalt/libcopybit/c2d2.h b/msm8998/libcopybit/c2d2.h
similarity index 100%
rename from msmcobalt/libcopybit/c2d2.h
rename to msm8998/libcopybit/c2d2.h
diff --git a/msmcobalt/libcopybit/copybit.cpp b/msm8998/libcopybit/copybit.cpp
similarity index 100%
rename from msmcobalt/libcopybit/copybit.cpp
rename to msm8998/libcopybit/copybit.cpp
diff --git a/msmcobalt/libcopybit/copybit.h b/msm8998/libcopybit/copybit.h
similarity index 100%
rename from msmcobalt/libcopybit/copybit.h
rename to msm8998/libcopybit/copybit.h
diff --git a/msmcobalt/libcopybit/copybit_c2d.cpp b/msm8998/libcopybit/copybit_c2d.cpp
similarity index 100%
rename from msmcobalt/libcopybit/copybit_c2d.cpp
rename to msm8998/libcopybit/copybit_c2d.cpp
diff --git a/msmcobalt/libcopybit/copybit_priv.h b/msm8998/libcopybit/copybit_priv.h
similarity index 100%
rename from msmcobalt/libcopybit/copybit_priv.h
rename to msm8998/libcopybit/copybit_priv.h
diff --git a/msmcobalt/libcopybit/software_converter.cpp b/msm8998/libcopybit/software_converter.cpp
similarity index 100%
rename from msmcobalt/libcopybit/software_converter.cpp
rename to msm8998/libcopybit/software_converter.cpp
diff --git a/msmcobalt/libcopybit/software_converter.h b/msm8998/libcopybit/software_converter.h
similarity index 100%
rename from msmcobalt/libcopybit/software_converter.h
rename to msm8998/libcopybit/software_converter.h
diff --git a/msmcobalt/libgralloc/Android.mk b/msm8998/libgralloc/Android.mk
similarity index 100%
rename from msmcobalt/libgralloc/Android.mk
rename to msm8998/libgralloc/Android.mk
diff --git a/msmcobalt/libgralloc/MODULE_LICENSE_APACHE2 b/msm8998/libgralloc/MODULE_LICENSE_APACHE2
similarity index 100%
rename from msmcobalt/libgralloc/MODULE_LICENSE_APACHE2
rename to msm8998/libgralloc/MODULE_LICENSE_APACHE2
diff --git a/msmcobalt/libgralloc/Makefile.am b/msm8998/libgralloc/Makefile.am
similarity index 82%
rename from msmcobalt/libgralloc/Makefile.am
rename to msm8998/libgralloc/Makefile.am
index 2698df3..d57ad32 100644
--- a/msmcobalt/libgralloc/Makefile.am
+++ b/msm8998/libgralloc/Makefile.am
@@ -12,8 +12,9 @@
libmemalloc_la_SOURCES = $(cpp_sources)
libmemalloc_la_CFLAGS = $(COMMON_CFLAGS) -DLOG_TAG=\"qdmemalloc\"
libmemalloc_la_CPPFLAGS = $(AM_CPPFLAGS)
-libmemalloc_LDADD = -lhardware -lcutils -llog -lutils -ldl
libmemalloc_la_LIBADD = ../libqdutils/libqdutils.la
+libmemalloc_la_LIBADD += -lhardware -lcutils -llog -lutils -ldl
+libmemalloc_la_LDFLAGS = -shared -avoid-version
header_sources = gralloc_priv.h \
gr.h
@@ -31,7 +32,8 @@
libgralloc_la_SOURCES = $(c_sources)
libgralloc_la_CFLAGS = $(COMMON_CFLAGS) -DLOG_TAG=\"qdgralloc\"
libgralloc_la_CPPFLAGS = $(AM_CPPFLAGS)
-libgralloc_LDADD = -lhardware -lcutils -llog -lutils
libgralloc_la_LIBADD = ../libqdutils/libqdutils.la
libgralloc_la_LIBADD += ../libqdutils/libqdMetaData.la
-libgralloc_la_LIBADD += libmemalloc.la
\ No newline at end of file
+libgralloc_la_LIBADD += -lhardware -lcutils -llog -lutils -lbinder
+libgralloc_la_LIBADD += libmemalloc.la
+libgralloc_la_LDFLAGS = -shared -avoid-version
\ No newline at end of file
diff --git a/msmcobalt/libgralloc/NOTICE b/msm8998/libgralloc/NOTICE
similarity index 100%
rename from msmcobalt/libgralloc/NOTICE
rename to msm8998/libgralloc/NOTICE
diff --git a/msmcobalt/libgralloc/adreno_utils.h b/msm8998/libgralloc/adreno_utils.h
similarity index 100%
rename from msmcobalt/libgralloc/adreno_utils.h
rename to msm8998/libgralloc/adreno_utils.h
diff --git a/msmcobalt/libgralloc/alloc_controller.cpp b/msm8998/libgralloc/alloc_controller.cpp
similarity index 96%
rename from msmcobalt/libgralloc/alloc_controller.cpp
rename to msm8998/libgralloc/alloc_controller.cpp
index 0ef0a9a..ae167ba 100644
--- a/msmcobalt/libgralloc/alloc_controller.cpp
+++ b/msm8998/libgralloc/alloc_controller.cpp
@@ -59,16 +59,24 @@
#define ION_FLAG_ALLOW_NON_CONTIG 0
#endif
+#ifndef ION_FLAG_CP_CAMERA_PREVIEW
+#define ION_FLAG_CP_CAMERA_PREVIEW 0
+#endif
+
#ifdef MASTER_SIDE_CP
#define CP_HEAP_ID ION_SECURE_HEAP_ID
#define SD_HEAP_ID ION_SECURE_DISPLAY_HEAP_ID
#define ION_CP_FLAGS (ION_SECURE | ION_FLAG_CP_PIXEL)
#define ION_SD_FLAGS (ION_SECURE | ION_FLAG_CP_SEC_DISPLAY)
+#define ION_SC_FLAGS (ION_SECURE | ION_FLAG_CP_CAMERA)
+#define ION_SC_PREVIEW_FLAGS (ION_SECURE | ION_FLAG_CP_CAMERA_PREVIEW)
#else // SLAVE_SIDE_CP
#define CP_HEAP_ID ION_CP_MM_HEAP_ID
#define SD_HEAP_ID CP_HEAP_ID
#define ION_CP_FLAGS (ION_SECURE | ION_FLAG_ALLOW_NON_CONTIG)
#define ION_SD_FLAGS ION_SECURE
+#define ION_SC_FLAGS ION_SECURE
+#define ION_SC_PREVIEW_FLAGS ION_SECURE
#endif
using namespace gralloc;
@@ -180,6 +188,18 @@
}
+void AdrenoMemInfo::getUnalignedWidthAndHeight(const private_handle_t *hnd, int& unaligned_w,
+ int& unaligned_h) {
+ MetaData_t *metadata = (MetaData_t *)hnd->base_metadata;
+ if(metadata && metadata->operation & UPDATE_BUFFER_GEOMETRY) {
+ unaligned_w = metadata->bufferDim.sliceWidth;
+ unaligned_h = metadata->bufferDim.sliceHeight;
+ } else {
+ unaligned_w = hnd->unaligned_width;
+ unaligned_h = hnd->unaligned_height;
+ }
+}
+
bool isUncompressedRgbFormat(int format)
{
bool is_rgb_format = false;
@@ -461,6 +481,9 @@
* VM. Please add it to the define once available.
*/
ionFlags |= ION_SD_FLAGS;
+ } else if (usage & GRALLOC_USAGE_HW_CAMERA_MASK) {
+ ionHeapId = ION_HEAP(SD_HEAP_ID);
+ ionFlags |= (usage & GRALLOC_USAGE_HW_COMPOSER) ? ION_SC_PREVIEW_FLAGS : ION_SC_FLAGS;
} else {
ionHeapId = ION_HEAP(CP_HEAP_ID);
ionFlags |= ION_CP_FLAGS;
@@ -709,7 +732,6 @@
return size;
}
-
void getBufferAttributes(int width, int height, int format, int usage,
int& alignedw, int &alignedh, int& tiled, unsigned int& size)
{
@@ -892,7 +914,7 @@
private_handle_t* hnd = new private_handle_t(data.fd, data.size,
data.allocType, 0, format,
- alignedw, alignedh);
+ alignedw, alignedh, -1, 0, 0, w, h);
hnd->base = (uint64_t) data.base;
hnd->offset = data.offset;
hnd->gpuaddr = 0;
@@ -989,7 +1011,8 @@
aligned_h = VENUS_Y_SCANLINES(COLOR_FMT_NV12_UBWC, height);
break;
case HAL_PIXEL_FORMAT_YCbCr_420_TP10_UBWC:
- aligned_w = VENUS_Y_STRIDE(COLOR_FMT_NV12_BPP10_UBWC, width);
+ // The macro returns the stride which is 4/3 times the width, hence * 3/4
+ aligned_w = (VENUS_Y_STRIDE(COLOR_FMT_NV12_BPP10_UBWC, width) * 3) / 4;
aligned_h = VENUS_Y_SCANLINES(COLOR_FMT_NV12_BPP10_UBWC, height);
break;
default:
@@ -1096,6 +1119,7 @@
return err;
}
+ // Ubwc buffers
unsigned int meta_size = 0;
switch (hnd->format) {
case HAL_PIXEL_FORMAT_BGR_565:
@@ -1103,6 +1127,8 @@
break;
case HAL_PIXEL_FORMAT_RGBA_8888:
case HAL_PIXEL_FORMAT_RGBX_8888:
+ case HAL_PIXEL_FORMAT_RGBA_1010102:
+ case HAL_PIXEL_FORMAT_RGBX_1010102:
meta_size = getRgbUBwcMetaBufferSize(hnd->width, hnd->height, 4);
break;
default:
diff --git a/msmcobalt/libgralloc/alloc_controller.h b/msm8998/libgralloc/alloc_controller.h
similarity index 97%
rename from msmcobalt/libgralloc/alloc_controller.h
rename to msm8998/libgralloc/alloc_controller.h
index 8216b0c..45977e2 100644
--- a/msmcobalt/libgralloc/alloc_controller.h
+++ b/msm8998/libgralloc/alloc_controller.h
@@ -56,7 +56,7 @@
virtual IMemAlloc* getAllocator(int flags) = 0;
- virtual bool isDisableUBWCForEncoder();
+ virtual bool isDisableUBWCForEncoder() = 0;
virtual ~IAllocController() {};
diff --git a/msmcobalt/libgralloc/fb_priv.h b/msm8998/libgralloc/fb_priv.h
similarity index 100%
rename from msmcobalt/libgralloc/fb_priv.h
rename to msm8998/libgralloc/fb_priv.h
diff --git a/msmcobalt/libgralloc/framebuffer.cpp b/msm8998/libgralloc/framebuffer.cpp
similarity index 100%
rename from msmcobalt/libgralloc/framebuffer.cpp
rename to msm8998/libgralloc/framebuffer.cpp
diff --git a/msmcobalt/libgralloc/gpu.cpp b/msm8998/libgralloc/gpu.cpp
similarity index 96%
rename from msmcobalt/libgralloc/gpu.cpp
rename to msm8998/libgralloc/gpu.cpp
index 5b22e6d..545903a 100644
--- a/msmcobalt/libgralloc/gpu.cpp
+++ b/msm8998/libgralloc/gpu.cpp
@@ -53,6 +53,16 @@
{
int err = 0;
int flags = 0;
+ int alignedw = 0;
+ int alignedh = 0;
+
+ AdrenoMemInfo::getInstance().getAlignedWidthAndHeight(width,
+ height,
+ format,
+ usage,
+ alignedw,
+ alignedh);
+
size = roundUpToPageSize(size);
alloc_data data;
data.offset = 0;
@@ -64,7 +74,8 @@
data.align = getpagesize();
if (usage & GRALLOC_USAGE_PROTECTED) {
- if (usage & GRALLOC_USAGE_PRIVATE_SECURE_DISPLAY) {
+ if ((usage & GRALLOC_USAGE_PRIVATE_SECURE_DISPLAY) ||
+ (usage & GRALLOC_USAGE_HW_CAMERA_MASK)) {
/* The alignment here reflects qsee mmu V7L/V8L requirement */
data.align = SZ_2M;
} else {
@@ -153,8 +164,8 @@
flags |= data.allocType;
uint64_t eBaseAddr = (uint64_t)(eData.base) + eData.offset;
private_handle_t *hnd = new private_handle_t(data.fd, size, flags,
- bufferType, format, width, height, eData.fd, eData.offset,
- eBaseAddr);
+ bufferType, format, alignedw, alignedh,
+ eData.fd, eData.offset, eBaseAddr, width, height);
hnd->offset = data.offset;
hnd->base = (uint64_t)(data.base) + data.offset;
@@ -327,7 +338,7 @@
err = gralloc_alloc_framebuffer(usage, pHandle);
} else {
err = gralloc_alloc_buffer(size, usage, pHandle, bufferType,
- grallocFormat, alignedw, alignedh);
+ grallocFormat, w, h);
}
if (err < 0) {
diff --git a/msmcobalt/libgralloc/gpu.h b/msm8998/libgralloc/gpu.h
similarity index 100%
rename from msmcobalt/libgralloc/gpu.h
rename to msm8998/libgralloc/gpu.h
diff --git a/msmcobalt/libgralloc/gr.h b/msm8998/libgralloc/gr.h
similarity index 95%
rename from msmcobalt/libgralloc/gr.h
rename to msm8998/libgralloc/gr.h
index 578240a..7d055fc 100644
--- a/msmcobalt/libgralloc/gr.h
+++ b/msm8998/libgralloc/gr.h
@@ -24,6 +24,7 @@
#include <hardware/gralloc.h>
#include <pthread.h>
#include <errno.h>
+#include <unistd.h>
#include <cutils/native_handle.h>
#include <utils/Singleton.h>
@@ -35,7 +36,7 @@
struct private_handle_t;
inline unsigned int roundUpToPageSize(unsigned int x) {
- return (x + (PAGE_SIZE-1)) & ~(PAGE_SIZE-1);
+ return (x + (getpagesize()-1)) & ~(getpagesize()-1);
}
template <class Type>
@@ -140,6 +141,15 @@
int tileEnabled, int& alignedw, int &alignedh);
/*
+ * Function to compute unaligned width and unaligned height based on
+ * private handle
+ *
+ * @return unaligned width, unaligned height
+ */
+ void getUnalignedWidthAndHeight(const private_handle_t *hnd, int& unaligned_w,
+ int& unaligned_h);
+
+ /*
* Function to return whether GPU support MacroTile feature
*
* @return >0 : supported
diff --git a/msmcobalt/libgralloc/gralloc.cpp b/msm8998/libgralloc/gralloc.cpp
similarity index 100%
rename from msmcobalt/libgralloc/gralloc.cpp
rename to msm8998/libgralloc/gralloc.cpp
diff --git a/msmcobalt/libgralloc/gralloc_priv.h b/msm8998/libgralloc/gralloc_priv.h
similarity index 86%
rename from msmcobalt/libgralloc/gralloc_priv.h
rename to msm8998/libgralloc/gralloc_priv.h
index 613c066..738b63f 100644
--- a/msmcobalt/libgralloc/gralloc_priv.h
+++ b/msm8998/libgralloc/gralloc_priv.h
@@ -30,8 +30,8 @@
#include <cutils/log.h>
-#define ROUND_UP_PAGESIZE(x) ( (((unsigned long)(x)) + PAGE_SIZE-1) & \
- (~(PAGE_SIZE-1)) )
+#define ROUND_UP_PAGESIZE(x) (unsigned int)( ((x) + getpagesize()-1) & \
+ (~(getpagesize()-1)) )
/* Gralloc usage bits indicating the type of allocation that should be used */
/* SYSTEM heap comes from kernel vmalloc (ION_SYSTEM_HEAP_ID)
@@ -118,7 +118,6 @@
#define HAL_PIXEL_FORMAT_BGRX_1010102 0x11C
#define HAL_PIXEL_FORMAT_XBGR_2101010 0x11D
#define HAL_PIXEL_FORMAT_YCbCr_420_P010 0x11F
-#define HAL_PIXEL_FORMAT_YCbCr_420_TP10_UBWC 0x120
#define HAL_PIXEL_FORMAT_INTERLACE 0x180
@@ -131,6 +130,7 @@
// UBWC aligned Venus format
#define HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS_UBWC 0x7FA30C06
+#define HAL_PIXEL_FORMAT_YCbCr_420_TP10_UBWC 0x7FA30C09
//Khronos ASTC formats
#define HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_4x4_KHR 0x93B0
@@ -166,6 +166,13 @@
#define HAL_IGC_NOT_SPECIFIED 0
#define HAL_IGC_s_RGB 1
+/* Color Space: Values maps to ColorSpace_t in qdMetadata.h */
+#define HAL_CSC_ITU_R_601 0
+#define HAL_CSC_ITU_R_601_FR 1
+#define HAL_CSC_ITU_R_709 2
+#define HAL_CSC_ITU_R_2020 3
+#define HAL_CSC_ITU_R_2020_FR 4
+
/* possible formats for 3D content*/
enum {
HAL_NO_3D = 0x0,
@@ -233,9 +240,11 @@
// The gpu address mapped into the mmu.
uint64_t gpuaddr __attribute__((aligned(8)));
int format;
- int width;
- int height;
+ int width; // holds aligned width of the actual buffer allocated
+ int height; // holds aligned height of the actual buffer allocated
uint64_t base_metadata __attribute__((aligned(8)));
+ int unaligned_width; // holds width client asked to allocate
+ int unaligned_height; // holds height client asked to allocate
#ifdef __cplusplus
static const int sNumFds = 2;
@@ -246,18 +255,40 @@
static const int sMagic = 'gmsm';
private_handle_t(int fd, unsigned int size, int flags, int bufferType,
- int format, int width, int height, int eFd = -1,
- unsigned int eOffset = 0, uint64_t eBase = 0) :
- fd(fd), fd_metadata(eFd), magic(sMagic),
+ int format, int width, int height) :
+ fd(fd), fd_metadata(-1), magic(sMagic),
flags(flags), size(size), offset(0), bufferType(bufferType),
- base(0), offset_metadata(eOffset), gpuaddr(0),
+ base(0), offset_metadata(0), gpuaddr(0),
format(format), width(width), height(height),
- base_metadata(eBase)
+ base_metadata(0), unaligned_width(width),
+ unaligned_height(height)
{
version = (int) sizeof(native_handle);
numInts = sNumInts();
numFds = sNumFds;
}
+
+ private_handle_t(int fd, unsigned int size, int flags, int bufferType,
+ int format, int width, int height,
+ int eFd, unsigned int eOffset, uint64_t eBase) :
+ private_handle_t(fd, size, flags, bufferType, format, width, height)
+ {
+ fd_metadata = eFd;
+ offset_metadata = eOffset;
+ base_metadata = eBase;
+ }
+
+ private_handle_t(int fd, unsigned int size, int flags, int bufferType,
+ int format, int width, int height,
+ int eFd, unsigned int eOffset, uint64_t eBase,
+ int unaligned_w, int unaligned_h) :
+ private_handle_t(fd, size, flags, bufferType, format, width, height,
+ eFd, eOffset, eBase)
+ {
+ unaligned_width = unaligned_w;
+ unaligned_height = unaligned_h;
+ }
+
~private_handle_t() {
magic = 0;
}
diff --git a/msmcobalt/libgralloc/ionalloc.cpp b/msm8998/libgralloc/ionalloc.cpp
similarity index 100%
rename from msmcobalt/libgralloc/ionalloc.cpp
rename to msm8998/libgralloc/ionalloc.cpp
diff --git a/msmcobalt/libgralloc/ionalloc.h b/msm8998/libgralloc/ionalloc.h
similarity index 100%
rename from msmcobalt/libgralloc/ionalloc.h
rename to msm8998/libgralloc/ionalloc.h
diff --git a/msmcobalt/libgralloc/mapper.cpp b/msm8998/libgralloc/mapper.cpp
similarity index 86%
rename from msmcobalt/libgralloc/mapper.cpp
rename to msm8998/libgralloc/mapper.cpp
index 142586b..132c768 100644
--- a/msmcobalt/libgralloc/mapper.cpp
+++ b/msm8998/libgralloc/mapper.cpp
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2008 The Android Open Source Project
- * Copyright (c) 2011-2015, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2011-2016, The Linux Foundation. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -55,6 +55,27 @@
return memalloc;
}
+static int gralloc_map_metadata(buffer_handle_t handle) {
+ private_handle_t* hnd = (private_handle_t*)handle;
+ hnd->base_metadata = 0;
+ IMemAlloc* memalloc = getAllocator(hnd->flags) ;
+ void *mappedAddress = MAP_FAILED;
+ unsigned int size = 0;
+ if (!(hnd->flags & private_handle_t::PRIV_FLAGS_FRAMEBUFFER)) {
+ mappedAddress = MAP_FAILED;
+ size = ROUND_UP_PAGESIZE(sizeof(MetaData_t));
+ int ret = memalloc->map_buffer(&mappedAddress, size,
+ hnd->offset_metadata, hnd->fd_metadata);
+ if(ret || mappedAddress == MAP_FAILED) {
+ ALOGE("Could not mmap metadata for handle %p, fd=%d (%s)",
+ hnd, hnd->fd_metadata, strerror(errno));
+ return -errno;
+ }
+ hnd->base_metadata = uint64_t(mappedAddress) + hnd->offset_metadata;
+ }
+ return 0;
+}
+
static int gralloc_map(gralloc_module_t const* module,
buffer_handle_t handle)
{
@@ -68,7 +89,6 @@
IMemAlloc* memalloc = getAllocator(hnd->flags) ;
void *mappedAddress = MAP_FAILED;
hnd->base = 0;
- hnd->base_metadata = 0;
// Dont map framebuffer and secure buffers
if (!(hnd->flags & private_handle_t::PRIV_FLAGS_FRAMEBUFFER) &&
@@ -83,23 +103,21 @@
}
hnd->base = uint64_t(mappedAddress) + hnd->offset;
+ } else {
+ // Cannot map secure buffers or framebuffers, but still need to map
+ // metadata for secure buffers.
+ // If mapping a secure buffers fails, the framework needs to get
+ // an error code.
+ err = -EACCES;
}
//Allow mapping of metadata for all buffers including secure ones, but not
//of framebuffer
- if (!(hnd->flags & private_handle_t::PRIV_FLAGS_FRAMEBUFFER)) {
- mappedAddress = MAP_FAILED;
- size = ROUND_UP_PAGESIZE(sizeof(MetaData_t));
- err = memalloc->map_buffer(&mappedAddress, size,
- hnd->offset_metadata, hnd->fd_metadata);
- if(err || mappedAddress == MAP_FAILED) {
- ALOGE("Could not mmap handle %p, fd=%d (%s)",
- handle, hnd->fd_metadata, strerror(errno));
- return -errno;
- }
- hnd->base_metadata = uint64_t(mappedAddress) + hnd->offset_metadata;
+ int metadata_err = gralloc_map_metadata(handle);
+ if (!err) {
+ err = metadata_err;
}
- return 0;
+ return err;
}
static int gralloc_unmap(gralloc_module_t const* module,
@@ -153,20 +171,11 @@
if (!module || private_handle_t::validate(handle) < 0)
return -EINVAL;
- /* NOTE: we need to initialize the buffer as not mapped/not locked
- * because it shouldn't when this function is called the first time
- * in a new process. Ideally these flags shouldn't be part of the
- * handle, but instead maintained in the kernel or at least
- * out-of-line
- */
-
- int err = gralloc_map(module, handle);
- if (err) {
- ALOGE("%s: gralloc_map failed", __FUNCTION__);
- return err;
- }
-
- return 0;
+ int err = gralloc_map(module, handle);
+ /* Do not fail register_buffer for secure buffers*/
+ if (err == -EACCES)
+ err = 0;
+ return err;
}
int gralloc_unregister_buffer(gralloc_module_t const* module,
@@ -309,6 +318,7 @@
int width = va_arg(args, int);
int height = va_arg(args, int);
int format = va_arg(args, int);
+ int alignedw = 0, alignedh = 0;
native_handle_t** handle = va_arg(args, native_handle_t**);
private_handle_t* hnd = (private_handle_t*)native_handle_create(
@@ -321,8 +331,12 @@
hnd->offset = offset;
hnd->base = uint64_t(base) + offset;
hnd->gpuaddr = 0;
- hnd->width = width;
- hnd->height = height;
+ AdrenoMemInfo::getInstance().getAlignedWidthAndHeight(width,
+ height, format, 0, alignedw, alignedh);
+ hnd->width = alignedw;
+ hnd->height = alignedh;
+ hnd->unaligned_width = width;
+ hnd->unaligned_height = height;
hnd->format = format;
*handle = (native_handle_t *)hnd;
res = 0;
@@ -398,7 +412,30 @@
return res;
}
MetaData_t *metadata = (MetaData_t *)hnd->base_metadata;
- if(metadata && metadata->operation & UPDATE_COLOR_SPACE) {
+ if (!metadata) {
+ break;
+#ifdef USE_COLOR_METADATA
+ } else if (metadata->operation & COLOR_METADATA) {
+ ColorMetaData *colorMetadata = &metadata->color;
+ res = 0;
+ switch (colorMetadata->colorPrimaries) {
+ case ColorPrimaries_BT709_5:
+ *color_space = HAL_CSC_ITU_R_709;
+ break;
+ case ColorPrimaries_BT601_6_525:
+ *color_space = ((colorMetadata->range) ?
+ HAL_CSC_ITU_R_601_FR : HAL_CSC_ITU_R_601);
+ break;
+ case ColorPrimaries_BT2020:
+ *color_space = (colorMetadata->range) ?
+ HAL_CSC_ITU_R_2020_FR : HAL_CSC_ITU_R_2020;
+ break;
+ default:
+ res = -EINVAL;
+ break;
+ }
+#endif
+ } else if(metadata->operation & UPDATE_COLOR_SPACE) {
*color_space = metadata->colorSpace;
res = 0;
}
diff --git a/msmcobalt/libgralloc/memalloc.h b/msm8998/libgralloc/memalloc.h
similarity index 100%
rename from msmcobalt/libgralloc/memalloc.h
rename to msm8998/libgralloc/memalloc.h
diff --git a/msmcobalt/libgralloc1/Android.mk b/msm8998/libgralloc1/Android.mk
similarity index 100%
rename from msmcobalt/libgralloc1/Android.mk
rename to msm8998/libgralloc1/Android.mk
diff --git a/msmcobalt/libgralloc1/gr_adreno_info.cpp b/msm8998/libgralloc1/gr_adreno_info.cpp
similarity index 100%
rename from msmcobalt/libgralloc1/gr_adreno_info.cpp
rename to msm8998/libgralloc1/gr_adreno_info.cpp
diff --git a/msmcobalt/libgralloc1/gr_adreno_info.h b/msm8998/libgralloc1/gr_adreno_info.h
similarity index 100%
rename from msmcobalt/libgralloc1/gr_adreno_info.h
rename to msm8998/libgralloc1/gr_adreno_info.h
diff --git a/msmcobalt/libgralloc1/gr_allocator.cpp b/msm8998/libgralloc1/gr_allocator.cpp
similarity index 97%
rename from msmcobalt/libgralloc1/gr_allocator.cpp
rename to msm8998/libgralloc1/gr_allocator.cpp
index b45ba83..32bc4ef 100644
--- a/msmcobalt/libgralloc1/gr_allocator.cpp
+++ b/msm8998/libgralloc1/gr_allocator.cpp
@@ -48,16 +48,24 @@
#define ION_FLAG_ALLOW_NON_CONTIG 0
#endif
+#ifndef ION_FLAG_CP_CAMERA_PREVIEW
+#define ION_FLAG_CP_CAMERA_PREVIEW 0
+#endif
+
#ifdef MASTER_SIDE_CP
#define CP_HEAP_ID ION_SECURE_HEAP_ID
#define SD_HEAP_ID ION_SECURE_DISPLAY_HEAP_ID
#define ION_CP_FLAGS (ION_SECURE | ION_FLAG_CP_PIXEL)
#define ION_SD_FLAGS (ION_SECURE | ION_FLAG_CP_SEC_DISPLAY)
+#define ION_SC_FLAGS (ION_SECURE | ION_FLAG_CP_CAMERA)
+#define ION_SC_PREVIEW_FLAGS (ION_SECURE | ION_FLAG_CP_CAMERA_PREVIEW)
#else // SLAVE_SIDE_CP
#define CP_HEAP_ID ION_CP_MM_HEAP_ID
#define SD_HEAP_ID CP_HEAP_ID
#define ION_CP_FLAGS (ION_SECURE | ION_FLAG_ALLOW_NON_CONTIG)
#define ION_SD_FLAGS ION_SECURE
+#define ION_SC_FLAGS ION_SECURE
+#define ION_SC_PREVIEW_FLAGS ION_SECURE
#endif
namespace gralloc1 {
@@ -599,6 +607,13 @@
* VM. Please add it to the define once available.
*/
flags |= ION_SD_FLAGS;
+ } else if (prod_usage & GRALLOC1_PRODUCER_USAGE_CAMERA) {
+ heap_id = ION_HEAP(SD_HEAP_ID);
+ if (cons_usage & GRALLOC1_CONSUMER_USAGE_HWCOMPOSER) {
+ flags |= ION_SC_PREVIEW_FLAGS;
+ } else {
+ flags |= ION_SC_FLAGS;
+ }
} else {
heap_id = ION_HEAP(CP_HEAP_ID);
flags |= ION_CP_FLAGS;
@@ -670,6 +685,11 @@
*aligned_w = VENUS_Y_STRIDE(COLOR_FMT_NV12_UBWC, width);
*aligned_h = VENUS_Y_SCANLINES(COLOR_FMT_NV12_UBWC, height);
break;
+ case HAL_PIXEL_FORMAT_YCbCr_420_TP10_UBWC:
+ // The macro returns the stride which is 4/3 times the width, hence * 3/4
+ *aligned_w = (VENUS_Y_STRIDE(COLOR_FMT_NV12_BPP10_UBWC, width) * 3) / 4;
+ *aligned_h = VENUS_Y_SCANLINES(COLOR_FMT_NV12_BPP10_UBWC, height);
+ break;
default:
ALOGE("%s: Unsupported pixel format: 0x%x", __FUNCTION__, format);
*aligned_w = 0;
diff --git a/msmcobalt/libgralloc1/gr_allocator.h b/msm8998/libgralloc1/gr_allocator.h
similarity index 100%
rename from msmcobalt/libgralloc1/gr_allocator.h
rename to msm8998/libgralloc1/gr_allocator.h
diff --git a/msmcobalt/libgralloc1/gr_buf_descriptor.h b/msm8998/libgralloc1/gr_buf_descriptor.h
similarity index 100%
rename from msmcobalt/libgralloc1/gr_buf_descriptor.h
rename to msm8998/libgralloc1/gr_buf_descriptor.h
diff --git a/msmcobalt/libgralloc1/gr_buf_mgr.cpp b/msm8998/libgralloc1/gr_buf_mgr.cpp
similarity index 93%
rename from msmcobalt/libgralloc1/gr_buf_mgr.cpp
rename to msm8998/libgralloc1/gr_buf_mgr.cpp
index 33abd40..9650583 100644
--- a/msmcobalt/libgralloc1/gr_buf_mgr.cpp
+++ b/msm8998/libgralloc1/gr_buf_mgr.cpp
@@ -285,7 +285,8 @@
}
if (prod_usage & GRALLOC1_PRODUCER_USAGE_PROTECTED) {
- if (cons_usage & GRALLOC1_CONSUMER_USAGE_PRIVATE_SECURE_DISPLAY) {
+ if ((prod_usage & GRALLOC1_PRODUCER_USAGE_CAMERA) ||
+ (cons_usage & GRALLOC1_CONSUMER_USAGE_PRIVATE_SECURE_DISPLAY)) {
// The alignment here reflects qsee mmu V7L/V8L requirement
align = SZ_2M;
} else {
@@ -361,8 +362,8 @@
return flags;
}
-int BufferManager::AllocateBuffer(unsigned int size, int aligned_w, int aligned_h, int real_w,
- int real_h, int format, int bufferType,
+int BufferManager::AllocateBuffer(unsigned int size, int aligned_w, int aligned_h, int unaligned_w,
+ int unaligned_h, int format, int bufferType,
gralloc1_producer_usage_t prod_usage,
gralloc1_consumer_usage_t cons_usage, buffer_handle_t *handle) {
int err = 0;
@@ -405,7 +406,7 @@
uint64_t eBaseAddr = (uint64_t)(e_data.base) + e_data.offset;
private_handle_t *hnd = new private_handle_t(data.fd, size, flags, bufferType, format, aligned_w,
aligned_h, e_data.fd, e_data.offset, eBaseAddr,
- real_w, real_h, prod_usage, cons_usage);
+ unaligned_w, unaligned_h, prod_usage, cons_usage);
hnd->offset = data.offset;
hnd->base = (uint64_t)(data.base) + data.offset;
@@ -493,6 +494,7 @@
private_handle_t *hnd = reinterpret_cast<private_handle_t *>(
native_handle_create(private_handle_t::kNumFds, private_handle_t::NumInts()));
if (hnd) {
+ unsigned int alignedw = 0, alignedh = 0;
hnd->magic = private_handle_t::kMagic;
hnd->fd = fd;
hnd->flags = private_handle_t::PRIV_FLAGS_USES_ION;
@@ -500,8 +502,12 @@
hnd->offset = offset;
hnd->base = uint64_t(base) + offset;
hnd->gpuaddr = 0;
- hnd->width = width;
- hnd->height = height;
+ BufferDescriptor descriptor(width, height, format);
+ allocator_->GetAlignedWidthAndHeight(descriptor, &alignedw, &alignedh);
+ hnd->unaligned_width = width;
+ hnd->unaligned_height = height;
+ hnd->width = alignedw;
+ hnd->height = alignedh;
hnd->format = format;
*handle = reinterpret_cast<native_handle_t *>(hnd);
}
@@ -582,7 +588,27 @@
return GRALLOC1_ERROR_BAD_HANDLE;
}
MetaData_t *metadata = reinterpret_cast<MetaData_t *>(hnd->base_metadata);
- if (metadata && metadata->operation & UPDATE_COLOR_SPACE) {
+ if (!metadata) {
+ return GRALLOC1_ERROR_BAD_HANDLE;
+#ifdef USE_COLOR_METADATA
+ } else if (metadata->operation & COLOR_METADATA) {
+ ColorMetaData *colorMetadata = &metadata->color;
+ switch (colorMetadata->colorPrimaries) {
+ case ColorPrimaries_BT709_5:
+ *color_space = HAL_CSC_ITU_R_709;
+ break;
+ case ColorPrimaries_BT601_6_525:
+ *color_space = ((colorMetadata->range) ? HAL_CSC_ITU_R_601_FR : HAL_CSC_ITU_R_601);
+ break;
+ case ColorPrimaries_BT2020:
+ *color_space = (colorMetadata->range) ? HAL_CSC_ITU_R_2020_FR : HAL_CSC_ITU_R_2020;
+ break;
+ default:
+ ALOGE("Unknown Color Space = %d", colorMetadata->colorPrimaries);
+ break;
+ }
+#endif
+ } else if (metadata->operation & UPDATE_COLOR_SPACE) {
*color_space = metadata->colorSpace;
}
} break;
diff --git a/msmcobalt/libgralloc1/gr_buf_mgr.h b/msm8998/libgralloc1/gr_buf_mgr.h
similarity index 91%
rename from msmcobalt/libgralloc1/gr_buf_mgr.h
rename to msm8998/libgralloc1/gr_buf_mgr.h
index d3c0e67..ed6b591 100644
--- a/msmcobalt/libgralloc1/gr_buf_mgr.h
+++ b/msm8998/libgralloc1/gr_buf_mgr.h
@@ -49,9 +49,10 @@
int GetBufferType(int format);
int AllocateBuffer(const BufferDescriptor &descriptor, buffer_handle_t *handle,
unsigned int bufferSize = 0);
- int AllocateBuffer(unsigned int size, int aligned_w, int aligned_h, int real_w, int real_h,
- int format, int bufferType, gralloc1_producer_usage_t prod_usage,
- gralloc1_consumer_usage_t cons_usage, buffer_handle_t *handle);
+ int AllocateBuffer(unsigned int size, int aligned_w, int aligned_h, int unaligned_w,
+ int unaligned_h, int format, int bufferType,
+ gralloc1_producer_usage_t prod_usage, gralloc1_consumer_usage_t cons_usage,
+ buffer_handle_t *handle);
int GetDataAlignment(int format, gralloc1_producer_usage_t prod_usage,
gralloc1_consumer_usage_t cons_usage);
int GetHandleFlags(int format, gralloc1_producer_usage_t prod_usage,
diff --git a/msmcobalt/libgralloc1/gr_device_impl.cpp b/msm8998/libgralloc1/gr_device_impl.cpp
similarity index 99%
rename from msmcobalt/libgralloc1/gr_device_impl.cpp
rename to msm8998/libgralloc1/gr_device_impl.cpp
index 6258941..f837ee2 100644
--- a/msmcobalt/libgralloc1/gr_device_impl.cpp
+++ b/msm8998/libgralloc1/gr_device_impl.cpp
@@ -298,8 +298,8 @@
gralloc1_error_t status = CheckDeviceAndHandle(device, buffer);
if (status == GRALLOC1_ERROR_NONE) {
const private_handle_t *hnd = PRIV_HANDLE_CONST(buffer);
- *outWidth = UINT(hnd->GetRealWidth());
- *outHeight = UINT(hnd->GetRealHeight());
+ *outWidth = UINT(hnd->GetUnalignedWidth());
+ *outHeight = UINT(hnd->GetUnalignedHeight());
}
return status;
diff --git a/msmcobalt/libgralloc1/gr_device_impl.h b/msm8998/libgralloc1/gr_device_impl.h
similarity index 100%
rename from msmcobalt/libgralloc1/gr_device_impl.h
rename to msm8998/libgralloc1/gr_device_impl.h
diff --git a/msmcobalt/libgralloc1/gr_ion_alloc.cpp b/msm8998/libgralloc1/gr_ion_alloc.cpp
similarity index 100%
rename from msmcobalt/libgralloc1/gr_ion_alloc.cpp
rename to msm8998/libgralloc1/gr_ion_alloc.cpp
diff --git a/msmcobalt/libgralloc1/gr_ion_alloc.h b/msm8998/libgralloc1/gr_ion_alloc.h
similarity index 100%
rename from msmcobalt/libgralloc1/gr_ion_alloc.h
rename to msm8998/libgralloc1/gr_ion_alloc.h
diff --git a/msmcobalt/libgralloc1/gr_priv_handle.h b/msm8998/libgralloc1/gr_priv_handle.h
similarity index 77%
rename from msmcobalt/libgralloc1/gr_priv_handle.h
rename to msm8998/libgralloc1/gr_priv_handle.h
index 444fc80..ee38b4d 100644
--- a/msmcobalt/libgralloc1/gr_priv_handle.h
+++ b/msm8998/libgralloc1/gr_priv_handle.h
@@ -86,8 +86,8 @@
uint64_t base_metadata __attribute__((aligned(8)));
// added for gralloc1
- int real_width; // holds width client asked to allocate
- int real_height; // holds height client asked to allocate// holds width client asked to allocate
+ int unaligned_width; // holds width client asked to allocate
+ int unaligned_height; // holds height client asked to allocate
gralloc1_producer_usage_t producer_usage __attribute__((aligned(8)));
gralloc1_consumer_usage_t consumer_usage __attribute__((aligned(8)));
@@ -99,33 +99,50 @@
}
private_handle_t(int fd, unsigned int size, int flags, int buf_type, int format, int width,
- int height, int meta_fd = -1, unsigned int meta_offset = 0,
- uint64_t meta_base = 0, int rw = 0, int rh = 0,
- gralloc1_producer_usage_t prod_usage = GRALLOC1_PRODUCER_USAGE_NONE,
- gralloc1_consumer_usage_t cons_usage = GRALLOC1_CONSUMER_USAGE_NONE)
+ int height)
: fd(fd),
- fd_metadata(meta_fd),
+ fd_metadata(-1),
magic(kMagic),
flags(flags),
size(size),
offset(0),
buffer_type(buf_type),
base(0),
- offset_metadata(meta_offset),
+ offset_metadata(0),
gpuaddr(0),
format(format),
width(width),
height(height),
- base_metadata(meta_base),
- real_width(rw),
- real_height(rh),
- producer_usage(prod_usage),
- consumer_usage(cons_usage) {
+ base_metadata(0),
+ unaligned_width(width),
+ unaligned_height(height),
+ producer_usage(GRALLOC1_PRODUCER_USAGE_NONE),
+ consumer_usage(GRALLOC1_CONSUMER_USAGE_NONE) {
version = static_cast<int>(sizeof(native_handle));
numInts = NumInts();
numFds = kNumFds;
}
+ private_handle_t(int fd, unsigned int size, int flags, int buf_type, int format, int width,
+ int height, int meta_fd, unsigned int meta_offset, uint64_t meta_base)
+ : private_handle_t(fd, size, flags, buf_type, format, width, height) {
+ fd_metadata = meta_fd;
+ offset_metadata = meta_offset;
+ base_metadata = meta_base;
+ }
+
+ private_handle_t(int fd, unsigned int size, int flags, int buf_type, int format, int width,
+ int height, int meta_fd, unsigned int meta_offset, uint64_t meta_base,
+ int unaligned_w , int unaligned_h,
+ gralloc1_producer_usage_t prod_usage, gralloc1_consumer_usage_t cons_usage)
+ : private_handle_t(fd, size, flags, buf_type, format, width, height, meta_fd, meta_offset
+ meta_base) {
+ unaligned_width = unaligned_w;
+ unaligned_height = unaligned_h;
+ producer_usage = prod_usage;
+ consumer_usage = cons_usage;
+ }
+
~private_handle_t() {
magic = 0;
ALOGE_IF(DBG_HANDLE, "deleting buffer handle %p", this);
@@ -151,9 +168,9 @@
return 0;
}
- int GetRealWidth() const { return real_width; }
+ int GetUnalignedWidth() const { return unaligned_width; }
- int GetRealHeight() const { return real_height; }
+ int GetUnalignedHeight() const { return unaligned_height; }
int GetColorFormat() const { return format; }
diff --git a/msmcobalt/libgralloc1/gr_utils.cpp b/msm8998/libgralloc1/gr_utils.cpp
similarity index 100%
rename from msmcobalt/libgralloc1/gr_utils.cpp
rename to msm8998/libgralloc1/gr_utils.cpp
diff --git a/msmcobalt/libgralloc1/gr_utils.h b/msm8998/libgralloc1/gr_utils.h
similarity index 100%
rename from msmcobalt/libgralloc1/gr_utils.h
rename to msm8998/libgralloc1/gr_utils.h
diff --git a/msmcobalt/libgralloc1/gralloc_priv.h b/msm8998/libgralloc1/gralloc_priv.h
similarity index 93%
rename from msmcobalt/libgralloc1/gralloc_priv.h
rename to msm8998/libgralloc1/gralloc_priv.h
index 64cb1f5..0695a60 100644
--- a/msmcobalt/libgralloc1/gralloc_priv.h
+++ b/msm8998/libgralloc1/gralloc_priv.h
@@ -20,9 +20,13 @@
#ifndef __GRALLOC_PRIV_H__
#define __GRALLOC_PRIV_H__
+#include <unistd.h>
#include "gr_priv_handle.h"
-#define ROUND_UP_PAGESIZE(x) ((((unsigned int)(x)) + PAGE_SIZE - 1) & (~(PAGE_SIZE - 1)))
+#define ROUND_UP_PAGESIZE(x) roundUpToPageSize(x)
+inline unsigned int roundUpToPageSize(unsigned int x) {
+ return (x + (getpagesize()-1)) & ~(getpagesize()-1);
+}
/* Gralloc usage bits indicating the type of allocation that should be used */
/* Refer gralloc1_producer_usage_t & gralloc1_consumer_usage-t in gralloc1.h */
@@ -107,7 +111,6 @@
#define HAL_PIXEL_FORMAT_BGRX_1010102 0x11C
#define HAL_PIXEL_FORMAT_XBGR_2101010 0x11D
#define HAL_PIXEL_FORMAT_YCbCr_420_P010 0x11F
-#define HAL_PIXEL_FORMAT_YCbCr_420_TP10_UBWC 0x120
#define HAL_PIXEL_FORMAT_INTERLACE 0x180
@@ -120,6 +123,7 @@
// UBWC aligned Venus format
#define HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS_UBWC 0x7FA30C06
+#define HAL_PIXEL_FORMAT_YCbCr_420_TP10_UBWC 0x7FA30C09
// Khronos ASTC formats
#define HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_4x4_KHR 0x93B0
@@ -155,6 +159,13 @@
#define HAL_IGC_NOT_SPECIFIED 0
#define HAL_IGC_s_RGB 1
+/* Color Space: Values maps to ColorSpace_t in qdMetadata.h */
+#define HAL_CSC_ITU_R_601 0
+#define HAL_CSC_ITU_R_601_FR 1
+#define HAL_CSC_ITU_R_709 2
+#define HAL_CSC_ITU_R_2020 3
+#define HAL_CSC_ITU_R_2020_FR 4
+
/* possible formats for 3D content*/
enum {
HAL_NO_3D = 0x0,
diff --git a/msmcobalt/liblight/Android.mk b/msm8998/liblight/Android.mk
similarity index 100%
rename from msmcobalt/liblight/Android.mk
rename to msm8998/liblight/Android.mk
diff --git a/msmcobalt/liblight/NOTICE b/msm8998/liblight/NOTICE
similarity index 100%
rename from msmcobalt/liblight/NOTICE
rename to msm8998/liblight/NOTICE
diff --git a/msmcobalt/liblight/lights.c b/msm8998/liblight/lights.c
similarity index 100%
rename from msmcobalt/liblight/lights.c
rename to msm8998/liblight/lights.c
diff --git a/msmcobalt/libmemtrack/Android.mk b/msm8998/libmemtrack/Android.mk
similarity index 100%
rename from msmcobalt/libmemtrack/Android.mk
rename to msm8998/libmemtrack/Android.mk
diff --git a/msmcobalt/libmemtrack/kgsl.c b/msm8998/libmemtrack/kgsl.c
similarity index 100%
rename from msmcobalt/libmemtrack/kgsl.c
rename to msm8998/libmemtrack/kgsl.c
diff --git a/msmcobalt/libmemtrack/memtrack_msm.c b/msm8998/libmemtrack/memtrack_msm.c
similarity index 100%
rename from msmcobalt/libmemtrack/memtrack_msm.c
rename to msm8998/libmemtrack/memtrack_msm.c
diff --git a/msmcobalt/libmemtrack/memtrack_msm.h b/msm8998/libmemtrack/memtrack_msm.h
similarity index 100%
rename from msmcobalt/libmemtrack/memtrack_msm.h
rename to msm8998/libmemtrack/memtrack_msm.h
diff --git a/msmcobalt/libqdutils/Android.mk b/msm8998/libqdutils/Android.mk
similarity index 95%
rename from msmcobalt/libqdutils/Android.mk
rename to msm8998/libqdutils/Android.mk
index db6509c..cc0b013 100644
--- a/msmcobalt/libqdutils/Android.mk
+++ b/msm8998/libqdutils/Android.mk
@@ -9,7 +9,7 @@
LOCAL_CFLAGS := $(common_flags) -DLOG_TAG=\"qdutils\" -Wno-sign-conversion
LOCAL_ADDITIONAL_DEPENDENCIES := $(common_deps)
LOCAL_COPY_HEADERS_TO := $(common_header_export_path)
-LOCAL_COPY_HEADERS := display_config.h
+LOCAL_COPY_HEADERS := display_config.h qd_utils.h
LOCAL_SRC_FILES := profiler.cpp \
qd_utils.cpp \
display_config.cpp
diff --git a/msmcobalt/libqdutils/Makefile.am b/msm8998/libqdutils/Makefile.am
similarity index 89%
rename from msmcobalt/libqdutils/Makefile.am
rename to msm8998/libqdutils/Makefile.am
index ef2108d..01fbf19 100644
--- a/msmcobalt/libqdutils/Makefile.am
+++ b/msm8998/libqdutils/Makefile.am
@@ -11,6 +11,7 @@
libqdMetaData_la_CFLAGS = $(AM_CFLAGS) -DLOG_TAG=\"DisplayMetaData\"
libqdMetaData_la_CPPFLAGS = $(AM_CPPFLAGS)
libqdMetaData_LDADD = -lcutils -llog
+libqdMetaData_la_LDFLAGS = -shared -avoid-version
header_sources = display_config.h
@@ -27,4 +28,5 @@
libqdutils_la_CFLAGS = $(COMMON_CFLAGS) -DLOG_TAG=\"qdutils\"
libqdutils_la_CPPFLAGS = $(AM_CPPFLAGS)
libqdutils_LDADD = -lhardware -lcutils -llog -lbinder
-libqdutils_la_LIBADD = ../libqservice/libqservice.la
\ No newline at end of file
+libqdutils_la_LIBADD = ../libqservice/libqservice.la
+libqdutils_la_LDFLAGS = -shared -avoid-version
\ No newline at end of file
diff --git a/msmcobalt/libqdutils/display_config.cpp b/msm8998/libqdutils/display_config.cpp
similarity index 100%
rename from msmcobalt/libqdutils/display_config.cpp
rename to msm8998/libqdutils/display_config.cpp
diff --git a/msmcobalt/libqdutils/display_config.h b/msm8998/libqdutils/display_config.h
similarity index 100%
rename from msmcobalt/libqdutils/display_config.h
rename to msm8998/libqdutils/display_config.h
diff --git a/msmcobalt/libqdutils/profiler.cpp b/msm8998/libqdutils/profiler.cpp
similarity index 100%
rename from msmcobalt/libqdutils/profiler.cpp
rename to msm8998/libqdutils/profiler.cpp
diff --git a/msmcobalt/libqdutils/profiler.h b/msm8998/libqdutils/profiler.h
similarity index 100%
rename from msmcobalt/libqdutils/profiler.h
rename to msm8998/libqdutils/profiler.h
diff --git a/msmcobalt/libqdutils/qdMetaData.cpp b/msm8998/libqdutils/qdMetaData.cpp
similarity index 95%
rename from msmcobalt/libqdutils/qdMetaData.cpp
rename to msm8998/libqdutils/qdMetaData.cpp
index 0f3b5e5..f6f57cb 100644
--- a/msmcobalt/libqdutils/qdMetaData.cpp
+++ b/msm8998/libqdutils/qdMetaData.cpp
@@ -94,6 +94,11 @@
case SET_VT_TIMESTAMP:
data->vtTimeStamp = *((uint64_t *)param);
break;
+#ifdef USE_COLOR_METADATA
+ case COLOR_METADATA:
+ data->color = *((ColorMetaData *)param);
+#endif
+ break;
default:
ALOGE("Unknown paramType %d", paramType);
break;
@@ -195,6 +200,11 @@
case GET_VT_TIMESTAMP:
*((uint64_t *)param) = data->vtTimeStamp;
break;
+#ifdef USE_COLOR_METADATA
+ case GET_COLOR_METADATA:
+ *((ColorMetaData *)param) = data->color;
+#endif
+ break;
default:
ALOGE("Unknown paramType %d", paramType);
break;
@@ -232,6 +242,9 @@
dst->fd_metadata, 0);
if (base_dst == reinterpret_cast<void*>(MAP_FAILED)) {
ALOGE("%s: dst mmap() failed: error is %s!", __func__, strerror(errno));
+ if(munmap(base_src, size))
+ ALOGE("%s: failed to unmap src ptr %p, err %d", __func__,
+ (void*)base_src, errno);
return -1;
}
diff --git a/msmcobalt/libqdutils/qdMetaData.h b/msm8998/libqdutils/qdMetaData.h
similarity index 94%
rename from msmcobalt/libqdutils/qdMetaData.h
rename to msm8998/libqdutils/qdMetaData.h
index 725e094..a0ac324 100644
--- a/msmcobalt/libqdutils/qdMetaData.h
+++ b/msm8998/libqdutils/qdMetaData.h
@@ -30,6 +30,10 @@
#ifndef _QDMETADATA_H
#define _QDMETADATA_H
+#ifdef USE_COLOR_METADATA
+#include <color_metadata.h>
+#endif
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -38,6 +42,8 @@
ITU_R_601,
ITU_R_601_FR,
ITU_R_709,
+ ITU_R_2020,
+ ITU_R_2020_FR,
};
enum IGC_t {
@@ -89,11 +95,15 @@
/* Set by camera to program the VT Timestamp */
uint64_t vtTimeStamp;
+#ifdef USE_COLOR_METADATA
+ /* Color Aspects + HDR info */
+ ColorMetaData color;
+#endif
};
enum DispParamType {
SET_VT_TIMESTAMP = 0x0001,
- UNUSED1 = 0x0002,
+ COLOR_METADATA = 0x0002,
PP_PARAM_INTERLACED = 0x0004,
UNUSED2 = 0x0008,
UNUSED3 = 0x0010,
@@ -112,6 +122,7 @@
enum DispFetchParamType {
GET_VT_TIMESTAMP = 0x0001,
+ GET_COLOR_METADATA = 0x0002,
GET_PP_PARAM_INTERLACED = 0x0004,
GET_BUFFER_GEOMETRY = 0x0080,
GET_REFRESH_RATE = 0x0100,
diff --git a/msmcobalt/libqdutils/qd_utils.cpp b/msm8998/libqdutils/qd_utils.cpp
similarity index 100%
rename from msmcobalt/libqdutils/qd_utils.cpp
rename to msm8998/libqdutils/qd_utils.cpp
diff --git a/msmcobalt/libqdutils/qd_utils.h b/msm8998/libqdutils/qd_utils.h
similarity index 100%
rename from msmcobalt/libqdutils/qd_utils.h
rename to msm8998/libqdutils/qd_utils.h
diff --git a/msmcobalt/libqservice/Android.mk b/msm8998/libqservice/Android.mk
similarity index 100%
rename from msmcobalt/libqservice/Android.mk
rename to msm8998/libqservice/Android.mk
diff --git a/msmcobalt/libqservice/IQClient.cpp b/msm8998/libqservice/IQClient.cpp
similarity index 100%
rename from msmcobalt/libqservice/IQClient.cpp
rename to msm8998/libqservice/IQClient.cpp
diff --git a/msmcobalt/libqservice/IQClient.h b/msm8998/libqservice/IQClient.h
similarity index 100%
rename from msmcobalt/libqservice/IQClient.h
rename to msm8998/libqservice/IQClient.h
diff --git a/msmcobalt/libqservice/IQHDMIClient.cpp b/msm8998/libqservice/IQHDMIClient.cpp
similarity index 100%
rename from msmcobalt/libqservice/IQHDMIClient.cpp
rename to msm8998/libqservice/IQHDMIClient.cpp
diff --git a/msmcobalt/libqservice/IQHDMIClient.h b/msm8998/libqservice/IQHDMIClient.h
similarity index 100%
rename from msmcobalt/libqservice/IQHDMIClient.h
rename to msm8998/libqservice/IQHDMIClient.h
diff --git a/msmcobalt/libqservice/IQService.cpp b/msm8998/libqservice/IQService.cpp
similarity index 100%
rename from msmcobalt/libqservice/IQService.cpp
rename to msm8998/libqservice/IQService.cpp
diff --git a/msmcobalt/libqservice/IQService.h b/msm8998/libqservice/IQService.h
similarity index 98%
rename from msmcobalt/libqservice/IQService.h
rename to msm8998/libqservice/IQService.h
index d25a06d..bf4343a 100644
--- a/msmcobalt/libqservice/IQService.h
+++ b/msm8998/libqservice/IQService.h
@@ -74,6 +74,7 @@
GET_BW_TRANSACTION_STATUS = 32, //Client can query BW transaction status.
SET_LAYER_MIXER_RESOLUTION = 33, // Enables client to set layer mixer resolution.
SET_COLOR_MODE = 34, // Overrides the QDCM mode on the display
+ GET_HDR_CAPABILITIES = 35, // Get HDR capabilities for legacy HWC interface
COMMAND_LIST_END = 400,
};
diff --git a/msmcobalt/libqservice/Makefile.am b/msm8998/libqservice/Makefile.am
similarity index 91%
rename from msmcobalt/libqservice/Makefile.am
rename to msm8998/libqservice/Makefile.am
index 155060d..79935b8 100644
--- a/msmcobalt/libqservice/Makefile.am
+++ b/msm8998/libqservice/Makefile.am
@@ -14,4 +14,5 @@
libqservice_la_SOURCES = $(cpp_sources)
libqservice_la_CFLAGS = $(COMMON_CFLAGS) -DLOG_TAG=\"qdqservice\"
libqservice_la_CPPFLAGS = $(AM_CPPFLAGS)
-libqservice_LDADD = -lhardware -lcutils -llog -lbinder
\ No newline at end of file
+libqservice_LDADD = -lhardware -lcutils -llog -lbinder
+libqservice_la_LDFLAGS = -shared -avoid-version
\ No newline at end of file
diff --git a/msmcobalt/libqservice/QService.cpp b/msm8998/libqservice/QService.cpp
similarity index 100%
rename from msmcobalt/libqservice/QService.cpp
rename to msm8998/libqservice/QService.cpp
diff --git a/msmcobalt/libqservice/QService.h b/msm8998/libqservice/QService.h
similarity index 100%
rename from msmcobalt/libqservice/QService.h
rename to msm8998/libqservice/QService.h
diff --git a/msmcobalt/libqservice/QServiceUtils.h b/msm8998/libqservice/QServiceUtils.h
similarity index 100%
rename from msmcobalt/libqservice/QServiceUtils.h
rename to msm8998/libqservice/QServiceUtils.h
diff --git a/msmcobalt/sdm/.clang-format b/msm8998/sdm/.clang-format
similarity index 100%
rename from msmcobalt/sdm/.clang-format
rename to msm8998/sdm/.clang-format
diff --git a/msmcobalt/sdm/include/core/buffer_allocator.h b/msm8998/sdm/include/core/buffer_allocator.h
similarity index 89%
rename from msmcobalt/sdm/include/core/buffer_allocator.h
rename to msm8998/sdm/include/core/buffer_allocator.h
index 0fd9388..86cc02a 100644
--- a/msmcobalt/sdm/include/core/buffer_allocator.h
+++ b/msm8998/sdm/include/core/buffer_allocator.h
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2015, The Linux Foundation. All rights reserved.
+* Copyright (c) 2015 - 2016, 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
@@ -52,6 +52,8 @@
bool secure = false; //!< Specifies buffer to be allocated from
//!< secure region.
bool cache = false; //!< Specifies whether the buffer needs to be cache.
+ bool secure_camera = false; //!< Specifies buffer to be allocated from specific
+ //!< secure heap and with a specific alignment.
};
/*! @brief Holds the information about the allocated buffer.
@@ -61,7 +63,9 @@
*/
struct AllocatedBufferInfo {
int fd = -1; //!< Specifies the fd of the allocated buffer.
- uint32_t stride = 0; //!< Specifies aligned buffer width of the allocated buffer.
+ uint32_t stride = 0; //!< Specifies allocated buffer stride in bytes.
+ uint32_t aligned_width = 0; //!< Specifies aligned allocated buffer width in pixels.
+ uint32_t aligned_height = 0; //!< Specifies aligned allocated buffer height in pixels.
uint32_t size = 0; //!< Specifies the size of the allocated buffer.
};
diff --git a/msmcobalt/sdm/include/core/buffer_sync_handler.h b/msm8998/sdm/include/core/buffer_sync_handler.h
similarity index 100%
rename from msmcobalt/sdm/include/core/buffer_sync_handler.h
rename to msm8998/sdm/include/core/buffer_sync_handler.h
diff --git a/msmcobalt/sdm/include/core/core_interface.h b/msm8998/sdm/include/core/core_interface.h
similarity index 100%
rename from msmcobalt/sdm/include/core/core_interface.h
rename to msm8998/sdm/include/core/core_interface.h
diff --git a/msmcobalt/sdm/include/core/debug_interface.h b/msm8998/sdm/include/core/debug_interface.h
similarity index 100%
rename from msmcobalt/sdm/include/core/debug_interface.h
rename to msm8998/sdm/include/core/debug_interface.h
diff --git a/msmcobalt/sdm/include/core/display_interface.h b/msm8998/sdm/include/core/display_interface.h
similarity index 95%
rename from msmcobalt/sdm/include/core/display_interface.h
rename to msm8998/sdm/include/core/display_interface.h
index ccaa0b5..416e01a 100644
--- a/msmcobalt/sdm/include/core/display_interface.h
+++ b/msm8998/sdm/include/core/display_interface.h
@@ -140,6 +140,7 @@
struct DisplayConfigFixedInfo {
bool underscan = false; //!< If display support CE underscan.
bool secure = false; //!< If this display is capable of handling secure content.
+ bool is_cmdmode = false; //!< If panel is command mode panel.
};
/*! @brief This structure defines configuration for variable properties of a display device.
@@ -597,10 +598,30 @@
/*! @brief Method to query whether it is Primrary device.
- @return \link Bool \endlink
+ @return true if this interface is primary.
*/
virtual bool IsPrimaryDisplay() = 0;
+ /*! @brief Method to toggle composition types handling by SDM.
+
+ @details Client shall call this method to request SDM to enable/disable a specific type of
+ layer composition. If client disables a composition type, SDM will not handle any of the layer
+ composition using the disabled method in a draw cycle. On lack of resources to handle all
+ layers using other enabled composition methods, Prepare() will return an error.
+
+ Request to toggle composition type is applied from subsequent draw cycles.
+
+ Default state of all defined composition types is enabled.
+
+ @param[in] composition_type \link LayerComposition \endlink
+ @param[in] enable \link enable composition type \endlink
+
+ @return \link DisplayError \endlink
+
+ @sa Prepare
+ */
+ virtual DisplayError SetCompositionState(LayerComposition composition_type, bool enable) = 0;
+
protected:
virtual ~DisplayInterface() { }
};
diff --git a/msmcobalt/sdm/include/core/dump_interface.h b/msm8998/sdm/include/core/dump_interface.h
similarity index 100%
rename from msmcobalt/sdm/include/core/dump_interface.h
rename to msm8998/sdm/include/core/dump_interface.h
diff --git a/msmcobalt/sdm/include/core/layer_buffer.h b/msm8998/sdm/include/core/layer_buffer.h
similarity index 95%
rename from msmcobalt/sdm/include/core/layer_buffer.h
rename to msm8998/sdm/include/core/layer_buffer.h
index 0bf1aa4..4f80f86 100644
--- a/msmcobalt/sdm/include/core/layer_buffer.h
+++ b/msm8998/sdm/include/core/layer_buffer.h
@@ -208,6 +208,10 @@
uint32_t secure_display : 1; //!< This flag shall be set by the client to indicate that the
//!< secure display session is in progress. Secure display
//!< session can not coexist with non-secure session.
+
+ uint32_t secure_camera : 1; //!< This flag shall be set by the client to indicate that the
+ //!< buffer is associated with secure camera session. A secure
+ //!< camera layer can co-exist with non-secure layer(s).
};
uint32_t flags = 0; //!< For initialization purpose only.
@@ -222,8 +226,12 @@
@sa LayerStack
*/
struct LayerBuffer {
- uint32_t width = 0; //!< Actual width of the Layer that this buffer is for.
- uint32_t height = 0; //!< Actual height of the Layer that this buffer is for.
+ uint32_t width = 0; //!< Aligned width of the Layer that this buffer is for.
+ uint32_t height = 0; //!< Aligned height of the Layer that this buffer is for.
+ uint32_t unaligned_width = 0;
+ //!< Unaligned width of the Layer that this buffer is for.
+ uint32_t unaligned_height = 0;
+ //!< Unaligned height of the Layer that this buffer is for.
uint32_t size = 0; //!< Size of a single buffer (even if multiple clubbed together)
LayerBufferFormat format = kFormatRGBA8888; //!< Format of the buffer content.
LayerCSC csc = kCSCFullRange601; //!< Color Space of the layer.
diff --git a/msmcobalt/sdm/include/core/layer_stack.h b/msm8998/sdm/include/core/layer_stack.h
similarity index 97%
rename from msmcobalt/sdm/include/core/layer_stack.h
rename to msm8998/sdm/include/core/layer_stack.h
index 0fcab25..2741f71 100644
--- a/msmcobalt/sdm/include/core/layer_stack.h
+++ b/msm8998/sdm/include/core/layer_stack.h
@@ -102,10 +102,10 @@
/* === List of composition types set by Client === */
/* These composition types represent target buffer layers onto which GPU or Blit will draw if SDM
decide to have some or all layers drawn by respective composition engine.
- If client does not provide a target buffer layer, SDM will assume that respective composition
- engine is not available and will not mark any layer for such a composition. If SDM is unable
- to handle layers without support of such a composition engine, Prepare() call will return
- failure.
+ Client must provide a target buffer layer, if respective composition type is not disabled by
+ an explicit call to SetCompositionState() method. If a composition type is not disabled,
+ providing a target buffer layer is optional. If SDM is unable to handle layers without support
+ of such a composition engine, Prepare() call will return failure.
*/
kCompositionGPUTarget, //!< This layer will hold result of composition for layers marked for
//!< GPU composition.
diff --git a/msmcobalt/sdm/include/core/sdm_types.h b/msm8998/sdm/include/core/sdm_types.h
similarity index 100%
rename from msmcobalt/sdm/include/core/sdm_types.h
rename to msm8998/sdm/include/core/sdm_types.h
diff --git a/msmcobalt/sdm/include/private/color_interface.h b/msm8998/sdm/include/private/color_interface.h
similarity index 100%
rename from msmcobalt/sdm/include/private/color_interface.h
rename to msm8998/sdm/include/private/color_interface.h
diff --git a/msmcobalt/sdm/include/private/color_params.h b/msm8998/sdm/include/private/color_params.h
similarity index 99%
rename from msmcobalt/sdm/include/private/color_params.h
rename to msm8998/sdm/include/private/color_params.h
index fdd0c9e..d2f8094 100644
--- a/msmcobalt/sdm/include/private/color_params.h
+++ b/msm8998/sdm/include/private/color_params.h
@@ -238,6 +238,7 @@
struct PPDETuningCfgData {
uint32_t cfg_en = 0;
PPDETuningCfg params;
+ bool cfg_pending = false;
};
struct SDEGamutCfg {
diff --git a/msmcobalt/sdm/include/private/extension_interface.h b/msm8998/sdm/include/private/extension_interface.h
similarity index 87%
rename from msmcobalt/sdm/include/private/extension_interface.h
rename to msm8998/sdm/include/private/extension_interface.h
index dea127e..baf18a1 100644
--- a/msmcobalt/sdm/include/private/extension_interface.h
+++ b/msm8998/sdm/include/private/extension_interface.h
@@ -31,7 +31,6 @@
#include "partial_update_interface.h"
#include "strategy_interface.h"
#include "resource_interface.h"
-#include "rotator_interface.h"
namespace sdm {
@@ -59,8 +58,8 @@
PartialUpdateInterface **interface) = 0;
virtual DisplayError DestroyPartialUpdate(PartialUpdateInterface *interface) = 0;
- virtual DisplayError CreateStrategyExtn(DisplayType type, HWDisplayMode mode,
- HWS3DMode s3d_mode,
+ virtual DisplayError CreateStrategyExtn(DisplayType type, const HWResourceInfo &hw_resource_info,
+ const HWPanelInfo &hw_panel_info,
const HWMixerAttributes &mixer_attributes,
const DisplayConfigVariableInfo &fb_config,
StrategyInterface **interface) = 0;
@@ -68,15 +67,10 @@
virtual DisplayError CreateResourceExtn(const HWResourceInfo &hw_resource_info,
ResourceInterface **interface,
+ BufferAllocator *buffer_allocator,
BufferSyncHandler *buffer_sync_handler) = 0;
virtual DisplayError DestroyResourceExtn(ResourceInterface *interface) = 0;
- virtual DisplayError CreateRotator(const HWRotatorInfo &hw_rot_info,
- BufferAllocator *buffer_allocator,
- BufferSyncHandler *buffer_sync_handler,
- RotatorInterface **intf) = 0;
- virtual DisplayError DestroyRotator(RotatorInterface *intf) = 0;
-
protected:
virtual ~ExtensionInterface() { }
};
diff --git a/msmcobalt/sdm/include/private/hw_info_types.h b/msm8998/sdm/include/private/hw_info_types.h
similarity index 94%
rename from msmcobalt/sdm/include/private/hw_info_types.h
rename to msm8998/sdm/include/private/hw_info_types.h
index 93fb81b..b960955 100644
--- a/msmcobalt/sdm/include/private/hw_info_types.h
+++ b/msm8998/sdm/include/private/hw_info_types.h
@@ -180,6 +180,7 @@
bool separate_rotator = false;
bool has_qseed3 = false;
bool has_concurrent_writeback = false;
+ bool has_ppp = false;
uint32_t writeback_index = kHWBlockMax;
HWDynBwLimitInfo dyn_bw_info;
std::vector<HWPipeCaps> hw_pipes;
@@ -235,6 +236,8 @@
char panel_name[256] = {0}; // Panel name
HWS3DMode s3d_mode = kS3DModeNone; // Panel's current s3d mode.
int panel_max_brightness = 0; // Max panel brightness
+ uint32_t left_roi_count = 1; // Number if ROI supported on left panel
+ uint32_t right_roi_count = 1; // Number if ROI supported on right panel
bool operator !=(const HWPanelInfo &panel_info) {
return ((port != panel_info.port) || (mode != panel_info.mode) ||
@@ -248,8 +251,9 @@
(dfps_porch_mode != panel_info.dfps_porch_mode) ||
(ping_pong_split != panel_info.ping_pong_split) ||
(max_fps != panel_info.max_fps) || (is_primary_panel != panel_info.is_primary_panel) ||
- (split_info != panel_info.split_info) ||
- (s3d_mode != panel_info.s3d_mode));
+ (split_info != panel_info.split_info) || (s3d_mode != panel_info.s3d_mode) ||
+ (left_roi_count != panel_info.left_roi_count) ||
+ (right_roi_count != panel_info.right_roi_count));
}
bool operator ==(const HWPanelInfo &panel_info) {
@@ -264,6 +268,7 @@
bool secure = false;
uint32_t frame_rate = 0;
LayerTransform transform;
+ bool secure_camera = false;
bool operator==(const HWSessionConfig& config) const {
return (src_rect == config.src_rect &&
@@ -271,7 +276,8 @@
buffer_count == config.buffer_count &&
secure == config.secure &&
frame_rate == config.frame_rate &&
- transform == config.transform);
+ transform == config.transform &&
+ secure_camera == config.secure_camera);
}
bool operator!=(const HWSessionConfig& config) const {
@@ -428,13 +434,16 @@
LayerRect updated_src_rect[kMaxSDELayers]; // Updated layer src rects in s3d mode
LayerRect updated_dst_rect[kMaxSDELayers]; // Updated layer dst rects in s3d mode
bool updating[kMaxSDELayers] = {0}; // Updated by strategy, considering plane_alpha+updating
+ uint32_t roi_index[kMaxSDELayers] = {0}; // Stores the ROI index where the layers are visible.
uint32_t count = 0; // Total number of layers which need to be set on hardware.
int sync_handle = -1;
- LayerRect left_partial_update; // Left ROI.
- LayerRect right_partial_update; // Right ROI.
+ std::vector<LayerRect> left_frame_roi; // Left ROI.
+ std::vector<LayerRect> right_frame_roi; // Right ROI.
+
+ bool roi_split = false; // Indicates separated left and right ROI
bool use_hw_cursor = false; // Indicates that HWCursor pipe needs to be used for cursor layer
DestScaleInfoMap dest_scale_info_map = {};
diff --git a/msmcobalt/sdm/include/private/partial_update_interface.h b/msm8998/sdm/include/private/partial_update_interface.h
similarity index 83%
rename from msmcobalt/sdm/include/private/partial_update_interface.h
rename to msm8998/sdm/include/private/partial_update_interface.h
index 3159b56..b753587 100644
--- a/msmcobalt/sdm/include/private/partial_update_interface.h
+++ b/msm8998/sdm/include/private/partial_update_interface.h
@@ -33,10 +33,17 @@
namespace sdm {
+struct PUConstraints {
+ bool enable = true; //!< If this is set, PU will be enabled or it will be disabled
+ bool enable_cursor_pu = false; //!< If this is set, PU will consider cursor layer in the layer
+ //!< stack for cursor partial update
+};
+
class PartialUpdateInterface {
public:
+ virtual DisplayError Start(const PUConstraints &pu_constraints) = 0;
virtual DisplayError GenerateROI(HWLayersInfo *hw_layers_info) = 0;
- virtual void ControlPartialUpdate(bool enable) = 0;
+ virtual DisplayError Stop() = 0;
protected:
virtual ~PartialUpdateInterface() { }
diff --git a/msmcobalt/sdm/include/private/resource_interface.h b/msm8998/sdm/include/private/resource_interface.h
similarity index 96%
rename from msmcobalt/sdm/include/private/resource_interface.h
rename to msm8998/sdm/include/private/resource_interface.h
index 6115112..3f34e91 100644
--- a/msmcobalt/sdm/include/private/resource_interface.h
+++ b/msm8998/sdm/include/private/resource_interface.h
@@ -44,8 +44,9 @@
const HWMixerAttributes &mixer_attributes) = 0;
virtual DisplayError Start(Handle display_ctx) = 0;
virtual DisplayError Stop(Handle display_ctx) = 0;
- virtual DisplayError Acquire(Handle display_ctx, HWLayers *hw_layers) = 0;
+ virtual DisplayError Prepare(Handle display_ctx, HWLayers *hw_layers) = 0;
virtual DisplayError PostPrepare(Handle display_ctx, HWLayers *hw_layers) = 0;
+ virtual DisplayError Commit(Handle display_ctx, HWLayers *hw_layers) = 0;
virtual DisplayError PostCommit(Handle display_ctx, HWLayers *hw_layers) = 0;
virtual void Purge(Handle display_ctx) = 0;
virtual DisplayError SetMaxMixerStages(Handle display_ctx, uint32_t max_mixer_stages) = 0;
diff --git a/msmcobalt/sdm/include/private/rotator_interface.h b/msm8998/sdm/include/private/rotator_interface.h
similarity index 100%
rename from msmcobalt/sdm/include/private/rotator_interface.h
rename to msm8998/sdm/include/private/rotator_interface.h
diff --git a/msmcobalt/sdm/include/private/strategy_interface.h b/msm8998/sdm/include/private/strategy_interface.h
similarity index 92%
rename from msmcobalt/sdm/include/private/strategy_interface.h
rename to msm8998/sdm/include/private/strategy_interface.h
index f2bfe23..122a3c6 100644
--- a/msmcobalt/sdm/include/private/strategy_interface.h
+++ b/msm8998/sdm/include/private/strategy_interface.h
@@ -48,9 +48,11 @@
virtual DisplayError Start(HWLayersInfo *hw_layers_info, uint32_t *max_attempts) = 0;
virtual DisplayError GetNextStrategy(StrategyConstraints *constraints) = 0;
virtual DisplayError Stop() = 0;
- virtual DisplayError Reconfigure(HWDisplayMode mode, HWS3DMode s3d_mode,
+ virtual DisplayError Reconfigure(const HWPanelInfo &hw_panel_info,
+ const HWResourceInfo &hw_res_info,
const HWMixerAttributes &mixer_attributes,
const DisplayConfigVariableInfo &fb_config) = 0;
+ virtual DisplayError SetCompositionState(LayerComposition composition_type, bool enable) = 0;
protected:
virtual ~StrategyInterface() { }
diff --git a/msmcobalt/sdm/include/utils/constants.h b/msm8998/sdm/include/utils/constants.h
similarity index 100%
rename from msmcobalt/sdm/include/utils/constants.h
rename to msm8998/sdm/include/utils/constants.h
diff --git a/msmcobalt/sdm/include/utils/debug.h b/msm8998/sdm/include/utils/debug.h
similarity index 97%
rename from msmcobalt/sdm/include/utils/debug.h
rename to msm8998/sdm/include/utils/debug.h
index a0d8967..540a25e 100644
--- a/msmcobalt/sdm/include/utils/debug.h
+++ b/msm8998/sdm/include/utils/debug.h
@@ -77,6 +77,8 @@
static bool IsUbwcTiledFrameBuffer();
static bool IsAVRDisabled();
static bool IsExtAnimDisabled();
+ static DisplayError GetMixerResolution(uint32_t *width, uint32_t *height);
+ static int GetExtMaxlayers();
static bool GetProperty(const char *property_name, char *value);
static bool SetProperty(const char *property_name, const char *value);
diff --git a/msmcobalt/sdm/include/utils/formats.h b/msm8998/sdm/include/utils/formats.h
similarity index 100%
rename from msmcobalt/sdm/include/utils/formats.h
rename to msm8998/sdm/include/utils/formats.h
diff --git a/msmcobalt/sdm/include/utils/locker.h b/msm8998/sdm/include/utils/locker.h
similarity index 100%
rename from msmcobalt/sdm/include/utils/locker.h
rename to msm8998/sdm/include/utils/locker.h
diff --git a/msmcobalt/sdm/include/utils/rect.h b/msm8998/sdm/include/utils/rect.h
similarity index 94%
rename from msmcobalt/sdm/include/utils/rect.h
rename to msm8998/sdm/include/utils/rect.h
index d084556..6d3d482 100644
--- a/msmcobalt/sdm/include/utils/rect.h
+++ b/msm8998/sdm/include/utils/rect.h
@@ -55,8 +55,8 @@
bool flip_horizontal, LayerRect *out_rects);
void SplitTopBottom(const LayerRect &in_rect, uint32_t split_count, uint32_t align_y,
bool flip_horizontal, LayerRect *out_rects);
- void ScaleRect(const LayerRect &src_domain, const LayerRect &dst_domain, const LayerRect &in_rect,
- LayerRect *out_rect);
+ void MapRect(const LayerRect &src_domain, const LayerRect &dst_domain, const LayerRect &in_rect,
+ LayerRect *out_rect);
RectOrientation GetOrientation(const LayerRect &in_rect);
} // namespace sdm
diff --git a/msmcobalt/sdm/include/utils/sys.h b/msm8998/sdm/include/utils/sys.h
similarity index 97%
rename from msmcobalt/sdm/include/utils/sys.h
rename to msm8998/sdm/include/utils/sys.h
index b90007a..6b40df4 100644
--- a/msmcobalt/sdm/include/utils/sys.h
+++ b/msm8998/sdm/include/utils/sys.h
@@ -54,6 +54,7 @@
#else
typedef int (*ioctl)(int, int, ...);
#endif
+ typedef int (*access)(const char *, int);
typedef int (*open)(const char *, int, ...);
typedef int (*close)(int);
typedef int (*poll)(struct pollfd *, nfds_t, int);
@@ -68,6 +69,7 @@
static bool getline_(fstream &fs, std::string &line); // NOLINT
static ioctl ioctl_;
+ static access access_;
static open open_;
static close close_;
static poll poll_;
diff --git a/msmcobalt/sdm/libs/core/Android.mk b/msm8998/sdm/libs/core/Android.mk
similarity index 97%
rename from msmcobalt/sdm/libs/core/Android.mk
rename to msm8998/sdm/libs/core/Android.mk
index de314ba..f97ff33 100644
--- a/msmcobalt/sdm/libs/core/Android.mk
+++ b/msm8998/sdm/libs/core/Android.mk
@@ -53,6 +53,5 @@
$(SDM_HEADER_PATH)/private/hw_info_types.h \
$(SDM_HEADER_PATH)/private/partial_update_interface.h \
$(SDM_HEADER_PATH)/private/resource_interface.h \
- $(SDM_HEADER_PATH)/private/rotator_interface.h \
$(SDM_HEADER_PATH)/private/strategy_interface.h
include $(BUILD_COPY_HEADERS)
diff --git a/msmcobalt/sdm/libs/core/Makefile.am b/msm8998/sdm/libs/core/Makefile.am
similarity index 96%
rename from msmcobalt/sdm/libs/core/Makefile.am
rename to msm8998/sdm/libs/core/Makefile.am
index 8dbbe2f..9041394 100644
--- a/msmcobalt/sdm/libs/core/Makefile.am
+++ b/msm8998/sdm/libs/core/Makefile.am
@@ -40,4 +40,5 @@
libsdmcore_la_SOURCES = $(c_sources)
libsdmcore_la_CFLAGS = $(COMMON_CFLAGS) -DLOG_TAG=\"SDM\"
libsdmcore_la_CPPFLAGS = $(AM_CPPFLAGS)
-libsdmcore_la_LIBADD = ../utils/libsdmutils.la
\ No newline at end of file
+libsdmcore_la_LIBADD = ../utils/libsdmutils.la
+libsdmcore_la_LDFLAGS = -shared -avoid-version
\ No newline at end of file
diff --git a/msmcobalt/sdm/libs/core/color_manager.cpp b/msm8998/sdm/libs/core/color_manager.cpp
similarity index 100%
rename from msmcobalt/sdm/libs/core/color_manager.cpp
rename to msm8998/sdm/libs/core/color_manager.cpp
diff --git a/msmcobalt/sdm/libs/core/color_manager.h b/msm8998/sdm/libs/core/color_manager.h
similarity index 100%
rename from msmcobalt/sdm/libs/core/color_manager.h
rename to msm8998/sdm/libs/core/color_manager.h
diff --git a/msmcobalt/sdm/libs/core/comp_manager.cpp b/msm8998/sdm/libs/core/comp_manager.cpp
similarity index 89%
rename from msmcobalt/sdm/libs/core/comp_manager.cpp
rename to msm8998/sdm/libs/core/comp_manager.cpp
index 0b66320..d1530dc 100644
--- a/msmcobalt/sdm/libs/core/comp_manager.cpp
+++ b/msm8998/sdm/libs/core/comp_manager.cpp
@@ -35,16 +35,17 @@
DisplayError CompManager::Init(const HWResourceInfo &hw_res_info,
ExtensionInterface *extension_intf,
+ BufferAllocator *buffer_allocator,
BufferSyncHandler *buffer_sync_handler) {
SCOPE_LOCK(locker_);
DisplayError error = kErrorNone;
if (extension_intf) {
- error = extension_intf->CreateResourceExtn(hw_res_info, &resource_intf_, buffer_sync_handler);
+ error = extension_intf->CreateResourceExtn(hw_res_info, &resource_intf_, buffer_allocator,
+ buffer_sync_handler);
} else {
- resource_intf_ = &resource_default_;
- error = resource_default_.Init(hw_res_info);
+ error = ResourceDefault::CreateResourceDefault(hw_res_info, &resource_intf_);
}
if (error != kErrorNone) {
@@ -63,7 +64,7 @@
if (extension_intf_) {
extension_intf_->DestroyResourceExtn(resource_intf_);
} else {
- resource_default_.Deinit();
+ ResourceDefault::DestroyResourceDefault(resource_intf_);
}
return kErrorNone;
@@ -118,6 +119,7 @@
// resources for the added display is configured properly.
if (!display_comp_ctx->is_primary_panel) {
safe_mode_ = true;
+ max_sde_ext_layers_ = UINT32(Debug::GetExtMaxlayers());
}
DLOGV_IF(kTagCompManager, "registered display bit mask 0x%x, configured display bit mask 0x%x, " \
@@ -127,11 +129,11 @@
return kErrorNone;
}
-DisplayError CompManager::UnregisterDisplay(Handle comp_handle) {
+DisplayError CompManager::UnregisterDisplay(Handle display_ctx) {
SCOPE_LOCK(locker_);
DisplayCompositionContext *display_comp_ctx =
- reinterpret_cast<DisplayCompositionContext *>(comp_handle);
+ reinterpret_cast<DisplayCompositionContext *>(display_ctx);
if (!display_comp_ctx) {
return kErrorParameters;
@@ -212,7 +214,7 @@
// Limit 2 layer SDE Comp if its not a Primary Display
if (!display_comp_ctx->is_primary_panel) {
- constraints->max_layers = 2;
+ constraints->max_layers = max_sde_ext_layers_;
}
// If a strategy fails after successfully allocating resources, then set safe mode
@@ -220,6 +222,9 @@
constraints->safe_mode = true;
}
+ // Set use_cursor constraint to Strategy
+ constraints->use_cursor = display_comp_ctx->valid_cursor;
+
// Avoid idle fallback, if there is only one app layer.
// TODO(user): App layer count will change for hybrid composition
uint32_t app_layer_count = UINT32(hw_layers->info.stack->layers.size()) - 1;
@@ -227,18 +232,19 @@
// Handle the idle timeout by falling back
constraints->safe_mode = true;
}
-
- if (SupportLayerAsCursor(comp_handle, hw_layers)) {
- constraints->use_cursor = true;
- }
}
void CompManager::PrePrepare(Handle display_ctx, HWLayers *hw_layers) {
SCOPE_LOCK(locker_);
DisplayCompositionContext *display_comp_ctx =
reinterpret_cast<DisplayCompositionContext *>(display_ctx);
+ display_comp_ctx->valid_cursor = SupportLayerAsCursor(display_comp_ctx, hw_layers);
+
+ // pu constraints
+ display_comp_ctx->pu_constraints.enable_cursor_pu = display_comp_ctx->valid_cursor;
+
display_comp_ctx->strategy->Start(&hw_layers->info, &display_comp_ctx->max_strategies,
- display_comp_ctx->partial_update_enable);
+ display_comp_ctx->pu_constraints);
display_comp_ctx->remaining_strategies = display_comp_ctx->max_strategies;
}
@@ -267,8 +273,8 @@
}
if (!exit) {
- error = resource_intf_->Acquire(display_resource_ctx, hw_layers);
- // Exit if successfully allocated resource, else try next strategy.
+ error = resource_intf_->Prepare(display_resource_ctx, hw_layers);
+ // Exit if successfully prepared resource, else try next strategy.
exit = (error == kErrorNone);
}
}
@@ -299,6 +305,15 @@
return kErrorNone;
}
+DisplayError CompManager::Commit(Handle display_ctx, HWLayers *hw_layers) {
+ SCOPE_LOCK(locker_);
+
+ DisplayCompositionContext *display_comp_ctx =
+ reinterpret_cast<DisplayCompositionContext *>(display_ctx);
+
+ return resource_intf_->Commit(display_comp_ctx->display_resource_ctx, hw_layers);
+}
+
DisplayError CompManager::ReConfigure(Handle display_ctx, HWLayers *hw_layers) {
SCOPE_LOCK(locker_);
@@ -308,7 +323,7 @@
DisplayError error = kErrorUndefined;
resource_intf_->Start(display_resource_ctx);
- error = resource_intf_->Acquire(display_resource_ctx, hw_layers);
+ error = resource_intf_->Prepare(display_resource_ctx, hw_layers);
if (error != kErrorNone) {
DLOGE("Reconfigure failed for display = %d", display_comp_ctx->display_type);
@@ -402,7 +417,7 @@
DisplayCompositionContext *display_comp_ctx =
reinterpret_cast<DisplayCompositionContext *>(display_ctx);
- display_comp_ctx->partial_update_enable = enable;
+ display_comp_ctx->pu_constraints.enable = enable;
}
void CompManager::AppendDump(char *buffer, uint32_t length) {
@@ -492,5 +507,14 @@
return resource_intf_->SetDetailEnhancerData(display_comp_ctx->display_resource_ctx, de_data);
}
-} // namespace sdm
+DisplayError CompManager::SetCompositionState(Handle display_ctx,
+ LayerComposition composition_type, bool enable) {
+ SCOPE_LOCK(locker_);
+ DisplayCompositionContext *display_comp_ctx =
+ reinterpret_cast<DisplayCompositionContext *>(display_ctx);
+
+ return display_comp_ctx->strategy->SetCompositionState(composition_type, enable);
+}
+
+} // namespace sdm
diff --git a/msmcobalt/sdm/libs/core/comp_manager.h b/msm8998/sdm/libs/core/comp_manager.h
similarity index 91%
rename from msmcobalt/sdm/libs/core/comp_manager.h
rename to msm8998/sdm/libs/core/comp_manager.h
index 688010c..ebb257b 100644
--- a/msmcobalt/sdm/libs/core/comp_manager.h
+++ b/msm8998/sdm/libs/core/comp_manager.h
@@ -40,19 +40,20 @@
class CompManager : public DumpImpl {
public:
DisplayError Init(const HWResourceInfo &hw_res_info_, ExtensionInterface *extension_intf,
- BufferSyncHandler *buffer_sync_handler);
+ BufferAllocator *buffer_allocator, BufferSyncHandler *buffer_sync_handler);
DisplayError Deinit();
DisplayError RegisterDisplay(DisplayType type, const HWDisplayAttributes &display_attributes,
const HWPanelInfo &hw_panel_info,
const HWMixerAttributes &mixer_attributes,
- const DisplayConfigVariableInfo &fb_config, Handle *res_mgr_hnd);
- DisplayError UnregisterDisplay(Handle res_mgr_hnd);
+ const DisplayConfigVariableInfo &fb_config, Handle *display_ctx);
+ DisplayError UnregisterDisplay(Handle display_ctx);
DisplayError ReconfigureDisplay(Handle display_ctx, const HWDisplayAttributes &display_attributes,
const HWPanelInfo &hw_panel_info,
const HWMixerAttributes &mixer_attributes,
const DisplayConfigVariableInfo &fb_config);
void PrePrepare(Handle display_ctx, HWLayers *hw_layers);
DisplayError Prepare(Handle display_ctx, HWLayers *hw_layers);
+ DisplayError Commit(Handle display_ctx, HWLayers *hw_layers);
DisplayError PostPrepare(Handle display_ctx, HWLayers *hw_layers);
DisplayError ReConfigure(Handle display_ctx, HWLayers *hw_layers);
DisplayError PostCommit(Handle display_ctx, HWLayers *hw_layers);
@@ -68,6 +69,8 @@
DisplayError SetMaxBandwidthMode(HWBwModes mode);
DisplayError GetScaleLutConfig(HWScaleLutInfo *lut_info);
DisplayError SetDetailEnhancerData(Handle display_ctx, const DisplayDetailEnhancerData &de_data);
+ DisplayError SetCompositionState(Handle display_ctx, LayerComposition composition_type,
+ bool enable);
// DumpImpl method
virtual void AppendDump(char *buffer, uint32_t length);
@@ -86,15 +89,15 @@
uint32_t remaining_strategies = 0;
bool idle_fallback = false;
bool fallback_ = false;
- uint32_t partial_update_enable = true;
// Using primary panel flag of hw panel to configure Constraints. We do not need other hw
// panel parameters for now.
bool is_primary_panel = false;
+ bool valid_cursor = false;
+ PUConstraints pu_constraints = {};
};
Locker locker_;
ResourceInterface *resource_intf_ = NULL;
- ResourceDefault resource_default_;
std::bitset<kDisplayMax> registered_displays_; // Bit mask of registered displays
std::bitset<kDisplayMax> configured_displays_; // Bit mask of sucessfully configured displays
bool safe_mode_ = false; // Flag to notify all displays to be in resource crunch
@@ -103,6 +106,7 @@
HWResourceInfo hw_res_info_;
ExtensionInterface *extension_intf_ = NULL;
uint32_t max_layers_ = kMaxSDELayers;
+ uint32_t max_sde_ext_layers_ = 0;
};
} // namespace sdm
diff --git a/msmcobalt/sdm/libs/core/core_impl.cpp b/msm8998/sdm/libs/core/core_impl.cpp
similarity index 87%
rename from msmcobalt/sdm/libs/core/core_impl.cpp
rename to msm8998/sdm/libs/core/core_impl.cpp
index 66eb846..5976176 100644
--- a/msmcobalt/sdm/libs/core/core_impl.cpp
+++ b/msm8998/sdm/libs/core/core_impl.cpp
@@ -76,19 +76,11 @@
goto CleanupOnError;
}
- error = comp_mgr_.Init(hw_resource_, extension_intf_, buffer_sync_handler_);
+ error = comp_mgr_.Init(hw_resource_, extension_intf_, buffer_allocator_, buffer_sync_handler_);
if (error != kErrorNone) {
goto CleanupOnError;
}
- if (extension_intf_ && hw_resource_.hw_rot_info.num_rotator) {
- error = extension_intf_->CreateRotator(hw_resource_.hw_rot_info, buffer_allocator_,
- buffer_sync_handler_, &rotator_intf_);
- if (error != kErrorNone) {
- DLOGW("rotation is not supported");
- }
- }
-
error = ColorManagerProxy::Init(hw_resource_);
// if failed, doesn't affect display core functionalities.
if (error != kErrorNone) {
@@ -108,10 +100,6 @@
DisplayError CoreImpl::Deinit() {
SCOPE_LOCK(locker_);
- if (extension_intf_ && hw_resource_.hw_rot_info.num_rotator) {
- extension_intf_->DestroyRotator(rotator_intf_);
- }
-
ColorManagerProxy::Deinit();
comp_mgr_.Deinit();
@@ -133,15 +121,15 @@
switch (type) {
case kPrimary:
display_base = new DisplayPrimary(event_handler, hw_info_intf_, buffer_sync_handler_,
- &comp_mgr_, rotator_intf_);
+ &comp_mgr_);
break;
case kHDMI:
display_base = new DisplayHDMI(event_handler, hw_info_intf_, buffer_sync_handler_,
- &comp_mgr_, rotator_intf_);
+ &comp_mgr_);
break;
case kVirtual:
display_base = new DisplayVirtual(event_handler, hw_info_intf_, buffer_sync_handler_,
- &comp_mgr_, rotator_intf_);
+ &comp_mgr_);
break;
default:
DLOGE("Spurious display type %d", type);
diff --git a/msmcobalt/sdm/libs/core/core_impl.h b/msm8998/sdm/libs/core/core_impl.h
similarity index 94%
rename from msmcobalt/sdm/libs/core/core_impl.h
rename to msm8998/sdm/libs/core/core_impl.h
index c2e98c3..459495d 100644
--- a/msmcobalt/sdm/libs/core/core_impl.h
+++ b/msm8998/sdm/libs/core/core_impl.h
@@ -38,9 +38,6 @@
namespace sdm {
-class HWInfoInterface;
-class RotatorCtrl;
-
class CoreImpl : public CoreInterface {
public:
// This class implements display core interface revision 1.0.
@@ -63,12 +60,11 @@
protected:
Locker locker_;
- BufferAllocator *buffer_allocator_;
- BufferSyncHandler *buffer_sync_handler_;
+ BufferAllocator *buffer_allocator_ = NULL;
+ BufferSyncHandler *buffer_sync_handler_ = NULL;
HWResourceInfo hw_resource_;
CompManager comp_mgr_;
HWInfoInterface *hw_info_intf_ = NULL;
- RotatorInterface *rotator_intf_ = NULL;
DynLib extension_lib_;
ExtensionInterface *extension_intf_ = NULL;
CreateExtensionInterface create_extension_intf_ = NULL;
diff --git a/msmcobalt/sdm/libs/core/core_interface.cpp b/msm8998/sdm/libs/core/core_interface.cpp
similarity index 100%
rename from msmcobalt/sdm/libs/core/core_interface.cpp
rename to msm8998/sdm/libs/core/core_interface.cpp
diff --git a/msmcobalt/sdm/libs/core/display_base.cpp b/msm8998/sdm/libs/core/display_base.cpp
similarity index 88%
rename from msmcobalt/sdm/libs/core/display_base.cpp
rename to msm8998/sdm/libs/core/display_base.cpp
index bd2d7d3..843ed6e 100644
--- a/msmcobalt/sdm/libs/core/display_base.cpp
+++ b/msm8998/sdm/libs/core/display_base.cpp
@@ -41,11 +41,10 @@
// TODO(user): Have a single structure handle carries all the interface pointers and variables.
DisplayBase::DisplayBase(DisplayType display_type, DisplayEventHandler *event_handler,
HWDeviceType hw_device_type, BufferSyncHandler *buffer_sync_handler,
- CompManager *comp_manager, RotatorInterface *rotator_intf,
- HWInfoInterface *hw_info_intf)
+ CompManager *comp_manager, HWInfoInterface *hw_info_intf)
: display_type_(display_type), event_handler_(event_handler), hw_device_type_(hw_device_type),
buffer_sync_handler_(buffer_sync_handler), comp_manager_(comp_manager),
- rotator_intf_(rotator_intf), hw_info_intf_(hw_info_intf) {
+ hw_info_intf_(hw_info_intf) {
}
DisplayError DisplayBase::Init() {
@@ -59,11 +58,17 @@
hw_intf_->GetDisplayAttributes(active_index, &display_attributes_);
fb_config_ = display_attributes_;
- error = hw_intf_->GetMixerAttributes(&mixer_attributes_);
+ error = Debug::GetMixerResolution(&mixer_attributes_.width, &mixer_attributes_.height);
if (error != kErrorNone) {
- return error;
+ error = hw_intf_->GetMixerAttributes(&mixer_attributes_);
+ if (error != kErrorNone) {
+ return error;
+ }
}
+ req_mixer_width_ = mixer_attributes_.width;
+ req_mixer_height_ = mixer_attributes_.height;
+
// Override x_pixels and y_pixels of frame buffer with mixer width and height
fb_config_.x_pixels = mixer_attributes_.width;
fb_config_.y_pixels = mixer_attributes_.height;
@@ -84,13 +89,6 @@
goto CleanupOnError;
}
- if (rotator_intf_) {
- error = rotator_intf_->RegisterDisplay(display_type_, &display_rotator_ctx_);
- if (error != kErrorNone) {
- goto CleanupOnError;
- }
- }
-
if (hw_info_intf_) {
HWResourceInfo hw_resource_info = HWResourceInfo();
hw_info_intf_->GetHWResourceInfo(&hw_resource_info);
@@ -120,9 +118,6 @@
DisplayError DisplayBase::Deinit() {
lock_guard<recursive_mutex> obj(recursive_mutex_);
- if (rotator_intf_) {
- rotator_intf_->UnregisterDisplay(display_rotator_ctx_);
- }
if (color_mgr_) {
delete color_mgr_;
@@ -188,7 +183,7 @@
LayerRect dst_domain = (LayerRect){0.0f, 0.0f, layer_mixer_width, layer_mixer_height};
LayerRect out_rect = gpu_target_layer->dst_rect;
- ScaleRect(src_domain, dst_domain, gpu_target_layer->dst_rect, &out_rect);
+ MapRect(src_domain, dst_domain, gpu_target_layer->dst_rect, &out_rect);
auto gpu_target_layer_dst_xpixels = out_rect.right - out_rect.left;
auto gpu_target_layer_dst_ypixels = out_rect.bottom - out_rect.top;
@@ -237,29 +232,15 @@
break;
}
- if (IsRotationRequired(&hw_layers_)) {
- if (!rotator_intf_) {
- continue;
- }
- error = rotator_intf_->Prepare(display_rotator_ctx_, &hw_layers_);
- } else {
- // Release all the previous rotator sessions.
- if (rotator_intf_) {
- error = rotator_intf_->Purge(display_rotator_ctx_);
- }
- }
-
+ error = hw_intf_->Validate(&hw_layers_);
if (error == kErrorNone) {
- error = hw_intf_->Validate(&hw_layers_);
- if (error == kErrorNone) {
- // Strategy is successful now, wait for Commit().
- pending_commit_ = true;
- break;
- }
- if (error == kErrorShutDown) {
- comp_manager_->PostPrepare(display_comp_ctx_, &hw_layers_);
- return error;
- }
+ // Strategy is successful now, wait for Commit().
+ pending_commit_ = true;
+ break;
+ }
+ if (error == kErrorShutDown) {
+ comp_manager_->PostPrepare(display_comp_ctx_, &hw_layers_);
+ return error;
}
}
@@ -301,8 +282,7 @@
}
}
- if (rotator_intf_ && IsRotationRequired(&hw_layers_)) {
- error = rotator_intf_->Commit(display_rotator_ctx_, &hw_layers_);
+ if (comp_manager_->Commit(display_comp_ctx_, &hw_layers_)) {
if (error != kErrorNone) {
return error;
}
@@ -321,13 +301,6 @@
return error;
}
- if (rotator_intf_ && IsRotationRequired(&hw_layers_)) {
- error = rotator_intf_->PostCommit(display_rotator_ctx_, &hw_layers_);
- if (error != kErrorNone) {
- return error;
- }
- }
-
if (partial_update_control_) {
comp_manager_->ControlPartialUpdate(display_comp_ctx_, true /* enable */);
}
@@ -351,17 +324,7 @@
hw_layers_.info.count = 0;
error = hw_intf_->Flush();
if (error == kErrorNone) {
- // Release all the rotator sessions.
- if (rotator_intf_) {
- error = rotator_intf_->Purge(display_rotator_ctx_);
- if (error != kErrorNone) {
- DLOGE("Rotator purge failed for display %d", display_type_);
- return error;
- }
- }
-
comp_manager_->Purge(display_comp_ctx_);
-
pending_commit_ = false;
} else {
DLOGW("Unable to flush display = %d", display_type_);
@@ -396,6 +359,13 @@
return kErrorNotSupported;
}
+DisplayError DisplayBase::GetConfig(DisplayConfigFixedInfo *variable_info) {
+ lock_guard<recursive_mutex> obj(recursive_mutex_);
+ variable_info->is_cmdmode = (hw_panel_info_.mode == kModeCommand);
+
+ return kErrorNone;
+}
+
DisplayError DisplayBase::GetActiveConfig(uint32_t *index) {
lock_guard<recursive_mutex> obj(recursive_mutex_);
return hw_intf_->GetActiveConfig(index);
@@ -429,23 +399,23 @@
hw_layers_.info.count = 0;
error = hw_intf_->Flush();
if (error == kErrorNone) {
- // Release all the rotator sessions.
- if (rotator_intf_) {
- error = rotator_intf_->Purge(display_rotator_ctx_);
- if (error != kErrorNone) {
- DLOGE("Rotator purge failed for display %d", display_type_);
- return error;
- }
- }
-
comp_manager_->Purge(display_comp_ctx_);
-
error = hw_intf_->PowerOff();
}
break;
case kStateOn:
error = hw_intf_->PowerOn();
+ if (error != kErrorNone) {
+ return error;
+ }
+
+ error = comp_manager_->ReconfigureDisplay(display_comp_ctx_, display_attributes_,
+ hw_panel_info_, mixer_attributes_, fb_config_);
+ if (error != kErrorNone) {
+ return error;
+ }
+
active = true;
break;
@@ -548,14 +518,17 @@
DumpImpl::AppendString(buffer, length, "\n");
HWLayersInfo &layer_info = hw_layers_.info;
- LayerRect &l_roi = layer_info.left_partial_update;
- LayerRect &r_roi = layer_info.right_partial_update;
- DumpImpl::AppendString(buffer, length, "\nROI(L T R B) : LEFT(%d %d %d %d)", INT(l_roi.left),
- INT(l_roi.top), INT(l_roi.right), INT(l_roi.bottom));
- if (IsValid(r_roi)) {
- DumpImpl::AppendString(buffer, length, ", RIGHT(%d %d %d %d)", INT(r_roi.left),
- INT(r_roi.top), INT(r_roi.right), INT(r_roi.bottom));
+ for (uint32_t i = 0; i < layer_info.left_frame_roi.size(); i++) {
+ LayerRect &l_roi = layer_info.left_frame_roi.at(i);
+ LayerRect &r_roi = layer_info.right_frame_roi.at(i);
+
+ DumpImpl::AppendString(buffer, length, "\nROI%d(L T R B) : LEFT(%d %d %d %d)", i,
+ INT(l_roi.left), INT(l_roi.top), INT(l_roi.right), INT(l_roi.bottom));
+ if (IsValid(r_roi)) {
+ DumpImpl::AppendString(buffer, length, ", RIGHT(%d %d %d %d)", INT(r_roi.left),
+ INT(r_roi.top), INT(r_roi.right), INT(r_roi.bottom));
+ }
}
const char *header = "\n| Idx | Comp Type | Split | WB | Pipe | W x H | Format | Src Rect (L T R B) | Dst Rect (L T R B) | Z | Flags | Deci(HxV) | CS |"; //NOLINT
@@ -644,21 +617,6 @@
}
}
-bool DisplayBase::IsRotationRequired(HWLayers *hw_layers) {
- lock_guard<recursive_mutex> obj(recursive_mutex_);
- HWLayersInfo &layer_info = hw_layers->info;
-
- for (uint32_t i = 0; i < layer_info.count; i++) {
- HWRotatorSession *hw_rotator_session = &hw_layers->config[i].hw_rotator_session;
-
- if (hw_rotator_session->hw_block_count) {
- return true;
- }
- }
-
- return false;
-}
-
const char * DisplayBase::GetName(const LayerComposition &composition) {
switch (composition) {
case kCompositionGPU: return "GPU";
@@ -893,7 +851,16 @@
DisplayError DisplayBase::SetMixerResolution(uint32_t width, uint32_t height) {
lock_guard<recursive_mutex> obj(recursive_mutex_);
- return ReconfigureMixer(width, height);
+
+ DisplayError error = ReconfigureMixer(width, height);
+ if (error != kErrorNone) {
+ return error;
+ }
+
+ req_mixer_width_ = width;
+ req_mixer_height_ = height;
+
+ return kErrorNone;
}
DisplayError DisplayBase::GetMixerResolution(uint32_t *width, uint32_t *height) {
@@ -912,6 +879,10 @@
lock_guard<recursive_mutex> obj(recursive_mutex_);
DisplayError error = kErrorNone;
+ if (!width || !height) {
+ return kErrorParameters;
+ }
+
HWMixerAttributes mixer_attributes;
mixer_attributes.width = width;
mixer_attributes.height = height;
@@ -924,6 +895,24 @@
return ReconfigureDisplay();
}
+bool DisplayBase::NeedsDownScale(const LayerRect &src_rect, const LayerRect &dst_rect,
+ bool needs_rotation) {
+ float src_width = FLOAT(src_rect.right - src_rect.left);
+ float src_height = FLOAT(src_rect.bottom - src_rect.top);
+ float dst_width = FLOAT(dst_rect.right - dst_rect.left);
+ float dst_height = FLOAT(dst_rect.bottom - dst_rect.top);
+
+ if (needs_rotation) {
+ std::swap(src_width, src_height);
+ }
+
+ if ((src_width > dst_width) || (src_height > dst_height)) {
+ return true;
+ }
+
+ return false;
+}
+
bool DisplayBase::NeedsMixerReconfiguration(LayerStack *layer_stack, uint32_t *new_mixer_width,
uint32_t *new_mixer_height) {
lock_guard<recursive_mutex> obj(recursive_mutex_);
@@ -935,19 +924,18 @@
LayerRect fb_rect = (LayerRect) {0.0f, 0.0f, FLOAT(fb_width), FLOAT(fb_height)};
uint32_t mixer_width = mixer_attributes_.width;
uint32_t mixer_height = mixer_attributes_.height;
+ uint32_t display_width = display_attributes_.x_pixels;
+ uint32_t display_height = display_attributes_.y_pixels;
RectOrientation fb_orientation = GetOrientation(fb_rect);
uint32_t max_layer_area = 0;
uint32_t max_area_layer_index = 0;
std::vector<Layer *> layers = layer_stack->layers;
+ uint32_t align_x = display_attributes_.is_device_split ? 4 : 2;
+ uint32_t align_y = 2;
for (uint32_t i = 0; i < layer_count; i++) {
Layer *layer = layers.at(i);
- LayerBuffer *layer_buffer = layer->input_buffer;
-
- if (!layer_buffer->flags.video) {
- continue;
- }
uint32_t layer_width = UINT32(layer->src_rect.right - layer->src_rect.left);
uint32_t layer_height = UINT32(layer->src_rect.bottom - layer->src_rect.top);
@@ -959,14 +947,17 @@
}
}
- if (max_layer_area > fb_area) {
+ // TODO(user): Mark layer which needs downscaling on GPU fallback as priority layer and use MDP
+ // for composition to avoid quality mismatch between GPU and MDP switch(idle timeout usecase).
+ if (max_layer_area >= fb_area) {
Layer *layer = layers.at(max_area_layer_index);
+ bool needs_rotation = (layer->transform.rotation == 90.0f);
uint32_t layer_width = UINT32(layer->src_rect.right - layer->src_rect.left);
uint32_t layer_height = UINT32(layer->src_rect.bottom - layer->src_rect.top);
- LayerRect layer_rect = (LayerRect){0.0f, 0.0f, FLOAT(layer_width), FLOAT(layer_height)};
+ LayerRect layer_dst_rect = {};
- RectOrientation layer_orientation = GetOrientation(layer_rect);
+ RectOrientation layer_orientation = GetOrientation(layer->src_rect);
if (layer_orientation != kOrientationUnknown &&
fb_orientation != kOrientationUnknown) {
if (layer_orientation != fb_orientation) {
@@ -975,16 +966,23 @@
}
// Align the width and height according to fb's aspect ratio
- layer_width = UINT32((FLOAT(fb_width) / FLOAT(fb_height)) * layer_height);
+ *new_mixer_width = FloorToMultipleOf(UINT32((FLOAT(fb_width) / FLOAT(fb_height)) *
+ layer_height), align_x);
+ *new_mixer_height = FloorToMultipleOf(layer_height, align_y);
- *new_mixer_width = layer_width;
- *new_mixer_height = layer_height;
+ LayerRect dst_domain = {0.0f, 0.0f, FLOAT(*new_mixer_width), FLOAT(*new_mixer_height)};
+
+ MapRect(fb_rect, dst_domain, layer->dst_rect, &layer_dst_rect);
+ if (NeedsDownScale(layer->src_rect, layer_dst_rect, needs_rotation)) {
+ *new_mixer_width = display_width;
+ *new_mixer_height = display_height;
+ }
return true;
} else {
- if (fb_width != mixer_width || fb_height != mixer_height) {
- *new_mixer_width = fb_width;
- *new_mixer_height = fb_height;
+ if (req_mixer_width_ != mixer_width || req_mixer_height_ != mixer_height) {
+ *new_mixer_width = req_mixer_width_;
+ *new_mixer_height = req_mixer_height_;
return true;
}
@@ -1070,4 +1068,10 @@
return hw_panel_info_.is_primary_panel;
}
+DisplayError DisplayBase::SetCompositionState(LayerComposition composition_type, bool enable) {
+ lock_guard<recursive_mutex> obj(recursive_mutex_);
+
+ return comp_manager_->SetCompositionState(display_comp_ctx_, composition_type, enable);
+}
+
} // namespace sdm
diff --git a/msmcobalt/sdm/libs/core/display_base.h b/msm8998/sdm/libs/core/display_base.h
similarity index 94%
rename from msmcobalt/sdm/libs/core/display_base.h
rename to msm8998/sdm/libs/core/display_base.h
index 2bc94b7..ae1171d 100644
--- a/msmcobalt/sdm/libs/core/display_base.h
+++ b/msm8998/sdm/libs/core/display_base.h
@@ -27,7 +27,6 @@
#include <core/display_interface.h>
#include <private/strategy_interface.h>
-#include <private/rotator_interface.h>
#include <private/color_interface.h>
#include <map>
@@ -45,15 +44,11 @@
using std::recursive_mutex;
using std::lock_guard;
-class RotatorCtrl;
-class HWInfoInterface;
-
class DisplayBase : public DisplayInterface, DumpImpl {
public:
DisplayBase(DisplayType display_type, DisplayEventHandler *event_handler,
HWDeviceType hw_device_type, BufferSyncHandler *buffer_sync_handler,
- CompManager *comp_manager, RotatorInterface *rotator_intf,
- HWInfoInterface *hw_info_intf);
+ CompManager *comp_manager, HWInfoInterface *hw_info_intf);
virtual ~DisplayBase() { }
virtual DisplayError Init();
virtual DisplayError Deinit();
@@ -63,6 +58,7 @@
virtual DisplayError GetDisplayState(DisplayState *state);
virtual DisplayError GetNumVariableInfoConfigs(uint32_t *count);
virtual DisplayError GetConfig(uint32_t index, DisplayConfigVariableInfo *variable_info);
+ virtual DisplayError GetConfig(DisplayConfigFixedInfo *variable_info);
virtual DisplayError GetActiveConfig(uint32_t *index);
virtual DisplayError GetVSyncState(bool *enabled);
virtual DisplayError SetDisplayState(DisplayState state);
@@ -111,6 +107,7 @@
virtual DisplayError SetDetailEnhancerData(const DisplayDetailEnhancerData &de_data);
virtual DisplayError GetDisplayPort(DisplayPort *port);
virtual bool IsPrimaryDisplay();
+ virtual DisplayError SetCompositionState(LayerComposition composition_type, bool enable);
protected:
DisplayError BuildLayerStackStats(LayerStack *layer_stack);
@@ -119,12 +116,12 @@
// DumpImpl method
void AppendDump(char *buffer, uint32_t length);
- bool IsRotationRequired(HWLayers *hw_layers);
const char *GetName(const LayerComposition &composition);
DisplayError ReconfigureDisplay();
bool NeedsMixerReconfiguration(LayerStack *layer_stack, uint32_t *new_mixer_width,
uint32_t *new_mixer_height);
DisplayError ReconfigureMixer(uint32_t width, uint32_t height);
+ bool NeedsDownScale(const LayerRect &src_rect, const LayerRect &dst_rect, bool needs_rotation);
recursive_mutex recursive_mutex_;
DisplayType display_type_;
@@ -134,12 +131,10 @@
HWPanelInfo hw_panel_info_;
BufferSyncHandler *buffer_sync_handler_ = NULL;
CompManager *comp_manager_ = NULL;
- RotatorInterface *rotator_intf_ = NULL;
DisplayState state_ = kStateOff;
bool active_ = false;
Handle hw_device_ = 0;
Handle display_comp_ctx_ = 0;
- Handle display_rotator_ctx_ = 0;
HWLayers hw_layers_;
bool pending_commit_ = false;
bool vsync_enable_ = false;
@@ -156,12 +151,8 @@
HWDisplayAttributes display_attributes_ = {};
HWMixerAttributes mixer_attributes_ = {};
DisplayConfigVariableInfo fb_config_ = {};
-
- private:
- // Unused
- virtual DisplayError GetConfig(DisplayConfigFixedInfo *variable_info) {
- return kErrorNone;
- }
+ uint32_t req_mixer_width_ = 0;
+ uint32_t req_mixer_height_ = 0;
};
} // namespace sdm
diff --git a/msmcobalt/sdm/libs/core/display_hdmi.cpp b/msm8998/sdm/libs/core/display_hdmi.cpp
similarity index 98%
rename from msmcobalt/sdm/libs/core/display_hdmi.cpp
rename to msm8998/sdm/libs/core/display_hdmi.cpp
index 3c3d9f4..a577348 100644
--- a/msmcobalt/sdm/libs/core/display_hdmi.cpp
+++ b/msm8998/sdm/libs/core/display_hdmi.cpp
@@ -37,10 +37,9 @@
namespace sdm {
DisplayHDMI::DisplayHDMI(DisplayEventHandler *event_handler, HWInfoInterface *hw_info_intf,
- BufferSyncHandler *buffer_sync_handler, CompManager *comp_manager,
- RotatorInterface *rotator_intf)
+ BufferSyncHandler *buffer_sync_handler, CompManager *comp_manager)
: DisplayBase(kHDMI, event_handler, kDeviceHDMI, buffer_sync_handler, comp_manager,
- rotator_intf, hw_info_intf) {
+ hw_info_intf) {
}
DisplayError DisplayHDMI::Init() {
diff --git a/msmcobalt/sdm/libs/core/display_hdmi.h b/msm8998/sdm/libs/core/display_hdmi.h
similarity index 97%
rename from msmcobalt/sdm/libs/core/display_hdmi.h
rename to msm8998/sdm/libs/core/display_hdmi.h
index 091cdc3..868b141 100644
--- a/msmcobalt/sdm/libs/core/display_hdmi.h
+++ b/msm8998/sdm/libs/core/display_hdmi.h
@@ -38,8 +38,7 @@
class DisplayHDMI : public DisplayBase, HWEventHandler {
public:
DisplayHDMI(DisplayEventHandler *event_handler, HWInfoInterface *hw_info_intf,
- BufferSyncHandler *buffer_sync_handler, CompManager *comp_manager,
- RotatorInterface *rotator_intf);
+ BufferSyncHandler *buffer_sync_handler, CompManager *comp_manager);
virtual DisplayError Init();
virtual DisplayError Prepare(LayerStack *layer_stack);
virtual DisplayError GetRefreshRateRange(uint32_t *min_refresh_rate, uint32_t *max_refresh_rate);
diff --git a/msmcobalt/sdm/libs/core/display_primary.cpp b/msm8998/sdm/libs/core/display_primary.cpp
similarity index 94%
rename from msmcobalt/sdm/libs/core/display_primary.cpp
rename to msm8998/sdm/libs/core/display_primary.cpp
index e8689ea..9f6c917 100644
--- a/msmcobalt/sdm/libs/core/display_primary.cpp
+++ b/msm8998/sdm/libs/core/display_primary.cpp
@@ -39,10 +39,9 @@
namespace sdm {
DisplayPrimary::DisplayPrimary(DisplayEventHandler *event_handler, HWInfoInterface *hw_info_intf,
- BufferSyncHandler *buffer_sync_handler, CompManager *comp_manager,
- RotatorInterface *rotator_intf)
+ BufferSyncHandler *buffer_sync_handler, CompManager *comp_manager)
: DisplayBase(kPrimary, event_handler, kDevicePrimary, buffer_sync_handler, comp_manager,
- rotator_intf, hw_info_intf) {
+ hw_info_intf) {
}
DisplayError DisplayPrimary::Init() {
@@ -107,10 +106,17 @@
DisplayError DisplayPrimary::Commit(LayerStack *layer_stack) {
lock_guard<recursive_mutex> obj(recursive_mutex_);
DisplayError error = kErrorNone;
+ uint32_t app_layer_count = hw_layers_.info.app_layer_count;
// Enabling auto refresh is async and needs to happen before commit ioctl
if (hw_panel_info_.mode == kModeCommand) {
- hw_intf_->SetAutoRefresh(layer_stack->flags.single_buffered_layer_present);
+ bool enable = (app_layer_count == 1) && layer_stack->flags.single_buffered_layer_present;
+ bool need_refresh = layer_stack->flags.single_buffered_layer_present && (app_layer_count > 1);
+
+ hw_intf_->SetAutoRefresh(enable);
+ if (need_refresh) {
+ event_handler_->Refresh();
+ }
}
bool set_idle_timeout = comp_manager_->CanSetIdleTimeout(display_comp_ctx_);
@@ -128,6 +134,10 @@
} else {
hw_intf_->SetIdleTimeoutMs(0);
}
+ } else if (switch_to_cmd_) {
+ uint32_t pending;
+ switch_to_cmd_ = false;
+ ControlPartialUpdate(true /* enable */, &pending);
}
return error;
@@ -192,7 +202,7 @@
ControlPartialUpdate(false /* enable */, &pending);
hw_intf_->SetIdleTimeoutMs(idle_timeout_ms_);
} else if (mode == kModeCommand) {
- ControlPartialUpdate(true /* enable */, &pending);
+ switch_to_cmd_ = true;
hw_intf_->SetIdleTimeoutMs(0);
}
diff --git a/msmcobalt/sdm/libs/core/display_primary.h b/msm8998/sdm/libs/core/display_primary.h
similarity index 97%
rename from msmcobalt/sdm/libs/core/display_primary.h
rename to msm8998/sdm/libs/core/display_primary.h
index 7a03005..7471899 100644
--- a/msmcobalt/sdm/libs/core/display_primary.h
+++ b/msm8998/sdm/libs/core/display_primary.h
@@ -37,8 +37,7 @@
class DisplayPrimary : public DisplayBase, HWEventHandler {
public:
DisplayPrimary(DisplayEventHandler *event_handler, HWInfoInterface *hw_info_intf,
- BufferSyncHandler *buffer_sync_handler, CompManager *comp_manager,
- RotatorInterface *rotator_intf);
+ BufferSyncHandler *buffer_sync_handler, CompManager *comp_manager);
virtual DisplayError Init();
virtual DisplayError Prepare(LayerStack *layer_stack);
virtual DisplayError Commit(LayerStack *layer_stack);
@@ -66,6 +65,7 @@
std::vector<const char *> event_list_ = {"vsync_event", "show_blank_event", "idle_notify",
"msm_fb_thermal_level", "thread_exit"};
bool avr_prop_disabled_ = false;
+ bool switch_to_cmd_ = false;
};
} // namespace sdm
diff --git a/msmcobalt/sdm/libs/core/display_virtual.cpp b/msm8998/sdm/libs/core/display_virtual.cpp
similarity index 96%
rename from msmcobalt/sdm/libs/core/display_virtual.cpp
rename to msm8998/sdm/libs/core/display_virtual.cpp
index 6beea5c..04922c4 100644
--- a/msmcobalt/sdm/libs/core/display_virtual.cpp
+++ b/msm8998/sdm/libs/core/display_virtual.cpp
@@ -34,10 +34,9 @@
namespace sdm {
DisplayVirtual::DisplayVirtual(DisplayEventHandler *event_handler, HWInfoInterface *hw_info_intf,
- BufferSyncHandler *buffer_sync_handler, CompManager *comp_manager,
- RotatorInterface *rotator_intf)
+ BufferSyncHandler *buffer_sync_handler, CompManager *comp_manager)
: DisplayBase(kVirtual, event_handler, kDeviceVirtual, buffer_sync_handler, comp_manager,
- rotator_intf, hw_info_intf) {
+ hw_info_intf) {
}
DisplayError DisplayVirtual::Init() {
diff --git a/msmcobalt/sdm/libs/core/display_virtual.h b/msm8998/sdm/libs/core/display_virtual.h
similarity index 97%
rename from msmcobalt/sdm/libs/core/display_virtual.h
rename to msm8998/sdm/libs/core/display_virtual.h
index d6ce915..3cc2e24 100644
--- a/msmcobalt/sdm/libs/core/display_virtual.h
+++ b/msm8998/sdm/libs/core/display_virtual.h
@@ -36,8 +36,7 @@
class DisplayVirtual : public DisplayBase {
public:
DisplayVirtual(DisplayEventHandler *event_handler, HWInfoInterface *hw_info_intf,
- BufferSyncHandler *buffer_sync_handler, CompManager *comp_manager,
- RotatorInterface *rotator_intf);
+ BufferSyncHandler *buffer_sync_handler, CompManager *comp_manager);
virtual DisplayError Init();
virtual DisplayError Prepare(LayerStack *layer_stack);
virtual DisplayError GetNumVariableInfoConfigs(uint32_t *count);
diff --git a/msmcobalt/sdm/libs/core/dump_impl.cpp b/msm8998/sdm/libs/core/dump_impl.cpp
similarity index 100%
rename from msmcobalt/sdm/libs/core/dump_impl.cpp
rename to msm8998/sdm/libs/core/dump_impl.cpp
diff --git a/msmcobalt/sdm/libs/core/dump_impl.h b/msm8998/sdm/libs/core/dump_impl.h
similarity index 100%
rename from msmcobalt/sdm/libs/core/dump_impl.h
rename to msm8998/sdm/libs/core/dump_impl.h
diff --git a/msmcobalt/sdm/libs/core/fb/hw_color_manager.cpp b/msm8998/sdm/libs/core/fb/hw_color_manager.cpp
similarity index 100%
rename from msmcobalt/sdm/libs/core/fb/hw_color_manager.cpp
rename to msm8998/sdm/libs/core/fb/hw_color_manager.cpp
diff --git a/msmcobalt/sdm/libs/core/fb/hw_color_manager.h b/msm8998/sdm/libs/core/fb/hw_color_manager.h
similarity index 100%
rename from msmcobalt/sdm/libs/core/fb/hw_color_manager.h
rename to msm8998/sdm/libs/core/fb/hw_color_manager.h
diff --git a/msmcobalt/sdm/libs/core/fb/hw_device.cpp b/msm8998/sdm/libs/core/fb/hw_device.cpp
similarity index 94%
rename from msmcobalt/sdm/libs/core/fb/hw_device.cpp
rename to msm8998/sdm/libs/core/fb/hw_device.cpp
index d6962fd..31d4b81 100644
--- a/msmcobalt/sdm/libs/core/fb/hw_device.cpp
+++ b/msm8998/sdm/libs/core/fb/hw_device.cpp
@@ -105,12 +105,28 @@
}
DisplayError HWDevice::Init() {
- char device_name[64] = {0};
-
// Read the fb node index
fb_node_index_ = GetFBNodeIndex(device_type_);
if (fb_node_index_ == -1) {
- DLOGE("%s should be present", device_name_);
+ DLOGE("device type = %d should be present", device_type_);
+ return kErrorHardware;
+ }
+
+ const char *dev_name = NULL;
+ vector<string> dev_paths = {"/dev/graphics/fb", "/dev/fb"};
+ for (size_t i = 0; i < dev_paths.size(); i++) {
+ dev_paths[i] += to_string(fb_node_index_);
+ if (Sys::access_(dev_paths[i].c_str(), F_OK) >= 0) {
+ dev_name = dev_paths[i].c_str();
+ DLOGI("access(%s) successful", dev_name);
+ break;
+ }
+
+ DLOGI("access(%s), errno = %d, error = %s", dev_paths[i].c_str(), errno, strerror(errno));
+ }
+
+ if (!dev_name) {
+ DLOGE("access() failed for all possible paths");
return kErrorHardware;
}
@@ -120,10 +136,9 @@
hw_resource_ = HWResourceInfo();
hw_info_intf_->GetHWResourceInfo(&hw_resource_);
- snprintf(device_name, sizeof(device_name), "%s%d", "/dev/graphics/fb", fb_node_index_);
- device_fd_ = Sys::open_(device_name, O_RDWR);
+ device_fd_ = Sys::open_(dev_name, O_RDWR);
if (device_fd_ < 0) {
- DLOGE("open %s failed err = %d errstr = %s", device_name, errno, strerror(errno));
+ DLOGE("open %s failed errno = %d, error = %s", dev_name, errno, strerror(errno));
return kErrorResources;
}
@@ -358,9 +373,9 @@
DLOGV_IF(kTagDriverConfig, "************************ DestScalar[%d] **************************",
dest_scalar_data->dest_scaler_ndx);
- DLOGV_IF(kTagDriverConfig, "Mixer WxH %dx%d", dest_scalar_data->lm_width,
- dest_scalar_data->lm_height);
- DLOGI_IF(kTagDriverConfig, "*****************************************************************");
+ DLOGV_IF(kTagDriverConfig, "Mixer WxH %dx%d flags %x", dest_scalar_data->lm_width,
+ dest_scalar_data->lm_height, dest_scalar_data->flags);
+ DLOGV_IF(kTagDriverConfig, "*****************************************************************");
}
mdp_commit.dest_scaler_cnt = UINT32(hw_layer_info.dest_scale_info_map.size());
@@ -387,6 +402,12 @@
DLOGI("mdp_commit: flags = %x, release fence = %x", mdp_commit.flags, mdp_commit.release_fence);
DLOGI("left_roi: x = %d, y = %d, w = %d, h = %d", l_roi.x, l_roi.y, l_roi.w, l_roi.h);
DLOGI("right_roi: x = %d, y = %d, w = %d, h = %d", r_roi.x, r_roi.y, r_roi.w, r_roi.h);
+ for (uint32_t i = 0; i < mdp_commit.dest_scaler_cnt; i++) {
+ mdp_destination_scaler_data *dest_scalar_data = &mdp_dest_scalar_data_[i];
+
+ DLOGI("Dest scalar index %d Mixer WxH %dx%d", dest_scalar_data->dest_scaler_ndx,
+ dest_scalar_data->lm_width, dest_scalar_data->lm_height);
+ }
for (uint32_t i = 0; i < mdp_commit.input_layer_cnt; i++) {
const mdp_input_layer &layer = mdp_layers[i];
const mdp_rect &src_rect = layer.src_rect;
@@ -721,7 +742,9 @@
}
}
- if (input_buffer->flags.secure) {
+ if (input_buffer->flags.secure_camera) {
+ *mdp_flags |= MDP_LAYER_SECURE_CAMERA_SESSION;
+ } else if (input_buffer->flags.secure) {
*mdp_flags |= MDP_LAYER_SECURE_SESSION;
}
@@ -774,8 +797,8 @@
DLOGI("Device type = %d, Display Port = %d, Display Mode = %d, Device Node = %d, Is Primary = %d",
device_type_, hw_panel_info_.port, hw_panel_info_.mode, fb_node_index_,
hw_panel_info_.is_primary_panel);
- DLOGI("Partial Update = %d, Dynamic FPS = %d",
- hw_panel_info_.partial_update, hw_panel_info_.dynamic_fps);
+ DLOGI("Partial Update = %d, supported roi_count =%d, Dynamic FPS = %d",
+ hw_panel_info_.partial_update, hw_panel_info_.left_roi_count, hw_panel_info_.dynamic_fps);
DLOGI("Align: left = %d, width = %d, top = %d, height = %d",
hw_panel_info_.left_align, hw_panel_info_.width_align,
hw_panel_info_.top_align, hw_panel_info_.height_align);
@@ -856,6 +879,9 @@
panel_info->is_primary_panel = atoi(tokens[1]);
} else if (!strncmp(tokens[0], "is_pluggable", strlen("is_pluggable"))) {
panel_info->is_pluggable = atoi(tokens[1]);
+ } else if (!strncmp(tokens[0], "pu_roi_cnt", strlen("pu_roi_cnt"))) {
+ panel_info->left_roi_count = UINT32(atoi(tokens[1]));
+ panel_info->right_roi_count = UINT32(atoi(tokens[1]));
}
}
}
@@ -1243,9 +1269,9 @@
if (mixer_attributes.width > display_attributes_.x_pixels ||
mixer_attributes.height > display_attributes_.y_pixels) {
- DLOGW("Input resolution exceeds display resolution! input: res %dx%d display: res %dx%d",
- mixer_attributes.width, mixer_attributes.height, display_attributes_.x_pixels,
- display_attributes_.y_pixels);
+ DLOGW_IF(kTagDriverConfig, "Input resolution exceeds display resolution! input: res %dx%d "\
+ "display: res %dx%d", mixer_attributes.width, mixer_attributes.height,
+ display_attributes_.x_pixels, display_attributes_.y_pixels);
return kErrorNotSupported;
}
@@ -1255,8 +1281,8 @@
}
if (mixer_attributes.width > max_input_width) {
- DLOGW("Input width exceeds width limit! input_width %d width_limit %d", mixer_attributes.width,
- max_input_width);
+ DLOGW_IF(kTagDriverConfig, "Input width exceeds width limit! input_width %d width_limit %d",
+ mixer_attributes.width, max_input_width);
return kErrorNotSupported;
}
@@ -1265,8 +1291,9 @@
FLOAT(display_attributes_.x_pixels) / FLOAT(display_attributes_.y_pixels);
if (display_aspect_ratio != mixer_aspect_ratio) {
- DLOGW("Aspect ratio mismatch! input: res %dx%d display: res %dx%d", mixer_attributes.width,
- mixer_attributes.height, display_attributes_.x_pixels, display_attributes_.y_pixels);
+ DLOGW_IF(kTagDriverConfig, "Aspect ratio mismatch! input: res %dx%d display: res %dx%d",
+ mixer_attributes.width, mixer_attributes.height, display_attributes_.x_pixels,
+ display_attributes_.y_pixels);
return kErrorNotSupported;
}
@@ -1274,8 +1301,8 @@
float scale_y = FLOAT(display_attributes_.y_pixels) / FLOAT(mixer_attributes.height);
float max_scale_up = hw_resource_.hw_dest_scalar_info.max_scale_up;
if (scale_x > max_scale_up || scale_y > max_scale_up) {
- DLOGW("Up scaling ratio exceeds for destination scalar upscale limit scale_x %f scale_y %f " \
- "max_scale_up %f", scale_x, scale_y, max_scale_up);
+ DLOGW_IF(kTagDriverConfig, "Up scaling ratio exceeds for destination scalar upscale " \
+ "limit scale_x %f scale_y %f max_scale_up %f", scale_x, scale_y, max_scale_up);
return kErrorNotSupported;
}
diff --git a/msmcobalt/sdm/libs/core/fb/hw_device.h b/msm8998/sdm/libs/core/fb/hw_device.h
similarity index 98%
rename from msmcobalt/sdm/libs/core/fb/hw_device.h
rename to msm8998/sdm/libs/core/fb/hw_device.h
index dce7648..72c7a13 100644
--- a/msmcobalt/sdm/libs/core/fb/hw_device.h
+++ b/msm8998/sdm/libs/core/fb/hw_device.h
@@ -45,6 +45,10 @@
#define MDP_LAYER_MULTIRECT_PARALLEL_MODE 0
#endif
+#ifndef MDP_LAYER_SECURE_CAMERA_SESSION
+#define MDP_LAYER_SECURE_CAMERA_SESSION 0
+#endif
+
namespace sdm {
class HWInfoInterface;
diff --git a/msmcobalt/sdm/libs/core/fb/hw_events.cpp b/msm8998/sdm/libs/core/fb/hw_events.cpp
similarity index 100%
rename from msmcobalt/sdm/libs/core/fb/hw_events.cpp
rename to msm8998/sdm/libs/core/fb/hw_events.cpp
diff --git a/msmcobalt/sdm/libs/core/fb/hw_events.h b/msm8998/sdm/libs/core/fb/hw_events.h
similarity index 100%
rename from msmcobalt/sdm/libs/core/fb/hw_events.h
rename to msm8998/sdm/libs/core/fb/hw_events.h
diff --git a/msmcobalt/sdm/libs/core/fb/hw_hdmi.cpp b/msm8998/sdm/libs/core/fb/hw_hdmi.cpp
similarity index 100%
rename from msmcobalt/sdm/libs/core/fb/hw_hdmi.cpp
rename to msm8998/sdm/libs/core/fb/hw_hdmi.cpp
diff --git a/msmcobalt/sdm/libs/core/fb/hw_hdmi.h b/msm8998/sdm/libs/core/fb/hw_hdmi.h
similarity index 100%
rename from msmcobalt/sdm/libs/core/fb/hw_hdmi.h
rename to msm8998/sdm/libs/core/fb/hw_hdmi.h
diff --git a/msmcobalt/sdm/libs/core/fb/hw_info.cpp b/msm8998/sdm/libs/core/fb/hw_info.cpp
similarity index 99%
rename from msmcobalt/sdm/libs/core/fb/hw_info.cpp
rename to msm8998/sdm/libs/core/fb/hw_info.cpp
index 121b7c0..ef450c0 100644
--- a/msmcobalt/sdm/libs/core/fb/hw_info.cpp
+++ b/msm8998/sdm/libs/core/fb/hw_info.cpp
@@ -247,6 +247,8 @@
hw_resource->separate_rotator = true;
} else if (!strncmp(tokens[i], "qseed3", strlen("qseed3"))) {
hw_resource->has_qseed3 = true;
+ } else if (!strncmp(tokens[i], "has_ppp", strlen("has_ppp"))) {
+ hw_resource->has_ppp = true;
} else if (!strncmp(tokens[i], "concurrent_writeback", strlen("concurrent_writeback"))) {
hw_resource->has_concurrent_writeback = true;
} else if (!strncmp(tokens[i], "avr", strlen("avr"))) {
diff --git a/msmcobalt/sdm/libs/core/fb/hw_info.h b/msm8998/sdm/libs/core/fb/hw_info.h
similarity index 100%
rename from msmcobalt/sdm/libs/core/fb/hw_info.h
rename to msm8998/sdm/libs/core/fb/hw_info.h
diff --git a/msmcobalt/sdm/libs/core/fb/hw_primary.cpp b/msm8998/sdm/libs/core/fb/hw_primary.cpp
similarity index 97%
rename from msmcobalt/sdm/libs/core/fb/hw_primary.cpp
rename to msm8998/sdm/libs/core/fb/hw_primary.cpp
index f3c7639..6f62143 100644
--- a/msmcobalt/sdm/libs/core/fb/hw_primary.cpp
+++ b/msm8998/sdm/libs/core/fb/hw_primary.cpp
@@ -332,6 +332,8 @@
return kErrorHardware;
}
+ auto_refresh_ = false;
+
return kErrorNone;
}
@@ -361,18 +363,27 @@
mdp_layer_commit_v1 &mdp_commit = mdp_disp_commit_.commit_v1;
- LayerRect left_roi = hw_layer_info.left_partial_update;
- LayerRect right_roi = hw_layer_info.right_partial_update;
+ LayerRect left_roi = hw_layer_info.left_frame_roi.at(0);
+ LayerRect right_roi = hw_layer_info.right_frame_roi.at(0);
+
mdp_commit.left_roi.x = UINT32(left_roi.left);
mdp_commit.left_roi.y = UINT32(left_roi.top);
mdp_commit.left_roi.w = UINT32(left_roi.right - left_roi.left);
mdp_commit.left_roi.h = UINT32(left_roi.bottom - left_roi.top);
+ // Update second roi information in right_roi
+ if (hw_layer_info.left_frame_roi.size() == 2) {
+ right_roi = hw_layer_info.left_frame_roi.at(1);
+ }
+
// SDM treats ROI as one full coordinate system.
// In case source split is disabled, However, Driver assumes Mixer to operate in
// different co-ordinate system.
- if (!hw_resource_.is_src_split && IsValid(right_roi)) {
- mdp_commit.right_roi.x = UINT32(right_roi.left) - mixer_attributes_.split_left;
+ if (IsValid(right_roi)) {
+ mdp_commit.right_roi.x = UINT32(right_roi.left);
+ if (!hw_resource_.is_src_split) {
+ mdp_commit.right_roi.x = UINT32(right_roi.left) - mixer_attributes_.split_left;
+ }
mdp_commit.right_roi.y = UINT32(right_roi.top);
mdp_commit.right_roi.w = UINT32(right_roi.right - right_roi.left);
mdp_commit.right_roi.h = UINT32(right_roi.bottom - right_roi.top);
diff --git a/msmcobalt/sdm/libs/core/fb/hw_primary.h b/msm8998/sdm/libs/core/fb/hw_primary.h
similarity index 100%
rename from msmcobalt/sdm/libs/core/fb/hw_primary.h
rename to msm8998/sdm/libs/core/fb/hw_primary.h
diff --git a/msmcobalt/sdm/libs/core/fb/hw_scale.cpp b/msm8998/sdm/libs/core/fb/hw_scale.cpp
similarity index 97%
rename from msmcobalt/sdm/libs/core/fb/hw_scale.cpp
rename to msm8998/sdm/libs/core/fb/hw_scale.cpp
index 3d175e5..4933412 100644
--- a/msmcobalt/sdm/libs/core/fb/hw_scale.cpp
+++ b/msm8998/sdm/libs/core/fb/hw_scale.cpp
@@ -134,14 +134,6 @@
mdp_scale = &scale_data_v2_.at(index);
} else {
mdp_scale_data_v2 mdp_dest_scale;
- mdp_destination_scaler_data *dest_scalar =
- reinterpret_cast<mdp_destination_scaler_data *>(mdp_commit->dest_scaler);
-
- dest_scalar[index].flags = MDP_DESTSCALER_ENABLE;
-
- if (scale_data.enable.detail_enhance) {
- dest_scalar[index].flags |= MDP_DESTSCALER_ENHANCER_UPDATE;
- }
dest_scale_data_v2_.insert(std::make_pair(index, mdp_dest_scale));
mdp_scale = &dest_scale_data_v2_[index];
@@ -151,6 +143,17 @@
(scale_data.enable.direction_detection ? ENABLE_DIRECTION_DETECTION : 0) |
(scale_data.enable.detail_enhance ? ENABLE_DETAIL_ENHANCE : 0);
+ if (sub_block_type == kHWDestinationScalar) {
+ mdp_destination_scaler_data *mdp_dest_scalar =
+ reinterpret_cast<mdp_destination_scaler_data *>(mdp_commit->dest_scaler);
+
+ mdp_dest_scalar[index].flags = mdp_scale->enable ? MDP_DESTSCALER_ENABLE : 0;
+
+ if (scale_data.enable.detail_enhance) {
+ mdp_dest_scalar[index].flags |= MDP_DESTSCALER_ENHANCER_UPDATE;
+ }
+ }
+
for (int i = 0; i < MAX_PLANES; i++) {
const HWPlane &plane = scale_data.plane[i];
mdp_scale->init_phase_x[i] = plane.init_phase_x;
diff --git a/msmcobalt/sdm/libs/core/fb/hw_scale.h b/msm8998/sdm/libs/core/fb/hw_scale.h
similarity index 100%
rename from msmcobalt/sdm/libs/core/fb/hw_scale.h
rename to msm8998/sdm/libs/core/fb/hw_scale.h
diff --git a/msmcobalt/sdm/libs/core/fb/hw_virtual.cpp b/msm8998/sdm/libs/core/fb/hw_virtual.cpp
similarity index 100%
rename from msmcobalt/sdm/libs/core/fb/hw_virtual.cpp
rename to msm8998/sdm/libs/core/fb/hw_virtual.cpp
diff --git a/msmcobalt/sdm/libs/core/fb/hw_virtual.h b/msm8998/sdm/libs/core/fb/hw_virtual.h
similarity index 100%
rename from msmcobalt/sdm/libs/core/fb/hw_virtual.h
rename to msm8998/sdm/libs/core/fb/hw_virtual.h
diff --git a/msmcobalt/sdm/libs/core/hw_events_interface.h b/msm8998/sdm/libs/core/hw_events_interface.h
similarity index 100%
rename from msmcobalt/sdm/libs/core/hw_events_interface.h
rename to msm8998/sdm/libs/core/hw_events_interface.h
diff --git a/msmcobalt/sdm/libs/core/hw_info_interface.h b/msm8998/sdm/libs/core/hw_info_interface.h
similarity index 100%
rename from msmcobalt/sdm/libs/core/hw_info_interface.h
rename to msm8998/sdm/libs/core/hw_info_interface.h
diff --git a/msmcobalt/sdm/libs/core/hw_interface.h b/msm8998/sdm/libs/core/hw_interface.h
similarity index 100%
rename from msmcobalt/sdm/libs/core/hw_interface.h
rename to msm8998/sdm/libs/core/hw_interface.h
diff --git a/msmcobalt/sdm/libs/core/resource_default.cpp b/msm8998/sdm/libs/core/resource_default.cpp
similarity index 95%
rename from msmcobalt/sdm/libs/core/resource_default.cpp
rename to msm8998/sdm/libs/core/resource_default.cpp
index 4fc3ce4..54a6658 100644
--- a/msmcobalt/sdm/libs/core/resource_default.cpp
+++ b/msm8998/sdm/libs/core/resource_default.cpp
@@ -37,10 +37,42 @@
namespace sdm {
-DisplayError ResourceDefault::Init(const HWResourceInfo &hw_res_info) {
+DisplayError ResourceDefault::CreateResourceDefault(const HWResourceInfo &hw_resource_info,
+ ResourceInterface **resource_intf) {
DisplayError error = kErrorNone;
- num_pipe_ = hw_res_info.num_vig_pipe + hw_res_info.num_rgb_pipe + hw_res_info.num_dma_pipe;
+ ResourceDefault *resource_default = new ResourceDefault(hw_resource_info);
+ if (!resource_default) {
+ return kErrorNone;
+ }
+
+ error = resource_default->Init();
+ if (error != kErrorNone) {
+ delete resource_default;
+ }
+
+ *resource_intf = resource_default;
+
+ return kErrorNone;
+}
+
+DisplayError ResourceDefault::DestroyResourceDefault(ResourceInterface *resource_intf) {
+ ResourceDefault *resource_default = static_cast<ResourceDefault *>(resource_intf);
+
+ resource_default->Deinit();
+ delete resource_default;
+
+ return kErrorNone;
+}
+
+ResourceDefault::ResourceDefault(const HWResourceInfo &hw_res_info)
+ : hw_res_info_(hw_res_info) {
+}
+
+DisplayError ResourceDefault::Init() {
+ DisplayError error = kErrorNone;
+
+ num_pipe_ = hw_res_info_.num_vig_pipe + hw_res_info_.num_rgb_pipe + hw_res_info_.num_dma_pipe;
if (!num_pipe_) {
DLOGE("Number of H/W pipes is Zero!");
@@ -48,7 +80,6 @@
}
src_pipes_.resize(num_pipe_);
- hw_res_info_ = hw_res_info;
// Priority order of pipes: VIG, RGB, DMA
uint32_t vig_index = 0;
@@ -187,7 +218,7 @@
return kErrorNone;
}
-DisplayError ResourceDefault::Acquire(Handle display_ctx, HWLayers *hw_layers) {
+DisplayError ResourceDefault::Prepare(Handle display_ctx, HWLayers *hw_layers) {
DisplayResourceContext *display_resource_ctx =
reinterpret_cast<DisplayResourceContext *>(display_ctx);
@@ -297,6 +328,12 @@
return kErrorNone;
}
+DisplayError ResourceDefault::Commit(Handle display_ctx, HWLayers *hw_layers) {
+ SCOPE_LOCK(locker_);
+
+ return kErrorNone;
+}
+
DisplayError ResourceDefault::PostCommit(Handle display_ctx, HWLayers *hw_layers) {
SCOPE_LOCK(locker_);
DisplayResourceContext *display_resource_ctx =
diff --git a/msmcobalt/sdm/libs/core/resource_default.h b/msm8998/sdm/libs/core/resource_default.h
similarity index 93%
rename from msmcobalt/sdm/libs/core/resource_default.h
rename to msm8998/sdm/libs/core/resource_default.h
index 79e7dcd..9f08155 100644
--- a/msmcobalt/sdm/libs/core/resource_default.h
+++ b/msm8998/sdm/libs/core/resource_default.h
@@ -36,8 +36,9 @@
class ResourceDefault : public ResourceInterface {
public:
- DisplayError Init(const HWResourceInfo &hw_resource_info);
- DisplayError Deinit();
+ static DisplayError CreateResourceDefault(const HWResourceInfo &hw_resource_info,
+ ResourceInterface **resource_intf);
+ static DisplayError DestroyResourceDefault(ResourceInterface *resource_intf);
virtual DisplayError RegisterDisplay(DisplayType type,
const HWDisplayAttributes &display_attributes,
const HWPanelInfo &hw_panel_info,
@@ -50,8 +51,9 @@
const HWMixerAttributes &mixer_attributes);
virtual DisplayError Start(Handle display_ctx);
virtual DisplayError Stop(Handle display_ctx);
- virtual DisplayError Acquire(Handle display_ctx, HWLayers *hw_layers);
+ virtual DisplayError Prepare(Handle display_ctx, HWLayers *hw_layers);
virtual DisplayError PostPrepare(Handle display_ctx, HWLayers *hw_layers);
+ virtual DisplayError Commit(Handle display_ctx, HWLayers *hw_layers);
virtual DisplayError PostCommit(Handle display_ctx, HWLayers *hw_layers);
virtual void Purge(Handle display_ctx);
virtual DisplayError SetMaxMixerStages(Handle display_ctx, uint32_t max_mixer_stages);
@@ -102,6 +104,9 @@
HWBlockContext() : is_in_use(false) { }
};
+ explicit ResourceDefault(const HWResourceInfo &hw_res_info);
+ DisplayError Init();
+ DisplayError Deinit();
uint32_t NextPipe(PipeType pipe_type, HWBlockType hw_block_id);
uint32_t SearchPipe(HWBlockType hw_block_id, SourcePipe *src_pipes, uint32_t num_pipe);
uint32_t GetPipe(HWBlockType hw_block_id, bool need_scale);
diff --git a/msmcobalt/sdm/libs/core/strategy.cpp b/msm8998/sdm/libs/core/strategy.cpp
similarity index 66%
rename from msmcobalt/sdm/libs/core/strategy.cpp
rename to msm8998/sdm/libs/core/strategy.cpp
index 7a983e5..106e9e1 100644
--- a/msmcobalt/sdm/libs/core/strategy.cpp
+++ b/msm8998/sdm/libs/core/strategy.cpp
@@ -26,6 +26,7 @@
#include <utils/debug.h>
#include "strategy.h"
+#include "utils/rect.h"
#define __CLASS__ "Strategy"
@@ -45,9 +46,8 @@
DisplayError error = kErrorNone;
if (extension_intf_) {
- error = extension_intf_->CreateStrategyExtn(display_type_, hw_panel_info_.mode,
- hw_panel_info_.s3d_mode, mixer_attributes_,
- fb_config_, &strategy_intf_);
+ error = extension_intf_->CreateStrategyExtn(display_type_, hw_resource_info_, hw_panel_info_,
+ mixer_attributes_, fb_config_, &strategy_intf_);
if (error != kErrorNone) {
DLOGE("Failed to create strategy");
return error;
@@ -74,15 +74,20 @@
}
DisplayError Strategy::Start(HWLayersInfo *hw_layers_info, uint32_t *max_attempts,
- bool partial_update_enable) {
+ const PUConstraints &pu_constraints) {
DisplayError error = kErrorNone;
hw_layers_info_ = hw_layers_info;
extn_start_success_ = false;
tried_default_ = false;
+ if (!disable_gpu_comp_ && !hw_layers_info_->gpu_target_index) {
+ DLOGE("GPU composition is enabled and GPU target buffer not provided.");
+ return kErrorNotSupported;
+ }
+
if (partial_update_intf_) {
- partial_update_intf_->ControlPartialUpdate(partial_update_enable);
+ partial_update_intf_->Start(pu_constraints);
}
GenerateROI();
@@ -117,8 +122,8 @@
}
}
- // Default composition is not possible if GPU composition is not supported.
- if (!hw_layers_info_->gpu_target_index) {
+ // Do not fallback to GPU if GPU comp is disabled.
+ if (disable_gpu_comp_) {
return kErrorNotSupported;
}
@@ -130,17 +135,30 @@
// Mark all application layers for GPU composition. Find GPU target buffer and store its index for
// programming the hardware.
LayerStack *layer_stack = hw_layers_info_->stack;
- uint32_t &hw_layer_count = hw_layers_info_->count;
- hw_layer_count = 0;
-
for (uint32_t i = 0; i < hw_layers_info_->app_layer_count; i++) {
layer_stack->layers.at(i)->composition = kCompositionGPU;
}
- Layer *gpu_target_layer = layer_stack->layers.at(hw_layers_info_->gpu_target_index);
- hw_layers_info_->updated_src_rect[hw_layer_count] = gpu_target_layer->src_rect;
- hw_layers_info_->updated_dst_rect[hw_layer_count] = gpu_target_layer->dst_rect;
- hw_layers_info_->index[hw_layer_count++] = hw_layers_info_->gpu_target_index;
+ if (!extn_start_success_) {
+ // When mixer resolution and panel resolutions are same (1600x2560) and FB resolution is
+ // 1080x1920 FB_Target destination coordinates(mapped to FB resolution 1080x1920) need to
+ // be mapped to destination coordinates of mixer resolution(1600x2560).
+ hw_layers_info_->count = 0;
+ uint32_t &hw_layer_count = hw_layers_info_->count;
+ Layer *gpu_target_layer = layer_stack->layers.at(hw_layers_info_->gpu_target_index);
+ float layer_mixer_width = FLOAT(mixer_attributes_.width);
+ float layer_mixer_height = FLOAT(mixer_attributes_.height);
+ float fb_width = FLOAT(fb_config_.x_pixels);
+ float fb_height = FLOAT(fb_config_.y_pixels);
+ LayerRect src_domain = (LayerRect){0.0f, 0.0f, fb_width, fb_height};
+ LayerRect dst_domain = (LayerRect){0.0f, 0.0f, layer_mixer_width, layer_mixer_height};
+
+ hw_layers_info_->updated_src_rect[hw_layer_count] = gpu_target_layer->src_rect;
+ MapRect(src_domain, dst_domain, gpu_target_layer->dst_rect,
+ &hw_layers_info_->updated_dst_rect[hw_layer_count]);
+
+ hw_layers_info_->index[hw_layer_count++] = hw_layers_info_->gpu_target_index;
+ }
tried_default_ = true;
@@ -163,15 +181,19 @@
split_display = true;
}
+ hw_layers_info_->left_frame_roi = {};
+ hw_layers_info_->right_frame_roi = {};
+
if (split_display) {
float left_split = FLOAT(mixer_attributes_.split_left);
- hw_layers_info_->left_partial_update = (LayerRect) {0.0f, 0.0f, left_split, layer_mixer_height};
- hw_layers_info_->right_partial_update = (LayerRect) {left_split, 0.0f, layer_mixer_width,
- layer_mixer_height};
+ hw_layers_info_->left_frame_roi.push_back(LayerRect(0.0f, 0.0f,
+ left_split, layer_mixer_height));
+ hw_layers_info_->right_frame_roi.push_back(LayerRect(left_split,
+ 0.0f, layer_mixer_width, layer_mixer_height));
} else {
- hw_layers_info_->left_partial_update = (LayerRect) {0.0f, 0.0f, layer_mixer_width,
- layer_mixer_height};
- hw_layers_info_->right_partial_update = (LayerRect) {0.0f, 0.0f, 0.0f, 0.0f};
+ hw_layers_info_->left_frame_roi.push_back(LayerRect(0.0f, 0.0f,
+ layer_mixer_width, layer_mixer_height));
+ hw_layers_info_->right_frame_roi.push_back(LayerRect(0.0f, 0.0f, 0.0f, 0.0f));
}
}
@@ -179,9 +201,7 @@
const HWDisplayAttributes &display_attributes,
const HWMixerAttributes &mixer_attributes,
const DisplayConfigVariableInfo &fb_config) {
- hw_panel_info_ = hw_panel_info;
- display_attributes_ = display_attributes;
- mixer_attributes_ = mixer_attributes;
+ DisplayError error = kErrorNone;
if (!extension_intf_) {
return kErrorNone;
@@ -194,12 +214,36 @@
partial_update_intf_ = NULL;
}
- extension_intf_->CreatePartialUpdate(display_type_, hw_resource_info_, hw_panel_info_,
- mixer_attributes_, display_attributes_,
+ extension_intf_->CreatePartialUpdate(display_type_, hw_resource_info_, hw_panel_info,
+ mixer_attributes, display_attributes,
&partial_update_intf_);
- return strategy_intf_->Reconfigure(hw_panel_info_.mode, hw_panel_info_.s3d_mode, mixer_attributes,
- fb_config);
+ error = strategy_intf_->Reconfigure(hw_panel_info, hw_resource_info_, mixer_attributes,
+ fb_config);
+ if (error != kErrorNone) {
+ return error;
+ }
+
+ hw_panel_info_ = hw_panel_info;
+ display_attributes_ = display_attributes;
+ mixer_attributes_ = mixer_attributes;
+ fb_config_ = fb_config;
+
+ return kErrorNone;
+}
+
+DisplayError Strategy::SetCompositionState(LayerComposition composition_type, bool enable) {
+ DLOGI("composition type = %d, enable = %d", composition_type, enable);
+
+ if (composition_type == kCompositionGPU) {
+ disable_gpu_comp_ = !enable;
+ }
+
+ if (strategy_intf_) {
+ return strategy_intf_->SetCompositionState(composition_type, enable);
+ }
+
+ return kErrorNone;
}
} // namespace sdm
diff --git a/msmcobalt/sdm/libs/core/strategy.h b/msm8998/sdm/libs/core/strategy.h
similarity index 94%
rename from msmcobalt/sdm/libs/core/strategy.h
rename to msm8998/sdm/libs/core/strategy.h
index 8b4b6f4..3fadd0d 100644
--- a/msmcobalt/sdm/libs/core/strategy.h
+++ b/msm8998/sdm/libs/core/strategy.h
@@ -41,13 +41,14 @@
DisplayError Deinit();
DisplayError Start(HWLayersInfo *hw_layers_info, uint32_t *max_attempts,
- bool partial_update_enable);
+ const PUConstraints &pu_constraints);
DisplayError GetNextStrategy(StrategyConstraints *constraints);
DisplayError Stop();
DisplayError Reconfigure(const HWPanelInfo &hw_panel_info,
const HWDisplayAttributes &hw_display_attributes,
const HWMixerAttributes &mixer_attributes,
const DisplayConfigVariableInfo &fb_config);
+ DisplayError SetCompositionState(LayerComposition composition_type, bool enable);
private:
void GenerateROI();
@@ -64,6 +65,7 @@
DisplayConfigVariableInfo fb_config_ = {};
bool extn_start_success_ = false;
bool tried_default_ = false;
+ bool disable_gpu_comp_ = false;
};
} // namespace sdm
diff --git a/msmcobalt/sdm/libs/hwc/Android.mk b/msm8998/sdm/libs/hwc/Android.mk
similarity index 100%
rename from msmcobalt/sdm/libs/hwc/Android.mk
rename to msm8998/sdm/libs/hwc/Android.mk
diff --git a/msmcobalt/sdm/libs/hwc/blit_engine.h b/msm8998/sdm/libs/hwc/blit_engine.h
similarity index 100%
rename from msmcobalt/sdm/libs/hwc/blit_engine.h
rename to msm8998/sdm/libs/hwc/blit_engine.h
diff --git a/msmcobalt/sdm/libs/hwc/blit_engine_c2d.cpp b/msm8998/sdm/libs/hwc/blit_engine_c2d.cpp
similarity index 94%
rename from msmcobalt/sdm/libs/hwc/blit_engine_c2d.cpp
rename to msm8998/sdm/libs/hwc/blit_engine_c2d.cpp
index 3ead9b7..e5cf81c 100644
--- a/msmcobalt/sdm/libs/hwc/blit_engine_c2d.cpp
+++ b/msm8998/sdm/libs/hwc/blit_engine_c2d.cpp
@@ -282,8 +282,8 @@
num_blit_target_ = layer_count - blit_target_start_index_;
LayerBuffer *layer_buffer = layer_stack->layers.at(gpu_target_index)->input_buffer;
- int fbwidth = INT(layer_buffer->width);
- int fbheight = INT(layer_buffer->height);
+ int fbwidth = INT(layer_buffer->unaligned_width);
+ int fbheight = INT(layer_buffer->unaligned_height);
if ((fbwidth < 0) || (fbheight < 0)) {
return -1;
}
@@ -294,10 +294,16 @@
for (uint32_t j = 0; j < num_blit_target_; j++, k++) {
Layer *layer = layer_stack->layers.at(k);
LayerBuffer *layer_buffer = layer->input_buffer;
+ int aligned_w = 0;
+ int aligned_h = 0;
// Set the buffer height and width
- layer_buffer->width = fbwidth;
- layer_buffer->height = fbheight/3;
+ AdrenoMemInfo::getInstance().getAlignedWidthAndHeight(fbwidth, fbheight/3,
+ INT(HAL_PIXEL_FORMAT_RGBA_8888), 0, aligned_w, aligned_h);
+ layer_buffer->width = aligned_w;
+ layer_buffer->height = aligned_h;
+ layer_buffer->unaligned_width = fbwidth;
+ layer_buffer->unaligned_height = fbheight/3;
layer->plane_alpha = 0xFF;
layer->blending = kBlendingOpaque;
@@ -313,6 +319,8 @@
uint32_t num_app_layers = (uint32_t) content_list->numHwLayers-1;
int target_width = 0;
int target_height = 0;
+ int target_aligned_width = 0;
+ int target_aligned_height = 0;
uint32_t processed_blit = 0;
LayerRect dst_rects[kMaxBlitTargetLayers];
bool blit_needed = false;
@@ -334,19 +342,24 @@
LayerRect &blit_src_rect = blit_layer->src_rect;
int width = INT(layer->dst_rect.right - layer->dst_rect.left);
int height = INT(layer->dst_rect.bottom - layer->dst_rect.top);
+ int aligned_w = 0;
+ int aligned_h = 0;
usage = GRALLOC_USAGE_PRIVATE_IOMMU_HEAP | GRALLOC_USAGE_HW_TEXTURE;
if (blit_engine_c2d_->get(blit_engine_c2d_, COPYBIT_UBWC_SUPPORT) > 0) {
usage |= GRALLOC_USAGE_PRIVATE_ALLOC_UBWC;
}
// TODO(user): FrameBuffer is assumed to be RGBA
- AdrenoMemInfo::getInstance().getAlignedWidthAndHeight(width, height,
- INT(HAL_PIXEL_FORMAT_RGBA_8888), usage, width, height);
-
target_width = std::max(target_width, width);
target_height += height;
+ AdrenoMemInfo::getInstance().getAlignedWidthAndHeight(width, height,
+ INT(HAL_PIXEL_FORMAT_RGBA_8888), usage, aligned_w, aligned_h);
+
+ target_aligned_width = std::max(target_aligned_width, aligned_w);
+ target_aligned_height += aligned_h;
+
// Left will be zero always
- dst_rects[processed_blit].top = FLOAT(target_height - height);
+ dst_rects[processed_blit].top = FLOAT(target_aligned_height - aligned_h);
dst_rects[processed_blit].right = dst_rects[processed_blit].left +
(layer->dst_rect.right - layer->dst_rect.left);
dst_rects[processed_blit].bottom = (dst_rects[processed_blit].top +
@@ -367,8 +380,10 @@
Layer *layer = layer_stack->layers.at(j + content_list->numHwLayers);
private_handle_t *target_buffer = blit_target_buffer_[current_blit_target_index_];
// Set the fd information
- layer->input_buffer->width = target_width;
- layer->input_buffer->height = target_height;
+ layer->input_buffer->width = target_aligned_width;
+ layer->input_buffer->height = target_aligned_height;
+ layer->input_buffer->unaligned_width = target_width;
+ layer->input_buffer->unaligned_height = target_height;
if (target_buffer->flags & private_handle_t::PRIV_FLAGS_UBWC_ALIGNED) {
layer->input_buffer->format = kFormatRGBA8888Ubwc;
}
diff --git a/msmcobalt/sdm/libs/hwc/blit_engine_c2d.h b/msm8998/sdm/libs/hwc/blit_engine_c2d.h
similarity index 100%
rename from msmcobalt/sdm/libs/hwc/blit_engine_c2d.h
rename to msm8998/sdm/libs/hwc/blit_engine_c2d.h
diff --git a/msmcobalt/sdm/libs/hwc/cpuhint.cpp b/msm8998/sdm/libs/hwc/cpuhint.cpp
similarity index 100%
rename from msmcobalt/sdm/libs/hwc/cpuhint.cpp
rename to msm8998/sdm/libs/hwc/cpuhint.cpp
diff --git a/msmcobalt/sdm/libs/hwc/cpuhint.h b/msm8998/sdm/libs/hwc/cpuhint.h
similarity index 100%
rename from msmcobalt/sdm/libs/hwc/cpuhint.h
rename to msm8998/sdm/libs/hwc/cpuhint.h
diff --git a/msmcobalt/sdm/libs/hwc/hwc_buffer_allocator.cpp b/msm8998/sdm/libs/hwc/hwc_buffer_allocator.cpp
similarity index 92%
rename from msmcobalt/sdm/libs/hwc/hwc_buffer_allocator.cpp
rename to msm8998/sdm/libs/hwc/hwc_buffer_allocator.cpp
index 0092402..906b96d 100644
--- a/msmcobalt/sdm/libs/hwc/hwc_buffer_allocator.cpp
+++ b/msm8998/sdm/libs/hwc/hwc_buffer_allocator.cpp
@@ -64,7 +64,11 @@
int height = INT(buffer_config.height);
int format;
- if (buffer_config.secure) {
+ if (buffer_config.secure_camera) {
+ alloc_flags = GRALLOC_USAGE_HW_CAMERA_WRITE;
+ alloc_flags |= (GRALLOC_USAGE_PROTECTED | GRALLOC_USAGE_HW_COMPOSER);
+ data.align = SZ_2M;
+ } else if (buffer_config.secure) {
alloc_flags = INT(GRALLOC_USAGE_PRIVATE_MM_HEAP);
alloc_flags |= INT(GRALLOC_USAGE_PROTECTED);
data.align = SECURE_ALIGN;
@@ -103,7 +107,10 @@
}
alloc_buffer_info->fd = data.fd;
+ // TODO(user): define stride for all planes and fix stride in bytes
alloc_buffer_info->stride = UINT32(aligned_width);
+ alloc_buffer_info->aligned_width = UINT32(aligned_width);
+ alloc_buffer_info->aligned_height = UINT32(aligned_height);
alloc_buffer_info->size = buffer_size;
meta_buffer_info->base_addr = data.base;
@@ -138,6 +145,8 @@
alloc_buffer_info->fd = -1;
alloc_buffer_info->stride = 0;
+ alloc_buffer_info->aligned_width = 0;
+ alloc_buffer_info->aligned_height = 0;
alloc_buffer_info->size = 0;
meta_buffer_info->base_addr = NULL;
@@ -161,7 +170,11 @@
int height = INT(buffer_config.height);
int format;
- if (buffer_config.secure) {
+ if (buffer_config.secure_camera) {
+ alloc_flags = GRALLOC_USAGE_HW_CAMERA_WRITE;
+ alloc_flags |= (GRALLOC_USAGE_PROTECTED | GRALLOC_USAGE_HW_COMPOSER);
+ align = SZ_2M;
+ } else if (buffer_config.secure) {
alloc_flags = INT(GRALLOC_USAGE_PRIVATE_MM_HEAP);
alloc_flags |= INT(GRALLOC_USAGE_PROTECTED);
align = SECURE_ALIGN;
diff --git a/msmcobalt/sdm/libs/hwc/hwc_buffer_allocator.h b/msm8998/sdm/libs/hwc/hwc_buffer_allocator.h
similarity index 100%
rename from msmcobalt/sdm/libs/hwc/hwc_buffer_allocator.h
rename to msm8998/sdm/libs/hwc/hwc_buffer_allocator.h
diff --git a/msmcobalt/sdm/libs/hwc/hwc_buffer_sync_handler.cpp b/msm8998/sdm/libs/hwc/hwc_buffer_sync_handler.cpp
similarity index 100%
rename from msmcobalt/sdm/libs/hwc/hwc_buffer_sync_handler.cpp
rename to msm8998/sdm/libs/hwc/hwc_buffer_sync_handler.cpp
diff --git a/msmcobalt/sdm/libs/hwc/hwc_buffer_sync_handler.h b/msm8998/sdm/libs/hwc/hwc_buffer_sync_handler.h
similarity index 100%
rename from msmcobalt/sdm/libs/hwc/hwc_buffer_sync_handler.h
rename to msm8998/sdm/libs/hwc/hwc_buffer_sync_handler.h
diff --git a/msmcobalt/sdm/libs/hwc/hwc_color_manager.cpp b/msm8998/sdm/libs/hwc/hwc_color_manager.cpp
similarity index 89%
rename from msmcobalt/sdm/libs/hwc/hwc_color_manager.cpp
rename to msm8998/sdm/libs/hwc/hwc_color_manager.cpp
index acf5f37..7bf49ff 100644
--- a/msmcobalt/sdm/libs/hwc/hwc_color_manager.cpp
+++ b/msm8998/sdm/libs/hwc/hwc_color_manager.cpp
@@ -385,7 +385,7 @@
return -EFAULT;
} else {
frame_capture_data->buffer = reinterpret_cast<uint8_t *>(buffer);
- frame_capture_data->buffer_stride = buffer_info.alloc_buffer_info.stride;
+ frame_capture_data->buffer_stride = buffer_info.buffer_config.width;
frame_capture_data->buffer_size = buffer_info.alloc_buffer_info.size;
}
ret = hwc_display->FrameCaptureAsync(buffer_info, 1);
@@ -423,65 +423,67 @@
DisplayDetailEnhancerData de_data;
PPDETuningCfgData *de_tuning_cfg_data = reinterpret_cast<PPDETuningCfgData*>(params);
- if (!de_tuning_cfg_data->cfg_en) {
- de_data.override_flags = kOverrideDEEnable;
- de_data.enable = 0;
- } else {
- de_data.override_flags = kOverrideDEEnable;
- de_data.enable = 1;
+ if (de_tuning_cfg_data->cfg_pending == true) {
+ if (!de_tuning_cfg_data->cfg_en) {
+ de_data.override_flags = kOverrideDEEnable;
+ de_data.enable = 0;
+ } else {
+ de_data.override_flags = kOverrideDEEnable;
+ de_data.enable = 1;
- if (de_tuning_cfg_data->params.flags & kDeTuningFlagSharpFactor) {
- de_data.override_flags |= kOverrideDEEnable;
- de_data.sharp_factor = de_tuning_cfg_data->params.sharp_factor;
- }
+ if (de_tuning_cfg_data->params.flags & kDeTuningFlagSharpFactor) {
+ de_data.override_flags |= kOverrideDESharpen1;
+ de_data.sharp_factor = de_tuning_cfg_data->params.sharp_factor;
+ }
- if (de_tuning_cfg_data->params.flags & kDeTuningFlagClip) {
- de_data.override_flags |= kOverrideDEEnable;
- de_data.clip = de_tuning_cfg_data->params.clip;
- }
+ if (de_tuning_cfg_data->params.flags & kDeTuningFlagClip) {
+ de_data.override_flags |= kOverrideDEClip;
+ de_data.clip = de_tuning_cfg_data->params.clip;
+ }
- if (de_tuning_cfg_data->params.flags & kDeTuningFlagThrQuiet) {
- de_data.override_flags |= kOverrideDEEnable;
- de_data.thr_quiet = de_tuning_cfg_data->params.thr_quiet;
- }
+ if (de_tuning_cfg_data->params.flags & kDeTuningFlagThrQuiet) {
+ de_data.override_flags |= kOverrideDEThrQuiet;
+ de_data.thr_quiet = de_tuning_cfg_data->params.thr_quiet;
+ }
- if (de_tuning_cfg_data->params.flags & kDeTuningFlagThrDieout) {
- de_data.override_flags |= kOverrideDEEnable;
- de_data.thr_dieout = de_tuning_cfg_data->params.thr_dieout;
- }
+ if (de_tuning_cfg_data->params.flags & kDeTuningFlagThrDieout) {
+ de_data.override_flags |= kOverrideDEThrDieout;
+ de_data.thr_dieout = de_tuning_cfg_data->params.thr_dieout;
+ }
- if (de_tuning_cfg_data->params.flags & kDeTuningFlagThrLow) {
- de_data.override_flags |= kOverrideDEEnable;
- de_data.thr_low = de_tuning_cfg_data->params.thr_low;
- }
+ if (de_tuning_cfg_data->params.flags & kDeTuningFlagThrLow) {
+ de_data.override_flags |= kOverrideDEThrLow;
+ de_data.thr_low = de_tuning_cfg_data->params.thr_low;
+ }
- if (de_tuning_cfg_data->params.flags & kDeTuningFlagThrHigh) {
- de_data.override_flags |= kOverrideDEEnable;
- de_data.thr_high = de_tuning_cfg_data->params.thr_high;
- }
+ if (de_tuning_cfg_data->params.flags & kDeTuningFlagThrHigh) {
+ de_data.override_flags |= kOverrideDEThrHigh;
+ de_data.thr_high = de_tuning_cfg_data->params.thr_high;
+ }
- if (de_tuning_cfg_data->params.flags & kDeTuningFlagContentQualLevel) {
- de_data.override_flags |= kOverrideDEEnable;
- switch (de_tuning_cfg_data->params.quality) {
- case kDeContentQualLow:
- de_data.quality_level = kContentQualityLow;
- break;
- case kDeContentQualMedium:
- de_data.quality_level = kContentQualityMedium;
- break;
- case kDeContentQualHigh:
- de_data.quality_level = kContentQualityHigh;
- break;
- case kDeContentQualUnknown:
- default:
- de_data.quality_level = kContentQualityUnknown;
- break;
+ if (de_tuning_cfg_data->params.flags & kDeTuningFlagContentQualLevel) {
+ switch (de_tuning_cfg_data->params.quality) {
+ case kDeContentQualLow:
+ de_data.quality_level = kContentQualityLow;
+ break;
+ case kDeContentQualMedium:
+ de_data.quality_level = kContentQualityMedium;
+ break;
+ case kDeContentQualHigh:
+ de_data.quality_level = kContentQualityHigh;
+ break;
+ case kDeContentQualUnknown:
+ default:
+ de_data.quality_level = kContentQualityUnknown;
+ break;
+ }
}
}
- }
- err = hwc_display->SetDetailEnhancerConfig(de_data);
- if (err) {
- DLOGW("SetDetailEnhancerConfig failed. err = %d", err);
+ err = hwc_display->SetDetailEnhancerConfig(de_data);
+ if (err) {
+ DLOGW("SetDetailEnhancerConfig failed. err = %d", err);
+ }
+ de_tuning_cfg_data->cfg_pending = false;
}
return err;
diff --git a/msmcobalt/sdm/libs/hwc/hwc_color_manager.h b/msm8998/sdm/libs/hwc/hwc_color_manager.h
similarity index 100%
rename from msmcobalt/sdm/libs/hwc/hwc_color_manager.h
rename to msm8998/sdm/libs/hwc/hwc_color_manager.h
diff --git a/msmcobalt/sdm/libs/hwc/hwc_debugger.cpp b/msm8998/sdm/libs/hwc/hwc_debugger.cpp
similarity index 100%
rename from msmcobalt/sdm/libs/hwc/hwc_debugger.cpp
rename to msm8998/sdm/libs/hwc/hwc_debugger.cpp
diff --git a/msmcobalt/sdm/libs/hwc/hwc_debugger.h b/msm8998/sdm/libs/hwc/hwc_debugger.h
similarity index 100%
rename from msmcobalt/sdm/libs/hwc/hwc_debugger.h
rename to msm8998/sdm/libs/hwc/hwc_debugger.h
diff --git a/msmcobalt/sdm/libs/hwc/hwc_display.cpp b/msm8998/sdm/libs/hwc/hwc_display.cpp
similarity index 95%
rename from msmcobalt/sdm/libs/hwc/hwc_display.cpp
rename to msm8998/sdm/libs/hwc/hwc_display.cpp
index b40884e..3327ed9 100644
--- a/msmcobalt/sdm/libs/hwc/hwc_display.cpp
+++ b/msm8998/sdm/libs/hwc/hwc_display.cpp
@@ -346,8 +346,18 @@
if (pvt_handle) {
layer_buffer->format = GetSDMFormat(pvt_handle->format, pvt_handle->flags);
- layer_buffer->width = UINT32(pvt_handle->width);
- layer_buffer->height = UINT32(pvt_handle->height);
+ int aligned_width, aligned_height;
+ int unaligned_width, unaligned_height;
+
+ AdrenoMemInfo::getInstance().getAlignedWidthAndHeight(pvt_handle, aligned_width,
+ aligned_height);
+ AdrenoMemInfo::getInstance().getUnalignedWidthAndHeight(pvt_handle, unaligned_width,
+ unaligned_height);
+
+ layer_buffer->width = UINT32(aligned_width);
+ layer_buffer->height = UINT32(aligned_height);
+ layer_buffer->unaligned_width = UINT32(unaligned_width);
+ layer_buffer->unaligned_height = UINT32(unaligned_height);
if (SetMetaData(pvt_handle, layer) != kErrorNone) {
return -EINVAL;
@@ -361,6 +371,9 @@
if (pvt_handle->flags & private_handle_t::PRIV_FLAGS_SECURE_BUFFER) {
layer_stack_.flags.secure_present = true;
layer_buffer->flags.secure = true;
+ if (pvt_handle->flags & private_handle_t::PRIV_FLAGS_CAMERA_WRITE) {
+ layer_buffer->flags.secure_camera = true;
+ }
}
// Gralloc Usage Protected Buffer - L3 - which needs to be treated as Secure & avoid fallback
if (pvt_handle->flags & private_handle_t::PRIV_FLAGS_PROTECTED_BUFFER) {
@@ -398,6 +411,8 @@
usage, aligned_width, aligned_height);
layer_buffer->width = UINT32(aligned_width);
layer_buffer->height = UINT32(aligned_height);
+ layer_buffer->unaligned_width = x_pixels;
+ layer_buffer->unaligned_height = y_pixels;
layer_buffer->format = GetSDMFormat(format, flags);
}
}
@@ -439,6 +454,7 @@
for (size_t i = 0; i < num_hw_layers; i++) {
hwc_layer_1_t &hwc_layer = content_list->hwLayers[i];
+ const private_handle_t *pvt_handle = static_cast<const private_handle_t *>(hwc_layer.handle);
Layer *layer = layer_stack_.layers.at(i);
int ret = PrepareLayerParams(&content_list->hwLayers[i], layer);
@@ -456,6 +472,15 @@
ApplyScanAdjustment(&scaled_display_frame);
SetRect(scaled_display_frame, &layer->dst_rect);
+ if (pvt_handle) {
+ bool NonIntegralSourceCrop = IsNonIntegralSourceCrop(hwc_layer.sourceCropf);
+ bool secure = (pvt_handle->flags & private_handle_t::PRIV_FLAGS_SECURE_BUFFER) ||
+ (pvt_handle->flags & private_handle_t::PRIV_FLAGS_PROTECTED_BUFFER) ||
+ (pvt_handle->flags & private_handle_t::PRIV_FLAGS_SECURE_DISPLAY);
+ if (NonIntegralSourceCrop && !secure) {
+ layer->flags.skip = true;
+ }
+ }
SetRect(hwc_layer.sourceCropf, &layer->src_rect);
ApplyDeInterlaceAdjustment(layer);
@@ -522,6 +547,8 @@
LayerBuffer *input_buffer = layer->input_buffer;
input_buffer->width = UINT32(layer->dst_rect.right - layer->dst_rect.left);
input_buffer->height = UINT32(layer->dst_rect.bottom - layer->dst_rect.top);
+ input_buffer->unaligned_width = input_buffer->width;
+ input_buffer->unaligned_height = input_buffer->height;
layer->src_rect.left = 0;
layer->src_rect.top = 0;
layer->src_rect.right = input_buffer->width;
@@ -594,7 +621,7 @@
size_t num_hw_layers = content_list->numHwLayers;
- if (!skip_prepare_) {
+ if (!skip_prepare_cnt) {
DisplayError error = display_intf_->Prepare(&layer_stack_);
if (error != kErrorNone) {
if (error == kErrorShutDown) {
@@ -612,7 +639,7 @@
} else {
// Skip is not set
MarkLayersForGPUBypass(content_list);
- skip_prepare_ = false;
+ skip_prepare_cnt = skip_prepare_cnt - 1;
DLOGI("SecureDisplay %s, Skip Prepare/Commit and Flush", secure_display_active_ ? "Starting" :
"Stopping");
flush_ = true;
@@ -782,6 +809,17 @@
(layer_stack_.flags.geometry_changed));
}
+bool HWCDisplay::IsNonIntegralSourceCrop(const hwc_frect_t &source) {
+ if ((source.left != roundf(source.left)) ||
+ (source.top != roundf(source.top)) ||
+ (source.right != roundf(source.right)) ||
+ (source.bottom != roundf(source.bottom))) {
+ return true;
+ } else {
+ return false;
+ }
+}
+
void HWCDisplay::SetRect(const hwc_rect_t &source, LayerRect *target) {
target->left = FLOAT(source.left);
target->top = FLOAT(source.top);
@@ -1245,14 +1283,6 @@
layer_buffer->format = GetSDMFormat(INT32(meta_data->linearFormat), 0);
}
- if (meta_data->operation & UPDATE_BUFFER_GEOMETRY) {
- int actual_width = pvt_handle->width;
- int actual_height = pvt_handle->height;
- AdrenoMemInfo::getInstance().getAlignedWidthAndHeight(pvt_handle, actual_width, actual_height);
- layer_buffer->width = UINT32(actual_width);
- layer_buffer->height = UINT32(actual_height);
- }
-
if (meta_data->operation & SET_SINGLE_BUFFER_MODE) {
layer->flags.single_buffer = meta_data->isSingleBufferMode;
// Graphics can set this operation on all types of layers including FB and set the actual value
@@ -1322,7 +1352,7 @@
return 0;
}
-void HWCDisplay::SetSecureDisplay(bool secure_display_active) {
+void HWCDisplay::SetSecureDisplay(bool secure_display_active, bool force_flush) {
secure_display_active_ = secure_display_active;
return;
}
diff --git a/msmcobalt/sdm/libs/hwc/hwc_display.h b/msm8998/sdm/libs/hwc/hwc_display.h
similarity index 97%
rename from msmcobalt/sdm/libs/hwc/hwc_display.h
rename to msm8998/sdm/libs/hwc/hwc_display.h
index 5b59fb8..7dab6d5 100644
--- a/msmcobalt/sdm/libs/hwc/hwc_display.h
+++ b/msm8998/sdm/libs/hwc/hwc_display.h
@@ -85,7 +85,7 @@
virtual int OnMinHdcpEncryptionLevelChange(uint32_t min_enc_level);
virtual int Perform(uint32_t operation, ...);
virtual int SetCursorPosition(int x, int y);
- virtual void SetSecureDisplay(bool secure_display_active);
+ virtual void SetSecureDisplay(bool secure_display_active, bool force_flush);
virtual DisplayError SetMixerResolution(uint32_t width, uint32_t height);
virtual DisplayError GetMixerResolution(uint32_t *width, uint32_t *height);
virtual void GetPanelResolution(uint32_t *width, uint32_t *height);
@@ -175,6 +175,7 @@
DisplayError SetMetaData(const private_handle_t *pvt_handle, Layer *layer);
bool NeedsFrameBufferRefresh(hwc_display_contents_1_t *content_list);
bool IsLayerUpdating(hwc_display_contents_1_t *content_list, const Layer *layer);
+ bool IsNonIntegralSourceCrop(const hwc_frect_t &source);
uint32_t GetUpdatingLayersCount(uint32_t app_layer_count);
bool SingleVideoLayerUpdating(uint32_t app_layer_count);
bool IsSurfaceUpdated(const std::vector<LayerRect> &dirty_regions);
@@ -209,7 +210,7 @@
bool shutdown_pending_ = false;
bool use_blit_comp_ = false;
bool secure_display_active_ = false;
- bool skip_prepare_ = false;
+ uint32_t skip_prepare_cnt = 0;
bool solid_fill_enable_ = false;
bool disable_animation_ = false;
uint32_t solid_fill_color_ = 0;
diff --git a/msmcobalt/sdm/libs/hwc/hwc_display_external.cpp b/msm8998/sdm/libs/hwc/hwc_display_external.cpp
similarity index 99%
rename from msmcobalt/sdm/libs/hwc/hwc_display_external.cpp
rename to msm8998/sdm/libs/hwc/hwc_display_external.cpp
index ed916d4..8a3a591 100644
--- a/msmcobalt/sdm/libs/hwc/hwc_display_external.cpp
+++ b/msm8998/sdm/libs/hwc/hwc_display_external.cpp
@@ -214,7 +214,7 @@
+ y_offset;
}
-void HWCDisplayExternal::SetSecureDisplay(bool secure_display_active) {
+void HWCDisplayExternal::SetSecureDisplay(bool secure_display_active, bool force_flush) {
if (secure_display_active_ != secure_display_active) {
secure_display_active_ = secure_display_active;
diff --git a/msmcobalt/sdm/libs/hwc/hwc_display_external.h b/msm8998/sdm/libs/hwc/hwc_display_external.h
similarity index 97%
rename from msmcobalt/sdm/libs/hwc/hwc_display_external.h
rename to msm8998/sdm/libs/hwc/hwc_display_external.h
index ac70489..c5ac3d7 100644
--- a/msmcobalt/sdm/libs/hwc/hwc_display_external.h
+++ b/msm8998/sdm/libs/hwc/hwc_display_external.h
@@ -39,7 +39,7 @@
static void Destroy(HWCDisplay *hwc_display);
virtual int Prepare(hwc_display_contents_1_t *content_list);
virtual int Commit(hwc_display_contents_1_t *content_list);
- virtual void SetSecureDisplay(bool secure_display_active);
+ virtual void SetSecureDisplay(bool secure_display_active, bool force_flush);
virtual int Perform(uint32_t operation, ...);
protected:
diff --git a/msmcobalt/sdm/libs/hwc/hwc_display_null.cpp b/msm8998/sdm/libs/hwc/hwc_display_null.cpp
similarity index 100%
rename from msmcobalt/sdm/libs/hwc/hwc_display_null.cpp
rename to msm8998/sdm/libs/hwc/hwc_display_null.cpp
diff --git a/msmcobalt/sdm/libs/hwc/hwc_display_null.h b/msm8998/sdm/libs/hwc/hwc_display_null.h
similarity index 97%
rename from msmcobalt/sdm/libs/hwc/hwc_display_null.h
rename to msm8998/sdm/libs/hwc/hwc_display_null.h
index 297e870..f1e0e5e 100644
--- a/msmcobalt/sdm/libs/hwc/hwc_display_null.h
+++ b/msm8998/sdm/libs/hwc/hwc_display_null.h
@@ -74,7 +74,7 @@
virtual int OnMinHdcpEncryptionLevelChange(uint32_t min_enc_level) { return 0; }
virtual int Perform(uint32_t operation, ...) { return 0; }
virtual int SetCursorPosition(int x, int y) { return 0; }
- virtual void SetSecureDisplay(bool secure_display_active) { return; }
+ virtual void SetSecureDisplay(bool secure_display_active, bool force_flush) { return; }
// Display Configurations
virtual int SetActiveDisplayConfig(int config) { return 0; }
diff --git a/msmcobalt/sdm/libs/hwc/hwc_display_primary.cpp b/msm8998/sdm/libs/hwc/hwc_display_primary.cpp
similarity index 91%
rename from msmcobalt/sdm/libs/hwc/hwc_display_primary.cpp
rename to msm8998/sdm/libs/hwc/hwc_display_primary.cpp
index 50805d4..51402d7 100644
--- a/msmcobalt/sdm/libs/hwc/hwc_display_primary.cpp
+++ b/msm8998/sdm/libs/hwc/hwc_display_primary.cpp
@@ -34,6 +34,7 @@
#include <stdarg.h>
#include <sys/mman.h>
+#include <gr.h>
#include "hwc_display_primary.h"
#include "hwc_debugger.h"
@@ -296,15 +297,33 @@
}
}
-void HWCDisplayPrimary::SetSecureDisplay(bool secure_display_active) {
+void HWCDisplayPrimary::SetSecureDisplay(bool secure_display_active, bool force_flush) {
if (secure_display_active_ != secure_display_active) {
// Skip Prepare and call Flush for null commit
DLOGI("SecureDisplay state changed from %d to %d Needs Flush!!", secure_display_active_,
secure_display_active);
secure_display_active_ = secure_display_active;
- skip_prepare_ = true;
+ skip_prepare_cnt = 1;
+
+ // Issue two null commits for command mode panels when external displays are connected.
+ // Two null commits are required to handle non secure to secure transitions at 30fps.
+ // TODO(user): Need two null commits on video mode also to handle transition cases of
+ // primary at higher fps (ex60) and external at lower fps.
+
+ // Avoid flush for command mode panels when no external displays are connected.
+ // This is to avoid flicker/blink on primary during transitions.
+ DisplayConfigFixedInfo display_config;
+ display_intf_->GetConfig(&display_config);
+ if (display_config.is_cmdmode) {
+ if (force_flush) {
+ DLOGI("Issue two null commits for command mode panels");
+ skip_prepare_cnt = 2;
+ } else {
+ DLOGI("Avoid flush for command mode panel when no external displays are connected");
+ skip_prepare_cnt = 0;
+ }
+ }
}
- return;
}
void HWCDisplayPrimary::ForceRefreshRate(uint32_t refresh_rate) {
@@ -353,11 +372,16 @@
}
static void SetLayerBuffer(const BufferInfo& output_buffer_info, LayerBuffer *output_buffer) {
- output_buffer->width = output_buffer_info.buffer_config.width;
- output_buffer->height = output_buffer_info.buffer_config.height;
- output_buffer->format = output_buffer_info.buffer_config.format;
- output_buffer->planes[0].fd = output_buffer_info.alloc_buffer_info.fd;
- output_buffer->planes[0].stride = output_buffer_info.alloc_buffer_info.stride;
+ const BufferConfig& buffer_config = output_buffer_info.buffer_config;
+ const AllocatedBufferInfo &alloc_buffer_info = output_buffer_info.alloc_buffer_info;
+
+ output_buffer->width = alloc_buffer_info.aligned_width;
+ output_buffer->height = alloc_buffer_info.aligned_height;
+ output_buffer->unaligned_width = buffer_config.width;
+ output_buffer->unaligned_height = buffer_config.height;
+ output_buffer->format = buffer_config.format;
+ output_buffer->planes[0].fd = alloc_buffer_info.fd;
+ output_buffer->planes[0].stride = alloc_buffer_info.stride;
}
void HWCDisplayPrimary::HandleFrameOutput() {
diff --git a/msmcobalt/sdm/libs/hwc/hwc_display_primary.h b/msm8998/sdm/libs/hwc/hwc_display_primary.h
similarity index 97%
rename from msmcobalt/sdm/libs/hwc/hwc_display_primary.h
rename to msm8998/sdm/libs/hwc/hwc_display_primary.h
index 901d856..07f6c55 100644
--- a/msmcobalt/sdm/libs/hwc/hwc_display_primary.h
+++ b/msm8998/sdm/libs/hwc/hwc_display_primary.h
@@ -40,7 +40,7 @@
virtual int Prepare(hwc_display_contents_1_t *content_list);
virtual int Commit(hwc_display_contents_1_t *content_list);
virtual int Perform(uint32_t operation, ...);
- virtual void SetSecureDisplay(bool secure_display_active);
+ virtual void SetSecureDisplay(bool secure_display_active, bool force_flush);
virtual DisplayError Refresh();
virtual void SetIdleTimeoutMs(uint32_t timeout_ms);
virtual void SetFrameDumpConfig(uint32_t count, uint32_t bit_mask_layer_type);
diff --git a/msmcobalt/sdm/libs/hwc/hwc_display_virtual.cpp b/msm8998/sdm/libs/hwc/hwc_display_virtual.cpp
similarity index 94%
rename from msmcobalt/sdm/libs/hwc/hwc_display_virtual.cpp
rename to msm8998/sdm/libs/hwc/hwc_display_virtual.cpp
index 25cd6fc..a4d343b 100644
--- a/msmcobalt/sdm/libs/hwc/hwc_display_virtual.cpp
+++ b/msm8998/sdm/libs/hwc/hwc_display_virtual.cpp
@@ -277,12 +277,18 @@
return -EINVAL;
}
- int output_buffer_width, output_buffer_height;
- AdrenoMemInfo::getInstance().getAlignedWidthAndHeight(output_handle, output_buffer_width,
- output_buffer_height);
+ int aligned_width, aligned_height;
+ int unaligned_width, unaligned_height;
- output_buffer_->width = UINT32(output_buffer_width);
- output_buffer_->height = UINT32(output_buffer_height);
+ AdrenoMemInfo::getInstance().getAlignedWidthAndHeight(output_handle, aligned_width,
+ aligned_height);
+ AdrenoMemInfo::getInstance().getUnalignedWidthAndHeight(output_handle, unaligned_width,
+ unaligned_height);
+
+ output_buffer_->width = UINT32(aligned_width);
+ output_buffer_->height = UINT32(aligned_height);
+ output_buffer_->unaligned_width = UINT32(unaligned_width);
+ output_buffer_->unaligned_height = UINT32(unaligned_height);
output_buffer_->flags.secure = 0;
output_buffer_->flags.video = 0;
diff --git a/msmcobalt/sdm/libs/hwc/hwc_display_virtual.h b/msm8998/sdm/libs/hwc/hwc_display_virtual.h
similarity index 100%
rename from msmcobalt/sdm/libs/hwc/hwc_display_virtual.h
rename to msm8998/sdm/libs/hwc/hwc_display_virtual.h
diff --git a/msmcobalt/sdm/libs/hwc/hwc_session.cpp b/msm8998/sdm/libs/hwc/hwc_session.cpp
similarity index 96%
rename from msmcobalt/sdm/libs/hwc/hwc_session.cpp
rename to msm8998/sdm/libs/hwc/hwc_session.cpp
index 5cdf7a7..cc8dc05 100644
--- a/msmcobalt/sdm/libs/hwc/hwc_session.cpp
+++ b/msm8998/sdm/libs/hwc/hwc_session.cpp
@@ -45,6 +45,7 @@
#include <sync/sync.h>
#include <profiler.h>
#include <bitset>
+#include <vector>
#include "hwc_buffer_allocator.h"
#include "hwc_buffer_sync_handler.h"
@@ -184,6 +185,7 @@
return -errno;
}
+ connected_displays_[HWC_DISPLAY_PRIMARY] = 1;
return 0;
}
@@ -201,6 +203,7 @@
DLOGE("Display core de-initialization failed. Error = %d", error);
}
+ connected_displays_[HWC_DISPLAY_PRIMARY] = 0;
return 0;
}
@@ -272,6 +275,7 @@
if (hwc_session->need_invalidate_) {
hwc_procs->invalidate(hwc_procs);
+ hwc_session->need_invalidate_ = false;
}
hwc_session->HandleSecureDisplaySession(displays);
@@ -636,16 +640,18 @@
if (disp == HWC_DISPLAY_EXTERNAL) {
status = HWCDisplayExternal::Create(core_intf_, &hwc_procs_, primary_width, primary_height,
qservice_, false, &hwc_display_[disp]);
+ connected_displays_[HWC_DISPLAY_EXTERNAL] = 1;
} else if (disp == HWC_DISPLAY_VIRTUAL) {
status = HWCDisplayVirtual::Create(core_intf_, &hwc_procs_, primary_width, primary_height,
content_list, &hwc_display_[disp]);
+ connected_displays_[HWC_DISPLAY_VIRTUAL] = 1;
} else {
DLOGE("Invalid display type");
return -1;
}
if (!status) {
- hwc_display_[disp]->SetSecureDisplay(secure_display_active_);
+ hwc_display_[disp]->SetSecureDisplay(secure_display_active_, true);
}
return status;
@@ -656,8 +662,10 @@
if (disp == HWC_DISPLAY_EXTERNAL) {
HWCDisplayExternal::Destroy(hwc_display_[disp]);
+ connected_displays_[HWC_DISPLAY_EXTERNAL] = 0;
} else if (disp == HWC_DISPLAY_VIRTUAL) {
HWCDisplayVirtual::Destroy(hwc_display_[disp]);
+ connected_displays_[HWC_DISPLAY_VIRTUAL] = 0;
} else {
DLOGE("Invalid display type");
return -1;
@@ -769,6 +777,10 @@
status = SetMixerResolution(input_parcel);
break;
+ case qService::IQService::GET_HDR_CAPABILITIES:
+ status = GetHdrCapabilities(input_parcel, output_parcel);
+ break;
+
default:
DLOGW("QService command = %d is not supported", command);
return -EINVAL;
@@ -1176,6 +1188,24 @@
return 0;
}
+android::status_t HWCSession::GetHdrCapabilities(const android::Parcel *input_parcel,
+ android::Parcel *output_parcel) {
+ // TODO(akumarkr): Get values from display intf
+ // uint32_t dpy = UINT32(input_parcel->readInt32());
+ std::vector<int32_t> supported_hdr_types;
+ supported_hdr_types.push_back(HAL_HDR_HDR10);
+ float max_luminance = 500.0;
+ float max_average_luminance = 200.0;
+ float min_luminance = 0.5;
+ if (output_parcel != nullptr) {
+ output_parcel->writeInt32Vector(supported_hdr_types);
+ output_parcel->writeFloat(max_luminance);
+ output_parcel->writeFloat(max_average_luminance);
+ output_parcel->writeFloat(min_luminance);
+ }
+ return 0;
+}
+
void HWCSession::DynamicDebug(const android::Parcel *input_parcel) {
int type = input_parcel->readInt32();
bool enable = (input_parcel->readInt32() > 0);
@@ -1580,9 +1610,18 @@
}
}
+ // Force flush on primary during transitions(secure<->non secure)
+ // when external displays are connected.
+ bool force_flush = false;
+ if ((connected_displays_[HWC_DISPLAY_PRIMARY] == 1) &&
+ ((connected_displays_[HWC_DISPLAY_EXTERNAL] == 1) ||
+ (connected_displays_[HWC_DISPLAY_VIRTUAL] == 1))) {
+ force_flush = true;
+ }
+
for (ssize_t dpy = static_cast<ssize_t>(HWC_NUM_DISPLAY_TYPES - 1); dpy >= 0; dpy--) {
if (hwc_display_[dpy]) {
- hwc_display_[dpy]->SetSecureDisplay(secure_display_active_);
+ hwc_display_[dpy]->SetSecureDisplay(secure_display_active_, force_flush);
}
}
}
diff --git a/msmcobalt/sdm/libs/hwc/hwc_session.h b/msm8998/sdm/libs/hwc/hwc_session.h
similarity index 96%
rename from msmcobalt/sdm/libs/hwc/hwc_session.h
rename to msm8998/sdm/libs/hwc/hwc_session.h
index 54b7260..c0dba84 100644
--- a/msmcobalt/sdm/libs/hwc/hwc_session.h
+++ b/msm8998/sdm/libs/hwc/hwc_session.h
@@ -125,6 +125,8 @@
android::Parcel *output_parcel);
android::status_t SetMixerResolution(const android::Parcel *input_parcel);
android::status_t SetDisplayPort(DisplayPort sdm_disp_port, int *hwc_disp_port);
+ android::status_t GetHdrCapabilities(const android::Parcel *input_parcel,
+ android::Parcel *output_parcel);
static Locker locker_;
CoreInterface *core_intf_ = NULL;
@@ -146,6 +148,7 @@
qService::QService *qservice_ = NULL;
bool is_hdmi_primary_ = false;
bool is_hdmi_yuv_ = false;
+ std::bitset<HWC_NUM_DISPLAY_TYPES> connected_displays_; // Bit mask of connected displays
};
} // namespace sdm
diff --git a/msmcobalt/sdm/libs/hwc2/Android.mk b/msm8998/sdm/libs/hwc2/Android.mk
similarity index 100%
rename from msmcobalt/sdm/libs/hwc2/Android.mk
rename to msm8998/sdm/libs/hwc2/Android.mk
diff --git a/msmcobalt/sdm/libs/hwc2/hwc_callbacks.cpp b/msm8998/sdm/libs/hwc2/hwc_callbacks.cpp
similarity index 100%
rename from msmcobalt/sdm/libs/hwc2/hwc_callbacks.cpp
rename to msm8998/sdm/libs/hwc2/hwc_callbacks.cpp
diff --git a/msmcobalt/sdm/libs/hwc2/hwc_callbacks.h b/msm8998/sdm/libs/hwc2/hwc_callbacks.h
similarity index 100%
rename from msmcobalt/sdm/libs/hwc2/hwc_callbacks.h
rename to msm8998/sdm/libs/hwc2/hwc_callbacks.h
diff --git a/msmcobalt/sdm/libs/hwc2/hwc_color_manager.cpp b/msm8998/sdm/libs/hwc2/hwc_color_manager.cpp
similarity index 86%
rename from msmcobalt/sdm/libs/hwc2/hwc_color_manager.cpp
rename to msm8998/sdm/libs/hwc2/hwc_color_manager.cpp
index a5cb821..c76f540 100644
--- a/msmcobalt/sdm/libs/hwc2/hwc_color_manager.cpp
+++ b/msm8998/sdm/libs/hwc2/hwc_color_manager.cpp
@@ -241,7 +241,7 @@
return -EFAULT;
} else {
frame_capture_data->buffer = reinterpret_cast<uint8_t *>(buffer);
- frame_capture_data->buffer_stride = buffer_info.alloc_buffer_info.stride;
+ frame_capture_data->buffer_stride = buffer_info.buffer_config.width;
frame_capture_data->buffer_size = buffer_info.alloc_buffer_info.size;
}
ret = hwc_display->FrameCaptureAsync(buffer_info, 1);
@@ -279,65 +279,67 @@
DisplayDetailEnhancerData de_data;
PPDETuningCfgData *de_tuning_cfg_data = reinterpret_cast<PPDETuningCfgData*>(params);
- if (!de_tuning_cfg_data->cfg_en) {
- de_data.override_flags = kOverrideDEEnable;
- de_data.enable = 0;
- } else {
- de_data.override_flags = kOverrideDEEnable;
- de_data.enable = 1;
+ if (de_tuning_cfg_data->cfg_pending == true) {
+ if (!de_tuning_cfg_data->cfg_en) {
+ de_data.override_flags = kOverrideDEEnable;
+ de_data.enable = 0;
+ } else {
+ de_data.override_flags = kOverrideDEEnable;
+ de_data.enable = 1;
- if (de_tuning_cfg_data->params.flags & kDeTuningFlagSharpFactor) {
- de_data.override_flags |= kOverrideDEEnable;
- de_data.sharp_factor = de_tuning_cfg_data->params.sharp_factor;
- }
+ if (de_tuning_cfg_data->params.flags & kDeTuningFlagSharpFactor) {
+ de_data.override_flags |= kOverrideDESharpen1;
+ de_data.sharp_factor = de_tuning_cfg_data->params.sharp_factor;
+ }
- if (de_tuning_cfg_data->params.flags & kDeTuningFlagClip) {
- de_data.override_flags |= kOverrideDEEnable;
- de_data.clip = de_tuning_cfg_data->params.clip;
- }
+ if (de_tuning_cfg_data->params.flags & kDeTuningFlagClip) {
+ de_data.override_flags |= kOverrideDEClip;
+ de_data.clip = de_tuning_cfg_data->params.clip;
+ }
- if (de_tuning_cfg_data->params.flags & kDeTuningFlagThrQuiet) {
- de_data.override_flags |= kOverrideDEEnable;
- de_data.thr_quiet = de_tuning_cfg_data->params.thr_quiet;
- }
+ if (de_tuning_cfg_data->params.flags & kDeTuningFlagThrQuiet) {
+ de_data.override_flags |= kOverrideDEThrQuiet;
+ de_data.thr_quiet = de_tuning_cfg_data->params.thr_quiet;
+ }
- if (de_tuning_cfg_data->params.flags & kDeTuningFlagThrDieout) {
- de_data.override_flags |= kOverrideDEEnable;
- de_data.thr_dieout = de_tuning_cfg_data->params.thr_dieout;
- }
+ if (de_tuning_cfg_data->params.flags & kDeTuningFlagThrDieout) {
+ de_data.override_flags |= kOverrideDEThrDieout;
+ de_data.thr_dieout = de_tuning_cfg_data->params.thr_dieout;
+ }
- if (de_tuning_cfg_data->params.flags & kDeTuningFlagThrLow) {
- de_data.override_flags |= kOverrideDEEnable;
- de_data.thr_low = de_tuning_cfg_data->params.thr_low;
- }
+ if (de_tuning_cfg_data->params.flags & kDeTuningFlagThrLow) {
+ de_data.override_flags |= kOverrideDEThrLow;
+ de_data.thr_low = de_tuning_cfg_data->params.thr_low;
+ }
- if (de_tuning_cfg_data->params.flags & kDeTuningFlagThrHigh) {
- de_data.override_flags |= kOverrideDEEnable;
- de_data.thr_high = de_tuning_cfg_data->params.thr_high;
- }
+ if (de_tuning_cfg_data->params.flags & kDeTuningFlagThrHigh) {
+ de_data.override_flags |= kOverrideDEThrHigh;
+ de_data.thr_high = de_tuning_cfg_data->params.thr_high;
+ }
- if (de_tuning_cfg_data->params.flags & kDeTuningFlagContentQualLevel) {
- de_data.override_flags |= kOverrideDEEnable;
- switch (de_tuning_cfg_data->params.quality) {
- case kDeContentQualLow:
- de_data.quality_level = kContentQualityLow;
- break;
- case kDeContentQualMedium:
- de_data.quality_level = kContentQualityMedium;
- break;
- case kDeContentQualHigh:
- de_data.quality_level = kContentQualityHigh;
- break;
- case kDeContentQualUnknown:
- default:
- de_data.quality_level = kContentQualityUnknown;
- break;
+ if (de_tuning_cfg_data->params.flags & kDeTuningFlagContentQualLevel) {
+ switch (de_tuning_cfg_data->params.quality) {
+ case kDeContentQualLow:
+ de_data.quality_level = kContentQualityLow;
+ break;
+ case kDeContentQualMedium:
+ de_data.quality_level = kContentQualityMedium;
+ break;
+ case kDeContentQualHigh:
+ de_data.quality_level = kContentQualityHigh;
+ break;
+ case kDeContentQualUnknown:
+ default:
+ de_data.quality_level = kContentQualityUnknown;
+ break;
+ }
}
}
- }
- err = hwc_display->SetDetailEnhancerConfig(de_data);
- if (err) {
- DLOGW("SetDetailEnhancerConfig failed. err = %d", err);
+ err = hwc_display->SetDetailEnhancerConfig(de_data);
+ if (err) {
+ DLOGW("SetDetailEnhancerConfig failed. err = %d", err);
+ }
+ de_tuning_cfg_data->cfg_pending = false;
}
return err;
diff --git a/msmcobalt/sdm/libs/hwc2/hwc_color_manager.h b/msm8998/sdm/libs/hwc2/hwc_color_manager.h
similarity index 100%
rename from msmcobalt/sdm/libs/hwc2/hwc_color_manager.h
rename to msm8998/sdm/libs/hwc2/hwc_color_manager.h
diff --git a/msmcobalt/sdm/libs/hwc2/hwc_display.cpp b/msm8998/sdm/libs/hwc2/hwc_display.cpp
similarity index 98%
rename from msmcobalt/sdm/libs/hwc2/hwc_display.cpp
rename to msm8998/sdm/libs/hwc2/hwc_display.cpp
index 772d2c7..0f2b900 100644
--- a/msmcobalt/sdm/libs/hwc2/hwc_display.cpp
+++ b/msm8998/sdm/libs/hwc2/hwc_display.cpp
@@ -386,6 +386,8 @@
LayerBuffer *layer_buffer = layer->input_buffer;
layer_buffer->width = UINT32(layer->dst_rect.right - layer->dst_rect.left);
layer_buffer->height = UINT32(layer->dst_rect.bottom - layer->dst_rect.top);
+ layer_buffer->unaligned_width = layer_buffer->width;
+ layer_buffer->unaligned_height = layer_buffer->height;
layer_buffer->acquire_fence_fd = -1;
layer_buffer->release_fence_fd = -1;
layer->src_rect.left = 0;
@@ -774,14 +776,22 @@
}
HWC2::Error HWCDisplay::AcceptDisplayChanges() {
- if (!validated_ && !layer_set_.empty()) {
+ if (layer_set_.empty()) {
+ return HWC2::Error::None;
+ }
+
+ if (!validated_) {
return HWC2::Error::NotValidated;
}
for (const auto& change : layer_changes_) {
auto hwc_layer = layer_map_[change.first];
auto composition = change.second;
- hwc_layer->UpdateClientCompositionType(composition);
+ if (hwc_layer != nullptr) {
+ hwc_layer->UpdateClientCompositionType(composition);
+ } else {
+ DLOGW("Invalid layer: %" PRIu64, change.first);
+ }
}
return HWC2::Error::None;
}
@@ -1318,6 +1328,8 @@
client_target_layer->input_buffer->format = GetSDMFormat(format, flags);
client_target_layer->input_buffer->width = UINT32(aligned_width);
client_target_layer->input_buffer->height = UINT32(aligned_height);
+ client_target_layer->input_buffer->unaligned_width = x_pixels;
+ client_target_layer->input_buffer->unaligned_height = y_pixels;
client_target_layer->plane_alpha = 255;
DLOGI("New framebuffer resolution (%dx%d)", fb_config.x_pixels, fb_config.y_pixels);
@@ -1472,6 +1484,8 @@
LayerBuffer *layer_buffer = solid_fill_layer_->input_buffer;
layer_buffer->width = primary_width;
layer_buffer->height = primary_height;
+ layer_buffer->unaligned_width = primary_width;
+ layer_buffer->unaligned_height = primary_height;
layer_buffer->acquire_fence_fd = -1;
layer_buffer->release_fence_fd = -1;
diff --git a/msmcobalt/sdm/libs/hwc2/hwc_display.h b/msm8998/sdm/libs/hwc2/hwc_display.h
similarity index 100%
rename from msmcobalt/sdm/libs/hwc2/hwc_display.h
rename to msm8998/sdm/libs/hwc2/hwc_display.h
diff --git a/msmcobalt/sdm/libs/hwc2/hwc_display_external.cpp b/msm8998/sdm/libs/hwc2/hwc_display_external.cpp
similarity index 100%
rename from msmcobalt/sdm/libs/hwc2/hwc_display_external.cpp
rename to msm8998/sdm/libs/hwc2/hwc_display_external.cpp
diff --git a/msmcobalt/sdm/libs/hwc2/hwc_display_external.h b/msm8998/sdm/libs/hwc2/hwc_display_external.h
similarity index 100%
rename from msmcobalt/sdm/libs/hwc2/hwc_display_external.h
rename to msm8998/sdm/libs/hwc2/hwc_display_external.h
diff --git a/msmcobalt/sdm/libs/hwc2/hwc_display_primary.cpp b/msm8998/sdm/libs/hwc2/hwc_display_primary.cpp
similarity index 96%
rename from msmcobalt/sdm/libs/hwc2/hwc_display_primary.cpp
rename to msm8998/sdm/libs/hwc2/hwc_display_primary.cpp
index 198eddb..a99a8b1 100644
--- a/msmcobalt/sdm/libs/hwc2/hwc_display_primary.cpp
+++ b/msm8998/sdm/libs/hwc2/hwc_display_primary.cpp
@@ -403,11 +403,16 @@
}
static void SetLayerBuffer(const BufferInfo &output_buffer_info, LayerBuffer *output_buffer) {
- output_buffer->width = output_buffer_info.buffer_config.width;
- output_buffer->height = output_buffer_info.buffer_config.height;
- output_buffer->format = output_buffer_info.buffer_config.format;
- output_buffer->planes[0].fd = output_buffer_info.alloc_buffer_info.fd;
- output_buffer->planes[0].stride = output_buffer_info.alloc_buffer_info.stride;
+ const BufferConfig& buffer_config = output_buffer_info.buffer_config;
+ const AllocatedBufferInfo &alloc_buffer_info = output_buffer_info.alloc_buffer_info;
+
+ output_buffer->width = alloc_buffer_info.aligned_width;
+ output_buffer->height = alloc_buffer_info.aligned_height;
+ output_buffer->unaligned_width = buffer_config.width;
+ output_buffer->unaligned_height = buffer_config.height;
+ output_buffer->format = buffer_config.format;
+ output_buffer->planes[0].fd = alloc_buffer_info.fd;
+ output_buffer->planes[0].stride = alloc_buffer_info.stride;
}
void HWCDisplayPrimary::HandleFrameOutput() {
diff --git a/msmcobalt/sdm/libs/hwc2/hwc_display_primary.h b/msm8998/sdm/libs/hwc2/hwc_display_primary.h
similarity index 100%
rename from msmcobalt/sdm/libs/hwc2/hwc_display_primary.h
rename to msm8998/sdm/libs/hwc2/hwc_display_primary.h
diff --git a/msmcobalt/sdm/libs/hwc2/hwc_display_virtual.cpp b/msm8998/sdm/libs/hwc2/hwc_display_virtual.cpp
similarity index 92%
rename from msmcobalt/sdm/libs/hwc2/hwc_display_virtual.cpp
rename to msm8998/sdm/libs/hwc2/hwc_display_virtual.cpp
index 787640c..5436faa 100644
--- a/msmcobalt/sdm/libs/hwc2/hwc_display_virtual.cpp
+++ b/msm8998/sdm/libs/hwc2/hwc_display_virtual.cpp
@@ -188,12 +188,18 @@
return HWC2::Error::BadParameter;
}
- int output_buffer_width, output_buffer_height;
- AdrenoMemInfo::getInstance().getAlignedWidthAndHeight(output_handle, output_buffer_width,
- output_buffer_height);
+ int aligned_width, aligned_height;
+ int unaligned_width, unaligned_height;
- output_buffer_->width = UINT32(output_buffer_width);
- output_buffer_->height = UINT32(output_buffer_height);
+ AdrenoMemInfo::getInstance().getAlignedWidthAndHeight(output_handle, aligned_width,
+ aligned_height);
+ AdrenoMemInfo::getInstance().getUnalignedWidthAndHeight(output_handle, unaligned_width,
+ unaligned_height);
+
+ output_buffer_->width = UINT32(aligned_width);
+ output_buffer_->height = UINT32(aligned_height);
+ output_buffer_->unaligned_width = UINT32(unaligned_width);
+ output_buffer_->unaligned_height = UINT32(unaligned_height);
// TODO(mkavm): Handle DRC and metadata changes
output_buffer_->flags.secure = 0;
output_buffer_->flags.video = 0;
diff --git a/msmcobalt/sdm/libs/hwc2/hwc_display_virtual.h b/msm8998/sdm/libs/hwc2/hwc_display_virtual.h
similarity index 100%
rename from msmcobalt/sdm/libs/hwc2/hwc_display_virtual.h
rename to msm8998/sdm/libs/hwc2/hwc_display_virtual.h
diff --git a/msmcobalt/sdm/libs/hwc2/hwc_layers.cpp b/msm8998/sdm/libs/hwc2/hwc_layers.cpp
similarity index 95%
rename from msmcobalt/sdm/libs/hwc2/hwc_layers.cpp
rename to msm8998/sdm/libs/hwc2/hwc_layers.cpp
index a18cb4a..f4ae584 100644
--- a/msmcobalt/sdm/libs/hwc2/hwc_layers.cpp
+++ b/msm8998/sdm/libs/hwc2/hwc_layers.cpp
@@ -75,8 +75,18 @@
}
LayerBuffer *layer_buffer = layer_->input_buffer;
- layer_buffer->width = UINT32(handle->width);
- layer_buffer->height = UINT32(handle->height);
+ int aligned_width, aligned_height;
+ int unaligned_width, unaligned_height;
+
+ AdrenoMemInfo::getInstance().getAlignedWidthAndHeight(handle, aligned_width, aligned_height);
+ AdrenoMemInfo::getInstance().getUnalignedWidthAndHeight(handle, unaligned_width,
+ unaligned_height);
+
+ layer_buffer->width = UINT32(aligned_width);
+ layer_buffer->height = UINT32(aligned_height);
+ layer_buffer->unaligned_width = UINT32(unaligned_width);
+ layer_buffer->unaligned_height = UINT32(unaligned_height);
+
layer_buffer->format = GetSDMFormat(handle->format, handle->flags);
if (SetMetaData(handle, layer_) != kErrorNone) {
return HWC2::Error::BadLayer;
@@ -88,6 +98,9 @@
// TZ Protected Buffer - L1
if (handle->flags & private_handle_t::PRIV_FLAGS_SECURE_BUFFER) {
layer_buffer->flags.secure = true;
+ if (handle->flags & private_handle_t::PRIV_FLAGS_CAMERA_WRITE) {
+ layer_buffer->flags.secure_camera = true;
+ }
}
if (handle->flags & private_handle_t::PRIV_FLAGS_SECURE_DISPLAY) {
layer_buffer->flags.secure_display = true;
@@ -97,6 +110,7 @@
layer_buffer->planes[0].offset = handle->offset;
layer_buffer->planes[0].stride = UINT32(handle->width);
layer_buffer->acquire_fence_fd = acquire_fence;
+ layer_buffer->size = handle->size;
layer_buffer->buffer_id = reinterpret_cast<uint64_t>(handle);
return HWC2::Error::None;
@@ -456,14 +470,6 @@
layer_buffer->format = GetSDMFormat(INT32(meta_data->linearFormat), 0);
}
- if (meta_data->operation & UPDATE_BUFFER_GEOMETRY) {
- int actual_width = pvt_handle->width;
- int actual_height = pvt_handle->height;
- AdrenoMemInfo::getInstance().getAlignedWidthAndHeight(pvt_handle, actual_width, actual_height);
- layer_buffer->width = UINT32(actual_width);
- layer_buffer->height = UINT32(actual_height);
- }
-
if (meta_data->operation & S3D_FORMAT) {
layer_buffer->s3d_format = GetS3DFormat(meta_data->s3dFormat);
}
diff --git a/msmcobalt/sdm/libs/hwc2/hwc_layers.h b/msm8998/sdm/libs/hwc2/hwc_layers.h
similarity index 100%
rename from msmcobalt/sdm/libs/hwc2/hwc_layers.h
rename to msm8998/sdm/libs/hwc2/hwc_layers.h
diff --git a/msmcobalt/sdm/libs/hwc2/hwc_session.cpp b/msm8998/sdm/libs/hwc2/hwc_session.cpp
similarity index 99%
rename from msmcobalt/sdm/libs/hwc2/hwc_session.cpp
rename to msm8998/sdm/libs/hwc2/hwc_session.cpp
index 66ab568..96111d9 100644
--- a/msmcobalt/sdm/libs/hwc2/hwc_session.cpp
+++ b/msm8998/sdm/libs/hwc2/hwc_session.cpp
@@ -215,7 +215,8 @@
// HWC2 functions returned in GetFunction
// Defined in the same order as in the HWC2 header
-static int32_t AcceptDisplayChanges(hwc2_device_t *device, hwc2_display_t display) {
+int32_t HWCSession::AcceptDisplayChanges(hwc2_device_t *device, hwc2_display_t display) {
+ SCOPE_LOCK(locker_);
return HWCSession::CallDisplayFunction(device, display, &HWCDisplay::AcceptDisplayChanges);
}
@@ -590,7 +591,7 @@
switch (descriptor) {
case HWC2::FunctionDescriptor::AcceptDisplayChanges:
- return AsFP<HWC2_PFN_ACCEPT_DISPLAY_CHANGES>(AcceptDisplayChanges);
+ return AsFP<HWC2_PFN_ACCEPT_DISPLAY_CHANGES>(HWCSession::AcceptDisplayChanges);
case HWC2::FunctionDescriptor::CreateLayer:
return AsFP<HWC2_PFN_CREATE_LAYER>(CreateLayer);
case HWC2::FunctionDescriptor::CreateVirtualDisplay:
diff --git a/msmcobalt/sdm/libs/hwc2/hwc_session.h b/msm8998/sdm/libs/hwc2/hwc_session.h
similarity index 98%
rename from msmcobalt/sdm/libs/hwc2/hwc_session.h
rename to msm8998/sdm/libs/hwc2/hwc_session.h
index ce3e27f..7ae59ed 100644
--- a/msmcobalt/sdm/libs/hwc2/hwc_session.h
+++ b/msm8998/sdm/libs/hwc2/hwc_session.h
@@ -82,6 +82,7 @@
// HWC2 Functions that require a concrete implementation in hwc session
// and hence need to be member functions
+ static int32_t AcceptDisplayChanges(hwc2_device_t *device, hwc2_display_t display);
static int32_t CreateLayer(hwc2_device_t *device, hwc2_display_t display,
hwc2_layer_t *out_layer_id);
static int32_t CreateVirtualDisplay(hwc2_device_t *device, uint32_t width, uint32_t height,
diff --git a/msmcobalt/sdm/libs/utils/Android.mk b/msm8998/sdm/libs/utils/Android.mk
similarity index 100%
rename from msmcobalt/sdm/libs/utils/Android.mk
rename to msm8998/sdm/libs/utils/Android.mk
diff --git a/msmcobalt/sdm/libs/utils/Makefile.am b/msm8998/sdm/libs/utils/Makefile.am
similarity index 85%
rename from msmcobalt/sdm/libs/utils/Makefile.am
rename to msm8998/sdm/libs/utils/Makefile.am
index 5b0eaab..ba6efae 100644
--- a/msmcobalt/sdm/libs/utils/Makefile.am
+++ b/msm8998/sdm/libs/utils/Makefile.am
@@ -7,4 +7,5 @@
libsdmutils_la_CC = @CC@
libsdmutils_la_SOURCES = $(cpp_sources)
libsdmutils_la_CFLAGS = $(COMMON_CFLAGS) -DLOG_TAG=\"SDM\"
-libsdmutils_la_CPPFLAGS = $(AM_CPPFLAGS)
\ No newline at end of file
+libsdmutils_la_CPPFLAGS = $(AM_CPPFLAGS)
+libsdmutils_la_LDFLAGS = -shared -avoid-version
\ No newline at end of file
diff --git a/msmcobalt/sdm/libs/utils/debug.cpp b/msm8998/sdm/libs/utils/debug.cpp
similarity index 88%
rename from msmcobalt/sdm/libs/utils/debug.cpp
rename to msm8998/sdm/libs/utils/debug.cpp
index cf60a37..fc8567a 100644
--- a/msmcobalt/sdm/libs/utils/debug.cpp
+++ b/msm8998/sdm/libs/utils/debug.cpp
@@ -30,6 +30,8 @@
#include <stdlib.h>
#include <utils/debug.h>
#include <utils/constants.h>
+#include <string>
+#include <algorithm>
namespace sdm {
@@ -161,6 +163,29 @@
return (value == 1);
}
+DisplayError Debug::GetMixerResolution(uint32_t *width, uint32_t *height) {
+ char value[64] = {};
+
+ DisplayError error = debug_.debug_handler_->GetProperty("sdm.mixer_resolution", value);
+ if (error !=kErrorNone) {
+ return error;
+ }
+
+ std::string str(value);
+
+ *width = UINT32(stoi(str));
+ *height = UINT32(stoi(str.substr(str.find('x') + 1)));
+
+ return kErrorNone;
+}
+
+int Debug::GetExtMaxlayers() {
+ int max_external_layers = 0;
+ debug_.debug_handler_->GetProperty("sdm.max_external_layers", &max_external_layers);
+
+ return std::max(max_external_layers, 2);
+}
+
bool Debug::GetProperty(const char* property_name, char* value) {
if (debug_.debug_handler_->GetProperty(property_name, value) != kErrorNone) {
return false;
diff --git a/msmcobalt/sdm/libs/utils/formats.cpp b/msm8998/sdm/libs/utils/formats.cpp
similarity index 100%
rename from msmcobalt/sdm/libs/utils/formats.cpp
rename to msm8998/sdm/libs/utils/formats.cpp
diff --git a/msmcobalt/sdm/libs/utils/rect.cpp b/msm8998/sdm/libs/utils/rect.cpp
similarity index 92%
rename from msmcobalt/sdm/libs/utils/rect.cpp
rename to msm8998/sdm/libs/utils/rect.cpp
index 3213b62..fc553a3 100644
--- a/msmcobalt/sdm/libs/utils/rect.cpp
+++ b/msm8998/sdm/libs/utils/rect.cpp
@@ -199,12 +199,16 @@
}
}
-void ScaleRect(const LayerRect &src_domain, const LayerRect &dst_domain, const LayerRect &in_rect,
- LayerRect *out_rect) {
+void MapRect(const LayerRect &src_domain, const LayerRect &dst_domain, const LayerRect &in_rect,
+ LayerRect *out_rect) {
if (!IsValid(src_domain) || !IsValid(dst_domain) || !IsValid(in_rect)) {
return;
}
+ int x_offset = INT(src_domain.left);
+ int y_offset = INT(src_domain.top);
+
+ LayerRect modified_in_rect = Reposition(in_rect, -x_offset, -y_offset);
float src_domain_width = src_domain.right - src_domain.left;
float src_domain_height = src_domain.bottom - src_domain.top;
float dst_domain_width = dst_domain.right - dst_domain.left;
@@ -213,10 +217,10 @@
float width_ratio = dst_domain_width / src_domain_width;
float height_ratio = dst_domain_height / src_domain_height;
- out_rect->left = width_ratio * in_rect.left;
- out_rect->top = height_ratio * in_rect.top;
- out_rect->right = width_ratio * in_rect.right;
- out_rect->bottom = height_ratio * in_rect.bottom;
+ out_rect->left = dst_domain.left + (width_ratio * modified_in_rect.left);
+ out_rect->top = dst_domain.top + (height_ratio * modified_in_rect.top);
+ out_rect->right = dst_domain.left + (width_ratio * modified_in_rect.right);
+ out_rect->bottom = dst_domain.top + (height_ratio * modified_in_rect.bottom);
}
RectOrientation GetOrientation(const LayerRect &in_rect) {
diff --git a/msmcobalt/sdm/libs/utils/sys.cpp b/msm8998/sdm/libs/utils/sys.cpp
similarity index 98%
rename from msmcobalt/sdm/libs/utils/sys.cpp
rename to msm8998/sdm/libs/utils/sys.cpp
index 0d1ab0e..f5e0f29 100644
--- a/msmcobalt/sdm/libs/utils/sys.cpp
+++ b/msm8998/sdm/libs/utils/sys.cpp
@@ -45,6 +45,7 @@
// Pointer to actual driver interfaces.
Sys::ioctl Sys::ioctl_ = ::ioctl;
+Sys::access Sys::access_ = ::access;
Sys::open Sys::open_ = ::open;
Sys::close Sys::close_ = ::close;
Sys::poll Sys::poll_ = ::poll;